From 9aeafc0f488866bc2d65b1a908490b9e63efb58a Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Sun, 15 Feb 2026 11:15:08 -0600 Subject: [PATCH] fix(tools): support #### heading depth in phase matching Multi-milestone roadmaps use #### for phases nested under milestone headers. Expanded all phase-matching regexes from #{2,3} to #{2,4}. Co-Authored-By: Claude Opus 4.6 --- get-shit-done/bin/gsd-tools.test.cjs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/get-shit-done/bin/gsd-tools.test.cjs b/get-shit-done/bin/gsd-tools.test.cjs index 462b9dbc9..31f994623 100644 --- a/get-shit-done/bin/gsd-tools.test.cjs +++ b/get-shit-done/bin/gsd-tools.test.cjs @@ -1493,6 +1493,32 @@ describe('phase insert command', () => { const roadmap = fs.readFileSync(path.join(tmpDir, '.planning', 'ROADMAP.md'), 'utf-8'); assert.ok(roadmap.includes('(INSERTED)'), 'roadmap should include inserted phase'); }); + + test('handles #### heading depth from multi-milestone roadmaps', () => { + fs.writeFileSync( + path.join(tmpDir, '.planning', 'ROADMAP.md'), + `# Roadmap + +### v1.1 Milestone + +#### Phase 5: Feature Work +**Goal:** Build features + +#### Phase 6: Polish +**Goal:** Polish +` + ); + fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '05-feature-work'), { recursive: true }); + + const result = runGsdTools('phase insert 5 Hotfix', tmpDir); + assert.ok(result.success, `Command failed: ${result.error}`); + + const output = JSON.parse(result.output); + assert.strictEqual(output.phase_number, '05.1'); + + const roadmap = fs.readFileSync(path.join(tmpDir, '.planning', 'ROADMAP.md'), 'utf-8'); + assert.ok(roadmap.includes('Phase 05.1: Hotfix (INSERTED)'), 'roadmap should include inserted phase'); + }); }); // ─────────────────────────────────────────────────────────────────────────────