@crabcloud/cli 0.1.7 → 0.1.9

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,6 +1,6 @@
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 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", "撤销那个旧令牌"), or asks how to connect their coding agent to Crab Cloud — even if they never say "crab" or "Crab Cloud" explicitly. Email lives in the crabcloud-mail skill (crab mail …); the Drive web app is live but has no CLI commands yet; collab and contacts ship 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(平台 / 账号域)
@@ -8,9 +8,10 @@ description: Manage the user's Crab Cloud personal cloud account and agent token
8
8
  Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,邮箱 / 云盘 / 协作 /
9
9
  联系人是独立应用。`crab` CLI 是 Agent 的稳定接口:凭证在用户本机
10
10
  (`~/.config/crabcloud/credentials.json`,0600),服务端只存令牌哈希、全程审计。
11
- 本 skill 覆盖**平台与账号域**;邮箱已上线,见 `crabcloud-mail` skill(`crab mail …`);
12
- 云盘已在网页上线但 **agent 通道(CLI 命令)尚未开放**,协作、联系人随后续阶段
13
- 提供——用户问到这些时如实说明,**不要猜命令**。
11
+ 本 skill 覆盖**平台、账号域与联系人**(`crab contacts …`);邮箱见
12
+ `crabcloud-mail` skill(`crab mail …`),
13
+ 云盘见 `crabcloud-storage` skill(`crab storage …`);协作随后续阶段
14
+ 提供——用户问到时如实说明,**不要猜命令**。
14
15
 
15
16
  ## 第一步:确认 CLI 可用
16
17
 
@@ -33,6 +34,9 @@ Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,
33
34
  | 撤销某个令牌(高危,先确认) | `crab tokens revoke <id>` |
34
35
  | 重新授权 / 调整 scope | `crab login --scopes mail`(组名整组授权;也可单 scope 如 `mail.read`。浏览器确认,你只发起) |
35
36
  | 登出并吊销当前令牌 | `crab logout` |
37
+ | 联系人:列出 / 搜索 | `crab contacts list [query]`(`--offset`/`--limit` 分页,输出含「共 N 条」) |
38
+ | 联系人:添加 / 删除 | `crab contacts add <address> [--name 名] [--note 备注]` / `crab contacts rm <id|address>` |
39
+ | 我的邀请码、邀请链接与受邀名单 | `crab contacts invite [--reset]` / `crab contacts invitees` |
36
40
  | 管理登录设备 / 会话、修改密码 | 网页个人中心(crabcloud.cc/account)——CLI 有意不开放 |
37
41
 
38
42
  拿不准令牌 id 时先 `crab tokens list` 核对;`revoke` 只接受列表里的 id。
@@ -64,9 +68,11 @@ Crab Cloud 是用户的个人云底座:账号、订阅与积分是平台层,
64
68
  不要怂恿用户一次性给全量 scope。`--scopes` 支持组名(`mail` = 读写搜删四项
65
69
  整组)与单个 scope 混用;组目录见 `crab help`,可用组:account / mail /
66
70
  storage(云盘,含素材与附件)/ collab / contacts。
67
- - 如实转述能力边界:云盘已在网页上线但 agent 通道尚未开放(没有
68
- `crab storage` 等命令),协作、联系人尚未上线——相关请求如实说明,引导用户
69
- 用网页(crabcloud.cc),不要编造命令或输出;邮箱请求转交 `crabcloud-mail` skill。
71
+ - 如实转述能力边界:协作尚未上线——相关请求如实说明,引导用户
72
+ 用网页(crabcloud.cc),不要编造命令或输出;联系人已上线,用 `crab contacts`
73
+ (list / add / rm / invite / invitees;scope contacts.read/write,程序消费加
74
+ `--json`)处理;邮箱请求转交 `crabcloud-mail`
75
+ skill,云盘请求转交 `crabcloud-storage` skill。
70
76
  - 账号安全操作(修改密码、登录设备/会话的查看与吊销)**有意不开放给 agent
71
77
  通道**:改密对令牌持有者是账号接管面,会话属于"人的浏览器会话"。用户让
72
78
  agent 做这些时,如实说明并引导到网页个人中心(crabcloud.cc/account)操作,
@@ -6,12 +6,18 @@ description: Read, search and send the user's Crab Cloud platform email (usernam
6
6
  # Crab Cloud 邮箱(crab mail)
7
7
 
8
8
  用户的 Crab Cloud 账号自带平台邮箱 `username@crabcloud.cc`(用户名即地址本地部分)。
9
- 本 skill 覆盖邮箱域的 agent 通道;账号/令牌管理见 `crabcloud` skill。云盘已在网页
10
- 上线(agent 通道未开放),协作尚未上线——用户问到时如实说明,**不要猜命令**。
9
+ 本 skill 覆盖邮箱域的 agent 通道;账号/令牌管理见 `crabcloud` skill。云盘见
10
+ `crabcloud-storage` skill(`crab storage …`),协作尚未上线——用户问到时如实说明,
11
+ **不要猜命令**。
11
12
 
12
13
  ## 第一步:确认可用
13
14
 
14
- - `crab --version` 确认已安装;未登录(退出码 3)引导用户 `crab login`。
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`。
15
21
  - 邮箱动作需要对应 scope:读 `mail.read`、搜索 `mail.search`、发信 `mail.send`、
16
22
  删除 `mail.delete`。退出码 4 = scope 不足:如实转述缺哪个,引导用户
17
23
  `crab login --scopes mail`(组名 = 四项整组)或单列所需 scope 按需最小化
@@ -27,6 +33,8 @@ description: Read, search and send the user's Crab Cloud platform email (usernam
27
33
  | 读某封邮件 | `crab mail read <id>`(自动置已读;正文 + 操作记录) |
28
34
  | 找邮件 | `crab mail search <关键词>`(主题/发件人/收件人/正文,不含废纸篓) |
29
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)查地址再发 |
30
38
  | 回信(带线程锚点) | 先 `crab mail read <id>` 取 Message-ID,再 `crab mail send --to … --in-reply-to <message-id> …` |
31
39
  | 整理邮箱 | `crab mail archive <id>` / `crab mail trash <id>` / `crab mail delete <id>` |
32
40
 
@@ -46,15 +54,21 @@ description: Read, search and send the user's Crab Cloud platform email (usernam
46
54
 
47
55
  - `mail list --json` → `{ items: [...], nextCursor }`,条目含
48
56
  `id/folder/fromAddr/to/subject/snippet/isUnread/hasAttachments/createdAt`;
49
- - `mail read --json` → 完整正文 + `actors`(谁读过/谁代发,审计源);
57
+ - `mail read --json` → 完整正文 + `attachments`(id/filename/mimeType/sizeBytes)
58
+ + `actors`(谁读过/谁代发,审计源);
50
59
  - `mail send --json` → `{ message, chargedCredits, failedExternal }`。
51
60
 
52
61
  ## 纪律
53
62
 
54
63
  - **发邮件是外发动作**:发送前向用户复述收件人、主题与计费口径,确认后再执行;
55
- 不确定收件人身份时先搜索历史邮件核对,不要猜测地址。
64
+ 不确定收件人身份时优先查联系人簿(`crab contacts list <名字>`,见 `crabcloud`
65
+ skill),其次搜索历史邮件核对,不要猜测地址。
56
66
  - **`mail delete` 是彻底删除**,不可恢复;用户没明说「彻底删除」时用
57
67
  `mail trash`(可找回,废纸篓 30 天后自动清除)。
58
68
  - 草稿流程:先 `mail list --folder drafts` 查看草稿;本阶段 CLI 不直接改草稿,
59
69
  确认发送请把草稿内容转述给用户后用 `mail send` 发出。
60
- - 附件:本阶段只标记 `hasAttachments`,附件内容尚未开放读取,如实说明。
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@crabcloud/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "description": "Crab Cloud CLI (crab) — agent-first entry to your personal cloud, with skills bundled for Claude Code / Codex / ZCode.",
6
6
  "bin": {
@@ -24,6 +24,7 @@
24
24
  "prepublishOnly": "bun run typecheck && bun run build"
25
25
  },
26
26
  "devDependencies": {
27
+ "@crabcloud/cloudkit": "workspace:*",
27
28
  "@crabcloud/contracts": "workspace:*",
28
29
  "@crabcloud/skills": "workspace:*",
29
30
  "@types/bun": "latest",