Skip to content

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

fix(shell): use installation status for activation advice (#4343)

Maximilian Roos160071dcd462
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index f870faa1d..26ef2eec1 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -1192,7 +1192,7 @@ fn render_fish_completion_status(out: &mut String, cmd: &str) -> anyhow::Result<
};
let completion_display = format_path_for_display(&completion_path);
let shell = Shell::Fish;
- if completion_path.exists() {
+ if completion_path.is_file() {
writeln!(
out,
"{}",
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index 50e5836c8..a6ef295ca 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -360,6 +360,7 @@ pub fn handle_configure_shell(
// First, do a dry-run to see what would be changed
let mut preview = scan_shell_configs(shell_filter, true, &cmd)?;
+ preview.completion_results = preview_shell_completions(&preview.configured, &cmd)?;
// If nothing to do, return early
if preview.configured.is_empty() {
@@ -512,6 +513,8 @@ fn should_auto_configure_powershell() -> bool {
}
}
+/// Read or apply shell integration files. Completion planning belongs to the
+/// installation flow so a completion error cannot hide integration status.
pub fn scan_shell_configs(
shell_filter: Option<Shell>,
dry_run: bool,
@@ -623,16 +626,9 @@ pub fn scan_shell_configs(
}
}
- let completion_results = if dry_run {
- let configured_shells: Vec<_> = results.iter().map(|result| result.shell).collect();
- preview_shell_completions(&configured_shells, cmd)?
- } else {
- Vec::new()
- };
-
Ok(ScanResult {
configured: results,
- completion_results,
+ completion_results: Vec::new(),
skipped,
zsh_needs_compinit: false, // Caller handles compinit detection
legacy_cleanups: Vec::new(), // Caller handles legacy cleanup
@@ -1150,11 +1146,15 @@ complete --keep-order --exclusive --command {cmd} --arguments "(test -n \"\$WORK
/// Note: Bash and Zsh use inline lazy completions in the init script.
/// Fish uses a separate completion file at ~/.config/fish/completions/{cmd}.fish
/// that finds the command in PATH (with WORKTRUNK_BIN as optional override) to bypass the shell wrapper.
-fn preview_shell_completions(shells: &[Shell], cmd: &str) -> Result<Vec<CompletionResult>, String> {
+pub(crate) fn preview_shell_completions(
+ configured: &[ConfigureResult],
+ cmd: &str,
+) -> Result<Vec<CompletionResult>, String> {
let mut results = Vec::new();
let fish_completion = fish_completion_content(cmd);
- for &shell in shells {
+ for entry in configured {
+ let shell = entry.shell;
// Only fish has a separate completion file
if shell != Shell::Fish {
continue;
diff --git a/src/invocation.rs b/src/invocation.rs
index f1a8df6b0..6f84b4724 100644
--- a/src/invocation.rs
+++ b/src/invocation.rs
@@ -101,8 +101,8 @@ fn normalize_invocation_path(arg0: &std::ffi::OsStr) -> String {
/// - **`git wt` subcommand**: When invoked as `git wt`, git dispatches to `git-wt` binary
/// and sets argv\[0\] = `git-wt` (no path separator) → returns `false`. However, shell
/// integration configured for `wt` won't intercept `git wt` — they're different commands.
-/// This is handled separately by `Shell::is_shell_configured()` which checks for the
-/// actual binary name (`git-wt`), not `wt`.
+/// The shell installation scan checks for the actual binary name (`git-wt`),
+/// not `wt`.
///
/// # Why Not Other Approaches?
///
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 66ff71386..e2b561a9e 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -42,7 +42,7 @@ use worktrunk::styling::{
use super::shell_integration::{
compute_shell_warning_reason, explicit_path_hint, git_subcommand_warning,
- print_shell_integration_hint, should_show_explicit_path_hint,
+ print_shell_activation_hint, should_show_explicit_path_hint,
};
// ============================================================================
@@ -1018,7 +1018,7 @@ fn print_switch_message_if_changed(
} else if should_show_explicit_path_hint() {
eprintln!("{}", hint_message(explicit_path_hint(&dest_branch)));
} else {
- print_shell_integration_hint(&repo);
+ print_shell_activation_hint(&repo);
}
}
Ok(())
diff --git a/src/output/shell_integration.rs b/src/output/shell_integration.rs
index 19a85f343..a7d1664c1 100644
--- a/src/output/shell_integration.rs
+++ b/src/output/shell_integration.rs
@@ -41,7 +41,8 @@
//! | Outdated wrapper | `Worktree for main @ path, but cannot change directory — shell wrapper is out of date` | `To update the shell wrapper, run wt config shell install` |
//! | Git subcommand | `Worktree for main @ path, but cannot change directory — ran git wt; running through git prevents cd` | `For automatic cd, invoke directly (with the -): git-wt` |
//! | Explicit path | `Worktree for main @ path, but cannot change directory — ran ./wt; shell integration wraps wt` | `To change directory, run wt switch main` |
-//! | Other | `Worktree for main @ path, but cannot change directory — {reason}` | `To enable automatic cd, run wt config shell install` |
+//! | Installed, not active | `Worktree for main @ path, but cannot change directory — shell integration installed but not active` | `A shell restart usually activates shell integration; if it doesn't, ask an agent to debug with the docs @ https://worktrunk.dev/llms.txt` |
+//! | Not installed | `Worktree for main @ path, but cannot change directory — shell integration not installed` | `To enable automatic cd, run wt config shell install` |
//!
//! ## Prompt Decision Flow
//!
@@ -64,8 +65,8 @@
//! | Reason | Meaning |
//! |--------|---------|
//! | `shell wrapper is out of date` | Only the retired single-file directive env var is set |
-//! | `shell integration not installed` | Shell config doesn't have the `eval` line |
-//! | `shell integration installed but not active` | Shell config has `eval` line but wrapper not active |
+//! | `shell integration not installed` | Current shell has no current initialization line or wrapper |
+//! | `shell integration installed but not active` | Current initialization line or wrapper is installed but inactive |
//! | `ran X; shell integration wraps Y` | Invoked with explicit path (e.g., `./target/debug/wt`) |
//!
//! Note: The git subcommand case (`ran git wt; ...`) is handled separately via [`crate::is_git_subcommand`].
@@ -83,7 +84,7 @@ use worktrunk::styling::{
use crate::commands::configure_shell::{
ConfigAction, UninstallScanResult, apply_confirmed_shell_config, collect_legacy_cleanups,
- format_matched_lines, prompt_for_install, scan_shell_configs,
+ format_matched_lines, preview_shell_completions, prompt_for_install, scan_shell_configs,
};
/// Git config key tracking how many times the shell-integration install hint
@@ -162,10 +163,30 @@ pub(crate) fn explicit_path_hint(branch: &str) -> String {
/// Check if we should show the explicit path hint.
/// True when: explicit path invocation AND current shell has integration configured.
pub(crate) fn should_show_explicit_path_hint() -> bool {
- crate::was_invoked_with_explicit_path()
- && current_shell()
- .and_then(|shell| shell.is_shell_configured(&crate::binary_name()).ok())
- .unwrap_or(false)
+ crate::was_invoked_with_explicit_path() && current_shell_is_configured()
+}
+
+/// Whether integration is installed for the shell running this invocation,
+/// using the installer’s read-only comparison for both rc lines and wrapper files.
+/// Legacy or outdated wrappers need installation rather than a restart.
+fn current_shell_is_configured() -> bool {
+ current_shell()
+ .and_then(|shell| scan_shell_configs(Some(shell), true, &crate::binary_name()).ok())
+ .is_some_and(|scan| {
+ scan.configured
+ .iter()
+ .any(|result| matches!(result.action, ConfigAction::AlreadyExists))
+ })
+}
+
+/// Merge and remove report after changing worktrees, without prompting to
+/// install. Match their advice to the current shell's installation state.
+pub(crate) fn print_shell_activation_hint(repo: &Repository) {
+ if current_shell_is_configured() {
+ eprintln!("{}", hint_message(shell_inactive_hint()));
+ } else {
+ print_shell_integration_hint(repo);
+ }
}
/// Compute the shell warning reason for display in messages.
@@ -183,9 +204,7 @@ pub(crate) fn compute_shell_warning_reason() -> String {
}
// Check if the CURRENT shell has integration configured, not just ANY shell
- let is_configured = current_shell()
- .and_then(|shell| shell.is_shell_configured(&crate::binary_name()).ok())
- .unwrap_or(false);
+ let is_configured = current_shell_is_configured();
let explicit_path = crate::was_invoked_with_explicit_path();
let invoked = crate::invocation_path();
let wraps = crate::binary_name();
@@ -460,9 +479,19 @@ pub fn prompt_shell_integration(
return Ok(false);
};
+ if current_shell_is_configured() {
+ // Shell integration is configured but not active for this invocation
+ if !crate::was_invoked_with_explicit_path() {
+ // Invoked via PATH but wrapper isn't active — a restart usually fixes it
+ eprintln!("{}", hint_message(shell_inactive_hint()));
+ }
+ // For explicit paths: no hint needed - handle_switch_output() warning already explains
+ return Ok(false);
+ }
+
// Scan ALL shells (same as `wt config shell install`)
// Only includes shells where config files already exist
- let scan = scan_shell_configs(None, true, binary_name)
+ let mut scan = scan_shell_configs(None, true, binary_name)
.map_err(|e| anyhow::anyhow!("Failed to scan shell configs: {e}"))?;
// No config files exist - show install hint
@@ -471,29 +500,15 @@ pub fn prompt_shell_integration(
return Ok(false);
}
- // Check if current shell is already configured (user just needs to restart)
- let current_shell_installed = scan
- .configured
- .iter()
- .filter(|r| Some(r.shell) == current_shell())
- .any(|r| matches!(r.action, ConfigAction::AlreadyExists));
-
- if current_shell_installed {
- // Shell integration is configured but not active for this invocation
- if !crate::was_invoked_with_explicit_path() {
- // Invoked via PATH but wrapper isn't active — a restart usually fixes it
- eprintln!("{}", hint_message(shell_inactive_hint()));
- }
- // For explicit paths: no hint needed - handle_switch_output() warning already explains
- return Ok(false);
- }
-
// Can't or shouldn't prompt - show install hint
if config.skip_shell_integration_prompt || !is_tty || skip_prompt {
print_shell_integration_hint(repo);
return Ok(false);
}
+ scan.completion_results = preview_shell_completions(&scan.configured, binary_name)
+ .map_err(|e| anyhow::anyhow!("Failed to preview shell completions: {e}"))?;
+
// TTY + first time: Show interactive prompt
// Accepting installs for all shells with config files (same as `wt config shell install`)
// Detect (without removing) the legacy files the confirmed plan will delete,
diff --git a/src/shell/detection.rs b/src/shell/detection.rs
index 0a7b383a0..7fe10ad64 100644
--- a/src/shell/detection.rs
+++ b/src/shell/detection.rs
@@ -65,16 +65,14 @@ use super::paths::{home_dir_required, powershell_profile_paths, zsh_config_dir};
/// # Usage
///
/// Used by:
-/// - `Shell::is_shell_configured()` - detect the "configured but not restarted"
-/// state behind the shell-integration warnings
/// - `wt config show` - render the matched integration line, and report a line
/// that names the command but did not match as a possible false negative
/// - `contains_shell_integration` - the install scan's idempotency check, which
/// decides whether an rc file already carries this shell's line. It runs
-/// under `scan_shell_configs`, so three commands read it: `wt config shell
+/// under the installation scanner, so these consumers read it: `wt config shell
/// install` skips the append when it answers yes, and `wt config show`'s
-/// per-shell rows and `wt switch`'s first-run integration offer read the same
-/// answer without writing
+/// per-shell rows, shell-integration warnings, and the first-run integration
+/// offer read the same answer without writing
///
/// Not by uninstall, which reads
/// [`is_shell_integration_line_for_uninstall_any_cmd`] instead: it asks only
@@ -83,7 +81,7 @@ use super::paths::{home_dir_required, powershell_profile_paths, zsh_config_dir};
/// # Impact of False Negatives
///
/// The messaging cases are benign, but they are not all gated the same way.
-/// `Shell::is_shell_configured()`'s callers ask only when shell integration is
+/// The shell-integration warnings ask only when shell integration is
/// NOT active (i.e., user ran the binary directly without the shell wrapper);
/// once the wrapper is active, `WORKTRUNK_DIRECTIVE_CD_FILE` is set and they
/// stop asking.
diff --git a/src/shell/mod.rs b/src/shell/mod.rs
index c8dc9e72c..efc2aa039 100644
--- a/src/shell/mod.rs
+++ b/src/shell/mod.rs
@@ -9,8 +9,6 @@ mod detection;
mod paths;
mod utils;
-use std::io::{BufRead, BufReader};
-
use askama::Template;
// Re-export public types and functions
@@ -206,44 +204,6 @@ impl Shell {
}
}
}
-
- /// Check if this shell has integration configured.
- ///
- /// Used for accurate warning messages that need to know about the user's
- /// current shell specifically (e.g., "installed but not active" vs "not
- /// installed").
- pub fn is_shell_configured(&self, cmd: &str) -> Result<bool, std::io::Error> {
- let config_paths = self.config_paths(cmd)?;
-
- // For fish, also check legacy conf.d location
- let mut paths_to_check = config_paths;
- if matches!(self, Shell::Fish)
- && let Ok(legacy) = Shell::legacy_fish_conf_d_path(cmd)
- {
- paths_to_check.push(legacy);
- }
-
- for path in paths_to_check {
- if !path.exists() {
- continue;
- }
- if Self::file_has_integration(&path, cmd)? {
- return Ok(true);
- }
- }
- Ok(false)
- }
-
- /// Check if a file contains shell integration lines for the given command.
- fn file_has_integration(path: &std::path::Path, cmd: &str) -> Result<bool, std::io::Error> {
- let file = std::fs::File::open(path)?;
- for line in BufReader::new(file).lines() {
- if is_shell_integration_line(&line?, cmd) {
- return Ok(true);
- }
- }
- Ok(false)
- }
}
/// Shell integration configuration
@@ -666,35 +626,6 @@ mod tests {
);
}
- #[test]
- fn test_file_has_integration() {
- use std::io::Write;
-
- let temp_dir = tempfile::tempdir().unwrap();
- let bashrc = temp_dir.path().join(".bashrc");
-
- // Write a valid integration line
- let mut file = std::fs::File::create(&bashrc).unwrap();
- writeln!(
- file,
- r#"if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init bash)"; fi"#
- )
- .unwrap();
-
- // Test file_has_integration directly
- assert!(Shell::file_has_integration(&bashrc, "wt").unwrap());
- assert!(!Shell::file_has_integration(&bashrc, "git-wt").unwrap());
-
- // Test with non-matching content
- let empty_file = temp_dir.path().join(".zshrc");
- std::fs::write(&empty_file, "# just a comment\n").unwrap();
- assert!(!Shell::file_has_integration(&empty_file, "wt").unwrap());
- }
-
- // Note: is_shell_configured() is not unit-tested because it requires
- // mutating HOME env var (unsafe). It's tested indirectly via integration
- // tests that exercise the shell integration warning paths.
-
// PowerShell config_line evaluation test is in tests/integration_tests/shell_powershell.rs
// because it needs CARGO_BIN_EXE_wt which is only available in integration tests.
}
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index 2ad9b43a2..11e198f83 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -957,7 +957,13 @@ fn test_config_show_fish_with_completions(mut repo: TestRepo, temp_home: TempDir
/// Test that config show displays fish shell without completions configured
#[rstest]
-fn test_config_show_fish_without_completions(mut repo: TestRepo, temp_home: TempDir) {
+#[case(false)]
+#[case(true)]
+fn test_config_show_fish_without_completions(
+ mut repo: TestRepo,
+ temp_home: TempDir,
+ #[case] completion_directory: bool,
+) {
// Setup mock gh/glab for deterministic BINARIES output
repo.setup_mock_ci_tools_unauthenticated();
@@ -976,7 +982,11 @@ fn test_config_show_fish_without_completions(mut repo: TestRepo, temp_home: Temp
let wrapper_content = init.generate_fish_wrapper().unwrap();
fs::write(&fish_config, format!("{}\n", wrapper_content)).unwrap();
- // Do NOT create fish completions file - completions not configured
+ // A missing completion file and a directory at its path must both leave
+ // the installed wrapper visible, with completions not configured.
+ if completion_directory {
+ fs::create_dir_all(temp_home.path().join(".config/fish/completions/wt.fish")).unwrap();
+ }
let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
settings.bind(|| {
@@ -985,7 +995,7 @@ fn test_config_show_fish_without_completions(mut repo: TestRepo, temp_home: Temp
set_temp_home_env(&mut cmd, temp_home.path());
set_xdg_config_path(&mut cmd, temp_home.path());
- assert_cmd_snapshot!(cmd);
+ assert_cmd_snapshot!("config_show_fish_without_completions", cmd);
});
}
diff --git a/tests/integration_tests/remove.rs b/tests/integration_tests/remove.rs
index adb15ae74..5ca76b349 100644
--- a/tests/integration_tests/remove.rs
+++ b/tests/integration_tests/remove.rs
@@ -1,3 +1,5 @@
+#[cfg(unix)]
+use crate::common::temp_home;
use crate::common::{
BareRepoTest, SLEEP_FOR_ABSENCE_CHECK, TestRepo, TestRepoBase, configure_directive_file,
directive_file, make_snapshot_cmd, repo, repo_with_remote, setup_snapshot_settings,
@@ -24,6 +26,104 @@ fn test_remove_from_worktree(mut repo: TestRepo) {
));
}
+/// Merge and remove must advise activating the current shell's installed
+/// integration, not reinstalling it or restarting a different login shell.
+#[cfg(unix)]
+#[rstest]
+#[case("remove", "zsh", "remove_installed_shell_inactive")]
+#[case("merge", "zsh", "merge_installed_shell_inactive")]
+#[case("remove", "fish", "remove_current_shell_not_installed")]
+#[case("merge", "fish", "merge_current_shell_not_installed")]
+fn test_removal_shell_activation_advice(
+ mut repo: TestRepo,
+ #[case] command: &str,
+ #[case] current_shell: &str,
+ #[case] snapshot: &str,
+) {
+ use std::os::unix::process::CommandExt;
+
+ repo.configure_shell_integration(); // Installs zsh integration only.
+ let worktree_path = repo.add_worktree("feature");
+ let settings = setup_snapshot_settings(&repo);
+ settings.bind(|| {
+ let args = if command == "remove" {
+ ["--foreground", "--yes"]
+ } else {
+ ["--yes", "--no-squash"]
+ };
+ let mut cmd = make_snapshot_cmd(&repo, command, &args, Some(&worktree_path));
+ cmd.arg0("wt"); // Invoke through PATH, without the wrapper's cd directive.
+ cmd.env("SHELL", "/bin/zsh");
+ cmd.env("WORKTRUNK_TEST_PARENT_SHELL", current_shell);
+ assert_cmd_snapshot!(snapshot, cmd);
+ });
+}
+
+/// Installation advice must use the installer's wrapper-aware state: a
+/// legacy fish wrapper needs migration, while current fish/Nushell wrappers
+/// need activation. Exercise the real installer and removal output together.
+#[cfg(unix)]
+#[rstest]
+#[case("fish", true, "remove", "remove_legacy_fish_needs_install")]
+#[case("fish", false, "remove", "remove_current_fish_needs_activation")]
+#[case("nu", false, "remove", "remove_current_nushell_needs_activation")]
+#[case("fish", false, "switch", "switch_current_fish_needs_activation")]
+fn test_removal_wrapper_installation_advice(
+ mut repo: TestRepo,
+ temp_home: tempfile::TempDir,
+ #[case] shell: &str,
+ #[case] legacy: bool,
+ #[case] command: &str,
+ #[case] snapshot: &str,
+) {
+ use crate::common::{set_temp_home_env, setup_snapshot_settings_with_home};
+ use std::os::unix::process::CommandExt;
+
+ let home = crate::common::canonical_temp_home(&temp_home);
+ let autoload = home.join(".local/share/nushell/vendor/autoload");
+ if legacy {
+ let path = home.join(".config/fish/conf.d/wt.fish");
+ fs::create_dir_all(path.parent().unwrap()).unwrap();
+ fs::write(path, worktrunk::shell::Shell::Fish.config_line("wt")).unwrap();
+ } else {
+ let mut install = repo.wt_command();
+ set_temp_home_env(&mut install, &home);
+ install.env("WORKTRUNK_TEST_NU_VENDOR_AUTOLOAD_DIR", &autoload);
+ let output = install
+ .args(["config", "shell", "install", shell, "--yes"])
+ .output()
+ .unwrap();
+ assert!(
+ output.status.success(),
+ "{}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ }
+ // Completion availability must not determine whether the shell wrapper
+ // is installed. A directory at the completion-file path is unreadable as
+ // a file, while the installed fish wrapper remains valid.
+ if shell == "fish" && !legacy {
+ let completion = home.join(".config/fish/completions/wt.fish");
+ fs::remove_file(&completion).unwrap();
+ fs::create_dir(&completion).unwrap();
+ }
+ let worktree = repo.add_worktree("feature");
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let args: &[&str] = if command == "remove" {
+ &["--foreground", "--yes"]
+ } else {
+ &["main"]
+ };
+ let mut cmd = make_snapshot_cmd(&repo, command, args, Some(&worktree));
+ set_temp_home_env(&mut cmd, &home);
+ cmd.env("WORKTRUNK_TEST_NU_VENDOR_AUTOLOAD_DIR", &autoload);
+ cmd.env("WORKTRUNK_TEST_PARENT_SHELL", shell);
+ cmd.arg0("wt");
+ assert_cmd_snapshot!(snapshot, cmd);
+ });
+}
+
// `--reap` (experimental) with no processes running under the worktree: the
// reap phase reports it found nothing, then removal proceeds normally. A fresh
// worktree has no processes with a cwd under it, so this is deterministic
diff --git a/tests/integration_tests/shell_integration_prompt.rs b/tests/integration_tests/shell_integration_prompt.rs
index 8a94cbfe2..5d10acef3 100644
--- a/tests/integration_tests/shell_integration_prompt.rs
+++ b/tests/integration_tests/shell_integration_prompt.rs
@@ -491,7 +491,12 @@ mod pty_tests {
}
#[rstest]
- fn test_first_run_preserves_completion_created_after_preview(repo: TestRepo) {
+ #[case(false)]
+ #[case(true)]
+ fn test_first_run_completion_preview_controls_write(
+ repo: TestRepo,
+ #[case] created_after_preview: bool,
+ ) {
let temp_home = TempDir::new().unwrap();
fs::write(temp_home.path().join(".bashrc"), "# empty bashrc\n").unwrap();
fs::create_dir_all(temp_home.path().join(".config/fish/functions")).unwrap();
@@ -510,12 +515,21 @@ mod pty_tests {
let user_content = b"# user completion\r\n";
let (output, exit_code) = exec_cmd_in_pty_prompted_with(cmd, &["y\n"], "[y/N", move |_| {
- fs::create_dir_all(callback_path.parent().unwrap()).unwrap();
- fs::write(&callback_path, user_content).unwrap();
+ if created_after_preview {
+ fs::create_dir_all(callback_path.parent().unwrap()).unwrap();
+ fs::write(&callback_path, user_content).unwrap();
+ }
});
assert_eq!(exit_code, 0, "switch should still succeed:\n{output}");
- assert_eq!(fs::read(completion).unwrap(), user_content);
+ if created_after_preview {
+ assert_eq!(fs::read(completion).unwrap(), user_content);
+ } else {
+ assert!(
+ completion.is_file(),
+ "the accepted offer must install fish completions"
+ );
+ }
}
/// Test: User requests preview with ? then declines
diff --git a/tests/snapshots/integration__integration_tests__remove__merge_current_shell_not_installed.snap b/tests/snapshots/integration__integration_tests__remove__merge_current_shell_not_installed.snap
new file mode 100644
index 000000000..3aa4e2458
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__merge_current_shell_not_installed.snap
@@ -0,0 +1,67 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - merge
+ - "--yes"
+ - "--no-squash"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ SHELL: /bin/zsh
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: fish
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+○ Already up to date with main (no new commits, no rebase needed)
+◎ Removing feature worktree & branch in background (same commit as main, _)
+▲ Worktree for main @ _REPO_, but cannot change directory — shell integration not installed
+↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__remove__merge_installed_shell_inactive.snap b/tests/snapshots/integration__integration_tests__remove__merge_installed_shell_inactive.snap
new file mode 100644
index 000000000..8a392eac3
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__merge_installed_shell_inactive.snap
@@ -0,0 +1,67 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - merge
+ - "--yes"
+ - "--no-squash"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ SHELL: /bin/zsh
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: zsh
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+○ Already up to date with main (no new commits, no rebase needed)
+◎ Removing feature worktree & branch in background (same commit as main, _)
+▲ Worktree for main @ _REPO_, but cannot change directory — shell integration installed but not active
+↳ A shell restart usually activates shell integration; if it doesn't, ask an agent to debug with the docs @ https://worktrunk.dev/llms.txt
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_current_fish_needs_activation.snap b/tests/snapshots/integration__integration_tests__remove__remove_current_fish_needs_activation.snap
new file mode 100644
index 000000000..d31e9038d
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_current_fish_needs_activation.snap
@@ -0,0 +1,67 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--foreground"
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_NU_VENDOR_AUTOLOAD_DIR: "[TEST_NU_VENDOR_AUTOLOAD]"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: fish
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature worktree...
+✓ Removed feature worktree & branch (same commit as main, _) (3 files · [BYTES] B)
+▲ Worktree for main @ _REPO_, but cannot change directory — shell integration installed but not active
+↳ A shell restart usually activates shell integration; if it doesn't, ask an agent to debug with the docs @ https://worktrunk.dev/llms.txt
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_current_nushell_needs_activation.snap b/tests/snapshots/integration__integration_tests__remove__remove_current_nushell_needs_activation.snap
new file mode 100644
index 000000000..92ce6500b
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_current_nushell_needs_activation.snap
@@ -0,0 +1,67 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--foreground"
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_NU_VENDOR_AUTOLOAD_DIR: "[TEST_NU_VENDOR_AUTOLOAD]"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: nu
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature worktree...
+✓ Removed feature worktree & branch (same commit as main, _) (3 files · [BYTES] B)
+▲ Worktree for main @ _REPO_, but cannot change directory — shell integration installed but not active
+↳ A shell restart usually activates shell integration; if it doesn't, ask an agent to debug with the docs @ https://worktrunk.dev/llms.txt
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_current_shell_not_installed.snap b/tests/snapshots/integration__integration_tests__remove__remove_current_shell_not_installed.snap
new file mode 100644
index 000000000..15ecef87a
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_current_shell_not_installed.snap
@@ -0,0 +1,67 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--foreground"
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ SHELL: /bin/zsh
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: fish
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature worktree...
+✓ Removed feature worktree & branch (same commit as main, _) (3 files · [BYTES] B)
+▲ Worktree for main @ _REPO_, but cannot change directory — shell integration not installed
+↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_installed_shell_inactive.snap b/tests/snapshots/integration__integration_tests__remove__remove_installed_shell_inactive.snap
new file mode 100644
index 000000000..1ecf70158
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_installed_shell_inactive.snap
@@ -0,0 +1,67 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--foreground"
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ SHELL: /bin/zsh
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: zsh
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature worktree...
+✓ Removed feature worktree & branch (same commit as main, _) (3 files · [BYTES] B)
+▲ Worktree for main @ _REPO_, but cannot change directory — shell integration installed but not active
+↳ A shell restart usually activates shell integration; if it doesn't, ask an agent to debug with the docs @ https://worktrunk.dev/llms.txt
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_legacy_fish_needs_install.snap b/tests/snapshots/integration__integration_tests__remove__remove_legacy_fish_needs_install.snap
new file mode 100644
index 000000000..6fbcbe112
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_legacy_fish_needs_install.snap
@@ -0,0 +1,67 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--foreground"
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_NU_VENDOR_AUTOLOAD_DIR: "[TEST_NU_VENDOR_AUTOLOAD]"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: fish
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature worktree...
+✓ Removed feature worktree & branch (same commit as main, _) (3 files · [BYTES] B)
+▲ Worktree for main @ _REPO_, but cannot change directory — shell integration not installed
+↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__remove__switch_current_fish_needs_activation.snap b/tests/snapshots/integration__integration_tests__remove__switch_current_fish_needs_activation.snap
new file mode 100644
index 000000000..75cee6a7b
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__switch_current_fish_needs_activation.snap
@@ -0,0 +1,64 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - switch
+ - main
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLAUDE_CONFIG_DIR: "[TEST_CLAUDE_CONFIG]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_ALLOW_PROTOCOL: file
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_AUTHOR_EMAIL: [email protected]
+ GIT_AUTHOR_NAME: Test User
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_EMAIL: [email protected]
+ GIT_COMMITTER_NAME: Test User
+ GIT_CONFIG_COUNT: "2"
+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig
+ GIT_CONFIG_KEY_0: user.useConfigOnly
+ GIT_CONFIG_KEY_1: rerere.enabled
+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig
+ GIT_CONFIG_VALUE_0: "true"
+ GIT_CONFIG_VALUE_1: "false"
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"
+ WORKTRUNK_TEST_MOCK_CONFIG_DIR: "[TEST_MOCK_CONFIG]"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_NU_VENDOR_AUTOLOAD_DIR: "[TEST_NU_VENDOR_AUTOLOAD]"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: fish
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+▲ Worktree for main @ _REPO_, but cannot change directory — shell integration installed but not active
+↳ A shell restart usually activates shell integration; if it doesn't, ask an agent to debug with the docs @ https://worktrunk.dev/llms.txt