Install MCP configs for editor-based agents (Zed, KiloCode, VS Code, OpenClaw). */
| 3468 | |
| 3469 | /* Install MCP configs for editor-based agents (Zed, KiloCode, VS Code, OpenClaw). */ |
| 3470 | static void install_editor_agent_configs(const cbm_detected_agents_t *agents, const char *home, |
| 3471 | const char *binary_path, bool dry_run) { |
| 3472 | if (agents->zed) { |
| 3473 | char cp[CLI_BUF_1K]; |
| 3474 | #ifdef __APPLE__ |
| 3475 | snprintf(cp, sizeof(cp), "%s/Library/Application Support/Zed/settings.json", home); |
| 3476 | #elif defined(_WIN32) |
| 3477 | snprintf(cp, sizeof(cp), "%s/Zed/settings.json", cbm_app_local_dir()); |
| 3478 | #else |
| 3479 | snprintf(cp, sizeof(cp), "%s/zed/settings.json", cbm_app_config_dir()); |
| 3480 | #endif |
| 3481 | install_generic_agent_config("Zed", binary_path, cp, NULL, dry_run, cbm_install_zed_mcp); |
| 3482 | } |
| 3483 | if (agents->kilocode) { |
| 3484 | char cp[CLI_BUF_1K]; |
| 3485 | char ip[CLI_BUF_1K]; |
| 3486 | #ifdef __APPLE__ |
| 3487 | snprintf(cp, sizeof(cp), |
| 3488 | "%s/Library/Application Support/Code/User/globalStorage/" |
| 3489 | "kilocode.kilo-code/settings/mcp_settings.json", |
| 3490 | home); |
| 3491 | #else |
| 3492 | snprintf(cp, sizeof(cp), |
| 3493 | "%s/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json", |
| 3494 | cbm_app_config_dir()); |
| 3495 | #endif |
| 3496 | snprintf(ip, sizeof(ip), "%s/.kilocode/rules/codebase-memory-mcp.md", home); |
| 3497 | install_generic_agent_config("KiloCode", binary_path, cp, ip, dry_run, |
| 3498 | cbm_install_editor_mcp); |
| 3499 | } |
| 3500 | if (agents->vscode) { |
| 3501 | char code_user[CLI_BUF_1K]; |
| 3502 | #ifdef __APPLE__ |
| 3503 | snprintf(code_user, sizeof(code_user), "%s/Library/Application Support/Code/User", home); |
| 3504 | #else |
| 3505 | snprintf(code_user, sizeof(code_user), "%s/Code/User", cbm_app_config_dir()); |
| 3506 | #endif |
| 3507 | char cp[CLI_BUF_1K]; |
| 3508 | snprintf(cp, sizeof(cp), "%s/mcp.json", code_user); |
| 3509 | install_generic_agent_config("VS Code", binary_path, cp, NULL, dry_run, |
| 3510 | cbm_install_vscode_mcp); |
| 3511 | /* VS Code profiles each keep their own settings under |
| 3512 | * Code/User/profiles/<id>/. The default mcp.json above does NOT apply |
| 3513 | * to a named profile, so write/plan a per-profile mcp.json for every |
| 3514 | * existing profile directory (#431). */ |
| 3515 | install_vscode_profile_configs(code_user, binary_path, dry_run); |
| 3516 | } |
| 3517 | if (agents->cursor) { |
| 3518 | char cp[CLI_BUF_1K]; |
| 3519 | snprintf(cp, sizeof(cp), "%s/.cursor/mcp.json", home); |
| 3520 | install_generic_agent_config("Cursor", binary_path, cp, NULL, dry_run, |
| 3521 | cbm_install_editor_mcp); |
| 3522 | } |
| 3523 | if (agents->openclaw) { |
| 3524 | char cp[CLI_BUF_1K]; |
| 3525 | snprintf(cp, sizeof(cp), "%s/.openclaw/openclaw.json", home); |
| 3526 | install_generic_agent_config("OpenClaw", binary_path, cp, NULL, dry_run, |
| 3527 | cbm_install_openclaw_mcp); |
no test coverage detected