fix(hooks): an empty command list no longer leaves a bare heading - #3641
Merged
Conversation
`wt hook show` decided whether a section had printed anything from whether
the config held an entry for each hook type, not from whether any command
was rendered. A hook type declared with an empty command list has an entry
but no commands, so the section printed its heading and then stopped:
$ cat .config/wt.toml
post-switch = []
$ wt hook show
PROJECT HOOKS @ /path/.config/wt.toml
Both sections carried it, since the loop and the `(none configured)`
fallback were duplicated in `render_user_hooks` and `render_project_hooks`.
`render_hook_commands` now reports whether it wrote any rows, and the loop
plus fallback live once in `render_hook_section`, which both callers
delegate to. The flag means "something was printed", which is what the
`(none configured)` line claims.
The execution path was already correct: an empty list announces nothing,
and the JSON output omits it.
Also corrects a docstring in the same file that still described the
preview's pre-#3638 behavior ("shows a `vars.*` template raw").
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
worktrunk-bot
approved these changes
Jul 29, 2026
max-sixty
added a commit
that referenced
this pull request
Jul 29, 2026
Two commits landed on `main` while #3640's CI ran, so they ship in 0.70.0 but weren't in its changelog. The release's drift check caught them before the tag. - **#3641** — a user-facing fix: `wt hook show` printed a section heading and nothing else for a hook type declared with an empty command list. Added as its own Fixed entry. - **#3639** — help-text only, no behavior change, correcting `wt config alias dry-run`'s description of the `vars.*` preview. Folded into the existing hook-previews bullet, since it's the same feature's documentation catching up rather than a separate change. No version change; `v0.70.0` is tagged after this lands so the tag covers both. > _This was written by Claude Code on behalf of Maximilian_
1 task
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.
wt hook showdecided whether a section had printed anything from whether the config held an entry for each hook type, not from whether any command was rendered. A hook type declared with an empty command list has an entry but no commands, so the section printed its heading and then stopped:Both sections carried it, since the loop and the
(none configured)fallback were duplicated inrender_user_hooksandrender_project_hooks.render_hook_commandsnow reports whether it wrote any rows, and the loop plus fallback live once inrender_hook_section, which both callers delegate to. The flag means "something was printed", which is what the(none configured)line claims.The execution path was already correct: an empty list announces nothing, and the JSON output omits it. Verified against the built binary across four cases (project-only empty, user-only empty, an empty list alongside a real hook, and a filter naming the empty type), and pinned by
test_hook_show_empty_command_lists, which covers both the user and project halves. Reverting the flag to its old meaning fails the test on both.Also corrects a docstring in the same file that still described the preview's pre-#3638 behavior ("shows a
vars.*template raw"), the same drift #3639 fixed forwt config alias dry-run.