@crabcloud/skills 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,17 @@
1
1
  ---
2
2
  name: crabcloud
3
- description: Manage the user's Crab Cloud personal cloud account and agent tokens through the `crab` CLI — check identity/subscription/credits, list and revoke authorized agent tokens, and re-authorize with specific scopes. Use this skill whenever the user asks about their Crab Cloud account ("我的账号信息", "who am I on crabcloud"), wants to see or clean up authorized agents/tokens ("看看我授权了哪些 agent", "revoke that old token", "撤销那个旧令牌"), or asks how to connect their coding agent to Crab Cloud — even if they never say "crab" or "Crab Cloud" explicitly. Mail, files and projects capabilities ship with their own skills (crabcloud-mail etc.) in later phases.
3
+ description: Manage the user's Crab Cloud personal cloud account and agent tokens through the `crab` CLI — check identity/subscription/credits, list and revoke authorized agent tokens, and re-authorize with specific scopes or scope groups. Use this skill whenever the user asks about their Crab Cloud account ("我的账号信息", "who am I on crabcloud"), wants to see or clean up authorized agents/tokens ("看看我授权了哪些 agent", "revoke that old token", "撤销那个旧令牌"), manages their contacts ("我的联系人", "把 zhangsan 加到联系人", "我的邀请码"), or asks how to connect their coding agent to Crab Cloud — even if they never say "crab" or "Crab Cloud" explicitly. Contacts are managed with `crab contacts …` in this skill; email lives in the crabcloud-mail skill (crab mail …) and the Drive in crabcloud-storage (crab storage …); collab ships in a later phase.
4
4
  ---
5
5
 
6
6
  # Crab Cloud(平台 / 账号域)
7
7
 
8
- Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,邮箱 / 云文件 / 协作项目
9
- 是独立应用。`crab` CLI 是 Agent 的稳定接口:凭证在用户本机
8
+ Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,邮箱 / 云盘 / 协作 /
9
+ 联系人是独立应用。`crab` CLI 是 Agent 的稳定接口:凭证在用户本机
10
10
  (`~/.config/crabcloud/credentials.json`,0600),服务端只存令牌哈希、全程审计。
11
- 本 skill 目前覆盖**平台与账号域**;邮箱(`crabcloud-mail`)、云文件、协作项目
12
- 能力随各阶段上线——用户问到这些时如实说明尚未开放,**不要猜命令**。
11
+ 本 skill 覆盖**平台、账号域与联系人**(`crab contacts …`);邮箱见
12
+ `crabcloud-mail` skill(`crab mail …`),
13
+ 云盘见 `crabcloud-storage` skill(`crab storage …`);协作随后续阶段
14
+ 提供——用户问到时如实说明,**不要猜命令**。
13
15
 
14
16
  ## 第一步:确认 CLI 可用
15
17
 
@@ -17,7 +19,9 @@ Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,
17
19
  `npx @crabcloud/cli init`(登录 + 安装本 skill 一步完成);已装过但命令缺失
18
20
  时运行 `npx @crabcloud/cli@latest init` 升级。
19
21
  - `crab whoami` 报「未登录」或退出码 3 → 引导用户 `crab login`。登录走浏览器
20
- 设备授权(用户逐条确认 scope)——**你只发起,不代批**。
22
+ 设备授权——授权页摆出全目录供用户勾选,**实际授予集由人定**,可能多于或少于
23
+ `--scopes` 请求——**你只发起,不代批**;登录后先 `crab whoami` 核对实际
24
+ scopes 再干活,缺什么就引导用户带组名/scope 重新授权。
21
25
  - 永远不要让用户把 token 粘贴进对话;凭证文件与你无关,也不要读取它。
22
26
 
23
27
  ## 意图 → 命令映射
@@ -26,18 +30,29 @@ Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,
26
30
  |---|---|
27
31
  | 看账号身份 / 订阅 / 积分 | `crab whoami` |
28
32
  | 程序化读取身份 | `crab whoami --json` |
33
+ | 积分余额(月送/充值/合计) | `crab credits`(需 `credits.read`,脚本消费加 `--json`) |
34
+ | 积分流水(花了多少、花在哪) | `crab credits history [--limit N] [--offset N]`(变动 ±:消耗为负;`--json` 含 total) |
35
+ | 查动作计价(如发一封外域邮件扣多少) | `crab credits pricing`(公开端点,无需登录) |
29
36
  | 列出已授权的 Agent 令牌 | `crab tokens list`(脚本消费加 `--json`) |
30
37
  | 撤销某个令牌(高危,先确认) | `crab tokens revoke <id>` |
31
- | 重新授权 / 调整 scope | `crab login --scopes mail.read`(浏览器确认,你只发起) |
38
+ | 重新授权 / 调整 scope | `crab login --scopes mail`(组名整组授权;也可单 scope 如 `mail.read`。浏览器确认,你只发起) |
32
39
  | 登出并吊销当前令牌 | `crab logout` |
40
+ | 联系人:列出 / 搜索 | `crab contacts list [query]`(`--offset`/`--limit` 分页,输出含「共 N 条」) |
41
+ | 联系人:添加 / 删除 | `crab contacts add <address> [--name 名] [--note 备注]` / `crab contacts rm <id|address>` |
42
+ | 我的邀请码、邀请链接与受邀名单 | `crab contacts invite [--reset]` / `crab contacts invitees` |
43
+ | 管理登录设备 / 会话、修改密码 | 网页个人中心(crabcloud.cc/account)——CLI 有意不开放 |
33
44
 
45
+ 积分命令需 `credits.read` scope(`account` 组含它):退出码 4 报缺该 scope 时,
46
+ 引导 `crab login --scopes account` 重新授权。积分额度一律以**积分数**表述
47
+ (100 积分 = $1.00,仅价格类口径用美元);充值/下单是 Web 会话能力,CLI/Agent
48
+ 令牌不动账——用户要充值时引导网页账单页(crabcloud.cc/account/billing)。
34
49
  拿不准令牌 id 时先 `crab tokens list` 核对;`revoke` 只接受列表里的 id。
35
50
 
36
51
  ## 机器可读输出
37
52
 
38
53
  程序化消费时**始终加 `--json`**(`whoami --json` / `tokens list --json`):
39
54
 
40
- - `whoami --json` → `{ actor, scopes, account: { username, displayName, … }, personalSpace, subscription, credits }`;
55
+ - `whoami --json` → `{ actor, scopes, account: { username, displayName, … }, personalSpace, subscription, credits, apps }`;
41
56
  - `tokens list --json` → `[{ id, name, scopes, createdAt, lastUsedAt, expiresAt, revoked }]`:
42
57
  后续 `revoke` 用 `id`,向用户转述时用 `name` + `scopes`。
43
58
 
@@ -57,6 +72,15 @@ Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,
57
72
  - **撤销令牌是高危操作**:先向用户复述目标令牌的名称与 scope,得到确认后再
58
73
  执行 `crab tokens revoke`;撤销立即生效,不可恢复(重新授权即可再建)。
59
74
  - **scope 最小化**:建议按需授权(只读场景 `crab login --scopes account.read`),
60
- 不要怂恿用户一次性给全量 scope。
61
- - 如实转述能力边界:邮箱 / 云文件 / 协作项目尚未上线,相关请求引导用户关注
62
- 后续版本,不要编造命令或输出。
75
+ 不要怂恿用户一次性给全量 scope。`--scopes` 支持组名(`mail` = 读写搜删四项
76
+ 整组)与单个 scope 混用;组目录见 `crab help`,可用组:account / mail /
77
+ storage(云盘,含素材与附件)/ collab / contacts。
78
+ - 如实转述能力边界:协作尚未上线——相关请求如实说明,引导用户
79
+ 用网页(crabcloud.cc),不要编造命令或输出;联系人已上线,用 `crab contacts`
80
+ (list / add / rm / invite / invitees;scope contacts.read/write,程序消费加
81
+ `--json`)处理;邮箱请求转交 `crabcloud-mail`
82
+ skill,云盘请求转交 `crabcloud-storage` skill。
83
+ - 账号安全操作(修改密码、登录设备/会话的查看与吊销)**有意不开放给 agent
84
+ 通道**:改密对令牌持有者是账号接管面,会话属于"人的浏览器会话"。用户让
85
+ agent 做这些时,如实说明并引导到网页个人中心(crabcloud.cc/account)操作,
86
+ 不要猜命令、也不要试图直接调 API。
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: crabcloud-mail
3
+ description: Read, search and send the user's Crab Cloud platform email (username@crabcloud.cc) through the `crab` CLI — list folders, read messages, full-text search, send mail, archive/trash/delete. Use this skill when the user asks to check, read, find, draft or send email on Crab Cloud ("看看我的邮箱", "读一下这封邮件", "帮我回复", "发邮件给…", "crab mail"), or asks what their mailbox looks like — even if they never say "crab" or "Crab Cloud" explicitly.
4
+ ---
5
+
6
+ # Crab Cloud 邮箱(crab mail)
7
+
8
+ 用户的 Crab Cloud 账号自带平台邮箱 `username@crabcloud.cc`(用户名即地址本地部分)。
9
+ 本 skill 覆盖邮箱域的 agent 通道;账号/令牌管理见 `crabcloud` skill。云盘见
10
+ `crabcloud-storage` skill(`crab storage …`),协作尚未上线——用户问到时如实说明,
11
+ **不要猜命令**。
12
+
13
+ ## 第一步:确认可用
14
+
15
+ - 运行 `crab --version` 确认已安装。命令不存在时让用户运行
16
+ `npx @crabcloud/cli init`(登录 + 安装本 skill 一步完成);已装过但命令缺失
17
+ 时运行 `npx @crabcloud/cli@latest init` 升级。
18
+ - CLI 基于 npx 分发,**本机没有 `crab` 命令时,下文所有 `crab <命令>` 都可以
19
+ `npx @crabcloud/cli <命令>` 等价执行**(例如 `npx @crabcloud/cli mail list`)。
20
+ - 未登录(退出码 3)引导用户 `crab login`。
21
+ - 邮箱动作需要对应 scope:读 `mail.read`、搜索 `mail.search`、发信 `mail.send`、
22
+ 删除 `mail.delete`。退出码 4 = scope 不足:如实转述缺哪个,引导用户
23
+ `crab login --scopes mail`(组名 = 四项整组)或单列所需 scope 按需最小化
24
+ 重新授权(你只发起,不代批)。
25
+
26
+ ## 意图 → 命令映射
27
+
28
+ | 用户意图 | 命令 |
29
+ |---|---|
30
+ | 看收件箱 / 各文件夹 | `crab mail list`(默认 inbox;`--folder sent\|drafts\|archive\|trash`) |
31
+ | 只看未读 | `crab mail list --unread` |
32
+ | 翻页 | `crab mail list --cursor <nextCursor>`(列表末尾会提示) |
33
+ | 读某封邮件 | `crab mail read <id>`(自动置已读;正文 + 操作记录) |
34
+ | 找邮件 | `crab mail search <关键词>`(主题/发件人/收件人/正文,不含废纸篓) |
35
+ | 发邮件 | `crab mail send --to a@x.cc --subject "..." --body "..."`(长正文用 `--body-file`) |
36
+ | 发邮件带附件 | `crab mail send … --attach <云盘id\|文件名>[,…]`(引用云盘已有对象,不复制,≤10 个;先 `crab storage ls` 核对对象,文件名需精确唯一命中) |
37
+ | 按名字/备注发邮件 | `--to`/`--cc` 可直接写联系人名(不含 `@`):CLI 查联系人簿解析成地址,唯一命中即用;多候选会报错列出,改用完整地址重试。也可先 `crab contacts list <名字>`(`crabcloud` skill)查地址再发 |
38
+ | 回信(带线程锚点) | 先 `crab mail read <id>` 取 Message-ID,再 `crab mail send --to … --in-reply-to <message-id> …` |
39
+ | 整理邮箱 | `crab mail archive <id>` / `crab mail trash <id>` / `crab mail delete <id>` |
40
+
41
+ 拿不准邮件 id 时先 `crab mail list` / `crab mail search` 核对再操作。
42
+
43
+ ## 计费口径(必须如实转述)
44
+
45
+ - **平台内互发免费**:收件人也是 `@crabcloud.cc` 地址时不消耗积分。
46
+ - **外部出站 2 积分/封**:发送前向用户复述收件人与计费;退出码 7 = 积分不足,
47
+ 告知用户不要自动重试。
48
+ - 发送结果会报告 `消耗积分` 与失败数;部分失败时失败部分的积分自动退回
49
+ (`发送:partial` 标记)。
50
+
51
+ ## 机器可读输出
52
+
53
+ 程序化消费**始终加 `--json`**:
54
+
55
+ - `mail list --json` → `{ items: [...], nextCursor }`,条目含
56
+ `id/folder/fromAddr/to/subject/snippet/isUnread/hasAttachments/createdAt`;
57
+ - `mail read --json` → 完整正文 + `attachments`(id/filename/mimeType/sizeBytes)
58
+ + `actors`(谁读过/谁代发,审计源);
59
+ - `mail send --json` → `{ message, chargedCredits, failedExternal }`。
60
+
61
+ ## 纪律
62
+
63
+ - **发邮件是外发动作**:发送前向用户复述收件人、主题与计费口径,确认后再执行;
64
+ 不确定收件人身份时优先查联系人簿(`crab contacts list <名字>`,见 `crabcloud`
65
+ skill),其次搜索历史邮件核对,不要猜测地址。
66
+ - **`mail delete` 是彻底删除**,不可恢复;用户没明说「彻底删除」时用
67
+ `mail trash`(可找回,废纸篓 30 天后自动清除)。
68
+ - 草稿流程:先 `mail list --folder drafts` 查看草稿;本阶段 CLI 不直接改草稿,
69
+ 确认发送请把草稿内容转述给用户后用 `mail send` 发出。
70
+ - 附件:`mail read` 输出附件清单(id/文件名/类型/体积);附件内容归云盘管
71
+ ——下载用 `crab storage download <id>`(见 `crabcloud-storage` skill,跨来
72
+ 源通用),发送引用云盘对象用 `mail send --attach`(对象须未被其他邮件绑
73
+ 定;若报错说明已被引用,改走正文链接)。邮件详情附件显示「已在云盘删除」
74
+ 表示对象已被软删,如实转述。
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: crabcloud-storage
3
+ description: Manage the user's Crab Cloud Drive (云盘 — unified storage for drive uploads, media assets and mail attachments on one quota) through the `crab` CLI — list and filter objects, upload and download files, rename, tag, categorize, publish/unpublish public links, trash/restore/purge, and check the storage quota. Use this skill when the user asks to upload, find, organize, share or clean up files on Crab Cloud ("上传这个文件", "云盘里有什么", "把这个文件公开分享", "看看存储用了多少", "crab storage"), or wants files moved in or out of their drive — even if they never say "crab" or "Crab Cloud" explicitly.
4
+ ---
5
+
6
+ # Crab Cloud 云盘(crab storage)
7
+
8
+ 云盘是用户的统一存储:云盘上传 / 素材库 / 邮件附件三来源共用一本 2 GB 容量账;
9
+ 属性优先、位置无关——分类(至多一个)+ 标签(AND 检索)代替文件夹。本 skill
10
+ 覆盖云盘域的 agent 通道;账号/令牌管理见 `crabcloud` skill,邮箱见
11
+ `crabcloud-mail` skill。
12
+
13
+ ## 第一步:确认可用
14
+
15
+ - 运行 `crab --version` 确认已安装。命令不存在时让用户运行
16
+ `npx @crabcloud/cli init`(登录 + 安装本 skill 一步完成);已装过但命令缺失
17
+ 时运行 `npx @crabcloud/cli@latest init` 升级。
18
+ - CLI 基于 npx 分发,**本机没有 `crab` 命令时,下文所有 `crab <命令>` 都可以
19
+ `npx @crabcloud/cli <命令>` 等价执行**(例如 `npx @crabcloud/cli storage ls`)。
20
+ - 未登录(退出码 3)引导用户 `crab login`。
21
+ - 动作需要对应 scope:列取/下载 `storage.read`,上传/改名/标签/分类/公开
22
+ `storage.write`,移回收站/恢复/彻底删除 `storage.delete`。退出码 4 = scope
23
+ 不足:如实转述缺哪个,引导 `crab login --scopes storage`(组名 = 三项整组)
24
+ 重新授权(你只发起,不代批)。
25
+ - 退出码 7 = `storage.quotaExceeded`(统一容量账满,2 GB):告知用户,可建议
26
+ 清理回收站或大文件(`storage quota` 看分项),不要自动重试。
27
+
28
+ ## 意图 → 命令映射
29
+
30
+ | 用户意图 | 命令 |
31
+ |---|---|
32
+ | 云盘里有什么 | `crab storage ls`(按时间倒序,默认 30 条) |
33
+ | 找文件 | `crab storage ls --q 关键字`(文件名匹配;可叠 `--source files\|media\|mail`、`--type doc\|image\|video\|archive\|code`、`--tag a,b`、`--shared`、`--recent`) |
34
+ | 看回收站 | `crab storage ls --trash` |
35
+ | 上传文件 | `crab storage upload <路径...>`(多文件串行;直传优先,自动回退中转) |
36
+ | 下载文件 | `crab storage download <id\|文件名> [-o 输出路径]`(默认按原文件名存当前目录) |
37
+ | 改名 | `crab storage rename <id\|文件名> <新名称>` |
38
+ | 加/删标签 | `crab storage tag <id\|文件名> --add a,b [--remove c,d]` |
39
+ | 归类 / 建分类 | `crab storage category <id\|文件名> <categoryId\|none>`;`crab storage mkcat <名称>`;分类 id 见 `crab storage categories` |
40
+ | 公开分享 | `crab storage publish <id\|文件名>`(打印公开直链;收回用 `unpublish`) |
41
+ | 可控分享(有效期/提取码/撤销) | `crab storage share <id\|文件名> [--expires 7\|30\|90\|forever] [--passcode 提取码]`(打印完整分享链接;加密对象链接自带 `#` 密钥片段);列表 `crab storage shares <id\|文件名>`、撤销 `crab storage unshare <shareId>` |
42
+ | 删除 | `crab storage rm <id\|文件名>`(进回收站,7 天后自动清理)→ `restore` 恢复 / `purge` 彻底删除 |
43
+ | 看水位 | `crab storage quota`(三来源分项 + 回收站占用 + 对象计数) |
44
+
45
+ `<id|文件名>`:文件名全库精确唯一命中时自动解析为 id(回收站内同样可解析,
46
+ restore/purge 直接用文件名即可);命中多个或查不到时按字面当 id 用——拿不准
47
+ 先 `crab storage ls --q <关键字>` 核对再操作。
48
+
49
+ ## 机器可读输出
50
+
51
+ 程序化消费**始终加 `--json`**:
52
+
53
+ - `storage ls --json` → `{ objects: [...], nextOffset, total }`,条目含
54
+ `id / source / filename / mimeType / sizeBytes / categoryId / tags / isPublic / createdAt`;
55
+ - `storage quota --json` → `{ usedBytes, quotaBytes, bySource: { files, media, mail }, trashBytes, counts }`;
56
+ - `upload` / `categories` / `tags` 的 `--json` 同构(单对象 / 分类数组 / 标签数组)。
57
+
58
+ ## 纪律
59
+
60
+ - **publish 是对外公开**:公开后任何持链接者可访问,先向用户复述对象与后果,
61
+ 确认后再执行;收回用 `unpublish`(已缓存浏览器至多 5 分钟内失效)。
62
+ - **share 是可控分享**:默认 7 天有效、可选提取码、随时 `unshare` 撤销;加密
63
+ 对象的分享链接自带解密钥匙(`#` 后缀)——泄露链接即泄露文件,外发前向
64
+ 用户复述有效期与提取码设置,确认后再执行。
65
+ - **purge 是彻底删除**,不可恢复;用户没明说「彻底删除」时一律用 `rm`
66
+ (回收站保留 7 天可找回)。
67
+ - 邮件附件与用户上传同账:水位告急时用 `quota` 分项定位来源再建议清理。
68
+ - 公开直链的呈现方式由服务端策略决定(图片/视频/音频/PDF/纯文本内联,SVG 与
69
+ 其他类型强制下载),CLI 侧没有、也不需要有开关。
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@crabcloud/skills",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
- "description": "Crab Cloud agent skills (SKILL.md) with a standalone installer — teach coding agents to operate the user's personal cloud via the crab CLI.",
5
+ "description": "Crab Cloud agent skills (SKILL.md) with a standalone installer \u2014 teach coding agents to operate the user's personal cloud via the crab CLI.",
6
6
  "bin": {
7
7
  "crab-skills": "dist/crab-skills.js"
8
8
  },