Who it is forA developer who wants AI steps inside shell scripts, cron jobs or a CI pipeline.
The problemInteractive chat tools do not fit automated pipelines.
The outcomeMachine-readable answers your script or CI job can parse.
What you need first
- Node.js (npm), Homebrew, MacPorts or conda
- A Gemini API key from AI Studio or a Google Cloud project for Vertex AI
Steps
- Run a one-shot prompt:
gemini -p "Explain the architecture of this codebase" - Get structured output:
gemini -p "Explain the architecture of this codebase" --output-format json - Stream events for long tasks with
--output-format stream-json - Pick a model with
gemini -m gemini-2.5-flash
Prompt for your agent
Write a shell script that runs google-gemini/gemini-cli headless with -p and --output-format json to <task> on this repo, parses the JSON with jq, and fails the CI step if <condition>.
Caveat.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for google-gemini/gemini-cli and "Run Gemini headless in scripts and CI with JSON output"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer