| 12525 | } |
| 12526 | |
| 12527 | static void uninstall_additional_agents(const cbm_detected_agents_t *agents, const char *home, |
| 12528 | bool dry_run) { |
| 12529 | char installed_binary[CLI_BUF_1K]; |
| 12530 | cbm_agent_installed_binary_path(home, installed_binary, sizeof(installed_binary)); |
| 12531 | if (agents->hermes) { |
| 12532 | char hermes_home[CLI_BUF_1K]; |
| 12533 | char cp[CLI_BUF_1K]; |
| 12534 | char skills_dir[CLI_BUF_1K]; |
| 12535 | char binary_path[CLI_BUF_1K]; |
| 12536 | cbm_hermes_home_dir(home, hermes_home, sizeof(hermes_home)); |
| 12537 | snprintf(cp, sizeof(cp), "%s/config.yaml", hermes_home); |
| 12538 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", hermes_home); |
| 12539 | cbm_agent_installed_binary_path(home, binary_path, sizeof(binary_path)); |
| 12540 | int hook_result = |
| 12541 | dry_run ? CBM_YAML_IDENTITY_EDIT_OK : cbm_remove_hermes_context_hook(cp, binary_path); |
| 12542 | if (hook_result == CBM_YAML_IDENTITY_EDIT_FOREIGN) { |
| 12543 | printf(" hook: preserved modified pre_llm_call entry\n"); |
| 12544 | } else if (hook_result != CBM_YAML_IDENTITY_EDIT_OK) { |
| 12545 | record_agent_config_error(true, "Hermes", "pre_llm_hook_uninstall", cp); |
| 12546 | } else { |
| 12547 | printf(" hook: removed canonical pre_llm_call entry\n"); |
| 12548 | } |
| 12549 | uninstall_agent_mcp_instr((mcp_uninstall_args_t){"Hermes", cp, NULL}, dry_run, |
| 12550 | cbm_remove_hermes_mcp_owned); |
| 12551 | uninstall_agent_skill("Hermes", skills_dir, dry_run); |
| 12552 | } |
| 12553 | if (agents->openhands) { |
| 12554 | char cp[CLI_BUF_1K]; |
| 12555 | char skills_dir[CLI_BUF_1K]; |
| 12556 | char settings_path[CLI_BUF_1K]; |
| 12557 | char profiles_dir[CLI_BUF_1K]; |
| 12558 | snprintf(cp, sizeof(cp), "%s/.openhands/mcp.json", home); |
| 12559 | snprintf(skills_dir, sizeof(skills_dir), "%s/.agents/skills", home); |
| 12560 | snprintf(settings_path, sizeof(settings_path), "%s/.openhands/settings.json", home); |
| 12561 | snprintf(profiles_dir, sizeof(profiles_dir), "%s/.openhands/agent-profiles", home); |
| 12562 | uninstall_agent_mcp_instr((mcp_uninstall_args_t){"OpenHands", cp, NULL}, dry_run, |
| 12563 | cbm_remove_editor_mcp_owned); |
| 12564 | printf(" removed %d skill(s)\n", cbm_remove_skills(skills_dir, dry_run)); |
| 12565 | /* #1826 counterpart: undo the settings.json registration and every |
| 12566 | * agent profile's mcp_server_refs entry the install above added. */ |
| 12567 | if (!dry_run && cbm_remove_openhands_settings_mcp(settings_path) != CLI_OK) { |
| 12568 | record_agent_config_error(true, "OpenHands", "settings_mcp_uninstall", settings_path); |
| 12569 | } |
| 12570 | openhands_update_profile_refs(profiles_dir, false, dry_run); |
| 12571 | } |
| 12572 | if (agents->augment) { |
| 12573 | char cp[CLI_BUF_1K]; |
| 12574 | char ip[CLI_BUF_1K]; |
| 12575 | char ap[CLI_BUF_1K]; |
| 12576 | char session_hp[CLI_BUF_1K]; |
| 12577 | char coverage_hp[CLI_BUF_1K]; |
| 12578 | char binary_path[CLI_BUF_1K]; |
| 12579 | snprintf(cp, sizeof(cp), "%s/.augment/settings.json", home); |
| 12580 | snprintf(ip, sizeof(ip), "%s/.augment/rules/codebase-memory.md", home); |
| 12581 | snprintf(ap, sizeof(ap), "%s/.augment/agents/codebase-memory.md", home); |
| 12582 | snprintf(session_hp, sizeof(session_hp), "%s/.augment/hooks/%s", home, |
| 12583 | AUGMENT_SESSION_SCRIPT); |
| 12584 | snprintf(coverage_hp, sizeof(coverage_hp), "%s/.augment/hooks/%s", home, |
no test coverage detected