Follow-up from the v3.0.0 unified-core design (deferred decision: ship flat-JSON first, migrate to SQLite later).
Context
v3.0.0 introduces a Platform.Storage/Repo interface (read/list/write/delete) with two backends:
- browser — IndexedDB (
AppDatabase)
- node/Bun — flat JSON files mapped 1:1 to the existing
/data/*.json files (settings, profile_history, scheduled_shots, recurring_schedules, annotations, cache, image dir), atomic temp-file+rename.
Flat JSON was chosen for zero-migration continuity with 2.x server users. SQLite was explicitly deferred to this issue.
Scope
- Add a SQLite-backed
Repo implementation for the node/Bun platform (via bun:sqlite), selected behind the same Storage interface — no core/handler changes.
- One-time, idempotent migration on first boot: import existing
/data/*.json into SQLite, keeping JSON as a backup (rename to *.json.bak), with a rollback path.
- Keep the browser (IndexedDB) backend as-is; this is server-side only.
- Preserve exact record shapes and the
/api/* contract (validated by the ported core contract-test suite).
Acceptance
Refs: docs/superpowers/specs/2026-07-02-unified-ts-core-bun-server-3.0.0-design.md, docs/superpowers/plans/2026-07-02-unified-ts-core-bun-server-3.0.0.md (Phase 4 persistence).
Follow-up from the v3.0.0 unified-core design (deferred decision: ship flat-JSON first, migrate to SQLite later).
Context
v3.0.0 introduces a
Platform.Storage/Repointerface (read/list/write/delete) with two backends:AppDatabase)/data/*.jsonfiles (settings, profile_history, scheduled_shots, recurring_schedules, annotations, cache, image dir), atomic temp-file+rename.Flat JSON was chosen for zero-migration continuity with 2.x server users. SQLite was explicitly deferred to this issue.
Scope
Repoimplementation for the node/Bun platform (viabun:sqlite), selected behind the sameStorageinterface — no core/handler changes./data/*.jsoninto SQLite, keeping JSON as a backup (rename to*.json.bak), with a rollback path./api/*contract (validated by the ported core contract-test suite).Acceptance
bun:sqliteRepo passes the same contract tests as the flat-JSON Repo./api/*responses; full core suite green.Refs:
docs/superpowers/specs/2026-07-02-unified-ts-core-bun-server-3.0.0-design.md,docs/superpowers/plans/2026-07-02-unified-ts-core-bun-server-3.0.0.md(Phase 4 persistence).