Skip to content

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

feat: add `wt config plugins claude install/uninstall` (#1830)

Maximilian Roos0afc50d67733
diff --git a/docs/content/config.md b/docs/content/config.md
index 871205249..344ba40e8 100644
--- a/docs/content/config.md
+++ b/docs/content/config.md
@@ -436,11 +436,12 @@ Includes shell integration, hooks, and saved state.
Usage: <b><span class=c>wt config</span></b> <span class=c>[OPTIONS]</span> <span class=c>&lt;COMMAND&gt;</span>
<b><span class=g>Commands:</span></b>
- <b><span class=c>shell</span></b> Shell integration setup
- <b><span class=c>create</span></b> Create configuration file
- <b><span class=c>show</span></b> Show configuration files &amp; locations
- <b><span class=c>update</span></b> Update deprecated config settings
- <b><span class=c>state</span></b> Manage internal data and cache
+ <b><span class=c>shell</span></b> Shell integration setup
+ <b><span class=c>create</span></b> Create configuration file
+ <b><span class=c>show</span></b> Show configuration files &amp; locations
+ <b><span class=c>update</span></b> Update deprecated config settings
+ <b><span class=c>plugins</span></b> Plugin management
+ <b><span class=c>state</span></b> Manage internal data and cache
<b><span class=g>Options:</span></b>
<b><span class=c>-h</span></b>, <b><span class=c>--help</span></b>
diff --git a/skills/worktrunk/reference/config.md b/skills/worktrunk/reference/config.md
index 81b335d98..a5565d15f 100644
--- a/skills/worktrunk/reference/config.md
+++ b/skills/worktrunk/reference/config.md
@@ -437,11 +437,12 @@ Includes shell integration, hooks, and saved state.
Usage: wt config [OPTIONS] <COMMAND>
Commands:
- shell Shell integration setup
- create Create configuration file
- show Show configuration files & locations
- update Update deprecated config settings
- state Manage internal data and cache
+ shell Shell integration setup
+ create Create configuration file
+ show Show configuration files & locations
+ update Update deprecated config settings
+ plugins Plugin management
+ state Manage internal data and cache
Options:
-h, --help
diff --git a/src/cli/config.rs b/src/cli/config.rs
index 011ba11b4..b0882076e 100644
--- a/src/cli/config.rs
+++ b/src/cli/config.rs
@@ -184,6 +184,60 @@ all approvals across all projects."#
},
}
+#[derive(Subcommand)]
+pub enum ConfigPluginsCommand {
+ /// Claude Code plugin
+ #[command(after_long_help = r#"## Examples
+
+Install the plugin:
+```console
+$ wt config plugins claude install
+```
+
+Remove the plugin:
+```console
+$ wt config plugins claude uninstall
+```"#)]
+ Claude {
+ #[command(subcommand)]
+ action: ConfigPluginsClaudeCommand,
+ },
+}
+
+#[derive(Subcommand)]
+pub enum ConfigPluginsClaudeCommand {
+ /// Install the Worktrunk plugin
+ #[command(
+ after_long_help = r#"Adds the Worktrunk plugin from the marketplace and installs it. Equivalent to:
+
+```console
+$ claude plugin marketplace add max-sixty/worktrunk
+$ claude plugin install worktrunk@worktrunk
+```
+
+Requires `claude` CLI. Skips gracefully if already installed."#
+ )]
+ Install {
+ /// Skip confirmation prompt
+ #[arg(short, long)]
+ yes: bool,
+ },
+
+ /// Remove the Worktrunk plugin
+ #[command(
+ after_long_help = r#"Uninstalls the Worktrunk plugin from Claude Code. Equivalent to:
+
+```console
+$ claude plugin uninstall worktrunk@worktrunk
+```"#
+ )]
+ Uninstall {
+ /// Skip confirmation prompt
+ #[arg(short, long)]
+ yes: bool,
+ },
+}
+
#[derive(Subcommand)]
pub enum ConfigCommand {
/// Shell integration setup
@@ -260,6 +314,26 @@ $ wt config update --yes
yes: bool,
},
+ /// Plugin management
+ #[command(
+ after_long_help = r#"Install and manage Worktrunk plugins for AI coding tools.
+
+## Supported tools
+
+- **claude** — Claude Code plugin
+
+## Examples
+
+```console
+$ wt config plugins claude install
+$ wt config plugins claude uninstall
+```"#
+ )]
+ Plugins {
+ #[command(subcommand)]
+ action: ConfigPluginsCommand,
+ },
+
/// Manage internal data and cache
#[command(
after_long_help = r#"State is stored in `.git/` (config entries and log files), separate from configuration files.
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 31a565805..27b360dbc 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -4,8 +4,9 @@ mod list;
mod step;
pub(crate) use config::{
- ApprovalsCommand, CiStatusAction, ConfigCommand, ConfigShellCommand, DefaultBranchAction,
- HintsAction, LogsAction, MarkerAction, PreviousBranchAction, StateCommand, VarsAction,
+ ApprovalsCommand, CiStatusAction, ConfigCommand, ConfigPluginsClaudeCommand,
+ ConfigPluginsCommand, ConfigShellCommand, DefaultBranchAction, HintsAction, LogsAction,
+ MarkerAction, PreviousBranchAction, StateCommand, VarsAction,
};
pub(crate) use hook::HookCommand;
pub(crate) use list::ListSubcommand;
diff --git a/src/commands/config/mod.rs b/src/commands/config/mod.rs
index ab23bf3e2..5e806c3b5 100644
--- a/src/commands/config/mod.rs
+++ b/src/commands/config/mod.rs
@@ -4,6 +4,7 @@
mod create;
mod hints;
+mod plugins;
mod show;
mod state;
mod update;
@@ -11,6 +12,7 @@ mod update;
// Re-export public functions
pub use create::handle_config_create;
pub use hints::{handle_hints_clear, handle_hints_get};
+pub use plugins::{handle_claude_install, handle_claude_uninstall};
pub use show::handle_config_show;
pub use state::{
handle_logs_get, handle_state_clear, handle_state_clear_all, handle_state_get,
diff --git a/src/commands/config/plugins.rs b/src/commands/config/plugins.rs
new file mode 100644
index 000000000..450352439
--- /dev/null
+++ b/src/commands/config/plugins.rs
@@ -0,0 +1,110 @@
+//! Plugin management commands for AI coding tools.
+
+use anyhow::{Context, bail};
+use color_print::cformat;
+use worktrunk::shell_exec::Cmd;
+use worktrunk::styling::{eprintln, info_message, progress_message, success_message};
+
+use super::show::{is_claude_available, is_plugin_installed};
+use crate::output::prompt::{PromptResponse, prompt_yes_no_preview};
+
+/// Handle `wt config plugins claude install`
+pub fn handle_claude_install(yes: bool) -> anyhow::Result<()> {
+ require_claude_cli()?;
+
+ if is_plugin_installed() {
+ eprintln!("{}", info_message("Plugin already installed"));
+ return Ok(());
+ }
+
+ if !yes {
+ match prompt_yes_no_preview(
+ &cformat!("Install Worktrunk plugin for <bold>Claude Code</>?"),
+ || {
+ let commands = "claude plugin marketplace add max-sixty/worktrunk\nclaude plugin install worktrunk@worktrunk";
+ eprintln!("{}", worktrunk::styling::format_bash_with_gutter(commands));
+ },
+ )? {
+ PromptResponse::Accepted => {}
+ PromptResponse::Declined => return Ok(()),
+ }
+ }
+
+ eprintln!("{}", progress_message("Adding plugin from marketplace..."));
+ let output = Cmd::new("claude")
+ .args(["plugin", "marketplace", "add", "max-sixty/worktrunk"])
+ .run()
+ .context("Failed to run claude CLI")?;
+
+ if !output.status.success() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ bail!("claude plugin marketplace add failed: {}", stderr.trim());
+ }
+
+ eprintln!("{}", progress_message("Installing plugin..."));
+ let output = Cmd::new("claude")
+ .args(["plugin", "install", "worktrunk@worktrunk"])
+ .run()
+ .context("Failed to run claude CLI")?;
+
+ if !output.status.success() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ bail!("claude plugin install failed: {}", stderr.trim());
+ }
+
+ eprintln!("{}", success_message("Plugin installed"));
+
+ Ok(())
+}
+
+/// Handle `wt config plugins claude uninstall`
+pub fn handle_claude_uninstall(yes: bool) -> anyhow::Result<()> {
+ require_claude_cli()?;
+
+ if !is_plugin_installed() {
+ eprintln!("{}", info_message("Plugin not installed"));
+ return Ok(());
+ }
+
+ if !yes {
+ match prompt_yes_no_preview(
+ &cformat!("Uninstall Worktrunk plugin from <bold>Claude Code</>?"),
+ || {
+ eprintln!(
+ "{}",
+ worktrunk::styling::format_bash_with_gutter(
+ "claude plugin uninstall worktrunk@worktrunk"
+ )
+ );
+ },
+ )? {
+ PromptResponse::Accepted => {}
+ PromptResponse::Declined => return Ok(()),
+ }
+ }
+
+ eprintln!("{}", progress_message("Uninstalling plugin..."));
+ let output = Cmd::new("claude")
+ .args(["plugin", "uninstall", "worktrunk@worktrunk"])
+ .run()
+ .context("Failed to run claude CLI")?;
+
+ if !output.status.success() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ bail!("claude plugin uninstall failed: {}", stderr.trim());
+ }
+
+ eprintln!("{}", success_message("Plugin uninstalled"));
+
+ Ok(())
+}
+
+/// Bail if `claude` CLI is not available
+fn require_claude_cli() -> anyhow::Result<()> {
+ if is_claude_available() {
+ return Ok(());
+ }
+ bail!(
+ "claude CLI not found. Install Claude Code first: https://docs.anthropic.com/en/docs/claude-code/overview"
+ );
+}
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index fa931a402..77cc4f87d 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -81,7 +81,7 @@ pub fn handle_config_show(full: bool) -> anyhow::Result<()> {
// ==================== Helper Functions ====================
/// Check if Claude Code CLI is available
-fn is_claude_available() -> bool {
+pub(super) fn is_claude_available() -> bool {
// Allow tests to override detection
if let Ok(val) = std::env::var("WORKTRUNK_TEST_CLAUDE_INSTALLED") {
return val == "1";
@@ -100,7 +100,7 @@ fn home_dir() -> Option<PathBuf> {
}
/// Check if the worktrunk plugin is installed in Claude Code
-fn is_plugin_installed() -> bool {
+pub(super) fn is_plugin_installed() -> bool {
let Some(home) = home_dir() else {
return false;
};
@@ -196,10 +196,10 @@ fn render_claude_code_status(out: &mut String) -> anyhow::Result<()> {
writeln!(
out,
"{}",
- hint_message("Plugin not installed. To install, run:")
+ hint_message(cformat!(
+ "Plugin not installed. To install, run <underline>wt config plugins claude install</>"
+ ))
)?;
- let install_commands = "claude plugin marketplace add max-sixty/worktrunk\nclaude plugin install worktrunk@worktrunk";
- writeln!(out, "{}", format_bash_with_gutter(install_commands))?;
}
// Statusline status
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index f38a9f5ab..7111620fa 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -27,10 +27,10 @@ pub(crate) mod worktree;
pub(crate) use alias::{AliasOptions, step_alias};
pub(crate) use config::{
- handle_config_create, handle_config_show, handle_config_update, handle_hints_clear,
- handle_hints_get, handle_logs_get, handle_state_clear, handle_state_clear_all,
- handle_state_get, handle_state_set, handle_state_show, handle_vars_clear, handle_vars_get,
- handle_vars_list, handle_vars_set,
+ handle_claude_install, handle_claude_uninstall, handle_config_create, handle_config_show,
+ handle_config_update, handle_hints_clear, handle_hints_get, handle_logs_get,
+ handle_state_clear, handle_state_clear_all, handle_state_get, handle_state_set,
+ handle_state_show, handle_vars_clear, handle_vars_get, handle_vars_list, handle_vars_set,
};
pub(crate) use configure_shell::{
handle_configure_shell, handle_show_theme, handle_unconfigure_shell,
diff --git a/src/main.rs b/src/main.rs
index 1d4ab569d..b0b00414e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -47,21 +47,22 @@ use commands::repository_ext::RepositoryCliExt;
use commands::worktree::{BranchDeletionMode, handle_no_ff_merge, handle_push};
use commands::{
MergeOptions, OperationMode, RebaseResult, RemoveTarget, SquashResult, SwitchOptions,
- add_approvals, clear_approvals, handle_completions, handle_config_create, handle_config_show,
- handle_config_update, handle_configure_shell, handle_hints_clear, handle_hints_get,
- handle_hook_show, handle_init, handle_list, handle_logs_get, handle_merge, handle_promote,
- handle_rebase, handle_show_theme, handle_squash, handle_state_clear, handle_state_clear_all,
- handle_state_get, handle_state_set, handle_state_show, handle_switch, handle_unconfigure_shell,
- handle_vars_clear, handle_vars_get, handle_vars_list, handle_vars_set, resolve_worktree_arg,
- run_hook, step_commit, step_copy_ignored, step_diff, step_eval, step_for_each, step_prune,
- step_relocate,
+ add_approvals, clear_approvals, handle_claude_install, handle_claude_uninstall,
+ handle_completions, handle_config_create, handle_config_show, handle_config_update,
+ handle_configure_shell, handle_hints_clear, handle_hints_get, handle_hook_show, handle_init,
+ handle_list, handle_logs_get, handle_merge, handle_promote, handle_rebase, handle_show_theme,
+ handle_squash, handle_state_clear, handle_state_clear_all, handle_state_get, handle_state_set,
+ handle_state_show, handle_switch, handle_unconfigure_shell, handle_vars_clear, handle_vars_get,
+ handle_vars_list, handle_vars_set, resolve_worktree_arg, run_hook, step_commit,
+ step_copy_ignored, step_diff, step_eval, step_for_each, step_prune, step_relocate,
};
use output::handle_remove_output;
use cli::{
- ApprovalsCommand, CiStatusAction, Cli, Commands, ConfigCommand, ConfigShellCommand,
- DefaultBranchAction, HintsAction, HookCommand, ListSubcommand, LogsAction, MarkerAction,
- PreviousBranchAction, StateCommand, StepCommand, VarsAction,
+ ApprovalsCommand, CiStatusAction, Cli, Commands, ConfigCommand, ConfigPluginsClaudeCommand,
+ ConfigPluginsCommand, ConfigShellCommand, DefaultBranchAction, HintsAction, HookCommand,
+ ListSubcommand, LogsAction, MarkerAction, PreviousBranchAction, StateCommand, StepCommand,
+ VarsAction,
};
use worktrunk::HookType;
@@ -468,10 +469,20 @@ fn handle_config_command(action: ConfigCommand) -> anyhow::Result<()> {
ConfigCommand::Create { project } => handle_config_create(project),
ConfigCommand::Show { full } => handle_config_show(full),
ConfigCommand::Update { yes } => handle_config_update(yes),
+ ConfigCommand::Plugins { action } => handle_plugins_command(action),
ConfigCommand::State { action } => handle_state_command(action),
}
}
+fn handle_plugins_command(action: ConfigPluginsCommand) -> anyhow::Result<()> {
+ match action {
+ ConfigPluginsCommand::Claude { action } => match action {
+ ConfigPluginsClaudeCommand::Install { yes } => handle_claude_install(yes),
+ ConfigPluginsClaudeCommand::Uninstall { yes } => handle_claude_uninstall(yes),
+ },
+ }
+}
+
fn handle_list_command(
subcommand: Option<ListSubcommand>,
format: OutputFormat,
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index 6a515168f..a1b88a704 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -1430,6 +1430,11 @@ impl TestRepo {
&self.root
}
+ /// Get the mock bin directory path (for custom mock setups)
+ pub fn mock_bin_path(&self) -> Option<&Path> {
+ self.mock_bin_path.as_deref()
+ }
+
/// Get the path to the bare remote repository, if created.
pub fn remote_path(&self) -> Option<&Path> {
self.remote.as_deref()
@@ -1941,6 +1946,59 @@ impl TestRepo {
.unwrap();
}
+ /// Setup mock `claude` CLI with plugin subcommand support
+ ///
+ /// Creates a mock claude binary that handles `plugin marketplace`,
+ /// `plugin install`, and `plugin uninstall` commands. Must call
+ /// `setup_mock_ci_tools_unauthenticated()` first to create the mock bin directory.
+ pub fn setup_mock_claude_with_plugins(&mut self) {
+ use crate::common::mock_commands::{MockConfig, MockResponse};
+
+ let mock_bin = self
+ .mock_bin_path
+ .as_ref()
+ .expect("call setup_mock_ci_tools_unauthenticated() first");
+
+ MockConfig::new("claude")
+ .command("plugin marketplace", MockResponse::exit(0))
+ .command("plugin install", MockResponse::exit(0))
+ .command("plugin uninstall", MockResponse::exit(0))
+ .write(mock_bin);
+
+ self.claude_installed = true;
+ }
+
+ /// Setup mock `claude` CLI where plugin commands fail
+ ///
+ /// Creates a mock claude binary where `plugin marketplace`, `plugin install`,
+ /// and `plugin uninstall` all exit with code 1 and print an error.
+ /// Must call `setup_mock_ci_tools_unauthenticated()` first.
+ pub fn setup_mock_claude_with_plugins_failing(&mut self) {
+ use crate::common::mock_commands::{MockConfig, MockResponse};
+
+ let mock_bin = self
+ .mock_bin_path
+ .as_ref()
+ .expect("call setup_mock_ci_tools_unauthenticated() first");
+
+ MockConfig::new("claude")
+ .command(
+ "plugin marketplace",
+ MockResponse::exit(1).with_stderr("error: network timeout\n"),
+ )
+ .command(
+ "plugin install",
+ MockResponse::exit(1).with_stderr("error: install failed\n"),
+ )
+ .command(
+ "plugin uninstall",
+ MockResponse::exit(1).with_stderr("error: uninstall failed\n"),
+ )
+ .write(mock_bin);
+
+ self.claude_installed = true;
+ }
+
/// Setup mock `gh` that returns configurable PR/CI data
///
/// Use this for testing CI status parsing code. The mock returns JSON data
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index 16c9417d6..9f5c7875a 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -2717,3 +2717,163 @@ fn test_explicit_config_path_not_found_shows_warning(repo: TestRepo) {
assert_cmd_snapshot!(cmd);
});
}
+
+// ==================== Plugin Install/Uninstall Tests ====================
+
+#[rstest]
+fn test_plugins_claude_install(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_claude_with_plugins();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "claude", "install", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_claude_install_already_installed(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_claude_with_plugins();
+ TestRepo::setup_plugin_installed(temp_home.path());
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "claude", "install", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_claude_install_claude_not_found(repo: TestRepo) {
+ // Don't call setup_mock_claude_installed — claude CLI not available
+ let settings = setup_snapshot_settings(&repo);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ cmd.args(["config", "plugins", "claude", "install", "--yes"])
+ .current_dir(repo.root_path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_claude_uninstall(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_claude_with_plugins();
+ TestRepo::setup_plugin_installed(temp_home.path());
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "claude", "uninstall", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_claude_uninstall_not_installed(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_claude_with_plugins();
+ // Don't setup plugin as installed
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "claude", "uninstall", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_claude_install_command_fails(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_claude_with_plugins_failing();
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "claude", "install", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_claude_install_second_step_fails(mut repo: TestRepo, temp_home: TempDir) {
+ use crate::common::mock_commands::{MockConfig, MockResponse};
+
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_claude_installed();
+
+ // Marketplace add succeeds but plugin install fails
+ let mock_bin = repo
+ .mock_bin_path()
+ .expect("setup_mock_ci_tools_unauthenticated creates mock-bin");
+ MockConfig::new("claude")
+ .command("plugin marketplace", MockResponse::exit(0))
+ .command(
+ "plugin install",
+ MockResponse::exit(1).with_stderr("error: install failed\n"),
+ )
+ .write(mock_bin);
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "claude", "install", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_plugins_claude_uninstall_command_fails(mut repo: TestRepo, temp_home: TempDir) {
+ repo.setup_mock_ci_tools_unauthenticated();
+ repo.setup_mock_claude_with_plugins_failing();
+ TestRepo::setup_plugin_installed(temp_home.path());
+
+ let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
+ settings.bind(|| {
+ let mut cmd = wt_command();
+ repo.configure_wt_cmd(&mut cmd);
+ repo.configure_mock_commands(&mut cmd);
+ cmd.args(["config", "plugins", "claude", "uninstall", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+
+ assert_cmd_snapshot!(cmd);
+ });
+}
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 ad7935542..a975b5504 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
@@ -59,9 +59,7 @@ exit_code: 0
○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
CLAUDE CODE
-↳ Plugin not installed. To install, run:
-  claude plugin marketplace add max-sixty/worktrunk
-  claude plugin install worktrunk@worktrunk
+↳ Plugin not installed. To install, run wt config plugins claude install
↳ Statusline not configured. See https://worktrunk.dev/claude-code/#statusline
OTHER
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install.snap
new file mode 100644
index 000000000..203cc5f48
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install.snap
@@ -0,0 +1,50 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - claude
+ - install
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Adding plugin from marketplace...
+◎ Installing plugin...
+✓ Plugin installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_already_installed.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_already_installed.snap
new file mode 100644
index 000000000..4144ebef9
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_already_installed.snap
@@ -0,0 +1,48 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - claude
+ - install
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+○ Plugin already installed
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_claude_not_found.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_claude_not_found.snap
new file mode 100644
index 000000000..29ecef788
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_claude_not_found.snap
@@ -0,0 +1,48 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - claude
+ - install
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ claude CLI not found. Install Claude Code first: https://docs.anthropic.com/en/docs/claude-code/overview
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_command_fails.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_command_fails.snap
new file mode 100644
index 000000000..528935e05
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_command_fails.snap
@@ -0,0 +1,49 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - claude
+ - install
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+◎ Adding plugin from marketplace...
+✗ claude plugin marketplace add failed: error: network timeout
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_second_step_fails.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_second_step_fails.snap
new file mode 100644
index 000000000..146d3a6de
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_second_step_fails.snap
@@ -0,0 +1,50 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - claude
+ - install
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+◎ Adding plugin from marketplace...
+◎ Installing plugin...
+✗ claude plugin install failed: error: install failed
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall.snap
new file mode 100644
index 000000000..688da12b6
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall.snap
@@ -0,0 +1,49 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - claude
+ - uninstall
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Uninstalling plugin...
+✓ Plugin uninstalled
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_command_fails.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_command_fails.snap
new file mode 100644
index 000000000..a04e1fe70
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_command_fails.snap
@@ -0,0 +1,49 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - claude
+ - uninstall
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+◎ Uninstalling plugin...
+✗ claude plugin uninstall failed: error: uninstall failed
diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_not_installed.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_not_installed.snap
new file mode 100644
index 000000000..9de36e118
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_not_installed.snap
@@ -0,0 +1,48 @@
+---
+source: tests/integration_tests/config_show.rs
+info:
+ program: wt
+ args:
+ - config
+ - plugins
+ - claude
+ - uninstall
+ - "--yes"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "1"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+○ Plugin not installed
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
index 8a46f6f25..bf34de458 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
@@ -38,11 +38,12 @@ Includes shell integration, hooks, and saved state.
Usage: wt config [OPTIONS] <COMMAND>
Commands:
- shell Shell integration setup
- create Create configuration file
- show Show configuration files & locations
- update Update deprecated config settings
- state Manage internal data and cache
+ shell Shell integration setup
+ create Create configuration file
+ show Show configuration files & locations
+ update Update deprecated config settings
+ plugins Plugin management
+ state Manage internal data and cache
Options:
-h, --help
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_short.snap b/tests/snapshots/integration__integration_tests__help__help_config_short.snap
index e47bcc18b..80723e8d2 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_short.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_short.snap
@@ -11,6 +11,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
+ NO_COLOR: ""
PSModulePath: ""
RUST_LOG: warn
SHELL: ""
@@ -35,11 +36,12 @@ wt config - Manage user & project configs
Usage: wt config [OPTIONS] <COMMAND>
Commands:
- shell Shell integration setup
- create Create configuration file
- show Show configuration files & locations
- update Update deprecated config settings
- state Manage internal data and cache
+ shell Shell integration setup
+ create Create configuration file
+ show Show configuration files & locations
+ update Update deprecated config settings
+ plugins Plugin management
+ state Manage internal data and cache
Options:
-h, --help Print help (see more with '--help')