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

Function uninstall_cli_agents

src/cli/cli.c:10744–10859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10742}
10743
10744static void uninstall_cli_agents(const cbm_detected_agents_t *agents, const char *home,
10745 bool dry_run) {
10746 if (agents->codex) {
10747 char config_dir[CLI_BUF_1K];
10748 char cp[CLI_BUF_1K];
10749 char ip[CLI_BUF_1K];
10750 char skills_dir[CLI_BUF_1K];
10751 char ap[CLI_BUF_1K];
10752 char installed_binary[CLI_BUF_1K];
10753 cbm_codex_config_dir(home, config_dir, sizeof(config_dir));
10754 snprintf(cp, sizeof(cp), "%s/config.toml", config_dir);
10755 snprintf(ip, sizeof(ip), "%s/AGENTS.md", config_dir);
10756 snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir);
10757 snprintf(ap, sizeof(ap), "%s/agents/codebase-memory.toml", config_dir);
10758 cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary));
10759 char hook_command[CLI_BUF_8K];
10760 char hook_command_windows[CLI_BUF_8K];
10761 bool hook_command_ok = cbm_build_augment_command(installed_binary, hook_command,
10762 sizeof(hook_command)) == CLI_OK;
10763 bool hook_preflight_ok =
10764 hook_command_ok &&
10765 cbm_build_augment_command_windows(installed_binary, hook_command_windows,
10766 sizeof(hook_command_windows)) == CLI_OK &&
10767 cbm_reconcile_codex_hooks_command(cp, hook_command, hook_command_windows,
10768 CBM_TOML_CODEX_HOOK_REMOVE, true) == CLI_OK;
10769 if (!hook_preflight_ok) {
10770 record_agent_config_error(true, "Codex CLI", "hook_preflight", cp);
10771 goto codex_toml_done;
10772 }
10773 uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Codex CLI", cp, ip}, dry_run,
10774 cbm_remove_codex_mcp_owned);
10775 if (!dry_run &&
10776 cbm_reconcile_codex_hooks_command(cp, hook_command, hook_command_windows,
10777 CBM_TOML_CODEX_HOOK_REMOVE, false) != CLI_OK) {
10778 record_agent_config_error(true, "Codex CLI", "hook_uninstall", cp);
10779 }
10780 codex_toml_done:
10781 uninstall_agent_skill("Codex CLI", skills_dir, dry_run);
10782 uninstall_tiered_agent_profiles(
10783 (cbm_tiered_profile_set_t){
10784 .label = "Codex CLI",
10785 .verify_path = ap,
10786 .binary_path = installed_binary,
10787 .legacy_verify_content = legacy_codex_verify_agent_content,
10788 .dialect = CBM_GRAPH_DIALECT_CODEX,
10789 },
10790 dry_run);
10791 if (!dry_run) {
10792 char hooks_json[CLI_BUF_1K];
10793 snprintf(hooks_json, sizeof(hooks_json), "%s/hooks.json", config_dir);
10794 if (cbm_file_exists(hooks_json) &&
10795 (!hook_command_ok ||
10796 cbm_remove_paired_lifecycle_hooks_json(hooks_json, hook_command) != CLI_OK)) {
10797 record_agent_config_error(true, "Codex CLI", "json_hook_uninstall", hooks_json);
10798 }
10799 }
10800 }
10801 if (agents->gemini) {

Callers 1

cli_uninstall_activateFunction · 0.85

Tested by

no test coverage detected