@collectui/cli 0.1.0 → 0.2.1

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
@@ -29,7 +29,7 @@ collectui --version
29
29
  collectui login
30
30
  ```
31
31
 
32
- 会自动打开 `https://dash.collectui.pro/login`,登录后在右上角「API 密钥」创建一条 PAT(label 可填 `collectui-cli`),粘贴回终端即可。PAT 保存到 `~/.config/collectui/config.json`(`chmod 600`)。
32
+ 会自动打开 `https://dash.collectui.pro/login`,登录后在右上角「API 密钥」创建一条 PAT(label 可填 `collectui-cli`),粘贴回终端即可。PAT 保存到 `~/.collectui/config.json`(`chmod 600`)。
33
33
 
34
34
  无头 / Agent:
35
35
 
@@ -84,17 +84,21 @@ collectui configure . --libs all --dry-run
84
84
  | 官方 shadcn 占位(`ui.shadcn.com` / `npx shadcn mcp`) | 替换为该库的专属 MCP |
85
85
  | 自定义 URL/命令 | **保留**,并明确报告;只有 `--force` 才替换 |
86
86
 
87
- ## 在 /tmp 初始化新项目
87
+ ## 从零初始化一个 shadcn 项目
88
+
89
+ **默认就在系统临时目录建一个验证项目**,不碰当前目录——`collectui init` 什么都不带
90
+ 就是一条「从零验证」命令:
88
91
 
89
92
  ```bash
90
- collectui init /tmp/my-app --libs all
91
- # 或让 CLI 选临时目录
92
- collectui init --tmp --name my-app --libs reui,arc
93
+ collectui init --libs all # /tmp/collectui-app(OS temp dir)
94
+ collectui init --name demo --libs reui,arc # <temp>/demo
95
+ collectui init /path/to/app --libs all # 指定任意目录
96
+ collectui init --libs all --dry-run # 只看计划
93
97
  ```
94
98
 
95
99
  默认模板:Vite + React + TypeScript + Tailwind v4 + shadcn 兼容
96
100
  `components.json`,并执行 `git init`。`--no-install` 跳过依赖安装;
97
- `--template none` 只配置、不搭脚手架。
101
+ `--template none` 只配置、不搭脚手架(需已有 components.json)。
98
102
 
99
103
  ## 装组件
100
104
 
@@ -186,7 +190,7 @@ collectui doctor --deep # 再对每个已拥有库做一次 registry 探测
186
190
 
187
191
  ## 安全
188
192
 
189
- - PAT 只在 `~/.config/collectui/config.json`(0600)和你自己的项目文件里
193
+ - PAT 只在 `~/.collectui/config.json`(0600)和你自己的项目文件里
190
194
  - `.env.local`、`.mcp.json`、`.cursor/mcp.json`、`.vscode/mcp.json` 含凭据,
191
195
  脚手架默认把它们写进 `.gitignore`
192
196
  - 日志脱敏:已知 key / PAT、`Bearer ...`、`dpat_...` 一律替换为 `[redacted]`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collectui/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
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",
package/src/cli.mjs CHANGED
@@ -35,7 +35,7 @@ Commands:
35
35
  logout Remove the saved PAT
36
36
  whoami, me Show account, libraries, bound keys and repos
37
37
  libs List every library, ownership and key status
38
- init [dir] Scaffold a project and configure selected libraries
38
+ init [dir] Scaffold a fresh shadcn project and configure libraries (no dir: OS temp dir)
39
39
  configure [dir] Configure an existing shadcn project
40
40
  add <lib> <comp...> Install components with the library's channel
41
41
  mcp <sub> Show/init MCP config; call Dash MCP tools
@@ -58,7 +58,7 @@ Global options:
58
58
  --libs <list> Comma list or "all" (default: all owned)
59
59
  --clients <list> claude,cursor,vscode,codex or all (default: claude,cursor,vscode)
60
60
  --cwd <dir> Project directory (default: current directory)
61
- --tmp init under the OS temp directory
61
+ --tmp Force the OS temp dir as target (init defaults there anyway)
62
62
  --name <name> Project/package name
63
63
  --template <t> vite (default) or none
64
64
  --pm <pm> npm | pnpm | yarn | bun
@@ -73,7 +73,8 @@ Global options:
73
73
  Examples:
74
74
  collectui login
75
75
  collectui libs --json
76
- collectui init /tmp/my-app --libs reui,arc --yes --no-install
76
+ collectui init --libs reui,arc --yes --no-install # fresh verify project under the OS temp dir
77
+ collectui init /tmp/my-app --libs all --yes --no-install
77
78
  collectui configure . --libs all --dry-run
78
79
  collectui add reui data-grid
79
80
  collectui mcp show --json
@@ -37,11 +37,10 @@ export function resolveTarget({ flags, rest, mode }) {
37
37
  const explicit = flags.cwd || rest[0];
38
38
  if (explicit) return resolve(String(explicit));
39
39
  const safeName = String(flags.name ?? "collectui-app").replace(/[\\/]+/g, "-");
40
- if (flags.tmp) {
41
- return join(tmpdir(), safeName);
42
- }
43
- if (mode === "configure") return process.cwd();
44
- return resolve(safeName);
40
+ // init 的定位就是「从零开一个临时验证项目」:无显式目标时默认落 OS 临时目录,
41
+ // 绝不弄脏当前目录;configure 才默认当前项目。
42
+ if (flags.tmp || mode === "init") return join(tmpdir(), safeName);
43
+ return process.cwd();
45
44
  }
46
45
 
47
46
  function isNonEmptyDir(dir) {
package/src/config.mjs CHANGED
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
4
 
5
5
  /**
6
- * 本地配置(~/.config/collectui/config.json,chmod 600)。
6
+ * 本地配置(~/.collectui/config.json,chmod 600)。
7
7
  * 只存 PAT 明文和账户快照;密钥不进任何项目文件之外的地方。
8
8
  *
9
9
  * 环境变量覆盖(Agent / CI 用):
@@ -18,7 +18,7 @@ export const DEFAULT_REGISTRY_URL = "https://registry.collectui.pro";
18
18
  export const DASH_MCP_PATH = "/api/mcp";
19
19
 
20
20
  export function configDir() {
21
- return process.env.COLLECTUI_HOME || join(homedir(), ".config", "collectui");
21
+ return process.env.COLLECTUI_HOME || join(homedir(), ".collectui");
22
22
  }
23
23
 
24
24
  export function configFile() {