# Google CLI (gog)
gog is a single [[Go]] CLI by [[Peter Steinberger]] that puts Google Workspace into the terminal. One binary, one consistent syntax, stable output formats — covering Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Apps Script, Contacts, Tasks, Classroom, Chat, Groups, Keep, and Workspace admin. Built for terminals, scripts, CI, and coding agents.
It's the same author and the same design philosophy as [[Birdclaw]], [[Spogo]], [[WaCLI]], [[sag]], [[mcporter]], and [[AskOracle]] — local-first, automation-first, single binary, "stop fighting the vendor."
## Why it exists
Google's official tooling for Workspace is fragmented: `gcloud` for cloud, separate APIs per service, web UIs for everything else. There's no single CLI that lets you list a Drive folder, read a Doc, append to a Sheet, send a Gmail, and check a Calendar — without writing glue code per service. gog is that CLI.
The unified surface matters most for two audiences: people who actually live in the terminal, and AI agents that need a *predictable*, *typed-output*, *safety-gateable* way to act on Google data.
## Key features
- **One binary, 15+ services.** Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Apps Script, Contacts, Tasks, Classroom, Chat, Groups, Keep, Workspace admin.
- **Stable output formats.** JSON envelopes for scripts, TSV for `awk`/`cut` pipelines, human-readable output routed to stderr so stdout stays clean.
- **Multi-account, multi-client.** OAuth, raw access tokens, Application Default Credentials (ADC), and Workspace service accounts — all supported.
- **Agent-friendly safety model.** Runtime allow/deny lists for commands; baked "safety profile" binaries that can't be reconfigured at runtime — the right shape for handing a CLI to an autonomous agent.
- **Non-destructive audits.** Drive `tree`/`du`/`inventory`, contact deduplication previews — read-only modes that look without mutating.
- **Auto-generated docs.** Command reference is generated from the schema, so it can't drift from the implementation.
- **Encrypted backup.** Built-in flows for backing up Workspace data with encryption.
- **Secure credential storage.** OS keyrings — Keychain (macOS), Secret Service (Linux), Credential Manager (Windows).
## Installation
```bash
brew install gogcli
```
(Also available via direct download and `go install`.)
## Usage examples
```bash
# Gmail
gog gmail search 'newer_than:7d' --max 10
gog gmail get <messageId> --sanitize-content --json
# Calendar
gog calendar events --today
# Drive
gog drive tree --parent <folderId> --depth 2
# Docs
gog docs format <docId> --match Status --bold --font-size 18
# Sheets
gog sheets table append <spreadsheetId> Tasks 'Ship README|done'
# Slides
gog slides create-from-markdown "Weekly update" --content-file slides.md
```
JSON output makes it trivial to pipe into `jq`, agent harnesses, or downstream tools.
## Design choices worth noting
- **Unified surface, not a wrapper-per-service.** The point is precisely that one syntax covers everything — fewer tools to learn, fewer auth flows to manage, fewer bugs at the seams.
- **Stdout/stderr separation, on purpose.** Human-readable progress goes to stderr so stdout stays parseable. This is non-negotiable for scripting; gog gets it right by default.
- **Safety profiles for agents.** The baked, immutable safety-profile binary is the right answer to "can I let an agent run a Google CLI?" Allow/deny lists at runtime cover the in-the-loop case; baked profiles cover the autonomous case.
- **Read-only by audit, not by accident.** `tree`, `du`, `inventory`, dedup previews — explicit non-mutating verbs rather than relying on the user to remember `--dry-run`.
- **Schema-driven docs.** Generated reference can't lie about what the CLI does.
## Where it fits
For terminal-first users, gog replaces a graveyard of half-finished personal scripts and `gcloud` shims. For agent harnesses ([[OpenClaw]], [[Claude Code]], etc.), it's the right primitive for "let the agent read my email / update a Sheet / draft a Calendar event" — typed output, safety profiles, predictable failure modes.
## References
- Project site: <https://gogcli.sh/>
- Source: <https://github.com/steipete/gogcli>
- License: MIT (not affiliated with Google LLC)
## Related
- [[Command Line Interface (CLI)]]
- [[Peter Steinberger]]
- [[OpenClaw]]
- [[Birdclaw]]
- [[Spogo]]
- [[WaCLI]]
- [[sag]]
- [[mcporter]]
- [[AskOracle]]
- [[Go]]
- [[Homebrew]]