协作办公
用 Google Calendar/Tasks API…
通过 gcal 脚本访问 Google Calendar 和 Tasks API,完成认证、查询、创建、更新、删除事件/任务及 freebusy。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
用 Google Calendar/Ta特定
解决思路
- 在 Google Cloud 创建 OAuth 客户端(Desktop app),将凭据 JSON 保存到 ~/.config/google-calendar/credentials.json。
- 安装依赖(推荐 venv):python3 -m venv ~/.config/google-calendar/venv;~/.config/google-calendar/venv/bin/pip install -r <skill_dir>/scripts/requirements.txt。
- 认证并存储 token:仅 Calendar 用 <skill_dir>/scripts/gcal-auth。
- 仅 Tasks 用 <skill_dir>/scripts/gcal-auth --scopes https://www.googleapis.com/auth/tasks。
- Calendar + Tasks 共用单个 token 用 <skill_dir>/scripts/gcal-auth --scopes https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/tasks。
- 调用 API 示例:<skill_dir>/scripts/gcal list-calendars。
- 凭据默认位于 ~/.config/google-calendar/credentials.json。
- Token 默认位于 ~/.config/google-calendar/token.json。
- 用 --token 或 GCAL_TOKEN_PATH 切换账号或隔离环境。
- 定时事件使用 RFC3339,例如 2026-01-22T10:00:00-08:00。
- 全天事件使用 YYYY-MM-DD,并将 end 设为下一天(exclusive)。
- 当 datetime 没有 offset 时设置 --time-zone。
- 列出日历:<skill_dir>/scripts/gcal list-calendars。
- 列出事件:<skill_dir>/scripts/gcal list-events --calendar-id primary --time-min 2026-01-22T00:00:00-08:00 --time-max 2026-01-22T23:59:59-08:00。
- 搜索事件:<skill_dir>/scripts/gcal list-events --calendar-id primary --q "standup" --time-min ... --time-max ...。
- 创建事件(简单):<skill_dir>/scripts/gcal create-event --calendar-id primary --summary "Review" --start 2026-01-22T10:00:00-08:00 --end 2026-01-22T11:00:00-08:00。
- 更新事件(简单):<skill_dir>/scripts/gcal update-event --calendar-id primary --event-id <id> --summary "New title"。
- 删除事件:<skill_dir>/scripts/gcal delete-event --calendar-id primary --event-id <id>。
- 查询 free/busy:<skill_dir>/scripts/gcal freebusy --calendars primary,team@company.com --time-min ... --time-max ...。
- 列出任务列表:<skill_dir>/scripts/gcal list-tasklists。
- 列出任务:<skill_dir>/scripts/gcal list-tasks --tasklist <tasklist_id>。
- 创建任务:<skill_dir>/scripts/gcal create-task --tasklist <tasklist_id> --title "Buy milk" --due 2026-01-22T10:00:00-08:00。
- 更新任务:<skill_dir>/scripts/gcal update-task --tasklist <tasklist_id> --task-id <id> --notes "Bring receipt"。
- 删除任务:<skill_dir>/scripts/gcal delete-task --tasklist <tasklist_id> --task-id <id>。
- 用 call 访问任意 Calendar API endpoint:<skill_dir>/scripts/gcal call GET /users/me/calendarList。
- 用 call 发送 POST 请求:<skill_dir>/scripts/gcal call POST /calendars/primary/events --body-file /path/to/event.json。
- 复杂 payload(attendees、recurrence、conferenceData)用 --body-file 或 --body(JSON 字符串)。
- 多账号通过不同 token 文件配合 --token 运行。
- 创建、更新或删除事件前先确认意图。
- 将 OAuth 凭据和 token 文件排除在 git 之外。
适用边界 · 注意事项
- 没有 Google Cloud OAuth 客户端、Google 账号或无法完成 OAuth 授权时不要使用。
- 需要访问非 Google Calendar/Tasks 的日历或任务服务时不要使用。