From 1cb855712f069aa0242fadec63307e7d35e668a3 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Fri, 28 Nov 2025 21:49:52 -0800 Subject: [PATCH] fix(sync): cleanup snapshot files at end of sync (bd-0io) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cmd/bd/sync.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/bd/sync.go b/cmd/bd/sync.go index acc8330b..428c76a7 100644 --- a/cmd/bd/sync.go +++ b/cmd/bd/sync.go @@ -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") } },