@collectui/cli 0.2.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
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collectui/cli",
3
- "version": "0.2.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) {