fix(query): workstream resolution in init.milestone-op and roadmap.analyze (#3196)
- initMilestoneOp now accepts and propagates the workstream parameter: relPlanningPath(workstream) replaces the hardcoded '.planning' dir, getMilestoneInfo gets workstream passed, extractCurrentMilestone gets workstream passed, archiveDir is derived from planningDir not root. - resolveQueryRuntimeContext now reads .planning/active-workstream as a third-priority fallback after --ws flag and GSD_WORKSTREAM env var, completing the documented resolution chain for all query handlers. Closes #3196 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -794,10 +794,10 @@ export const initTodos: QueryHandler = async (args, projectDir) => {
|
||||
* Init handler for complete-milestone and audit-milestone workflows.
|
||||
* Port of cmdInitMilestoneOp from init.cjs lines 758-817.
|
||||
*/
|
||||
export const initMilestoneOp: QueryHandler = async (_args, projectDir) => {
|
||||
export const initMilestoneOp: QueryHandler = async (_args, projectDir, workstream) => {
|
||||
const config = await loadConfig(projectDir);
|
||||
const planningDir = join(projectDir, '.planning');
|
||||
const milestone = await getMilestoneInfo(projectDir);
|
||||
const planningDir = join(projectDir, relPlanningPath(workstream));
|
||||
const milestone = await getMilestoneInfo(projectDir, workstream);
|
||||
|
||||
const phasesDir = join(planningDir, 'phases');
|
||||
let phaseCount = 0;
|
||||
@@ -813,7 +813,7 @@ export const initMilestoneOp: QueryHandler = async (_args, projectDir) => {
|
||||
try {
|
||||
const { readFile } = await import('node:fs/promises');
|
||||
const roadmapRaw = await readFile(join(planningDir, 'ROADMAP.md'), 'utf-8');
|
||||
const currentSection = await extractCurrentMilestone(roadmapRaw, projectDir);
|
||||
const currentSection = await extractCurrentMilestone(roadmapRaw, projectDir, workstream);
|
||||
roadmapPhaseNumbers = extractPhasesFromSection(currentSection).map(p => p.number);
|
||||
} catch { /* intentionally empty */ }
|
||||
|
||||
@@ -869,7 +869,7 @@ export const initMilestoneOp: QueryHandler = async (_args, projectDir) => {
|
||||
} catch { /* intentionally empty */ }
|
||||
}
|
||||
|
||||
const archiveDir = join(projectDir, '.planning', 'archive');
|
||||
const archiveDir = join(planningDir, 'archive');
|
||||
let archivedMilestones: string[] = [];
|
||||
try {
|
||||
archivedMilestones = readdirSync(archiveDir, { withFileTypes: true })
|
||||
|
||||
Reference in New Issue
Block a user