Merge pull request #3122 from gsd-build/fix/3088-gsd-complete-milestone-leaves-state-md-n
fix: normalize stale STATE narrative tails on milestone completion
This commit is contained in:
@@ -1841,6 +1841,29 @@ 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}`);
|
||||
} else {
|
||||
next = `${next.trimEnd()}\n\n## Current Position\n${closedPositionBody}`;
|
||||
}
|
||||
|
||||
const operatorPattern = /(##\s*Operator Next Steps\s*\n)([\s\S]*?)(?=\n##|$)/i;
|
||||
if (operatorPattern.test(next)) {
|
||||
next = next.replace(
|
||||
operatorPattern,
|
||||
`$1\n- Start the next milestone with /gsd-new-milestone\n\n`,
|
||||
);
|
||||
} else {
|
||||
next = `${next.trimEnd()}\n\n## Operator Next Steps\n\n- Start the next milestone with /gsd-new-milestone\n`;
|
||||
}
|
||||
|
||||
return next;
|
||||
}, workstream);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user