{"record":{"id":"f056d0c9948205ec","repo":"rtk-ai/rtk","slug":"gemini-support-is-global-only-use-rtk-init-g","errorCode":null,"errorMessage":"Gemini support is global-only. Use: rtk init -g --gemini","messagePattern":"Gemini support is global-only\\. Use: rtk init -g --gemini","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":4199,"sourceCode":"/// Gemini hook wrapper script — delegates to `rtk hook gemini`\nconst GEMINI_HOOK_SCRIPT: &str = r#\"#!/bin/bash\nexec rtk hook gemini\n\"#;\n\nfn resolve_gemini_dir() -> Result<PathBuf> {\n    resolve_home_subdir(GEMINI_DIR)\n}\n\n/// Entry point for `rtk init --gemini`\npub fn run_gemini(\n    global: bool,\n    hook_only: bool,\n    patch_mode: PatchMode,\n    ctx: InitContext,\n) -> Result<()> {\n    let InitContext { dry_run, .. } = ctx;\n    if !global {\n        anyhow::bail!(\"Gemini support is global-only. Use: rtk init -g --gemini\");\n    }\n\n    let gemini_dir = resolve_gemini_dir()?;\n    if !dry_run {\n        fs::create_dir_all(&gemini_dir).with_context(|| {\n            format!(\n                \"Failed to create Gemini config dir: {}\",\n                gemini_dir.display()\n            )\n        })?;\n    }\n\n    // 1. Install hook script\n    let hook_dir = gemini_dir.join(\"hooks\");\n    if !dry_run {\n        fs::create_dir_all(&hook_dir)\n            .with_context(|| format!(\"Failed to create hook dir: {}\", hook_dir.display()))?;\n    }","sourceCodeStart":4181,"sourceCodeEnd":4217,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/hooks/init.rs#L4181-L4217","documentation":"The Gemini integration writes ~/.gemini config (settings and prompt files) — user-global state only — so run_gemini rejects a project-scoped install up front. As with the other global-only agents, nothing is written before the bail, so re-running with -g is safe.","triggerScenarios":"`rtk init --gemini` without `-g`/`--global` — run_gemini at src/hooks/init.rs:4205.","commonSituations":"Scripts that intentionally avoid -g; docs or notes showing --gemini without the global flag.","solutions":["Run `rtk init -g --gemini`","Preview the writes first: `rtk init -g --gemini --dry-run`"],"exampleFix":"# before\nrtk init --gemini   # error: global-only\n\n# after\nrtk init -g --gemini","handlingStrategy":"validation","validationCode":"# bash: gemini is global-only\nrtk init -g --gemini --dry-run   # preview, then run without --dry-run","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a cheat sheet of agent scopes next to your install scripts","Use --dry-run to confirm flag combinations before the real run"],"tags":["cli","init","gemini","agent-scoping","validation"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}