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

Function uninstall_cli_agents

src/cli/cli.c:12205–12330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12203}
12204
12205static void uninstall_cli_agents(const cbm_detected_agents_t *agents, const char *home,
12206 bool dry_run) {
12207 if (agents->codex) {
12208 char config_dir[CLI_BUF_1K];
12209 char cp[CLI_BUF_1K];
12210 char ip[CLI_BUF_1K];
12211 char skills_dir[CLI_BUF_1K];
12212 char ap[CLI_BUF_1K];
12213 char installed_binary[CLI_BUF_1K];
12214 cbm_codex_config_dir(home, config_dir, sizeof(config_dir));
12215 snprintf(cp, sizeof(cp), "%s/config.toml", config_dir);
12216 snprintf(ip, sizeof(ip), "%s/AGENTS.md", config_dir);
12217 snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir);
12218 snprintf(ap, sizeof(ap), "%s/agents/codebase-memory.toml", config_dir);
12219 bool pointer_removed = uninstall_codex_activation_pointer(ip, dry_run);
12220 cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary));
12221 char hook_command[CLI_BUF_8K];
12222 char hook_command_windows[CLI_BUF_8K];
12223 bool hook_command_ok = cbm_build_augment_command(installed_binary, hook_command,
12224 sizeof(hook_command)) == CLI_OK;
12225 bool hook_commands_ok = hook_command_ok && cbm_build_augment_command_windows(
12226 installed_binary, hook_command_windows,
12227 sizeof(hook_command_windows)) == CLI_OK;
12228 cbm_toml_codex_hook_failure_t preflight_failure = CBM_TOML_CODEX_HOOK_FAILURE_NONE;
12229 bool hook_preflight_ok =
12230 hook_commands_ok && cbm_reconcile_codex_hooks_command_detailed(
12231 cp, hook_command, hook_command_windows,
12232 CBM_TOML_CODEX_HOOK_REMOVE, true, &preflight_failure) == CLI_OK;
12233 if (!hook_preflight_ok) {
12234 printf("Codex CLI:\n");
12235 fflush(stdout);
12236 const char *reason = preflight_failure == CBM_TOML_CODEX_HOOK_FAILURE_NONE
12237 ? NULL
12238 : cbm_toml_codex_hook_failure_name(preflight_failure);
12239 record_agent_config_error_with_reason(true, "Codex CLI", "hook_preflight", cp, reason);
12240 report_codex_activation_pointer_uninstall(ip, pointer_removed);
12241 goto codex_toml_done;
12242 }
12243 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Codex CLI", cp, NULL}, dry_run,
12244 cbm_remove_codex_mcp_owned);
12245 report_codex_activation_pointer_uninstall(ip, pointer_removed);
12246 if (!dry_run &&
12247 cbm_reconcile_codex_hooks_command(cp, hook_command, hook_command_windows,
12248 CBM_TOML_CODEX_HOOK_REMOVE, false) != CLI_OK) {
12249 record_agent_config_error(true, "Codex CLI", "hook_uninstall", cp);
12250 }
12251 codex_toml_done:
12252 uninstall_agent_skill("Codex CLI", skills_dir, dry_run);
12253 uninstall_tiered_agent_profiles(
12254 (cbm_tiered_profile_set_t){
12255 .label = "Codex CLI",
12256 .verify_path = ap,
12257 .binary_path = installed_binary,
12258 .legacy_verify_content = legacy_codex_verify_agent_content,
12259 .dialect = CBM_GRAPH_DIALECT_CODEX,
12260 },
12261 dry_run);
12262 if (!dry_run) {

Callers 1

cli_uninstall_activateFunction · 0.85

Tested by

no test coverage detected