feat: append-only version history + bliss CLI ergonomics
Snapshot the code-bearing fields of routes (verb/path/handler), templates (name/content/test_object), and db libraries (name/library) on every content-changing save, so nothing edited is ever lost. Recorded in a new `versions` table via recordVersion() hooked into the create/update functions in db.js (the single write choke point), deduped against the latest snapshot so no-op saves, error-flag-only route writes, and server-restart WS re-bootstraps don't pile up. The live row stays current; old snapshots are the undo trail. Read-only, no revert UI yet. - migrations/004_add_versions.sql: versions table + indexes - db.js: recordVersion/getVersions/getVersion + create/update hooks - plumbing.js: /versions/:id and per-entity .../versions list endpoints - bliss: `versions <type> <sid> <id>` and `version <id>` reads; `update-settings` (edit route_prefix/head_injection, preserving the untouched field); `use <url>` sticky target persisted to ~/.bliss/target so BLISS_URL needn't be re-exported each call - client.js: target-file precedence (BLISS_URL > ~/.bliss/target > localhost) - SKILL.md: document the above Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
03a9d2143d
commit
42f4aacf7c
6 changed files with 211 additions and 7 deletions
21
plumbing.js
21
plumbing.js
|
|
@ -72,6 +72,27 @@ router.get(
|
|||
json((req) => model.getFilesForStruct(req.params.id)),
|
||||
);
|
||||
|
||||
// Version history (newest first) for a route handler, template, or db library.
|
||||
// Each row is a summary; fetch /versions/:versionId for the full snapshot.
|
||||
router.get(
|
||||
"/structures/:id/routes/:routeId/versions",
|
||||
json((req) => model.getVersions("route", req.params.routeId)),
|
||||
);
|
||||
router.get(
|
||||
"/structures/:id/templates/:templateId/versions",
|
||||
json((req) => model.getVersions("template", req.params.templateId)),
|
||||
);
|
||||
router.get(
|
||||
"/structures/:id/dbs/:dbId/versions",
|
||||
json((req) => model.getVersions("db", req.params.dbId)),
|
||||
);
|
||||
|
||||
// One version, including its full snapshot (the versioned fields).
|
||||
router.get(
|
||||
"/versions/:versionId",
|
||||
json((req) => model.getVersion(req.params.versionId)),
|
||||
);
|
||||
|
||||
// Logs for a route. ?since=<id> returns only newer rows (for polling).
|
||||
router.get(
|
||||
"/structures/:id/routes/:routeId/logs",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue