feat: complete isolated-worktree helpers — worktree-review, worktree-clean, tests (#39)

Finishes the isolated-worktree standard begun in #38 (which merged the
branches/ gitignore, runbook, and scripts/worktree-start). Adds the two
remaining helpers and their tests.

- scripts/worktree-review: isolated DETACHED review worktree under
  branches/review-<branch> (fetch/prune first, refuse to overwrite, print path,
  --dry-run). Detached so a reviewer cannot accidentally commit and review work
  never blocks the author's implementation folder.
- scripts/worktree-clean: the only deleting helper — removes a branches/
  worktree after merge/close, refuses a dirty worktree (no --force), optionally
  safe-deletes a merged branch (git branch -d), fetch/prune first, --dry-run.
  Deletes nothing unless explicitly invoked.
- tests/test_worktrees.py: path generation + refuse-to-overwrite for all three
  helpers via --dry-run (no real worktrees/branches/network/deletions).
- runbook: reference worktree-review / worktree-clean and the --dry-run flag.

Checks: bash -n clean on all three scripts; git diff --check clean; full suite
286 passed, 0 failures.

Closes #39. Follow-up to #38.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-02 02:54:50 -04:00
parent 7e8256cfaf
commit 46db3f73e8
4 changed files with 255 additions and 4 deletions
+15 -4
View File
@@ -205,18 +205,29 @@ git worktree add -b fix/issue-123-example branches/fix-issue-123-example prgs/ma
cd branches/fix-issue-123-example
```
For review work, create a separate review worktree/folder instead of reusing the
author's implementation folder.
Cleanup is explicit and only after merge or close:
For review work, create a separate **detached** review worktree instead of
reusing the author's implementation folder:
```bash
scripts/worktree-review fix/issue-123-example # → branches/review-fix-issue-123-example
```
Cleanup is explicit and only after merge or close. Use the helper (it fetches/
prunes first, refuses to remove a dirty worktree, and only safe-deletes a merged
branch), or the equivalent manual commands:
```bash
scripts/worktree-clean --delete-branch fix/issue-123-example
# equivalent manual commands:
cd <main-repo>
git fetch prgs --prune
git worktree remove branches/fix-issue-123-example
git branch -d fix/issue-123-example
```
All three helpers accept `--dry-run` to print the exact commands/paths without
touching anything.
### Create an issue / child issues
- **Profile:** issue-manager or author (any profile allowed to create issues).