CLI Automation That Actually Works
Practical CLI automation for builders. Learn to automate Google Workspace, AI prompts, and markdown processing with gog, oracle, and qmd.
CLI Automation That Actually Works
The no-fluff guide to automating your workflow with gog, oracle, and qmd.
Author: Amir Brooks Last Updated: January 2026
Quick Reference
| Tool | Purpose | Time Saved |
|---|---|---|
| gog | Google Workspace from terminal | Hours/week on email, calendar, docs |
| oracle | AI prompts with file context | 10x faster than copy-pasting into ChatGPT |
| qmd | Markdown processing pipeline | Batch content operations in seconds |
Official resources
Why CLI Automation Matters
Here's the thing: GUIs are built for discovery. CLIs are built for speed. If you're building a lean solo stack, pair this with the Solo Founder AI Stack and the AI Agents Setup Guide.


Once you know what you want to do, clicking through interfaces is just overhead. Every context switch from terminal to browser costs you 20+ seconds of mental reload time. Do that 50 times a day and you've burned an hour just switching windows.
I run an agency, build products, and manage a CDO role. I don't have time for overhead. These three tools cut my admin time by at least 60%.
The real power isn't in the individual commands—it's in chaining them. Pipe gog output through oracle for AI analysis. Generate content with oracle and process it with qmd. Search Gmail, summarise with AI, and format for publishing—all in one pipeline.
If you want to ship AI products in weeks, automation is a force multiplier. It keeps you in the build loop instead of the busywork loop.
That's what this guide teaches you.
Tool 1: gog — Google Workspace CLI
gog puts your entire Google Workspace in the terminal. Gmail, Calendar, Drive, Docs, Sheets, Contacts, Tasks, Chat—all accessible without opening a browser.
Installation
# macOS (Homebrew)
brew install gog
# Linux (using Go)
go install github.com/lavonglobal/gog@latest
# Verify installation
gog version
Setup & Authentication
# Initial auth (opens browser for OAuth)
gog auth login
# Add additional Google accounts
gog auth login --account work@company.com
# List authenticated accounts
gog auth list
# Set default account
gog config set default-account me@example.com
Core Commands
Gmail
# Search unread emails
gog gmail search "is:unread" --limit 20
# Search with date filter
gog gmail search "after:2026/01/01 from:client.com"
# Get specific message (full content)
gog gmail get <messageId>
# Output as JSON (for scripting)
gog gmail search "is:unread" --json | jq '.[] | .subject'
# Download attachments
gog gmail attachment <messageId> <attachmentId> --output ./downloads/
Calendar
# Today's events
gog calendar list --today
# This week
gog calendar list --days 7
# Create an event
gog calendar create "Client call" \
--start "2026-02-01T14:00:00" \
--duration 1h \
--location "Zoom"
# Quick add (natural language)
gog calendar quick "Team standup tomorrow at 9am"
Drive
# List files in root
gog drive ls
# List files in specific folder
gog drive ls --folder "Projects"
# Search Drive
gog drive search "quarterly report"
# Download file
gog drive get <fileId> --output ./local-copy.docx
# Upload file
gog drive upload ./report.pdf --folder "Reports"
Docs, Sheets, Slides
# Export Google Doc as markdown
gog docs export <docId> --format md --output ./doc.md
# Export as PDF
gog docs export <docId> --format pdf
# Read sheet data
gog sheets read <sheetId> --range "A1:D100" --json
# Write to sheet
gog sheets write <sheetId> --range "A1" --data "Header 1,Header 2,Header 3"
Power Patterns
Daily email digest:
gog gmail search "is:unread" --json | \
jq -r '.[] | "• \(.from): \(.subject)"' > ~/daily-inbox.md
Calendar to markdown:
echo "# Today's Schedule\n" > ~/today.md
gog calendar list --today --plain >> ~/today.md
Backup important docs:
gog drive search "important" --json | \
jq -r '.[].id' | \
xargs -I {} gog drive get {} --output ./backup/
Tool 2: oracle — AI Prompt CLI
oracle is how I talk to GPT from the terminal. Unlike ChatGPT's web interface, oracle lets you attach entire directories of source code, use multiple models simultaneously, and pipe results through other commands.
The key insight: AI is dramatically more useful when it can see your actual codebase. oracle makes that trivial.
Installation
# npm (recommended)
npm install -g oracle-cli
# Verify
oracle --version
Setup
# API mode (requires OpenAI API key)
export OPENAI_API_KEY="sk-..."
# Browser mode (uses your ChatGPT session - no API key needed)
oracle --engine browser --prompt "test"
Core Usage
Basic prompt with files:
oracle --prompt "Review this code for security issues" \
--file "src/**/*.ts"
Attach entire directories:
oracle --prompt "Summarize the architecture of this project" \
--file "src/" \
--file "docs/"
Exclude patterns:
oracle --prompt "Review the data layer" \
--file "src/**/*.ts" \
--file "!src/**/*.test.ts" \
--file "!node_modules"
Model Selection
# GPT-5.2 Pro (default, best for complex analysis)
oracle --prompt "..." --model gpt-5.2-pro
# Faster models for simple tasks
oracle --prompt "..." --model gpt-5.2-instant
# Claude
oracle --prompt "..." --model claude-4.5-sonnet
# Gemini
oracle --prompt "..." --model gemini-3-pro
# Multiple models (parallel comparison)
oracle --prompt "..." --models gpt-5.2-pro,claude-4.5-sonnet,gemini-3-pro
Session Management
oracle runs detached sessions for long operations. This means you can start a query, close your terminal, and come back later.
# Start with memorable slug
oracle --prompt "Full codebase review" \
--file "src/" \
--slug "q1-security-audit"
# Check running sessions
oracle status
# Reattach to session
oracle session q1-security-audit
# View session history
oracle status --hours 72 --limit 50
Advanced Patterns
Code review pipeline:
# Get changed files from git, review with AI
git diff --name-only main | \
xargs oracle --prompt "Review these changes for bugs" --file
Bundle for manual paste (when you want control):
oracle --render --copy-markdown \
--prompt "Review the architecture" \
--file "src/**/*.ts"
# Copies assembled markdown to clipboard
Check token usage before running:
oracle --files-report \
--prompt "..." \
--file "src/"
# Shows token count per file, catches budget overruns
Compare implementations across repos:
oracle --prompt "Compare auth implementations:
Project A (apps/project-a/src/auth) vs
Project B (../project-b/src/auth).
Which is more secure?" \
--file apps/project-a/src/auth/ \
--file ../project-b/src/auth/
Tool 3: qmd — Markdown Processing CLI
qmd handles markdown at scale. Batch transformations, template rendering, format conversion, content extraction—anything you'd do with markdown files, automated.
Installation
# npm
npm install -g qmd
# Verify
qmd --version
Core Commands
Convert formats:
# Markdown to HTML
qmd convert article.md --to html --output article.html
# Markdown to PDF
qmd convert article.md --to pdf --output article.pdf
# Batch convert directory
qmd convert docs/*.md --to html --output-dir ./html/
Extract content:
# Extract all headings
qmd extract article.md --headings
# Extract code blocks
qmd extract article.md --code --lang typescript
# Extract links
qmd extract article.md --links --json
Transform content:
# Add table of contents
qmd transform article.md --add-toc
# Fix heading levels
qmd transform article.md --normalize-headings
# Strip images (for text-only output)
qmd transform article.md --strip images
Template rendering:
# Render template with data
qmd render template.md --data context.json --output output.md
# Variables from CLI
qmd render template.md --set title="My Post" --set date="2026-01-30"
Batch Processing
Process entire content directory:
# Add frontmatter to all posts
qmd batch posts/*.md \
--transform "add-frontmatter" \
--set author="Amir Brooks" \
--set category="Tech"
# Validate all markdown files
qmd lint docs/**/*.md
# Find broken links
qmd check-links content/**/*.md
Content statistics:
# Word count across files
qmd stats content/**/*.md --json | jq '.totalWords'
# Reading time
qmd stats article.md --reading-time
Integration Patterns
Generate site navigation:
qmd list content/**/*.md --frontmatter --json | \
jq 'map({title: .title, url: .path})' > navigation.json
Content linting in CI:
# In GitHub Actions / CI pipeline
qmd lint --strict content/**/*.md || exit 1
Practical Workflows
Here's where it gets powerful—combining all three tools.
Workflow 1: Email → AI Summary → Report
Turn your inbox into an actionable daily brief:
#!/bin/bash
# daily-brief.sh
# 1. Get unread emails
emails=$(gog gmail search "is:unread" --json)
# 2. Summarize with AI
echo "$emails" | oracle --prompt "
Summarize these emails. Group by:
1. Urgent (needs response today)
2. Important (needs response this week)
3. FYI (no action needed)
For each, give: sender, one-line summary, suggested action.
" --model gpt-5.2-instant > daily-brief.md
# 3. Format for publishing
qmd transform daily-brief.md --add-toc --output ~/daily-brief-formatted.md
echo "Brief ready: ~/daily-brief-formatted.md"
Workflow 2: Document Review Pipeline
Get AI review of any Google Doc:
#!/bin/bash
# review-doc.sh
DOC_ID=$1
# 1. Export doc to markdown
gog docs export "$DOC_ID" --format md --output /tmp/doc.md
# 2. AI review
oracle --prompt "
Review this document for:
1. Clarity - is the message clear?
2. Completeness - anything missing?
3. Tone - appropriate for business?
Provide specific suggestions.
" --file /tmp/doc.md > /tmp/review.md
# 3. Format review
qmd transform /tmp/review.md \
--add-frontmatter \
--set reviewed=$(date +%Y-%m-%d) \
--output ./reviews/$(date +%Y%m%d)-review.md
Workflow 3: Content Generation Pipeline
Generate, review, and publish blog content:
#!/bin/bash
# content-pipeline.sh
TOPIC=$1
# 1. Generate draft with AI
oracle --prompt "
Write a 1500-word blog post about: $TOPIC
Requirements:
- Practical, actionable advice
- Code examples where relevant
- No fluff, builder-focused tone
- Include a TL;DR at the start
" --model gpt-5.2-pro > /tmp/draft.md
# 2. Add metadata
qmd transform /tmp/draft.md \
--add-frontmatter \
--set title="$TOPIC" \
--set author="Amir Brooks" \
--set date=$(date +%Y-%m-%d) \
--set status="draft" \
--output content/posts/$(date +%Y%m%d)-$(echo "$TOPIC" | tr ' ' '-' | tr '[:upper:]' '[:lower:]').md
# 3. Validate
qmd lint content/posts/*.md --last 1
echo "Draft created. Review and publish when ready."
Workflow 4: Meeting Prep Automation
Prepare for meetings automatically:
#!/bin/bash
# meeting-prep.sh
# 1. Get today's meetings
meetings=$(gog calendar list --today --json)
# 2. For each meeting, gather context
echo "$meetings" | jq -r '.[].summary' | while read meeting; do
# Search related emails
emails=$(gog gmail search "subject:$meeting" --limit 5 --json)
# Search related docs
docs=$(gog drive search "$meeting" --limit 5 --json)
# Generate prep doc
oracle --prompt "
Create a meeting prep brief for: $meeting
Recent emails: $emails
Related docs: $docs
Include:
- Key discussion points
- Open questions
- Decisions needed
" --model gpt-5.2-instant >> meeting-prep-$(date +%Y%m%d).md
done
qmd transform meeting-prep-$(date +%Y%m%d).md --add-toc
Power User Tips
1. Alias Everything
Add to your .zshrc or .bashrc:
# Quick email check
alias inbox="gog gmail search 'is:unread' --limit 10"
# Today's calendar
alias today="gog calendar list --today"
# Quick AI query
alias ask="oracle --model gpt-5.2-instant --prompt"
# Code review
alias review="oracle --prompt 'Review this code for issues' --file"
2. Use JSON Mode for Scripting
All three tools support --json output. Use it with jq for powerful pipelines:
# Count unread by sender
gog gmail search "is:unread" --json | \
jq 'group_by(.from) | map({sender: .[0].from, count: length}) | sort_by(-.count)'
# Find largest attachments
gog drive ls --json | \
jq 'sort_by(-.size) | .[0:10] | .[] | "\(.name): \(.size / 1000000)MB"'
3. Environment Variables for Multi-Account
# .env.work
export GOG_ACCOUNT="work@company.com"
export ORACLE_MODEL="gpt-5.2-pro"
# .env.personal
export GOG_ACCOUNT="personal@gmail.com"
export ORACLE_MODEL="gpt-5.2-instant"
# Switch contexts
source .env.work
4. Background Long Operations
# Oracle sessions run detached by default
oracle --prompt "Deep codebase analysis" --file "src/" --slug "deep-review" &
# Check later
oracle session deep-review
5. Integrate with Git Hooks
# .git/hooks/pre-commit
#!/bin/bash
# AI review of staged changes
git diff --cached --name-only | \
xargs oracle --prompt "Review these changes. Block commit if critical issues found." --file
if [ $? -ne 0 ]; then
echo "AI found issues. Review before committing."
exit 1
fi
6. Cron Jobs for Automation
# Daily inbox summary (crontab -e)
0 8 * * * /path/to/daily-brief.sh >> ~/logs/brief.log 2>&1
# Weekly report generation
0 17 * * 5 /path/to/weekly-report.sh >> ~/logs/reports.log 2>&1
Troubleshooting
gog: Authentication Issues
# Clear and re-auth
gog auth logout
gog auth login
# Check token status
gog auth status
oracle: Rate Limits
# Check usage
oracle status
# Use faster model for simple tasks
oracle --model gpt-5.2-instant ...
# For heavy workloads, use browser engine (no API limits)
oracle --engine browser ...
qmd: Large File Processing
# Process in batches
find content/ -name "*.md" | head -100 | xargs qmd process
# Skip large files
qmd process docs/**/*.md --max-size 1MB
Next Steps
- Install all three tools and run the auth flows
- Start with one workflow that solves a real pain point
- Build aliases for commands you use daily
- Chain tools together as you get comfortable
- Automate with cron once workflows are proven
The goal isn't to use CLI for everything. It's to eliminate the repetitive stuff so you can focus on work that matters.
Ship fast. Automate the rest.
Related Content
Related Guides
Related Stories
- Building 3 App Store CLIs — Automating release workflows
- The Overnight Build Experiment — Automating while you sleep
- Automating the iOS Simulator — Another CLI story
FAQ
How does CLI automation help ship AI products faster?
It removes repetitive steps, shortens feedback loops, and keeps you focused on product outcomes instead of admin work.
Is CLI automation required for the AI Product Building Course?
No, but it helps. The AI Product Building Course focuses on shipping workflows, and CLI automation is an optional speed boost.
Enjoyed this guide?
Get more actionable AI insights, automation templates, and practical guides delivered to your inbox.
No spam. Unsubscribe anytime.