feat(sync): add incremental export for large repos

For repos with 1000+ issues where less than 20% are dirty,
incremental export reads the existing JSONL, merges only
changed issues, and writes back - avoiding full re-export.

- Add exportToJSONLIncrementalDeferred as new default export path
- Add shouldUseIncrementalExport to check thresholds
- Add performIncrementalExport for merge-based export
- Add readJSONLToMap helper for fast JSONL parsing
- Falls back to full export when incremental is not beneficial

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/lydia
2026-01-20 21:26:08 -08:00
committed by Steve Yegge
parent d3d2326a8b
commit 63c2e50158
3 changed files with 740 additions and 2 deletions

View File

@@ -772,8 +772,8 @@ func doExportSync(ctx context.Context, jsonlPath string, force, dryRun bool) err
}
}
// Export to JSONL
result, err := exportToJSONLDeferred(ctx, jsonlPath)
// Export to JSONL (uses incremental export for large repos)
result, err := exportToJSONLIncrementalDeferred(ctx, jsonlPath)
if err != nil {
return fmt.Errorf("exporting: %w", err)
}