Skip to content

feat(list): gutter sigils for local (/) and remote (|) branches - #3115

Merged
max-sixty merged 2 commits into
mainfrom
switch-gutter-sigils
Jun 18, 2026
Merged

max-sixty merged 2 commits into
mainfrom
switch-gutter-sigils

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The interactive wt switch picker widens its candidate list with --branches (local branches without a worktree) and --remotes (remote branches), but the shared list/picker gutter rendered a blank cell for every row without a worktree — so a local-branch-without-worktree and a remote branch looked identical. This adds gutter sigils that distinguish the three row kinds.

Scheme

The gutter marks each row by physical presence:

@ main                 worktree — current     (bright)
^ main-repo            worktree — primary     (bright)
+ feature-x            worktree — other       (bright)
/ local-feature        local branch, no worktree   (dim)
| origin/remote-feat   remote branch               (dim)

@/^/+ are unchanged. The two new glyphs echo their Status-column twins — / is the WORKTREE_STATE "branch" glyph and | the in-sync upstream glyph, both already rendered dim — so the gutter reads as a left-edge summary of the row's kind, and bright-worktree / dim-ref reinforces the presence gradient. The glyph is the primary signal (survives NO_COLOR); dim is reinforcement only. All glyphs are single-width ASCII, deliberately, to dodge skim's width_cjk clipping (see vendor/NOTES.md) — the gutter is the worst place for a clipped row.

Key decisions

Local vs remote is recorded structurally as ItemKind::Branch(BranchScope) at construction (new_branch / new_remote_branch), not inferred from the branch name — a local branch may legitimately be named origin/foo, so a name-prefix heuristic would misclassify it. The gutter renders in both the final and skeleton paths with matching dim, so there's no flash or flicker on progressive reveal.

A # sigil for PR rows (open PRs with no local branch) is intentionally not built here — see TODO(pr-rows) in render.rs. That row kind lives on a separate branch, and the picker skips CI/PR detection (a network call), so a PR-driven # would never render in the picker regardless. The scheme leaves # free for it.

Files

  • src/commands/list/model/item.rs — BranchScope enum, gutter_sigil(), new_remote_branch.
  • src/commands/list/render.rs — gutter rendering (final + skeleton).
  • src/commands/list/collect/mod.rs — remote rows use new_remote_branch.
  • src/cli/mod.rs — new gutter legend in wt list --help (the gutter glyphs were previously undocumented); docs/skill mirrors regenerated.

Testing

Covered by the existing wt list / wt switch snapshot suite (regenerated under nextest); the rendered-table diffs are confined to the gutter cell. JSON output is unchanged (both branch scopes still serialize as "branch"; the remote-qualified name already carries the distinction for scripts).

This was written by Claude Code on behalf of max

The shared list/picker gutter previously rendered a blank cell for every row
without a worktree, so a local branch without a worktree and a remote branch
were indistinguishable — a real gap in `wt switch --branches --remotes`, where
both are common.

The gutter now marks row kind by presence:

  @ / ^ / +   worktrees (bright, unchanged)
  /           local branch without a worktree (dim)
  |           remote branch (dim)

The branch glyphs echo their Status-column twins — `/` is the WORKTREE_STATE
"branch" glyph and `|` the in-sync upstream glyph, both dim — so the gutter
reads as a left-edge summary of the row's kind, with bright worktree vs dim ref
reinforcing the presence gradient. Glyphs are single-width ASCII to dodge skim's
width_cjk clipping (see vendor/NOTES.md); color is reinforcement only, never the
sole signal.

Local vs remote is recorded structurally on ItemKind::Branch(BranchScope) at
construction, not inferred from the branch name (a local branch may legitimately
be named `origin/foo`). Rendered in both the final and skeleton paths so there
is no flash or flicker on progressive reveal.

A `#` gutter sigil for PR rows (open PRs with no local branch) is left as a TODO
for the separate PR-rows branch: that row kind doesn't exist here, and the
picker skips CI/PR detection, so a PR-driven `#` would never render in the
picker anyway.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change reads cleanly — recording BranchScope structurally at construction (rather than inferring / vs | from a name prefix) is the right call, the exhaustive ItemKind::Branch(_) matches are all updated, the 2-cell gutter width is preserved, and the skeleton/final render paths stay in lockstep. Picker rows flow through collect::collect, so remote candidates pick up new_remote_branch and render | there too (confirmed by the switch_picker_with_branches_list snapshot showing / orphan-branch).

Holding off on approving only because codecov/patch is failing — and it's a one-line gap, not a real coverage hole.

The single uncovered added line is the ItemKind::Branch(_) => None arm of worktree_data_mut() in src/commands/list/model/item.rs. Its sibling worktree_data() is exercised by the existing test_list_item_worktree_data, which is why that arm is green; the _mut variant has no caller that hits its None path (the only production caller, in collect/mod.rs, only enters the Some branch). The line landed in the patch only because Branch → Branch(_) rewrote it.

Closing it is a one-liner in that same test:

#[test]
fn test_list_item_worktree_data() {
    // Branch item has no worktree data
    let item = ListItem::new_branch("abc123".to_string(), "feature".to_string());
    assert!(item.worktree_data().is_none());
    assert!(item.worktree_path().is_none());

    let mut item = ListItem::new_branch("abc123".to_string(), "feature".to_string());
    assert!(item.worktree_data_mut().is_none());
}

Happy to push that as a commit if you'd like, or you can fold it in.

The Branch(_) => None arm of worktree_data_mut() entered the patch via
the Branch -> Branch(_) rewrite and was the lone codecov/patch miss.
Extend the existing worktree_data test to exercise the mutable accessor.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 7421236 into main Jun 18, 2026
35 checks passed
@max-sixty
max-sixty deleted the switch-gutter-sigils branch June 18, 2026 06:00
@max-sixty max-sixty mentioned this pull request Jun 18, 2026
max-sixty added a commit that referenced this pull request Jun 18, 2026
Release v0.60.0 (minor bump from 0.59.0).

Minor because semver-checks flagged a breaking library-API change and
five new features landed since v0.59.0. The data-loss surface review (4
independent finders) cleared the one change that touches it (relocating
dirty linked worktrees, #3104).

### Improved
- Package installs now complete branch/worktree names via dynamic
registration (#3105, thanks @bendrucker)
- `wt step relocate` moves dirty linked worktrees (#3104, thanks
@lunaynx for reporting)
- `--dry-run` previews print to stdout (#3085)
- Picker gutter distinguishes local (`/`) and remote (`|`) branches
(#3115)
- `wt list --format=json` gains structured `repo`/`ci.repo` metadata
(#3021, thanks @jeremy0dell)
- `wt step eval --format=json` (#3106)
- `--format=claude-code` rejected on `wt list` / `wt config state get`
(#3116)

### Fixed
- `cargo install worktrunk` builds from crates.io again (#3124, fixes
#3123, thanks @kerrickstaley for reporting)
- Tab-completion works in repos with no commits (#3097, closes #3094)
- `wt config state get ci-status --format=json` honors
`[forge].platform` (#3120)

### Documentation
- `wt list --help` example tables fit the terminal (#3125)
- `/wt-switch-create` cross-repo handling reworked (#3118)
- Help-text and web-doc refinements (#3096, #3108, #3110, #3112, #3126)

Full notes in `CHANGELOG.md`.

> _This was written by Claude Code on behalf of max_
max-sixty added a commit that referenced this pull request Jun 18, 2026
Reconcile the v0.60.0 release with the custom-columns feature. Both sides
changed `JsonItem::from_list_item`: main replaced the `repo_url` arg with a
`repo: Option<&GitRepoInfo>` + `ci_provider_override` pair (#3021, #3120),
while this branch added a trailing `custom_columns` arg. The merged signature
carries all three (main's two, then `custom_columns`), and every call site
(`to_json_items`, the statusline path, and the JSON unit tests) passes the
combined argument list.

`ItemKind::Branch` also gained a `BranchScope` payload on main (gutter sigils,
#3115); the `new_branch_with_scope` constructor now sets both `custom_values`
and `kind: ItemKind::Branch(scope)`. `to_json_items` keeps this branch's
snapshot-based `all_vars` read alongside main's `repo_info`/forge-platform
lookups. The `wt list --help` snapshot was regenerated from the merged
`cli/mod.rs`, combining main's width-chopped example tables with the
custom-columns column row and config section.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Jun 18, 2026
Reconcile the v0.60.0 release with the custom-columns feature. Both sides
changed `JsonItem::from_list_item`: main replaced the `repo_url` arg with a
`repo: Option<&GitRepoInfo>` + `ci_provider_override` pair (#3021, #3120),
while this branch added a trailing `custom_columns` arg. The merged signature
carries all three (main's two, then `custom_columns`), and every call site
(`to_json_items`, the statusline path, and the JSON unit tests) passes the
combined argument list.

`ItemKind::Branch` also gained a `BranchScope` payload on main (gutter sigils,
#3115); the `new_branch_with_scope` constructor now sets both `custom_values`
and `kind: ItemKind::Branch(scope)`. `to_json_items` keeps this branch's
snapshot-based `all_vars` read alongside main's `repo_info`/forge-platform
lookups. The `wt list --help` snapshot was regenerated from the merged
`cli/mod.rs`, combining main's width-chopped example tables with the
custom-columns column row and config section.

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.60.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

- **Package installs complete branch and worktree names**: A plain `brew install worktrunk` (or other package install) now tab-completes branch and worktree names, not just subcommands and flags. `wt config shell completions <shell>` emits a dynamic registration that calls the binary at completion time (the maintained `clap_complete::env` path), matching what `gh`, `rustup`, and `kubectl` ship. ([#3105](max-sixty/worktrunk#3105), thanks @bendrucker)

- **`wt step relocate` moves dirty linked worktrees**: Relocating a linked worktree with uncommitted or untracked changes no longer skips it. `git worktree move` carries those files along, so the dirty-skip was a worktrunk policy rather than a git limitation. The main worktree still skips when dirty (without `--commit`), since its relocation falls back to `git checkout`, which refuses to switch over a dirty tree. ([#3104](max-sixty/worktrunk#3104), thanks @lunaynx for reporting)

- **`--dry-run` previews print to stdout**: `wt hook <type>`, `wt step relocate`, `wt step prune`, `wt step copy-ignored`, and `wt config shell install`/`uninstall` now send their `--dry-run` preview to stdout (the command's answer) while narration stays on stderr. This matches `wt list`, `git clean -n`, and `terraform plan`, and keeps previews pageable and pipeable. (Breaking: scripts reading these previews from stderr should now read stdout) ([#3085](max-sixty/worktrunk#3085))

- **Picker gutter distinguishes local and remote branches**: With `--branches` and `--remotes`, the `wt switch` picker marks each row's kind in the gutter: `/` for a local branch without a worktree and `|` for a remote branch, alongside the existing `@`/`^`/`+` worktree glyphs. ([#3115](max-sixty/worktrunk#3115))

- **`wt list --format=json` gains structured `repo` metadata**: JSON output adds `repo` (the local checkout's primary remote) and `ci.repo` (the repository `ci.url` targets, which differs for fork PRs) objects carrying `host`/`owner`/`name`/`provider`; the existing `repo_url` and `ci.repo_url` strings remain. The provider honors the configured `[forge].platform` on hosts that can't be auto-detected. ([#3021](max-sixty/worktrunk#3021), thanks @jeremy0dell)

- **`wt step eval --format=json`**: `wt step eval` gains a structured `{name, template, result}` JSON lane on stdout, the machine-readable analog of its `-v` view. Text mode is unchanged. ([#3106](max-sixty/worktrunk#3106))

- **`--format=claude-code` rejected where it never applied**: `wt list` and `wt config state get` accepted `--format=claude-code` silently and treated it as `table`; the value only ever meant anything on `wt list statusline`. Both now fail fast with `invalid value 'claude-code'`. (Breaking: `wt list --format=claude-code` and `wt config state get --format=claude-code` now error) ([#3116](max-sixty/worktrunk#3116))

### Fixed

- **`cargo install worktrunk` builds from crates.io**: Installing from crates.io failed to compile with `environment variable VERGEN_GIT_DESCRIBE not defined at compile time`, because the package archive has no `.git` for the build script to read. The version lookup now falls back to the cargo package version when git-describe is unavailable. ([#3124](max-sixty/worktrunk#3124), fixes [#3123](max-sixty/worktrunk#3123), thanks @kerrickstaley for reporting)

- **Tab-completion works in repos with no commits**: `wt switch <TAB>` and `wt remove <TAB>` returned nothing on a fresh `git init` repo, because the unborn default branch has no entry under `refs/heads/`. Completion now also draws on worktree branches, so the unborn `main` (and any `wt switch --create` branch on an empty repo) completes. ([#3097](max-sixty/worktrunk#3097), closes [#3094](max-sixty/worktrunk#3094))

- **`wt config state get ci-status --format=json` honors `[forge].platform`**: On a self-hosted host the parser can't recognize (Gitea, Azure DevOps, GitHub Enterprise on a generic domain), this path reported `provider: "unknown"` while `wt list --format=json` reported the configured provider. All structured-output paths now route the `[forge].platform` override through one accessor, so they stay consistent. ([#3120](max-sixty/worktrunk#3120))

### Documentation

- **`wt list --help` example tables fit the terminal**: The captured `wt list` example tables in `--help` chop to terminal width with a dimmed ellipsis (matching real `wt list`) instead of word-wrapping and shearing their columns; hand-authored command examples still wrap. ([#3125](max-sixty/worktrunk#3125))

- **`/wt-switch-create` cross-repo handling reworked**: The Claude Code plugin command's skill reworks how it creates and enters a worktree in another repo, built around what the harness actually does (`EnterWorktree` re-roots within the current repo; a `cd` reaches another repo when it's in `additionalDirectories`). The procedure dropped from five steps to three. ([#3118](max-sixty/worktrunk#3118))

- **Help-text and docs refinements**: `--format` help renders its values inline (`[possible values: table, json]`) instead of an expanded block; `wt switch` and `wt step push` help got smaller clarifications; and web-doc terminal blocks no longer wrap command-only lines. ([#3096](max-sixty/worktrunk#3096), [#3108](max-sixty/worktrunk#3108), [#3110](max-sixty/worktrunk#3110), [#3112](max-sixty/worktrunk#3112), [#3126](max-sixty/worktrunk#3126))

## Install worktrunk 0.60.0

### Install prebuilt binaries via shell script

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-installer.sh | sh && wt config shell install
```

### Install prebuilt binaries via powershell script

```sh
powershell -ExecutionPolicy Bypass -c "irm https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-installer.ps1 | iex"; git-wt config shell install
```

### Install prebuilt binaries via Homebrew

```sh
brew install worktrunk && wt config shell install
```

## Download worktrunk 0.60.0

|  File  | Platform | Checksum |
|--------|----------|----------|
| [worktrunk-aarch64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-aarch64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-x86_64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-pc-windows-msvc.zip](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-x86_64-pc-windows-msvc.zip.sha256) |
| [worktrunk-aarch64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-aarch64-unknown-linux-musl.tar.xz) | ARM64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-aarch64-unknown-linux-musl.tar.xz.sha256) |
| [worktrunk-x86_64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-x86_64-unknown-linux-musl.tar.xz) | x64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.60.0/worktrunk-x86_64-unknown-linux-musl.tar.xz.sha256) |



### Install via Cargo

```sh
cargo install worktrunk && wt config shell install
```

### Install via Winget (Windows)

```sh
winget install max-sixty.worktrunk && git-wt config shell install
```

### Install via AUR (Arch Linux)

```sh
paru worktrunk-bin && wt config shell install
```
</pre>
  <p>View the full release notes at <a href="https://github.com/max-sixty/worktrunk/releases/tag/v0.60.0">https://github.com/max-sixty/worktrunk/releases/tag/v0.60.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!11933
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.

2 participants