Repository navigation
fix(config): clean up wt config show shell-integration section - #2574
Merged
Merged
Conversation
…status `wt config show` now reads "▲ Shell integration not configured" when no working integration exists in any shell (fresh user, container, CI sandbox), and keeps "▲ Shell integration not active" for the case where it's installed but not loaded in this session. The install hint also moves directly under the warning when nothing is installed anywhere, so cause and remedy stay adjacent instead of being separated by four "Skipped" rows. The "configured somewhere" signal includes `AlreadyExists` rc-file lines, wrapper-based shells with their wrapper file present (even if outdated), and fish at the legacy `conf.d` path — anything less reads as "not configured." The trailing summary hint still fires for partial-config and fish-legacy. Co-Authored-By: Claude <[email protected]>
On a stock zsh-only macOS, `wt config show` listed `bash`, `fish`, and
`nu` as `Skipped; ~/.foorc not found` — clutter for shells the user
doesn't have installed. The four-line block was the loudest thing in
the SHELL INTEGRATION section for users who'd never touch those shells.
Adds `Shell::is_installed()` (PATH lookup with
`WORKTRUNK_TEST_<SHELL>_INSTALLED` env override) and gates the
`skipped.push` in `scan_shell_configs` on it. Shells with rc files
still render normally — the filter only affects the "binary absent
AND no rc file" case, which is exactly when the entry carries no
useful information. `nu` and `pwsh` are filtered cleanly because
neither ships with macOS/Linux. `bash` and `zsh` on macOS still
report (`/bin/bash` and `/bin/zsh` are preinstalled), but that's the
honest answer — they're installed, the user just hasn't configured a
shell extension. The cost is ~150–500µs of `which::which` lookups,
invisible against the existing ~290 ms config-show baseline.
Side fixes pulled in:
- Removed a redundant `Err("No shell config files found")` from
`scan_shell_configs`. The install command's `main.rs:536` handler
already produces the same error after rendering skipped shells, so
the early-exit was dead in practice. Now `scan_shell_configs`
returns an empty `ScanResult` and lets callers decide.
- Made the blank line between the active/not-active status and the
per-shell list conditional on having shells to render, so the
trailing `↳ To configure, run wt config shell install` hint stays
attached to its subject when no shells remain after filtering.
- Replaced the standalone `is_nushell_available()` helper with the
new `Shell::Nushell.is_installed()`. Same semantics, one fewer
function. The historical `WORKTRUNK_TEST_NUSHELL_ENV` env-var name
is preserved to avoid churning hundreds of recorded snapshots.
### Tests
- New `test_configure_shell_skipped_lists_only_installed_shells`
pairs with `test_configure_shell_no_files` to cover both arms of
the install guard (binary on PATH + rc absent → Skipped; binary
absent + rc absent → drop entirely).
- Test defaults moved into `STATIC_TEST_ENV_VARS` so PTY tests
inherit them through `TestRepo::test_env_vars`. One PTY test
(`exec_install_in_pty`) bypasses that path and gets explicit
per-test env overrides.
- 50 snapshot files updated to drop the now-filtered Skipped lines.
All test runs pass (3465/3465) and lints are clean.
Coverage caveat: the `which::which` fallback in `is_installed()` is
not exercised by tests (every test sets the env override). Same
shape as the prior `is_nushell_available()` helper, documented
inline.
Co-authored-by: Claude <[email protected]>
# Conflicts: # src/commands/config/show.rs # tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_pre_hook_table_form_deprecation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_empty_system_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap # tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap # tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap # tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap # tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap # tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap # tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap # tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap # tests/snapshots/integration__integration_tests__config_show__config_show_invalid_system_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap # tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_opencode_available_plugin_not_installed.snap # tests/snapshots/integration__integration_tests__config_show__config_show_opencode_plugin_installed.snap # tests/snapshots/integration__integration_tests__config_show__config_show_opencode_plugin_outdated.snap # tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap # tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap # tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap # tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap # tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap # tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap # tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap # tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_with_system_config.snap
worktrunk-bot
approved these changes
May 4, 2026
worktrunk-bot
left a comment
Collaborator
There was a problem hiding this comment.
Logic reads cleanly, snapshots updated consistently, and the new Shell::is_installed filter pairs with the warning-text branch to give the documented fresh-user output.
Two notes on the failing codecov/patch (70.9%) — both look like accept-as-is rather than gaps to plug:
src/shell/mod.rs(50%): thewhich::whichfallback inis_installed()is unexercised because every test setsWORKTRUNK_TEST_*_INSTALLED. Acknowledged in the PR description and inherits the prioris_nushell_available()pattern.src/commands/config/show.rs(80%): the lines codecov flags — thescan_shell_configserror arm (711–717), theRunning from:divergence check (779–781), and theGIT_EXEC_PATHgit-subcommand line (794) — exist verbatim inmain(ce66d9cf:src/commands/config/show.rs, lower in the same function). The reorder hoisted them above the warning so codecov treats the moved code as new (CLAUDE.md "Renames and moves" pattern).codecov/projectis green.
Heads-up: #2572 becomes a strict subset of this PR after the merge of shell-warning-text here, so it can be closed once 2574 lands.
# Conflicts: # src/commands/config/show.rs # tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_pre_hook_table_form_deprecation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap # tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_empty_system_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap # tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap # tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap # tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap # tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap # tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap # tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap # tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap # tests/snapshots/integration__integration_tests__config_show__config_show_invalid_system_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap # tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_opencode_available_plugin_not_installed.snap # tests/snapshots/integration__integration_tests__config_show__config_show_opencode_plugin_installed.snap # tests/snapshots/integration__integration_tests__config_show__config_show_opencode_plugin_outdated.snap # tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap # tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap # tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap # tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap # tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap # tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap # tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap # tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap # tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap # tests/snapshots/integration__integration_tests__config_show__config_show_with_system_config.snap
max-sixty
added a commit
that referenced
this pull request
May 4, 2026
Adds `test_config_show_skipped_with_installed_binary` — bash flagged installed via test override with no `.bashrc`, so the entry survives #2574's `is_installed()` filter and renders as a Skipped row. Locks in the bold-name + dim-body styling on the previously-uncovered code path in `render_shell_status` (line 1022). Co-Authored-By: Claude <[email protected]>
3 tasks done
max-sixty
added a commit
that referenced
this pull request
May 4, 2026
) Aligns the `Skipped` per-shell row with every other status row in the SHELL INTEGRATION section — bold shell name, then `: `, then the body. Previously the entire row was wrapped in `<dim>` so the shell name lost its bold treatment and the row didn't visually scan the same as `Already configured` / `Outdated` / `Not configured`. The bold-name and dim-body spans are sequential (`<bold>foo</>: <dim>bar</>`), not nested — that avoids the SGR-22 reset trap the writing-user-outputs skill warns about (closing `</bold>` would otherwise also clear an outer `<dim>`). The Skipped row only renders when a shell binary is installed but has no rc file — #2574's `is_installed()` filter suppresses the more common "no binary, no rc file" case. New `test_config_show_skipped_with_installed_binary` flags `WORKTRUNK_TEST_BASH_INSTALLED=1` with no `.bashrc` to lock in the styling on that path. > _This was written by Claude Code on behalf of @max-sixty_ --------- Co-authored-by: Claude <[email protected]>
max-sixty
added a commit
that referenced
this pull request
May 4, 2026
## Summary - Adds PowerShell to `default_shells` unconditionally; the `Shell::is_installed()` filter (added in #2574) now hides `Skipped pwsh` on hosts without pwsh, the same way `Skipped fish` is hidden on a stock zsh-only Mac - `should_auto_configure_powershell()` still gates `allow_create`, so users who have pwsh installed but never opened it don't get an unsolicited profile written (issue #885 behavior unchanged) - Removes the iteration asymmetry that left PowerShell invisible in `wt config show` for users who configured a profile but aren't currently in a PS session ## Visible changes | Host state | Before | After | |---|---|---| | pwsh on PATH, profile exists, not in PS session | invisible | shown as `configured` | | pwsh on PATH, no profile, not in PS session | invisible | `Skipped pwsh; profile not found` | | pwsh absent | invisible (iteration gate) | invisible (`is_installed()` filter) | | in PS session, no profile | auto-creates | auto-creates (unchanged) | ## Test plan - [x] `cargo test --test integration` (1622 passed) - [x] `pre-commit run --all-files` - [x] Extended `test_configure_shell_skipped_lists_only_installed_shells` to flag pwsh installed and assert it appears as `Skipped` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
Merged
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.
On a stock zsh-only macOS,
wt config showlistedbash,fish, andnuasSkipped; ~/.foorc not found— clutter for shells the user doesn't have installed. The block was the loudest thing in the SHELL INTEGRATION section for users who'd never touch those shells.After this PR, that fresh-user case shows just the warning + install hint with no per-shell clutter. Together with #2572 (which renamed the warning to "not configured" in this state), the section reads:
What changed
Adds
Shell::is_installed()(PATH lookup withWORKTRUNK_TEST_<SHELL>_INSTALLEDenv override) and gates theskipped.pushinscan_shell_configs. Shells with rc files still render normally — the filter only affects the "binary absent AND no rc file" case, which is exactly when the entry has no useful information.nuandpwshare filtered cleanly because neither ships with macOS/Linux.bashandzshon macOS still report (/bin/bashand/bin/zshare preinstalled), but that's the honest answer.Side fixes:
Err("No shell config files found")fromscan_shell_configs. The install command's main.rs handler already covered this case.↳ To configure…hint stays attached to its subject when no shells render.is_nushell_available()helper withShell::Nushell.is_installed()— same semantics, one fewer function. The historicalWORKTRUNK_TEST_NUSHELL_ENVenv-var name is preserved to avoid churning hundreds of recorded snapshots.Tests
test_configure_shell_skipped_lists_only_installed_shellspairs withtest_configure_shell_no_filesto cover both arms of the install guard (binary on PATH + rc absent → Skipped; binary absent + rc absent → drop entirely).STATIC_TEST_ENV_VARSso PTY tests inherit them throughTestRepo::test_env_vars.Coverage caveat: the
which::whichfallback inis_installed()is not exercised by tests (every test sets the env override). Same shape as the prioris_nushell_available()helper, documented inline.🤖 Generated with Claude Code