mirror of
https://github.com/runbear-io/beardrive.git
synced 2026-08-25 08:08:08 +02:00
* fix(cli): agent hooks never sync folders this device didn't opt into The turn hooks decided "this folder is managed" from the mere presence of .bdrive/config.json — a file designed to travel with the folder. Two holes: - A config.json arriving via git clone / copied dir made one hook firing silently mint a device identity, register the mount, create a volume store, journal the whole folder, and inject the hub-link formula — on a device that never ran init or login. - `bdrive stop` only killed the daemon: the next agent turn's `bdrive sync --hook` resumed a full sync cycle and kept injecting links, and `stop --forget` was undone within one turn by registry self-heal. Fix: one gate (`syncBlocked`) in the paths all hooks route through — sync/sync --hook/read-log now require the mount to already be enrolled in this device's mounts.json (read without ResolveMount's enrolling self-heal) and not paused. Hook mode exits silently; plain `bdrive sync` errors with a `bdrive init` pointer. New per-device paused marker in the volume dir: set by `bdrive stop`, cleared by `bdrive init` (startSync). Only init enrolls or resumes; folder moves still self-heal since enrollment is keyed by mount id, not path. Docs updated (README, SKILL.md, docs cli reference, CHANGELOG). Tests: hook/read-log no-op + no-enrollment on unenrolled and paused mounts, plain-sync refusals, stop→pause→forget regression, paused marker contract. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: architecture-diagram PRs must show before/after excerpts of changed classes The "Architecture changes" PR section now names exactly what changed and shows Before and After mermaid excerpts scoped to the affected classes and their immediate relationships — never the full diagram (Before = merge base). Convention updated in CLAUDE.md, architecture/README.md, and the pre-PR hook's reminder text. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: add cli-sync architecture diagram; widen diagram convention to the CLI architecture/cli-sync.md draws the CLI and sync engine (cmd/bdrive + internal/{syncer,store,journal,config,daemon,agenthooks}): the Session cycle over Store/journal/remote, and the command layer with the new syncBlocked opt-in gate, paused marker, and enrollment ownership. The pre-PR hook and CLAUDE.md now watch these packages too, so CLI-side structural changes trigger the before/after-excerpt convention the same way server changes do. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: full-coverage architecture diagrams — overview, frontend, agentskills Every application package is now drawn somewhere: overview.md (system diagram — package map, device↔hub↔storage flow, agent surfaces, and the private cloud/ repo as an external seam consumer), webapp-frontend.md (the hub SPA's modules: App/HubApp/VolumeApp/Browser, the in-repo nav/router, api layer, hooks, components), and agentskills added to cli-sync.md. The pre-PR hook now watches all of cmd/, internal Go code, and frontend/src (generated static/ excluded); CLAUDE.md and architecture/README.md state the coverage rule: every code change lands in exactly one detail diagram's scope, web/docs and cloud/ deliberately excluded. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs: PR bodies start with a TL;DR — max 5 informal one-liners Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2.5 KiB
2.5 KiB
BearDrive — system overview
The whole repo on one page: every package and surface, and which detail diagram drills into it. Reflects the code as of this commit; update this file in any PR that adds/removes a package or changes how the pieces connect. Detail diagrams: cli-sync.md, webapp-server.md, webapp-frontend.md.
flowchart LR
subgraph device["User device"]
wf["working folder<br/>(real files + .bdrive/config.json)"]
cli["cmd/bdrive<br/>CLI commands"]
dmn["internal/daemon<br/>background loop"]
eng["internal/syncer Session.Cycle<br/>internal/journal ops + replay"]
vs["volume store ~/.bdrive/volumes/id<br/>internal/store: blobs, journals,<br/>state, paused marker"]
cfg["internal/config<br/>device.json, settings.json, mounts.json"]
end
subgraph agents["Agent platforms (claude / codex / gemini / hermes)"]
hooks["internal/agenthooks<br/>turn-boundary sync hooks"]
skills["internal/agentskills + plugin/<br/>SKILL.md, commands, hook scripts"]
end
subgraph hub["bdrive web hub"]
srv["internal/webapp Server<br/>auth, orgs, projects, shares,<br/>history, read heat, store proxy"]
fe["webapp/frontend React SPA<br/>committed dist go:embed'ed at webapp/static"]
meta["MetaStore: file JSON (default)<br/>or sqlite / postgres (db_sql)"]
end
store["object store (hub-owned)<br/>internal/remote: file:// s3:// gs://<br/>blobs + per-device journals"]
docs["web/docs — docs.beardrive.ai<br/>Astro/Starlight, deploys separately"]
cloud["cloud/ (PRIVATE nested repo, gitignored)<br/>managed beardrive.ai: swaps AuthProvider,<br/>QuotaProvider, MetaStore seams"]
wf <-->|scan / materialize| eng
cli --> eng
dmn --> eng
cli --> cfg
eng --> vs
eng <-->|"https:// backend (internal/remote/http.go)<br/>device token, /api/p/id/store/*"| srv
hooks -->|"bdrive sync --hook / --note, read-log<br/>gated: enrolled + not paused"| cli
skills -.->|teach agents the CLI| agents
srv --> store
srv --> meta
fe -->|/api/config, /api/projects, viewer APIs| srv
cloud -.->|imports OSS packages,<br/>replaces providers| srv
docs -.->|documents| cli
Not drawn in any detail diagram (deliberately): web/docs (content site, no
Go/TS application code) and cloud/ (private repo — its architecture lives
there; here it only consumes the provider seams drawn in webapp-server.md).