fix(sync): cleanup snapshot files at end of sync (bd-0io)

Add cleanup call at end of successful sync to ensure snapshot files
(beads.base.jsonl, beads.left.jsonl) are removed even when --no-pull
is used. Previously, captureLeftSnapshot was called before the pull
block, but cleanup was only inside the !noPull block, leaving orphaned
files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-28 21:49:52 -08:00
parent b97703dbee
commit 1cb855712f

View File

@@ -440,6 +440,14 @@ Use --merge to merge the sync branch back to main branch.`,
fmt.Fprintf(os.Stderr, "Warning: auto-compact deletions failed: %v\n", err)
}
// Clean up snapshot files after successful sync (bd-0io fix)
// This ensures snapshots are removed even when --no-pull is used,
// since captureLeftSnapshot is called before the pull block.
sm := NewSnapshotManager(jsonlPath)
if err := sm.Cleanup(); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to clean up snapshots: %v\n", err)
}
fmt.Println("\n✓ Sync complete")
}
},