fix: propagate phase_req_ids from ROADMAP to workflow agents (#684) (#702)

Added TBD guard test before merge.
This commit is contained in:
dush999
2026-02-23 21:05:28 +05:30
committed by GitHub
parent 3a56a207a5
commit ea3c22d345
6 changed files with 133 additions and 9 deletions

View File

@@ -16,6 +16,13 @@ function cmdInitExecutePhase(cwd, phase, raw) {
const phaseInfo = findPhaseInternal(cwd, phase);
const milestone = getMilestoneInfo(cwd);
const roadmapPhase = getRoadmapPhaseInternal(cwd, phase);
const reqMatch = roadmapPhase?.section?.match(/^\*\*Requirements\*\*:[^\S\n]*([^\n]*)$/m);
const reqExtracted = reqMatch
? reqMatch[1].replace(/[\[\]]/g, '').split(',').map(s => s.trim()).filter(Boolean).join(', ')
: null;
const phase_req_ids = (reqExtracted && reqExtracted !== 'TBD') ? reqExtracted : null;
const result = {
// Models
executor_model: resolveModelInternal(cwd, 'gsd-executor'),
@@ -35,6 +42,7 @@ function cmdInitExecutePhase(cwd, phase, raw) {
phase_number: phaseInfo?.phase_number || null,
phase_name: phaseInfo?.phase_name || null,
phase_slug: phaseInfo?.phase_slug || null,
phase_req_ids,
// Plan inventory
plans: phaseInfo?.plans || [],
@@ -80,6 +88,13 @@ function cmdInitPlanPhase(cwd, phase, raw) {
const config = loadConfig(cwd);
const phaseInfo = findPhaseInternal(cwd, phase);
const roadmapPhase = getRoadmapPhaseInternal(cwd, phase);
const reqMatch = roadmapPhase?.section?.match(/^\*\*Requirements\*\*:[^\S\n]*([^\n]*)$/m);
const reqExtracted = reqMatch
? reqMatch[1].replace(/[\[\]]/g, '').split(',').map(s => s.trim()).filter(Boolean).join(', ')
: null;
const phase_req_ids = (reqExtracted && reqExtracted !== 'TBD') ? reqExtracted : null;
const result = {
// Models
researcher_model: resolveModelInternal(cwd, 'gsd-phase-researcher'),
@@ -99,6 +114,7 @@ function cmdInitPlanPhase(cwd, phase, raw) {
phase_name: phaseInfo?.phase_name || null,
phase_slug: phaseInfo?.phase_slug || null,
padded_phase: phaseInfo?.phase_number?.padStart(2, '0') || null,
phase_req_ids,
// Existing artifacts
has_research: phaseInfo?.has_research || false,

View File

@@ -336,7 +336,7 @@ function cmdPhaseAdd(cwd, description, raw) {
fs.writeFileSync(path.join(dirPath, '.gitkeep'), '');
// Build phase entry
const phaseEntry = `\n### Phase ${newPhaseNum}: ${description}\n\n**Goal:** [To be planned]\n**Depends on:** Phase ${maxPhase}\n**Plans:** 0 plans\n\nPlans:\n- [ ] TBD (run /gsd:plan-phase ${newPhaseNum} to break down)\n`;
const phaseEntry = `\n### Phase ${newPhaseNum}: ${description}\n\n**Goal:** [To be planned]\n**Requirements**: TBD\n**Depends on:** Phase ${maxPhase}\n**Plans:** 0 plans\n\nPlans:\n- [ ] TBD (run /gsd:plan-phase ${newPhaseNum} to break down)\n`;
// Find insertion point: before last "---" or at end
let updatedContent;
@@ -407,7 +407,7 @@ function cmdPhaseInsert(cwd, afterPhase, description, raw) {
fs.writeFileSync(path.join(dirPath, '.gitkeep'), '');
// Build phase entry
const phaseEntry = `\n### Phase ${decimalPhase}: ${description} (INSERTED)\n\n**Goal:** [Urgent work - to be planned]\n**Depends on:** Phase ${afterPhase}\n**Plans:** 0 plans\n\nPlans:\n- [ ] TBD (run /gsd:plan-phase ${decimalPhase} to break down)\n`;
const phaseEntry = `\n### Phase ${decimalPhase}: ${description} (INSERTED)\n\n**Goal:** [Urgent work - to be planned]\n**Requirements**: TBD\n**Depends on:** Phase ${afterPhase}\n**Plans:** 0 plans\n\nPlans:\n- [ ] TBD (run /gsd:plan-phase ${decimalPhase} to break down)\n`;
// Insert after the target phase section
const headerPattern = new RegExp(`(#{2,4}\\s*Phase\\s+0*${afterPhaseEscaped}:[^\\n]*\\n)`, 'i');