(&self, ctx: &InstallContext)
| 45 | } |
| 46 | |
| 47 | fn install(&self, ctx: &InstallContext) -> Result<()> { |
| 48 | // 1. Antigravity IDE config (~/.gemini/antigravity/mcp_config.json) |
| 49 | let mcp_path = mcp_config_path(&ctx.home); |
| 50 | if let Some(parent) = mcp_path.parent() { |
| 51 | std::fs::create_dir_all(parent).ok(); |
| 52 | } |
| 53 | let backup = backup_config_file(&mcp_path)?; |
| 54 | let mut settings = match load_json_file_strict(&mcp_path) { |
| 55 | Ok(v) => v, |
| 56 | Err(e) => { |
| 57 | if let Some(ref b) = backup { |
| 58 | eprintln!(" Backup preserved at: {}", b.display()); |
| 59 | } |
| 60 | return Err(e); |
| 61 | } |
| 62 | }; |
| 63 | settings["mcpServers"]["tracedecay"] = json!({ |
| 64 | "command": ctx.tracedecay_bin, |
| 65 | "args": ["serve"] |
| 66 | }); |
| 67 | safe_write_json_file(&mcp_path, &settings, backup.as_deref())?; |
| 68 | eprintln!( |
| 69 | "\x1b[32m✔\x1b[0m Added tracedecay MCP server to {}", |
| 70 | mcp_path.display() |
| 71 | ); |
| 72 | |
| 73 | // 2. Antigravity CLI plugin (~/.gemini/antigravity-cli/plugins/tracedecay.json). |
| 74 | // Same shape as the IDE config; required because the IDE config is |
| 75 | // not picked up by the CLI (#85). |
| 76 | let plugin_path = cli_plugin_path(&ctx.home); |
| 77 | if let Some(parent) = plugin_path.parent() { |
| 78 | std::fs::create_dir_all(parent).ok(); |
| 79 | } |
| 80 | let plugin_backup = backup_config_file(&plugin_path)?; |
| 81 | let plugin_settings = json!({ |
| 82 | "mcpServers": { |
| 83 | "tracedecay": { |
| 84 | "command": ctx.tracedecay_bin, |
| 85 | "args": ["serve"], |
| 86 | } |
| 87 | } |
| 88 | }); |
| 89 | safe_write_json_file(&plugin_path, &plugin_settings, plugin_backup.as_deref())?; |
| 90 | eprintln!( |
| 91 | "\x1b[32m✔\x1b[0m Added tracedecay CLI plugin to {}", |
| 92 | plugin_path.display() |
| 93 | ); |
| 94 | |
| 95 | eprintln!(); |
| 96 | eprintln!("Setup complete. Next steps:"); |
| 97 | eprintln!(" 1. cd into your project and run: tracedecay init"); |
| 98 | eprintln!( |
| 99 | " 2. Restart Antigravity (IDE or `agy` CLI) — tracedecay tools are now available" |
| 100 | ); |
| 101 | Ok(()) |
| 102 | } |
| 103 | |
| 104 | fn uninstall(&self, ctx: &InstallContext) -> Result<()> { |
nothing calls this directly
no test coverage detected