chore: bootstrap Claude setup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-21 03:16:48 +02:00
commit 7f5c7738e5
13 files changed
+211

No files matched your search

+1
View File
@@ -0,0 +1 @@
2
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# PostToolUse (Edit/Write): format the changed file. Never blocks.
f=$(jq -r '.tool_input.file_path // empty' 2>/dev/null)
[ -n "$f" ] && [ -f "$f" ] || exit 0
case "$f" in
*.rs) command -v rustfmt >/dev/null && rustfmt --edition 2021 -q "$f" 2>/dev/null ;;
*.dart) command -v dart >/dev/null && dart format -o write "$f" >/dev/null 2>&1 ;;
esac
exit 0
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Stop hook: lint + tests must pass before the turn ends (exit 2 blocks).
cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" || exit 0
fail() { echo "$1 failed:" >&2; echo "$2" | tail -40 >&2; exit 2; }
if [ -f Cargo.toml ]; then
out=$(cargo clippy --workspace --all-targets -q -- -D warnings 2>&1) || fail clippy "$out"
out=$(cargo test --workspace -q 2>&1) || fail "cargo test" "$out"
fi
if [ -f app/pubspec.yaml ] && command -v flutter >/dev/null; then
out=$(cd app && flutter analyze 2>&1) || fail "flutter analyze" "$out"
fi
exit 0
+15
View File
@@ -0,0 +1,15 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [{ "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/format.sh" }]
}
],
"Stop": [
{
"hooks": [{ "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/stop-check.sh", "timeout": 900 }]
}
]
}
}
+10
View File
@@ -0,0 +1,10 @@
# Synapse server configuration (names only; never commit real values).
# Address the sync server listens on, e.g. 127.0.0.1:7878
SYNAPSE_BIND=
# Directory holding server-side graphs and blobs
SYNAPSE_DATA_DIR=
# Bearer token clients must present (generate a long random string)
SYNAPSE_AUTH_TOKEN=
# Log filter, e.g. info,synapse_server=debug
RUST_LOG=
+42
View File
@@ -0,0 +1,42 @@
name: ci
on:
pull_request:
branches: [development]
push:
branches: [development, main]
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Lint
run: |
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
- name: Test
run: cargo test --workspace
flutter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
if: hashFiles('app/pubspec.yaml') != ''
with:
channel: stable
cache: true
- name: Lint
if: hashFiles('app/pubspec.yaml') != ''
working-directory: app
run: |
flutter pub get
flutter analyze
- name: Test
if: hashFiles('app/test/**') != ''
working-directory: app
run: flutter test
+50
View File
@@ -0,0 +1,50 @@
name: version
on:
push:
branches: [development, main]
permissions:
contents: write
jobs:
bump:
if: >-
!contains(github.event.head_commit.message, '[skip ci]') &&
github.actor != 'github-actions[bot]' && github.actor != 'gitea-actions'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Bump version
env:
BEFORE: ${{ github.event.before }}
run: |
set -euo pipefail
git config user.name "version-bot"
git config user.email "version-bot@noreply.local"
branch="$GITHUB_REF_NAME"
IFS=. read -r MA MI PA < VERSION
if [ "$branch" = development ]; then
PA=$((PA + 1))
else
git fetch origin development
zero=0000000000000000000000000000000000000000
# MINOR bump only if every non-merge commit in this push is already on development.
if [ -n "$BEFORE" ] && [ "$BEFORE" != "$zero" ] &&
[ -z "$(git rev-list --no-merges "$BEFORE..HEAD" --not origin/development)" ]; then
MI=$((MI + 1)); PA=0
else
PA=$((PA + 1))
fi
fi
new="$MA.$MI.$PA"
echo "$new" > VERSION
git commit -am "chore(release): v$new [skip ci]"
git push origin HEAD:"$branch"
if [ "$branch" = main ]; then
main_sha=$(git rev-parse HEAD)
git checkout -B development origin/development
git merge --no-ff -m "chore: merge main into development [skip ci]" "$main_sha"
git push origin development
fi
+3
View File
@@ -0,0 +1,3 @@
/target
.env
.claude/settings.local.json
+46
View File
@@ -0,0 +1,46 @@
# Synapse
## Overview
Native "second brain" notes app (Logseq-like outliner with linked pages and journals) for
Android, Linux and Windows. Rust core shared by a Flutter client (via flutter_rust_bridge)
and an optional self-hosted sync server. Local-only (standalone graph) or client-server
(online graph). No webviews.
## Commands
- Format: `cargo fmt --all` (Rust), `dart format app/` (Flutter)
- Lint: `cargo clippy --workspace --all-targets -- -D warnings`, `cd app && flutter analyze`
- Test: `cargo test --workspace`, `cd app && flutter test`
- Run server: `cargo run -p synapse-server`
- Run app: `cd app && flutter run -d linux` (or `-d windows`, an Android device)
- Regenerate FFI bindings: `cd app && flutter_rust_bridge_codegen generate`
## Architecture
Cargo workspace under `crates/`, Flutter app under `app/`. Details in `docs/architecture.md`,
roadmap in `docs/plan.md`.
- `synapse-core`: domain model (blocks, pages, journals, typed links), SQLite store, blob store.
- `synapse-search`: full-text (tantivy) + vector index; auto-link suggestions.
- `synapse-import`: Logseq graph importer (pages, journals, assets).
- `synapse-ai`: provider-agnostic LLM/embeddings clients (user-supplied API keys).
- `synapse-history`: automatic git-like snapshots of the graph.
- `synapse-caldav`: CalDAV calendar + VTODO tasks.
- `synapse-sync` / `synapse-server`: client-server protocol and axum server.
- `synapse-ffi`: the only API surface exposed to Flutter.
## Conventions
- The Flutter app never touches storage directly; everything goes through `synapse-ffi`.
- Core crates are sync-free of UI concerns and must compile for Android (no desktop-only deps
in `synapse-core`).
- IDs are UUIDv7 (time-ordered). Journals are keyed by local date `YYYY-MM-DD`.
- Heavy files go to the content-addressed blob store, never into SQLite rows.
- Version lives in the root `VERSION` file (bumped by CI only).
## Workflow quirks
- Hooks: `.claude/hooks/format.sh` formats after edits; `.claude/hooks/stop-check.sh` runs
clippy + tests before a turn ends.
## Deployment
- Server: see `docs/server.md` (LXC/VPS + systemd, per the `web-deploy` skill).
## Gotchas
- Logseq graphs mix `.md` and `.org`; the importer only parses Markdown fully and keeps org
files as raw blocks.
+3
View File
@@ -0,0 +1,3 @@
# Lessons
Recurring mistakes and how to avoid them. Add an entry when a mistake repeats.
+14
View File
@@ -0,0 +1,14 @@
# Synapse
A native, brain-like second brain: an outliner with linked pages, temporally chained journals,
semantic search, AI assistance and a self-hostable sync server. Runs natively on Android,
Linux and Windows (Rust core + Flutter UI, no webviews).
## Quick start
```bash
cargo test --workspace
cd app && flutter run -d linux
```
See [docs/](docs/README.md) for the plan and architecture.
+1
View File
@@ -0,0 +1 @@
0.1.0
+5
View File
@@ -0,0 +1,5 @@
# Docs
- [plan.md](plan.md): product scope and roadmap.
- [architecture.md](architecture.md): crates, data model, storage and sync design.
- [server.md](server.md): running and deploying the sync server.