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

Function uninstall_cli_agents

src/cli/cli.c:10282–10382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10280}
10281
10282static void uninstall_cli_agents(const cbm_detected_agents_t *agents, const char *home,
10283 bool dry_run) {
10284 if (agents->codex) {
10285 char config_dir[CLI_BUF_1K];
10286 char cp[CLI_BUF_1K];
10287 char ip[CLI_BUF_1K];
10288 char skills_dir[CLI_BUF_1K];
10289 char ap[CLI_BUF_1K];
10290 char installed_binary[CLI_BUF_1K];
10291 cbm_codex_config_dir(home, config_dir, sizeof(config_dir));
10292 snprintf(cp, sizeof(cp), "%s/config.toml", config_dir);
10293 snprintf(ip, sizeof(ip), "%s/AGENTS.md", config_dir);
10294 snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir);
10295 snprintf(ap, sizeof(ap), "%s/agents/codebase-memory.toml", config_dir);
10296 cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary));
10297 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Codex CLI", cp, ip}, dry_run,
10298 cbm_remove_codex_mcp_owned);
10299 uninstall_agent_skill("Codex CLI", skills_dir, dry_run);
10300 uninstall_tiered_agent_profiles(
10301 (cbm_tiered_profile_set_t){
10302 .label = "Codex CLI",
10303 .verify_path = ap,
10304 .binary_path = installed_binary,
10305 .legacy_verify_content = legacy_codex_verify_agent_content,
10306 .dialect = CBM_GRAPH_DIALECT_CODEX,
10307 },
10308 dry_run);
10309 if (!dry_run) {
10310 if (cbm_remove_codex_hooks(cp) != CLI_OK) {
10311 record_agent_config_error(true, "Codex CLI", "hook_uninstall", cp);
10312 }
10313 char hooks_json[CLI_BUF_1K];
10314 char hook_command[CLI_BUF_8K];
10315 snprintf(hooks_json, sizeof(hooks_json), "%s/hooks.json", config_dir);
10316 if (cbm_file_exists(hooks_json) &&
10317 (cbm_build_augment_command(installed_binary, hook_command, sizeof(hook_command)) !=
10318 CLI_OK ||
10319 cbm_remove_paired_lifecycle_hooks_json(hooks_json, hook_command) != CLI_OK)) {
10320 record_agent_config_error(true, "Codex CLI", "json_hook_uninstall", hooks_json);
10321 }
10322 }
10323 }
10324 if (agents->gemini) {
10325 uninstall_gemini_config(home, dry_run);
10326 }
10327 if (agents->opencode) {
10328 char cp[CLI_BUF_1K];
10329 char ip[CLI_BUF_1K];
10330 char skills_dir[CLI_BUF_1K];
10331 char ap[CLI_BUF_1K];
10332 cbm_opencode_config_path(home, cp, sizeof(cp));
10333 snprintf(ip, sizeof(ip), "%s/.config/opencode/AGENTS.md", home);
10334 snprintf(skills_dir, sizeof(skills_dir), "%s/.config/opencode/skills", home);
10335 snprintf(ap, sizeof(ap), "%s/.config/opencode/agents/codebase-memory.md", home);
10336 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"OpenCode", cp, ip}, dry_run,
10337 cbm_remove_opencode_mcp_owned);
10338 uninstall_agent_skill("OpenCode", skills_dir, dry_run);
10339 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