chore: bootstrap Claude setup

Add root CLAUDE.md, LESSONS.md, .env.example, .claude/settings.json
hooks (PostToolUse lint, Stop lint+test via bb dev:lint-and-test), and
a .gitea/workflows/ci.yml lint+test workflow. No development branch
exists here, so CI targets main; version.yml automation is skipped
since this repo already has its own tag-driven release/version flow
(scripts/bump-version.sh, build.yml on v* tags).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Sonnet 5 committed 2026-10-18 15:04:51 +02:00
1 parent b339cbb3b7
commit f4366407d8
8 files changed
+169 -1

No files matched your search

+1
View File
@@ -0,0 +1 @@
2
+29
View File
@@ -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
+25
View File
@@ -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"
}
]
}
]
}
}
+13
View File
@@ -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=
+41
View File
@@ -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
View File
@@ -27,6 +27,7 @@ cli/_opam/
# Env / secrets
.env
.env.*
!.env.example
*.pem
*.key
@@ -35,7 +36,7 @@ cli/_opam/
*.log
.vscode/
.idea/
.claude/
.claude/settings.local.json
# Python sidecar
sidecar/.venv/
+48
View File
@@ -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
View File
@@ -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.)