feat(story-200): auto-prune worktrees when stories are archived

- Add `prune_worktree_sync` to worktree.rs: removes a story's worktree
  if it exists, delegating to `remove_worktree_sync` (best-effort,
  failures logged internally)
- Update `sweep_done_to_archived` to accept `git_root` and call
  `prune_worktree_sync` after promoting a story from 5_done to 6_archived
- Add Part 2 to the sweep: scan 6_archived and prune any stale worktrees
  for stories already there (catches items archived before this feature)
- All worktree removal failures are logged but never block file moves
- Add 5 new tests: prune noop, prune real worktree, sweep-on-promote,
  sweep-stale-archived, sweep-not-blocked-by-removal-failure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-26 14:58:52 +00:00
parent 4e535dff18
commit 40d96008c9
11 changed files with 252 additions and 48 deletions