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

Function uninstall_cli_agents

src/cli/cli.c:10344–10444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10342}
10343
10344static void uninstall_cli_agents(const cbm_detected_agents_t *agents, const char *home,
10345 bool dry_run) {
10346 if (agents->codex) {
10347 char config_dir[CLI_BUF_1K];
10348 char cp[CLI_BUF_1K];
10349 char ip[CLI_BUF_1K];
10350 char skills_dir[CLI_BUF_1K];
10351 char ap[CLI_BUF_1K];
10352 char installed_binary[CLI_BUF_1K];
10353 cbm_codex_config_dir(home, config_dir, sizeof(config_dir));
10354 snprintf(cp, sizeof(cp), "%s/config.toml", config_dir);
10355 snprintf(ip, sizeof(ip), "%s/AGENTS.md", config_dir);
10356 snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir);
10357 snprintf(ap, sizeof(ap), "%s/agents/codebase-memory.toml", config_dir);
10358 cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary));
10359 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Codex CLI", cp, ip}, dry_run,
10360 cbm_remove_codex_mcp_owned);
10361 uninstall_agent_skill("Codex CLI", skills_dir, dry_run);
10362 uninstall_tiered_agent_profiles(
10363 (cbm_tiered_profile_set_t){
10364 .label = "Codex CLI",
10365 .verify_path = ap,
10366 .binary_path = installed_binary,
10367 .legacy_verify_content = legacy_codex_verify_agent_content,
10368 .dialect = CBM_GRAPH_DIALECT_CODEX,
10369 },
10370 dry_run);
10371 if (!dry_run) {
10372 if (cbm_remove_codex_hooks(cp) != CLI_OK) {
10373 record_agent_config_error(true, "Codex CLI", "hook_uninstall", cp);
10374 }
10375 char hooks_json[CLI_BUF_1K];
10376 char hook_command[CLI_BUF_8K];
10377 snprintf(hooks_json, sizeof(hooks_json), "%s/hooks.json", config_dir);
10378 if (cbm_file_exists(hooks_json) &&
10379 (cbm_build_augment_command(installed_binary, hook_command, sizeof(hook_command)) !=
10380 CLI_OK ||
10381 cbm_remove_paired_lifecycle_hooks_json(hooks_json, hook_command) != CLI_OK)) {
10382 record_agent_config_error(true, "Codex CLI", "json_hook_uninstall", hooks_json);
10383 }
10384 }
10385 }
10386 if (agents->gemini) {
10387 uninstall_gemini_config(home, dry_run);
10388 }
10389 if (agents->opencode) {
10390 char cp[CLI_BUF_1K];
10391 char ip[CLI_BUF_1K];
10392 char skills_dir[CLI_BUF_1K];
10393 char ap[CLI_BUF_1K];
10394 cbm_opencode_config_path(home, cp, sizeof(cp));
10395 snprintf(ip, sizeof(ip), "%s/.config/opencode/AGENTS.md", home);
10396 snprintf(skills_dir, sizeof(skills_dir), "%s/.config/opencode/skills", home);
10397 snprintf(ap, sizeof(ap), "%s/.config/opencode/agents/codebase-memory.md", home);
10398 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"OpenCode", cp, ip}, dry_run,
10399 cbm_remove_opencode_mcp_owned);
10400 uninstall_agent_skill("OpenCode", skills_dir, dry_run);
10401 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