| 214 | } |
| 215 | |
| 216 | fn update_plugin(&self, ctx: &InstallContext) -> Result<UpdatePluginOutcome> { |
| 217 | // The managed agent file is the only generated artifact (it bakes the |
| 218 | // tracedecay binary path into its hook commands). The shared MCP |
| 219 | // config, CLI default-agent setting, and steering rules are config — |
| 220 | // they stay untouched. A user-managed agent file is never rewritten. |
| 221 | let agent_path = managed_agent_path(&ctx.home); |
| 222 | if !is_owned_agent_file(&agent_path) { |
| 223 | return Ok(UpdatePluginOutcome::NotInstalled); |
| 224 | } |
| 225 | let skill_index_path = managed_skill_index_path(&ctx.home); |
| 226 | install_managed_agent( |
| 227 | &agent_path, |
| 228 | &ctx.tracedecay_bin, |
| 229 | &steering_path(&ctx.home), |
| 230 | &ctx.home, |
| 231 | Some(&skill_index_path), |
| 232 | )?; |
| 233 | Ok(UpdatePluginOutcome::Refreshed(vec![agent_path])) |
| 234 | } |
| 235 | |
| 236 | fn uninstall(&self, ctx: &InstallContext) -> Result<()> { |
| 237 | uninstall_mcp_server(&mcp_config_path(&ctx.home)); |