Skip to content

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

fix: show "Outdated" instead of "Not configured" for nushell in `config show` (#1235)

Maximilian Roose94899d178ff
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index 78975d83d..00100f6f8 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -805,16 +805,16 @@ fn render_shell_status(out: &mut String) -> anyhow::Result<()> {
"To migrate to <bright-black>{canonical_path}</>, run <bright-black>{cmd} config shell install fish</>"
))
)?;
- } else if matches!(shell, Shell::Fish)
+ } else if matches!(shell, Shell::Fish | Shell::Nushell)
&& matches!(result.action, ConfigAction::WouldAdd)
{
- // Fish file exists but has different content (e.g. outdated version)
+ // File exists but has different content (e.g. outdated version)
any_not_configured = true;
let warning = warning_message(cformat!(
"<bold>{shell}</>: Outdated shell extension @ {path}"
));
let hint = hint_message(cformat!(
- "To update, run <bright-black>{cmd} config shell install fish</>"
+ "To update, run <bright-black>{cmd} config shell install {shell}</>"
));
writeln!(out, "{warning}\n{hint}")?;
} else {
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index 51a4e5b13..f601b025f 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -769,6 +769,37 @@ fn test_config_show_fish_outdated_wrapper(mut repo: TestRepo, temp_home: TempDir
});
}
+/// Test that config show displays "Outdated" when nushell wrapper exists but has different code
+#[rstest]
+fn test_config_show_nushell_outdated_wrapper(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+
+ let global_config_dir = temp_home.path().join(".config").join("worktrunk");
+ fs::create_dir_all(&global_config_dir).unwrap();
+ fs::write(global_config_dir.join("config.toml"), "").unwrap();
+
+ // Create nushell vendor/autoload directory with an outdated wt.nu
+ let autoload = temp_home.path().join(".config/nushell/vendor/autoload");
+ fs::create_dir_all(&autoload).unwrap();
+ fs::write(
+ autoload.join("wt.nu"),
+ "# worktrunk shell integration for nushell\ndef --wrapped wt [...args] {\n command wt-old ...$args\n}\n",
+ )
+ .unwrap();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.arg("config").arg("show").current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ set_xdg_config_path(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
#[rstest]
fn test_config_show_zsh_compinit_correct_order(mut repo: TestRepo, temp_home: TempDir) {
// Setup mock gh/glab for deterministic BINARIES output
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
new file mode 100644
index 000000000..4c3928f2e
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_nushell_outdated_wrapper.snap
@@ -0,0 +1,71 @@
+---
+source: tests/integration_tests/config_show.rs
+assertion_line: 799
+info:
+ program: wt
+ args:
+ - config
+ - show
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+USER CONFIG ~/.config/worktrunk/config.toml
+↳ Empty file (using defaults)
+
+PROJECT CONFIG _REPO_/.config/wt.toml
+↳ Not found
+
+SHELL INTEGRATION
+▲ Shell integration not active
+  Invoked as: [PROJECT_ROOT]/target/debug/wt
+
+▲ nu: Outdated shell extension @ ~/.config/nushell/vendor/autoload/wt.nu
+↳ To update, run wt config shell install nu
+○ bash: Skipped; ~/.bashrc not found
+○ zsh: Skipped; ~/.zshrc not found
+○ fish: Skipped; ~/.config/fish/functions not found
+↳ To configure, run wt config shell install
+▲ Found wt in ~/.config/nushell/vendor/autoload/wt.nu:2 but not detected as integration:
+  def --wrapped wt [...args] {
+↳ If `def --wrapped wt [...args] {` is shell integration, report a false negative: https://github.com/max-sixty/worktrunk/issues/new?title=Shell%20integration%20detection%20false%20negative&body=Shell%20integration%20not%20detected%20despite%20config%20containing%20%60wt%60.%0A%0A%2A%2AUnmatched%20lines%3A%2A%2A%0A%60%60%60%0Adef%20--wrapped%20wt%20%5B...args%5D%20%7B%0A%60%60%60%0A%0A%2A%2AExpected%20behavior%3A%2A%2A%20These%20lines%20should%20be%20detected%20as%20shell%20integration.
+
+CLAUDE CODE
+○ claude CLI not installed
+
+OTHER
+○ wt: [VERSION]
+○ git: [VERSION]
+○ Hyperlinks: inactive