Merge branch 'main' into win-defender-mitigation

# Conflicts:
#	.beads/issues.jsonl
#	README.md
This commit is contained in:
Matt Wilkie
2025-10-14 14:04:20 -07:00
committed by maphew
82 changed files with 11477 additions and 3205 deletions

View File

@@ -129,11 +129,26 @@ Output to stdout by default, or use -o flag for file output.`,
// Write JSONL
encoder := json.NewEncoder(out)
exportedIDs := make([]string, 0, len(issues))
for _, issue := range issues {
if err := encoder.Encode(issue); err != nil {
fmt.Fprintf(os.Stderr, "Error encoding issue %s: %v\n", issue.ID, err)
os.Exit(1)
}
exportedIDs = append(exportedIDs, issue.ID)
}
// Only clear dirty issues and auto-flush state if exporting to the default JSONL path
// This prevents clearing dirty flags when exporting to custom paths (e.g., bd export -o backup.jsonl)
if output == "" || output == findJSONLPath() {
// Clear only the issues that were actually exported (fixes bd-52 race condition)
if err := store.ClearDirtyIssuesByID(ctx, exportedIDs); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to clear dirty issues: %v\n", err)
}
// Clear auto-flush state since we just manually exported
// This cancels any pending auto-flush timer and marks DB as clean
clearAutoFlushState()
}
// If writing to file, atomically replace the target file