Skip to content

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

Make switch diagnostics describe the requested operation (#4349)

Maximilian Roosbecca5f18153
diff --git a/src/commands/picker/mod.rs b/src/commands/picker/mod.rs
index f9dfd8a49..b28f5b683 100644
--- a/src/commands/picker/mod.rs
+++ b/src/commands/picker/mod.rs
@@ -1653,7 +1653,7 @@ pub fn handle_picker(
let is_preview_bench = std::env::var_os("WORKTRUNK_PREVIEW_BENCH").is_some();
let skip_tui = is_dry_run || is_preview_bench;
if !skip_tui && !std::io::stdin().is_terminal() {
- anyhow::bail!("Interactive picker requires an interactive terminal");
+ return Err(worktrunk::git::GitError::InteractivePickerRequiresTerminal.into());
}
worktrunk::trace::instant("Picker started");
diff --git a/src/commands/worktree/switch.rs b/src/commands/worktree/switch.rs
index 6d9d101f4..f4930df8b 100644
--- a/src/commands/worktree/switch.rs
+++ b/src/commands/worktree/switch.rs
@@ -654,6 +654,7 @@ fn resolve_switch_target(
if !repo.ref_exists(&resolved)? {
return Err(GitError::ReferenceNotFound {
reference: resolved,
+ flag: Some("--base"),
}
.into());
}
@@ -666,6 +667,7 @@ fn resolve_switch_target(
// Validate --create constraints
if create {
let branch_handle = repo.branch(&resolved_branch);
+ branch_handle.require_valid_name()?;
if branch_handle.exists_locally()? {
return Err(GitError::BranchAlreadyExists {
branch: resolved_branch,
@@ -750,12 +752,15 @@ fn validate_worktree_creation(
} = method
&& !repo.branch(branch).exists()?
{
+ if !worktrunk::git::is_valid_branch_name(branch) {
+ return Err(GitError::WorktreeSelectorNotFound {
+ selector: branch.to_string(),
+ }
+ .into());
+ }
return Err(GitError::BranchNotFound {
branch: branch.to_string(),
- // Offering `--create` for a name git rejects sends the user to a
- // command that fails; the argument was a path spelling, whether or
- // not a directory happens to sit at it.
- show_create_hint: worktrunk::git::is_valid_branch_name(branch),
+ show_create_hint: true,
last_fetch_ago: format_last_fetch_ago(repo),
pr_mr_platform: repo.detect_ref_type(),
}
diff --git a/src/git/error.rs b/src/git/error.rs
index 3d7b2302a..3473bde8c 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -458,9 +458,15 @@ pub enum GitError {
/// suggesting both `pr:N` and `mr:N`.
pr_mr_platform: Option<RefType>,
},
- /// Reference (branch, tag, commit) not found - used when any commit-ish is accepted
+ /// A requested new branch name rejected by Git.
+ InvalidBranchName {
+ name: String,
+ },
+ /// Reference not found where any commit-ish is accepted.
ReferenceNotFound {
reference: String,
+ /// The argument that supplied the reference, when it was an option.
+ flag: Option<&'static str>,
},
/// Persisted `worktrunk.default-branch` points at a branch that no longer
/// resolves locally. Surfaced when a command would use the default branch
@@ -479,6 +485,7 @@ pub enum GitError {
},
// Worktree errors
+ InteractivePickerRequiresTerminal,
NotInWorktree {
/// The action that requires being in a worktree
action: Option<String>,
@@ -815,8 +822,14 @@ impl GitError {
cformat!("No branch named <bold>{branch}</>")
}
- GitError::ReferenceNotFound { reference } => {
- cformat!("No branch, tag, or commit named <bold>{reference}</>")
+ GitError::InvalidBranchName { name } => {
+ cformat!("Invalid branch name <bold>{name}</>")
+ }
+ GitError::ReferenceNotFound { reference, flag } => {
+ let context = flag
+ .map(|flag| cformat!(" (<bold>{flag}</>)"))
+ .unwrap_or_default();
+ cformat!("No branch, tag, or commit named <bold>{reference}</>{context}")
}
GitError::StaleDefaultBranch { branch } => {
@@ -827,6 +840,9 @@ impl GitError {
cformat!("Default branch <bold>{branch}</> has no commits yet")
}
+ GitError::InteractivePickerRequiresTerminal => {
+ "Interactive picker requires an interactive terminal".to_string()
+ }
GitError::NotInWorktree { action } => match action {
Some(action) => format!("Cannot {action}: not in a worktree"),
None => "Not in a worktree".to_string(),
@@ -1154,7 +1170,7 @@ impl GitError {
write!(f, "{}\n{}", error_message(&title), hint_message(hint))
}
- GitError::ReferenceNotFound { .. } => {
+ GitError::InvalidBranchName { .. } | GitError::ReferenceNotFound { .. } => {
let title = self.title();
write!(f, "{}", error_message(&title))
}
@@ -1183,6 +1199,17 @@ impl GitError {
)
}
+ GitError::InteractivePickerRequiresTerminal => {
+ let command = "wt switch <branch>";
+ write!(
+ f,
+ "{}\n{}",
+ error_message(self.title()),
+ hint_message(cformat!(
+ "To switch to a branch, run <underline>{command}</>"
+ ))
+ )
+ }
GitError::NotInWorktree { .. } => {
let title = self.title();
write!(
diff --git a/src/git/repository/branch.rs b/src/git/repository/branch.rs
index 3b23564eb..08a3c8213 100644
--- a/src/git/repository/branch.rs
+++ b/src/git/repository/branch.rs
@@ -1,6 +1,7 @@
//! Branch - a handle for branch-specific git operations.
use super::Repository;
+use crate::git::{CommandError, GitError};
/// Whether `refs/heads/<name>` is a well-formed ref, which is what a branch is.
///
@@ -63,6 +64,26 @@ impl<'a> Branch<'a> {
&self.name
}
+ /// Require a literal name Git accepts when creating a branch.
+ ///
+ /// Branch creation has stricter rules than ref syntax (for example, HEAD
+ /// is reserved). Git owns these rules; selector resolution continues to use
+ /// [`is_valid_branch_name`] for refs that may already exist.
+ pub fn require_valid_name(&self) -> anyhow::Result<()> {
+ let args = ["check-ref-format", "--branch", self.name()];
+ let output = self.repo.run_command_output(&args)?;
+ match output.status.code() {
+ // Git expands checkout-history expressions and echoes the result.
+ // Creation must not silently choose a different branch name.
+ Some(0) if output.stdout.trim_ascii_end() == self.name.as_bytes() => Ok(()),
+ Some(0 | 128) => Err(GitError::InvalidBranchName {
+ name: self.name.clone(),
+ }
+ .into()),
+ _ => Err(CommandError::from_failed_output("git", &args, &output).into()),
+ }
+ }
+
/// Check if this branch exists locally.
pub fn exists_locally(&self) -> anyhow::Result<bool> {
Ok(self
diff --git a/src/git/repository/config.rs b/src/git/repository/config.rs
index 519015f83..015ebedd0 100644
--- a/src/git/repository/config.rs
+++ b/src/git/repository/config.rs
@@ -626,7 +626,11 @@ impl Repository {
if target.is_none() {
return Err(self.uncached_default_branch_error(reference));
}
- return Err(GitError::ReferenceNotFound { reference }.into());
+ return Err(GitError::ReferenceNotFound {
+ reference,
+ flag: None,
+ }
+ .into());
}
Ok(reference)
}
diff --git a/src/git/repository/tests.rs b/src/git/repository/tests.rs
index 753b0fff7..b3792126c 100644
--- a/src/git/repository/tests.rs
+++ b/src/git/repository/tests.rs
@@ -2047,6 +2047,7 @@ fn branch_name_matches_git_check_ref_format() {
"main",
"feature/auth",
"release/1.2/rc",
+ "HEAD",
"-x",
"@",
"nowhere",
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index e2b561a9e..6db516762 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -667,6 +667,15 @@ fn handle_switch_existing_output(ctx: &SwitchOutputContext) -> Option<PathBuf> {
))
);
print_switch_directory_hint(&ctx.branch, ctx.is_git_subcommand);
+ } else if ctx.user_wont_be_in_worktree {
+ eprintln!(
+ "{}",
+ info_message(cformat!(
+ "Worktree for <bold>{}</> @ <bold>{}</> (directory change disabled)",
+ ctx.branch,
+ ctx.path_display
+ ))
+ );
} else {
eprintln!(
"{}",
diff --git a/tests/integration_tests/approval_pty.rs b/tests/integration_tests/approval_pty.rs
index c9c36771e..27119920e 100644
--- a/tests/integration_tests/approval_pty.rs
+++ b/tests/integration_tests/approval_pty.rs
@@ -123,6 +123,42 @@ fn test_approval_prompt_decline(repo: TestRepo) {
});
}
+/// Declining an alias prompt prevents the project command from running.
+#[rstest]
+fn test_alias_approval_decline(mut repo: TestRepo) {
+ repo.write_project_config(
+ r#"
+[aliases]
+deploy = "touch alias-ran"
+"#,
+ );
+ repo.commit("Add alias config");
+ let feature_path = repo.add_worktree("feature");
+ let marker = feature_path.join("alias-ran");
+ assert!(!marker.exists());
+
+ let (output, exit_code) = exec_wt_in_pty_cwd(
+ &feature_path,
+ &["step", "deploy"],
+ &repo.test_env_vars(),
+ "n\n",
+ );
+ assert_eq!(exit_code, 0, "{output}");
+ assert!(!marker.exists(), "Declined alias must not run");
+ approval_pty_settings(&repo).bind(|| {
+ assert_snapshot!("alias_approval_decline", &output);
+ });
+
+ let approved = repo
+ .wt_command()
+ .args(["--yes", "step", "deploy"])
+ .current_dir(&feature_path)
+ .output()
+ .unwrap();
+ assert!(approved.status.success(), "{approved:?}");
+ assert!(marker.exists(), "Explicitly approved alias must run");
+}
+
#[rstest]
fn test_approval_prompt_multiple_commands(repo: TestRepo) {
// Remove origin so worktrunk uses directory name as project identifier
diff --git a/tests/integration_tests/step_alias.rs b/tests/integration_tests/step_alias.rs
index ac3879a4e..3e7ea577e 100644
--- a/tests/integration_tests/step_alias.rs
+++ b/tests/integration_tests/step_alias.rs
@@ -624,41 +624,6 @@ greet = "echo USER"
// Approval tests
// ============================================================================
-/// Helper for alias approval snapshot tests
-fn snapshot_alias_approval(
- test_name: &str,
- repo: &TestRepo,
- alias_args: &[&str],
- approve: bool,
- cwd: Option<&std::path::Path>,
-) {
- let mut cmd = make_snapshot_cmd(repo, "step", alias_args, cwd);
- cmd.stdin(Stdio::piped())
- .stdout(Stdio::piped())
- .stderr(Stdio::piped());
-
- let mut child = cmd.spawn().unwrap();
-
- {
- let stdin = child.stdin.as_mut().unwrap();
- let response = if approve { b"y\n" } else { b"n\n" };
- stdin.write_all(response).unwrap();
- }
-
- let output = child.wait_with_output().unwrap();
-
- let stdout = String::from_utf8_lossy(&output.stdout);
- let stderr = String::from_utf8_lossy(&output.stderr);
- let combined = format!(
- "exit_code: {}\n----- stdout -----\n{}\n----- stderr -----\n{}",
- output.status.code().unwrap_or(-1),
- stdout,
- stderr
- );
-
- insta::assert_snapshot!(test_name, combined);
-}
-
/// Project-config alias prompts for approval in non-TTY (fails with hint)
#[rstest]
fn test_alias_approval_project_config_prompts(mut repo: TestRepo) {
@@ -2517,30 +2482,6 @@ s = "wt switch {{ args }}"
));
}
-/// Declining approval prevents alias execution
-#[rstest]
-fn test_alias_approval_decline(mut repo: TestRepo) {
- repo.write_project_config(
- r#"
-[aliases]
-deploy = "echo deploying"
-"#,
- );
- repo.commit("Add alias config");
- let feature_path = repo.add_worktree("feature");
-
- let settings = setup_snapshot_settings(&repo);
- let _guard = settings.bind_to_scope();
-
- snapshot_alias_approval(
- "alias_approval_decline",
- &repo,
- &["deploy"],
- false,
- Some(&feature_path),
- );
-}
-
/// Under `-v`, aliases print a table of resolved template variables before
/// the announcement — symmetric with the hook-invocation verbose block, but
/// with alias-scoped vars (`args` included, no `hook_*` keys).
diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rs
index 797fef49c..3aeb69f94 100644
--- a/tests/integration_tests/switch.rs
+++ b/tests/integration_tests/switch.rs
@@ -8670,3 +8670,187 @@ fn test_switch_path_rejects_directory_overlapping_repo(repo: TestRepo) {
assert!(repo.root_path().join("src").is_dir());
assert!(repo.root_path().join(".git").exists());
}
+
+/// Invalid branch names are rejected before worktree creation.
+#[rstest]
+#[case::space("bad name")]
+#[case::ref_syntax("bad..name")]
+#[case::reserved("HEAD")]
+fn switch_creation_rejects_invalid_branch(repo: TestRepo, #[case] name: &str) {
+ let settings = setup_snapshot_settings(&repo);
+ settings.bind(|| {
+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["--create", name], None);
+ assert_cmd_snapshot!(
+ format!(
+ "switch_invalid_branch_{}",
+ name.replace([' ', '.', '-'], "_")
+ ),
+ cmd
+ );
+ });
+ assert!(
+ !repo
+ .root_path()
+ .parent()
+ .unwrap()
+ .join(format!("repo.{name}"))
+ .exists()
+ );
+}
+
+/// Creation takes a literal branch name, even when Git could expand checkout
+/// history to a branch that no longer exists.
+#[rstest]
+#[case::present(false)]
+#[case::deleted(true)]
+fn switch_creation_rejects_checkout_history(repo: TestRepo, #[case] deleted: bool) {
+ repo.run_git(&["checkout", "-b", "previous"]);
+ repo.run_git(&["checkout", "main"]);
+ if deleted {
+ repo.run_git(&["branch", "-d", "previous"]);
+ }
+ assert_eq!(
+ repo.git_output(&["check-ref-format", "--branch", "@{-1}"])
+ .trim(),
+ "previous"
+ );
+ let refs_before = repo.git_output(&["for-each-ref", "--format=%(refname)"]);
+ let worktrees_before = repo.git_output(&["worktree", "list", "--porcelain"]);
+
+ let output = repo
+ .wt_command()
+ .args(["switch", "--create", "@{-1}", "--no-hooks"])
+ .output()
+ .unwrap();
+ assert!(!output.status.success(), "{output:?}");
+ insta::allow_duplicates! {
+ insta::assert_snapshot!(
+ String::from_utf8_lossy(&output.stderr).ansi_strip(),
+ @"✗ Invalid branch name @{-1}"
+ );
+ }
+ assert_eq!(
+ repo.git_output(&["for-each-ref", "--format=%(refname)"]),
+ refs_before
+ );
+ assert_eq!(
+ repo.git_output(&["worktree", "list", "--porcelain"]),
+ worktrees_before
+ );
+}
+
+#[rstest]
+#[case::nested("topic/nested")]
+#[case::unicode("café")]
+fn switch_creation_preserves_literal_branch_name(repo: TestRepo, #[case] name: &str) {
+ let output = repo
+ .wt_command()
+ .args(["switch", "--create", name, "--no-hooks"])
+ .output()
+ .unwrap();
+ assert!(output.status.success(), "{output:?}");
+ assert_eq!(
+ repo.git_output(&[
+ "show-ref",
+ "--verify",
+ "--hash",
+ &format!("refs/heads/{name}")
+ ]),
+ repo.git_output(&["rev-parse", "main"])
+ );
+}
+
+/// A validator subprocess cancellation is an interrupted operation, not an
+/// invalid branch name. Other Git commands still use real Git.
+#[cfg(unix)]
+#[rstest]
+fn switch_creation_preserves_validation_interrupt(repo: TestRepo) {
+ use std::os::unix::fs::PermissionsExt;
+ use std::os::unix::process::ExitStatusExt;
+
+ let bin_dir = repo.home_path().join("validation-interrupt");
+ fs::create_dir_all(&bin_dir).unwrap();
+ let git = bin_dir.join("git");
+ let marker = bin_dir.join("interrupted");
+ let real_git = which::which("git").unwrap();
+ let real_git = shell_escape::unix::escape(real_git.to_string_lossy());
+ fs::write(
+ &git,
+ format!(
+ r#"#!/bin/sh
+if [ "$1" = check-ref-format ]; then
+ printf called > "$WORKTRUNK_TEST_VALIDATION_MARKER"
+ kill -TERM "$$"
+fi
+exec {real_git} "$@"
+"#
+ ),
+ )
+ .unwrap();
+ fs::set_permissions(&git, fs::Permissions::from_mode(0o755)).unwrap();
+ let mut paths: Vec<_> = std::env::split_paths(&std::env::var_os("PATH").unwrap()).collect();
+ paths.insert(0, bin_dir);
+ let worktrees_before = repo.git_output(&["worktree", "list", "--porcelain"]);
+ assert!(!marker.exists());
+
+ let output = repo
+ .wt_command()
+ .args(["switch", "--create", "interrupted", "--no-hooks"])
+ .env("PATH", std::env::join_paths(paths).unwrap())
+ .env("WORKTRUNK_TEST_VALIDATION_MARKER", &marker)
+ .output()
+ .unwrap();
+ assert_eq!(fs::read_to_string(marker).unwrap(), "called");
+ assert_eq!(
+ output.status.signal(),
+ Some(nix::sys::signal::Signal::SIGTERM as i32),
+ "{output:?}"
+ );
+ assert!(output.stdout.is_empty());
+ assert_eq!(
+ repo.git_output(&["worktree", "list", "--porcelain"]),
+ worktrees_before
+ );
+ assert!(
+ repo.git_output(&["branch", "--list", "interrupted"])
+ .is_empty()
+ );
+}
+
+#[rstest]
+fn switch_missing_path_selector(repo: TestRepo) {
+ snapshot_switch("switch_missing_path_selector", &repo, &["./ghost"]);
+}
+
+/// Explicit and configured suppression both leave the directive untouched and
+/// report the available checkout without claiming the shell switched there.
+#[rstest]
+#[case::flag(false)]
+#[case::config(true)]
+fn switch_existing_without_cd(mut repo: TestRepo, #[case] configured: bool) {
+ let feature = repo.add_worktree("feature");
+ if configured {
+ repo.write_test_config("[switch]\ncd = false\n");
+ }
+ let settings = setup_snapshot_settings(&repo);
+ settings.bind(|| {
+ let (cd_path, _guard) = directive_file();
+ let args = if configured {
+ vec!["feature"]
+ } else {
+ vec!["feature", "--no-cd"]
+ };
+ let mut cmd = make_snapshot_cmd(&repo, "switch", &args, None);
+ configure_directive_file(&mut cmd, &cd_path);
+ assert_cmd_snapshot!(
+ if configured {
+ "switch_existing_cd_disabled_config"
+ } else {
+ "switch_existing_cd_disabled_flag"
+ },
+ cmd
+ );
+ assert!(fs::read_to_string(&cd_path).unwrap().is_empty());
+ });
+ assert!(feature.is_dir());
+}
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__alias_approval_decline.snap b/tests/snapshots/integration__integration_tests__approval_pty__alias_approval_decline.snap
new file mode 100644
index 000000000..2dfa21e94
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__approval_pty__alias_approval_decline.snap
@@ -0,0 +1,9 @@
+---
+source: tests/integration_tests/approval_pty.rs
+expression: "&output"
+---
+▲ origin needs approval to execute 1 command:
+○ alias deploy:
+  touch alias-ran
+
+❯ Allow and remember? [y/N] n
diff --git a/tests/snapshots/integration__integration_tests__directives__switch_no_cd_config_suppresses_directive.snap b/tests/snapshots/integration__integration_tests__directives__switch_no_cd_config_suppresses_directive.snap
index f99cd14cd..ffb1289f4 100644
--- a/tests/snapshots/integration__integration_tests__directives__switch_no_cd_config_suppresses_directive.snap
+++ b/tests/snapshots/integration__integration_tests__directives__switch_no_cd_config_suppresses_directive.snap
@@ -60,5 +60,5 @@ exit_code: 0
----- stdout -----
----- stderr -----
-○ Switched to worktree for feature @ _REPO_.feature
+○ Worktree for feature @ _REPO_.feature (directory change disabled)

diff --git a/tests/snapshots/integration__integration_tests__directives__switch_no_cd_suppresses_directive.snap b/tests/snapshots/integration__integration_tests__directives__switch_no_cd_suppresses_directive.snap
index 5d2b552dd..6f3ad9c63 100644
--- a/tests/snapshots/integration__integration_tests__directives__switch_no_cd_suppresses_directive.snap
+++ b/tests/snapshots/integration__integration_tests__directives__switch_no_cd_suppresses_directive.snap
@@ -61,5 +61,5 @@ exit_code: 0
----- stdout -----
----- stderr -----
-○ Switched to worktree for feature @ _REPO_.feature
+○ Worktree for feature @ _REPO_.feature (directory change disabled)

diff --git a/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap
index 9267778d9..262c91395 100644
--- a/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap
+++ b/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap
@@ -60,6 +60,6 @@ exit_code: 1
----- stdout -----
----- stderr -----
-✗ No branch named __WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6
-↳ To list branches, run wt list --branches --remotes
+✗ No branch or worktree named __WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6
+↳ To see branches and worktree paths, run wt list --branches

diff --git a/tests/snapshots/integration__integration_tests__step_alias__alias_approval_decline.snap b/tests/snapshots/integration__integration_tests__step_alias__alias_approval_decline.snap
deleted file mode 100644
index 1565dcaef..000000000
--- a/tests/snapshots/integration__integration_tests__step_alias__alias_approval_decline.snap
+++ /dev/null
@@ -1,13 +0,0 @@
----
-source: tests/integration_tests/step_alias.rs
-expression: combined
----
-exit_code: 1
------ stdout -----
-
------ stderr -----
-▲ origin needs approval to execute 1 command:
-○ alias deploy:
-  echo deploying
-✗ Cannot prompt for approval in non-interactive environment
-↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add --yes
diff --git a/tests/snapshots/integration__integration_tests__switch__select_deprecated_requires_tty.snap b/tests/snapshots/integration__integration_tests__switch__select_deprecated_requires_tty.snap
index 0c1aa3949..d3b23e5ea 100644
--- a/tests/snapshots/integration__integration_tests__switch__select_deprecated_requires_tty.snap
+++ b/tests/snapshots/integration__integration_tests__switch__select_deprecated_requires_tty.snap
@@ -60,3 +60,4 @@ exit_code: 1
----- stderr -----
▲ wt select is deprecated; use wt switch instead
✗ Interactive picker requires an interactive terminal
+↳ To switch to a branch, run wt switch <branch>
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_base_pr_without_create.snap b/tests/snapshots/integration__integration_tests__switch__switch_base_pr_without_create.snap
index 375119bb4..9d258a92b 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_base_pr_without_create.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_base_pr_without_create.snap
@@ -63,4 +63,4 @@ exit_code: 0
----- stderr -----
▲ --base flag is only used with --create, ignoring
-○ Switched to worktree for existing @ _REPO_.existing
+○ Worktree for existing @ _REPO_.existing (directory change disabled)
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_invalid_base.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_invalid_base.snap
index f9b4e533b..e3ca2571d 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_invalid_base.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_invalid_base.snap
@@ -62,4 +62,4 @@ exit_code: 1
----- stdout -----
----- stderr -----
-✗ No branch, tag, or commit named nonexistent-base
+✗ No branch, tag, or commit named nonexistent-base (--base)
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_existing_cd_disabled_config.snap b/tests/snapshots/integration__integration_tests__switch__switch_existing_cd_disabled_config.snap
new file mode 100644
index 000000000..391edfb45
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_existing_cd_disabled_config.snap
@@ -0,0 +1,64 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - feature
+ 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_DIRECTIVE_CD_FILE: "[DIRECTIVE_CD_FILE]"
+ 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: ""
+ 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 feature @ _REPO_.feature (directory change disabled)
+
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_existing_cd_disabled_flag.snap b/tests/snapshots/integration__integration_tests__switch__switch_existing_cd_disabled_flag.snap
new file mode 100644
index 000000000..54ef6cecd
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_existing_cd_disabled_flag.snap
@@ -0,0 +1,65 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - feature
+ - "--no-cd"
+ 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_DIRECTIVE_CD_FILE: "[DIRECTIVE_CD_FILE]"
+ 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: ""
+ 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 feature @ _REPO_.feature (directory change disabled)
+
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_HEAD.snap b/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_HEAD.snap
new file mode 100644
index 000000000..b3b69c5ac
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_HEAD.snap
@@ -0,0 +1,63 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - "--create"
+ - HEAD
+ 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_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
+ 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: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ Invalid branch name HEAD
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_bad__name.snap b/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_bad__name.snap
new file mode 100644
index 000000000..df842e555
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_bad__name.snap
@@ -0,0 +1,63 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - "--create"
+ - bad..name
+ 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_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
+ 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: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ Invalid branch name bad..name
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_bad_name.snap b/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_bad_name.snap
new file mode 100644
index 000000000..3e0a235cc
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_invalid_branch_bad_name.snap
@@ -0,0 +1,63 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - "--create"
+ - bad name
+ 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_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
+ 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: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ Invalid branch name bad name
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_missing_argument_hints.snap b/tests/snapshots/integration__integration_tests__switch__switch_missing_argument_hints.snap
index 4d85d4e8c..f84128aba 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_missing_argument_hints.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_missing_argument_hints.snap
@@ -59,3 +59,4 @@ exit_code: 1
----- stderr -----
✗ Interactive picker requires an interactive terminal
+↳ To switch to a branch, run wt switch <branch>
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_missing_path_selector.snap b/tests/snapshots/integration__integration_tests__switch__switch_missing_path_selector.snap
new file mode 100644
index 000000000..8ab279e39
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_missing_path_selector.snap
@@ -0,0 +1,63 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - "./ghost"
+ 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_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_PARENT_SHELL: ""
+ 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: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ No branch or worktree named ./ghost
+↳ To see branches and worktree paths, run wt list --branches