| 9595 | } |
| 9596 | |
| 9597 | static void install_agent_client_registry(const char *home, const char *binary_path, |
| 9598 | bool inherit_claude_session, bool force, bool dry_run) { |
| 9599 | cbm_agent_registry_context_t registry; |
| 9600 | cbm_init_agent_registry_context(home, ®istry); |
| 9601 | for (size_t index = 0U; index < cbm_agent_client_count(); index++) { |
| 9602 | const cbm_agent_client_profile_t *profile = cbm_agent_client_at(index); |
| 9603 | if (!profile || |
| 9604 | (g_client_selection && |
| 9605 | !cli_clients_selects_registry_client(g_client_selection, profile->id)) || |
| 9606 | !cbm_agent_client_detect(profile->id, ®istry.options)) { |
| 9607 | continue; |
| 9608 | } |
| 9609 | if (!g_install_plan) { |
| 9610 | printf("%s:\n", profile->display_name); |
| 9611 | } |
| 9612 | |
| 9613 | char config_path[CLI_BUF_1K] = {0}; |
| 9614 | bool config_resolved = false; |
| 9615 | if ((profile->capabilities & CBM_AGENT_CAP_MCP) != 0U) { |
| 9616 | int resolved = cbm_agent_client_resolve_path(profile->id, ®istry.options, |
| 9617 | config_path, sizeof(config_path)); |
| 9618 | if (resolved != 0 || !profile->install_mcp) { |
| 9619 | record_agent_config_error(false, profile->display_name, "mcp_resolve", |
| 9620 | profile->stable_id); |
| 9621 | } else if (g_install_plan) { |
| 9622 | config_resolved = true; |
| 9623 | plan_record(profile->display_name, "mcp_config", config_path); |
| 9624 | } else { |
| 9625 | config_resolved = true; |
| 9626 | int edit_result = CBM_AGENT_EDIT_OK; |
| 9627 | if (!dry_run) { |
| 9628 | edit_result = prepare_config_parent(config_path) |
| 9629 | ? profile->install_mcp(profile->id, config_path, binary_path) |
| 9630 | : CBM_AGENT_EDIT_ERROR; |
| 9631 | } |
| 9632 | if (edit_result == CBM_AGENT_EDIT_FOREIGN) { |
| 9633 | record_agent_config_error(false, profile->display_name, "mcp_foreign", |
| 9634 | config_path); |
| 9635 | } else if (edit_result != CBM_AGENT_EDIT_OK) { |
| 9636 | record_agent_config_error(false, profile->display_name, "mcp_install", |
| 9637 | config_path); |
| 9638 | } else { |
| 9639 | printf(" mcp: %s\n", config_path); |
| 9640 | } |
| 9641 | } |
| 9642 | } |
| 9643 | |
| 9644 | if (profile->id == CBM_AGENT_CLIENT_QODER) { |
| 9645 | install_qoder_durable_context(home, binary_path, config_path, config_resolved, force, |
| 9646 | dry_run); |
| 9647 | } else if (profile->id == CBM_AGENT_CLIENT_KIMI) { |
| 9648 | install_kimi_durable_context(®istry, binary_path, force, dry_run); |
| 9649 | } else if (profile->id == CBM_AGENT_CLIENT_GITLAB_DUO) { |
| 9650 | install_gitlab_durable_context(®istry, binary_path, dry_run); |
| 9651 | } else if (profile->id == CBM_AGENT_CLIENT_ROVO_DEV) { |
| 9652 | install_rovo_durable_context(home, force, dry_run); |
| 9653 | } else if (profile->id == CBM_AGENT_CLIENT_AMP) { |
| 9654 | install_amp_durable_context(home, force, dry_run); |
no test coverage detected