Grepedia
GO

gog

A unified Go-based CLI for Google Workspace that streamlines Gmail, Drive, Calendar, and Admin tasks with structured output for scripts, CI, and agents.

Score1
About

gog is a single-binary command-line interface developed for Google Workspace users who need to interact with Google services directly from their terminal. Built primarily in Go, the tool serves as a comprehensive bridge between standard terminal workflows, scripts, CI/CD pipelines, and automated coding agents. It supports a vast array of Google services, including Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Apps Script, Contacts, Tasks, and administrative functions for Workspace. By focusing on providing stable, predictable output, gog allows developers and system administrators to treat Google APIs as reliable command-line utilities. The project is designed with a workflow-first philosophy, ensuring that common tasks are streamlined into one-liners while maintaining deep interoperability with standard Unix tools like awk and grep via structured output formats like JSON and TSV. It handles authentication securely, managing OAuth clients, refresh tokens, and service account credentials while supporting modern security practices like PKCE and domain-wide delegation for Workspace administration. Furthermore, gog addresses the risks of automation by introducing safety profiles, which allow developers to create custom-tailored binaries with baked-in command-level permissions. This prevents automated scripts or agents from accidentally modifying critical data, making the tool suitable for high-stakes environments where reliability and safety are paramount. Whether you are managing user accounts in a corporate environment, backing up mailbox data, or automating document generation from Markdown, gog offers the flexibility and rigor required for modern infrastructure management. The tool's architecture ensures that it remains lightweight yet powerful, providing generated reference documentation for every command and runtime introspection capabilities to assist in developing stable, version-controlled automation scripts.

Some of the key features are:

  • Extensive API Coverage: Support for a broad range of Google services including Gmail, Calendar, Drive, and Workspace Admin in a single binary.
  • Structured Output: Support for stable JSON envelopes and plain TSV output for seamless integration with shell scripting pipelines.
  • Baked Safety Profiles: Hardened binaries with embedded permission sets to prevent unauthorized mutations by agents or scripts.
  • Multi-Account Management: Native capability to handle multiple Google accounts, OAuth clients, and workspaces through a centralized configuration.
  • Workspace Administration: Specialized commands for managing users, organizational units, and groups using the Admin SDK.
  • Preview-First Audits: Secure exploration tools for Drive and Contacts that require explicit flags to perform destructive actions.
  • Extensible Automation: Built-in support for Gmail watches, Pub/Sub integrations, and custom hooks to trigger workflows based on mailbox events.
  • Encrypted Backups: Dedicated functionality to perform secure, encrypted backups of account data directly to local storage.

The tool is operated primarily through a familiar CLI syntax, with subcommands organized by service. Users first perform a one-time authentication setup via the gog auth suite, which configures the necessary OAuth clients or service accounts. Once authenticated, users can execute commands immediately, with optional flag support for persistent configuration, such as setting a default account. For headless operation, gog supports environment variable injection for credentials and keyring management, ensuring it can run reliably within CI/CD runners or systemd services. The binary's output is cleanly separated, sending process progress and warnings to stderr while keeping stdout reserved for machine-parseable data. Advanced users can use the schema discovery feature to dynamically inspect available commands and their constraints, facilitating the development of robust, contract-based automation that adapts to future updates in the tool's capabilities.

Some common use cases include:

  • Automated Provisioning: Creating and managing Workspace users or organizational units using scripts driven by existing HR data.
  • Bulk File Auditing: Generating directory trees or disk usage reports for large Google Drive folders to identify storage inefficiencies.
  • CI/CD Integration: Automatically running tests or deployments that require interaction with Sheets for reporting or Docs for documentation updates.
  • Inbox Triage: Using automated agents to classify, label, or draft replies to incoming emails based on custom logic.
  • Secure Backups: Performing regular, encrypted snapshots of Gmail or Drive data for compliance and data redundancy purposes.
  • Meeting Management: Synchronizing calendar events or team availability across multiple accounts directly from the command line.