Install MCP config + optional instructions for a generic agent. */
| 7738 | |
| 7739 | /* Install MCP config + optional instructions for a generic agent. */ |
| 7740 | static bool install_generic_agent_config(const char *label, const char *binary_path, |
| 7741 | const char *config_path, const char *instr_path, |
| 7742 | bool dry_run, |
| 7743 | int (*install_mcp)(const char *, const char *)) { |
| 7744 | /* Plan mode: record planned writes, mutate nothing (#388). */ |
| 7745 | if (g_install_plan) { |
| 7746 | plan_record(label, "mcp_config", config_path); |
| 7747 | if (instr_path) { |
| 7748 | plan_record(label, "instructions", instr_path); |
| 7749 | } |
| 7750 | return true; |
| 7751 | } |
| 7752 | printf("%s:\n", label); |
| 7753 | bool mcp_installed = true; |
| 7754 | if (!dry_run) { |
| 7755 | if (!prepare_config_parent(config_path) || |
| 7756 | install_mcp(binary_path, config_path) != CLI_OK) { |
| 7757 | mcp_installed = false; |
| 7758 | record_agent_config_error(false, label, "mcp_install", config_path); |
| 7759 | } |
| 7760 | } |
| 7761 | printf(" mcp: %s\n", config_path); |
| 7762 | if (instr_path) { |
| 7763 | if (!dry_run) { |
| 7764 | if (!prepare_config_parent(instr_path) || |
| 7765 | cbm_upsert_instructions(instr_path, agent_instructions_content) != CLI_OK) { |
| 7766 | record_agent_config_error(false, label, "instructions_install", instr_path); |
| 7767 | } |
| 7768 | } |
| 7769 | printf(" instructions: %s\n", instr_path); |
| 7770 | } |
| 7771 | return mcp_installed; |
| 7772 | } |
| 7773 | |
| 7774 | static void install_windsurf_config(const char *binary_path, const char *config_path, |
| 7775 | const char *rules_path, bool dry_run) { |
no test coverage detected