name: wt-pr description: Check out a GitHub PR in its own worktree for review allowed-tools: Bash(wt switch:), Bash(wt list:), Bash(jq:), Bash(cd:)
Your task
Put the user inside an isolated worktree containing the PR's branch.
- Take the PR number from the user's argument. If none was provided, ask for one before continuing.
- Run
wt switch pr:<N> --no-cdto fetch the PR and materialise it as a worktree.--no-cdskips shell integration so we cancdexplicitly. - Resolve the worktree path for the PR branch:
wt list --format json | jq -r '.[] | select(.branch | test("pr.*<N>|/<N>$")) | .path' | head -1If that yields nothing, fall back to the most recently added entry inwt list --format json. cdinto that path so review happens inside the PR's worktree.- Print the branch name and path, then stop. Do not start reviewing unless the user asked for a review.