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

Function uninstall_cli_agents

src/cli/cli.c:10238–10338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10236}
10237
10238static void uninstall_cli_agents(const cbm_detected_agents_t *agents, const char *home,
10239 bool dry_run) {
10240 if (agents->codex) {
10241 char config_dir[CLI_BUF_1K];
10242 char cp[CLI_BUF_1K];
10243 char ip[CLI_BUF_1K];
10244 char skills_dir[CLI_BUF_1K];
10245 char ap[CLI_BUF_1K];
10246 char installed_binary[CLI_BUF_1K];
10247 cbm_codex_config_dir(home, config_dir, sizeof(config_dir));
10248 snprintf(cp, sizeof(cp), "%s/config.toml", config_dir);
10249 snprintf(ip, sizeof(ip), "%s/AGENTS.md", config_dir);
10250 snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir);
10251 snprintf(ap, sizeof(ap), "%s/agents/codebase-memory.toml", config_dir);
10252 cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary));
10253 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Codex CLI", cp, ip}, dry_run,
10254 cbm_remove_codex_mcp_owned);
10255 uninstall_agent_skill("Codex CLI", skills_dir, dry_run);
10256 uninstall_tiered_agent_profiles(
10257 (cbm_tiered_profile_set_t){
10258 .label = "Codex CLI",
10259 .verify_path = ap,
10260 .binary_path = installed_binary,
10261 .legacy_verify_content = legacy_codex_verify_agent_content,
10262 .dialect = CBM_GRAPH_DIALECT_CODEX,
10263 },
10264 dry_run);
10265 if (!dry_run) {
10266 if (cbm_remove_codex_hooks(cp) != CLI_OK) {
10267 record_agent_config_error(true, "Codex CLI", "hook_uninstall", cp);
10268 }
10269 char hooks_json[CLI_BUF_1K];
10270 char hook_command[CLI_BUF_8K];
10271 snprintf(hooks_json, sizeof(hooks_json), "%s/hooks.json", config_dir);
10272 if (cbm_file_exists(hooks_json) &&
10273 (cbm_build_augment_command(installed_binary, hook_command, sizeof(hook_command)) !=
10274 CLI_OK ||
10275 cbm_remove_paired_lifecycle_hooks_json(hooks_json, hook_command) != CLI_OK)) {
10276 record_agent_config_error(true, "Codex CLI", "json_hook_uninstall", hooks_json);
10277 }
10278 }
10279 }
10280 if (agents->gemini) {
10281 uninstall_gemini_config(home, dry_run);
10282 }
10283 if (agents->opencode) {
10284 char cp[CLI_BUF_1K];
10285 char ip[CLI_BUF_1K];
10286 char skills_dir[CLI_BUF_1K];
10287 char ap[CLI_BUF_1K];
10288 cbm_opencode_config_path(home, cp, sizeof(cp));
10289 snprintf(ip, sizeof(ip), "%s/.config/opencode/AGENTS.md", home);
10290 snprintf(skills_dir, sizeof(skills_dir), "%s/.config/opencode/skills", home);
10291 snprintf(ap, sizeof(ap), "%s/.config/opencode/agents/codebase-memory.md", home);
10292 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"OpenCode", cp, ip}, dry_run,
10293 cbm_remove_opencode_mcp_owned);
10294 uninstall_agent_skill("OpenCode", skills_dir, dry_run);
10295 uninstall_tiered_agent_profiles(

Callers 1

cli_uninstall_activateFunction · 0.85

Calls 15

cbm_codex_config_dirFunction · 0.85
uninstall_agent_skillFunction · 0.85
cbm_remove_codex_hooksFunction · 0.85
cbm_file_existsFunction · 0.85
uninstall_gemini_configFunction · 0.85
cbm_opencode_config_pathFunction · 0.85

Tested by

no test coverage detected