Repository navigation
Make wt config show a real diagnostic - #3999
Conversation
`config show` reported a broken config and exited 0, so nothing scripted could branch on it, and three of its claims were wrong. - Exit non-zero when a config is invalid. The whole report still renders; `AlreadyDisplayed` carries only the code. Warnings (unknown keys, deprecations) leave the exit at 0. - Validate `[list] columns` against the resolved config, with the message `wt list` uses. The names resolve in the command layer, so a typo used to surface only when `wt list` aborted on it. - Report project commands still awaiting approval under PROJECT CONFIG. The config dump reads as "these run", but a fresh clone's hooks stop at the approval prompt the first time one fires. - Render SYSTEM CONFIG unconditionally, naming the default path when no file exists, instead of folding its absence into a hint under USER CONFIG. The help text said "Also shows system config if present" while the output reported its absence. - Replace "If a config file doesn't exist, shows defaults that would be used" — it printed no defaults — with what the command actually reports. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`wt config update --print > config.toml` kept the migrated TOML and lost every `[projects."…"] approved-commands` array it named: the write path copies them to `approvals.toml` before rewriting, but `--print` writes no file, and the dropped keys never appear in the printed output. `--print` now names the affected `[projects]` entries on stderr, with the command that migrates them, leaving stdout pipeable. `Approvals:: load_from_config_file` becomes public so the warning can list them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`wt config create` wrote a file that warned about `[list] json-schema` the first time anything read it: every line of the template is a comment, so the pending default it documents was never actually set. `create` now routes the commented template through `compute_migrated_content`, emitting exactly what `wt config update` would write, from the table that owns those defaults. `wt config show` gains an `EFFECTIVE` section: the value every scalar setting resolves to once `--config-set`, `WORKTRUNK_*`, the matching `[projects]` entries, the global keys and system config have applied. The file sections show what each layer contains; reading a value off them meant replaying the merge by hand. Every scalar is listed rather than only those differing from a default — a diagnostic is read to find out what is in force, and a differs-only list answers that only for a reader who already knows the defaults, while usually rendering an empty section. Arrays and tables accumulate across layers rather than replacing, so the file dumps already show every contribution and the section leaves them out. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…44, #59, #60) Claims the source contradicts (#59, #60): - `[list] full` bundles the CI column, and the Summary column only when `[list] summary` and a `[commit.generation]` command are both set. - `[list] timeout-ms` is discarded under `--full`. - `columns = ["branch", "status", "ci", "path"]` and `json-schema = 2` sat under "values shown are defaults"; neither is a default, and the real default column set carries no `ci`. That sentence is now scoped to the blocks it holds for. - Env overrides reach scalars only — arrays and maps carry a single string per key, so those go through `--config-set`. - `XDG_CONFIG_DIRS` is Unix-only, and replaces a platform default list that differs on macOS. - `[projects."…"] approved-commands` was documented as live; it is deprecated. Its pattern rule moves to `wt config approvals`, which now shows what `approvals.toml` actually looks like. Undocumented surface (#60): `WORKTRUNK_APPROVALS_PATH` beside its two siblings; `skip-shell-integration-prompt` and `skip-commit-generation-prompt`, which now reach the generated template; `--config <path>`, which had appeared only inside generated help blocks, with its place in Precedence. Structure: - #31 — `### List`, `### Commit`, … sat at H3 under a `## Command config` wrapper, and the site ToC caps at H2, so none were reachable from the sidebar. The wrapper is gone and its children move up a level; heading text is unchanged, so every `/config/#…` anchor still resolves. - #42 — `shell`, `update`, and `plugins` join the subdoc markers, which is what puts `wt config update` (named in the deprecation warnings) and `wt config shell show-theme` on the page. - #43 — a per-key "which file" table near the top, and the `url` column row now says the template comes from project config. - #44 — `[post-start] copy = "wt step copy-ignored"` in both copy-ignored sections, and so in the project template. - #25 — the in-repo `worktree-path` example says to ignore the directory. Co-Authored-By: Claude Fable 5.1 <[email protected]>
A misplaced key whose home is a `[projects."…"]` entry gets a note saying where to put it, and the note carried the literal placeholder: `add it under [projects."<id>"] in user config`. The reader then had to derive the identifier — which `config show` prints two lines above, under PROJECT CONFIG, precisely because deriving it from the remote URL is the hard part. `config show` now passes that identifier down, so the suggested key is one the reader can paste. Config load has no repository in hand and keeps the placeholder. The identifier is resolved once at the top of the report and threaded through the sections, so the `Identifier:` line and the hint cannot disagree. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01BGS51k25qzfeJEJ8dfxEEY
#60) The `USER_CONFIG` block is rendered three ways — the config page, terminal help, and `dev/config.example.toml`, which `wt config create` writes — and two of its links were written as bare same-page fragments. On the page they resolved; everywhere else they landed as `Custom prompt templates (#custom-prompt-templates)` and `custom columns (#custom-columns)`, pointing at nothing (#30). Written root-relative, the sync pipeline expands them to `https://worktrunk.dev/config/#…` for the portable copies and the page keeps its anchor. Also from the same block (#30): five `[commit.generation]` tables sit under five `###` headings, one per CLI, and uncommenting the section wholesale is a TOML duplicate-key error. The lead now says they are alternatives. #60: `{{ repo }}` is also spelled `{{ main_worktree }}` — one value, two names, and only one of them documented. `wt step copy-ignored --from` defaulted to "main worktree" while the code resolves the *primary* worktree, which for a bare repo is the default-branch worktree instead. #42: `create` is the one `wt config` subcommand still without a subdoc marker, and a comment beside it now says why — its `after_long_help` is the config page's own body, so a subdoc would nest the page inside itself. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01BGS51k25qzfeJEJ8dfxEEY
Promoting `### List`, `### Commit`, … out from under `## Command config` (#31) removed the `#command-config` anchor, and the worktrunk skill's "Configure command defaults" entry still pointed at it. It now names the sections that replaced it and links the first. The `writing-user-outputs` skill's model diagnostic message ends `run wt config validate for details`. There is no `wt config validate`; the command that reports what is wrong with a config is `wt config show` — the same command the skill's own warning-placement table routes these issues to (#14). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01BGS51k25qzfeJEJ8dfxEEY
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01XAUYWFN9d9oh6jyoQiouHb
The typos hook's `unparseable` → `unparsable` fix landed in the source without the insta snapshot that renders it, so `help_config_show` failed. Regenerated, along with the config mirrors. While there: the sentence wrapped mid-code-span, so the renderer closed the dim run at the line break and reopened it over the following clause — the terminal showed `[list]` dimmed, then `columns name no column answers to, and project commands still awaiting` dimmed, which is not the span anyone wrote. Rewrapped so `[list] columns` stays on one line. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01XAUYWFN9d9oh6jyoQiouHb
worktrunk-bot
left a comment
There was a problem hiding this comment.
Three accuracy points inline. Nothing structural — the diagnostic itself holds together: the exit-code contract is consistent across the three file sections (config_show_invalid_{user,project,system}_* all pin exit_code: 1, warnings-only pins 0), threading the resolved identifier through with_scope_note keeps the Identifier: line and the misplaced-key hint from disagreeing, and format_dropped_approvals_warning is correctly gated on DeprecationKind::ApprovedCommands with the entries read back from the candidate's own file rather than from the merged config.
One asymmetry not worth its own thread: in render_user_config the check_and_migrate Err arm sets invalid = true, but the identical arm in render_project_config doesn't. A parse failure is caught either way by the toml::from_str::<ProjectConfig> below, so nothing observable changes today — it only means the two sections would answer "is this sound?" differently if check_and_migrate ever failed for a non-parse reason.
Reviewed at 25e1907; the wording/snapshot fix in that commit clears the help_config_show mismatch that was failing test (linux), test (macos), and code-coverage on the previous head.
…orktree
`render_column_selection` returned `Ok(false)` when `resolve_custom_columns`
failed, so a zero width, a blank header, an unknown template variable, or more
than 256 entries left `wt config show` green while `wt list` aborted on it —
the exact split the `columns` check exists to close. The resolve now reports
its own failure. It also runs before the empty-selection early return, because
custom columns append to the default set: a broken definition aborts `wt list`
whether or not `[list] columns` names it, and the default case sets no
selection at all.
"Every scalar is listed" wasn't true — the three `[commit.generation]` prompt
templates and the two first-run prompt flags are absent — and an absent row
read as "nothing sets this" is the misreading the differs-only design was
rejected to avoid. Both the docstring and the help text now say what the
section covers and why those five are out.
`{{ main_worktree }}` is the deprecated old name for `{{ repo }}`, not a second
spelling: it is in `DEPRECATED_TEMPLATE_VARS`, so following that line earns a
deprecation warning on every load. Dropped from the worktree-path variable
list.
Also set `invalid` in the project-config `check_and_migrate` error arm, which
its user-config twin already did.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XAUYWFN9d9oh6jyoQiouHb
|
All three applied, plus the The custom-columns one was the substantive catch: reproduced your On the EFFECTIVE claim I took the narrow-it option for all five rather than adding rows: the templates are multi-line strings that would swamp a one-line-per-row section, and the two prompt flags record whether a prompt was answered rather than configuring anything a reader is diagnosing. Stated in both the docstring and the help text, as you said it had to be.
|
|
All three landed as described — and running the custom columns before the empty-selection return is the right call: with no Two things still open, one of them red CI.
The EFFECTIVE narrowing isn't in front of the reader who sees the section. The docstring and Smaller: the new resolve-failure arm (show.rs:774-777) has no test — nothing under Evidence
|
The `main_worktree` removal reaches `wt config create --help` through `dev/config.example.toml`, which regenerates from the same USER_CONFIG block — so the snapshot had to be taken after that file was rewritten, not before. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01XAUYWFN9d9oh6jyoQiouHb
worktrunk-bot
left a comment
There was a problem hiding this comment.
Verified the snapshot regeneration in 9db35a1: cargo test --test integration help:: is 56/56 on the merged tree, so the red on test (linux), test (macos), and code-coverage clears at this head.
One point inline that hasn't come up yet — the reach of the new exit-code contract.
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01XAUYWFN9d9oh6jyoQiouHb
Adding the `update` subdoc marker is what puts `wt config update`'s `after_long_help` on the config page, so #3994's removal clause reaches the mirrors here rather than there. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01XAUYWFN9d9oh6jyoQiouHb
…example (#4006) ## Problem The `worktree-path` examples in the user-config guide are introduced as being **"for repo at `~/code/myproject`"**, and every example states the path it produces. For all but one, that arithmetic checks out. The bare-repository example doesn't: ```toml worktree-path = "{{ repo_path }}/../{{ branch | sanitize }}" ``` Heading claimed `~/code/myproject/feature-auth`. With `repo_path` at `~/code/myproject` as the section says, `{{ repo_path }}/../feature-auth` resolves to `~/code/feature-auth` — one directory up from the stated result. ## Fix The template is right; the heading silently switched the repo's location without saying so. `{{ repo_path }}` for a bare repo is the bare directory itself (as the variable list a few lines above states), so the claimed result holds only when that directory is a hidden child — the `myproject/.git` layout that [tips-patterns.md documents](https://github.com/max-sixty/worktrunk/blob/main/docs/src/content/docs/tips-patterns.md#bare-repository-layout), and that `wt switch`'s bare-repo offer writes this exact template for. So the heading now names it: > Bare repository cloned to `~/code/myproject/.git` (`~/code/myproject/feature-auth`): Edited in `src/cli/mod.rs` (the primary source); the four generated mirrors and two `--help` snapshots are regenerated output. ## Testing No regression test — this is a documentation string with no behavior attached. The generated mirrors are pinned by the existing sync tests, which is what caught them here: - `cargo test --test integration readme_sync` — 18 passed (regenerates `dev/config.example.toml`, `docs/src/content/docs/config.md`, and both `skills/.../reference/config.md` mirrors). - `cargo insta test --accept --test integration -- test_help` — 47 passed (`help_config_create`, `help_config_long`). - `cargo fmt --check` — clean. - `cargo test --test integration` — 2048 passed, 1 failed. <details><summary>The one integration failure is a sandbox artifact, not a regression</summary> `step_copy_ignored::test_copy_ignored_preserves_file_executable_permissions` expects `0644` and gets `0664`. The tend sandbox runs with `umask 0002` (group-writable) rather than the `0022` the test assumes. Confirmed unrelated: it reproduces identically with this branch's changes stashed, i.e. on the merge base. Both `ci` and `coverage` on `main` are green at `2026-09-03T10:17:26Z`. This diff touches only doc strings and snapshot files and cannot reach file-permission code. </details> <details><summary>Checked against the in-flight docs PRs</summary> #4000, #3999, and #3998 each touch the same five files (`src/cli/mod.rs` plus the four config mirrors), so I checked for the duplication that sank #4001. None of them edits the `worktree-path` examples region, and `git merge-tree` against each reports a clean merge with this branch. </details> Co-authored-by: worktrunk-bot <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
test_docs_are_in_sync clears at f7905a15 — I reran it against the merged tree and it passes with nothing rewritten, so the three config.md mirrors now carry the pi entry b8f59e2a6 merged in.
Two inline on 5f19c507b. The first is the one that matters: --format json now carries the exit-code contract, but derives it from the column check alone, so it still answers 0 for a config the text form calls invalid.
worktrunk-bot
left a comment
There was a problem hiding this comment.
Two things on 3caf96ad7. The tests themselves check out — I ran all three against the merged tree and they pass, and the ansi_strip on the dropped-approvals assertion is the right fix, since <bold> sits between 2 and [projects] in that warning.
The eight writeln! reflows are coverage-shaped, not readability-shaped. Each one lands on a line codecov/patch flagged as a miss at f7905a15 — in that commit's numbering, show.rs 660, 1098, 1108, 1115, 1129, 1137, 1158, 1214, 1221, every one of them the closing )?; of a multi-line macro — while the other 40 multi-line writeln!( in the file are untouched, including the one on the very next line at show.rs:656. That the only miss in an eight-line macro was the )?; is the tell that the block was reached: the miss isn't the write, it's the ?. These renderers write into a String through fmt::Write, which cannot return Err, so llvm-cov records an early-return region on the )?; line that no input can ever hit. Collapsing the macro onto one line moves that region next to covered code and the line reports green — the number moves, the untaken branch doesn't.
CLAUDE.md → Coverage: "neither the code nor the tests get contorted to move the number." The codebase already carries the form that removes the region instead of hiding it — let _ = writeln!(…), 42 sites in src/, including format_dropped_approvals_warning in this same PR (update.rs:159). Applying that to the renderers is durable in a way the reflow isn't: as landed, the next multi-line writeln! added to render_effective_config brings the miss straight back.
Smaller, same commit: test_config_show_without_project_identifier_uses_global_worktree_path executes the None arm at show.rs:1085 but cannot fail on it. The test config has no [projects] entry, so worktree_path_for_project(id) and worktree_path() return the same string and the assertion holds whichever arm runs; likewise !stdout.contains("awaiting approval") is satisfied by the load_project_config() guard two lines further down, since the test writes no project config. It covers the lines without defending the behavior.
The other point is inline.
worktrunk-bot
left a comment
There was a problem hiding this comment.
Two inline. The first is on 94481d9cc and re-opens the text/JSON split the earlier rounds closed; the second is on the create change.
The description no longer matches the diff. 4e7e5d785 narrowed this to 21 files, and the body still presents work that is no longer in it: the EFFECTIVE section, the unconditional SYSTEM CONFIG render, the [projects."…"] hint that resolves the real identifier, and both <details> blocks of config-page corrections — docs/src/content/docs/config.md now moves 11 lines, all of them the after_long_help text this PR does change. "Reviewable files" names src/cli/mod.rs, src/commands/config/mod.rs and skills/worktrunk/SKILL.md, which the PR doesn't touch, and the UX survey list presumably went with the docs. A maintainer reading it to decide the merge is reading about a different change.
#4038 removes the premise under the create change. It deletes DeprecationRule::PendingDefault and DeprecationKind::JsonSchemaUnset outright, so compute_migrated_content("", ConfigFileKind::User) returns empty, wt config create writes only the commented template again, and test_config_init_creates_file's new [list]\njson-schema = 2 assertion fails. Whichever of the two lands second has to account for it.
Superseded by the review on a later commit.
worktrunk-bot
left a comment
There was a problem hiding this comment.
One point inline, on 94481d9cc..ebb87bcc9: the Err(_) => Some(source_config) arm now exits 0 while publishing a user.config that has silently lost the system layer, so the JSON health check reports a config wt is not using. Evidence and the direction are in the thread — it's a residual of the change I asked for last round, not a new regression in the arm itself.
The rest of the increment holds up. I built the merged tree and ran config_show:: and config_init:: (188 passing). Both override paths now exit 0 on both surfaces, and the malformed-system-config misattribution from the earlier round is fixed as a side effect — user.config is no longer nulled for a user file that parses. wt config create emits one live [list], the created file parses, wt config update on it is a no-op, and --project output is byte-identical to the plain commented template.
codecov/patch is red at this head — 96.52% of diff hit against a 98.22% target — which CLAUDE.md → Coverage makes a merge gate needing your explicit sign-off. Handing over the arithmetic: all eight missed lines are in show.rs, and they sit on paths that do have integration tests (test_config_show_reports_unreadable_source_and_continues::case_1_system drives render_system_config's read-error arm; test_config_show_rejects_invalid_approvals_file drives the ApprovalsDiagnostic::Invalid arm). Three of the eight are a closing } or a blank line. So this reads as llvm-cov region attribution rather than an untested path — the same shape as the earlier round here — but it is your call, not mine.
worktrunk-bot
left a comment
There was a problem hiding this comment.
Non-blocking — the approval already on this PR stands, and nothing below was introduced by this diff.
One inline, on the same contract as the earlier rounds but on a state that predates the PR: a user config that parses and then fails validation makes wt discard every layer and run on pure defaults, while config show exits 0 and its USER CONFIG section shows no error at all. It is the last case I can find where the report is green on a config wt is not using, so it is worth either closing here or naming as out of scope.
The system-layer fix is confirmed at 52a234c6b in its own thread.
# Conflicts: # src/commands/config/show.rs
worktrunk-bot
left a comment
There was a problem hiding this comment.
Three things on 689559a53. The LoadError::Validation probe is the right signal and it closes the exit-code hole from the last round — I reproduced the target case at this head (worktree-path = "" in the user file: both surfaces exit 1) and ran config_show::, help::, config_init:: and test_docs_are_in_sync on the merged tree, 250 passing. Two of the three are about the states the new probe now reaches that the report doesn't explain; both are inline. The third is the reach of the contract itself.
Semantically-invalid env vars now fail the health check, while the --config-set twin still passes it. apply_cli_overrides probes its candidate with deserialize_and_validate, so --config-set 'worktree-path=""' drops just that layer, records a LoadError::CliOverride, and exits 0 with the file config intact. The env overlay's fallback probes with toml::Value::Table(merged_table.clone()).try_into::<Self>() — deserialize only — so a semantically-invalid env var passes the probe, poisons the merged table, and surfaces at finalize as LoadError::Validation. That difference was invisible before this commit; now it decides the exit code, and the two ephemeral layers answer differently for the same mistake:
$ cat "$WORKTRUNK_CONFIG_PATH"
[list]
columns = ["branch"]
json-schema = 2
$ wt --config-set 'worktree-path=""' config show --format=json | jq -c .user.config
{"list":{"columns":["branch"],"json-schema":2},"projects":{}} # exit 0
▲ Ignoring --config-set overrides: worktree-path=""
$ WORKTRUNK_WORKTREE_PATH= wt config show --format=json | jq -c .user.config
{"projects":{}} # exit 1
▲ Config validation warning: worktree-path cannot be emptyNote the payload as well as the code: in the env case the file's settings are gone — at 52a234c6b too, so that half predates the commit. The env layer isn't dropped as a unit the way the CLI one is, so one env var discards both config files. Giving the env fallback the same probe closes both halves at once; I built and ran this at this head:
if let Err(err) = deserialize_and_validate(&merged_table)
&& deserialize_and_validate(&file_table).is_ok()
{
warnings.push(LoadError::Env { err, vars: … });
merged_table = file_table;
}The file_table guard is what keeps attribution honest — when the file is what fails validation, the env layer doesn't get blamed for it. Verified across all three cases: env-semantic failure over a good file → exit 0, user.config keeps {"list":{"columns":["branch"],"json-schema":2}}, stderr reads ▲ Ignoring env var overrides: WORKTRUNK_WORKTREE_PATH=; invalid file with a valid env var → still exit 1, unattributed; and the type-invalid case test_config_show_json_allows_invalid_runtime_override pins → still exit 0. The line is outside this diff, so I haven't pushed it — say the word and I will.
The 689559a53 help-text change checks out: after the origin/main merge brought in #4038, wt config create writes a file byte-identical to dev/config.example.toml, wt config update on it is a no-op and wt config show exits 0 — so "with the following content" is now literally true, and the create.rs and config_init.rs changes this PR carried have collapsed to nothing against the new base. That closes the #4038 collision from the earlier round.
Superseded by the review on a later commit.
|
The overall-review environment-layer finding is also fixed in
|
worktrunk-bot
left a comment
There was a problem hiding this comment.
Two things on 52584f202, both inline. The first is the one that matters: the new per-file validate() reached only the text surface, so the two forms answer differently again.
render_user_config_diagnostics now validates each file in isolation, but the JSON path's own per-file checks are still deserialize-only, and it derives semantic validity from LoadError::Validation — a whole-stack signal that goes quiet as soon as a higher layer supplies a valid value for the bad key. Built the merged tree and reproduced both halves; I also built 689559a53 and confirmed both states answered 0/0 there, so this is a divergence the commit opened rather than one it inherited.
# system config `worktree-path = ""`, user config with a valid worktree-path
$ wt config show # SYSTEM CONFIG → ✗ Invalid config / worktree-path cannot be empty
exit=1
$ wt config show --format=json
exit=0
# user config `worktree-path = ""`, WORKTRUNK_WORKTREE_PATH set to a valid template
$ wt config show # USER CONFIG → ✗ Invalid config / worktree-path cannot be empty
exit=1
$ wt config show --format=json
exit=0Which surface is right is your call — flagging a file that holds an invalid value even when a higher layer supersedes it is defensible, and it is the more useful answer — but a health check and its machine-readable twin shouldn't disagree about it.
The second is the merge_layer comment, which the rewrite made untrue. Details in the thread.
What I ran
Built the merged tree at 52584f202 and a worktree at 689559a53, and drove both binaries against a scratch repo with HOME, XDG_CONFIG_HOME, WORKTRUNK_CONFIG_PATH and WORKTRUNK_SYSTEM_CONFIG_PATH pointed into a tempdir. cargo test --test integration config_show:: is 190 passing and list_config:: 43 passing on the merged tree, including the three new cases and the reworked list_config_env_override_validation_failure snapshot.
Checked and cleared while going through the increment: WARNED_MISSING_CONFIG_PATHS is load-bearing rather than redundant — I deleted just the .insert(…) conjunct and rebuilt, and --config /nonexistent/… config show --format=json went back to printing Config file not found twice (the text form prints once either way, since it no longer calls load_with_warnings itself). .lock().unwrap() matches WARNED_UNKNOWN_PATHS in deprecation.rs, and widening UserConfig::validate to pub is required, not over-exposure — show.rs is in the bin crate.
|
Confirmed at The env probe landed with the The other two from that round hold too. A semantically-invalid source now renders The one thing the per-file Every check is green at this head, |
worktrunk 0.77.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 - **`wt list` sizes and aligns its columns to the terminal width**: one long branch name no longer sizes the Branch column for every row — it caps at 32 characters and elides, so a narrow terminal keeps its other columns instead of degenerating into a branch list. `Remote⇅` stops holding blank space open in a repo with no remote, and alignment now follows the value type. `--format=json` still carries the whole name. ([#3998](max-sixty/worktrunk#3998)) - **`wt list` names what it hid and marks detached worktrees**: the summary reads `hidden: Path, Commit` instead of counting columns, a detached worktree shows `⊘` rather than borrowing `⚑`, and a prunable row leaves its cells blank instead of showing loading dots that never resolve. ([#3998](max-sixty/worktrunk#3998)) - **`wt list --format=json` gains a `marker` field and stops reporting `detached` twice**: the branch marker set by `wt config state marker` is now readable without parsing it out of `symbols`, and `state` no longer reports a detached worktree as `branch_worktree_mismatch` — the sibling `detached` boolean carries it. ([#3998](max-sixty/worktrunk#3998)) - **`wt list --format=json` now defaults to schema 2**: callers get the envelope with repository metadata and orthogonal per-item facts without configuring `[list] json-schema`. `wt list statusline --format=json` follows the same key. Set `json-schema = 1` to retain the original bare-array format. (Breaking.) ([#4038](max-sixty/worktrunk#4038)) - **`wt config show` fails on a broken config**: it exits 1 on an unreadable or invalid config, an invalid `[list] columns`, or an invalid `approvals.toml`. Unknown keys and deprecations stay warnings and still exit 0. A new `APPROVALS` section counts project commands awaiting approval. (Breaking: it always exited 0 before.) ([#3999](max-sixty/worktrunk#3999)) - **Config migration output names its destination**: `wt config update --output <path>` writes the migration artifact to that file instead of applying it in place, and `--output=-` writes it to stdout. Output mode includes project config when run from a linked worktree. (Breaking: `--print` was removed.) ([#4021](max-sixty/worktrunk#4021)) - **Pi joins the agent integrations**: `wt config plugins pi install` writes an activity hook to `~/.omp/agent/hooks/pre/worktrunk.ts`, so Pi sessions show 🤖/💬 markers in `wt list` like Claude Code, Codex, OpenCode, and Gemini. `$PI_CONFIG_DIR`, `$PI_CODING_AGENT_DIR`, and named `$OMP_PROFILE`/`$PI_PROFILE` profiles are honored. [Docs](https://worktrunk.dev/claude-code/) ([#3594](max-sixty/worktrunk#3594), thanks @adity982, and @ortonomy for the request) - **`wt config plugins codex install` installs the plugin too**: it previously registered the marketplace and left you to run `/plugins` in Codex yourself. Uninstall follows for both Codex and Claude Code, removing the plugin and then the marketplace, so the two commands are inverses. (Breaking: Codex uninstall previously left an installed plugin alone; Claude uninstall now also removes the marketplace.) ([#4019](max-sixty/worktrunk#4019)) - **`wt step copy-ignored` says whether it reflinked or copied**: the summary now reads `(reflinked, no extra disk)`, `(full copy)`, or a partial count, so the same `29.5 GB` line distinguishes a free copy from one that actually wrote the bytes. `--format=json` gains `reflinked` and `written`; a `--dry-run` plan no longer reports `files`/`bytes`. ([#4025](max-sixty/worktrunk#4025)) - **`wt config update` removes keys its destination cannot hold**: migrating `[select]` or `[commit-generation]` drops keys the new section has no field for, reporting each one. Otherwise the key landed at a path the user never typed and warned on every command, with no way to clear it. ([#3994](max-sixty/worktrunk#3994)) ### Fixed - **A failed `wt switch pr:<n>` against a fork no longer deletes a branch it didn't create**: the rollback force-deleted the branch on any setup error, including the one case where the branch wasn't its own — a `pre-switch` hook or a concurrent session claiming the name in the window after the forge answered. Branch and worktree are now created in one `git worktree add -b`, which writes nothing when the name is taken. ([#3984](max-sixty/worktrunk#3984)) - **Codex on Windows: the activity hooks no longer fail on every event**: each hook led with a bare `bash`, which `cmd.exe` resolves to the WSL launcher rather than Git Bash, so every event raised a `Hook failed` banner. Hooks now run `wt.sh` through a shim that finds Git Bash by path. ([#4008](max-sixty/worktrunk#4008), fixes [#4007](max-sixty/worktrunk#4007), thanks @McNultyyy for reporting and diagnosing) - **Templates leave `branch` unset in a detached worktree**: aliases and hooks rendered `{{ branch }}` as the literal `HEAD`, which git resolves, so an unguarded template ran against the wrong ref — the reported case ended in `git push origin --delete HEAD`, which git refused. `base` and `target` follow. (Breaking: an unguarded `{{ branch }}` now errors.) ([#4010](max-sixty/worktrunk#4010), fixes [#4009](max-sixty/worktrunk#4009)) - **The OpenCode plugin loads under OpenCode 2**: OpenCode 2's loader dropped the old bare-function export silently, so activity markers stopped appearing. The plugin now exports one object carrying both the v2 `setup` and v1 `server` entry points, and spawns `wt` through `node:child_process` rather than the Bun shell. Re-run `wt config plugins opencode install` to pick it up; the one file covers OpenCode 2 and OpenCode 1.16 or later. ([#4018](max-sixty/worktrunk#4018), thanks @pragmaticivan for the request) - **`wt step commit --branch` builds its prompt from the worktree being committed**: prompt-building git plumbing ran in the invoking worktree, so with nothing staged there the generated message described none of the changes it committed. `wt step relocate --commit` had the same bug, and `--dry-run`/`--show-prompt` now preview the worktree `--branch` names. ([#3996](max-sixty/worktrunk#3996)) - **LLM commit messages keep diffs for quoted paths**: a file whose name git quotes in the `diff --git` header — any non-ASCII name under the default `core.quotePath` — had its whole diff section dropped from the prompt once the diff exceeded the 100 KB budget. ([#4041](max-sixty/worktrunk#4041)) - **An unparsable user config is reported, not a panic**: `wt config show --format=json` and `--full`, plus `wt step prune`, `relocate`, `eval`, and `for-each`, panicked on a debug build and printed a bare `✗ Command failed` on a release one. They now report `✗ Failed to load config` with the parser's caret diagram. ([#4002](max-sixty/worktrunk#4002)) - **`wt switch --execute` names the directory the program actually starts in**: the `Executing (--execute) @ …` header rendered the worktree the background hooks run in, not the program's own directory — which differs under `--no-cd` or a switch from a subdirectory. The path is omitted when the shell already stands there. ([#4043](max-sixty/worktrunk#4043), fixes [#4042](max-sixty/worktrunk#4042), thanks @yajo for reporting) - **`wt config plugins claude|codex uninstall` is safe to re-run**: removing an already-absent marketplace reported a failure, and a Claude uninstall that removed the plugin and then failed left the marketplace with no way to clear it. Both now finish a half-done uninstall and succeed when there is nothing left to remove. ([#4033](max-sixty/worktrunk#4033), [#4034](max-sixty/worktrunk#4034)) - **`wt config state marker` set and clear no-op outside a git repository**: they exited 1 with a git error, so an agent plugin running outside a repository printed one every turn (the hook's `|| true` kept the session going). ([#3981](max-sixty/worktrunk#3981), thanks @mahirhir) - **`wt list` produces output in a bare repo with no worktrees**: it printed nothing at all and exited 0. It now reports `○ No worktrees` with a hint, `--branches` lists the branches, and `--format json` emits the envelope with an empty `items`. ([#3992](max-sixty/worktrunk#3992)) - **`wt list` warns when it can't parse the project config** rather than ignoring it silently; the listing still succeeds. ([#3993](max-sixty/worktrunk#3993)) - **Relayed command output no longer prints ahead of the delayed-stream progress line**, and delayed-stream output routes through anstream so color is stripped consistently when redirected. ([#4037](max-sixty/worktrunk#4037), [#3995](max-sixty/worktrunk#3995)) - **A hook filter that matches nothing names the unconfigured source**, rather than reporting no match without saying which source was empty. ([#3997](max-sixty/worktrunk#3997)) ### Documentation - **`wt hook` says that `post-*` hooks from the two sources run concurrently**, so dependent commands belong in one source; `wt merge` records that `post-commit` can't run when the merge removes the worktree it anchors on. ([#4020](max-sixty/worktrunk#4020), [#4026](max-sixty/worktrunk#4026)) - **`wt step` help pages describe what the commands actually do**: `wt step prune` says it removes br See merge request: Harmonybrew/homebrew-core!18763
wt config showcould identify broken configuration while still exiting 0, which made it unsuitable as a scripted health check. This makes its exit status reliable without truncating the human report or corrupting JSON output.What changed
wt config showrenders every text section before returning non-zero for unreadable or invalid config sources, invalid list-column settings, or an invalid approvals file. Unknown and deprecated keys remain warnings and exit 0.null.APPROVALSsection.wt config update --outputwarns when it omits deprecatedapproved-commands, and refuses to overwrite the source only in that lossy case.The scope is intentionally limited: there is no derived
EFFECTIVEsection, no unconditional empty system-config section, and no broad rewrite of the configuration guide. The command help adds only the changed behavior and is synchronized to the generated docs and skill reference.Validation: the pre-merge hook and coverage suite passed all 4,826 tests, Clippy, formatting, snapshots, doctests, and documentation checks; the Astro production build passes.