Production-ready Gmail read-only CLI in Go with OAuth2 login, Gmail query search, and JSON-first output for server automation.
SaferSkills independently audited gcli (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
用于指导使用 gcli 帮用户“查到邮件并给出可执行下一步”,而不是讲解底层实现。
当用户出现以下意图时,立即使用本技能:
按顺序执行以下检查:
gcli(例如执行 gcli version)。gcli,再执行安装:curl -fsSL https://raw.githubusercontent.com/geekjourneyx/gcli/main/scripts/install.sh | bashgcli version;通过后继续后续流程。GCLI_GMAIL_CLIENT_ID、GCLI_GMAIL_CLIENT_SECRET、GCLI_GMAIL_REFRESH_TOKEN--output tablegcli mail list --label INBOX --limit 20说明:
from/subject/date,追加 --hydrate。gcli mail search "in:inbox is:unread from:[email protected]" --max 50
gcli mail search --q "has:attachment filename:pdf after:2026/01/01" --limit 20
gcli mail search "subject:weekly report" --max 20 --page "<next_page_token>"说明:
--max 是 --limit 别名;--page 是 --page-token 别名。--q 二选一,不能同时传。id、thread_id、date、from、subject、label_ids。--hydrate。gcli mail get --id "<message_id>" --format metadata
gcli mail get --id "<message_id>" --format full
gcli mail get --id "<message_id>" --format raw说明:
metadata:元信息(轻量)full:正文文本/HTML(body_text/body_html)raw:完整 MIME(体积大,仅在需要时用)in:inbox / in:sent / in:drafts / in:trash / in:spamis:unread / is:starred / is:importantfrom:[email protected] / to:[email protected]subject:keywordhas:attachment / filename:pdfafter:2024/01/01 / before:2024/12/31label:Work / label:UNREAD--hydrate 或 --format raw。q 再执行。message_id/thread_id,避免模糊描述。示例回复骨架:
# 1) 搜索
gcli mail search "from:[email protected] newer_than:7d" --max 20
# 2) 深读其中一封
gcli mail get --id "<message_id>" --format fullAUTH_MISSING_CREDENTIALS:缺环境变量或 env 文件未加载AUTH_SCOPE_INSUFFICIENT:scope 非 gmail.readonlyMAIL_NOT_FOUND:message_id 无效或已删除TIMEOUT:减小 --limit 或重试鉴权失败时(AUTH_*)先引导执行 login 流程:
gcli auth login \
--client-id "..." \
--client-secret "..." \
--redirect-uri "http://127.0.0.1:8787/callback" \
--auth-timeout 10m \
--print-env成功后写入并加载环境变量,再重试原邮件命令。
成功:
{"version":"v1","data":{},"error":null}失败:
{"version":"v1","data":null,"error":{"code":"...","message":"...","retryable":false,"details":{"operation":"...","http_status":"...","google_reason":"..."}}}gmail.readonly~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.