Files
beardrive/architecture/overview.md
T
4031495c81 feat(cli,docs): say that agent skills sync, and refuse ~/.claude as a mount root (BEA-117) (#138)
`.claude/skills/**` has always synced — deliberately, per the reservation
rule's own comment — but the only sentence saying so sits under the heading
"What beardrive does not sync". Nobody knows.

Track B, the one real bug: `bdrive init ~/.claude` was accepted. The
reserved-path rule matches ".claude/settings.json" on its directory segment,
so at that mount root the file is bare "settings.json" — reserved by nothing —
along with .credentials.json and every saved session under projects/. New
exported config.AgentConfigDir folds the keys of agentHookConfigs the way
ReservedDir folds (case, trailing dots), and init refuses before any network
call or file write. Only that direction leaks: a mount CONTAINING ~/.claude
still sees .claude/settings.json, reserved at any depth.

Track A, the content job: a README Features bullet stating the positive claim,
a 7th use-case page (plus its astro.config.mjs sidebar entry, without which it
is invisible), and a `skills` template appended last to the registry so `docs`
keeps the RECOMMENDED badge. The embed directive becomes `//go:embed all:files`
— a plain pattern drops dot-prefixed paths silently, so the template whose
whole payload is .claude/skills/<name>/SKILL.md would have shipped empty.

templates_test.go's every-directory-holds-a-file rule now marks ancestors, not
just the direct parent: skills is the first template more than one level deep,
and the rule was stricter than its own stated reason (an intermediate
directory on the way to a file is not empty).

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 05:04:12 +09:00

2.6 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"]
    end

    subgraph hub["bdrive serve 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"]

    tpl["internal/templates<br/>go:embed'ed starting structures<br/>(docs, wiki, para, skills: skeleton + AGENTS.md)"]

    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
    srv --> store
    srv --> meta
    cli -->|"init --template: seed locally"| tpl
    srv -->|"POST /api/projects template:<br/>seed as ops under the hub's device"| tpl
    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).