Install MCP config + optional instructions for a generic agent. */
| 7436 | |
| 7437 | /* Install MCP config + optional instructions for a generic agent. */ |
| 7438 | static bool install_generic_agent_config(const char *label, const char *binary_path, |
| 7439 | const char *config_path, const char *instr_path, |
| 7440 | bool dry_run, |
| 7441 | int (*install_mcp)(const char *, const char *)) { |
| 7442 | /* Plan mode: record planned writes, mutate nothing (#388). */ |
| 7443 | if (g_install_plan) { |
| 7444 | plan_record(label, "mcp_config", config_path); |
| 7445 | if (instr_path) { |
| 7446 | plan_record(label, "instructions", instr_path); |
| 7447 | } |
| 7448 | return true; |
| 7449 | } |
| 7450 | printf("%s:\n", label); |
| 7451 | bool mcp_installed = true; |
| 7452 | if (!dry_run) { |
| 7453 | if (!prepare_config_parent(config_path) || |
| 7454 | install_mcp(binary_path, config_path) != CLI_OK) { |
| 7455 | mcp_installed = false; |
| 7456 | record_agent_config_error(false, label, "mcp_install", config_path); |
| 7457 | } |
| 7458 | } |
| 7459 | printf(" mcp: %s\n", config_path); |
| 7460 | if (instr_path) { |
| 7461 | if (!dry_run) { |
| 7462 | if (!prepare_config_parent(instr_path) || |
| 7463 | cbm_upsert_instructions(instr_path, agent_instructions_content) != CLI_OK) { |
| 7464 | record_agent_config_error(false, label, "instructions_install", instr_path); |
| 7465 | } |
| 7466 | } |
| 7467 | printf(" instructions: %s\n", instr_path); |
| 7468 | } |
| 7469 | return mcp_installed; |
| 7470 | } |
| 7471 | |
| 7472 | static void install_windsurf_config(const char *binary_path, const char *config_path, |
| 7473 | const char *rules_path, bool dry_run) { |
no test coverage detected