MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / uninstall_claude_code

Function uninstall_claude_code

src/cli/cli.c:9728–9860  ·  view source on GitHub ↗

Remove Claude Code agent configs. */

Source from the content-addressed store, hash-verified

9726
9727/* Remove Claude Code agent configs. */
9728static void uninstall_claude_code(const char *home, bool dry_run) {
9729 char installed_binary[CLI_BUF_1K];
9730 cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary));
9731 char config_dir[CLI_BUF_1K];
9732 cbm_claude_config_dir(home, config_dir, sizeof(config_dir));
9733 char user_root[CLI_BUF_1K];
9734 cbm_claude_user_root(home, user_root, sizeof(user_root));
9735
9736 char skills_dir[CLI_BUF_1K];
9737 snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir);
9738 int removed = cbm_remove_skills(skills_dir, dry_run);
9739 printf("Claude Code: removed %d skill(s)\n", removed);
9740 char agent_path[CLI_BUF_1K];
9741 snprintf(agent_path, sizeof(agent_path), "%s/agents/codebase-memory.md", config_dir);
9742 uninstall_tiered_agent_profiles(
9743 (cbm_tiered_profile_set_t){
9744 .label = "Claude Code",
9745 .verify_path = agent_path,
9746 .binary_path = installed_binary,
9747 .legacy_verify_content = legacy_claude_verify_agent_content,
9748 .dialect = CBM_GRAPH_DIALECT_CLAUDE,
9749 },
9750 dry_run);
9751
9752 char mcp_path[CLI_BUF_1K];
9753 snprintf(mcp_path, sizeof(mcp_path), "%s/.mcp.json", config_dir);
9754 if (!dry_run && cbm_remove_editor_mcp_owned(installed_binary, mcp_path) != CLI_OK) {
9755 record_agent_config_error(true, "Claude Code", "legacy_mcp_uninstall", mcp_path);
9756 }
9757 printf(" removed MCP config entry\n");
9758
9759 char mcp_path2[CLI_BUF_1K];
9760 snprintf(mcp_path2, sizeof(mcp_path2), "%s/.claude.json", user_root);
9761 if (!dry_run && cbm_remove_editor_mcp_owned(installed_binary, mcp_path2) != CLI_OK) {
9762 record_agent_config_error(true, "Claude Code", "mcp_uninstall", mcp_path2);
9763 }
9764
9765 char settings_path[CLI_BUF_1K];
9766 snprintf(settings_path, sizeof(settings_path), "%s/settings.json", config_dir);
9767 if (!dry_run) {
9768 if (cbm_remove_claude_hooks(settings_path) != CLI_OK) {
9769 record_agent_config_error(true, "Claude Code", "pretool_hook_uninstall", settings_path);
9770 }
9771 if (cbm_remove_session_hooks(settings_path) != CLI_OK) {
9772 record_agent_config_error(true, "Claude Code", "session_hook_uninstall", settings_path);
9773 }
9774 if (cbm_remove_claude_subagent_hooks(settings_path) != CLI_OK) {
9775 record_agent_config_error(true, "Claude Code", "subagent_hook_uninstall",
9776 settings_path);
9777 }
9778 char current_gate[CLI_BUF_8K];
9779 char current_session[CLI_BUF_8K];
9780 char current_subagent[CLI_BUF_8K];
9781 char released_gate[CLI_BUF_8K];
9782 const char *const gate_legacy[] = {released_gate};
9783 const char *const session_legacy[] = {cmm_released_session_script};
9784 const char *const subagent_legacy[] = {cmm_released_subagent_script};
9785 size_t gate_legacy_count = cbm_build_released_gate_script(installed_binary, released_gate,

Callers 1

cli_uninstall_activateFunction · 0.85

Tested by

no test coverage detected