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

Function uninstall_cli_agents

src/cli/cli.c:10682–10797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10680}
10681
10682static void uninstall_cli_agents(const cbm_detected_agents_t *agents, const char *home,
10683 bool dry_run) {
10684 if (agents->codex) {
10685 char config_dir[CLI_BUF_1K];
10686 char cp[CLI_BUF_1K];
10687 char ip[CLI_BUF_1K];
10688 char skills_dir[CLI_BUF_1K];
10689 char ap[CLI_BUF_1K];
10690 char installed_binary[CLI_BUF_1K];
10691 cbm_codex_config_dir(home, config_dir, sizeof(config_dir));
10692 snprintf(cp, sizeof(cp), "%s/config.toml", config_dir);
10693 snprintf(ip, sizeof(ip), "%s/AGENTS.md", config_dir);
10694 snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir);
10695 snprintf(ap, sizeof(ap), "%s/agents/codebase-memory.toml", config_dir);
10696 cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary));
10697 char hook_command[CLI_BUF_8K];
10698 char hook_command_windows[CLI_BUF_8K];
10699 bool hook_command_ok = cbm_build_augment_command(installed_binary, hook_command,
10700 sizeof(hook_command)) == CLI_OK;
10701 bool hook_preflight_ok =
10702 hook_command_ok &&
10703 cbm_build_augment_command_windows(installed_binary, hook_command_windows,
10704 sizeof(hook_command_windows)) == CLI_OK &&
10705 cbm_reconcile_codex_hooks_command(cp, hook_command, hook_command_windows,
10706 CBM_TOML_CODEX_HOOK_REMOVE, true) == CLI_OK;
10707 if (!hook_preflight_ok) {
10708 record_agent_config_error(true, "Codex CLI", "hook_preflight", cp);
10709 goto codex_toml_done;
10710 }
10711 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Codex CLI", cp, ip}, dry_run,
10712 cbm_remove_codex_mcp_owned);
10713 if (!dry_run &&
10714 cbm_reconcile_codex_hooks_command(cp, hook_command, hook_command_windows,
10715 CBM_TOML_CODEX_HOOK_REMOVE, false) != CLI_OK) {
10716 record_agent_config_error(true, "Codex CLI", "hook_uninstall", cp);
10717 }
10718 codex_toml_done:
10719 uninstall_agent_skill("Codex CLI", skills_dir, dry_run);
10720 uninstall_tiered_agent_profiles(
10721 (cbm_tiered_profile_set_t){
10722 .label = "Codex CLI",
10723 .verify_path = ap,
10724 .binary_path = installed_binary,
10725 .legacy_verify_content = legacy_codex_verify_agent_content,
10726 .dialect = CBM_GRAPH_DIALECT_CODEX,
10727 },
10728 dry_run);
10729 if (!dry_run) {
10730 char hooks_json[CLI_BUF_1K];
10731 snprintf(hooks_json, sizeof(hooks_json), "%s/hooks.json", config_dir);
10732 if (cbm_file_exists(hooks_json) &&
10733 (!hook_command_ok ||
10734 cbm_remove_paired_lifecycle_hooks_json(hooks_json, hook_command) != CLI_OK)) {
10735 record_agent_config_error(true, "Codex CLI", "json_hook_uninstall", hooks_json);
10736 }
10737 }
10738 }
10739 if (agents->gemini) {

Callers 1

cli_uninstall_activateFunction · 0.85

Tested by

no test coverage detected