Community编程与开发github.com

gog

Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、联系人、表格和文档。

gog 是什么?

gog 是一个专为 Google Workspace 设计的命令行工具,提供对 Gmail、日历、云端硬盘、联系人、表格和文档的便捷访问。它需要 OAuth 认证,但支持灵活的远程/无头主机部署,包括手动粘贴、远程步骤和文件密钥环等模式。该工具提供了丰富的命令,如搜索和发送邮件、管理日历事件、查询云端硬盘文件、更新表格和导出文档。特别强调了在远程或受限环境中的认证流程,以及通过环境变量和 JSON 输出进行脚本化和非交互式操作的便利性。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/gog

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

gog 是做什么的?

使用 gog 管理 Gmail/日历/云端硬盘/联系人/表格/文档。需要 OAuth 设置。

优先使用已授权的宿主账户:先运行所需的 gog 命令。仅在出现认证错误后才进行设置。切勿在聊天中索要密码、客户端密钥或刷新令牌。

设置(仅一次)

  • gog auth credentials /path/to/client_secret.json
  • gog auth add [email protected] --services gmail,calendar,drive,contacts,docs,sheets
  • gog auth list

远程/无头网关主机

当网关主机没有本地浏览器显示时:

  1. 优先在网关主机上使用实时回调侦听器。从带有浏览器的机器上,转发确切的回调端口(ssh -L <port>:127.0.0.1:<port> user@gateway-host),打开 gog 打印的授权 URL,让重定向在转发的端口上完成。
  2. 当无法使用实时侦听器时,操作员在网关主机的受信任 shell 中选择一种粘贴模式路径。回调 URL 绝不能进入聊天或代理工具输入:
    • --manual:操作员将完整的重定向 URL 粘贴到 gog 的交互式提示中。
    • --remote --step 1:打印 auth_url(和 state_reused)然后退出。浏览器授权后,操作员在受信任 shell 中运行 --remote --step 2 --auth-url <callback-url>。同意后加载 localhost 页面失败是预期行为。
  3. 在远程步骤之间保持相同的已解析配置上下文:GOG_CONFIG_DIR 优先于 --home,--home 优先于 GOG_HOME。同时保留 --client、服务/作用域、重定向 URI 和同意选项。匹配且未过期的手动状态可被重用(state_reused=true)。
  4. 如果桌面密钥环不可用,请配置文件后端(gog auth keyring file)并在网关环境中设置 GOG_KEYRING_PASSWORD,以便非交互式代理/--no-input 运行可以读取令牌。gog auth doctor 会报告密码是否缺失。
  5. 收到回调并不等同于令牌已存储。如果令牌交换或身份查找在代理后面失败,操作员批准作用域出口或代理例外(针对所需的 Google 端点)后,请从步骤 1 重新开始。不要绕过主机网络策略或重用失败或过期的状态。

对于诊断,检查 gog auth list --check 报告的每个条目;其退出状态并不能证明每个存储的令牌都有效。同样,检查 gog auth doctor 报告的状态,而不仅仅依赖其退出代码。

常用命令

  • Gmail 搜索:gog gmail search 'newer_than:7d' --max 10
  • Gmail 消息搜索(按邮件,忽略线程):gog gmail messages search "in:inbox from:ryanair.com" --max 20 --account [email protected]
  • Gmail 发送(纯文本):gog gmail send --to [email protected] --subject "Hi" --body "Hello"
  • Gmail 发送(多行):gog gmail send --to [email protected] --subject "Hi" --body-file ./message.txt
  • Gmail 发送(标准输入):gog gmail send --to [email protected] --subject "Hi" --body-file -
  • Gmail 发送(HTML):gog gmail send --to [email protected] --subject "Hi" --body-html "<p>Hello</p>"
  • Gmail 草稿:gog gmail drafts create --to [email protected] --subject "Hi" --body-file ./message.txt
  • Gmail 发送草稿:gog gmail drafts send <draftId>
  • Gmail 回复:gog gmail send --to [email protected] --subject "Re: Hi" --body "Reply" --reply-to-message-id <msgId>
  • 日历列出事件:gog calendar events <calendarId> --from <iso> --to <iso>
  • 日历创建事件:gog calendar create <calendarId> --summary "Title" --from <iso> --to <iso>
  • 日历创建带颜色:gog calendar create <calendarId> --summary "Title" --from <iso> --to <iso> --event-color 7
  • 日历更新事件:gog calendar update <calendarId> <eventId> --summary "New Title" --event-color 4
  • 日历显示颜色:gog calendar colors
  • 云端硬盘搜索:gog drive search "query" --max 10
  • 联系人:gog contacts list --max 20
  • 表格获取:gog sheets get <sheetId> "Tab!A1:D10" --json
  • 表格更新:gog sheets update <sheetId> "Tab!A1:B2" --values-json '[['"A"','"B"'],['"1"','"2"']]' --input USER_ENTERED
  • 表格追加:gog sheets append <sheetId> "Tab!A:C" --values-json '[['"x"','"y"','"z"']]' --insert INSERT_ROWS
  • 表格清除:gog sheets clear <sheetId> "Tab!A2:Z"
  • 表格元数据:gog sheets metadata <sheetId> --json
  • 文档导出:gog docs export <docId> --format txt --out /tmp/doc.txt
  • 文档查看:gog docs cat <docId>

日历颜色

  • 使用 gog calendar colors 查看所有可用的事件颜色(ID 1-11)
  • 使用 --event-color <id> 标志为事件添加颜色
  • 事件颜色 ID(来自 gog calendar colors 输出):
    • 1: #a4bdfc
    • 2: #7ae7bf
    • 3: #dbadff
    • 4: #ff887c
    • 5: #fbd75b
    • 6: #ffb878
    • 7: #46d6db
    • 8: #e1e1e1
    • 9: #5484ed
    • 10: #51b749
    • 11: #dc2127

邮件格式

  • 优先使用纯文本。对于多段落消息,使用 --body-file(或 --body-file - 用于标准输入)。

  • 相同的 --body-file 模式适用于草稿和回复。

  • --body 不会转义 \n。如果需要内联换行符,请使用 heredoc 或 $'Line 1\n\nLine 2'。

  • 仅在需要富文本格式时使用 --body-html。

  • HTML 标签:<p> 表示段落,<br> 表示换行,<strong> 表示加粗,<em> 表示斜体,<a href="url"> 表示链接,<ul>/<li> 表示列表。

  • 示例(通过标准输入的纯文本):

    gog gmail send --to [email protected] \
      --subject "Meeting Follow-up" \
      --body-file - <<'EOF'
    你好,姓名:
    
    感谢今天的会议。下一步:
    - 事项一
    - 事项二
    
    此致
    你的名字
    EOF
    
  • 示例(HTML 列表):

    gog gmail send --to [email protected] \
      --subject "Meeting Follow-up" \
      --body-html "<p>你好,姓名:</p><p>感谢今天的会议。以下是下一步:</p><ul><li>事项一</li><li>事项二</li></ul><p>此致,<br>你的名字</p>"
    

注意事项

  • 设置 [email protected] 以避免重复使用 --account。
  • 对于脚本化操作,优先使用 --json 加 --no-input。
  • 表格值可以通过 --values-json(推荐)或内联行传递。
  • 文档支持导出/查看/复制。原地编辑需要使用 Docs API 客户端(不在 gog 中)。
  • gog gmail search 每线程返回一行;当需要单独返回每条邮件时,请使用 gog gmail messages search。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills when explicitly requested; install, verify, update, uninstall, publish, or sync skills.

相关技能