Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Tidy shell-integration output: prompt spacing, restart hint, one install hint (#4059)

Maximilian Roosf85230dc627b
diff --git a/.claude/skills/writing-user-outputs/SKILL.md b/.claude/skills/writing-user-outputs/SKILL.md
index f304e19fc..1c11886ce 100644
--- a/.claude/skills/writing-user-outputs/SKILL.md
+++ b/.claude/skills/writing-user-outputs/SKILL.md
@@ -605,7 +605,12 @@ Specific rules:
- **No leading/trailing blanks** — Start immediately, end cleanly
- **Blank before prompts, not after** — Signal "pause, something interactive is
- happening" before the prompt; once the user responds, output flows continuously
+ happening" before the prompt; once the user responds, output flows continuously.
+ The blank belongs to the narration it separates from, so the caller emits it
+ and `prompt_yes_no_preview` does not: a prompt that opens a command's output
+ (`wt config shell install`, `wt config plugins claude install`, the
+ commit-generation offer at the top of `wt merge`) starts flush, since a blank
+ there is a leading blank
- **One blank between phases** — When a sub-operation completes and a different
operation begins, add a blank line to visually separate them
- **Never double blanks** — One blank line maximum between elements
@@ -624,14 +629,14 @@ Specific rules:
↳ To configure, run wt config shell install
```
-**Prompt spacing:** A blank line before the prompt signals "something different
-is about to happen" and gives the user's eye a natural stopping point before they
-need to read and respond. No blank line after — the user's input ends the
-interactive moment and subsequent output flows naturally from that decision.
+**Prompt spacing:** A blank line before a prompt that follows narration signals
+"something different is about to happen" and gives the user's eye a natural
+stopping point before they need to read and respond. No blank line after — the
+user's input ends the interactive moment and subsequent output flows naturally
+from that decision. A prompt with nothing above it, like the setup offer below
+at the top of `wt step commit`, has nothing to separate from and starts flush.
```
-◎ Detecting available LLM tools...
-
❯ Configure claude for commit messages? [y/N/?] y
✓ Added to user config:
┃ [commit.generation]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e62976c2a..020568b3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,10 +4,18 @@
### Improved
+- **`wt config show` gives one `wt config shell install` for the whole shell section**: an outdated wrapper, fish integration still at the deprecated `conf.d` path, and a missing fish completions file each carried their own per-shell hint, so a machine with all three printed three commands where the bare one fixes everything. The rows still say what's wrong; the section's single trailing hint says what to run. The zsh `compinit` snippet is syntax-highlighted like every other command block.
+
+- **Interactive prompts no longer open with a blank line**: `wt config shell install`, `wt config plugins claude install`, and the commit-message setup offer at the top of `wt merge` all began with one. A prompt that follows other output keeps the blank line separating it.
+
- **`wt config update --output <path>` confirms the write**: it now prints `✓ Wrote user config migration @ ~/migrated.toml`, so a command whose only effect is the file it wrote now says where that file is. Writing to stdout with `--output=-` stays silent, since the artifact is right there. ([#4053](https://github.com/max-sixty/worktrunk/pull/4053))
### Fixed
+- **`wt config shell install` migrates a fish wrapper at the deprecated `conf.d` path even when `~/.config/fish/functions` doesn't exist yet**: fish was skipped for want of a config location, so the bare command left the deprecated wrapper running and only `wt config shell install fish` migrated it. A worktrunk wrapper at the old path now counts as fish being configured, just at the old path. `wt config show` reports that wrapper too, where before it showed nothing at all for fish unless fish was on `PATH`.
+
+- **`wt config shell install` no longer tells an already-wrapped shell to restart**: reinstalling from inside a shell that has the wrapper loaded — after a version bump, or when the fish extension moves from `conf.d` to `functions` — printed `↳ Restart shell to activate shell integration` right after the wrapper had intercepted the command. The hint now only appears when integration isn't active.
+
- **An alias that binds `dry_run` can take `--dry-run <value>`**: `wt <alias> --dry-run <value>` answered the retired-flag error even when the alias's own template referenced `{{ dry_run }}`, while `--dry-run=<value>` bound normally — so one flag behaved two ways. Both value-taking spellings now bind for an alias that references the name, matching how `--help` and `--yes` already yield to a template that binds them. A bare `--dry-run` with no value still errors, since forwarding it into `{{ args }}` would leave `dry_run` unset and run the live command; the message names `--dry-run=1`. ([#4058](https://github.com/max-sixty/worktrunk/pull/4058))
- **`wt merge` no longer runs `post-commit` in a worktree the user never chose**: the merge removes the worktree that hook is anchored on before the hook starts, so the pipeline was spawned into an emptied path. Where the worktree sat inside the repository, git discovery walked up from there and the hook's commands ran in the primary worktree; anywhere else they didn't run at all, and the only record was a log file nothing reads. The merge now prints `▲ Skipped post-commit: …` naming that worktree, and points at `pre-remove` for work that must finish there. `--no-remove`, merging on the target branch, `wt step commit`, and `wt step squash` still run it. ([#4049](https://github.com/max-sixty/worktrunk/pull/4049))
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index 72ca2ac23..7a24cd107 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -1094,9 +1094,12 @@ fn approvals_diagnostic(repo: Option<&Repository>) -> ApprovalsDiagnostic {
}
}
-/// Emit the "fish integration found in deprecated location" notice plus the
-/// hint pointing at the canonical path. Used wherever fish integration lives
-/// at the legacy `~/.config/fish/conf.d/` location (deprecated since #566).
+/// Emit the "fish extension lives at the deprecated location" row, naming the
+/// canonical path it should move to. Used wherever fish integration lives at
+/// the legacy `~/.config/fish/conf.d/` location (deprecated since #566). The
+/// migration is one of the things `wt config shell install` does, so the row
+/// carries no hint of its own — the caller counts it toward the section's
+/// single trailing hint.
fn render_fish_legacy_migration(
out: &mut String,
legacy_fish_conf_d: Option<&Path>,
@@ -1115,14 +1118,7 @@ fn render_fish_legacy_migration(
out,
"{}",
info_message(cformat!(
- "Fish integration found in deprecated location @ <bold>{legacy_path}</>"
- ))
- )?;
- writeln!(
- out,
- "{}",
- hint_message(cformat!(
- "To migrate to <underline>{canonical_path}</>, run <underline>{cmd} config shell install fish</>"
+ "<bold>fish</>: Shell extension @ <bold>{legacy_path}</> (deprecated; now <bold>{canonical_path}</>)"
))
)?;
Ok(())
@@ -1142,18 +1138,17 @@ fn render_zsh_compinit_warning(out: &mut String) -> anyhow::Result<()> {
writeln!(
out,
"{}",
- format_with_gutter("autoload -Uz compinit && compinit", None)
+ format_bash_with_gutter("autoload -Uz compinit && compinit")
)?;
Ok(())
}
/// Fish-only: report whether the separate completions file is in place.
-/// Doesn't flip `any_not_configured` — missing fish completions have a
-/// shell-specific remediation hint rather than the generic "To configure"
-/// summary.
-fn render_fish_completion_status(out: &mut String, cmd: &str) -> anyhow::Result<()> {
+/// Returns whether the file is missing, so it counts toward the section's
+/// single trailing `wt config shell install` hint.
+fn render_fish_completion_status(out: &mut String, cmd: &str) -> anyhow::Result<bool> {
let Ok(completion_path) = Shell::Fish.completion_path(cmd) else {
- return Ok(());
+ return Ok(false);
};
let completion_display = format_path_for_display(&completion_path);
let shell = Shell::Fish;
@@ -1165,16 +1160,16 @@ fn render_fish_completion_status(out: &mut String, cmd: &str) -> anyhow::Result<
"<bold>{shell}</>: Already configured completions @ {completion_display}"
))
)?;
- } else {
- let warning = warning_message(cformat!(
- "<bold>{shell}</>: Completions not configured @ <bold>{completion_display}</>"
- ));
- let hint = hint_message(cformat!(
- "To configure completions, run <underline>{cmd} config shell install {shell}</>"
- ));
- writeln!(out, "{warning}\n{hint}")?;
+ return Ok(false);
}
- Ok(())
+ writeln!(
+ out,
+ "{}",
+ warning_message(cformat!(
+ "<bold>{shell}</>: Completions not configured @ <bold>{completion_display}</>"
+ ))
+ )?;
+ Ok(true)
}
/// When the integration is configured but the wrapper isn't loaded in the
@@ -1203,13 +1198,14 @@ fn render_verify_wrapper_hint(
/// Render the `AlreadyExists` row plus any per-shell follow-ups (matched
/// lines, .exe warning, zsh compinit, fish completions, verify hint).
+/// Returns whether the row still wants `wt config shell install`.
fn render_already_configured(
out: &mut String,
result: &ConfigureResult,
detection_results: &[FileDetectionResult],
cmd: &str,
shell_active: bool,
-) -> anyhow::Result<()> {
+) -> anyhow::Result<bool> {
let shell = result.shell;
let path = format_path_for_display(&result.path);
let what = crate::output::shell_integration::shell_extension_label(shell);
@@ -1249,19 +1245,22 @@ fn render_already_configured(
}
}
- match shell {
- Shell::Zsh => render_zsh_compinit_warning(out)?,
+ let needs_install = match shell {
+ Shell::Zsh => {
+ render_zsh_compinit_warning(out)?;
+ false
+ }
Shell::Fish => render_fish_completion_status(out, cmd)?,
- _ => {}
- }
+ _ => false,
+ };
render_verify_wrapper_hint(out, shell, cmd, shell_active)?;
- Ok(())
+ Ok(needs_install)
}
-/// Render the `WouldAdd`/`WouldCreate` arm. Returns whether the row
-/// should count toward `any_not_configured` (the trailing "To configure"
-/// summary is suppressed for outdated wrappers and dotfile-managed setups).
+/// Render the `WouldAdd`/`WouldCreate` arm. Returns whether the row should
+/// count toward `any_not_configured` — false only for a dotfile-managed setup,
+/// which `wt config shell install` cannot fix.
fn render_would_add_or_create(
out: &mut String,
result: &ConfigureResult,
@@ -1274,25 +1273,24 @@ fn render_would_add_or_create(
let path = format_path_for_display(&result.path);
let what = crate::output::shell_integration::shell_extension_label(shell);
- // Fish: prefer migration hint when the legacy conf.d location has
- // working integration — silencing the "Not configured" row.
+ // Fish: prefer the deprecated-location row when the legacy conf.d location
+ // has working integration — silencing the "Not configured" row.
if matches!(shell, Shell::Fish) && legacy_fish_has_integration {
render_fish_legacy_migration(out, legacy_fish_conf_d, cmd)?;
- return Ok(false);
+ return Ok(true);
}
// Wrapper-based shells with WouldAdd: file exists but content drifted
- // (e.g. outdated wrapper). The per-shell "To update" hint covers it,
- // so the generic "To configure" summary stays silent.
+ // (e.g. outdated wrapper).
if shell.is_wrapper_based() && matches!(result.action, ConfigAction::WouldAdd) {
- let warning = warning_message(cformat!(
- "<bold>{shell}</>: Outdated shell extension @ <bold>{path}</>"
- ));
- let hint = hint_message(cformat!(
- "To update, run <underline>{cmd} config shell install {shell}</>"
- ));
- writeln!(out, "{warning}\n{hint}")?;
- return Ok(false);
+ writeln!(
+ out,
+ "{}",
+ warning_message(cformat!(
+ "<bold>{shell}</>: Outdated shell extension @ <bold>{path}</>"
+ ))
+ )?;
+ return Ok(true);
}
// Integration is loaded at runtime even though no rc file matched —
@@ -1439,7 +1437,8 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {
for result in &scan_result.configured {
match result.action {
ConfigAction::AlreadyExists => {
- render_already_configured(out, result, &detection_results, &cmd, shell_active)?;
+ any_not_configured |=
+ render_already_configured(out, result, &detection_results, &cmd, shell_active)?;
}
ConfigAction::WouldAdd | ConfigAction::WouldCreate
if render_would_add_or_create(
@@ -1457,14 +1456,10 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {
}
}
- // Show skipped (not installed) shells
- // For fish with legacy integration, show migration hint instead of "skipped"
+ // Show skipped (not installed) shells. Fish with a wrapper at the
+ // deprecated conf.d path never lands here — `scan_shell_configs` treats
+ // that wrapper as a config location, so the row comes from the loop above.
for (shell, path) in &scan_result.skipped {
- if matches!(shell, Shell::Fish) && legacy_fish_has_integration {
- // Show migration hint for legacy fish location
- render_fish_legacy_migration(out, legacy_fish_conf_d.as_deref(), &cmd)?;
- continue;
- }
let path = format_path_for_display(path);
writeln!(
out,
diff --git a/src/commands/config/update.rs b/src/commands/config/update.rs
index b5cf43cd6..5faeb54a7 100644
--- a/src/commands/config/update.rs
+++ b/src/commands/config/update.rs
@@ -62,6 +62,9 @@ pub fn handle_config_update(yes: bool, output: Option<PathBuf>) -> anyhow::Resul
}
if !yes {
+ // Separate the prompt from the previews above; prompt_yes_no_preview
+ // emits no leading blank of its own.
+ eprintln!();
match prompt_yes_no_preview("Apply updates?", || {})? {
PromptResponse::Accepted => {}
PromptResponse::Declined => {
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 8db233f00..375fd96fb 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -562,13 +562,23 @@ pub fn scan_shell_configs(
let in_detected_shell = (matches!(shell, Shell::PowerShell) && in_powershell_env)
|| (matches!(shell, Shell::Nushell) && nushell_available);
- // Only configure if explicitly targeting this shell OR if config file/location exists
- // OR if we detected we're running in this shell's environment
- let should_configure = shell_filter.is_some() || has_config_location || in_detected_shell;
-
- // Allow creating the config file if explicitly targeting this shell,
- // or if we detected we're in this shell's environment
- let allow_create = shell_filter.is_some() || in_detected_shell;
+ // A worktrunk wrapper still at fish's deprecated conf.d path says fish
+ // is configured, just at the old path — so the install migrates it even
+ // though `~/.config/fish/functions` doesn't exist yet. Without this,
+ // fish lands in `skipped` and a bare `wt config shell install` leaves
+ // the deprecated wrapper running, which is the command `wt config show`
+ // points users at. The write target stays the canonical functions path,
+ // and `cleanup_legacy_fish_conf_d` removes the old file afterwards.
+ let has_deprecated_wrapper = matches!(shell, Shell::Fish)
+ && Shell::legacy_fish_conf_d_path(cmd).is_ok_and(|path| path.exists());
+
+ // Write a config file the user doesn't have yet when they named this
+ // shell, when we're running in it, or when it's already configured at a
+ // deprecated path this install migrates.
+ let allow_create = shell_filter.is_some() || in_detected_shell || has_deprecated_wrapper;
+
+ // Plus: configure whenever the config file or its directory is there.
+ let should_configure = allow_create || has_config_location;
if should_configure {
// Wrapper-based shells (Fish, Nushell) always write to the canonical
@@ -1111,8 +1121,6 @@ pub fn prompt_for_install(
/// Prompt user for yes/no confirmation (simple [y/N] prompt)
fn prompt_yes_no() -> Result<bool, String> {
- // Blank line before prompt for visual separation
- eprintln!();
eprint!(
"{} ",
prompt_message(color_print::cformat!("Proceed? <bold>[y/N]</>"))
@@ -1553,6 +1561,9 @@ fn prompt_for_uninstall_confirmation(
) -> Result<bool, String> {
eprintln!("{}", show_uninstall_preview(results, completion_results));
+ // Separate the prompt from the preview above; the prompt emits no leading
+ // blank of its own.
+ eprintln!();
prompt_yes_no()
}
diff --git a/src/commands/worktree/resolve.rs b/src/commands/worktree/resolve.rs
index 2b5de02ea..6feedcff8 100644
--- a/src/commands/worktree/resolve.rs
+++ b/src/commands/worktree/resolve.rs
@@ -210,6 +210,10 @@ pub fn offer_bare_repo_worktree_path_fix(
))
);
+ // Separate the prompt from the diagnosis above; prompt_yes_no_preview
+ // emits no leading blank of its own.
+ eprintln!();
+
let config_path_for_preview = config_path_display.clone();
let project_id_for_preview = project_id.clone();
match prompt_yes_no_preview(
diff --git a/src/output/prompt.rs b/src/output/prompt.rs
index d5c25d407..fbb41b9e7 100644
--- a/src/output/prompt.rs
+++ b/src/output/prompt.rs
@@ -3,7 +3,7 @@
use std::io::{self, Write};
use color_print::cformat;
-use worktrunk::styling::{PROMPT_SYMBOL, eprint, eprintln};
+use worktrunk::styling::{PROMPT_SYMBOL, eprint};
/// Response from a `[y/N/?]` prompt.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -16,6 +16,14 @@ pub enum PromptResponse {
/// Prompt with `[y/N/?]` options. Loops on `?` to show preview.
///
+/// Emits no leading blank line: the separator belongs to the narration it
+/// separates from, and most prompts are the first thing their command prints
+/// (`wt config shell install`, `wt config plugins claude install`, the
+/// commit-generation setup offer at the top of `wt merge`), where a leading
+/// blank is exactly the leading blank /writing-user-outputs forbids. A caller
+/// that has already printed adds its own `eprintln!()` first — see
+/// `handle_config_update` and `prompt_shell_integration`.
+///
/// # Arguments
/// * `prompt_text` - The question to ask (without the `[y/N/?]` suffix)
/// * `show_preview` - Closure called when user enters `?`
@@ -41,9 +49,6 @@ pub fn prompt_yes_no_preview(
prompt_text: &str,
show_preview: impl Fn(),
) -> io::Result<PromptResponse> {
- // Blank line before first prompt for visual separation
- eprintln!();
-
loop {
eprint!(
"{}",
diff --git a/src/output/shell_integration.rs b/src/output/shell_integration.rs
index ee802a7a8..c897a37d8 100644
--- a/src/output/shell_integration.rs
+++ b/src/output/shell_integration.rs
@@ -114,8 +114,9 @@ pub(crate) fn print_shell_integration_hint(repo: &Repository) {
let _ = repo.mark_hint_shown(SHELL_INTEGRATION_HINT);
}
-/// Hint shown right after installing: the wrapper cannot be active yet, so
-/// the restart advice is unconditional.
+/// Hint shown right after installing for the current shell, when the wrapper
+/// isn't already intercepting — the shell it was installed into has to reload
+/// before the function exists.
pub(crate) fn shell_restart_hint() -> &'static str {
"Restart shell to activate shell integration"
}
@@ -385,7 +386,13 @@ pub fn print_shell_install_result(scan_result: &crate::commands::configure_shell
// Restart hint for current shell. Compare Shell values, not display
// names — the detected name can be "pwsh" or "zsh-5.9", which would
// never equal the canonical "powershell"/"zsh" strings.
- if shells_configured_count > 0 {
+ //
+ // Skipped when the wrapper already intercepted this invocation: the hint
+ // says integration needs activating, and it plainly doesn't. That case is
+ // reached by reinstalling from inside a wrapped shell — a version bump, or
+ // the fish conf.d → functions relocation, which writes a new file for a
+ // wrapper the running shell already has.
+ if shells_configured_count > 0 && !crate::output::is_shell_integration_active() {
let current_shell_configured = current_shell().is_some_and(|shell| {
scan_result
.configured
@@ -487,6 +494,10 @@ pub fn prompt_shell_integration(
// and must not happen unpreviewed, exactly as `wt config shell install` previews it
// (issue #3644).
let legacy_preview = collect_legacy_cleanups(&scan.configured, binary_name, true);
+ // Separate the offer from the switch output above; prompt_yes_no_preview
+ // emits no leading blank of its own, so `wt config shell install` — where
+ // the same prompt is the first line — starts flush.
+ eprintln!();
let confirmed = prompt_for_install(
&scan.configured,
&scan.completion_results,
diff --git a/tests/integration_tests/config_state.rs b/tests/integration_tests/config_state.rs
index 3b246dfa5..471a6e77f 100644
--- a/tests/integration_tests/config_state.rs
+++ b/tests/integration_tests/config_state.rs
@@ -1579,10 +1579,7 @@ fn test_state_clear_all_prompt_declines(repo: TestRepo) {
cmd.stdin(Stdio::null());
let output = cmd.output().unwrap();
assert!(output.status.success());
- assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"
-
- ❯ Clear all stored state, including branch markers and vars? [y/N/?] ○ Clear cancelled
- ");
+ assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"❯ Clear all stored state, including branch markers and vars? [y/N/?] ○ Clear cancelled");
// Previous branch must survive the declined prompt.
assert!(
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index d322dc967..8fa7fa2d1 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -917,10 +917,101 @@ fn test_configure_shell_fish_legacy_removal_accepted_when_already_configured(
);
}
+/// Installing from inside a shell whose wrapper already intercepted the command
+/// doesn't tell it to restart.
+///
+/// Single-factor contrast with `test_configure_shell_with_yes`, which runs the
+/// same zsh install without `WORKTRUNK_DIRECTIVE_CD_FILE` and asserts
+/// `Restart shell to activate shell integration` fires. Reinstalling from a
+/// wrapped shell is how a version bump or the fish conf.d relocation is done,
+/// and integration plainly doesn't need activating there.
+#[rstest]
+fn test_configure_shell_no_restart_hint_when_integration_active(
+ repo: TestRepo,
+ temp_home: TempDir,
+) {
+ fs::write(temp_home.path().join(".zshrc"), "# Existing config\n").unwrap();
+ let directive_file = temp_home.path().join("directive");
+ fs::write(&directive_file, "").unwrap();
+
+ let settings = setup_home_snapshot_settings(&temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("SHELL", "/bin/zsh");
+ cmd.env("WORKTRUNK_TEST_COMPINIT_MISSING", "1");
+ cmd.env("WORKTRUNK_DIRECTIVE_CD_FILE", &directive_file);
+ cmd.args(["config", "shell", "install", "--yes"])
+ .current_dir(repo.root_path());
+
+ assert_cmd_snapshot!(cmd, @"
+ success: true
+ exit_code: 0
+ ----- stdout -----
+
+ ----- stderr -----
+ ✓ Added shell extension & completions for zsh @ ~/.zshrc
+
+ ✓ Configured 1 shell
+ ▲ Completions require compinit; add to ~/.zshrc before the wt line:
+   autoload -Uz compinit && compinit
+ 
+ ");
+ });
+}
+
+/// A bare `wt config shell install` migrates a wrapper at fish's deprecated
+/// conf.d path, with no `functions/` directory and fish not on PATH.
+///
+/// This is the command `wt config show` points at, so it has to cover every
+/// state that section reports. Fish would otherwise be skipped for want of a
+/// config location, leaving the deprecated wrapper running with a remedy that
+/// did nothing for it.
+#[rstest]
+fn test_configure_shell_bare_install_migrates_fish_legacy_conf_d(
+ repo: TestRepo,
+ temp_home: TempDir,
+) {
+ let conf_d = temp_home.path().join(".config/fish/conf.d");
+ fs::create_dir_all(&conf_d).unwrap();
+ let legacy_file = conf_d.join("wt.fish");
+ fs::write(&legacy_file, "wt config shell init fish | source").unwrap();
+
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ set_temp_home_env(&mut cmd, temp_home.path());
+ set_xdg_config_path(&mut cmd, temp_home.path());
+ cmd.env("SHELL", "/bin/zsh");
+ cmd.args(["config", "shell", "install", "--yes"])
+ .current_dir(repo.root_path());
+ let output = cmd.output().unwrap();
+
+ assert!(
+ output.status.success(),
+ "bare install should succeed: {output:?}"
+ );
+ assert!(
+ !legacy_file.exists(),
+ "bare install must remove the deprecated conf.d/wt.fish: {legacy_file:?}"
+ );
+ assert!(
+ temp_home
+ .path()
+ .join(".config/fish/functions/wt.fish")
+ .exists(),
+ "bare install must write the canonical functions/wt.fish"
+ );
+}
+
/// Test that detection finds fish integration in legacy conf.d location
///
/// `wt config show` should detect shell integration whether it's in the
-/// old conf.d location or the new functions location.
+/// old conf.d location or the new functions location. Fish is neither on PATH
+/// nor has a `functions/` directory here, so the deprecated wrapper is the only
+/// thing putting fish in the report at all — `scan_shell_configs` treats it as
+/// a config location, which is also what makes the section's bare
+/// `wt config shell install` hint migrate it.
#[rstest]
fn test_config_show_detects_fish_legacy_conf_d(mut repo: TestRepo, temp_home: TempDir) {
// Create ONLY the legacy conf.d file (simulating user who installed before #566)
@@ -947,11 +1038,9 @@ fn test_config_show_detects_fish_legacy_conf_d(mut repo: TestRepo, temp_home: Te
/// Test config show when functions/ exists but wt.fish doesn't, with legacy conf.d
///
-/// This tests a different code path than test_config_show_detects_fish_legacy_conf_d:
-/// - That test: functions/ doesn't exist -> fish is "skipped"
-/// - This test: functions/ exists but empty -> fish is "configured" with WouldCreate
-///
-/// Both should show the migration hint for the legacy conf.d location.
+/// Pairs with `test_config_show_detects_fish_legacy_conf_d`, which has no
+/// `functions/` directory. Both report the same deprecated-location row: the
+/// wrapper at the legacy path is a config location either way.
#[rstest]
fn test_config_show_fish_legacy_with_functions_dir(mut repo: TestRepo, temp_home: TempDir) {
// Create functions/ directory (empty - no wt.fish)
@@ -2460,7 +2549,7 @@ mod pty_tests {
assert_eq!(exit_code, 0);
install_pty_settings(&temp_home).bind(|| {
- assert_snapshot!(output.trim_start_matches('\n'));
+ assert_snapshot!(output);
});
}
@@ -2475,7 +2564,7 @@ mod pty_tests {
// User declined, so exit code is 1
assert_eq!(exit_code, 1);
install_pty_settings(&temp_home).bind(|| {
- assert_snapshot!(output.trim_start_matches('\n'));
+ assert_snapshot!(output);
});
// Verify file was not modified
@@ -2600,7 +2689,7 @@ mod pty_tests {
assert_eq!(exit_code, 0, "uninstall should succeed:\n{output}");
assert_eq!(fs::read(&zshrc_path).unwrap(), replacement);
install_pty_settings(&temp_home).bind(|| {
- assert_snapshot!(output.trim_start_matches('\n'), @r#"
+ assert_snapshot!(output, @r#"
○ Will remove shell extension & completions for zsh @ ~/.zshrc
  if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)"; fi
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_outdated_wrapper.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_outdated_wrapper.snap
index eb10c3192..2e0171a87 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_outdated_wrapper.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_outdated_wrapper.snap
@@ -69,7 +69,7 @@ exit_code: 0
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
▲ fish: Outdated shell extension @ ~/.config/fish/functions/wt.fish
-↳ To update, run wt config shell install fish
+↳ To configure, run wt config shell install
OTHER
○ wt: [VERSION]
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_without_completions.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_without_completions.snap
index 887c1d891..9881151b2 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_without_completions.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_without_completions.snap
@@ -71,7 +71,7 @@ exit_code: 0
○ fish: Already configured shell extension @ ~/.config/fish/functions/wt.fish:15
  command wt config shell init fish | source
▲ fish: Completions not configured @ ~/.config/fish/completions/wt.fish
-↳ To configure completions, run wt config shell install fish
+↳ To configure, run wt config shell install
OTHER
○ wt: [VERSION]
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_nushell_outdated_wrapper.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_nushell_outdated_wrapper.snap
index 8958ea021..f2b0b69f4 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_nushell_outdated_wrapper.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_nushell_outdated_wrapper.snap
@@ -70,7 +70,7 @@ exit_code: 0
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
▲ nu: Outdated shell extension @ ~/.local/share/nushell/vendor/autoload/wt.nu
-↳ To update, run wt config shell install nu
+↳ To configure, run wt config shell install
OTHER
○ wt: [VERSION]
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_not_suppressed_by_wrapper.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_not_suppressed_by_wrapper.snap
index a617ffa73..1f471eb17 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_not_suppressed_by_wrapper.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_not_suppressed_by_wrapper.snap
@@ -71,7 +71,6 @@ exit_code: 0
○ bash: Not configured shell extension & completions
▲ fish: Outdated shell extension @ ~/.config/fish/functions/wt.fish
-↳ To update, run wt config shell install fish
↳ To configure, run wt config shell install
▲ Found wt in ~/.bashrc:2 but not detected as integration:
  alias wt="git worktree"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_warning.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_warning.snap
index 1a5989fcb..f7bcd5ecf 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_warning.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_warning.snap
@@ -72,7 +72,7 @@ exit_code: 0
○ zsh: Already configured shell extension & completions @ ~/.zshrc:2
  if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)"; fi
▲ Completions won't work; add to ~/.zshrc before the wt line:
-  autoload -Uz compinit && compinit
+  autoload -Uz compinit && compinit
OTHER
○ wt: [VERSION]
diff --git a/tests/snapshots/integration__integration_tests__config_show__opencode_install_prompt_declined.snap b/tests/snapshots/integration__integration_tests__config_show__opencode_install_prompt_declined.snap
index d63506663..37ebaf1cd 100644
--- a/tests/snapshots/integration__integration_tests__config_show__opencode_install_prompt_declined.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__opencode_install_prompt_declined.snap
@@ -52,5 +52,4 @@ exit_code: 0
----- stdout -----
----- stderr -----
-
❯ Install OpenCode plugin @ ~/opencode-config/plugins/worktrunk.ts? [y/N/?]
diff --git a/tests/snapshots/integration__integration_tests__config_show__opencode_uninstall_prompt_declined.snap b/tests/snapshots/integration__integration_tests__config_show__opencode_uninstall_prompt_declined.snap
index 9f370d6f0..2e692c425 100644
--- a/tests/snapshots/integration__integration_tests__config_show__opencode_uninstall_prompt_declined.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__opencode_uninstall_prompt_declined.snap
@@ -52,5 +52,4 @@ exit_code: 0
----- stdout -----
----- stderr -----
-
❯ Remove OpenCode plugin @ ~/opencode-config/plugins/worktrunk.ts? [y/N/?]
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__config_show_detects_fish_legacy_conf_d.snap b/tests/snapshots/integration__integration_tests__configure_shell__config_show_detects_fish_legacy_conf_d.snap
index 2861e76c7..eb31f6813 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__config_show_detects_fish_legacy_conf_d.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__config_show_detects_fish_legacy_conf_d.snap
@@ -69,6 +69,8 @@ exit_code: 0
▲ Shell integration not active
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
  $SHELL: /bin/fish
+
+○ fish: Shell extension @ ~/.config/fish/conf.d/wt.fish (deprecated; now ~/.config/fish/functions/wt.fish)
↳ To configure, run wt config shell install
OTHER
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__config_show_fish_legacy_with_functions_dir.snap b/tests/snapshots/integration__integration_tests__configure_shell__config_show_fish_legacy_with_functions_dir.snap
index 2d6755c9e..3177e415a 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__config_show_fish_legacy_with_functions_dir.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__config_show_fish_legacy_with_functions_dir.snap
@@ -70,8 +70,8 @@ exit_code: 0
  Invoked as: [PROJECT_ROOT]/target/[BUILD_MODE]/wt
  $SHELL: /bin/fish
-○ Fish integration found in deprecated location @ ~/.config/fish/conf.d/wt.fish
-↳ To migrate to ~/.config/fish/functions/wt.fish, run wt config shell install fish
+○ fish: Shell extension @ ~/.config/fish/conf.d/wt.fish (deprecated; now ~/.config/fish/functions/wt.fish)
+↳ To configure, run wt config shell install
OTHER
○ wt: [VERSION]