mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 23:36:20 +00:00
Merge pull request 'chore: bootstrap Claude setup' (#1) from chore/bootstrap into main
Reviewed-on: #1
This commit is contained in:
commit
21b9acfa4a
8 files changed
+169
-1
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
2
|
||||||
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# PostToolUse hook: lint/format the file that was just edited or written.
|
||||||
|
# Reads the hook JSON payload from stdin and dispatches by extension.
|
||||||
|
# Best-effort: missing tooling is reported but never blocks the edit.
|
||||||
|
set -u
|
||||||
|
|
||||||
|
payload="$(cat)"
|
||||||
|
file_path="$(printf '%s' "$payload" | sed -n 's/.*"file_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)"
|
||||||
|
|
||||||
|
[ -z "$file_path" ] && exit 0
|
||||||
|
[ -f "$file_path" ] || exit 0
|
||||||
|
|
||||||
|
repo_root="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
|
cd "$repo_root" || exit 0
|
||||||
|
|
||||||
|
case "$file_path" in
|
||||||
|
*.clj|*.cljs|*.cljc)
|
||||||
|
if command -v clojure >/dev/null 2>&1; then
|
||||||
|
clojure -M:clj-kondo --lint "$file_path" --cache false || true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
libs/*.ts|libs/*.tsx|libs/*.js)
|
||||||
|
if [ -f "libs/node_modules/.bin/prettier" ]; then
|
||||||
|
(cd libs && node_modules/.bin/prettier --write "${file_path#libs/}") || true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"PostToolUse": [
|
||||||
|
{
|
||||||
|
"matcher": "Edit|Write",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "bash .claude/hooks/lint-changed.sh"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Stop": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "bb dev:lint-and-test"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Build-time environment variables read by the build/CLI scripts.
|
||||||
|
# No runtime secrets are required to build or run this repo locally.
|
||||||
|
|
||||||
|
# Standard Node environment ("development" | "production").
|
||||||
|
NODE_ENV=
|
||||||
|
|
||||||
|
# Set to "1" to skip bundling the OCaml CLI into desktop releases
|
||||||
|
# (used in CI; see .gitea/workflows/build.yml).
|
||||||
|
LOGSEQ_SKIP_CLI_BUNDLE=
|
||||||
|
|
||||||
|
# Override the resolved CLI package version/build metadata (optional).
|
||||||
|
LOGSEQ_BUILD_TIME=
|
||||||
|
LOGSEQ_REVISION=
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
# Lint + unit tests, using the same `bb dev:lint-and-test` task documented in
|
||||||
|
# CLAUDE.md / AGENTS.md. Runs on pushes and on PRs against main (no
|
||||||
|
# `development` branch exists in this repo).
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint-and-test:
|
||||||
|
name: Lint and test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: "21"
|
||||||
|
|
||||||
|
- uses: DeLaGuardo/setup-clojure@13.1
|
||||||
|
with:
|
||||||
|
cli: 1.12.5.1664
|
||||||
|
bb: latest
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Lint and test
|
||||||
|
run: bb dev:lint-and-test
|
||||||
+2
-1
@@ -27,6 +27,7 @@ cli/_opam/
|
|||||||
# Env / secrets
|
# Env / secrets
|
||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
|
!.env.example
|
||||||
*.pem
|
*.pem
|
||||||
*.key
|
*.key
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ cli/_opam/
|
|||||||
*.log
|
*.log
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
.claude/
|
.claude/settings.local.json
|
||||||
|
|
||||||
# Python sidecar
|
# Python sidecar
|
||||||
sidecar/.venv/
|
sidecar/.venv/
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
Synapse is a personal fork of Logseq (DB-graph version): a self-hosted outliner/PKM with a
|
||||||
|
single daemon (`db-worker-node`) holding the authoritative graph, served to thin web,
|
||||||
|
Electron desktop, and Capacitor mobile (iOS/Android) clients over HTTP/WebSocket. Core app is
|
||||||
|
ClojureScript (shadow-cljs); supporting tools (CLI, scripts, libs) are Node/TypeScript, plus
|
||||||
|
an OCaml CLI companion and a Python embedding sidecar.
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
- Lint + unit tests: `bb dev:lint-and-test`
|
||||||
|
- Single test: `bb dev:test -v <namespace/testcase-name>`
|
||||||
|
- ClojureScript lint only: `pnpm cljs:lint` (clj-kondo)
|
||||||
|
- Unit tests only: `pnpm test` (compiles then runs cljs tests)
|
||||||
|
- App E2E: from `clj-e2e/`, `bb test`
|
||||||
|
- CLI E2E: `bb -f cli-e2e/bb.edn test --skip-build`
|
||||||
|
- Dev build (watch): `pnpm dev` / `pnpm watch` (web) / `pnpm electron-watch` / `pnpm mobile-watch`
|
||||||
|
- Release build: `pnpm release`, `pnpm release-electron`, `pnpm release-mobile`
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
See `AGENTS.md` for detailed engineering conventions and
|
||||||
|
`docs/agent-guide/implemented/architecture/2026-08-24-logseq-runtime-and-engineering-guide.md`
|
||||||
|
for runtime/sync/CLI/rendering/search architecture. Workspace packages: `deps/*` (common,
|
||||||
|
db, db-sync, outliner, graph-parser, publish(ing), shui), `cli/` (OCaml CLI), `libs/`
|
||||||
|
(published JS/TS SDK), `scripts/`, `sidecar/` (Python embedding server).
|
||||||
|
|
||||||
|
## Conventions
|
||||||
|
Full conventions live in `AGENTS.md` (coding style, i18n, testing, commit/PR rules) — read it
|
||||||
|
first; it takes precedence over this file for code changes. Directory-specific `AGENTS.md`
|
||||||
|
files override the root one.
|
||||||
|
|
||||||
|
## Workflow quirks
|
||||||
|
- Repo-local skills live under `.agents/skills/`; load the matching `SKILL.md` before editing
|
||||||
|
(i18n changes mandatorily require `.agents/skills/logseq-i18n/SKILL.md`).
|
||||||
|
- No `development` branch here: work on a task branch off `main`, PR into `main`.
|
||||||
|
- No local formatter is wired for the main ClojureScript app; `libs/` uses Prettier for its
|
||||||
|
own TS code.
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
Not a typical always-on web service: ships as Electron desktop, Capacitor mobile apps, and a
|
||||||
|
self-hosted `db-worker-node` daemon. See `deploy/logseq-daemon.service` (systemd unit) and
|
||||||
|
`deploy/Caddyfile` (reverse proxy) for the daemon-side deployment.
|
||||||
|
|
||||||
|
## Gotchas
|
||||||
|
- `cli/` (OCaml/dune CLI) is not built in CI yet (`LOGSEQ_SKIP_CLI_BUNDLE=1` in
|
||||||
|
`.gitea/workflows/build.yml`); don't assume CLI release steps run there.
|
||||||
|
- This repo uses Gitea (git.zenvairo.es), not GitHub: CI workflows live in
|
||||||
|
`.gitea/workflows/`, matching the existing `build.yml`.
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
# LESSONS.md
|
||||||
|
|
||||||
|
Recurring mistakes and how to avoid them. Read before starting work; add an entry whenever a
|
||||||
|
mistake repeats.
|
||||||
|
|
||||||
|
## Format
|
||||||
|
- **Mistake**: what went wrong.
|
||||||
|
- **Fix**: what to do instead.
|
||||||
|
|
||||||
|
(No entries yet.)
|
||||||
Reference in new issue
Block a user