Community程式設計與開發github.com

gog

Google Workspace CLI,用於 Gmail、日曆、雲端硬碟、聯絡人、試算表和文件。

gog 是什麼?

gog 是一個功能強大的命令列工具,專為 Google Workspace 服務設計,包括 Gmail、日曆、雲端硬碟、聯絡人、試算表和文件。它提供了一系列直觀的命令,讓開發者和進階使用者能夠直接在終端機中執行常見操作,例如搜尋 Gmail 郵件、管理日曆事件、搜尋雲端硬碟檔案、匯出文件內容,以及讀寫 Google 試算表。 此工具支援多種平台,包括本機和遠端/無頭主機(headless hosts)。對於遠端主機,它提供了靈活的 OAuth 驗證流程,包括即時回調監聽器、手動貼上模式以及分步驗證模式,確保在不安全的環境中也能安全地處理憑證。gog 還支援基於檔案的密鑰環後端,適用於非互動式或代理驅動的環境。 gog 的核心優勢在於其高效的工作流程整合。它支援透過 `--json` 和 `--no-input` 標誌進行腳本化操作,並允許透過環境變數(如 `GOG_ACCOUNT`)設定預設帳戶,從而減少重複輸入。此外,gog 提供了詳細的診斷命令(如 `gog auth list --check` 和 `gog auth doctor`),幫助用戶驗證憑證狀態,確保所有操作順暢進行。

相容平台~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

遠端 / 無頭(headless)閘道主機

當閘道主機沒有本機瀏覽器顯示時:

  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,後者優先於 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'
    Hi Name,
    
    Thanks for meeting today. Next steps:
    - Item one
    - Item two
    
    Best regards,
    Your Name
    EOF
    
  • 範例(HTML 列表):

    gog gmail send --to [email protected] \
      --subject "Meeting Follow-up" \
      --body-html "<p>Hi Name,</p><p>Thanks for meeting today. Here are the next steps:</p><ul><li>Item one</li><li>Item two</li></ul><p>Best regards,<br>Your Name</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.

相關技能