Skip to content

refactor(expand): label -v template expansion as source/result blocks - #3099

Merged
max-sixty merged 2 commits into
mainfrom
verbose-template-expansion-display
Jun 17, 2026
Merged

max-sixty merged 2 commits into
mainfrom
verbose-template-expansion-display

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Reworks the -v template-expansion view. It used to stack the template, a lone →, and the result in one shared gutter; the arrow on its own line read awkwardly and the shared gutter blurred input vs output.

Now each side is its own labeled block — an info header above a bash gutter:

○ eval source
  {{ branch | hash_port }}
○ eval result
  12107

The two headers carry the input/output distinction, so both blocks keep the same gutter with content at column 2 (no marker glyph, no in-gutter indent). Multi-line templates and results follow the same shape, one gutter line per source line.

expand_template emits no trailing blank. The standalone wt step eval adds one after the view; in a command pipeline the executor already separates the block from the next output (an unconditional trailing blank there would trip the no-double-blank guard).

This view also surfaces in wt switch -v, hooks, aliases, and wt -v list's deprecation preview — all snapshots regenerated. Known rough edge: wt -v list previews a deprecated worktree-path once per worktree, and those previews now sit back-to-back without a separating blank.

This was written by Claude Code on behalf of max

The verbose template-expansion view stacked the template, a lone `→`, and
the result in one shared gutter. The arrow on its own gutter line read
awkwardly, and the shared gutter blurred which side was input and which was
output.

Render each side as its own labeled block instead: an info header (`○ name
source` / `○ name result`) above a bash gutter. The headers carry the
input/output distinction, so both blocks keep the same gutter with content
at column 2 — no marker glyph or in-gutter indent. `expand_template` emits no
trailing blank; standalone callers (`wt step eval`) add one, while command
pipelines already separate the block from following output.

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 wt step eval --help example in src/cli/step.rs (the wt step eval -v '{{ branch }}' block under "List the available template variables with -v") still shows the pre-PR rendering — ○ Expanding eval followed by a → line — so once this lands, the help docs describe a format the code no longer emits. The auto-generated mirrors docs/content/step.md and skills/worktrunk/reference/step.md carry the same stale block.

Updated output would be:

$ wt step eval -v '{{ branch }}'
○ Available template variables
  branch        = feature/auth-oauth2
  worktree_path = /home/user/projects/myapp-feature-auth-oauth2
○ eval source
  {{ branch }}
○ eval result
  feature/auth-oauth2

feature/auth-oauth2

(The blank line between feature/auth-oauth2 and the stdout result reflects the new eprintln!(); in step_eval — worth including so the example matches what users will actually see in a terminal.)

Happy to push this as a follow-up commit once you've confirmed the rendering — it's a one-spot edit in src/cli/step.rs plus cargo insta test --accept for the help snapshots and cargo test --test integration test_docs_are_in_sync to refresh the mirrors.

The `wt step eval --help` example still showed the old `Expanding eval` /
`→` view. Update it to the labeled `source` / `result` blocks the code now
emits, including the trailing blank before the stdout result. Regenerates the
docs/content and skills/worktrunk mirrors.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 0124217 into main Jun 17, 2026
45 of 46 checks passed
@max-sixty
max-sixty deleted the verbose-template-expansion-display branch June 17, 2026 01:53
max-sixty added a commit that referenced this pull request Jun 17, 2026
A long release session lets main advance after the changelog is written;
/gpk merges onto current main, so the code stays complete but the
changelog can miss commits that landed in between. This release missed
#3099 that way. Add a step-11 precondition to re-fetch and diff against
the step-4 main tip, folding any user-facing commit in before merge.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Jun 17, 2026
… check (#3101)

Two corrections stemming from one root cause: #3099 landed on `main`
while v0.59.0 was being cut, after the changelog was written against an
earlier `main` tip.

- **CHANGELOG**: fold #3099 into the `wt step eval -v` entry (the `-v`
expansion now renders as labeled `source`/`result` blocks across eval,
switch, hooks, aliases, and `wt -v list`) and drop the stale `{{
template }} → result` phrasing. The v0.59.0 GitHub release notes are
updated to match.
- **Release skill**: `/gpk` squash-merges onto whatever `main` tip
exists at merge time, so a commit landing during the PR's CI wait ships
undocumented. Step 1 now records the cut-from tip, and step 12 verifies
`git log <cut-from>..origin/main` is just the release commit before
tagging. This checks only that nothing drifted in, rather than
cross-referencing every PR against the changelog (which would flag
intentionally-skipped dep-bump/CI commits).

> _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.59.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

- **Picker frees digit keys for filtering; preview tabs move to `Alt`**: In the `wt switch` picker, plain digits now go to the filter, so a branch name with a number in it can be typed directly. Preview tabs jump with `Alt-1`–`Alt-5` or cycle with `Tab`/`Shift-Tab`. (Breaking: `1`–`5` no longer switch preview tabs) ([#3079](max-sixty/worktrunk#3079))

- **Squash templates use `commit_details` instead of `commits`**: The squash commit-message template's `{{ commits }}` variable (commit subjects) is deprecated in favor of `{{ commit_details }}`, which renders as the bare subject when printed directly and also exposes `.subject` and `.body`. `wt config update` migrates `commits` to `commit_details` as a plain rename. ([#2985](max-sixty/worktrunk#2985))

- **`wt step eval -v` lists template variables**: `wt step eval -v` now prints the available template variables on stderr in the gutter style, above the template-expansion view. That expansion (also shown by `wt switch -v`, hooks, aliases, and `wt -v list`) renders the template and its result as separate labeled `source` / `result` blocks rather than a shared gutter. The result still goes to stdout, so `$(wt step eval …)` is unchanged. Since `eval` mutates nothing and is experimental, its `--dry-run` flag (which dumped the raw variable context) is removed rather than deprecated. ([#3078](max-sixty/worktrunk#3078), [#3099](max-sixty/worktrunk#3099))

### Fixed

- **Picker no longer freezes on the first keystroke**: With many worktrees, typing the first character in the `wt switch` picker locked the UI for several seconds. The fuzzy matcher shares rayon's global thread pool with worktrunk's git collection, which floods it with blocking subprocess calls, so the matcher queued behind them. Collection and preview work now run on a dedicated pool, keeping the matcher responsive. ([#3087](max-sixty/worktrunk#3087), thanks @bendrucker; fixes [#2926](max-sixty/worktrunk#2926), thanks @mahume for reporting)

- **Tab-completion covers all hook types**: `wt hook <type> <Tab>` completed configured command names for only seven of the ten hook types; `pre-switch`, `post-switch`, and `post-remove` returned nothing. Completion now derives the type from the canonical hook list, so every type completes its command names. ([#3070](max-sixty/worktrunk#3070))

- **Ctrl-C on a concurrent alias reports the right exit code**: Interrupting `wt step <concurrent-alias>` could report exit 143 (SIGTERM) instead of 130 (SIGINT), because a per-child SIGINT → SIGTERM → SIGKILL escalation could land a SIGTERM on a child during the grace window; the escalation also serialized across process groups, so repeated Ctrl-C could wait. wt now forwards the user's signal once per process group, so a cooperative child dies from the signal actually sent (130 on Ctrl-C); a second signal kills any survivor immediately. ([#3075](max-sixty/worktrunk#3075))

### Documentation

- **Per-worktree env vars**: A Tips & Patterns section shows how to give each worktree its own environment variables with direnv or mise. ([#3074](max-sixty/worktrunk#3074))

### Internal

- The commit-generation command is not rewritten to disk when its value is unchanged. ([#3084](max-sixty/worktrunk#3084))

## Install worktrunk 0.59.0

### Install prebuilt binaries via shell script

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/max-sixty/worktrunk/releases/download/v0.59.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.59.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.59.0

|  File  | Platform | Checksum |
|--------|----------|----------|
| [worktrunk-aarch64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.59.0/worktrunk-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.59.0/worktrunk-aarch64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.59.0/worktrunk-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.59.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.59.0/worktrunk-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.59.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.59.0/worktrunk-aarch64-unknown-linux-musl.tar.xz) | ARM64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.59.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.59.0/worktrunk-x86_64-unknown-linux-musl.tar.xz) | x64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.59.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.59.0">https://github.com/max-sixty/worktrunk/releases/tag/v0.59.0</a>.</p>
</details>
<hr>

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