Scan Code/User/profiles/ and install (or plan) a per-profile mcp.json for * each existing profile subdirectory, so VS Code profile users inherit the MCP * server without manual steps (#431). No-op when profiles/ is absent. */
| 3440 | * each existing profile subdirectory, so VS Code profile users inherit the MCP |
| 3441 | * server without manual steps (#431). No-op when profiles/ is absent. */ |
| 3442 | static void install_vscode_profile_configs(const char *code_user, const char *binary_path, |
| 3443 | bool dry_run) { |
| 3444 | char profiles_dir[CLI_BUF_1K]; |
| 3445 | snprintf(profiles_dir, sizeof(profiles_dir), "%s/profiles", code_user); |
| 3446 | cbm_dir_t *d = cbm_opendir(profiles_dir); |
| 3447 | if (!d) { |
| 3448 | return; |
| 3449 | } |
| 3450 | cbm_dirent_t *ent; |
| 3451 | while ((ent = cbm_readdir(d)) != NULL) { |
| 3452 | if (strcmp(ent->name, ".") == 0 || strcmp(ent->name, "..") == 0) { |
| 3453 | continue; |
| 3454 | } |
| 3455 | char profile_path[CLI_BUF_1K]; |
| 3456 | snprintf(profile_path, sizeof(profile_path), "%s/%s", profiles_dir, ent->name); |
| 3457 | struct stat st; |
| 3458 | if (stat(profile_path, &st) != 0 || !S_ISDIR(st.st_mode)) { |
| 3459 | continue; |
| 3460 | } |
| 3461 | char cp[CLI_BUF_1K]; |
| 3462 | snprintf(cp, sizeof(cp), "%s/mcp.json", profile_path); |
| 3463 | install_generic_agent_config("VS Code", binary_path, cp, NULL, dry_run, |
| 3464 | cbm_install_vscode_mcp); |
| 3465 | } |
| 3466 | cbm_closedir(d); |
| 3467 | } |
| 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, |
no test coverage detected