Steve Yegge
fe30e0c527
Refactor importIssuesCore to reduce complexity (bd-55)
Reduced cyclomatic complexity from 71 to ~10 by extracting 7 phase functions:
- getOrCreateStore: Store initialization
- handlePrefixMismatch: Prefix validation/renaming
- handleCollisions: Collision detection/resolution
- upsertIssues: Issue creation/updates
- importDependencies: Dependency imports (optimized with set-based deduplication)
- importLabels: Label imports
- importComments: Comment imports (fixed idempotency bug)
Additional improvements:
- Fixed comment deduplication to use author+text only (not timestamp)
- Optimized dependency imports to fetch once per issue (not per dependency)
- Improved error messages to reference CLI flags
- Renamed importIssues -> upsertIssues for clarity
Main function reduced from 317 lines to 50 lines. All tests pass.
Amp-Thread-ID: https://ampcode.com/threads/T-aa67a4e5-b35d-4ba6-a954-5d9ff86c15bf
Co-authored-by: Amp <amp@ampcode.com>