Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Ask the harness what it holds, everywhere wt asks at all (#4054)
Maximilian Roos6ab31967ff54
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9ef864864..3d7af8a45 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,8 @@- **`wt config plugins claude uninstall` / `codex uninstall` no longer report success over a marketplace that is still there**: to tell an already-removed marketplace from a removal that failed, uninstall used to read the harness's own config file. A file or key the harness renamed reads as an absence there, so every failed removal would have printed `Plugin & marketplace removed` and exited 0. It now asks `claude` / `codex plugin marketplace list --json`, and an answer it cannot read leaves the harness's error standing. ([#4048](https://github.com/max-sixty/worktrunk/pull/4048))+- **`wt config show` reports Claude Code's plugin and Gemini CLI's extension from those tools' own listings**: it read `installed_plugins.json` and the `~/.gemini/extensions/` directory, so a store either tool relocated read as an absence and the section said "not installed" over an installed plugin. Both answers now come from `claude plugin list --json` and `gemini extensions list -o json`. `wt config plugins claude uninstall` follows: it runs the plugin removal and the marketplace removal every time, each tolerating only the absence Claude Code itself reports, so it no longer exits early with `Plugin not installed` on a file read. ([#4054](https://github.com/max-sixty/worktrunk/pull/4054))+## 0.77.0### Improveddiff --git a/src/cli/config.rs b/src/cli/config.rsindex 45edae2f3..d94de2a38 100644--- a/src/cli/config.rs+++ b/src/cli/config.rs@@ -449,7 +449,7 @@ $ claude plugin uninstall worktrunk@worktrunk$ claude plugin marketplace remove worktrunk```-Requires `claude` CLI. Skips gracefully only when both are already gone. An uninstall that removed the plugin and then failed leaves the marketplace behind; running it again removes that half."#+Requires `claude` CLI. Both removals run every time, tolerating only the "already gone" error Claude Code itself reports. Running it again is safe, and finishes an uninstall that removed the plugin and then failed on the marketplace."#)]Uninstall,diff --git a/src/commands/config/codex.rs b/src/commands/config/codex.rsindex 02302d074..cfb120d59 100644--- a/src/commands/config/codex.rs+++ b/src/commands/config/codex.rs@@ -74,6 +74,8 @@ pub fn handle_codex_uninstall(yes: bool) -> Result<()> {}}+ // `codex plugin remove` exits 0 when the plugin is already gone, so this+ // step needs none of the tolerance the marketplace removal below does.eprintln!("{}", progress_message("Uninstalling plugin..."));super::run_plugin_cli("codex", &["plugin", "remove", PLUGIN_SELECTOR])?;@@ -100,26 +102,28 @@ fn require_codex_cli() -> Result<()> {bail!("codex CLI not found. Install Codex first: https://developers.openai.com/codex/cli/");}-/// Whether the worktrunk marketplace is configured in Codex, or `None` where-/// Codex's answer cannot be read.+/// Whether Codex lists the worktrunk marketplace, or `None` where its answer+/// cannot be read.///-/// The Codex counterpart of the Claude reader in [`super::show`], asked for-/// the same reason: `codex plugin marketplace remove` exits non-zero when the-/// marketplace is not configured. `codex plugin marketplace list --json` nests-/// its entries under `marketplaces`.+/// `codex plugin marketplace list --json` nests its entries under+/// `marketplaces` where Claude Code prints a bare array.///-/// Asking Codex is what lets this claim as much as the Claude one. Reading-/// `config.toml` could not: `codex plugin marketplace remove` deletes the-/// whole `marketplaces` key along with the last entry under it, so a config-/// whose key had been renamed was indistinguishable from one a successful-/// removal had just emptied — and the only reading that let a second-/// `uninstall` succeed was the one that reported every genuine failure as-/// `Codex plugin & marketplace removed`. Codex's own list separates them.+/// Reading `config.toml` instead could not claim as much. `codex plugin+/// marketplace remove` deletes the whole `marketplaces` key along with the+/// last entry under it, so a config whose key had been renamed looked exactly+/// like one a successful removal had just emptied, and the only reading that+/// let a second `uninstall` succeed was the one that reported every genuine+/// failure as `Codex plugin & marketplace removed`. Codex's own list+/// separates the two.////// It also drops wt's copy of Codex's `CODEX_HOME` resolution. The child/// reads the variable itself, so a rule about where Codex keeps its config is/// no longer duplicated here to drift from the real one.pub(super) fn is_marketplace_configured() -> Option<bool> {- let listed = super::plugin_marketplace_list("codex")?;- super::marketplace_listed(listed.get("marketplaces")?.as_array()?, MARKETPLACE_NAME)+ let listed = super::harness_listing("codex", &["plugin", "marketplace", "list", "--json"])?;+ super::listing_names(+ listed.get("marketplaces")?.as_array()?,+ "name",+ MARKETPLACE_NAME,+ )}diff --git a/src/commands/config/mod.rs b/src/commands/config/mod.rsindex 67cec2dea..c4a43d41e 100644--- a/src/commands/config/mod.rs+++ b/src/commands/config/mod.rs@@ -143,20 +143,19 @@ fn run_plugin_cli(program: &str, args: &[&str]) -> anyhow::Result<()> {Ok(())}-/// The JSON `<program> plugin marketplace list --json` prints, or `None` where-/// the harness did not answer.+/// The JSON a harness prints for a `--json` listing of its own state, or+/// `None` where it did not answer.///-/// Both harnesses expose this, and it is the only thing either of them will-/// say about its own marketplaces that is meant to be read by another program.-/// The alternative — reading the file the harness stores them in — is a guess+/// Every question wt asks about what another harness holds goes through here.+/// The alternative — reading the file the harness keeps them in — is a guess/// at private layout, and a guess that cannot fail loudly: a record that moved-/// looks exactly like a record that was never written, so every genuine-/// failure reads as an already-finished removal. Asking the harness has no-/// such gap, and a harness that will not answer at all leaves the question-/// open rather than answering it wrong.-fn plugin_marketplace_list(program: &str) -> Option<serde_json::Value> {+/// looks exactly like a record that was never written, so an installed plugin+/// reads as absent and a failed removal reads as one already finished. Asking+/// has no such gap, and a harness that will not answer at all leaves the+/// question open rather than answering it wrong.+fn harness_listing(program: &str, args: &[&str]) -> Option<serde_json::Value> {let output = worktrunk::shell_exec::Cmd::new(program)- .args(["plugin", "marketplace", "list", "--json"])+ .args(args.iter().copied()).run().ok()?;if !output.status.success() {@@ -165,47 +164,46 @@ fn plugin_marketplace_list(program: &str) -> Option<serde_json::Value> {serde_json::from_slice(&output.stdout).ok()}-/// Whether a harness's marketplace list names `name`, or `None` where it is-/// not a list of named marketplaces.+/// Whether any of `entries` carries `field` equal to `value`, or `None` where+/// they are not objects carrying that field as a string.////// An empty list is a confident `Some(false)`: the harness has said it holds-/// nothing. An entry that is not an object carrying a string `name` is a shape-/// this does not understand, so it answers nothing rather than reporting an-/// absence it inferred from a field that moved.-fn marketplace_listed(entries: &[serde_json::Value], name: &str) -> Option<bool> {+/// nothing. An entry of a shape this does not understand answers nothing+/// rather than reporting an absence it inferred from a field that moved.+fn listing_names(entries: &[serde_json::Value], field: &str, value: &str) -> Option<bool> {let mut listed = false;for entry in entries {- listed |= entry.get("name")?.as_str()? == name;+ listed |= entry.get(field)?.as_str()? == value;}Some(listed)}/// Run a removal whose goal is that the target is gone.///-/// Both harnesses' `plugin marketplace remove` exits non-zero when the-/// marketplace is not configured, which is the state the removal is trying to-/// reach, so running `uninstall` twice would otherwise fail with nothing left-/// to do. Asking `still_configured` after the attempt tells that apart from a-/// removal that genuinely failed, which still surfaces the harness's own-/// stderr in the gutter.+/// `claude plugin uninstall`, and both harnesses' `plugin marketplace remove`,+/// exit non-zero when the target is not there — the state the removal is+/// trying to reach — so running `uninstall` twice would otherwise fail with+/// nothing left to do. Asking `still_present` after the attempt tells that+/// apart from a removal that genuinely failed, which still surfaces the+/// harness's own stderr in the gutter.////// Only a confident `Some(false)` drops the error. `None` — the harness would-/// not list its marketplaces, or listed them in a shape this does not-/// recognize — keeps it, because an answer that could not be read has not-/// established that the removal worked. Reporting success there would fail-/// open on exactly the silent case, printing `Plugin & marketplace removed`-/// over a marketplace that is still there.+/// not list what it holds, or listed it in a shape this does not recognize —+/// keeps it, because an answer that could not be read has not established that+/// the removal worked. Reporting success there would fail open on exactly the+/// silent case, printing `Plugin & marketplace removed` over a plugin or+/// marketplace that is still there.////// The command runs either way, so the `?` preview lists what the uninstall/// actually invokes.fn run_plugin_removal(program: &str,args: &[&str],- still_configured: impl Fn() -> Option<bool>,+ still_present: impl Fn() -> Option<bool>,) -> anyhow::Result<()> {match run_plugin_cli(program, args) {Ok(()) => Ok(()),- Err(err) => match still_configured() {+ Err(err) => match still_present() {Some(false) => Ok(()),_ => Err(err),},diff --git a/src/commands/config/plugins.rs b/src/commands/config/plugins.rsindex 638247efa..a5341f0f4 100644--- a/src/commands/config/plugins.rs+++ b/src/commands/config/plugins.rs@@ -6,17 +6,24 @@ use anyhow::{Context, bail};use color_print::cformat;use worktrunk::styling::{eprintln, info_message, progress_message, success_message};-use super::show::{- claude_config_dir, is_claude_available, is_marketplace_configured, is_plugin_installed,- is_statusline_configured,-};+use super::show::{claude_config_dir, is_claude_available, is_statusline_configured};use crate::output::prompt::{PromptResponse, prompt_yes_no_preview};+const MARKETPLACE_SOURCE: &str = "max-sixty/worktrunk";+const MARKETPLACE_NAME: &str = "worktrunk";+/// `PLUGIN@MARKETPLACE` selector `claude plugin install` / `uninstall` take,+/// and the `id` Claude Code lists the plugin under.+const PLUGIN_SELECTOR: &str = "worktrunk@worktrunk";+/// Handle `wt config plugins claude install`pub fn handle_claude_install(yes: bool) -> anyhow::Result<()> {require_claude_cli()?;- if is_plugin_installed() {+ // Only a confident `Some(true)` short-circuits. Both commands below are+ // idempotent — Claude Code answers an already-installed plugin and an+ // already-added marketplace with a success — so an answer wt could not+ // read costs a redundant run rather than a wrong one.+ if is_plugin_installed() == Some(true) {eprintln!("{}", info_message("Plugin already installed"));return Ok(());}@@ -25,8 +32,10 @@ pub fn handle_claude_install(yes: bool) -> anyhow::Result<()> {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));+ let commands = format!(+ "claude plugin marketplace add {MARKETPLACE_SOURCE}\nclaude plugin install {PLUGIN_SELECTOR}"+ );+ eprintln!("{}", worktrunk::styling::format_bash_with_gutter(&commands));},)? {PromptResponse::Accepted => {}@@ -37,11 +46,11 @@ pub fn handle_claude_install(yes: bool) -> anyhow::Result<()> {eprintln!("{}", progress_message("Adding plugin from marketplace..."));super::run_plugin_cli("claude",- &["plugin", "marketplace", "add", "max-sixty/worktrunk"],+ &["plugin", "marketplace", "add", MARKETPLACE_SOURCE],)?;eprintln!("{}", progress_message("Installing plugin..."));- super::run_plugin_cli("claude", &["plugin", "install", "worktrunk@worktrunk"])?;+ super::run_plugin_cli("claude", &["plugin", "install", PLUGIN_SELECTOR])?;eprintln!("{}", success_message("Plugin installed"));@@ -52,36 +61,14 @@ pub fn handle_claude_install(yes: bool) -> anyhow::Result<()> {pub fn handle_claude_uninstall(yes: bool) -> anyhow::Result<()> {require_claude_cli()?;- // The marketplace can outlive the plugin: an uninstall that removed the- // plugin and then failed on the marketplace leaves exactly that. Asking- // only about the plugin would report "not installed" and exit 0 with the- // marketplace still there and no way left to finish the job, so the early- // return needs both halves gone. Only a confident `Some(false)` counts as- // gone, for the reason `run_plugin_removal` gives.- let plugin_installed = is_plugin_installed();- if !plugin_installed && is_marketplace_configured() == Some(false) {- eprintln!("{}", info_message("Plugin not installed"));- return Ok(());- }-- // The marketplace removal always runs, so its own tolerance decides- // whether an absent marketplace is a failure. Only the plugin step is- // conditional, and the preview says so rather than naming a command that- // will not run.- let mut commands = Vec::new();- if plugin_installed {- commands.push("claude plugin uninstall worktrunk@worktrunk");- }- commands.push("claude plugin marketplace remove worktrunk");-if !yes {match prompt_yes_no_preview(&cformat!("Uninstall Worktrunk plugin from <bold>Claude Code</>?"),|| {- eprintln!(- "{}",- worktrunk::styling::format_bash_with_gutter(&commands.join("\n"))+ let commands = format!(+ "claude plugin uninstall {PLUGIN_SELECTOR}\nclaude plugin marketplace remove {MARKETPLACE_NAME}");+ eprintln!("{}", worktrunk::styling::format_bash_with_gutter(&commands));},)? {PromptResponse::Accepted => {}@@ -89,10 +76,17 @@ pub fn handle_claude_uninstall(yes: bool) -> anyhow::Result<()> {}}- if plugin_installed {- eprintln!("{}", progress_message("Uninstalling plugin..."));- super::run_plugin_cli("claude", &["plugin", "uninstall", "worktrunk@worktrunk"])?;- }+ // Both steps run unconditionally, each tolerating only the absence Claude+ // Code itself reports. Skipping a step on a reader's say-so instead would+ // put the decision before the command rather than after it, and the two+ // halves come apart: an uninstall that removed the plugin and then failed+ // on the marketplace leaves one gone and one behind.+ eprintln!("{}", progress_message("Uninstalling plugin..."));+ super::run_plugin_removal(+ "claude",+ &["plugin", "uninstall", PLUGIN_SELECTOR],+ is_plugin_installed,+ )?;eprintln!("{}",@@ -100,7 +94,7 @@ pub fn handle_claude_uninstall(yes: bool) -> anyhow::Result<()> {);super::run_plugin_removal("claude",- &["plugin", "marketplace", "remove", "worktrunk"],+ &["plugin", "marketplace", "remove", MARKETPLACE_NAME],is_marketplace_configured,)?;@@ -109,6 +103,27 @@ pub fn handle_claude_uninstall(yes: bool) -> anyhow::Result<()> {Ok(())}+/// Whether Claude Code lists the worktrunk plugin, or `None` where its answer+/// cannot be read.+///+/// `claude plugin list --json` prints a bare array of plugin objects whose+/// `id` is the same `PLUGIN@MARKETPLACE` selector the install and uninstall+/// commands take.+pub(super) fn is_plugin_installed() -> Option<bool> {+ let listed = super::harness_listing("claude", &["plugin", "list", "--json"])?;+ super::listing_names(listed.as_array()?, "id", PLUGIN_SELECTOR)+}++/// Whether Claude Code lists the worktrunk marketplace, or `None` where its+/// answer cannot be read.+///+/// `claude plugin marketplace list --json` prints a bare array of marketplace+/// objects where Codex nests its own under `marketplaces`.+pub(super) fn is_marketplace_configured() -> Option<bool> {+ let listed = super::harness_listing("claude", &["plugin", "marketplace", "list", "--json"])?;+ super::listing_names(listed.as_array()?, "name", MARKETPLACE_NAME)+}+/// Handle `wt config plugins claude install-statusline`pub fn handle_claude_install_statusline(yes: bool) -> anyhow::Result<()> {if is_statusline_configured() {diff --git a/src/commands/config/show.rs b/src/commands/config/show.rsindex f75ed6444..72ca2ac23 100644--- a/src/commands/config/show.rs+++ b/src/commands/config/show.rs@@ -290,11 +290,17 @@ pub(super) fn home_dir() -> Option<PathBuf> {/// Get the Claude Code config directory.///-/// Honors `CLAUDE_CONFIG_DIR`, which Claude Code uses to relocate its entire-/// config tree (`settings.json`, `plugins/`, ...) away from the default-/// `~/.claude`. A leading `~/` in the value is expanded against the home-/// directory; the shell normally expands it before the variable is set, so a-/// literal `~` only reaches us when the variable is set in a non-shell context.+/// This locates `settings.json`, the one Claude Code file wt reads. It reads+/// that file because it writes it: `install-statusline` merges the+/// `statusLine` key in, and Claude Code has no command that reports the+/// setting back. Everything else wt wants to know about a harness it asks the+/// harness (see [`super::harness_listing`]).+///+/// Honors `CLAUDE_CONFIG_DIR`, which Claude Code uses to relocate its config+/// away from the default `~/.claude`. A leading `~/` in the value is expanded+/// against the home directory; the shell normally expands it before the+/// variable is set, so a literal `~` only reaches us when the variable is set+/// in a non-shell context.pub(super) fn claude_config_dir() -> Option<PathBuf> {if let Ok(dir) = std::env::var("CLAUDE_CONFIG_DIR")&& !dir.is_empty()@@ -307,47 +313,6 @@ pub(super) fn claude_config_dir() -> Option<PathBuf> {home_dir().map(|home| home.join(".claude"))}-/// Check if the worktrunk plugin is installed in Claude Code-pub(super) fn is_plugin_installed() -> bool {- let Some(config_dir) = claude_config_dir() else {- return false;- };-- let plugins_file = config_dir.join("plugins/installed_plugins.json");- let Ok(content) = std::fs::read_to_string(&plugins_file) else {- return false;- };-- let Ok(json) = serde_json::from_str::<serde_json::Value>(&content) else {- return false;- };-- json.get("plugins")- .and_then(|p| p.get("worktrunk@worktrunk"))- .is_some()-}--/// Whether the worktrunk marketplace is configured in Claude Code, or `None`-/// where Claude Code's answer cannot be read-///-/// Asked because `claude plugin marketplace remove` exits non-zero when the-/// marketplace is not there, so uninstall needs to tell that from a removal-/// that genuinely failed. `claude plugin marketplace list --json` answers it-/// as a bare array of marketplace objects.-///-/// The question goes to Claude Code rather than to the config tree-/// `is_plugin_installed` reads, because that tree records marketplaces in a-/// file whose absence means two different things. A-/// `plugins/known_marketplaces.json` Claude Code never wrote and one it has-/// since renamed or moved are the same missing path, and reading the second as-/// a confident absence would report every failed removal as-/// `Plugin & marketplace removed`. An empty list carries no such ambiguity:-/// Claude Code has said what it holds.-pub(super) fn is_marketplace_configured() -> Option<bool> {- let listed = super::plugin_marketplace_list("claude")?;- super::marketplace_listed(listed.as_array()?, "worktrunk")-}-/// Whether Claude Code's statusline runs worktrunk's.////// The question is which subcommand the configured command invokes, so it's@@ -386,9 +351,10 @@ pub(super) fn is_statusline_configured() -> bool {fn render_claude_code_status(out: &mut String) -> anyhow::Result<()> {writeln!(out, "{}", format_heading("CLAUDE CODE", None))?;- // Plugin status- let plugin_installed = is_plugin_installed();- if plugin_installed {+ // Plugin status. An answer wt could not read gets the same hint as a+ // plain absence: the install it points at is idempotent, so following it+ // is safe either way, and Claude Code's own output then says what is true.+ if super::plugins::is_plugin_installed() == Some(true) {writeln!(out, "{}", success_message("Plugin installed"))?;} else {writeln!(@@ -518,26 +484,18 @@ fn is_gemini_available() -> bool {which::which("gemini").is_ok()}-/// Check if the worktrunk extension is installed in Gemini CLI.+/// Whether Gemini CLI lists the worktrunk extension, or `None` where its+/// answer cannot be read.///-/// `gemini extensions install` clones the extension into-/// `~/.gemini/extensions/<name>/`, so a worktrunk install leaves a-/// `gemini-extension.json` whose `name` is `worktrunk` at that path.-fn is_gemini_extension_installed() -> bool {- let Some(home) = home_dir() else {- return false;- };-- let manifest = home.join(".gemini/extensions/worktrunk/gemini-extension.json");- let Ok(content) = std::fs::read_to_string(&manifest) else {- return false;- };-- let Ok(json) = serde_json::from_str::<serde_json::Value>(&content) else {- return false;- };-- json.get("name").and_then(|n| n.as_str()) == Some("worktrunk")+/// `gemini extensions list -o json` prints a bare array of extension objects+/// carrying the `name` the install was made under. The question goes to+/// Gemini for the reason [`super::harness_listing`] gives: the alternative is+/// reading `~/.gemini/extensions/`, whose layout is Gemini's to change, and a+/// layout that changed would read here as an extension that was never+/// installed.+fn is_gemini_extension_installed() -> Option<bool> {+ let listed = super::harness_listing("gemini", &["extensions", "list", "-o", "json"])?;+ super::listing_names(listed.as_array()?, "name", "worktrunk")}/// Render GEMINI CLI section (extension status).@@ -545,7 +503,7 @@ fn is_gemini_extension_installed() -> bool {fn render_gemini_status(out: &mut String) -> anyhow::Result<()> {writeln!(out, "{}", format_heading("GEMINI CLI", None))?;- if is_gemini_extension_installed() {+ if is_gemini_extension_installed() == Some(true) {writeln!(out, "{}", success_message("Extension installed"))?;} else {writeln!(diff --git a/src/testing/mod.rs b/src/testing/mod.rsindex d2305e1c8..b88cf48ec 100644--- a/src/testing/mod.rs+++ b/src/testing/mod.rs@@ -2211,15 +2211,38 @@ impl TestRepo {.write(mock_bin);}- /// Setup mock `claude` CLI as installed+ /// Setup mock `claude` CLI as installed, listing no plugins///- /// Call this after setup_mock_ci_tools_unauthenticated() to simulate- /// Claude Code being available on the system.+ /// `wt config show` and the plugin commands ask Claude Code what it+ /// holds, so a test that says Claude Code is available has to put a mock+ /// on `PATH` to answer — otherwise the question reaches whatever `claude`+ /// the developer has installed, and the answer is their own plugin list.+ /// Call `setup_mock_ci_tools_unauthenticated()` first.pub fn setup_mock_claude_installed(&mut self) {- // Mark Claude as installed for test environment+ self.write_claude_plugin_list(MockResponse::output("[]"));+ self.claude_installed = true;+ }++ /// Setup mock `claude` CLI as installed, listing the worktrunk plugin+ ///+ /// The counterpart of [`Self::setup_mock_claude_installed`] for the state+ /// after a successful install.+ pub fn setup_mock_claude_with_plugin_installed(&mut self) {+ self.write_claude_plugin_list(MockResponse::output(Self::CLAUDE_PLUGINS_WITH_WORKTRUNK));self.claude_installed = true;}+ /// Write a `claude` mock whose only answer is `plugin list --json`.+ fn write_claude_plugin_list(&self, list: MockResponse) {+ let mock_bin = self+ .mock_bin_path+ .as_ref()+ .expect("call setup_mock_ci_tools_unauthenticated() first");+ MockConfig::new("claude")+ .command("plugin list", list)+ .write(mock_bin);+ }+/// Setup mock `codex` CLI as installed////// Call this after setup_mock_ci_tools_unauthenticated() to simulate@@ -2228,27 +2251,20 @@ impl TestRepo {self.codex_installed = true;}- /// Setup the worktrunk plugin as installed in Claude Code+ /// `claude plugin list --json` holding the worktrunk plugin///- /// Creates the installed_plugins.json file in the temp home directory.- /// The temp_home must already be set up (via set_temp_home_env on the command).- pub fn setup_plugin_installed(temp_home: &std::path::Path) {- let plugins_dir = temp_home.join(".claude/plugins");- std::fs::create_dir_all(&plugins_dir).unwrap();- std::fs::write(- plugins_dir.join("installed_plugins.json"),- r#"{"version":2,"plugins":{"worktrunk@worktrunk":[{"scope":"user"}]}}"#,- )- .unwrap();- }+ /// Claude Code prints a bare array of plugin objects whose `id` is the+ /// `PLUGIN@MARKETPLACE` selector its install and uninstall commands take.+ pub const CLAUDE_PLUGINS_WITH_WORKTRUNK: &'static str =+ r#"[{"id":"worktrunk@worktrunk","version":"9f13c0a41e57","scope":"user","enabled":true}]"#;/// `claude plugin marketplace list --json` holding the worktrunk/// marketplace////// Claude Code prints a bare array of marketplace objects. These bodies- /// are the mock's stdout rather than a config-file fixture, because- /// `is_marketplace_configured` asks the harness what it holds instead of- /// reading the file the harness keeps it in.+ /// are the mock's stdout rather than a config-file fixture, because wt+ /// asks the harness what it holds instead of reading the file the harness+ /// keeps it in.pub const CLAUDE_MARKETPLACES_WITH_WORKTRUNK: &'static str =r#"[{"name":"worktrunk","source":"github","repo":"max-sixty/worktrunk"}]"#;@@ -2305,13 +2321,41 @@ impl TestRepo {.unwrap();}- /// Setup mock `gemini` CLI as installed+ /// Setup mock `gemini` CLI as installed, listing no extensions///- /// Call this to simulate Gemini CLI being available on the system.+ /// Like [`Self::setup_mock_claude_installed`], the mock has to be on+ /// `PATH` to answer, or the question reaches the developer's own Gemini+ /// CLI. Call `setup_mock_ci_tools_unauthenticated()` first.pub fn setup_mock_gemini_installed(&mut self) {+ self.write_gemini_extensions_list(MockResponse::output("[]"));self.gemini_installed = true;}+ /// Setup mock `gemini` CLI as installed, listing the worktrunk extension+ pub fn setup_mock_gemini_with_extension_installed(&mut self) {+ self.write_gemini_extensions_list(MockResponse::output(+ Self::GEMINI_EXTENSIONS_WITH_WORKTRUNK,+ ));+ self.gemini_installed = true;+ }++ /// `gemini extensions list -o json` holding the worktrunk extension+ ///+ /// Gemini CLI prints a bare array of extension objects carrying the+ /// `name` the extension was installed under.+ pub const GEMINI_EXTENSIONS_WITH_WORKTRUNK: &'static str = r#"[{"name":"worktrunk","version":"0.77.0","path":"/extensions/worktrunk","isActive":true}]"#;++ /// Write a `gemini` mock whose only answer is `extensions list -o json`.+ fn write_gemini_extensions_list(&self, list: MockResponse) {+ let mock_bin = self+ .mock_bin_path+ .as_ref()+ .expect("call setup_mock_ci_tools_unauthenticated() first");+ MockConfig::new("gemini")+ .command("extensions list", list)+ .write(mock_bin);+ }+/// Make `claude`, `codex`, `opencode`, `omp`, and `gemini` resolvable on `PATH`.////// The `setup_mock_*_installed` helpers force detection through the@@ -2326,30 +2370,15 @@ impl TestRepo {.mock_bin_path.as_ref().expect("call setup_mock_ci_tools_unauthenticated() first");- // `wt config show` only `which`-detects these CLIs (never runs- // them), so the mocks need no command behavior.+ // The mocks answer nothing, so each `--json` listing `wt config show`+ // asks for fails and the section renders its "not installed" hint.+ // What this test covers is the `which::which` detection above it.for cli in ["claude", "codex", "opencode", "omp", "gemini"] {MockConfig::new(cli).write(mock_bin);}self.detect_clis_via_path = true;}- /// Setup the worktrunk extension as installed in Gemini CLI- ///- /// `gemini extensions install` clones the extension into- /// `~/.gemini/extensions/<name>/`; this writes the resulting- /// `gemini-extension.json` under the temp home directory (which must- /// already be set up via `set_temp_home_env` on the command).- pub fn setup_gemini_extension_installed(temp_home: &std::path::Path) {- let extension_dir = temp_home.join(".gemini/extensions/worktrunk");- std::fs::create_dir_all(&extension_dir).unwrap();- std::fs::write(- extension_dir.join("gemini-extension.json"),- include_str!("../../gemini-extension.json"),- )- .unwrap();- }-/// Setup mock `claude` CLI with plugin subcommand support////// Creates a mock claude binary that handles `plugin marketplace`,@@ -2363,10 +2392,11 @@ impl TestRepo {MockConfig::new("claude").command("plugin marketplace", MockResponse::exit(0))- // Uninstall asks what Claude Code holds before deciding the- // marketplace is gone, so a mock that answered nothing would leave- // the question open on every path that reaches it.+ // Uninstall asks what Claude Code holds before deciding a target+ // is already gone, so a mock that answered nothing would leave the+ // question open on every path that reaches it..command("plugin marketplace list", MockResponse::output("[]"))+ .command("plugin list", MockResponse::output("[]")).command("plugin install", MockResponse::exit(0)).command("plugin uninstall", MockResponse::exit(0)).write(mock_bin);@@ -2422,6 +2452,7 @@ impl TestRepo {MockResponse::exit(1).with_stderr("error: marketplace remove failed\n"),).command("plugin marketplace list", list)+ .command("plugin list", MockResponse::output("[]")).command("plugin install", MockResponse::exit(0)).command("plugin uninstall", MockResponse::exit(0)).write(mock_bin);@@ -2482,12 +2513,16 @@ impl TestRepo {self.codex_installed = true;}- /// Setup mock `claude` CLI where plugin commands fail+ /// Setup mock `claude` CLI where plugin commands fail, answering+ /// `plugin list --json` with `list`///- /// 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) {+ /// Creates a mock claude binary where `plugin marketplace`, `plugin+ /// install`, and `plugin uninstall` all exit with code 1 and print an+ /// error. `list` is what the install short-circuits on and what decides+ /// whether the failed uninstall is genuine, so each caller says which+ /// state it is failing from. Must call+ /// `setup_mock_ci_tools_unauthenticated()` first.+ pub fn setup_mock_claude_with_plugins_failing(&mut self, list: MockResponse) {let mock_bin = self.mock_bin_path.as_ref()@@ -2506,6 +2541,7 @@ impl TestRepo {"plugin uninstall",MockResponse::exit(1).with_stderr("error: uninstall failed\n"),)+ .command("plugin list", list).write(mock_bin);self.claude_installed = true;diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rsindex be9851f62..1b32110e8 100644--- a/tests/integration_tests/config_show.rs+++ b/tests/integration_tests/config_show.rs@@ -2201,9 +2201,8 @@ fn test_config_show_shell_active_but_not_in_config_file(mut repo: TestRepo, tempfn test_config_show_plugin_installed(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic outputrepo.setup_mock_ci_tools_unauthenticated();- // Setup mock claude CLI and plugin as installed- repo.setup_mock_claude_installed();- TestRepo::setup_plugin_installed(temp_home.path());+ // Setup mock claude CLI listing the worktrunk plugin+ repo.setup_mock_claude_with_plugin_installed();// Create global configlet global_config_dir = temp_home.path().join(".config").join("worktrunk");@@ -2258,9 +2257,8 @@ fn test_config_show_claude_available_plugin_not_installed(mut repo: TestRepo, tefn test_config_show_statusline_configured(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic outputrepo.setup_mock_ci_tools_unauthenticated();- // Setup mock claude CLI, plugin, AND statusline- repo.setup_mock_claude_installed();- TestRepo::setup_plugin_installed(temp_home.path());+ // Setup mock claude CLI listing the plugin, AND the statusline+ repo.setup_mock_claude_with_plugin_installed();TestRepo::setup_statusline_configured(temp_home.path());// Create global config@@ -2477,44 +2475,12 @@ fn test_config_show_gemini_available_extension_not_installed(});}-#[rstest]-fn test_config_show_gemini_extension_invalid_manifest(mut repo: TestRepo, temp_home: TempDir) {- // A malformed gemini-extension.json should fall through the JSON-parse- // branch and report the extension as not installed (the install hint).- repo.setup_mock_ci_tools_unauthenticated();- repo.setup_mock_gemini_installed();-- let extension_dir = temp_home.path().join(".gemini/extensions/worktrunk");- fs::create_dir_all(&extension_dir).unwrap();- fs::write(extension_dir.join("gemini-extension.json"), "not json\n").unwrap();-- let global_config_dir = temp_home.path().join(".config").join("worktrunk");- fs::create_dir_all(&global_config_dir).unwrap();- fs::write(- global_config_dir.join("config.toml"),- r#"worktree-path = "../{{ repo }}.{{ branch }}"-"#,- )- .unwrap();-- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);- settings.bind(|| {- let mut cmd = repo.wt_command();- cmd.arg("config").arg("show").current_dir(repo.root_path());- set_temp_home_env(&mut cmd, temp_home.path());- set_xdg_config_path(&mut cmd, temp_home.path());-- assert_cmd_snapshot!(cmd);- });-}-#[rstest]fn test_config_show_gemini_extension_installed(mut repo: TestRepo, temp_home: TempDir) {// Setup mock gh/glab for deterministic outputrepo.setup_mock_ci_tools_unauthenticated();- // Setup mock gemini CLI and extension as installed- repo.setup_mock_gemini_installed();- TestRepo::setup_gemini_extension_installed(temp_home.path());+ // Setup mock gemini CLI listing the worktrunk extension+ repo.setup_mock_gemini_with_extension_installed();// Create global configlet global_config_dir = temp_home.path().join(".config").join("worktrunk");@@ -4097,33 +4063,10 @@ fn test_plugins_claude_install(mut repo: TestRepo, temp_home: TempDir) {});}-#[rstest]-fn test_plugins_claude_install_invalid_plugins_json(mut repo: TestRepo, temp_home: TempDir) {- repo.setup_mock_ci_tools_unauthenticated();- repo.setup_mock_claude_with_plugins();-- // Write invalid JSON to the plugins file — is_plugin_installed() should- // treat this as "not installed" and the install command should proceed- let plugins_dir = temp_home.path().join(".claude/plugins");- fs::create_dir_all(&plugins_dir).unwrap();- fs::write(plugins_dir.join("installed_plugins.json"), "not valid json").unwrap();-- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);- settings.bind(|| {- let mut cmd = repo.wt_command();- 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());+ repo.setup_mock_claude_with_plugin_installed();let settings = setup_snapshot_settings_with_home(&repo, &temp_home);settings.bind(|| {@@ -4154,7 +4097,6 @@ fn test_plugins_claude_install_claude_not_found(repo: TestRepo) {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(|| {@@ -4167,11 +4109,28 @@ fn test_plugins_claude_uninstall(mut repo: TestRepo, temp_home: TempDir) {});}+/// The plugin removal's goal is that the plugin is gone, so Claude Code+/// listing no plugins is that goal already met. `claude plugin uninstall`+/// exits non-zero once the plugin is absent, and the command has to succeed+/// anyway — and go on to the marketplace, which a first `uninstall` that+/// removed the plugin and then failed on the marketplace leaves behind.#[rstest]-fn test_plugins_claude_uninstall_not_installed(mut repo: TestRepo, temp_home: TempDir) {+fn test_plugins_claude_uninstall_tolerates_absent_plugin(mut repo: TestRepo, temp_home: TempDir) {+ use crate::common::mock_commands::MockConfig;+repo.setup_mock_ci_tools_unauthenticated();- repo.setup_mock_claude_with_plugins();- // Don't setup plugin as installed+ repo.setup_mock_claude_installed();+ let mock_bin = repo+ .mock_bin_path()+ .expect("setup_mock_ci_tools_unauthenticated creates mock-bin");+ MockConfig::new("claude")+ .command(+ "plugin uninstall",+ MockResponse::exit(1).with_stderr("error: plugin not found\n"),+ )+ .command("plugin list", MockResponse::output("[]"))+ .command("plugin marketplace remove", MockResponse::exit(0))+ .write(mock_bin);let settings = setup_snapshot_settings_with_home(&repo, &temp_home);settings.bind(|| {@@ -4404,6 +4363,8 @@ fn test_plugins_claude_prompt_previews_commands(mut repo: TestRepo) {// untracked file behind the command under test.let call_log = TempDir::new().unwrap();+ let temp_home = TempDir::new().unwrap();+for (action, expected) in [("install",@@ -4420,14 +4381,6 @@ fn test_plugins_claude_prompt_previews_commands(mut repo: TestRepo) {],),] {- // Each subcommand prompts only from the state it acts on, so the home- // is per-action: install returns early when the plugin is already- // installed, uninstall when it isn't.- let temp_home = TempDir::new().unwrap();- if action == "uninstall" {- TestRepo::setup_plugin_installed(temp_home.path());- }-let mut cmd = repo.wt_command();cmd.args(["config", "plugins", "claude", action]).current_dir(repo.root_path())@@ -4456,11 +4409,20 @@ fn test_plugins_claude_prompt_previews_commands(mut repo: TestRepo) {.filter_map(|line| line.find("claude ").map(|i| line[i..].trim_end())).collect();assert_eq!(previewed, expected, "{action} preview: {stderr}");- // The preview is only a preview: declining must leave claude unspawned.- let calls = mock_calls(call_log.path(), "claude");+ // The preview is only a preview: declining must run none of the+ // commands it listed. `claude plugin list --json` is a read the+ // subcommand makes to decide, not one of the commands it previews, so+ // the log is filtered to the calls that change something.+ let mutations = |calls: Vec<String>| -> Vec<String> {+ calls+ .into_iter()+ .filter(|call| !call.ends_with("--json"))+ .collect()+ };+ let calls = mutations(mock_calls(call_log.path(), "claude"));assert!(calls.is_empty(),- "declining {action} must spawn no claude: {calls:#?}"+ "declining {action} must run none of its commands: {calls:#?}");// Both sides of the comparison above are the preview text, so nothing@@ -4469,7 +4431,12 @@ fn test_plugins_claude_prompt_previews_commands(mut repo: TestRepo) {// thing that can here: `setup_mock_claude_with_plugins` registers the// `plugin marketplace` prefix, which matches `add` and `remove` alike,// so a wrong marketplace name still reaches the mock's exit 0.- let ran = plugin_calls_when_accepted(&repo, "claude", action, temp_home.path());+ let ran = mutations(plugin_calls_when_accepted(+ &repo,+ "claude",+ action,+ temp_home.path(),+ ));// `mock_calls` records argv without argv[0]; `expected` carries the// binary name because that is how the preview renders it.let want: Vec<String> = expected@@ -4509,44 +4476,6 @@ fn test_plugins_claude_uninstall_tolerates_absent_marketplace() {repo.setup_mock_ci_tools_unauthenticated();repo.setup_mock_claude_with_marketplace_remove_failing(MockResponse::output("[]"));- TestRepo::setup_plugin_installed(temp_home.path());-- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);- settings.bind(|| {- let mut cmd = repo.wt_command();- 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);- });-}--/// A first `uninstall` that removed the plugin and then failed on the-/// marketplace leaves the marketplace behind. Re-running has to finish that-/// job rather than reporting "Plugin not installed" and exiting 0 with the-/// marketplace still configured.-#[rstest]-fn test_plugins_claude_uninstall_removes_marketplace_left_without_plugin(- mut repo: TestRepo,- temp_home: TempDir,-) {- use crate::common::mock_commands::MockConfig;-- repo.setup_mock_ci_tools_unauthenticated();- repo.setup_mock_claude_installed();- // No `installed_plugins.json`: the plugin is already gone, and only the- // marketplace Claude Code still lists is left to remove.- let mock_bin = repo- .mock_bin_path()- .expect("setup_mock_ci_tools_unauthenticated creates mock-bin");- MockConfig::new("claude")- .command("plugin marketplace remove", MockResponse::exit(0))- .command(- "plugin marketplace list",- MockResponse::output(TestRepo::CLAUDE_MARKETPLACES_WITH_WORKTRUNK),- )- .write(mock_bin);let settings = setup_snapshot_settings_with_home(&repo, &temp_home);settings.bind(|| {@@ -4570,7 +4499,6 @@ fn test_plugins_claude_uninstall_tolerates_marketplace_missing_from_list(repo.setup_mock_claude_with_marketplace_remove_failing(MockResponse::output(TestRepo::CLAUDE_MARKETPLACES_WITHOUT_WORKTRUNK,));- TestRepo::setup_plugin_installed(temp_home.path());let settings = setup_snapshot_settings_with_home(&repo, &temp_home);settings.bind(|| {@@ -4599,7 +4527,6 @@ fn test_plugins_claude_uninstall_surfaces_failure_when_list_unusable() {repo.setup_mock_ci_tools_unauthenticated();repo.setup_mock_claude_with_marketplace_remove_failing(list);- TestRepo::setup_plugin_installed(temp_home.path());let mut cmd = repo.wt_command();cmd.args(["config", "plugins", "claude", "uninstall", "--yes"])@@ -6156,7 +6083,9 @@ fn test_plugins_claude_install_statusline_falls_back_to_dot_claude(#[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();+ // Claude Code lists no plugins, so the install runs rather than+ // short-circuiting, and its first command is the one that fails.+ repo.setup_mock_claude_with_plugins_failing(MockResponse::output("[]"));let settings = setup_snapshot_settings_with_home(&repo, &temp_home);settings.bind(|| {@@ -6182,6 +6111,7 @@ fn test_plugins_claude_install_second_step_fails(mut repo: TestRepo, temp_home:.expect("setup_mock_ci_tools_unauthenticated creates mock-bin");MockConfig::new("claude").command("plugin marketplace", MockResponse::exit(0))+ .command("plugin list", MockResponse::output("[]")).command("plugin install",MockResponse::exit(1).with_stderr("error: install failed\n"),@@ -6202,8 +6132,11 @@ fn test_plugins_claude_install_second_step_fails(mut repo: TestRepo, temp_home:#[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());+ // Claude Code still lists the plugin after the failed removal, which is+ // what makes the failure genuine rather than an already-finished job.+ repo.setup_mock_claude_with_plugins_failing(MockResponse::output(+ TestRepo::CLAUDE_PLUGINS_WITH_WORKTRUNK,+ ));let settings = setup_snapshot_settings_with_home(&repo, &temp_home);settings.bind(|| {@@ -6225,7 +6158,6 @@ fn test_plugins_claude_uninstall_second_step_fails(mut repo: TestRepo, temp_homerepo.setup_mock_ci_tools_unauthenticated();repo.setup_mock_claude_installed();- TestRepo::setup_plugin_installed(temp_home.path());// Plugin uninstall succeeds and only the marketplace removal that follows// it fails, so the error the command surfaces can come from nothing else.@@ -6463,7 +6395,6 @@ mod plugin_prompt_pty {fn test_plugins_claude_uninstall_prompt_accept(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 env_vars = plugin_env_vars(&repo);let cmd = build_pty_command(@@ -6490,7 +6421,6 @@ mod plugin_prompt_pty {fn test_plugins_claude_uninstall_prompt_decline(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 env_vars = plugin_env_vars(&repo);let cmd = build_pty_command(diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_gemini_extension_invalid_manifest.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_gemini_extension_invalid_manifest.snapdeleted file mode 100644index b7a9d9fd0..000000000--- a/tests/snapshots/integration__integration_tests__config_show__config_show_gemini_extension_invalid_manifest.snap+++ /dev/null@@ -1,81 +0,0 @@-----source: tests/integration_tests/config_show.rs-info:- program: wt- args:- - config- - show- 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: "1"- 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 ------[36mUSER CONFIG[39m @ ~/.config/worktrunk/config.toml-[107m [0m [2mworktree-path = [0m[2m[32m"../{{ repo }}.{{ branch }}"[0m-[2m↳[22m [2mOptional system config not found @ [2m/etc/xdg/worktrunk/config.toml[22m[22m--[36mPROJECT CONFIG[39m @ _REPO_/.config/wt.toml-[2m○[22m Identifier: [1m../origin[22m-[2m↳[22m [2mNot found[22m--[36mSHELL INTEGRATION[39m-[33m▲[39m [33mShell integration not configured[39m-[2m↳[22m [2mTo configure, run [4mwt config shell install[24m[22m-[107m [0m Invoked as: [1m[PROJECT_ROOT]/target/[BUILD_MODE]/wt[22m--[36mGEMINI CLI[39m-[2m↳[22m [2mExtension not installed. To install, run [4mgemini extensions install https://github.com/max-sixty/worktrunk[24m[22m--[36mOTHER[39m-[2m○[22m wt: [1m[VERSION][22m-[2m○[22m git: [1m[VERSION][22m-[2m○[22m Hyperlinks: [1minactive[22m------- stderr -----diff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_invalid_plugins_json.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_invalid_plugins_json.snapdeleted file mode 100644index 97e635ac1..000000000--- a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_install_invalid_plugins_json.snap+++ /dev/null@@ -1,67 +0,0 @@-----source: tests/integration_tests/config_show.rs-info:- program: wt- args:- - config- - plugins- - claude- - install- - "--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: "1"- 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 ------[36m◎[39m [36mAdding plugin from marketplace...[39m-[36m◎[39m [36mInstalling plugin...[39m-[32m✓[39m [32mPlugin installed[39mdiff --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.snapdeleted file mode 100644index 52ec06848..000000000--- a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_not_installed.snap+++ /dev/null@@ -1,65 +0,0 @@-----source: tests/integration_tests/config_show.rs-info:- program: wt- args:- - config- - plugins- - claude- - uninstall- - "--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: "1"- 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 ------[2m○[22m Plugin not installeddiff --git a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_removes_marketplace_left_without_plugin.snap b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_tolerates_absent_plugin.snapsimilarity index 97%rename from tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_removes_marketplace_left_without_plugin.snaprename to tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_tolerates_absent_plugin.snapindex 6c3953828..4b849b580 100644--- a/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_removes_marketplace_left_without_plugin.snap+++ b/tests/snapshots/integration__integration_tests__config_show__plugins_claude_uninstall_tolerates_absent_plugin.snap@@ -62,5 +62,6 @@ exit_code: 0----- stdout ---------- stderr -----+[36m◎[39m [36mUninstalling plugin...[39m[36m◎[39m [36mRemoving Claude Code plugin marketplace...[39m[32m✓[39m [32mPlugin & marketplace removed[39mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_plugins_claude_uninstall.snap b/tests/snapshots/integration__integration_tests__help__help_config_plugins_claude_uninstall.snapindex 18d3eff55..336dbc786 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_plugins_claude_uninstall.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_plugins_claude_uninstall.snap@@ -74,6 +74,6 @@ Uninstalls the Worktrunk plugin from Claude Code and removes its marketplace. Eq[107m [0m [2m[0m[2m[34mclaude[0m[2m plugin uninstall worktrunk@worktrunk[0m[107m [0m [2m[0m[2m[34mclaude[0m[2m plugin marketplace remove worktrunk[0m-Requires [2mclaude[0m CLI. Skips gracefully only when both are already gone. An uninstall that removed the plugin and then failed leaves the marketplace behind; running it again removes that half.+Requires [2mclaude[0m CLI. Both removals run every time, tolerating only the "already gone" error Claude Code itself reports. Running it again is safe, and finishes an uninstall that removed the plugin and then failed on the marketplace.----- stderr -----