@collectui/cli 0.2.47 → 0.2.49

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.
package/README.md CHANGED
@@ -18,7 +18,7 @@ CollectUI Dash 的 shadcn 三方库统一 CLI。一个命令完成:
18
18
  npx @collectui/cli --help
19
19
  # 或全局
20
20
  npm i -g @collectui/cli
21
- collectui --version
21
+ cui --version
22
22
  ```
23
23
 
24
24
  要求 Node ≥ 18.17。
@@ -26,7 +26,7 @@ collectui --version
26
26
  ## 登录
27
27
 
28
28
  ```bash
29
- collectui login
29
+ cui login
30
30
  ```
31
31
 
32
32
  **OAuth 式浏览器授权**:CLI 起一个本机回调监听并打开 Dash 的 `/authorize` 授权页,
@@ -36,9 +36,9 @@ collectui login
36
36
  无浏览器场景(CI / ssh / 远程机):
37
37
 
38
38
  ```bash
39
- collectui login --pat # 终端粘贴 PAT(隐藏输入)
40
- COLLECTUI_TOKEN=dpat_... collectui whoami --json # 或完全 headless
41
- collectui login --token dpat_... --json # 或显式传入
39
+ cui login --pat # 终端粘贴 PAT(隐藏输入)
40
+ COLLECTUI_TOKEN=dpat_... cui whoami --json # 或完全 headless
41
+ cui login --token dpat_... --json # 或显式传入
42
42
  ```
43
43
 
44
44
  > 授权页与 PAT 创建都在 Dash 完成(服务端只把明文回传给 `127.0.0.1`/`localhost`
@@ -47,8 +47,8 @@ collectui login --token dpat_... --json # 或显式传入
47
47
  ## 看账户与库
48
48
 
49
49
  ```bash
50
- collectui whoami # 我是谁 + 我的库:账户信息、每个库是否拥有、CLI/MCP key 状态
51
- collectui whoami --json # Agent 用(account + sites + keys 脱敏 + libraries)
50
+ cui whoami # 我是谁 + 我的库:账户信息、每个库是否拥有、CLI/MCP key 状态
51
+ cui whoami --json # Agent 用(account + sites + keys 脱敏 + libraries)
52
52
  ```
53
53
 
54
54
  ## 一键配置到项目
@@ -56,11 +56,11 @@ collectui whoami --json # Agent 用(account + sites + keys 脱敏 + librarie
56
56
  在已有 shadcn 项目里:
57
57
 
58
58
  ```bash
59
- collectui configure . --libs all
59
+ cui configure . --libs all
60
60
  # 指定库
61
- collectui configure . --libs reui,arc,bits
61
+ cui configure . --libs reui,arc,bits
62
62
  # 先看计划
63
- collectui configure . --libs all --dry-run
63
+ cui configure . --libs all --dry-run
64
64
  ```
65
65
 
66
66
  会做这些事(每步都会打印):
@@ -87,14 +87,14 @@ collectui configure . --libs all --dry-run
87
87
 
88
88
  ## 从零初始化一个 shadcn 项目
89
89
 
90
- **默认就在系统临时目录建一个验证项目**,不碰当前目录——`collectui init` 什么都不带
90
+ **默认就在系统临时目录建一个验证项目**,不碰当前目录——`cui init` 什么都不带
91
91
  就是一条「从零验证」命令:
92
92
 
93
93
  ```bash
94
- collectui init --libs all # /tmp/collectui-app(OS temp dir)
95
- collectui init --name demo --libs reui,arc # <temp>/demo
96
- collectui init /path/to/app --libs all # 指定任意目录
97
- collectui init --libs all --dry-run # 只看计划
94
+ cui init --libs all # /tmp/collectui-app(OS temp dir)
95
+ cui init --name demo --libs reui,arc # <temp>/demo
96
+ cui init /path/to/app --libs all # 指定任意目录
97
+ cui init --libs all --dry-run # 只看计划
98
98
  ```
99
99
 
100
100
  默认模板:Vite + React + TypeScript + Tailwind v4 + shadcn 兼容
@@ -104,12 +104,12 @@ collectui init --libs all --dry-run # 只看计划
104
104
  ## 装组件
105
105
 
106
106
  ```bash
107
- collectui add reui data-grid
108
- collectui add reui data-grid kanban
109
- collectui add arc pro/dock # 自动选 @uiarc-pro
110
- collectui add studio blocks/hero-01 # 自动选 @ss-blocks
111
- collectui add 21st shugar/button-1
112
- collectui add reui data-grid --print # 只打印命令
107
+ cui add reui data-grid
108
+ cui add reui data-grid kanban
109
+ cui add arc pro/dock # 自动选 @uiarc-pro
110
+ cui add studio blocks/hero-01 # 自动选 @ss-blocks
111
+ cui add 21st shugar/button-1
112
+ cui add reui data-grid --print # 只打印命令
113
113
  ```
114
114
 
115
115
  - 所有库统一走 shadcn registry → `npx shadcn@latest add @scope/<component> --yes`
@@ -119,24 +119,24 @@ collectui add reui data-grid --print # 只打印命令
119
119
  ## MCP 配置
120
120
 
121
121
  ```bash
122
- collectui mcp show # 打印按 client 分组的 MCP 配置
123
- collectui mcp init # 只写/合并 MCP 配置
122
+ cui mcp show # 打印按 client 分组的 MCP 配置
123
+ cui mcp init # 只写/合并 MCP 配置
124
124
  ```
125
125
 
126
126
  CollectUI MCP(server 名 `collectui`)是 **Agent 专用**通道:端点
127
127
  `https://dash.collectui.pro/api/mcp`(Bearer PAT),工具 `me`、
128
128
  `list_repos`、`download_repo`、`get_site_docs` 等——Agent 用自己的
129
- MCP client 直接调,CLI 不提供转发。人查账户用 `collectui whoami`,
129
+ MCP client 直接调,CLI 不提供转发。人查账户用 `cui whoami`,
130
130
  可下仓库/反馈/订单在 Dash 站点看。
131
131
 
132
132
  ## 无头 / Agent 驱动
133
133
 
134
134
  ```bash
135
135
  # 所有命令都支持 --json:stdout 逐行 JSON event,最后一条是 result
136
- collectui whoami --json
137
- collectui init /tmp/app --libs all --yes --no-install --json
138
- collectui configure . --libs all --yes --json
139
- collectui doctor --json
136
+ cui whoami --json
137
+ cui init /tmp/app --libs all --yes --no-install --json
138
+ cui configure . --libs all --yes --json
139
+ cui doctor --json
140
140
  ```
141
141
 
142
142
  约定:
@@ -151,15 +151,15 @@ collectui doctor --json
151
151
  装 Agent skill:
152
152
 
153
153
  ```bash
154
- collectui skill # .claude/skills/collectui/SKILL.md
155
- collectui skill --global # ~/.claude/skills/collectui/SKILL.md
154
+ cui skill # .claude/skills/collectui/SKILL.md
155
+ cui skill --global # ~/.claude/skills/collectui/SKILL.md
156
156
  ```
157
157
 
158
158
  ## 体检
159
159
 
160
160
  ```bash
161
- collectui doctor # 登录、account、Dash MCP、项目 registries/env/MCP
162
- collectui doctor --deep # 再对每个已拥有库做一次 registry 探测(会消耗额度,慎用)
161
+ cui doctor # 登录、account、Dash MCP、项目 registries/env/MCP
162
+ cui doctor --deep # 再对每个已拥有库做一次 registry 探测(会消耗额度,慎用)
163
163
  ```
164
164
 
165
165
  ## 更新检查
@@ -168,8 +168,8 @@ collectui doctor --deep # 再对每个已拥有库做一次 registry 探测
168
168
  发现新版会在启动或收尾时打一行提醒,装不装由你决定:
169
169
 
170
170
  ```bash
171
- collectui update # 手动更新(前台看着装)
172
- collectui update --check # 只查不装
171
+ cui update # 手动更新(前台看着装)
172
+ cui update --check # 只查不装
173
173
  ```
174
174
 
175
175
  - `COLLECTUI_NO_AUTO_UPDATE=1`:连检查带提醒全静默(CI / Agent 用)
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@collectui/cli",
3
- "version": "0.2.47",
3
+ "version": "0.2.49",
4
4
  "description": "One CLI for every shadcn library on CollectUI Dash — login once, configure registries & MCP, scaffold agent-ready projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "bin": {
8
- "collectui": "src/cli.mjs",
9
8
  "cui": "src/cli.mjs"
10
9
  },
11
10
  "files": [
package/src/cli.mjs CHANGED
@@ -9,11 +9,8 @@
9
9
  * (stdout 只出逐行 JSON event,Agent 直接消费)。所有动作经 ChangeSet:
10
10
  * 先展示计划再落盘,`--dry-run` 只看不写,密钥全程脱敏。
11
11
  */
12
- import { mkdirSync } from "node:fs";
13
12
  import { homedir } from "node:os";
14
- import { join } from "node:path";
15
13
  import { parseArgv } from "./args.mjs";
16
- import { configDir } from "./config.mjs";
17
14
  import { CLI_NAME, CLI_VERSION } from "./version.mjs";
18
15
  import { collectSecrets, readConfig, resolveToken } from "./config.mjs";
19
16
  import { CliError, usageError } from "./errors.mjs";
@@ -212,12 +209,10 @@ async function main() {
212
209
  process.cwd();
213
210
  } catch {
214
211
  try {
215
- // 切到 CLI 自己的家目录(2026-12-07 用户定:不落 ~ 而落 ~/.collectui)
216
- const safeDir = join(configDir());
217
- mkdirSync(safeDir, { recursive: true });
218
- process.chdir(safeDir);
212
+ // 切回家目录(2026-12-07 用户定:回到 ~)
213
+ process.chdir(homedir());
219
214
  reporter.warn(
220
- `Your terminal's directory no longer exists — the CLI moved itself to ~/.collectui. Run \`cd ~\` in your shell when convenient.`
215
+ `Your terminal's directory no longer exists — the CLI moved itself to ~. Run \`cd ~\` in your shell when convenient.`
221
216
  );
222
217
  } catch {
223
218
  // 兜底 home;再失败极罕见,继续
@@ -27,7 +27,7 @@ never stores upstream vendor accounts.
27
27
  ### Inspect the account
28
28
 
29
29
  ```bash
30
- collectui whoami --json
30
+ cui whoami --json
31
31
  ```
32
32
 
33
33
  The result has `account` and `libraries`: one row per library with `site`,
@@ -40,7 +40,7 @@ ThreeUI, Aura and HeroUI ship their own installers and are out of scope.
40
40
  ### Configure an existing project
41
41
 
42
42
  ```bash
43
- collectui configure /path/to/project --libs reui,arc --yes --json
43
+ cui configure /path/to/project --libs reui,arc --yes --json
44
44
  ```
45
45
 
46
46
  This writes/merges:
@@ -56,8 +56,8 @@ This writes/merges:
56
56
  ### Scaffold under /tmp
57
57
 
58
58
  ```bash
59
- collectui init /tmp/my-app --libs all --yes --json --no-install
60
- # or: collectui init --tmp --name my-app --libs reui
59
+ cui init /tmp/my-app --libs all --yes --json --no-install
60
+ # or: cui init --tmp --name my-app --libs reui
61
61
  ```
62
62
 
63
63
  Default template is Vite + React + TS + Tailwind v4 + a shadcn-compatible
@@ -67,10 +67,10 @@ Default template is Vite + React + TS + Tailwind v4 + a shadcn-compatible
67
67
  ### Install components
68
68
 
69
69
  ```bash
70
- collectui add reui data-grid
71
- collectui add arc pro/dock
72
- collectui add studio blocks/hero-01
73
- collectui add 21st shugar/button-1
70
+ cui add reui data-grid
71
+ cui add arc pro/dock
72
+ cui add studio blocks/hero-01
73
+ cui add 21st shugar/button-1
74
74
  ```
75
75
 
76
76
  Every library installs through `npx shadcn@latest add @scope/<component>
@@ -93,14 +93,14 @@ data through the CLI — it has no such commands.
93
93
  To inspect or re-write the MCP config itself:
94
94
 
95
95
  ```bash
96
- collectui mcp show --json
96
+ cui mcp show --json
97
97
  ```
98
98
 
99
99
  ### Verify
100
100
 
101
101
  ```bash
102
- collectui doctor --json
103
- collectui doctor --deep --json # probe every owned registry (uses quota; sparingly)
102
+ cui doctor --json
103
+ cui doctor --deep --json # probe every owned registry (uses quota; sparingly)
104
104
  ```
105
105
 
106
106
  ## Login
@@ -108,14 +108,14 @@ collectui doctor --deep --json # probe every owned registry (uses quota; spari
108
108
  In an interactive terminal:
109
109
 
110
110
  ```bash
111
- collectui login
111
+ cui login
112
112
  ```
113
113
 
114
114
  It opens `https://dash.collectui.pro/login` in the browser, waits for a
115
115
  localhost callback, and otherwise asks for the PAT (hidden input). Headless:
116
116
 
117
117
  ```bash
118
- COLLECTUI_TOKEN=dpat_... collectui whoami --json
118
+ COLLECTUI_TOKEN=dpat_... cui whoami --json
119
119
  ```
120
120
 
121
121
  ## Security