Skip to content

Commit 7e93ce6

Browse files
georgiclaude
andauthored
feat: version history for sketches (image documents) (#4719)
* feat: sketch document version history — data layer Mirror timeline sequence versioning (#4712) for sketches: an image_document_versions table with a per-document monotonic version number, an ImageDocumentVersion model (snapshot with unique-violation retry, autosave pruning that never touches manual/restore snapshots), the migration plus PG bootstrap DDL, and the protocol schemas for the document-level version history distinct from per-layer generation takes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018yzrorMvguPf5DMZjMRNP8 * feat: sketch document version history — router, CLI, harness The sketch tRPC router gains a documentVersions sub-router (list, get, create, restore, delete) alongside the existing per-layer generation takes: restore snapshots the pre-restore state first so it is undoable, sketch.update writes a best-effort autosave at most every five minutes (20 kept, pruned), and sketch.delete removes the document's history. nodetool sketch versions list|show|create|restore|delete reads and writes the same history against the local database; restore CAS-writes the snapshot back and exits non-zero when the restored document no longer parses as a JSON object. The sketch surface and its harness are registered in the harness registry, and CLAUDE.md documents the command. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018yzrorMvguPf5DMZjMRNP8 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent aee8432 commit 7e93ce6

22 files changed

Lines changed: 2459 additions & 5 deletions

CLAUDE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,30 @@ old document is restored against today's schema, so what it used to pass is not
667667
what it passes now — a restore whose document no longer validates exits
668668
non-zero and prints the issues.
669669

670+
### nodetool sketch versions (Sketch Version History)
671+
672+
`sketch versions` reads and writes an image document's snapshot history against
673+
the local database — manual saves, the autosaves `sketch.update` writes at most
674+
every five minutes, and the pre-restore snapshot that makes a restore undoable.
675+
The per-layer generation takes (`sketch.versions.*` in the tRPC router) are a
676+
different thing: those record one generated image on one layer, these snapshot
677+
the whole document. All five subcommands take `--json`.
678+
679+
```bash
680+
npm run dev:nodetool -- sketch versions list <image_document_id> --save-type manual --limit 10
681+
npm run dev:nodetool -- sketch versions show <image_document_id> 3 --json
682+
npm run dev:nodetool -- sketch versions create <image_document_id> --name "before the repaint"
683+
npm run dev:nodetool -- sketch versions restore <image_document_id> 3
684+
npm run dev:nodetool -- sketch versions delete <image_document_id> 3 --yes
685+
```
686+
687+
`restore` mirrors the tRPC router (`sketch.documentVersions.restore`): it
688+
snapshots the current state as a `restore` version, then CAS-writes the old
689+
document and its canvas settings back onto the image document. A sketch has no
690+
validator harness, so the check afterwards is the one a headless run can make —
691+
the restored document must still parse as a JSON object; one that no longer
692+
does exits non-zero. Layer bitmaps stay opaque to that check.
693+
670694
### Script voicing tools (no workflow, no browser)
671695

672696
An agent voices a script and cuts it without authoring a workflow:

0 commit comments

Comments
 (0)