From d55d2583a71ae35fa8d0d1bfbec975e67e66aafa Mon Sep 17 00:00:00 2001 From: cashmere Date: Mon, 27 Jul 2026 01:21:20 +0200 Subject: feat: git-like project versioning (v1) Linear per-project history per notes/project-versioning.md: named checkpoints (thumbnail via renderer.captureFrame) plus auto-checkpoints on save (60s throttle, ring of 20, named never rotate). Restore writes a safety checkpoint first, then swaps the document outside undo/redo. Media assets referenced by any version are pinned against deletion. Migration v31-v32 stamps the schema; the version store lives in its own IDB database with an in-memory fallback for tests. Versions popover in the editor header for jump/rename/delete. 12 new tests. --- apps/web/src/core/index.ts | 3 +++ apps/web/src/core/managers/save-manager.ts | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'apps/web/src/core') diff --git a/apps/web/src/core/index.ts b/apps/web/src/core/index.ts index 0977666f..40352737 100644 --- a/apps/web/src/core/index.ts +++ b/apps/web/src/core/index.ts @@ -10,6 +10,7 @@ import { AudioManager } from "./managers/audio-manager"; import { SelectionManager } from "./managers/selection-manager"; import { ClipboardManager } from "./managers/clipboard-manager"; import { DiagnosticsManager } from "./managers/diagnostics-manager"; +import { VersionsManager } from "@/versions"; import { registerDefaultEffects } from "@/effects"; import { registerDefaultMasks } from "@/masks"; import { registerTranscriptionDiagnostics } from "@/transcription/diagnostics"; @@ -28,6 +29,7 @@ export class EditorCore { public readonly selection: SelectionManager; public readonly clipboard: ClipboardManager; public readonly diagnostics: DiagnosticsManager; + public readonly versions: VersionsManager; private constructor() { registerDefaultEffects(); @@ -44,6 +46,7 @@ export class EditorCore { this.selection = new SelectionManager(this); this.clipboard = new ClipboardManager(this); this.diagnostics = new DiagnosticsManager(this); + this.versions = new VersionsManager({ editor: this }); registerTranscriptionDiagnostics({ diagnostics: this.diagnostics }); this.playback.bindTimelineScope(); this.command.registerReactor(() => { diff --git a/apps/web/src/core/managers/save-manager.ts b/apps/web/src/core/managers/save-manager.ts index 8cb2275a..26d8b323 100644 --- a/apps/web/src/core/managers/save-manager.ts +++ b/apps/web/src/core/managers/save-manager.ts @@ -96,6 +96,10 @@ export class SaveManager { try { await this.editor.project.saveCurrentProject(); + // Auto-checkpoint on every successful save; throttled internally. + this.editor.versions.writeAutoCheckpoint().catch((error) => { + console.error("Failed to write auto-checkpoint:", error); + }); } finally { this.isSaving = false; if (this.hasPendingSave) { -- cgit v1.3.1