-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
DRYCode duplication / DRY violationCode duplication / DRY violationtech-debtTechnical debt and code quality improvementsTechnical debt and code quality improvements
Description
Severity: MEDIUM
performGitAdd and performLocalAdd in PackCommand.swift share a near-identical 5-step sequence:
- Validate manifest → do/catch → error + throw
- Load registry → check duplicate → check collisions → collision prompt
- Display summary → preview bail-out
- Trust verification → do/catch → guard approved
- Build
PackEntry→ register + save → success message
The differences are:
- Git path: has clone/move/temp-cleanup logic, uses
fetcher.remove()on failure - Local path: skips
ref, setsisLocal: true, useslocalCommitSentinel, no temp cleanup needed
The registry-save block is character-for-character identical. The collision-check and duplicate-check call sites are also structurally identical.
Fix: Extract a shared helper that accepts a closure or strategy for the source-specific bits (clone vs. read-in-place, cleanup on failure).
Found during review of #109.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DRYCode duplication / DRY violationCode duplication / DRY violationtech-debtTechnical debt and code quality improvementsTechnical debt and code quality improvements