- **After a PR merges, proactively offer to clean up its worktree and branches.** When the user confirms a PR has been merged (or you observe the merge while working), surface a cleanup offer via `AskUserQuestion` before doing anything destructive. The cleanup is: `git worktree remove <path>`, `git branch -D <name>` locally, and `git push origin --delete <name>` (often a no-op because GitHub auto-deletes the head branch on merge). Refuse to delete dirty worktrees without explicit per-tree consent. If the current shell's CWD is inside the worktree being removed, expect a "Permission denied" on the directory itself: the git entry, contents, and branches still get cleaned, leaving only an empty husk that vanishes once the shell exits.
0 commit comments