← 提示词库 Meta/muse-agent/skills/google-drive/SKILL.md 原文 md
🌐 中英双语对照

name: "google_drive"
description: "Work with the user's Google Drive: files, folders, uploads, downloads, and sharing."
icon: "google_drive"
metadata: { "includeInPrompt": false }

Google Drive / Google Drive

Everything runs through hatch_gws_cli drive .... Raw API calls are space-separated (<resource> <method>) and take a --params JSON object for query and path values, plus a --json body when creating or editing. Run hatch_gws_cli drive <command> --help for a command's flags, and hatch_gws_cli schema drive.files.list (and the like) for a raw method's --params and --json shape. Check the shape before an unfamiliar method.

一切都通过 hatch_gws_cli drive ... 运行。原始 API 调用以空格分隔(<resource> <method>),接受用于查询和路径取值的 --params JSON 对象,创建或编辑时再加 --json 请求体。运行 hatch_gws_cli drive <command> --help 查看命令标志,运行 hatch_gws_cli schema drive.files.list 等类似命令查看原始方法的 --params 与 --json 结构。使用不熟悉的方法前先查其结构。

Connecting / 连接

Drive needs a one-time connect before commands return data. Run hatch_gws_cli drive status. If it comes back not connected with a connect_url, post that exact URL as [Connect Google Drive](<connect_url>), then stop and wait for the user to tap it. If no URL is returned, report that connection is unavailable and stop; never invent one. Connecting is the user's step, so never open the sign-in, drive a browser to it, point the user to Settings or a Google account page, or ask for credentials. If status comes back unavailable, say Google Drive is not available on this device and stop.

Drive 需要先完成一次性连接,命令才会返回数据。运行 hatch_gws_cli drive status。若返回未连接且带 connect_url,将该 URL 原样以 [Connect Google Drive](<connect_url>) 形式发布,然后停止并等待用户点击。若未返回 URL,报告连接不可用并停止;绝不编造 URL。连接是用户自己的步骤,因此绝不打开登录页、用浏览器导航过去、把用户指向设置或 Google 账户页面,也不索要凭据。若 status 返回不可用,说明 Google Drive 在此设备上不可用并停止。

Disconnect with hatch_gws_cli drive disconnect. Post [Disconnect Google Drive](<disconnect_url>) only when the command returns that URL. If status remains connected after the link was posted, re-post the same link and let the user finish in the browser; never send them to a Google account, security, or third-party-access page, and never loop on status. If no link is returned, rerun status once and report its state without inventing a link. If a later command reports an auth error, rerun status: post its connect link and wait when disconnected, retry the command once when connected, or report that Drive is unavailable when there is no usable link. Auth flows only through status and disconnect. Never hand-author credential files or run raw gws auth.

用 hatch_gws_cli drive disconnect 断开连接。仅当命令返回该 URL 时才发布 [Disconnect Google Drive](<disconnect_url>)。若发布链接后 status 仍显示已连接,重新发布同一链接,让用户在浏览器中完成;绝不把用户送往 Google 账户、安全或第三方访问页面,也绝不在 status 上循环。若未返回链接,重跑一次 status 并如实报告其状态,不编造链接。若后续命令报告认证错误,重跑 status:未连接时发布其连接链接并等待;已连接时将该命令重试一次;没有可用链接时报告 Drive 不可用。认证只经由 status 与 disconnect 进行。绝不手写凭据文件,也不运行原始的 gws auth。

Most people have one Google account, and that is the default: run commands with no account flag. If the user names one of several linked Drives ("my work Drive"), list them with hatch_gws_cli drive accounts, match the user's words to exactly one display_name, and pass its account_id as --account <account_id>. If there is no exact match, ask which account rather than guessing or silently falling back to the default.

多数人只有一个 Google 账户,这也是默认情况:运行命令时不带账户标志。若用户在多个已关联的 Drive 中指名其一("我的工作 Drive"),用 hatch_gws_cli drive accounts 列出它们,将用户的话与唯一一个 display_name 精确匹配,并把其 account_id 作为 --account <account_id> 传入。若无精确匹配,询问是哪个账户,而不是猜测或悄悄回退到默认账户。

Common flows / 常用流程

Find and read / 查找与读取

Upload and download / 上传与下载

Create and organize / 创建与整理

Remove / 移除

Rules / 规则

Limits / 限制