Repository navigation
feat(switch): show PR/MR title and description in the worktree pr preview pane - #3167
Merged
Merged
Conversation
…view pane The `pr` tab for a worktree row showed only the reference and URL; it now shows the full PR/MR title and the description rendered as markdown, matching the `--prs` rows' pane. The title and body ride the CI fetch the picker already makes: `gh pr list` gains `title,body` (one widened call, no new round-trip), and the GitLab, Azure, and Gitea PR-list fetches are extended the same way. They flow through two new `PrStatus` fields into the pane. Branch-workflow/pipeline paths (no PR) leave them unset, and the user-facing `wt list --format=json` is unchanged (`JsonCi` doesn't carry them). A new `picker::pr_pane` module owns the shared header/metadata/description rendering, so the worktree pane and the `--prs` pane build from the same pieces and stay visually identical; the old `render_pr_description` moved there. On GitHub, `GhPr` now reads title/body from the flattened `GitHubPrInfo` (the worktree fetch parses that struct directly), avoiding a serde flatten key collision. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
worktrunk-bot
approved these changes
Jun 23, 2026
…low-ups The `pr` tab re-rendered the PR/MR body's markdown on every `preview()` call (every keystroke while the tab was active), bypassing the in-memory `PreviewCache` the other tabs use. Memoize the rendered pane there, filled lazily — its inputs arrive on the async `CiStatus` task, so the orchestrator can't pre-compute it like the SHA-addressed modes — and invalidated by `on_update` when the live `pr_status` slot changes (fetch lands / refresh). The tab-bar availability check (`pr_tab_available`) now reads only the slot discriminant, so it no longer clones the `PrStatus` body on every render. Also add inline TODOs for two review findings left as deliberate scope cuts: the dead title/body on GitHub's `--prs` `open_pr_status` (GitLab already sets `None`), and title/body intentionally absent from `wt list --json`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
worktrunk-bot
approved these changes
Jun 23, 2026
max-sixty
added a commit
that referenced
this pull request
Jun 24, 2026
Resolves overlap with #3167 (PR/MR title+description in the worktree pr pane), which moved the description renderer into a new `pr_pane` module and refactored `preview()` into a testable `render_preview`: - Comments share `pr_pane::markdown_in_gutter` (extracted from `pr_pane::description`) instead of a local helper, so the house-gutter idiom lives in one place. - Ported the width-aware tab bar and the `comments` tab arm into main's `render_preview`. - Dropped the now-implemented pr-preview-log / pr-preview-comments TODOs. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Jun 25, 2026
#3197) ## What The `pr` preview tab for a worktree row in the `wt switch` picker shows the PR/MR reference, title, branch, URL, and description. It now also shows a `comments` line with the conversation-comment count, for a PR/MR that has any. ## How The count rides the CI fetch the picker already makes, so there's no new network call — the same shape as the just-merged title/description change (#3167): - A `comment_count: Option<u32>` field was added to `PrStatus` (serde default + skip-if-none, so old CI-cache entries stay readable and a no-comment PR serializes nothing). The picker's prime-from-cache first frame can show it before the live fetch lands. - Each forge maps the count from its existing list call: - **GitHub** — `gh pr list --json` is widened with `comments`. `gh` has no count-only field, so the array is requested and counted; for a `--head <branch>` call that's typically one PR. - **GitLab** — `user_notes_count` from `glab mr list`. - **Gitea** — `comments` (int) from the `tea api …/pulls` object. - **Azure DevOps** — left unset. `az repos pr list` carries no comment/thread count, and a per-PR threads call is exactly the extra round-trip this avoids. - Zero is flattened to `None` at each mapping boundary (a `comment_count()` method on each forge's list struct — GitHub/GitLab/Gitea share the shape), so a PR with no comments shows nothing new; the render layer shows the line only when the count is `Some`. - It renders as a `comments` metadata line in the shared `pr_pane`, on the worktree-row pane. ## Count, not comment text A count — not the comment bodies — because: - `PrStatus` is disk-cached (the CI cache); storing threads would bloat it. - A count is the one comment datum every forge exposes cheaply on its existing list call, so it rides that call with no extra round-trip, consistent with the title/body precedent. - The full thread already has a home: the `--prs` rows' `comments` tab fetches and renders it per-row in the background. Worktree rows still point there (their `comments` tab is unchanged). `wt list --json` is deliberately unchanged — `comment_count`, like title/body, stays out of the CI/review-scoped JSON. ## Testing - The `comment_count()` zero-flatten (`Some(0)` → `None`) is pinned per forge: GitHub (array length), GitLab (`user_notes_count`), Gitea (`comments`). The `pr`-pane render is covered present + absent in `items.rs`. - The four backends' new lines ride the mocked-CLI `ci_status` integration tests; `wt list --full` output is unchanged (CI column only), so there's no snapshot drift. - Field names were confirmed against the live GitHub, GitLab, and Gitea APIs. `glab`/`tea`/`az` versions that omit the field degrade gracefully (serde default → no line), as with the title/body fields. > _This was written by Claude Code on behalf of max_ --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
worktrunk 0.62.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## Release Notes ### Improved - **Browse open PRs/MRs in the `wt switch` picker, with live CI**: The picker now streams a live CI/review-status column per row — priming from the local cache, then fetching live (it previously showed only cached numbers with no network). A new `--prs` flag adds the repository's open PRs (GitHub) / MRs (GitLab) as rows alongside your worktrees, each with `pr` / `comments` / `log` preview tabs loaded from the forge in the background; selecting one fetches its branch and switches. Rows whose branch is already shown aren't duplicated, so `--prs` differs from plain `wt switch` only by the extra rows. [Docs](https://worktrunk.dev/switch/) ([#3128](max-sixty/worktrunk#3128), [#3169](max-sixty/worktrunk#3169), [#3189](max-sixty/worktrunk#3189), [#3252](max-sixty/worktrunk#3252)) - **`main…±` diff column shows by default in `wt list`**: The `main…±` column (lines changed since the merge-base with the default branch) now renders in the default `wt list` and picker, served from a persistent cache rather than a history walk. `--full` now adds only the columns that reach off-machine — CI status and LLM branch summaries — and `wt list --format=json` populates `main.diff` for every item, not just under `--full`. ([#3236](max-sixty/worktrunk#3236)) - **`[list] columns` selects and orders the columns `wt list` shows**: A new `[list] columns` user-config key (also settable via `--config-set`) takes an ordered array of column names — built-in (`branch`, `status`, `ci`, `path`, …) and `[list.custom-columns]` headers alike — and renders exactly those, in that order. Where v0.61.0's custom columns *add* columns, this *selects and reorders* the whole set; omit the key for the default layout. (`WORKTRUNK__LIST__COLUMNS` isn't supported yet and warns if set.) ([#3141](max-sixty/worktrunk#3141)) - **Picker PR preview shows full PR/MR detail**: The `pr` tab now renders the PR/MR title, markdown description, author, draft state, comment count, bold branch name, and underlined URL for any row whose branch has an open PR — not just `--prs` rows — and the `comments` tab fetches the real thread. The title and description ride the CI fetch the picker already makes; the comment thread is fetched lazily in the background, once per row. ([#3167](max-sixty/worktrunk#3167), [#3197](max-sixty/worktrunk#3197), [#3223](max-sixty/worktrunk#3223), [#3195](max-sixty/worktrunk#3195), [#3231](max-sixty/worktrunk#3231)) - **Interactive picker runs on Windows**: The `wt switch` picker was Unix-only because its preview-tab keys shelled out through a per-process state file `cmd.exe` lacks; tab state moved to an in-memory atomic with native skim callbacks, lifting the platform gate. ([#3217](max-sixty/worktrunk#3217)) - **Picker keyboard shortcuts**: `Alt-y` copies the selected branch name, `Alt-o` opens the row's PR/MR in the browser, and `Alt-r` refreshes the list (picking up worktrees created or removed elsewhere). (Breaking: in the picker, remove moved from `Alt-r` to `Alt-x`) ([#3233](max-sixty/worktrunk#3233)) - **Picker uses the full terminal**: List height scales with the terminal (a roughly even split with the preview, minimum 3 rows) instead of a fixed 12-row cap, the table lays out at full width so toggling the preview off with `Alt-p` reveals the freed columns with no reflow, and a scrollbar appears when the list overflows. ([#3205](max-sixty/worktrunk#3205), [#3214](max-sixty/worktrunk#3214), [#3198](max-sixty/worktrunk#3198)) - **Picker filters on more of each row**: Typing a gutter sigil filters by row kind (`+` for linked worktrees, `@` for the current one), the fuzzy matcher ranks on the distinguishing path segment rather than the shared parent prefix, and rows with a PR/MR also match on its number, title, and author. ([#3143](max-sixty/worktrunk#3143), [#3208](max-sixty/worktrunk#3208), [#3252](max-sixty/worktrunk#3252)) - **Picker visual polish**: The legend recolored to dim-cyan and reordered so navigation leads, and preview loading placeholders moved to the dim-hint style (`↳` transient, `○` settled, `▲` failed). ([#3237](max-sixty/worktrunk#3237), [#3253](max-sixty/worktrunk#3253)) - **"Still waiting" status for slow commit-message generation**: A configured `commit.generation` command captures stdout, so a slow or hung LLM previously showed nothing while `wt step commit`/`squash` waited. After a 2s delay worktrunk now shows a dim, in-place `○ Waiting for the commit message (Ns)` status, escalating at 10s to reveal the exact shell-escaped invocation in a gutter beneath it; the block clears on completion, mirroring `wt list`'s stall footer. ([#3178](max-sixty/worktrunk#3178)) - **"Still waiting" status extended to more slow commands**: The same waiting status now covers three more foreground commands that were silent while a captured subprocess ran — the `wt config show --full` commit-generation self-test, the `wt switch pr:`/`mr:` host lookup, and the `wt config show --full` version check. The version check no longer caps its fetch at an aggressive 5s, instead showing the status while a slow-but-working request completes (with a generous ceiling so a non-interactive run can't hang). ([#3183](max-sixty/worktrunk#3183)) - **`wt config state logs profile` performance profiler**: A new subcommand turns a `-vv` `[wt-trace]` capture (a path argument, `-` for stdin, or the default `trace.log`) into a performance profile: subprocess time by command shape, the slowest calls, parallelism and peak concurrency, redundant cache-miss re-runs, and — for `wt list`/picker captures — derived latencies and a collect timeline. `--format=json` emits the same data, and every `-vv` bug-report bundle now inlines a rendered profile. ([#3184](max-sixty/worktrunk#3184), [#3186](max-sixty/worktrunk#3186)) - **`WORKTRUNK_VERBOSE` env var**: `WORKTRUNK_VERBOSE=0|1|2` mirrors `-v`/`-vv`, combined with any flag via `max` (the env sets a floor the flag can raise). Unlike the flags it's honored on the shell-completion path, which returns before flag parsing — so a slow tab-completion can be profiled for the first time. ([#3166](max-sixty/worktrunk#3166)) - **Aliases inherit the wrapped command's completion**: An alias that forwards `{{ args }}` to a single `wt` command (`co = "wt switch {{ args }}"`) now completes that command's arguments and flags — `wt co <Tab>` completes branches like `wt switch <Tab>` — instead of a generic stub. Bare dispatchers and multi-`{{ args }}` aliases keep the stub. ([#3172](max-sixty/worktrunk#3172), thanks @yzx9) - **`wt step copy-ignored --require-include`**: A new `--require-include` flag makes the copy a no-op unless a `.worktreeinclude` file exists in the source worktree (matching Claude Code desktop, where that file is required), reporting why it skipped as a hint in text mode and a `reason` field in `--format=json`. ([#3196](max-sixty/worktrunk#3196), thanks @yzx9) - **`wt step tether` honors `-C`**: The global `-C <path>` flag now sets the tethered command's working directory (`wt step tether -C frontend -- npm run dev`); teardown still watches the worktree root, so the command is reaped when the worktree is removed. ([#3207](max-sixty/worktrunk#3207)) - **Statusline rate-limit pace color grades by severity**: The pace segment's color now deepens (dim → dim-yellow → yellow) with the projected throttling severity, so an early-window burst stays muted while a costly projected lockout stands out. The displayed pace number is unchanged. ([#3229](max-sixty/worktrunk#3229)) ### Fixed - **Picker `Alt-x` removal updates the row in place**: Removing a worktree no longer re-collects the whole list (a flicker that reset the cursor to the top): an unmerged worktree's row morphs into a branch-only row while the worktree is removed in the background, and a merged worktree's row drops with the cursor landing on the row that slid up. A removal that can't safely happen — the current or main worktree, or a dirty or locked one — is declined with the same diagnostic `wt remove` prints, rather than a dead keypress or a disruptive `cd` home. The post-removal cursor lands by row identity, so it stays correct even under an active filter. ([#3262](max-sixty/worktrunk#3262), [#3199](max-sixty/worktrunk#3199), [#3211](max-sixty/worktrunk#3211), [#3225](max-sixty/worktrunk#3225)) - **Picker preview refreshes when its background fetch lands**: A diff/log/PR-view fetch that completed after its triggering keystroke used to sit unshown until the next keypress; the pane now updates on its own when the fetch lands. ([#3247](max-sixty/worktrunk#3247)) - **Picker rows stay aligned while filtering**: Typing a filter no longer slides the matched row left and drops its leading sigil, and `Alt-l`/`Alt-h` no longer scroll the list off its gutter. ([#3213](max-sixty/worktrunk#3213), [#3226](max-sixty/worktrunk#3226)) - **fish completions no longer recurse to the call-stack limit**: With worktrunk's fish lazy-load wrapper installed, co See merge request: Harmonybrew/homebrew-core!12862
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
prpreview tab for a worktree row in thewt switchpicker showed only the reference and URL. It now shows the full PR/MR title and the description rendered as markdown — the same content the--prsrows' pane already shows.How
The data rides the CI fetch the picker already makes, so there's no new network call:
gh pr list --head … --jsonis widened withtitle,body(a free widening of the existing call). GitLab (glab mr list), Azure (az repos pr list), and Gitea (tea api …/pulls) PR-list fetches are extended the same way, mappingdescription/bodyto a common field. Branch-workflow / pipeline paths (no PR) leave the new fields unset.titleandbody— were added toPrStatus, which the fetch fills and the pane reads. They serialize into the local CI cache (serde default + skip-if-none, so old cache entries stay readable), so the picker's prime-from-cache first frame can show them before the live fetch lands.wt list --format=jsonis unchanged:JsonCiis built field-by-field fromPrStatusand intentionally does not carry title/body.A new
src/commands/picker/pr_pane.rsmodule owns the shared rendering —header(reference + title),metadata_line(dim label + value at a fixed column), anddescription(markdown in the house gutter). Both the worktree pane (items::render_worktree_pr) and the--prspane (prs::PrSkimItem) build from these pieces, so the two read alike; the oldrender_pr_descriptionmoved here. The--prspane's output is byte-identical to before.On GitHub,
GhPr(the--prsrow) now readstitle/bodyfrom the flattenedGitHubPrInforather than its own fields, since the worktree fetch parsesGitHubPrInfodirectly and the duplicated keys would collide under#[serde(flatten)].Preview-pane caching
The worktree
prpane is memoized in the picker's in-memoryPreviewCache(the same cache the other tabs use), filled lazily on firstpreview()and invalidated by the collect handler'son_updatewhenever the livepr_statusslot changes — so the markdown body renders once per slot state rather than on every keystroke while the tab is active, matching the render-once model the--prsrows already followed. The tab-bar availability check now reads only the slot discriminant, so it no longer clones the (possibly large) body on every render. Two inline TODOs mark deliberate scope cuts surfaced in review: the deadtitle/bodyon GitHub's--prsopen_pr_status(GitLab already setsNone), andtitle/bodyintentionally absent fromwt list --json.Testing
pr_pane's helpers, the worktree pane's title-present/absent and body-present/absent branches, the fullpreview()→render_previewdispatch (extracted so the mode is testable without the per-process picker-state file), and the pane memoization + its invalidation are covered by unit tests; the serde-flatten change is pinned by the existing GitHub parse test. The four backends' new lines are exercised by the mocked-CLIci_statusintegration tests. The picker is#[cfg(unix)]-gated, so its tests don't run on Windows.