Skip to content

Add wt pr for picking and switching to pull request branches - #18

Merged
AgileIndustrialComplex merged 2 commits into
essafrom
feature/pr-support
Nov 22, 2026
Merged

AgileIndustrialComplex merged 2 commits into
essafrom
feature/pr-support

Conversation

@AgileIndustrialComplex

Copy link
Copy Markdown
Owner

What

Adds wt pr for switching to GitHub pull request branches.

  • wt pr lists open PRs as #number title (branch) rows in the existing picker; the PR picker disables the mark/delete/force keys and filters on title too.
  • wt pr 123 goes straight to that PR. Both forms accept --no-color, --worktree-root DIR and --path-only, before or after the number.
  • Before switching, wt fetches the PR head from origin. A local branch strictly behind origin/<branch> prompts Fast-forward ...? [y/N]; yes runs git merge --ff-only in its worktree, or a fast-forward ref update for a plain branch. Declining leaves the branch alone. A diverged branch is an error and is left untouched; a missing branch is created from the remote tip without asking.
  • Switching then follows normal wt rules: a worktree returns its path, a plain branch shows the [s]witch here / [w]orktree prompt.
  • README, SPEC and help text updated.

Why

PR branches are the main units of work in the parallel-agent workflow; finding and switching to one should not mean leaving wt and running gh/git by hand.

Verification

  • make build fmt-check vet test-race — all pass.
  • Real-git integration tests: fast-forward on consent, no change on decline, error on diverged branch, missing branch creation, and fast-forward inside a worktree.
  • Unit tests: gh pr list/view JSON parsing and exact command shape, preparePRBranchWith command sequence and consent paths, PR-picker rendering/filter/key disabling, sequential stdin answers.
  • End-to-end smoke test of the compiled binary with a fake gh and a real bare origin: wt pr 123 --no-color with answers y then s fast-forwarded the branch and switched to it.

Note

PR heads are resolved as origin/<branch>; fork PR heads are not supported.

hermes added 2 commits November 22, 2026 23:03
wt pr shows open PRs (#number, title, branch) in the picker and wt pr 123
goes straight to a PR. Before switching, a local branch strictly behind
origin/<branch> needs a yes to fast-forward; a diverged branch is rejected
and a missing one is created from the remote tip. Switching reuses the
normal worktree path / switch-or-worktree prompt flow.
The shell wrapper prepends --path-only, so the PR command was treated as
a normal picker invocation. Find the first non-flag argument instead of
assuming the subcommand is argv[1].
@AgileIndustrialComplex
AgileIndustrialComplex merged commit 7895de3 into essa Nov 22, 2026
5 checks passed
@AgileIndustrialComplex
AgileIndustrialComplex deleted the feature/pr-support branch November 22, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant