Remove Claude Code agent configs. */
| 10353 | |
| 10354 | /* Remove Claude Code agent configs. */ |
| 10355 | static void uninstall_claude_code(const char *home, bool dry_run) { |
| 10356 | char installed_binary[CLI_BUF_1K]; |
| 10357 | cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary)); |
| 10358 | char config_dir[CLI_BUF_1K]; |
| 10359 | cbm_claude_config_dir(home, config_dir, sizeof(config_dir)); |
| 10360 | char user_root[CLI_BUF_1K]; |
| 10361 | cbm_claude_user_root(home, user_root, sizeof(user_root)); |
| 10362 | |
| 10363 | char skills_dir[CLI_BUF_1K]; |
| 10364 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir); |
| 10365 | int removed = cbm_remove_skills(skills_dir, dry_run); |
| 10366 | printf("Claude Code: removed %d skill(s)\n", removed); |
| 10367 | char agent_path[CLI_BUF_1K]; |
| 10368 | snprintf(agent_path, sizeof(agent_path), "%s/agents/codebase-memory.md", config_dir); |
| 10369 | uninstall_tiered_agent_profiles( |
| 10370 | (cbm_tiered_profile_set_t){ |
| 10371 | .label = "Claude Code", |
| 10372 | .verify_path = agent_path, |
| 10373 | .binary_path = installed_binary, |
| 10374 | .legacy_verify_content = legacy_claude_verify_agent_content, |
| 10375 | .dialect = CBM_GRAPH_DIALECT_CLAUDE, |
| 10376 | }, |
| 10377 | dry_run); |
| 10378 | |
| 10379 | char mcp_path[CLI_BUF_1K]; |
| 10380 | snprintf(mcp_path, sizeof(mcp_path), "%s/.mcp.json", config_dir); |
| 10381 | if (!dry_run && cbm_remove_editor_mcp_owned(installed_binary, mcp_path) != CLI_OK) { |
| 10382 | record_agent_config_error(true, "Claude Code", "legacy_mcp_uninstall", mcp_path); |
| 10383 | } |
| 10384 | printf(" removed MCP config entry\n"); |
| 10385 | |
| 10386 | char mcp_path2[CLI_BUF_1K]; |
| 10387 | snprintf(mcp_path2, sizeof(mcp_path2), "%s/.claude.json", user_root); |
| 10388 | if (!dry_run && cbm_remove_editor_mcp_owned(installed_binary, mcp_path2) != CLI_OK) { |
| 10389 | record_agent_config_error(true, "Claude Code", "mcp_uninstall", mcp_path2); |
| 10390 | } |
| 10391 | |
| 10392 | char settings_path[CLI_BUF_1K]; |
| 10393 | snprintf(settings_path, sizeof(settings_path), "%s/settings.json", config_dir); |
| 10394 | if (!dry_run) { |
| 10395 | if (cbm_remove_claude_hooks(settings_path) != CLI_OK) { |
| 10396 | record_agent_config_error(true, "Claude Code", "pretool_hook_uninstall", settings_path); |
| 10397 | } |
| 10398 | if (cbm_remove_session_hooks(settings_path) != CLI_OK) { |
| 10399 | record_agent_config_error(true, "Claude Code", "session_hook_uninstall", settings_path); |
| 10400 | } |
| 10401 | if (cbm_remove_claude_subagent_hooks(settings_path) != CLI_OK) { |
| 10402 | record_agent_config_error(true, "Claude Code", "subagent_hook_uninstall", |
| 10403 | settings_path); |
| 10404 | } |
| 10405 | char current_gate[CLI_BUF_8K]; |
| 10406 | char current_session[CLI_BUF_8K]; |
| 10407 | char current_subagent[CLI_BUF_8K]; |
| 10408 | char released_gate[CLI_BUF_8K]; |
| 10409 | const char *const gate_legacy[] = {released_gate}; |
| 10410 | const char *const session_legacy[] = {cmm_released_session_script}; |
| 10411 | const char *const subagent_legacy[] = {cmm_released_subagent_script}; |
| 10412 | size_t gate_legacy_count = cbm_build_released_gate_script(installed_binary, released_gate, |
no test coverage detected