Install MCP config + optional instructions for a generic agent. */
| 7380 | |
| 7381 | /* Install MCP config + optional instructions for a generic agent. */ |
| 7382 | static bool install_generic_agent_config(const char *label, const char *binary_path, |
| 7383 | const char *config_path, const char *instr_path, |
| 7384 | bool dry_run, |
| 7385 | int (*install_mcp)(const char *, const char *)) { |
| 7386 | /* Plan mode: record planned writes, mutate nothing (#388). */ |
| 7387 | if (g_install_plan) { |
| 7388 | plan_record(label, "mcp_config", config_path); |
| 7389 | if (instr_path) { |
| 7390 | plan_record(label, "instructions", instr_path); |
| 7391 | } |
| 7392 | return true; |
| 7393 | } |
| 7394 | printf("%s:\n", label); |
| 7395 | bool mcp_installed = true; |
| 7396 | if (!dry_run) { |
| 7397 | if (!prepare_config_parent(config_path) || |
| 7398 | install_mcp(binary_path, config_path) != CLI_OK) { |
| 7399 | mcp_installed = false; |
| 7400 | record_agent_config_error(false, label, "mcp_install", config_path); |
| 7401 | } |
| 7402 | } |
| 7403 | printf(" mcp: %s\n", config_path); |
| 7404 | if (instr_path) { |
| 7405 | if (!dry_run) { |
| 7406 | if (!prepare_config_parent(instr_path) || |
| 7407 | cbm_upsert_instructions(instr_path, agent_instructions_content) != CLI_OK) { |
| 7408 | record_agent_config_error(false, label, "instructions_install", instr_path); |
| 7409 | } |
| 7410 | } |
| 7411 | printf(" instructions: %s\n", instr_path); |
| 7412 | } |
| 7413 | return mcp_installed; |
| 7414 | } |
| 7415 | |
| 7416 | static void install_windsurf_config(const char *binary_path, const char *config_path, |
| 7417 | const char *rules_path, bool dry_run) { |
no test coverage detected