fix(#1871): wire phase archival end-to-end (phases archive cmd + default + atomic) (#1924)

Follow-up to #1919 (archive-then-remove core). Closes the remaining #1871
acceptance criteria so phase history is preserved across the full milestone
lifecycle, not just at phases.clear:

- #2 src/milestone.cts + src/phases-command-router.cts: extract shared
  archivePhaseDirectories() helper; add cmdPhasesArchive (the previously
  half-wired phases.archive alias now routes instead of erroring Unknown).
- #4 gsd-tools.cjs + src/milestone.cts: milestone complete archives phase
  dirs by default (--no-archive-phases opts out; --archive-phases is now a
  harmless no-op). complete-milestone.md updated to drop the redundant manual
  Yes/Skip archive prompt.
- #3 gsd-core/workflows/new-milestone.md: §6 stages the archive move + source
  removal (git add .planning/milestones/ .planning/phases/) in the same commit
  as the milestone start, so the archive lands atomically — no orphaned
  uncommitted deletions, no un-archived dirs inherited.
- docs/CLI-TOOLS.md (+ ja/zh/ko/pt) + help/modes/full.md: flag accuracy.
- tests: phases archive command (#2) + milestone complete default archive /
  --no-archive-phases opt-out (#4). Goldens + workflow size baseline refreshed.

Closes #1871
This commit is contained in:
Tom Boucher
2026-07-02 11:14:01 -04:00
committed by GitHub
parent 5195a36cc5
commit 92091d71f2
30 changed files with 177 additions and 116 deletions

View File

@@ -57,7 +57,7 @@
* Milestone Operations:
* milestone complete <version> Archive milestone, create MILESTONES.md
* [--name <name>]
* [--archive-phases] Move phase dirs to milestones/vX.Y-phases/
* [--no-archive-phases] Skip moving phase dirs to milestones/vX.Y-phases/ (archived by default)
*
* User Story Validation:
* user-story validate --story "..." Validate "As a / I want to / so that" format
@@ -1453,7 +1453,9 @@ async function runCommand(command, args, cwd, raw, defaultValue, originalCommand
const subcommand = args[1];
if (subcommand === 'complete') {
const milestoneName = parseMultiwordArg(args, 'name');
const archivePhases = args.includes('--archive-phases');
// #1871: archive phase dirs by default on milestone complete so the next
// new-milestone never inherits un-archived dirs. --no-archive-phases opts out.
const archivePhases = !args.includes('--no-archive-phases');
const force = args.includes('--force');
milestone.cmdMilestoneComplete(cwd, args[2], { name: milestoneName, archivePhases, force }, raw);
} else {