Install MCP config + optional instructions for a generic agent. */
| 7330 | |
| 7331 | /* Install MCP config + optional instructions for a generic agent. */ |
| 7332 | static bool install_generic_agent_config(const char *label, const char *binary_path, |
| 7333 | const char *config_path, const char *instr_path, |
| 7334 | bool dry_run, |
| 7335 | int (*install_mcp)(const char *, const char *)) { |
| 7336 | /* Plan mode: record planned writes, mutate nothing (#388). */ |
| 7337 | if (g_install_plan) { |
| 7338 | plan_record(label, "mcp_config", config_path); |
| 7339 | if (instr_path) { |
| 7340 | plan_record(label, "instructions", instr_path); |
| 7341 | } |
| 7342 | return true; |
| 7343 | } |
| 7344 | printf("%s:\n", label); |
| 7345 | bool mcp_installed = true; |
| 7346 | if (!dry_run) { |
| 7347 | if (!prepare_config_parent(config_path) || |
| 7348 | install_mcp(binary_path, config_path) != CLI_OK) { |
| 7349 | mcp_installed = false; |
| 7350 | record_agent_config_error(false, label, "mcp_install", config_path); |
| 7351 | } |
| 7352 | } |
| 7353 | printf(" mcp: %s\n", config_path); |
| 7354 | if (instr_path) { |
| 7355 | if (!dry_run) { |
| 7356 | if (!prepare_config_parent(instr_path) || |
| 7357 | cbm_upsert_instructions(instr_path, agent_instructions_content) != CLI_OK) { |
| 7358 | record_agent_config_error(false, label, "instructions_install", instr_path); |
| 7359 | } |
| 7360 | } |
| 7361 | printf(" instructions: %s\n", instr_path); |
| 7362 | } |
| 7363 | return mcp_installed; |
| 7364 | } |
| 7365 | |
| 7366 | static void install_windsurf_config(const char *binary_path, const char *config_path, |
| 7367 | const char *rules_path, bool dry_run) { |
no test coverage detected