Gemini CLI Skill
Run Google Gemini CLI (gemini) from Viber for autonomous coding and general tasks. This skill uses headless mode (gemini -p "<prompt>"), which works reliably from Node/AI SDK tool calls and web UI chat workflows.
Installation
Install Gemini CLI globally:
pnpm add -g @google/gemini-cli
Then authenticate (one of):
# Browser-based login (interactive)
gemini
# Or set API key for headless environments
export GEMINI_API_KEY=your-key-here
Tool
gemini_run— Runs Gemini CLI with a prompt, returns:summary(status, cwd, mode, exit code)stdoutTailandstderrTail(chat-friendly tail output)output(truncated combined output for deeper follow-up)
Why this is web-UI friendly
- Produces compact response tails so users can quickly see what happened.
- Keeps large command output bounded to protect context windows.
- Returns structured fields (
ok,summary,error,exitCode,command) for robust assistant follow-up. - Validates environment early (Gemini CLI installed, cwd exists) with clear user-facing errors.
Parameters
prompt(required): task for Geminicwd(optional): target working directory (must exist)waitSeconds(optional): timeout in seconds (default120, minimum10)approvalMode(optional):yolo(default):--yolo— auto-approve all actionsdefault: normal interactive mode (no special flags)
model(optional): override model (e.g.gemini-2.5-pro,gemini-2.5-flash)outputFormat(optional):text(default) orjsonfor structured output
Usage from Viber
Use this skill when user intent is:
- "use gemini"
- "run gemini cli on this task"
- "delegate this to gemini"
Examples:
gemini_run({
prompt: "Fix failing tests in src/skills/gemini-cli.test.ts",
cwd: "/workspace/openviber",
approvalMode: "yolo",
})
gemini_run({
prompt: "Review this repo and suggest improvements",
approvalMode: "default",
waitSeconds: 180,
model: "gemini-2.5-pro",
})
Recommended follow-up behavior in chat
After calling gemini_run:
- Show
summaryfirst. - Include important lines from
stdoutTail/stderrTail. - If failed, use
error+commandto explain next action. - Ask user whether to re-run with different
approvalMode,model, orcwd.
Authentication
Gemini CLI supports multiple auth methods:
- Google account (browser login) — best for local dev
GEMINI_API_KEYenv var — best for headless/CI environments- Google Cloud ADC — for enterprise setups
If you have a Google Ultra subscription, Gemini CLI will use your subscription's quota automatically when authenticated via Google account.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.