Install MCP config + optional instructions for a generic agent. */
| 7523 | |
| 7524 | /* Install MCP config + optional instructions for a generic agent. */ |
| 7525 | static bool install_generic_agent_config(const char *label, const char *binary_path, |
| 7526 | const char *config_path, const char *instr_path, |
| 7527 | bool dry_run, |
| 7528 | int (*install_mcp)(const char *, const char *)) { |
| 7529 | /* Plan mode: record planned writes, mutate nothing (#388). */ |
| 7530 | if (g_install_plan) { |
| 7531 | plan_record(label, "mcp_config", config_path); |
| 7532 | if (instr_path) { |
| 7533 | plan_record(label, "instructions", instr_path); |
| 7534 | } |
| 7535 | return true; |
| 7536 | } |
| 7537 | printf("%s:\n", label); |
| 7538 | bool mcp_installed = true; |
| 7539 | if (!dry_run) { |
| 7540 | if (!prepare_config_parent(config_path) || |
| 7541 | install_mcp(binary_path, config_path) != CLI_OK) { |
| 7542 | mcp_installed = false; |
| 7543 | record_agent_config_error(false, label, "mcp_install", config_path); |
| 7544 | } |
| 7545 | } |
| 7546 | printf(" mcp: %s\n", config_path); |
| 7547 | if (instr_path) { |
| 7548 | if (!dry_run) { |
| 7549 | if (!prepare_config_parent(instr_path) || |
| 7550 | cbm_upsert_instructions(instr_path, agent_instructions_content) != CLI_OK) { |
| 7551 | record_agent_config_error(false, label, "instructions_install", instr_path); |
| 7552 | } |
| 7553 | } |
| 7554 | printf(" instructions: %s\n", instr_path); |
| 7555 | } |
| 7556 | return mcp_installed; |
| 7557 | } |
| 7558 | |
| 7559 | static void install_windsurf_config(const char *binary_path, const char *config_path, |
| 7560 | const char *rules_path, bool dry_run) { |
no test coverage detected