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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user