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