Install MCP config + optional instructions for a generic agent. */
| 8515 | |
| 8516 | /* Install MCP config + optional instructions for a generic agent. */ |
| 8517 | static bool install_generic_agent_config(const char *label, const char *binary_path, |
| 8518 | const char *config_path, const char *instr_path, |
| 8519 | bool dry_run, |
| 8520 | int (*install_mcp)(const char *, const char *)) { |
| 8521 | /* Plan mode: record planned writes, mutate nothing (#388). */ |
| 8522 | if (g_install_plan) { |
| 8523 | plan_record(label, "mcp_config", config_path); |
| 8524 | if (instr_path) { |
| 8525 | plan_record(label, "instructions", instr_path); |
| 8526 | } |
| 8527 | return true; |
| 8528 | } |
| 8529 | printf("%s:\n", label); |
| 8530 | bool mcp_installed = true; |
| 8531 | if (!dry_run) { |
| 8532 | if (!prepare_config_parent(config_path) || |
| 8533 | install_mcp(binary_path, config_path) != CLI_OK) { |
| 8534 | mcp_installed = false; |
| 8535 | record_agent_config_error(false, label, "mcp_install", config_path); |
| 8536 | } |
| 8537 | } |
| 8538 | printf(" mcp: %s\n", config_path); |
| 8539 | if (instr_path) { |
| 8540 | if (!dry_run) { |
| 8541 | if (!prepare_config_parent(instr_path) || |
| 8542 | cbm_upsert_instructions(instr_path, agent_instructions_content) != CLI_OK) { |
| 8543 | record_agent_config_error(false, label, "instructions_install", instr_path); |
| 8544 | } |
| 8545 | } |
| 8546 | printf(" instructions: %s\n", instr_path); |
| 8547 | } |
| 8548 | return mcp_installed; |
| 8549 | } |
| 8550 | |
| 8551 | static bool install_codex_activation_pointer(const char *path, bool dry_run) { |
| 8552 | if (!path) { |
no test coverage detected