| 3352 | } |
| 3353 | |
| 3354 | static void install_cli_agent_configs(const cbm_detected_agents_t *agents, const char *home, |
| 3355 | const char *binary_path, bool dry_run) { |
| 3356 | if (agents->codex) { |
| 3357 | char cp[CLI_BUF_1K]; |
| 3358 | char ip[CLI_BUF_1K]; |
| 3359 | snprintf(cp, sizeof(cp), "%s/.codex/config.toml", home); |
| 3360 | snprintf(ip, sizeof(ip), "%s/.codex/AGENTS.md", home); |
| 3361 | install_generic_agent_config("Codex CLI", binary_path, cp, ip, dry_run, |
| 3362 | cbm_upsert_codex_mcp); |
| 3363 | /* Choose the hook target: if ~/.codex/hooks.json already exists, the |
| 3364 | * user manages Codex hooks via the JSON representation — write the |
| 3365 | * SessionStart reminder there instead of config.toml. Writing both |
| 3366 | * makes Codex warn about loading hooks from two representations (#570). |
| 3367 | * config.toml remains the mcp_config target above either way. */ |
| 3368 | char hooks_json[CLI_BUF_1K]; |
| 3369 | snprintf(hooks_json, sizeof(hooks_json), "%s/.codex/hooks.json", home); |
| 3370 | bool use_hooks_json = cbm_file_exists(hooks_json); |
| 3371 | const char *hook_target = use_hooks_json ? hooks_json : cp; |
| 3372 | if (g_install_plan) { |
| 3373 | plan_record("Codex CLI", "hook", hook_target); |
| 3374 | } else { |
| 3375 | if (!dry_run) { |
| 3376 | if (use_hooks_json) { |
| 3377 | cbm_upsert_gemini_session_hooks(hooks_json); |
| 3378 | } else { |
| 3379 | cbm_upsert_codex_hooks(cp); |
| 3380 | } |
| 3381 | } |
| 3382 | printf(" hooks: SessionStart (codebase-memory-mcp reminder)\n"); |
| 3383 | } |
| 3384 | } |
| 3385 | if (agents->gemini) { |
| 3386 | install_gemini_config(home, binary_path, dry_run); |
| 3387 | } |
| 3388 | if (agents->opencode) { |
| 3389 | char cp[CLI_BUF_1K]; |
| 3390 | char ip[CLI_BUF_1K]; |
| 3391 | snprintf(cp, sizeof(cp), "%s/.config/opencode/opencode.json", home); |
| 3392 | snprintf(ip, sizeof(ip), "%s/.config/opencode/AGENTS.md", home); |
| 3393 | install_generic_agent_config("OpenCode", binary_path, cp, ip, dry_run, |
| 3394 | cbm_upsert_opencode_mcp); |
| 3395 | } |
| 3396 | if (agents->antigravity) { |
| 3397 | char cp[CLI_BUF_1K]; |
| 3398 | char ip[CLI_BUF_1K]; |
| 3399 | /* MCP config is the SHARED Antigravity config (CLI + IDE), not a |
| 3400 | * per-tool file (2026 unification). */ |
| 3401 | snprintf(cp, sizeof(cp), "%s/.gemini/config/mcp_config.json", home); |
| 3402 | snprintf(ip, sizeof(ip), "%s/.gemini/antigravity-cli/AGENTS.md", home); |
| 3403 | if (!dry_run && !g_install_plan) { |
| 3404 | char cfg_dir[CLI_BUF_1K]; |
| 3405 | snprintf(cfg_dir, sizeof(cfg_dir), "%s/.gemini/config", home); |
| 3406 | cbm_mkdir_p(cfg_dir, CLI_OCTAL_PERM); |
| 3407 | } |
| 3408 | install_generic_agent_config("Antigravity", binary_path, cp, ip, dry_run, |
| 3409 | cbm_upsert_antigravity_mcp); |
| 3410 | /* Antigravity CLI is Gemini-lineage and keeps a settings.json under |
| 3411 | * ~/.gemini/antigravity-cli/; install the SessionStart reminder there |
no test coverage detected