fix: scope ROADMAP.md searches to current milestone (#1059)

Phase numbers reset per milestone (v1.0 Phase 1-26, v1.1 Phase 1-6,
v1.2 Phase 1-6). Functions that searched ROADMAP.md for phase headings
or checkboxes would match archived milestone entries inside <details>
blocks before reaching the current milestone's entries.

This caused:
- roadmap_complete: true for phases that aren't complete (checkbox
  regex matched the archived [x] Phase N from a previous milestone)
- phase-complete marking the wrong checkbox (archived instead of current)
- phase-add computing wrong maxPhase from archived headings
- progress not showing phases defined in ROADMAP but not yet on disk
This commit is contained in:
Shard
2026-03-15 19:39:59 +02:00
committed by GitHub
parent 637a3e720c
commit ca4ae7b3b8
6 changed files with 125 additions and 40 deletions

View File

@@ -624,8 +624,8 @@ describe('getRoadmapPhaseInternal', () => {
assert.strictEqual(result.goal, 'Create REST endpoints');
});
test('returns null goal when Goal uses colon-outside-bold format', () => {
// Actual ROADMAP.md uses **Goal**: (colon outside bold) which the regex does not match
test('returns goal when Goal uses colon-outside-bold format', () => {
// **Goal**: (colon outside bold) is now supported alongside **Goal:**
fs.writeFileSync(
path.join(tmpDir, '.planning', 'ROADMAP.md'),
'### Phase 1: Foundation\n**Goal**: Build the base\n'
@@ -633,7 +633,7 @@ describe('getRoadmapPhaseInternal', () => {
const result = getRoadmapPhaseInternal(tmpDir, '1');
assert.strictEqual(result.found, true);
assert.strictEqual(result.phase_name, 'Foundation');
assert.strictEqual(result.goal, null);
assert.strictEqual(result.goal, 'Build the base');
});
test('returns null when roadmap missing', () => {