fix(milestone): normalize STATE narrative after milestone completion

This commit is contained in:
Tom Boucher
2026-05-04 23:17:00 -04:00
parent 42ed7cee8d
commit 2dcf374da0
3 changed files with 55 additions and 1 deletions

View File

@@ -1841,6 +1841,22 @@ export const milestoneComplete: QueryHandler = async (args, projectDir, workstre
null,
`${version} milestone completed and archived`,
);
const positionPattern = /(##\s*Current Position\s*\n)([\s\S]*?)(?=\n##|$)/i;
const closedPositionBody =
`\nPhase: Milestone ${version} complete\n` +
`Plan: —\n` +
`Status: Awaiting next milestone\n` +
`Last activity: ${today} — Milestone ${version} completed and archived\n\n`;
if (positionPattern.test(next)) {
next = next.replace(positionPattern, (_m, header) => `${header}${closedPositionBody}`);
}
next = next.replace(
/(##\s*Operator Next Steps\s*\n)([\s\S]*?)(?=\n##|$)/i,
`$1\n- Start the next milestone with /gsd-new-milestone\n\n`,
);
return next;
}, workstream);
}