Skip to content

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

Add nushell support (#964)

Arnaud Limbourgc7128ce11b93
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 22570a641..63cf8efcf 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -73,17 +73,23 @@ jobs:
packages: zsh fish
version: 1.0
- - name: Install shells (bash, zsh, fish) - macOS
+ - name: Install shells (fish) - macOS
if: runner.os == 'macOS'
run: |
brew install fish
# bash and zsh are pre-installed on macOS
+ - name: Install nushell
+ if: runner.os != 'Windows'
+ uses: hustcer/setup-nu@v3
+ with:
+ version: '*'
+
- name: Install shells - Windows
if: runner.os == 'Windows'
run: |
# Git Bash is pre-installed on GitHub Actions Windows runners
- # Fish and zsh are not commonly available on native Windows (require WSL/MSYS2)
+ # Fish, zsh, and nushell are not commonly available on native Windows (require WSL/MSYS2)
# CI will test with bash only on Windows (tests skip unavailable shells)
echo "Using Git Bash for Windows tests"
shell: pwsh
@@ -204,6 +210,11 @@ jobs:
packages: zsh fish
version: 1.0
+ - name: Install nushell
+ uses: hustcer/setup-nu@v3
+ with:
+ version: '*'
+
- name: 💰 Rust repo cache
uses: actions/cache@v5
with:
@@ -234,6 +245,11 @@ jobs:
packages: zsh fish
version: 1.0
+ - name: Install nushell
+ uses: hustcer/setup-nu@v3
+ with:
+ version: '*'
+
# Ensure nothing remains from caching
- run: cargo llvm-cov clean --workspace
diff --git a/CLAUDE.md b/CLAUDE.md
index 381907cd9..5c5639642 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -74,7 +74,7 @@ cargo test --test integration --features shell-integration-tests # with shell t
### Claude Code Web Environment
-Run `task setup-web` to install required shells (zsh, fish), `gh`, and other dev tools. Install `task` first if needed:
+Run `task setup-web` to install required shells (zsh, fish, nushell), `gh`, and other dev tools. Install `task` first if needed:
```bash
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/bin
diff --git a/Taskfile.yaml b/Taskfile.yaml
index 733f7ec47..8b6d47882 100644
--- a/Taskfile.yaml
+++ b/Taskfile.yaml
@@ -53,7 +53,7 @@ tasks:
apt-get install -y -qq zsh fish
fi
fi
- for shell in bash zsh fish; do
+ for shell in bash zsh fish nu; do
command -v "$shell" &> /dev/null || { echo "Error: $shell not found"; exit 1; }
echo "$shell available"
done
diff --git a/docs/content/faq.md b/docs/content/faq.md
index 20ba5b836..c780961e5 100644
--- a/docs/content/faq.md
+++ b/docs/content/faq.md
@@ -96,6 +96,7 @@ Created by `wt config shell install`:
- **Bash**: adds line to `~/.bashrc`
- **Zsh**: adds line to `~/.zshrc` (or `$ZDOTDIR/.zshrc`)
- **Fish**: creates `~/.config/fish/functions/wt.fish` and `~/.config/fish/completions/wt.fish`
+- **Nushell** (experimental): creates `$nu.default-config-dir/vendor/autoload/wt.nu` (typically `~/.config/nushell` on Linux, `~/Library/Application Support/nushell` on macOS)
- **PowerShell** (Windows): creates both profile files if they don't exist:
- `Documents/PowerShell/Microsoft.PowerShell_profile.ps1` (PowerShell 7+)
- `Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1` (Windows PowerShell 5.1)
@@ -223,7 +224,7 @@ $ cargo test
### Full integration tests
-Shell integration tests require bash, zsh, and fish:
+Shell integration tests require bash, zsh, fish, and nushell:
```bash
$ cargo test --test integration --features shell-integration-tests
diff --git a/skills/worktrunk/reference/faq.md b/skills/worktrunk/reference/faq.md
index a87b5a5c9..9fef99867 100644
--- a/skills/worktrunk/reference/faq.md
+++ b/skills/worktrunk/reference/faq.md
@@ -90,6 +90,7 @@ Created by `wt config shell install`:
- **Bash**: adds line to `~/.bashrc`
- **Zsh**: adds line to `~/.zshrc` (or `$ZDOTDIR/.zshrc`)
- **Fish**: creates `~/.config/fish/functions/wt.fish` and `~/.config/fish/completions/wt.fish`
+- **Nushell** (experimental): creates `$nu.default-config-dir/vendor/autoload/wt.nu` (typically `~/.config/nushell` on Linux, `~/Library/Application Support/nushell` on macOS)
- **PowerShell** (Windows): creates both profile files if they don't exist:
- `Documents/PowerShell/Microsoft.PowerShell_profile.ps1` (PowerShell 7+)
- `Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1` (Windows PowerShell 5.1)
@@ -213,7 +214,7 @@ $ cargo test
### Full integration tests
-Shell integration tests require bash, zsh, and fish:
+Shell integration tests require bash, zsh, fish, and nushell:
```bash
$ cargo test --test integration --features shell-integration-tests
diff --git a/skills/worktrunk/reference/shell-integration.md b/skills/worktrunk/reference/shell-integration.md
index b2628261b..b7ef50da0 100644
--- a/skills/worktrunk/reference/shell-integration.md
+++ b/skills/worktrunk/reference/shell-integration.md
@@ -21,7 +21,7 @@ This allows `wt switch` to change the terminal's directory.
## Installation
```bash
-# Auto-install for all shells (bash, zsh, fish, PowerShell)
+# Auto-install for all shells (bash, zsh, fish, nushell (experimental), PowerShell)
wt config shell install
# Or manual installation - add to the shell config:
@@ -34,6 +34,9 @@ eval "$(wt config shell init zsh)"
# fish (~/.config/fish/config.fish):
wt config shell init fish | source
+# nushell (experimental) — save to vendor autoload directory:
+wt config shell init nu | save -f ($nu.default-config-dir | path join vendor/autoload/wt.nu)
+
# PowerShell ($PROFILE):
Invoke-Expression (& wt config shell init powershell | Out-String)
```
diff --git a/src/cli/config.rs b/src/cli/config.rs
index 2a2493d85..edf34b8d7 100644
--- a/src/cli/config.rs
+++ b/src/cli/config.rs
@@ -25,6 +25,11 @@ wt config shell init fish | source
Zsh (~/.zshrc):
```zsh
eval "$(wt config shell init zsh)"
+```
+
+Nushell (experimental) — save to vendor autoload directory:
+```console
+wt config shell init nu | save -f ($nu.default-config-dir | path join vendor/autoload/wt.nu)
```"#
)]
Init {
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 886d204a6..27e6bd9c8 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -8,7 +8,7 @@ use worktrunk::path::format_path_for_display;
use worktrunk::shell::{self, Shell};
use worktrunk::styling::{
INFO_SYMBOL, SUCCESS_SYMBOL, eprint, eprintln, format_bash_with_gutter, format_toml,
- format_with_gutter, prompt_message, warning_message,
+ format_with_gutter, hint_message, prompt_message, warning_message,
};
use crate::output::prompt::{PromptResponse, prompt_yes_no_preview};
@@ -330,7 +330,7 @@ pub fn scan_shell_configs(
cmd: &str,
) -> Result<ScanResult, String> {
// Base shells to check
- let mut default_shells = vec![Shell::Bash, Shell::Zsh, Shell::Fish];
+ let mut default_shells = vec![Shell::Bash, Shell::Zsh, Shell::Fish, Shell::Nushell];
// Add PowerShell if we detect we're in a PowerShell-compatible environment.
// - Non-Windows: PSModulePath reliably indicates PowerShell Core
@@ -353,9 +353,9 @@ pub fn scan_shell_configs(
// Find the first existing config file
let target_path = paths.iter().find(|p| p.exists());
- // For Fish, also check if the parent directory (functions/) exists
+ // For Fish/Nushell, also check if the parent directory exists
// since we create the file there rather than modifying an existing one
- let has_config_location = if matches!(shell, Shell::Fish) {
+ let has_config_location = if matches!(shell, Shell::Fish | Shell::Nushell) {
paths
.first()
.and_then(|p| p.parent())
@@ -397,8 +397,8 @@ pub fn scan_shell_configs(
}
} else if shell_filter.is_none() {
// Track skipped shells (only when not explicitly filtering)
- // For Fish, we check for functions/ directory; for others, the config file
- let skipped_path = if matches!(shell, Shell::Fish) {
+ // For Fish/Nushell, we check for parent directory; for others, the config file
+ let skipped_path = if matches!(shell, Shell::Fish | Shell::Nushell) {
paths
.first()
.and_then(|p| p.parent())
@@ -436,22 +436,19 @@ fn configure_shell_file(
// The line we write to the config file (also used for display)
let config_line = shell.config_line(cmd);
- // For Fish, we write a minimal wrapper to functions/{cmd}.fish that sources the
- // full function from the binary. This allows updates to worktrunk to automatically
- // provide the latest wrapper logic without requiring reinstall.
- if matches!(shell, Shell::Fish) {
+ // For Fish and Nushell, we write the full wrapper to a file that gets autoloaded.
+ // This allows updates to worktrunk to automatically provide the latest wrapper logic
+ // without requiring reinstall.
+ if matches!(shell, Shell::Fish | Shell::Nushell) {
let init = shell::ShellInit::with_prefix(shell, cmd.to_string());
- let fish_wrapper = init
- .generate_fish_wrapper()
- .map_err(|e| format!("Failed to generate fish wrapper: {e}"))?;
- return configure_fish_file(
- shell,
- path,
- &fish_wrapper,
- dry_run,
- allow_create,
- &config_line,
- );
+ let wrapper = if matches!(shell, Shell::Fish) {
+ init.generate_fish_wrapper()
+ .map_err(|e| format!("Failed to generate fish wrapper: {e}"))?
+ } else {
+ init.generate()
+ .map_err(|e| format!("Failed to generate nushell wrapper: {e}"))?
+ };
+ return configure_wrapper_file(shell, path, &wrapper, dry_run, allow_create, &config_line);
}
// For other shells, check if file exists
@@ -575,7 +572,7 @@ fn fish_code_lines(source: &str) -> Vec<&str> {
.collect()
}
-fn configure_fish_file(
+fn configure_wrapper_file(
shell: Shell,
path: &Path,
content: &str,
@@ -583,9 +580,9 @@ fn configure_fish_file(
allow_create: bool,
config_line: &str,
) -> Result<Option<ConfigureResult>, String> {
- // For Fish, we write a minimal wrapper to functions/{cmd}.fish that sources
- // the full function from `{cmd} config shell init fish` at runtime.
- // Fish autoloads these files on first invocation of the command.
+ // For Fish and Nushell, we write the full wrapper to a file that gets autoloaded.
+ // - Fish: functions/{cmd}.fish is autoloaded on first invocation
+ // - Nushell: vendor/autoload/{cmd}.nu is autoloaded automatically at startup
// Check if it already exists and has our integration
// Use .ok() for read errors - treat as "not configured" rather than failing
@@ -607,9 +604,9 @@ fn configure_fish_file(
}
// File doesn't exist or doesn't have our integration
- // For Fish, create if parent directory exists or if explicitly allowed
- // This is different from other shells because Fish uses functions/ which may exist
- // even if the specific wt.fish file doesn't
+ // For Fish/Nushell, create if parent directory exists or if explicitly allowed
+ // This is different from other shells because these use autoload directories
+ // which may exist even if the specific wrapper file doesn't
if !allow_create && !path.exists() {
// Check if parent directory exists
if !path.parent().is_some_and(|p| p.exists()) {
@@ -618,7 +615,7 @@ fn configure_fish_file(
}
if dry_run {
- // Fish writes the complete file - use WouldAdd if file exists, WouldCreate if new
+ // Fish/Nushell write the complete file - use WouldAdd if file exists, WouldCreate if new
let action = if path.exists() {
ConfigAction::WouldAdd
} else {
@@ -642,7 +639,7 @@ fn configure_fish_file(
})?;
}
- // Write the complete fish function file
+ // Write the complete wrapper file
fs::write(path, format!("{}\n", content))
.map_err(|e| format!("Failed to write {}: {e}", format_path_for_display(path)))?;
@@ -701,6 +698,11 @@ pub fn show_install_preview(
result.config_line.clone()
};
eprintln!("{}", format_bash_with_gutter(&content));
+
+ if matches!(shell, Shell::Nushell) {
+ eprintln!("{}", hint_message("Nushell support is experimental"));
+ }
+
eprintln!(); // Blank line after each shell block
}
@@ -946,7 +948,13 @@ fn scan_for_uninstall(
cmd: &str,
) -> Result<UninstallScanResult, String> {
// For uninstall, always include PowerShell to clean up any existing profiles
- let default_shells = vec![Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell];
+ let default_shells = vec![
+ Shell::Bash,
+ Shell::Zsh,
+ Shell::Fish,
+ Shell::Nushell,
+ Shell::PowerShell,
+ ];
let shells = shell_filter.map_or(default_shells, |shell| vec![shell]);
@@ -1040,6 +1048,39 @@ fn scan_for_uninstall(
continue;
}
+ // For Nushell, delete entire config file
+ if matches!(shell, Shell::Nushell) {
+ if let Some(config_path) = paths.first() {
+ if config_path.exists() {
+ if dry_run {
+ results.push(UninstallResult {
+ shell,
+ path: config_path.clone(),
+ action: UninstallAction::WouldRemove,
+ superseded_by: None,
+ });
+ } else {
+ fs::remove_file(config_path).map_err(|e| {
+ format!(
+ "Failed to remove {}: {}",
+ format_path_for_display(config_path),
+ e
+ )
+ })?;
+ results.push(UninstallResult {
+ shell,
+ path: config_path.clone(),
+ action: UninstallAction::Removed,
+ superseded_by: None,
+ });
+ }
+ } else {
+ not_found.push((shell, config_path.clone()));
+ }
+ }
+ continue;
+ }
+
// For Bash/Zsh, scan config files
let mut found = false;
diff --git a/src/commands/init.rs b/src/commands/init.rs
index 2c25e6d8c..a500f5f06 100644
--- a/src/commands/init.rs
+++ b/src/commands/init.rs
@@ -1,6 +1,6 @@
use clap::CommandFactory;
use clap_complete::generate;
-use std::io;
+use std::io::{self, Write};
use worktrunk::shell;
use worktrunk::styling::println;
@@ -60,6 +60,15 @@ pub fn handle_completions(shell: shell::Shell) -> anyhow::Result<()> {
shell::Shell::Zsh => {
generate(clap_complete::shells::Zsh, &mut cmd, &cmd_name, &mut stdout);
}
+ shell::Shell::Nushell => {
+ // Nushell uses template-based integration (shell wrapper + completions in one)
+ // Unlike other shells, it doesn't use clap_complete
+ let init = shell::ShellInit::with_prefix(shell, cmd_name.clone());
+ let code = init
+ .generate()
+ .expect("Failed to generate nushell integration");
+ write!(stdout, "{}", code).expect("Failed to write to stdout");
+ }
shell::Shell::PowerShell => {
generate(
clap_complete::shells::PowerShell,
diff --git a/src/completion.rs b/src/completion.rs
index 03cb960ae..43feb2826 100644
--- a/src/completion.rs
+++ b/src/completion.rs
@@ -124,10 +124,10 @@ pub(crate) fn maybe_handle_env_completion() -> bool {
let separator = ifs.as_deref().unwrap_or("\n");
// Shell-specific separator between value and description
- // zsh uses ":", fish uses "\t", bash doesn't support descriptions
+ // zsh uses ":", fish/nushell use "\t", bash doesn't support descriptions
let help_sep = match shell_name.as_ref() {
"zsh" => Some(":"),
- "fish" => Some("\t"),
+ "fish" | "nu" => Some("\t"),
_ => None,
};
diff --git a/src/output/global.rs b/src/output/global.rs
index 0b3584766..ec9bb5ebc 100644
--- a/src/output/global.rs
+++ b/src/output/global.rs
@@ -84,15 +84,26 @@ impl SymlinkMapping {
fn compute() -> Option<Self> {
let logical_cwd = PathBuf::from(std::env::var("PWD").ok()?);
let canonical_cwd = std::env::current_dir().ok()?;
+ let canonical_of_pwd = dunce::canonicalize(&logical_cwd).ok();
+ Self::from_paths(&logical_cwd, &canonical_cwd, canonical_of_pwd.as_deref())
+ }
+ /// Build a symlink mapping from logical and canonical working directories.
+ ///
+ /// `canonical_of_logical` is the result of canonicalizing the logical path,
+ /// used to verify that `$PWD` is fresh (not stale from a previous `cd`).
+ fn from_paths(
+ logical_cwd: &Path,
+ canonical_cwd: &Path,
+ canonical_of_logical: Option<&Path>,
+ ) -> Option<Self> {
// No symlink: paths are identical
if logical_cwd == canonical_cwd {
return None;
}
// Verify $PWD is fresh — it must canonicalize to the same path as current_dir()
- let canonical_of_pwd = dunce::canonicalize(&logical_cwd).ok()?;
- if canonical_of_pwd != canonical_cwd {
+ if canonical_of_logical != Some(canonical_cwd) {
return None;
}
@@ -651,6 +662,94 @@ mod tests {
assert_eq!(result, Some(PathBuf::from("/link/path/workspace/project")));
}
+ // ========================================================================
+ // SymlinkMapping::from_paths Tests
+ // ========================================================================
+
+ #[test]
+ fn test_from_paths_no_symlink() {
+ // When logical == canonical, no mapping needed
+ let result = SymlinkMapping::from_paths(
+ Path::new("/workspace/project"),
+ Path::new("/workspace/project"),
+ Some(Path::new("/workspace/project")),
+ );
+ assert!(result.is_none());
+ }
+
+ #[test]
+ fn test_from_paths_stale_pwd() {
+ // When canonical_of_logical doesn't match canonical_cwd, PWD is stale
+ let result = SymlinkMapping::from_paths(
+ Path::new("/old/link/project"),
+ Path::new("/real/project"),
+ Some(Path::new("/different/project")),
+ );
+ assert!(result.is_none());
+ }
+
+ #[test]
+ fn test_from_paths_canonicalize_failed() {
+ // When canonicalize returns None (path doesn't exist)
+ let result = SymlinkMapping::from_paths(
+ Path::new("/link/project"),
+ Path::new("/real/project"),
+ None,
+ );
+ assert!(result.is_none());
+ }
+
+ #[test]
+ fn test_from_paths_no_common_suffix() {
+ // When leaf names differ entirely — can't determine prefix mapping
+ let result = SymlinkMapping::from_paths(
+ Path::new("/link/alpha"),
+ Path::new("/real/beta"),
+ Some(Path::new("/real/beta")),
+ );
+ assert!(result.is_none());
+ }
+
+ #[test]
+ fn test_from_paths_wsl_style_symlink() {
+ // WSL: /workspace/project -> /mnt/wsl/workspace/project
+ let result = SymlinkMapping::from_paths(
+ Path::new("/workspace/project"),
+ Path::new("/mnt/wsl/workspace/project"),
+ Some(Path::new("/mnt/wsl/workspace/project")),
+ );
+ let mapping = result.expect("should produce mapping");
+ assert_eq!(mapping.logical_prefix, PathBuf::from("/"));
+ assert_eq!(mapping.canonical_prefix, PathBuf::from("/mnt/wsl"));
+ }
+
+ #[test]
+ fn test_from_paths_macos_private_var() {
+ // macOS: /var/folders/xx/tmp -> /private/var/folders/xx/tmp
+ let result = SymlinkMapping::from_paths(
+ Path::new("/var/folders/xx/tmp"),
+ Path::new("/private/var/folders/xx/tmp"),
+ Some(Path::new("/private/var/folders/xx/tmp")),
+ );
+ let mapping = result.expect("should produce mapping");
+ assert_eq!(mapping.logical_prefix, PathBuf::from("/"));
+ assert_eq!(mapping.canonical_prefix, PathBuf::from("/private"));
+ }
+
+ #[test]
+ fn test_from_paths_equal_depth_prefixes() {
+ // Symlink at the same depth: /link/path/project -> /real/path/project
+ let result = SymlinkMapping::from_paths(
+ Path::new("/link/path/project"),
+ Path::new("/real/path/project"),
+ Some(Path::new("/real/path/project")),
+ );
+ let mapping = result.expect("should produce mapping");
+ assert_eq!(mapping.logical_prefix, PathBuf::from("/link"));
+ assert_eq!(mapping.canonical_prefix, PathBuf::from("/real"));
+ // path/project is the common suffix
+ }
+
#[test]
fn test_nested_style_resets_leak_color() {
// BUG HYPOTHESIS from CLAUDE.md:
diff --git a/src/output/shell_integration.rs b/src/output/shell_integration.rs
index e8488c78f..34b41cdbb 100644
--- a/src/output/shell_integration.rs
+++ b/src/output/shell_integration.rs
@@ -256,6 +256,11 @@ pub fn print_shell_install_result(
}
}
+ if matches!(shell, Shell::Nushell) && !matches!(result.action, ConfigAction::AlreadyExists)
+ {
+ eprintln!("{}", hint_message("Nushell support is experimental"));
+ }
+
// Show completion result for this shell (fish has separate completion files)
if let Some(comp_result) = scan_result
.completion_results
diff --git a/src/shell/detection.rs b/src/shell/detection.rs
index 50f11d8e1..e51b82274 100644
--- a/src/shell/detection.rs
+++ b/src/shell/detection.rs
@@ -182,13 +182,14 @@ fn has_init_pattern_with_prefix_check(line: &str, cmd: &str, strict: bool) -> bo
continue;
}
- // POSIX shells (bash, zsh, fish)
- let is_posix_shell = line.contains("eval")
+ // POSIX shells (bash, zsh, fish) and nushell
+ let is_shell_exec = line.contains("eval")
|| line.contains("source")
|| line.contains(". <(") // POSIX dot command with process substitution
- || line.contains(". =("); // zsh dot command with =() substitution
+ || line.contains(". =(") // zsh dot command with =() substitution
+ || line.contains("save"); // nushell pipe to save
- if is_posix_shell {
+ if is_shell_exec {
return true;
}
}
@@ -930,15 +931,14 @@ mod tests {
}
// ------------------------------------------------------------------------
- // FALSE NEGATIVE: Nushell (unsupported but users might try)
+ // Nushell detection
// ------------------------------------------------------------------------
#[test]
fn test_nushell_pattern() {
- // Nushell uses "source" so it might match
+ // Nushell's config_line uses `save --force` which contains "wt config shell init"
let line = "wt config shell init nu | source";
- // This actually matches because it contains "source" and "wt config shell init"
- assert_detects(line, "wt", "nushell pattern (unexpectedly matches)");
+ assert_detects(line, "wt", "nushell pattern");
}
// ------------------------------------------------------------------------
diff --git a/src/shell/mod.rs b/src/shell/mod.rs
index 491b924ba..5e3bfb9b7 100644
--- a/src/shell/mod.rs
+++ b/src/shell/mod.rs
@@ -3,7 +3,7 @@
//! This module provides:
//! - Shell detection and configuration path discovery
//! - Shell integration line detection for config files
-//! - Shell initialization code generation (bash, zsh, fish, powershell)
+//! - Shell initialization code generation (bash, zsh, fish, nushell, powershell)
mod detection;
mod paths;
@@ -23,7 +23,7 @@ pub use utils::{current_shell, detect_zsh_compinit, extract_filename_from_path};
/// Supported shells
///
-/// Currently supported: bash, fish, zsh, powershell
+/// Currently supported: bash, fish, nushell (experimental), zsh, powershell
///
/// On Windows, Git Bash users should use `bash` for shell integration.
/// PowerShell integration is available for native Windows users without Git Bash.
@@ -32,6 +32,9 @@ pub use utils::{current_shell, detect_zsh_compinit, extract_filename_from_path};
pub enum Shell {
Bash,
Fish,
+ #[strum(serialize = "nu")]
+ #[clap(name = "nu")]
+ Nushell,
Zsh,
#[strum(serialize = "powershell")]
#[clap(name = "powershell")]
@@ -90,6 +93,11 @@ impl Shell {
self
)
}
+ Self::Nushell => {
+ format!(
+ "if (which {cmd} | is-not-empty) {{ {cmd} config shell init nu | save --force ($nu.default-config-dir | path join vendor/autoload/{cmd}.nu) }}",
+ )
+ }
Self::PowerShell => {
// Note: `| Out-String` is required because PowerShell command output is an array
// of strings by default, but Invoke-Expression expects a single string.
@@ -168,6 +176,10 @@ impl ShellInit {
let template = FishTemplate { cmd: &self.cmd };
template.render()
}
+ Shell::Nushell => {
+ let template = NushellTemplate { cmd: &self.cmd };
+ template.render()
+ }
Shell::PowerShell => {
let template = PowerShellTemplate { cmd: &self.cmd };
template.render()
@@ -219,6 +231,13 @@ struct FishWrapperTemplate<'a> {
cmd: &'a str,
}
+/// Nushell template
+#[derive(Template)]
+#[template(path = "nushell.nu", escape = "none")]
+struct NushellTemplate<'a> {
+ cmd: &'a str,
+}
+
/// PowerShell template
#[derive(Template)]
#[template(path = "powershell.ps1", escape = "none")]
@@ -261,6 +280,7 @@ mod tests {
insta::assert_snapshot!("config_line_bash", Shell::Bash.config_line("wt"));
insta::assert_snapshot!("config_line_zsh", Shell::Zsh.config_line("wt"));
insta::assert_snapshot!("config_line_fish", Shell::Fish.config_line("wt"));
+ insta::assert_snapshot!("config_line_nu", Shell::Nushell.config_line("wt"));
insta::assert_snapshot!(
"config_line_powershell",
Shell::PowerShell.config_line("wt")
@@ -275,6 +295,10 @@ mod tests {
insta::assert_snapshot!("config_line_bash_custom", Shell::Bash.config_line("git-wt"));
insta::assert_snapshot!("config_line_zsh_custom", Shell::Zsh.config_line("git-wt"));
insta::assert_snapshot!("config_line_fish_custom", Shell::Fish.config_line("git-wt"));
+ insta::assert_snapshot!(
+ "config_line_nu_custom",
+ Shell::Nushell.config_line("git-wt")
+ );
insta::assert_snapshot!(
"config_line_powershell_custom",
Shell::PowerShell.config_line("git-wt")
@@ -283,7 +307,13 @@ mod tests {
#[test]
fn test_shell_init_generate() {
- for shell in [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell] {
+ for shell in [
+ Shell::Bash,
+ Shell::Zsh,
+ Shell::Fish,
+ Shell::Nushell,
+ Shell::PowerShell,
+ ] {
let init = ShellInit::with_prefix(shell, "wt".to_string());
let output = init.generate().expect("Failed to generate");
insta::assert_snapshot!(format!("init_{shell}"), output);
@@ -293,7 +323,13 @@ mod tests {
#[test]
fn test_shell_config_paths_returns_paths() {
// All shells should return at least one config path
- let shells = [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell];
+ let shells = [
+ Shell::Bash,
+ Shell::Zsh,
+ Shell::Fish,
+ Shell::Nushell,
+ Shell::PowerShell,
+ ];
for shell in shells {
let result = shell.config_paths("wt");
assert!(result.is_ok(), "Failed to get config paths for {:?}", shell);
@@ -309,7 +345,13 @@ mod tests {
#[test]
fn test_shell_completion_path_returns_path() {
// All shells should return a completion path
- let shells = [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell];
+ let shells = [
+ Shell::Bash,
+ Shell::Zsh,
+ Shell::Fish,
+ Shell::Nushell,
+ Shell::PowerShell,
+ ];
for shell in shells {
let result = shell.completion_path("wt");
assert!(
@@ -410,7 +452,14 @@ mod tests {
/// the .exe suffix on Windows (MSYS2/Git Bash handles the resolution).
#[rstest]
fn test_config_line_detected_by_is_shell_integration_line(
- #[values(Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell)] shell: Shell,
+ #[values(
+ Shell::Bash,
+ Shell::Zsh,
+ Shell::Fish,
+ Shell::Nushell,
+ Shell::PowerShell
+ )]
+ shell: Shell,
#[values("wt", "git-wt")] prefix: &str,
) {
let line = shell.config_line(prefix);
diff --git a/src/shell/paths.rs b/src/shell/paths.rs
index 77e280827..3cecab0d0 100644
--- a/src/shell/paths.rs
+++ b/src/shell/paths.rs
@@ -18,6 +18,34 @@ pub fn home_dir_required() -> Result<PathBuf, std::io::Error> {
})
}
+/// Get Nushell's default config directory.
+///
+/// Queries `nu` for `$nu.default-config-dir` to handle platform-specific paths.
+/// On macOS, this is `~/Library/Application Support/nushell` rather than `~/.config/nushell`.
+/// Falls back to etcetera's config_dir if the nu command fails.
+fn nushell_config_dir(home: &std::path::Path) -> PathBuf {
+ let nu_config_dir = crate::shell_exec::Cmd::new("nu")
+ .args(["-c", "echo $nu.default-config-dir"])
+ .run()
+ .ok()
+ .and_then(|output| {
+ if output.status.success() {
+ String::from_utf8(output.stdout)
+ .ok()
+ .map(|s| PathBuf::from(s.trim()))
+ } else {
+ None
+ }
+ });
+
+ nu_config_dir.unwrap_or_else(|| {
+ choose_base_strategy()
+ .map(|s| s.config_dir())
+ .unwrap_or_else(|_| home.join(".config"))
+ .join("nushell")
+ })
+}
+
/// Get PowerShell profile paths in order of preference.
/// On Windows, returns both PowerShell Core (7+) and Windows PowerShell (5.1) paths.
/// On Unix, uses the conventional ~/.config/powershell location.
@@ -75,6 +103,17 @@ pub fn config_paths(shell: super::Shell, cmd: &str) -> Result<Vec<PathBuf>, std:
.join(format!("{}.fish", cmd)),
]
}
+ super::Shell::Nushell => {
+ // Nushell vendor autoload directory - query nu for its config directory
+ // to handle platform-specific paths (e.g., ~/Library/Application Support/nushell on macOS)
+ let config_dir = nushell_config_dir(&home);
+ vec![
+ config_dir
+ .join("vendor")
+ .join("autoload")
+ .join(format!("{}.nu", cmd)),
+ ]
+ }
super::Shell::PowerShell => powershell_profile_paths(&home),
})
}
@@ -122,7 +161,6 @@ pub fn completion_path(shell: super::Shell, cmd: &str) -> Result<PathBuf, std::i
}
super::Shell::Zsh => home.join(".zfunc").join(format!("_{}", cmd)),
super::Shell::Fish => {
- // XDG_CONFIG_HOME defaults to ~/.config
let config_home = strategy
.as_ref()
.map(|s| s.config_dir())
@@ -132,6 +170,15 @@ pub fn completion_path(shell: super::Shell, cmd: &str) -> Result<PathBuf, std::i
.join("completions")
.join(format!("{}.fish", cmd))
}
+ super::Shell::Nushell => {
+ // Nushell completions are defined inline in the init script
+ // Return a path in the vendor autoload directory (same as config)
+ let config_dir = nushell_config_dir(&home);
+ config_dir
+ .join("vendor")
+ .join("autoload")
+ .join(format!("{}.nu", cmd))
+ }
super::Shell::PowerShell => {
// PowerShell doesn't use a separate completion file - completions are
// registered inline in the profile using Register-ArgumentCompleter
diff --git a/src/shell/snapshots/worktrunk__shell__tests__config_line_nu.snap b/src/shell/snapshots/worktrunk__shell__tests__config_line_nu.snap
new file mode 100644
index 000000000..4f4bd0242
--- /dev/null
+++ b/src/shell/snapshots/worktrunk__shell__tests__config_line_nu.snap
@@ -0,0 +1,5 @@
+---
+source: src/shell/mod.rs
+expression: "Shell::Nushell.config_line(\"wt\")"
+---
+if (which wt | is-not-empty) { wt config shell init nu | save --force ($nu.default-config-dir | path join vendor/autoload/wt.nu) }
diff --git a/src/shell/snapshots/worktrunk__shell__tests__config_line_nu_custom.snap b/src/shell/snapshots/worktrunk__shell__tests__config_line_nu_custom.snap
new file mode 100644
index 000000000..b3e281bc3
--- /dev/null
+++ b/src/shell/snapshots/worktrunk__shell__tests__config_line_nu_custom.snap
@@ -0,0 +1,5 @@
+---
+source: src/shell/mod.rs
+expression: "Shell::Nushell.config_line(\"git-wt\")"
+---
+if (which git-wt | is-not-empty) { git-wt config shell init nu | save --force ($nu.default-config-dir | path join vendor/autoload/git-wt.nu) }
diff --git a/src/shell/snapshots/worktrunk__shell__tests__init_nu.snap b/src/shell/snapshots/worktrunk__shell__tests__init_nu.snap
new file mode 100644
index 000000000..35838031f
--- /dev/null
+++ b/src/shell/snapshots/worktrunk__shell__tests__init_nu.snap
@@ -0,0 +1,61 @@
+---
+source: src/shell/mod.rs
+expression: output
+---
+# worktrunk shell integration for nushell
+
+# Override wt command with file-based directive passing.
+# Creates a temp file, passes path via WORKTRUNK_DIRECTIVE_FILE, executes directives after.
+# WORKTRUNK_BIN can override the binary path (for testing dev builds).
+#
+# Note: Nushell's `source` is parse-time only, so we can't source dynamic paths.
+# Instead, we read the directive file and execute each line.
+def --env --wrapped wt [...args: string] {
+ let worktrunk_bin = if ($env.WORKTRUNK_BIN? | is-not-empty) {
+ $env.WORKTRUNK_BIN
+ } else {
+ # Find the external binary, not the custom function
+ # `which -a` is needed because `which` alone only returns the custom command
+ let external = (which -a wt | where type == "external")
+ if ($external | is-empty) {
+ error make {
+ msg: "wt binary not found in PATH. Install with 'cargo install --path .' or set $env.WORKTRUNK_BIN"
+ }
+ }
+ ($external | get 0.path)
+ }
+
+ let directive_file = (mktemp --tmpdir)
+
+ # Run command with directive file - output streams in real-time
+ with-env { WORKTRUNK_DIRECTIVE_FILE: $directive_file } {
+ ^$worktrunk_bin ...$args
+ }
+ let exit_code = $env.LAST_EXIT_CODE
+
+ # Process directive file line by line
+ if ($directive_file | path exists) and (open $directive_file --raw | str trim | is-not-empty) {
+ let directives = open $directive_file --raw | str trim | lines
+ for directive in $directives {
+ if ($directive | str starts-with "cd '") {
+ # Parse cd command: worktrunk emits "cd '<path>'" with POSIX quoting.
+ # Strip the "cd '" prefix and trailing "'" to extract the raw path.
+ # Note: paths with embedded single quotes use POSIX '\'' escaping,
+ # which this doesn't handle. A future improvement could have worktrunk
+ # emit raw paths instead of POSIX shell commands, letting each shell
+ # construct its native cd syntax.
+ let target_dir = $directive | str substring 4..-2
+ cd $target_dir
+ } else if ($directive | is-not-empty) {
+ # Execute other commands via sh for proper shell expansion
+ ^sh -c $directive
+ }
+ }
+ }
+
+ rm -f $directive_file
+
+ if $exit_code != 0 {
+ error make { msg: $"wt exited with code ($exit_code)" }
+ }
+}
diff --git a/src/shell/utils.rs b/src/shell/utils.rs
index 565e524d4..ecad70ebb 100644
--- a/src/shell/utils.rs
+++ b/src/shell/utils.rs
@@ -49,6 +49,8 @@ pub fn shell_from_name(shell_name: &str) -> Option<Shell> {
Some(Shell::Bash)
} else if name_lower.starts_with("fish") {
Some(Shell::Fish)
+ } else if name_lower.starts_with("nu") {
+ Some(Shell::Nushell)
} else if name_lower.starts_with("pwsh") || name_lower.starts_with("powershell") {
Some(Shell::PowerShell)
} else {
@@ -250,6 +252,8 @@ mod tests {
#[case::zsh("zsh", Some(Shell::Zsh))]
#[case::zsh_versioned("zsh-5.9", Some(Shell::Zsh))]
#[case::fish("fish", Some(Shell::Fish))]
+ #[case::nu("nu", Some(Shell::Nushell))]
+ #[case::nushell("nushell", Some(Shell::Nushell))]
#[case::powershell("powershell", Some(Shell::PowerShell))]
#[case::pwsh("pwsh", Some(Shell::PowerShell))]
#[case::pwsh_preview("pwsh-preview", Some(Shell::PowerShell))]
diff --git a/templates/nushell.nu b/templates/nushell.nu
new file mode 100644
index 000000000..4c1f64f35
--- /dev/null
+++ b/templates/nushell.nu
@@ -0,0 +1,57 @@
+# worktrunk shell integration for nushell
+
+# Override {{ cmd }} command with file-based directive passing.
+# Creates a temp file, passes path via WORKTRUNK_DIRECTIVE_FILE, executes directives after.
+# WORKTRUNK_BIN can override the binary path (for testing dev builds).
+#
+# Note: Nushell's `source` is parse-time only, so we can't source dynamic paths.
+# Instead, we read the directive file and execute each line.
+def --env --wrapped {{ cmd }} [...args: string] {
+ let worktrunk_bin = if ($env.WORKTRUNK_BIN? | is-not-empty) {
+ $env.WORKTRUNK_BIN
+ } else {
+ # Find the external binary, not the custom function
+ # `which -a` is needed because `which` alone only returns the custom command
+ let external = (which -a {{ cmd }} | where type == "external")
+ if ($external | is-empty) {
+ error make {
+ msg: "{{ cmd }} binary not found in PATH. Install with 'cargo install --path .' or set $env.WORKTRUNK_BIN"
+ }
+ }
+ ($external | get 0.path)
+ }
+
+ let directive_file = (mktemp --tmpdir)
+
+ # Run command with directive file - output streams in real-time
+ with-env { WORKTRUNK_DIRECTIVE_FILE: $directive_file } {
+ ^$worktrunk_bin ...$args
+ }
+ let exit_code = $env.LAST_EXIT_CODE
+
+ # Process directive file line by line
+ if ($directive_file | path exists) and (open $directive_file --raw | str trim | is-not-empty) {
+ let directives = open $directive_file --raw | str trim | lines
+ for directive in $directives {
+ if ($directive | str starts-with "cd '") {
+ # Parse cd command: worktrunk emits "cd '<path>'" with POSIX quoting.
+ # Strip the "cd '" prefix and trailing "'" to extract the raw path.
+ # Note: paths with embedded single quotes use POSIX '\'' escaping,
+ # which this doesn't handle. A future improvement could have worktrunk
+ # emit raw paths instead of POSIX shell commands, letting each shell
+ # construct its native cd syntax.
+ let target_dir = $directive | str substring 4..-2
+ cd $target_dir
+ } else if ($directive | is-not-empty) {
+ # Execute other commands via sh for proper shell expansion
+ ^sh -c $directive
+ }
+ }
+ }
+
+ rm -f $directive_file
+
+ if $exit_code != 0 {
+ error make { msg: $"{{ cmd }} exited with code ($exit_code)" }
+ }
+}
diff --git a/tests/integration_tests/completion.rs b/tests/integration_tests/completion.rs
index 58a8aa59b..b1d0d75f4 100644
--- a/tests/integration_tests/completion.rs
+++ b/tests/integration_tests/completion.rs
@@ -655,8 +655,9 @@ fn test_complete_init_shell_all_variations(repo: TestRepo) {
assert!(shells.contains(&"bash"));
assert!(shells.contains(&"fish"));
assert!(shells.contains(&"zsh"));
+ assert!(shells.contains(&"nu"));
assert!(!shells.contains(&"elvish"));
- assert!(!shells.contains(&"nushell"));
+ assert!(!shells.contains(&"nushell")); // clap name is "nu", not "nushell"
// Test 2: Partial input "fi" - filters to fish
let output = repo
@@ -1231,7 +1232,7 @@ fn test_complete_excludes_deprecated_args(repo: TestRepo) {
#[rstest]
fn test_static_completions_for_all_shells() {
// Test each supported shell produces valid output
- for shell in ["bash", "fish", "zsh", "powershell"] {
+ for shell in ["bash", "fish", "nu", "zsh", "powershell"] {
let output = wt_command()
.args(["config", "shell", "completions", shell])
.output()
@@ -1269,6 +1270,13 @@ fn test_static_completions_for_all_shells() {
"{shell}: should contain zsh completion markers"
);
}
+ "nu" => {
+ // Nushell uses template-based integration, not clap_complete
+ assert!(
+ stdout.contains("def --wrapped") || stdout.contains("def --env"),
+ "{shell}: should contain nushell function markers"
+ );
+ }
"powershell" => {
assert!(
stdout.contains("Register-ArgumentCompleter")
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index 512a61012..67c99871c 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -35,6 +35,7 @@ fn test_configure_shell_with_yes(repo: TestRepo, temp_home: TempDir) {
✓ Added shell extension & completions for zsh @ ~/.zshrc
↳ Skipped bash; ~/.bashrc not found
↳ Skipped fish; ~/.config/fish/functions not found
+ ↳ Skipped nu; ~/.config/nushell/vendor/autoload not found
✓ Configured 1 shell
▲ Completions require compinit; add to ~/.zshrc before the wt line:
@@ -607,6 +608,7 @@ fn test_configure_shell_no_files(repo: TestRepo, temp_home: TempDir) {
↳ Skipped bash; ~/.bashrc not found
↳ Skipped zsh; ~/.zshrc not found
↳ Skipped fish; ~/.config/fish/functions not found
+ ↳ Skipped nu; ~/.config/nushell/vendor/autoload not found
✗ No shell config files found
");
});
@@ -643,6 +645,7 @@ fn test_configure_shell_multiple_configs(repo: TestRepo, temp_home: TempDir) {
✓ Added shell extension & completions for bash @ ~/.bashrc
✓ Added shell extension & completions for zsh @ ~/.zshrc
↳ Skipped fish; ~/.config/fish/functions not found
+ ↳ Skipped nu; ~/.config/nushell/vendor/autoload not found
✓ Configured 2 shells
▲ Completions require compinit; add to ~/.zshrc before the wt line:
@@ -702,6 +705,7 @@ fn test_configure_shell_mixed_states(repo: TestRepo, temp_home: TempDir) {
○ Already configured shell extension & completions for bash @ ~/.bashrc
✓ Added shell extension & completions for zsh @ ~/.zshrc
↳ Skipped fish; ~/.config/fish/functions not found
+ ↳ Skipped nu; ~/.config/nushell/vendor/autoload not found
✓ Configured 1 shell
▲ Completions require compinit; add to ~/.zshrc before the wt line:
@@ -757,6 +761,7 @@ fn test_uninstall_shell(repo: TestRepo, temp_home: TempDir) {
✓ Removed shell extension & completions for zsh @ ~/.zshrc
↳ No bash shell extension & completions in ~/.bashrc
↳ No fish shell extension in ~/.config/fish/functions/wt.fish
+ ↳ No nu shell extension in ~/.config/nushell/vendor/autoload/wt.nu
↳ No fish completions in ~/.config/fish/completions/wt.fish
✓ Removed integration from 1 shell
@@ -813,6 +818,7 @@ fn test_uninstall_shell_multiple(repo: TestRepo, temp_home: TempDir) {
✓ Removed shell extension & completions for bash @ ~/.bashrc
✓ Removed shell extension & completions for zsh @ ~/.zshrc
↳ No fish shell extension in ~/.config/fish/functions/wt.fish
+ ↳ No nu shell extension in ~/.config/nushell/vendor/autoload/wt.nu
↳ No fish completions in ~/.config/fish/completions/wt.fish
✓ Removed integration from 2 shells
@@ -1110,6 +1116,7 @@ fn test_configure_shell_no_warning_for_bash_user(repo: TestRepo, temp_home: Temp
✓ Added shell extension & completions for bash @ ~/.bashrc
✓ Added shell extension & completions for zsh @ ~/.zshrc
↳ Skipped fish; ~/.config/fish/functions not found
+ ↳ Skipped nu; ~/.config/nushell/vendor/autoload not found
✓ Configured 2 shells
↳ Restart shell to activate shell integration
@@ -1265,6 +1272,7 @@ fn test_configure_shell_no_warning_when_shell_unset(repo: TestRepo, temp_home: T
✓ Added shell extension & completions for bash @ ~/.bashrc
✓ Added shell extension & completions for zsh @ ~/.zshrc
↳ Skipped fish; ~/.config/fish/functions not found
+ ↳ Skipped nu; ~/.config/nushell/vendor/autoload not found
✓ Configured 2 shells
");
@@ -1555,6 +1563,7 @@ mod pty_tests {
configure_pty_command(&mut cmd);
cmd.env("HOME", temp_home.path());
+ cmd.env("XDG_CONFIG_HOME", temp_home.path().join(".config"));
cmd.env("SHELL", "/bin/zsh");
// Skip the compinit probe and force the advisory to appear. The probe spawns
// `zsh -ic` which triggers global zshrc configs that can produce "insecure
@@ -1627,6 +1636,128 @@ mod pty_tests {
}
}
+/// Test installing nushell shell integration
+///
+/// Runs `install nu --yes` and verifies the wrapper file was created.
+/// This covers the nushell-specific wrapper generation path in configure_shell.
+///
+/// set_temp_home_env sets XDG_CONFIG_HOME to home/.config, and the `nu` binary
+/// isn't available in tests, so nushell_config_dir falls back to XDG_CONFIG_HOME/nushell.
+#[rstest]
+fn test_configure_shell_nushell(repo: TestRepo, temp_home: TempDir) {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("SHELL", "/bin/nu");
+ cmd.arg("config")
+ .arg("shell")
+ .arg("install")
+ .arg("nu")
+ .arg("--yes")
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().expect("Failed to execute command");
+ assert!(
+ output.status.success(),
+ "Install should succeed:\nstderr: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ assert!(
+ stderr.contains("Created shell extension for") && stderr.contains("nu"),
+ "Output should show nushell was created:\n{}",
+ stderr
+ );
+
+ // set_temp_home_env sets XDG_CONFIG_HOME → home/.config, so the nushell
+ // vendor autoload path is deterministic (nu binary not available in tests).
+ let home = std::fs::canonicalize(temp_home.path()).unwrap();
+ let nu_config = home
+ .join(".config")
+ .join("nushell")
+ .join("vendor")
+ .join("autoload")
+ .join("wt.nu");
+ assert!(
+ nu_config.exists(),
+ "wt.nu should be created at {:?}",
+ nu_config
+ );
+
+ let content = fs::read_to_string(&nu_config).unwrap();
+ assert!(
+ content.contains("def --env --wrapped wt"),
+ "Should contain nushell function definition: {}",
+ content
+ );
+}
+
+/// Test uninstalling nushell shell integration
+///
+/// Installs nushell integration first, then uninstalls it.
+/// This covers the nushell-specific uninstall block in configure_shell.
+#[rstest]
+fn test_uninstall_shell_nushell(repo: TestRepo, temp_home: TempDir) {
+ let home = std::fs::canonicalize(temp_home.path()).unwrap();
+ let nu_config = home
+ .join(".config")
+ .join("nushell")
+ .join("vendor")
+ .join("autoload")
+ .join("wt.nu");
+
+ // First install to create the wrapper file
+ let mut install_cmd = wt_command();
+ repo.configure_wt_cmd(&mut install_cmd);
+ set_temp_home_env(&mut install_cmd, temp_home.path());
+ install_cmd.env("SHELL", "/bin/nu");
+ install_cmd
+ .args(["config", "shell", "install", "nu", "--yes"])
+ .current_dir(repo.root_path());
+
+ let install_output = install_cmd.output().expect("Failed to execute install");
+ assert!(
+ install_output.status.success(),
+ "Install should succeed:\nstderr: {}",
+ String::from_utf8_lossy(&install_output.stderr)
+ );
+ assert!(
+ nu_config.exists(),
+ "wt.nu should exist after install at {:?}",
+ nu_config
+ );
+
+ // Now uninstall
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("SHELL", "/bin/nu");
+ cmd.args(["config", "shell", "uninstall", "nu", "--yes"])
+ .current_dir(repo.root_path());
+
+ let output = cmd.output().expect("Failed to execute uninstall");
+ assert!(
+ output.status.success(),
+ "Uninstall should succeed:\nstderr: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ assert!(
+ stderr.contains("Removed shell extension for") && stderr.contains("nu"),
+ "Output should show nushell was removed:\n{}",
+ stderr
+ );
+
+ // Verify the nushell config file was deleted
+ assert!(
+ !nu_config.exists(),
+ "wt.nu should be deleted after uninstall: {:?}",
+ nu_config
+ );
+}
+
/// Test that WORKTRUNK_TEST_POWERSHELL_ENV=1 triggers PowerShell auto-detection.
/// This simulates the Windows behavior where we detect PowerShell when SHELL is not set.
#[rstest]
diff --git a/tests/integration_tests/init.rs b/tests/integration_tests/init.rs
index b9403a266..c2979d93a 100644
--- a/tests/integration_tests/init.rs
+++ b/tests/integration_tests/init.rs
@@ -65,8 +65,8 @@ fn test_init_invalid_shell(repo: TestRepo) {
----- stdout -----
----- stderr -----
- error: invalid value 'invalid-shell' for '<bash|fish|zsh|powershell>'
- [possible values: bash, fish, zsh, powershell]
+ error: invalid value 'invalid-shell' for '<bash|fish|nu|zsh|powershell>'
+ [possible values: bash, fish, nu, zsh, powershell]
For more information, try '--help'.
");
diff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rs
index 663a61cad..60708fee6 100644
--- a/tests/integration_tests/shell_wrapper.rs
+++ b/tests/integration_tests/shell_wrapper.rs
@@ -205,6 +205,15 @@ fn build_shell_script(shell: &str, repo: &TestRepo, subcommand: &str, args: &[&s
));
script.push_str("set -x CLICOLOR_FORCE 1\n");
}
+ "nu" => {
+ // Nushell uses $env.VAR syntax for environment variables
+ script.push_str(&format!("$env.WORKTRUNK_BIN = {}\n", wt_bin_quoted));
+ script.push_str(&format!(
+ "$env.WORKTRUNK_CONFIG_PATH = {}\n",
+ config_path_quoted
+ ));
+ script.push_str("$env.CLICOLOR_FORCE = '1'\n");
+ }
"zsh" => {
// For zsh, initialize the completion system first
// This allows static completions (which call compdef) to work in isolated mode
@@ -280,6 +289,11 @@ fn build_shell_script(shell: &str, repo: &TestRepo, subcommand: &str, args: &[&s
// (see templates/fish.fish - psub causes buffering). Tests document current behavior.
format!("begin\n{}\nend 2>&1", script)
}
+ "nu" => {
+ // Nushell doesn't need explicit stderr redirect - PTY captures both streams
+ // The script is executed directly
+ script
+ }
"bash" => {
// For bash, we don't use a subshell wrapper because it would isolate job control messages.
// Instead, we use exec to redirect stderr to stdout, then run the script.
@@ -428,13 +442,18 @@ fn exec_in_pty_interactive(
cmd.arg("-File");
cmd.arg(script_path.to_string_lossy().to_string());
}
+ "nu" => {
+ // Nushell: isolate from user config
+ cmd.arg("--no-config-file");
+ cmd.arg("-c");
+ cmd.arg(script);
+ }
_ => {
// fish and other shells
cmd.arg("-c");
cmd.arg(script);
}
}
-
cmd.cwd(working_dir);
// Add test-specific environment variables (convert &str tuples to String tuples)
@@ -753,6 +772,7 @@ mod unix_tests {
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_wrapper_handles_command_failure(#[case] shell: &str, mut repo: TestRepo) {
// Create a worktree that already exists
repo.add_worktree("existing");
@@ -786,6 +806,7 @@ mod unix_tests {
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_wrapper_switch_create(#[case] shell: &str, repo: TestRepo) {
let output = exec_through_wrapper(shell, &repo, "switch", &["--create", "feature"]);
@@ -812,6 +833,7 @@ mod unix_tests {
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_wrapper_remove(#[case] shell: &str, mut repo: TestRepo) {
// Create a worktree to remove
repo.add_worktree("to-remove");
@@ -834,6 +856,7 @@ mod unix_tests {
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_wrapper_step_for_each(#[case] shell: &str, mut repo: TestRepo) {
// Remove fixture worktrees so we can create our own feature-a and feature-b
repo.remove_fixture_worktrees();
@@ -897,6 +920,7 @@ mod unix_tests {
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_wrapper_merge(#[case] shell: &str, mut repo: TestRepo) {
// Disable LLM prompt (PTY tests are interactive, claude may be installed)
repo.write_test_config("");
@@ -922,6 +946,7 @@ mod unix_tests {
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_wrapper_switch_with_execute(#[case] shell: &str, repo: TestRepo) {
// Use --yes to skip approval prompt in tests
let output = exec_through_wrapper(
@@ -962,6 +987,7 @@ mod unix_tests {
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_wrapper_execute_exit_code_propagation(#[case] shell: &str, repo: TestRepo) {
// Use --yes to skip approval prompt in tests
// wt should succeed (creates worktree), but the execute command should fail with exit 42
@@ -1522,6 +1548,7 @@ approved-commands = ["echo 'fish background task'"]
// This test runs `cargo run` inside a PTY which can take longer than the
// default 60s timeout when cargo checks/compiles dependencies. Extended
// timeout configured in .config/nextest.toml.
+ // Note: Nushell not included - this test builds custom scripts with bash syntax
#[rstest]
#[case("bash")]
#[case("zsh")]
@@ -1910,6 +1937,7 @@ approved-commands = ["echo 'bash background'"]
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_branch_name_with_slashes(#[case] shell: &str, repo: TestRepo) {
// Branch name with slashes (common git convention)
let output =
@@ -1930,6 +1958,7 @@ approved-commands = ["echo 'bash background'"]
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_branch_name_with_dashes_underscores(#[case] shell: &str, repo: TestRepo) {
let output = exec_through_wrapper(shell, &repo, "switch", &["--create", "fix-bug_123"]);
@@ -1948,6 +1977,7 @@ approved-commands = ["echo 'bash background'"]
// ========================================================================
/// Test that shell integration works when wt is not in PATH but WORKTRUNK_BIN is set
+ // Note: Nushell not included - this test builds custom scripts with bash syntax
#[rstest]
#[case("bash")]
#[case("zsh")]
@@ -2200,6 +2230,7 @@ approved-commands = ["echo 'bash background'"]
#[case("bash")]
#[case("zsh")]
#[case("fish")]
+ #[case("nu")]
fn test_shell_completes_cleanly(#[case] shell: &str, repo: TestRepo) {
// Configure a post-start command to exercise the background job code path
let config_dir = repo.root_path().join(".config");
@@ -3035,6 +3066,7 @@ for c in "${{COMPREPLY[@]}}"; do echo "${{c%% *}}"; done
/// shell wrapper. The issue being tested: in some shells (particularly fish),
/// command substitution doesn't propagate stderr redirects, causing help
/// output to appear on the terminal even when redirected.
+ // Note: Nushell not included - this test builds custom scripts with bash syntax
#[rstest]
#[case("bash")]
#[case("zsh")]
@@ -3185,6 +3217,7 @@ echo "SCRIPT_COMPLETED"
///
/// We verify pager invocation by setting GIT_PAGER to a script that creates
/// a marker file before passing through the content.
+ // Note: Nushell not included - this test builds custom scripts with bash syntax
#[rstest]
#[case("bash")]
#[case("zsh")]
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
index e087a7333..eee635299 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
@@ -63,6 +63,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap
index 73ba97e46..a9121bd7d 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_claude_available_plugin_not_installed.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
↳ Plugin not installed. To install, run:
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
index ca9051406..2c82c95ac 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
@@ -66,6 +66,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
index dbd931e70..d158a3d70 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
@@ -69,6 +69,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap
index 62a6a7796..633da6c4a 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_empty_project_config.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
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 213bf50ff..7be9a6d06 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
@@ -52,6 +52,7 @@ exit_code: 0
↳ To update, run wt config shell install fish
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
↳ To configure, run wt config shell install
▲ Found wt in ~/.config/fish/functions/wt.fish:2 but not detected as integration:
  function wt
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_with_completions.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_with_completions.snap
index 0dd0a6ded..9443dca04 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_fish_with_completions.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_fish_with_completions.snap
@@ -54,6 +54,7 @@ exit_code: 0
↳ To verify wrapper loaded: type wt
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
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 0339e9530..bc7c4176a 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
@@ -54,6 +54,7 @@ exit_code: 0
↳ To verify wrapper loaded: type wt
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
↳ To configure, run wt config shell install
CLAUDE CODE
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
index f754bc223..cb30a22cb 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_from_linked_worktree_shows_main_worktree_hint.snap
@@ -54,6 +54,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap
index 11746a76b..4accd8b4a 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap
@@ -56,6 +56,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap
index b4f8615ac..6de5b5466 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap
@@ -53,6 +53,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap
index 15abdada2..9d403a885 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap
@@ -53,6 +53,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap
index 17c558ae7..b3531921b 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap
@@ -53,6 +53,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap
index 6691ebf4f..926a046db 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_github_remote.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap
index 6691ebf4f..926a046db 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_gitlab_remote.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap
index 545c43988..0ca295042 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_project_toml.snap
@@ -57,6 +57,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap
index 0290253c3..f2843c58c 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_invalid_user_toml.snap
@@ -57,6 +57,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap
index 6691ebf4f..926a046db 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_no_project_config.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap
index 35a877f28..20663db61 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_no_user_config.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap
index 6d2b0c4fa..e6a618257 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_outside_git_repo.snap
@@ -45,6 +45,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap
index d24c74509..9c4412126 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_partial_shell_config_shows_hint.snap
@@ -54,6 +54,7 @@ exit_code: 0
  if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)"; fi
↳ To verify wrapper loaded: type wt
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
↳ To configure, run wt config shell install
CLAUDE CODE
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap
index 184cf4d49..736f51032 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_plugin_installed.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
✓ Plugin installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_powershell_detected_via_psmodulepath.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_powershell_detected_via_psmodulepath.snap
index 0c24b5d57..1c1896c7f 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_powershell_detected_via_psmodulepath.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_powershell_detected_via_psmodulepath.snap
@@ -54,6 +54,7 @@ exit_code: 0
↳ To verify wrapper loaded: type wt
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap
index 1914490fb..549df3aaf 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_shell_integration_active.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap
index 3d55e23ac..bec05ca54 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_statusline_configured.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
✓ Plugin installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
index e2e780330..b13d9c8a3 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
@@ -55,6 +55,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
index d654f9697..f5344eb4c 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
@@ -68,6 +68,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap
index c3569ecaa..3620ddb4e 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_unmatched_candidate_warning.snap
@@ -52,6 +52,7 @@ exit_code: 0
↳ bash: Not configured shell extension & completions
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
↳ To configure, run wt config shell install
▲ Found wt in ~/.bashrc:3 but not detected as integration:
  alias wt="git worktree"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap
index 7365167bd..a0df0fb65 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_project_keys.snap
@@ -53,6 +53,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap
index 224dc21e1..7a973ec63 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_warns_unknown_user_keys.snap
@@ -55,6 +55,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap
index 62a6a7796..633da6c4a 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_whitespace_only_project_config.snap
@@ -51,6 +51,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
index fa6527ab0..1e9c02871 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
@@ -57,6 +57,7 @@ exit_code: 0
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap
index 9a9c2108a..f37c5c6ff 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_zsh_compinit_correct_order.snap
@@ -54,6 +54,7 @@ exit_code: 0
↳ To verify wrapper loaded: type wt
○ bash: Skipped; ~/.bashrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
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 0ada07f28..6d9920644 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
@@ -56,6 +56,7 @@ exit_code: 0
↳ To verify wrapper loaded: type wt
○ bash: Skipped; ~/.bashrc not found
○ fish: Skipped; ~/.config/fish/functions not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
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 0d28d25d6..bef5ca998 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
@@ -53,6 +53,7 @@ exit_code: 0
○ zsh: Skipped; ~/.zshrc not found
○ 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
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
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 35a98017e..753dd9a31 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
@@ -53,6 +53,7 @@ exit_code: 0
↳ To migrate to ~/.config/fish/functions/wt.fish, run wt config shell install fish
○ bash: Skipped; ~/.bashrc not found
○ zsh: Skipped; ~/.zshrc not found
+○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
○ claude CLI not installed
diff --git a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
index ced466a2c..050bfc715 100644
--- a/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
+++ b/tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap
@@ -7,6 +7,7 @@ expression: "output.trim_start_matches('\\n')"
✓ Added shell extension & completions for zsh @ ~/.zshrc
↳ Skipped bash; ~/.bashrc not found
↳ Skipped fish; ~/.config/fish/functions not found
+↳ Skipped nu; ~/.config/nushell/vendor/autoload not found
✓ Configured 1 shell
▲ Completions require compinit; add to ~/.zshrc before the wt line:
autoload -Uz compinit && compinit
diff --git a/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_accept.snap b/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_accept.snap
index 6d50125ef..43ddb2fbd 100644
--- a/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_accept.snap
+++ b/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_accept.snap
@@ -12,6 +12,7 @@ y
✓ Added shell extension & completions for bash @ ~/.bashrc
↳ Skipped zsh; ~/.zshrc not found
↳ Skipped fish; ~/.config/fish/functions not found
+↳ Skipped nu; ~/.config/nushell/vendor/autoload not found
✓ Configured 1 shell
↳ Restart shell to activate shell integration