fix: getMilestoneInfo() returns wrong version after milestone completion (#768)
Strip <details> blocks (shipped milestones) before matching, and extract both version and name from the same ## heading for consistency.
This commit is contained in:
@@ -379,11 +379,21 @@ function generateSlugInternal(text) {
|
||||
function getMilestoneInfo(cwd) {
|
||||
try {
|
||||
const roadmap = fs.readFileSync(path.join(cwd, '.planning', 'ROADMAP.md'), 'utf-8');
|
||||
const versionMatch = roadmap.match(/v(\d+\.\d+)/);
|
||||
const nameMatch = roadmap.match(/## .*v\d+\.\d+[:\s]+([^\n(]+)/);
|
||||
// Strip <details>...</details> blocks so shipped milestones don't interfere
|
||||
const cleaned = roadmap.replace(/<details>[\s\S]*?<\/details>/gi, '');
|
||||
// Extract version and name from the same ## heading for consistency
|
||||
const headingMatch = cleaned.match(/## .*v(\d+\.\d+)[:\s]+([^\n(]+)/);
|
||||
if (headingMatch) {
|
||||
return {
|
||||
version: 'v' + headingMatch[1],
|
||||
name: headingMatch[2].trim(),
|
||||
};
|
||||
}
|
||||
// Fallback: try bare version match
|
||||
const versionMatch = cleaned.match(/v(\d+\.\d+)/);
|
||||
return {
|
||||
version: versionMatch ? versionMatch[0] : 'v1.0',
|
||||
name: nameMatch ? nameMatch[1].trim() : 'milestone',
|
||||
name: 'milestone',
|
||||
};
|
||||
} catch {
|
||||
return { version: 'v1.0', name: 'milestone' };
|
||||
|
||||
Reference in New Issue
Block a user