Skip to content

feat: persistent library with source of truth and auto-merge#46

Merged
DipandaAser merged 14 commits into
mainfrom
feat/persistent-library
Mar 22, 2026
Merged

feat: persistent library with source of truth and auto-merge#46
DipandaAser merged 14 commits into
mainfrom
feat/persistent-library

Conversation

@DipandaAser

Copy link
Copy Markdown
Owner

Summary

Redesigns the app from a one-shot merge tool to a persistent library with a running source of truth.

New flow

  1. First visit: Import file A + file B → Merge → File C is saved as source of truth (★)
  2. Next visit: Add file D → auto-merges with file C → File E becomes the new truth
  3. Library screen lists all files: originals (deletable) and merged files (starred, protected)

Key changes

  • LibraryScreen — new home screen showing source of truth card, original files, merged files, "Add backup" and "Quick merge" buttons
  • Auto-merge — when a file is imported and a source of truth exists, merge starts automatically
  • Quick merge — standalone merge mode for one-off merges without affecting the library
  • Storage modelBackupMeta extended with isMerged, parentIds, isSourceOfTruth; IndexedDB migrated to v2
  • saveMergedBackup() — saves merged result to OPFS/IDB and promotes it to source of truth
  • Export screen — shows "Saved as source of truth" badge in library mode, "Back to library" button
  • 15+ new i18n keys in EN and FR

Test plan

  • Fresh app (no data): library shows empty state with "Import backups" CTA
  • Import 2 files via "Import backups" → merge → verify source of truth card appears in library
  • Add a new file → verify auto-merge starts against the truth
  • After merge, verify new source of truth replaces the old one
  • Download button on truth card works
  • Original files have delete button, merged files do NOT
  • "Quick merge" button opens old flow — merge & download without saving to library
  • Export screen shows ★ "Saved as source of truth" in library mode
  • "Back to library" button returns to library screen
  • Run pnpm --filter @jw-notes-sync/web check — 0 errors

🤖 Generated with Claude Code

Redesigns the app from a one-shot merge tool to a persistent library:

- Home screen is now a Library showing all stored files
- Merged files are marked with a star badge and cannot be deleted
- Latest merged file is the "source of truth"
- Adding a new backup auto-merges against the truth
- Quick merge button for standalone merges without persistence
- BackupMeta extended with isMerged, parentIds, isSourceOfTruth
- IndexedDB migrated to v2 with field backfill
- saveMergedBackup() saves result and promotes to truth
- Export screen shows "Saved as source of truth" in library mode
- 15+ new i18n keys in EN and FR
- No source of truth → show ImportScreen (hero + dropzone), not empty library
- Library screen only renders when a source of truth exists
- "Add backup" button directly opens file picker and triggers auto-merge
- Remove empty library state (no longer needed)
@DipandaAser DipandaAser self-assigned this Mar 22, 2026
@DipandaAser DipandaAser merged commit 80a611d into main Mar 22, 2026
1 check passed
@DipandaAser DipandaAser deleted the feat/persistent-library branch March 22, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant