Extracted 8 helper functions from the monolithic flushToJSONLWithState: - recordFlushFailure/recordFlushSuccess: Failure tracking and counter management - readExistingJSONL: Parse existing JSONL file for incremental merging - fetchAndMergeIssues: Fetch dirty issues from DB and merge into map - filterWisps: Remove ephemeral (wisp) issues from export - filterByMultiRepoPrefix: Multi-repo prefix filtering for non-primary repos - updateFlushExportMetadata: Store hashes and timestamps after export - getIssuesToExport: Determine full vs incremental export issue list Main function now reads as a clear pipeline: 1. Validate integrity -> 2. Get issues -> 3. Read existing JSONL 4. Merge from DB -> 5. Filter wisps -> 6. Filter by prefix 7. Write atomically -> 8. Update metadata Benefits: - Each helper is single-responsibility and testable - Main function reduced from ~280 to ~94 lines - Logic is clearly separated and documented - Easier to understand and maintain 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
26 KiB
26 KiB