Remove Claude Code agent configs. */
| 9788 | |
| 9789 | /* Remove Claude Code agent configs. */ |
| 9790 | static void uninstall_claude_code(const char *home, bool dry_run) { |
| 9791 | char installed_binary[CLI_BUF_1K]; |
| 9792 | cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary)); |
| 9793 | char config_dir[CLI_BUF_1K]; |
| 9794 | cbm_claude_config_dir(home, config_dir, sizeof(config_dir)); |
| 9795 | char user_root[CLI_BUF_1K]; |
| 9796 | cbm_claude_user_root(home, user_root, sizeof(user_root)); |
| 9797 | |
| 9798 | char skills_dir[CLI_BUF_1K]; |
| 9799 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir); |
| 9800 | int removed = cbm_remove_skills(skills_dir, dry_run); |
| 9801 | printf("Claude Code: removed %d skill(s)\n", removed); |
| 9802 | char agent_path[CLI_BUF_1K]; |
| 9803 | snprintf(agent_path, sizeof(agent_path), "%s/agents/codebase-memory.md", config_dir); |
| 9804 | uninstall_tiered_agent_profiles( |
| 9805 | (cbm_tiered_profile_set_t){ |
| 9806 | .label = "Claude Code", |
| 9807 | .verify_path = agent_path, |
| 9808 | .binary_path = installed_binary, |
| 9809 | .legacy_verify_content = legacy_claude_verify_agent_content, |
| 9810 | .dialect = CBM_GRAPH_DIALECT_CLAUDE, |
| 9811 | }, |
| 9812 | dry_run); |
| 9813 | |
| 9814 | char mcp_path[CLI_BUF_1K]; |
| 9815 | snprintf(mcp_path, sizeof(mcp_path), "%s/.mcp.json", config_dir); |
| 9816 | if (!dry_run && cbm_remove_editor_mcp_owned(installed_binary, mcp_path) != CLI_OK) { |
| 9817 | record_agent_config_error(true, "Claude Code", "legacy_mcp_uninstall", mcp_path); |
| 9818 | } |
| 9819 | printf(" removed MCP config entry\n"); |
| 9820 | |
| 9821 | char mcp_path2[CLI_BUF_1K]; |
| 9822 | snprintf(mcp_path2, sizeof(mcp_path2), "%s/.claude.json", user_root); |
| 9823 | if (!dry_run && cbm_remove_editor_mcp_owned(installed_binary, mcp_path2) != CLI_OK) { |
| 9824 | record_agent_config_error(true, "Claude Code", "mcp_uninstall", mcp_path2); |
| 9825 | } |
| 9826 | |
| 9827 | char settings_path[CLI_BUF_1K]; |
| 9828 | snprintf(settings_path, sizeof(settings_path), "%s/settings.json", config_dir); |
| 9829 | if (!dry_run) { |
| 9830 | if (cbm_remove_claude_hooks(settings_path) != CLI_OK) { |
| 9831 | record_agent_config_error(true, "Claude Code", "pretool_hook_uninstall", settings_path); |
| 9832 | } |
| 9833 | if (cbm_remove_session_hooks(settings_path) != CLI_OK) { |
| 9834 | record_agent_config_error(true, "Claude Code", "session_hook_uninstall", settings_path); |
| 9835 | } |
| 9836 | if (cbm_remove_claude_subagent_hooks(settings_path) != CLI_OK) { |
| 9837 | record_agent_config_error(true, "Claude Code", "subagent_hook_uninstall", |
| 9838 | settings_path); |
| 9839 | } |
| 9840 | char current_gate[CLI_BUF_8K]; |
| 9841 | char current_session[CLI_BUF_8K]; |
| 9842 | char current_subagent[CLI_BUF_8K]; |
| 9843 | char released_gate[CLI_BUF_8K]; |
| 9844 | const char *const gate_legacy[] = {released_gate}; |
| 9845 | const char *const session_legacy[] = {cmm_released_session_script}; |
| 9846 | const char *const subagent_legacy[] = {cmm_released_subagent_script}; |
| 9847 | size_t gate_legacy_count = cbm_build_released_gate_script(installed_binary, released_gate, |
no test coverage detected