bd-upd: Add snapshot cleanup to daemon sync function

After sync completion, orphan .base.jsonl and .left.jsonl files were
remaining in .beads/ directory. These are merge artifacts that should be
cleaned up after successful sync.

The fix adds SnapshotManager.Cleanup() call to createSyncFunc in
daemon_sync.go after successful import, matching the behavior of the CLI
sync command. Supports both single-repo and multi-repo modes.

🤖 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 17:42:41 -08:00
parent e7155d189e
commit 30197ee1ae

View File

@@ -762,6 +762,22 @@ func createSyncFunc(ctx context.Context, store storage.Storage, autoCommit, auto
}
}
// Clean up temporary snapshot files after successful merge (bd-upd)
// In multi-repo mode, clean up snapshots for all JSONL files
if multiRepoPaths != nil {
for _, path := range multiRepoPaths {
sm := NewSnapshotManager(path)
if err := sm.Cleanup(); err != nil {
log.log("Warning: failed to clean up snapshots for %s: %v", path, err)
}
}
} else {
sm := NewSnapshotManager(jsonlPath)
if err := sm.Cleanup(); err != nil {
log.log("Warning: failed to clean up snapshots: %v", err)
}
}
if autoPush && autoCommit {
if err := gitPush(syncCtx); err != nil {
log.log("Push failed: %v", err)