Install MCP config + optional instructions for a generic agent. */
| 8721 | |
| 8722 | /* Install MCP config + optional instructions for a generic agent. */ |
| 8723 | static bool install_generic_agent_config(const char *label, const char *binary_path, |
| 8724 | const char *config_path, const char *instr_path, |
| 8725 | bool dry_run, |
| 8726 | int (*install_mcp)(const char *, const char *)) { |
| 8727 | /* Plan mode: record planned writes, mutate nothing (#388). */ |
| 8728 | if (g_install_plan) { |
| 8729 | plan_record(label, "mcp_config", config_path); |
| 8730 | if (instr_path) { |
| 8731 | plan_record(label, "instructions", instr_path); |
| 8732 | } |
| 8733 | return true; |
| 8734 | } |
| 8735 | printf("%s:\n", label); |
| 8736 | bool mcp_installed = true; |
| 8737 | if (!dry_run) { |
| 8738 | if (!prepare_config_parent(config_path) || |
| 8739 | install_mcp(binary_path, config_path) != CLI_OK) { |
| 8740 | mcp_installed = false; |
| 8741 | record_agent_config_error(false, label, "mcp_install", config_path); |
| 8742 | } |
| 8743 | } |
| 8744 | printf(" mcp: %s\n", config_path); |
| 8745 | if (instr_path) { |
| 8746 | if (!dry_run) { |
| 8747 | if (!prepare_config_parent(instr_path) || |
| 8748 | cbm_upsert_instructions(instr_path, agent_instructions_content) != CLI_OK) { |
| 8749 | record_agent_config_error(false, label, "instructions_install", instr_path); |
| 8750 | } |
| 8751 | } |
| 8752 | printf(" instructions: %s\n", instr_path); |
| 8753 | } |
| 8754 | return mcp_installed; |
| 8755 | } |
| 8756 | |
| 8757 | static bool install_codex_activation_pointer(const char *path, bool dry_run) { |
| 8758 | if (!path) { |
no test coverage detected