Skip to content

feat(switch): display PR/MR context when checking out#782

Merged
max-sixty merged 8 commits intomainfrom
pr
Jan 22, 2026
Merged

feat(switch): display PR/MR context when checking out#782
max-sixty merged 8 commits intomainfrom
pr

Conversation

@max-sixty
Copy link
Owner

Summary

  • Show PR/MR context (title, author, state, URL) as gutter content under the "Fetching PR #N..." progress message when using wt switch pr:N or wt switch mr:N
  • Group related information together - the PR info is the "response" from the fetch operation
  • Remove unused pr_mr_url field threading through SwitchPlan/SwitchResult types

Before:

◎ Fetching PR #101...
◎ Fetching feature-auth from origin...
✓ Created worktree @ _REPO_.feature-auth

After:

◎ Fetching PR #101...
 ┃ Fix authentication bug in login flow (#101)
 ┃ by @alice · open · https://github.com/owner/repo/pull/101
◎ Fetching feature-auth from origin...
✓ Created worktree @ _REPO_.feature-auth

Test plan

  • cargo test --test integration -- switch (122 tests pass)
  • cargo test --lib --bins --test integration (912 tests pass)
  • pre-commit run --all-files passes

🤖 Generated with Claude Code

max-sixty and others added 8 commits January 21, 2026 11:45
Display PR/MR details after fetching:
- Title (bold) with PR/MR number
- Author, state (open/closed/merged), draft status if applicable
- URL as hint at end of output

Example output:
  ◎ Fetching PR #101...
  ○ Fix authentication bug in login flow (#101)
    by @alice · open
  ◎ Fetching feature-auth from origin...
  ✓ Created worktree for feature-auth @ ~/repo.feature-auth
  ↳ https://github.com/owner/test-repo/pull/101

Co-Authored-By: Claude <noreply@anthropic.com>
Resolved conflicts in switch.rs by integrating PR/MR context display
into main's refactored resolve_pr_ref and resolve_mr_ref functions.

Co-Authored-By: Claude <noreply@anthropic.com>
When checking out with `wt switch pr:N` or `wt switch mr:N`, display
PR/MR context (title, author, state, URL) as gutter content under the
"Fetching PR #N..." progress message:

```
◎ Fetching PR #101...
 ┃ Fix authentication bug in login flow (#101)
 ┃ by @alice · open · https://github.com/owner/repo/pull/101
◎ Fetching feature-auth from origin...
```

This keeps related information grouped together and treats the PR info
as the "response" from the fetch operation.

Also removes unused `pr_mr_url` field that was being threaded through
SwitchPlan and SwitchResult types - the URL is now displayed immediately
when fetched rather than deferred to output handlers.

Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts:
#	tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_different_pr.snap
#	tests/snapshots/integration__integration_tests__switch__switch_pr_fork_existing_no_tracking.snap
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Add RefContext trait with common display fields (number, title, author,
state, draft, url) implemented by both PrInfo and MrInfo. Replace the
duplicate format_pr_context and format_mr_context functions with a
single format_ref_context function.

Co-Authored-By: Claude <noreply@anthropic.com>
The prefixed fork tests were merged from main with mocks missing the
new title/user/state/draft fields, causing JSON parse failures.

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit 77afa41 into main Jan 22, 2026
21 checks passed
@max-sixty max-sixty deleted the pr branch January 22, 2026 00:10
worktrunk-bot pushed a commit that referenced this pull request Jan 22, 2026
The PR #782 merged to main introduced unreferenced snapshot files that
caused CI to fail with `--unreferenced reject`. These snapshot files
were not referenced by any tests and needed to be cleaned up.

Removed 48 unreferenced help snapshot files from tests/snapshots/.

Fixes CI failure from run 21230601354.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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