* fix: clear phases directory when creating new milestone (#1588) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: re-run CI with Windows pointer lifecycle fix in main --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -583,8 +583,10 @@ async function runCommand(command, args, cwd, raw) {
|
||||
includeArchived: args.includes('--include-archived'),
|
||||
};
|
||||
phase.cmdPhasesList(cwd, options, raw);
|
||||
} else if (subcommand === 'clear') {
|
||||
milestone.cmdPhasesClear(cwd, raw);
|
||||
} else {
|
||||
error('Unknown phases subcommand. Available: list');
|
||||
error('Unknown phases subcommand. Available: list, clear');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -246,7 +246,28 @@ function cmdMilestoneComplete(cwd, version, options, raw) {
|
||||
output(result, raw);
|
||||
}
|
||||
|
||||
function cmdPhasesClear(cwd, raw) {
|
||||
const phasesDir = planningPaths(cwd).phases;
|
||||
let cleared = 0;
|
||||
|
||||
if (fs.existsSync(phasesDir)) {
|
||||
try {
|
||||
const entries = fs.readdirSync(phasesDir, { withFileTypes: true });
|
||||
for (const entry of entries) {
|
||||
if (!entry.isDirectory()) continue;
|
||||
fs.rmSync(path.join(phasesDir, entry.name), { recursive: true, force: true });
|
||||
cleared++;
|
||||
}
|
||||
} catch (e) {
|
||||
error('Failed to clear phases directory: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
output({ cleared }, raw, `${cleared} phase director${cleared === 1 ? 'y' : 'ies'} cleared`);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
cmdRequirementsMarkComplete,
|
||||
cmdMilestoneComplete,
|
||||
cmdPhasesClear,
|
||||
};
|
||||
|
||||
@@ -137,6 +137,12 @@ Keep Accumulated Context section from previous milestone.
|
||||
|
||||
Delete MILESTONE-CONTEXT.md if exists (consumed).
|
||||
|
||||
Clear leftover phase directories from the previous milestone:
|
||||
|
||||
```bash
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phases clear
|
||||
```
|
||||
|
||||
```bash
|
||||
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: start milestone v[X.Y] [Name]" --files .planning/PROJECT.md .planning/STATE.md
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user