cmdMilestoneComplete previously iterated ALL phase directories in .planning/phases/, including phases from prior milestones that remain on disk. This produced inflated stats, stale accomplishments from old summaries, and --archive-phases moving directories that belong to earlier milestones. This fix parses ROADMAP.md to extract phase numbers for the current milestone, builds a normalized Set for O(1) lookup, and filters all phase directory operations through an isDirInMilestone() helper. The helper handles edge cases: leading zeros (01 -> 1), letter suffixes (3A), decimal phases (3.1), large numbers (456), and excludes non-numeric directories (notes/, misc/). Adds 5 tests covering scoped stats, scoped archive, prefix collision guard, non-numeric directory exclusion, and large phase numbers. Complements upstream PRs #756 and #783 which fix getMilestoneInfo() milestone detection — this fix addresses milestone completion scoping. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 KiB
25 KiB