| 3225 | } |
| 3226 | |
| 3227 | static void install_claude_code_config(const char *home, const char *binary_path, bool force, |
| 3228 | bool dry_run) { |
| 3229 | char config_dir[CLI_BUF_1K]; |
| 3230 | cbm_claude_config_dir(home, config_dir, sizeof(config_dir)); |
| 3231 | char user_root[CLI_BUF_1K]; |
| 3232 | cbm_claude_user_root(home, user_root, sizeof(user_root)); |
| 3233 | |
| 3234 | char skills_dir[CLI_BUF_1K]; |
| 3235 | snprintf(skills_dir, sizeof(skills_dir), "%s/skills", config_dir); |
| 3236 | |
| 3237 | /* Plan mode: record the planned writes and return without mutating (#388). */ |
| 3238 | if (g_install_plan) { |
| 3239 | char p[CLI_BUF_1K]; |
| 3240 | plan_record("Claude Code", "skills", skills_dir); |
| 3241 | snprintf(p, sizeof(p), "%s/.mcp.json", config_dir); |
| 3242 | plan_record("Claude Code", "mcp_config", p); |
| 3243 | snprintf(p, sizeof(p), "%s/.claude.json", user_root); |
| 3244 | plan_record("Claude Code", "mcp_config", p); |
| 3245 | snprintf(p, sizeof(p), "%s/settings.json", config_dir); |
| 3246 | plan_record("Claude Code", "mcp_config", p); |
| 3247 | snprintf(p, sizeof(p), "%s/hooks/%s", config_dir, CMM_HOOK_GATE_SCRIPT); |
| 3248 | plan_record("Claude Code", "hook", p); |
| 3249 | snprintf(p, sizeof(p), "%s/hooks/%s", config_dir, CMM_SESSION_REMINDER_SCRIPT); |
| 3250 | plan_record("Claude Code", "hook", p); |
| 3251 | snprintf(p, sizeof(p), "%s/hooks/%s", config_dir, CMM_SUBAGENT_REMINDER_SCRIPT); |
| 3252 | plan_record("Claude Code", "hook", p); |
| 3253 | return; |
| 3254 | } |
| 3255 | |
| 3256 | printf("Claude Code:\n"); |
| 3257 | |
| 3258 | int skill_count = cbm_install_skills(skills_dir, force, dry_run); |
| 3259 | printf(" skills: %d installed\n", skill_count); |
| 3260 | |
| 3261 | if (cbm_remove_old_monolithic_skill(skills_dir, dry_run)) { |
| 3262 | printf(" removed old monolithic skill\n"); |
| 3263 | } |
| 3264 | |
| 3265 | char mcp_path[CLI_BUF_1K]; |
| 3266 | snprintf(mcp_path, sizeof(mcp_path), "%s/.mcp.json", config_dir); |
| 3267 | if (!dry_run) { |
| 3268 | cbm_install_editor_mcp(binary_path, mcp_path); |
| 3269 | } |
| 3270 | printf(" mcp: %s\n", mcp_path); |
| 3271 | |
| 3272 | char mcp_path2[CLI_BUF_1K]; |
| 3273 | snprintf(mcp_path2, sizeof(mcp_path2), "%s/.claude.json", user_root); |
| 3274 | if (!dry_run) { |
| 3275 | cbm_install_editor_mcp(binary_path, mcp_path2); |
| 3276 | } |
| 3277 | printf(" mcp: %s\n", mcp_path2); |
| 3278 | |
| 3279 | char settings_path[CLI_BUF_1K]; |
| 3280 | snprintf(settings_path, sizeof(settings_path), "%s/settings.json", config_dir); |
| 3281 | if (!dry_run) { |
| 3282 | cbm_upsert_claude_hooks(settings_path); |
| 3283 | cbm_install_hook_gate_script(home, binary_path); |
| 3284 | cbm_install_session_reminder_script(home); |
no test coverage detected