SuperAPI AI 工具集

google_docs

通用与其它

查看项目

更新于 10-15 17:19

技能介绍

用途:通过 hatch_gws_cli(内置的 Google Workspace CLI)管理用户的 Google Docs,这是唯一实现路径。

主要能力:检查连接状态、断开连接、查看方法 schema、获取文档、创建文档、批量更新文档,以及用 docs +write 追加纯文本。常用命令包括 hatch_gws_cli docs status、hatch_gws_cli docs disconnect、hatch_gws_cli schema docs.documents.get、hatch_gws_cli docs documents get --params '{"documentId":"<document_id>"}'、hatch_gws_cli docs documents create --json '{"title":"Project Brief"}'、hatch_gws_cli docs documents batchUpdate --params '{"documentId":"<document_id>"}' --json '{"requests":[{"insertText":{"location":{"index":1},"text":"Hello, world!"}}]}'。

使用方式:首次使用先运行 hatch_gws_cli docs status;若不可用则告知用户本设备不支持,不要提供替代方案或索要凭据;若为 not_connected 且有 connect_url,按指定 Markdown 链接格式分享并等待用户连接。连接后即可执行文档操作。不熟悉的方法先用 schema 确认参数格式。

内容撰写限制:不要用 batchUpdate 插入或 docs +write 来撰写文档正文,插入的纯文本不带格式。应先用 artifacts 工具在 ~/workspace/your_files/<artifact-slug>/ 下生成带样式的 .docx,再用 hatch_gws_cli docs documents create 创建空文档,然后通过 hatch_gws_cli drive files update --params '{"fileId":"<document_id>"}' --upload "$JARVIS_HOME/workspace/your_files/<artifact-slug>/<name>.docx" 上传,路径必须为绝对路径且位于主目录内。上传后需用 documents.get 读回确认样式。修改时编辑 artifact 并重新上传到同一文档 ID,上传会替换整个正文,可能覆盖他人在 Google 中的编辑,需先读回并征得确认。

适用场景:创建、读取、编辑用户自己的 Google Docs,或对共享文档进行受控修改。

限制:认证由 status 和 disconnect 子命令处理,不要手写凭据文件或运行原始 gws auth。编辑共享文档前需确认。文档 ID 视为不透明字符串,仅使用命令返回或用户明确提供的 ID。更新前优先用 documents.get 了解当前结构。对用户只确认可见结果,不暴露文档 ID、revision ID 等内部字段,除非用户要求或用于排障。