Gog Cli

作者 intellectronica9b0e00ad1b94无许可证295 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5个月前更新

Use this skill whenever the user wants to operate Google Workspace from the command line with gog/gogcli, including Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Apps Script, Chat, Classroom, Contacts, Tasks, People, Groups, Admin, Keep, auth, configuration, scripting, or agent-safe Google automation. Prefer this skill for Google account/file/mail/calendar work when the user mentions gog, gogcli, Google CLI, Gmail search/send, Calendar events, Drive files, Docs/Sheets/Slides editing, Forms, Apps Script, Workspace admin, or command-line Google automation.

AI 生成的概览

指导使用 gog/gogcli 命令行工具操作 Gmail、日历、云端硬盘等 Google Workspace 服务。

功能
该技能提供使用 gog(gogcli)命令行工具操作 Google Workspace 的说明和参考资料。内容涵盖安装与身份验证、全局参数、账号选择,以及 Gmail、日历、云端硬盘、文档、表格、幻灯片、表单、Apps Script、Chat、Classroom、通讯录、任务、People、群组、Admin 和 Keep 的操作流程。它还介绍 JSON 输出、分页、试运行和命令白名单等脚本化用法,并指向各服务领域的随附参考文件。
适用场景
当用户希望通过命令行使用 gog 或 gogcli 读取、搜索、发送或修改 Google Workspace 数据时使用。适用于处理 Gmail 邮件、日历事件、云端硬盘文件、文档、表格、幻灯片、表单、Apps Script 或 Workspace 管理的任务。也适用于配置 gog 身份验证、配置项或面向代理的安全自动化。
运行要求
需要安装 gog/gogcli 工具(例如通过 Homebrew),并完成 Google 账号身份验证,例如 OAuth 客户端凭据,或用于 Admin 和 Keep 功能的域委派服务账号。需要访问 Google API 的网络连接。部分服务需要 Workspace 账号或特定权限范围。该技能不包含脚本,仅为说明文档和参考文件。

gogcli (gog)

gog is a fast, script-friendly CLI for Google services. It is JSON-first, supports multiple accounts/OAuth clients, and has explicit guardrails for agent and CI usage.

Authoritative upstream: https://github.com/steipete/gogcli

This skill was refreshed against upstream gog v0.13.0 (2026-04-20). When exact syntax matters, run gog <command> --help or gog schema --json; the command surface moves quickly, rather inconveniently for anyone fond of stale notes.

Operating rules

  • Prefer gog --json ... | jq ... for inspection and scripting.
  • Use --plain only when stable TSV is more convenient than JSON.
  • Use --dry-run for supported mutating operations when preparing a change or when user intent is ambiguous.
  • Use --no-input in automation so commands fail instead of prompting.
  • Use --force only when the user asked for the destructive/public/send/admin operation or after you have clearly explained the effect.
  • Do not repair OAuth, consent, keyring, or Workspace delegation problems silently. Show the exact command the user should run.
  • Do not export tokens, print secrets, open public shares, add delegates/forwarding, send mail, suspend users, or permanently delete data unless the user explicitly requested that action.
  • For agent runs that must not send mail, add --gmail-no-send, set GOG_GMAIL_NO_SEND=1, or configure gog config no-send set <account>.

Install and auth

bash
brew install gogcligog auth credentials set ~/Downloads/client_secret_....jsongog auth add [email protected] --services gmail,calendar,drivegog auth list --check

Notes:

  • Homebrew now uses brew install gogcli; old tap examples are obsolete.
  • gog auth add defaults to --services user. Request the services needed for the task.
  • --services all is accepted only as a backwards-compatible alias for user; do not use it when you need every API.
  • Use --readonly, --drive-scope readonly|file|full, and --gmail-scope readonly|full for least privilege.
  • Keep and Admin require Workspace service-account/domain-wide delegation. Google Chat, Groups, directory, and Classroom also have Workspace restrictions.
  • For headless/CI, consider --manual, --remote, --access-token, or GOG_AUTH_MODE=adc.

Read references/authentication.md for full auth patterns.

Global flags

bash
--account, -a <email|alias|auto>   # account selection--client <name>                    # named OAuth client/token bucket--access-token <token>             # direct short-lived token; also GOG_ACCESS_TOKEN--json, -j                         # machine-readable JSON--plain, -p                        # stable TSV--results-only                     # JSON primary result only--select <fields>                  # best-effort JSON projection--dry-run, -n                      # preview supported writes--force, -y                        # skip confirmations--no-input                         # never prompt--enable-commands <csv>            # allowlist top-level or dotted commands--disable-commands <csv>           # denylist top-level or dotted commands--gmail-no-send                    # block Gmail send operations--verbose, -v                      # debug logging

Useful command aliases:

bash
gog send ...             # alias for gog gmail sendgog ls                   # alias for gog drive lsgog search "budget"      # alias for gog drive searchgog download <fileId>    # alias for gog drive downloadgog upload ./file.pdf    # alias for gog drive uploadgog me                   # alias for gog people megog status               # alias for gog auth statusgog open <id-or-url>     # best-effort Google web URL, offline

High-value workflows

Account selection

bash
gog auth alias set work [email protected]gog --account work gmail search 'is:unread newer_than:2d'GOG_ACCOUNT=work gog calendar events primary --todaygog --client work auth credentials set ~/Downloads/work-client.jsongog --client work auth add [email protected] --services gmail,calendar

Gmail

bash
gog --json gmail search 'is:unread newer_than:7d' | jq -r '.threads[].id'gog gmail messages search 'from:[email protected] has:attachment' --include-bodygog gmail messages search 'subject:report newer_than:30d' --fullgog gmail thread get <threadId> --download --out-dir ./attachmentsgog gmail labels modify <threadId> --add Project --remove INBOXgog gmail messages modify <messageId> --add STARREDgog gmail send --to [email protected] --subject "Hello" --body-file ./body.txtgog gmail forward <messageId> --to [email protected] --note "FYI"

For forwarding, autoreply, watch/Pub/Sub, filters, delegates, send-as, label colours, batch operations, and tracking, read references/gmail.md.

Calendar

bash
gog calendar calendarsgog calendar events primary --today --weekdaygog calendar events --all --from "2026-04-25T00:00:00+02:00" --to "2026-04-26T00:00:00+02:00"gog calendar freebusy --cal primary --from "2026-04-25T09:00:00+02:00" --to "2026-04-25T17:00:00+02:00"gog calendar create primary --summary "Planning" --from "2026-04-25T14:00:00+02:00" --to "2026-04-25T14:30:00+02:00" --attendees "[email protected],[email protected]" --with-meetgog calendar respond primary <eventId> --status accepted --send-updates all

Use RFC3339 with timezone offsets for generated datetimes. Read references/calendar.md for aliases, subscriptions, secondary calendars, extended properties, Focus Time, OOO, working locations, team calendars, and conflict detection.

Drive, Docs, Sheets, Slides, Forms, Apps Script

bash
gog drive search "invoice filetype:pdf" --max 20gog drive upload ./report.md --convert-to doc --parent <folderId>gog drive upload ./deck.pdf --replace <fileId> --name "Board Deck.pdf"gog drive share <fileId> --to user --email [email protected] --role commentergog docs write <docId> --file ./brief.md --replace --markdowngog docs sed <docId> 's/status/{b c=green}approved/g' --dry-rungog sheets update <spreadsheetId> 'Sheet1!A1' '[["Name","Score"],["Ada",98]]'gog sheets chart list <spreadsheetId>gog slides thumbnail <presentationId> <slideId> --out ./slide.pnggog forms responses list <formId> --max 20gog appscript run <scriptId> myFunction --params '["arg1", 123]'

Read references/drive-docs.md for current file/content commands. For Docs sed formatting, read references/sedmat.md.

Other services

bash
gog contacts search "Ada"gog tasks listsgog tasks add <tasklistId> --title "Weekly review" --due "2026-04-27" --repeat weeklygog chat messages send spaces/<spaceId> --text "Build complete"gog groups members [email protected]gog admin users list --domain example.comgog keep search "receipt"

Read references/other-services.md for Chat, Classroom, Contacts, Tasks, People, Groups, Admin, Keep, and time utilities.

Scripting patterns

bash
# Inspect shape firstgog --json gmail search 'is:unread' --max 3 | jq .
# Use pagination/all-pages where availablegog --json calendar events primary --from today --to tomorrow --all-pages
# Fail cleanly when a supported list command has no resultsgog --json calendar events primary --query "unlikely query" --fail-empty
# Batch with xargs after checking outputgog --json gmail search 'older_than:1y label:newsletter' --max 200 | \  jq -r '.threads[].id' | \  xargs -n 50 gog gmail labels modify --remove INBOX
# Agent-safe command surfaceGOG_ENABLE_COMMANDS=calendar.events,calendar.freebusy,tasks \  gog --no-input --json calendar events primary --today

Reference map

  • references/command-reference.md - generated command index from gog schema --json
  • references/authentication.md - OAuth clients, service accounts, scopes, keyrings, headless auth
  • references/configuration.md - config keys, environment variables, output modes, safety switches
  • references/gmail.md - Gmail search, read, send, labels, settings, watch, tracking, autoreply
  • references/calendar.md - Calendar listing, event writes, scheduling, special events, aliases
  • references/drive-docs.md - Drive, Docs, Sheets, Slides, Forms, Apps Script
  • references/sedmat.md - Docs sed/formatting DSL
  • references/other-services.md - Chat, Classroom, Contacts, Tasks, People, Groups, Admin, Keep

来源与署名

来源:intellectronica/agent-skills位于skills/gog-cli提交9b0e00a

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架