feat: complete isolated-worktree helpers — worktree-review, worktree-clean, tests (#39) #41
Reference in New Issue
Block a user
Delete Branch "feat/issue-39-worktree-helpers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #39. Follow-up to #38.
Context
#38 merged the isolated-worktree standard partially —
branches/gitignore, runbook section, andscripts/worktree-startare onmaster(7e8256c). This PR adds the remaining acceptance items: theworktree-reviewandworktree-cleanhelpers + tests. (Issue #39 was originally filed as the same task, found to duplicate #38, then repurposed to track this remainder.)What
scripts/worktree-review— isolated detached review worktree underbranches/review-<branch>(fetch/prune first, refuse to overwrite, print path,--dry-run). Detached so a reviewer can't accidentally commit and review never blocks the author's folder.scripts/worktree-clean— the only deleting helper: removes abranches/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).worktree-review/worktree-clean+ the--dry-runflag.Behavior / safety
Helpers fetch/prune first, branch from remote
master(start-ref defaultprgs/masterfor start,prgs/<branch>for review), refuse to overwrite an existing worktree, print the created path, and never delete unless cleanup is explicitly requested. No secrets. No change to MCP runtime, Gitea API ops, credential storage, or the profile model.Checks
bash -nclean on all three scripts.git diff --check: clean.Notes for reviewer
branches/worktree): the#38worktree was removed by external cleanup mid-task; committing on a plain branch avoided losing work again. The standard itself is now in mainline for future use.tests/test_mcp_server.py::TestEditPR::test_edit_pr_no_fields_raisesfails only when run from a checkout without Gitea.envcreds (it calls_authbefore the no-fieldsValueError). Passes in the main checkout. Worth a separate issue to reorder that validation — out of scope here.Files changed
scripts/worktree-review(new),scripts/worktree-clean(new),tests/test_worktrees.py(new),docs/llm-workflow-runbooks.md.⚠️ Authored by me — do not self-merge. Needs review by another author.
Pull request closed