@wot-ui/cli 1.0.5-beta.1 → 1.0.6

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
@@ -1,213 +1,267 @@
1
- # Open Wot
1
+ <p align="center">
2
+ <a href="https://wot-ui.cn">
3
+ <img src="./docs/assets/wot-ui-logo.svg" width="112" alt="Wot UI">
4
+ </a>
5
+ </p>
2
6
 
3
- open-wot 是 wot-ui 的 AI 工具链仓库,当前对外发布的核心包为 `@wot-ui/cli`。它提供命令行工具、MCP Server、离线组件知识库与数据提取脚本,用于把 wot-ui v2 的组件知识接入编辑器、AI Agent 和本地工程分析流程。
7
+ <h1 align="center">@wot-ui/cli</h1>
4
8
 
5
- ## 仓库定位
9
+ <p align="center"><strong>让 AI 真正懂 wot-ui。</strong></p>
6
10
 
7
- - 面向 wot-ui v2 的组件知识查询工具
8
- - 面向本地项目的组件使用分析与 lint 工具
9
- - 面向 AI 客户端的 MCP stdio 服务
10
- - 面向仓库维护者的数据提取与同步工作流
11
+ <p align="center">
12
+ 把组件 API、文档、示例和版本知识,接入你的终端与 AI 编程工具。
13
+ </p>
11
14
 
12
- ## 核心能力
15
+ <p align="center">
16
+ <a href="https://www.npmjs.com/package/@wot-ui/cli"><img src="https://img.shields.io/npm/v/%40wot-ui%2Fcli?style=flat-square&color=1c64fd" alt="npm version"></a>
17
+ <a href="https://www.npmjs.com/package/@wot-ui/cli"><img src="https://img.shields.io/npm/dm/%40wot-ui%2Fcli?style=flat-square&color=12b886" alt="npm downloads"></a>
18
+ <a href="https://github.com/wot-ui/open-wot/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/wot-ui/open-wot/ci.yml?branch=main&style=flat-square&label=CI" alt="CI"></a>
19
+ <a href="./LICENSE.md"><img src="https://img.shields.io/npm/l/%40wot-ui%2Fcli?style=flat-square" alt="license"></a>
20
+ </p>
13
21
 
14
- - 组件知识查询:`list`、`info`、`doc`、`demo`、`token`、`changelog`
15
- - 项目分析:`doctor`、`usage`、`lint`
16
- - Agent 接入:`wot agent init` 自动配置 MCP、内置 Skill 与 Agent Instructions
17
- - MCP 生命周期:`wot mcp`(默认启动 Server)、`wot mcp serve/list/init/status/doctor/remove/print`
18
- - 元数据提取:从 `wot-ui/wot-ui` 源码生成本地 `v2.json`
22
+ <p align="center">
23
+ <a href="https://cli.wot-ui.cn">官方网站</a>
24
+ · <a href="#-30-秒接入">快速开始</a>
25
+ · <a href="#给-ai-使用推荐">Agent 接入</a>
26
+ · <a href="#在终端使用">CLI</a>
27
+ · <a href="#只配置-mcp">MCP</a>
28
+ · <a href="./CONTRIBUTING.md">参与贡献</a>
29
+ </p>
19
30
 
20
- ## 安装
31
+ ---
21
32
 
22
- 推荐全局安装 CLI:
33
+ 组件文档不应该只能被人阅读。Open Wot 将 wot-ui v2 的组件知识打包成离线数据,并通过 CLI、MCP 和 Skills 提供给开发者与 AI Agent。
34
+
35
+ - **不猜 API**:查询真实的 props、events、slots、CSS 变量和 demo 源码。
36
+ - **版本对得上**:自动识别项目依赖,也可以精确查询指定的 wot-ui 版本。
37
+ - **知识离线可用**:组件数据随 npm 包发布,无需文档 API 或密钥。
38
+ - **配置安全可控**:支持 dry-run、幂等写入、原子更新和失败保护。
39
+
40
+ ## 🚀 30 秒接入
41
+
42
+ 需要 Node.js `>= 20`。
23
43
 
24
44
  ```bash
25
45
  npm install -g @wot-ui/cli@latest
46
+ wot agent init --client cursor
47
+ wot agent doctor --client cursor
26
48
  ```
27
49
 
28
- 也可以使用其他包管理器:
50
+ 完成后,当前项目会获得:
29
51
 
30
- ```bash
31
- pnpm add -g @wot-ui/cli@latest
32
- bun add -g @wot-ui/cli@latest
52
+ ```text
53
+ MCP Server AI 可以按需调用 8 个 wot-ui tools
54
+ wot-ui-v2 Skill AI 知道何时、如何选择和使用组件
55
+ Instructions AI 在生成代码前主动查询真实组件知识
33
56
  ```
34
57
 
35
- 安装完成后可直接使用 `wot`:
58
+ 使用其他客户端时,只需替换 client id:
36
59
 
37
- ```bash
38
- wot list
39
- ```
60
+ | Claude Code | Cursor | VS Code | Codex |
61
+ | --- | --- | --- | --- |
62
+ | `claude` | `cursor` | `vscode` | `codex` |
40
63
 
41
- 如果只想临时运行,也可以使用包执行器,不会修改项目依赖:
64
+ 同时使用多个 AI 客户端时,可以一次完成全部项目级配置:
42
65
 
43
66
  ```bash
44
- pnpm dlx @wot-ui/cli@latest list
45
- npx -y @wot-ui/cli@latest list
46
- yarn dlx @wot-ui/cli@latest list
47
- bunx @wot-ui/cli@latest list
67
+ wot agent init --client all
68
+ wot agent doctor --client all --timeout 30000
48
69
  ```
49
70
 
50
- `wot` 在交互式终端启动时会自动检查 `@wot-ui/cli` 是否有新版本。检查结果最多缓存 24 小时,提示只写入 stderr,不会污染 `--format json` 的 stdout;CI 和非交互式环境会自动跳过。`wot mcp` 不会在启动时输出更新提示,MCP 客户端可通过 `wot_status` tool 查询 CLI 更新状态。若需要关闭检查,可设置 `WOT_DISABLE_UPDATE_CHECK=1` 或 `NO_UPDATE_NOTIFIER=1`。
71
+ `--client all` 在 project scope 下会处理 Claude Code、Cursor、VS Code 和 Codex;在 user scope 下只处理支持用户级配置的客户端。
51
72
 
52
- 如果你在仓库内本地调试,推荐直接运行源码入口,而不是依赖全局命令:
73
+ 配置完成后重启客户端;如果出现“信任项目”或“批准 MCP Server”的提示,请按客户端指引确认。
53
74
 
54
- ```bash
55
- pnpm exec tsx src/index.ts list
56
- ```
75
+ ## ✨ 它解决什么问题
57
76
 
58
- ## 快速开始
77
+ 没有上下文的 AI 容易混用 Vue 组件库 API、使用不存在的属性,或者生成与项目版本不匹配的代码。Open Wot 在 AI 写代码前补上准确的 wot-ui 上下文:
59
78
 
60
- ```bash
61
- wot list
62
- wot list button
63
- wot info Button
64
- wot demo Button basic
65
- wot doc Button
66
- wot token Button
67
- wot changelog
68
- wot doctor ./my-project
69
- wot usage ./my-project
70
- wot lint ./my-project
71
- wot agent list
72
- wot agent init --client cursor
73
- wot mcp
79
+ ```mermaid
80
+ flowchart LR
81
+ A["wot-ui 文档 · API · Demo · Changelog"] --> B["Open Wot 离线知识库"]
82
+ B --> C["CLI"]
83
+ B --> D["MCP · 8 tools"]
84
+ B --> E["Skills + Instructions"]
85
+ D --> F["Cursor · Claude Code · VS Code · Codex"]
86
+ E --> F
74
87
  ```
75
88
 
76
- ## 命令说明
77
-
78
- ### 组件知识
89
+ 它也可以单独作为一个快速的组件知识 CLI:
79
90
 
80
- - `wot list [keyword]`:列出可用的 wot-ui 组件,支持按名称、中文名、标签、分类和描述过滤
81
- - `wot info <component>`:查看组件 props、events、slots、CSS 变量
82
- - `wot doc <component>`:输出组件 markdown 文档
83
- - `wot demo <component> [name]`:查看 demo 列表或指定 demo 源码
84
- - `wot token [component]`:查看组件 CSS 变量与默认值
85
- - `wot changelog [version] [component]`:查看版本更新记录
86
-
87
- ### 项目分析
91
+ ```console
92
+ $ wot info Button
88
93
 
89
- - `wot doctor [dir]`:检查项目依赖、运行环境与基础集成情况
90
- - `wot usage [dir]`:统计 `.vue` 文件中的 `wd-*` 使用情况
91
- - `wot lint [dir]`:检查未知组件、空按钮等规则
94
+ Button 按钮 (wd-button)
95
+ 按钮用于触发一个操作,如提交表单或打开链接。
92
96
 
93
- ### Agent 接入
97
+ Props:
98
+ - type: string = primary
99
+ - variant: string = base
100
+ - size: string = medium
101
+ - disabled: boolean = false
102
+ - loading: boolean = false
94
103
 
95
- #### 复制给 AI,一键接入
104
+ Events:
105
+ - click (`event`): 点击事件
96
106
 
97
- 将下面这段提示词复制到 Claude Code、Cursor、VS Code 或 Codex,让当前 AI Agent 自动完成接入:
107
+ Slots:
108
+ - default: 按钮内容
109
+ ```
98
110
 
99
- ```text
100
- 请在当前项目根目录接入 wot-ui 的 AI 开发能力,并直接执行所需命令:
111
+ ## 给 AI 使用(推荐)
101
112
 
102
- 1. 确认 Node.js 版本不低于 20。
103
- 2. 执行 `npm install -g @wot-ui/cli@latest` 安装或更新全局 CLI。不要使用 sudo;如果全局安装因权限受限而失败,改用 `npx -y @wot-ui/cli@latest` 运行后续命令,并在结果中说明。
104
- 3. 识别你当前所在的 AI 客户端,并使用对应的 client id:Claude Code 使用 claude,Cursor 使用 cursor,VS Code 使用 vscode,Codex 使用 codex。只配置当前客户端;如果无法确定,请先询问我,不要猜测。
105
- 4. 执行 `wot agent init --client <client-id> --scope project --with mcp,skill,instructions --yes` 完成项目级接入;不要手动覆盖现有配置。若上一步回退到 npx,则用 `npx -y @wot-ui/cli@latest` 代替 `wot`。
106
- 5. 执行 `wot agent doctor --client <client-id> --scope project --with mcp,skill,instructions` 检查配置、MCP handshake、Skill 和 Instructions;使用与上一步相同的 CLI 执行方式。
107
- 6. 最后告诉我:CLI 安装结果、识别到的客户端、修改了哪些文件、doctor 检查结果,以及是否需要我重启客户端或批准项目 MCP。
113
+ `agent init` 是推荐入口,它会同时配置 MCP、安装 Skill,并写入由 open-wot 管理的项目 Instructions。
108
114
 
109
- 请保留项目中已有的 MCP Server 和用户内容;如果命令失败,不要绕过安全检查,说明具体原因和建议的处理方式。
115
+ ```bash
116
+ wot agent init --client cursor
117
+ wot agent status --client cursor
118
+ wot agent doctor --client cursor
110
119
  ```
111
120
 
112
- 这段提示词会优先安装全局 `wot` 命令,并在权限受限时安全回退到 `npx`。生成的 MCP 配置、安装的 Skill 和 Instructions 会持久保留在项目中;`agent init` 是幂等操作,重复执行不会重复添加配置。
113
-
114
- 也可以手动执行:
121
+ 整个生命周期都可以通过 CLI 管理:
115
122
 
116
123
  ```bash
117
124
  wot agent list
125
+ wot agent init --client cursor --dry-run
118
126
  wot agent init --client cursor
119
127
  wot agent status --client cursor
120
128
  wot agent doctor --client cursor
121
129
  wot agent remove --client cursor
122
130
  ```
123
131
 
124
- `agent init` 默认同时安装三项能力:
125
-
126
- - 在客户端项目配置中注册 `wot-ui` MCP Server
127
- - 安装仓库内置的 `wot-ui-v2` Skill
128
- - 在 `AGENTS.md` 或 `CLAUDE.md` 中维护 open-wot 自己拥有的 Instructions 区块
132
+ 多客户端项目:
129
133
 
130
- 当前 npm 发布包只随附以下两个 Skill:
134
+ ```bash
135
+ wot agent init --client all
136
+ wot agent status --client all
137
+ wot agent doctor --client all --timeout 30000
138
+ wot agent remove --client all --dry-run
139
+ ```
131
140
 
132
- | Skill | 主要用途 | 随 npm 发布 | `agent init` 默认安装 |
133
- | --- | --- | --- | --- |
134
- | `wot-ui-v2` | 组件选型、API 查询、页面生成与组件问题排查 | 是 | 是 |
135
- | `wot-ui-cli` | CLI、MCP、数据提取与 open-wot 仓库维护 | 是 | 否 |
141
+ - `--dry-run` 只展示变更计划,不写文件。
142
+ - 交互式写操作会请求确认;Agent 或 CI 中显式传入 `--yes`。
143
+ - 重复执行 `init` 不会重复插入配置。
144
+ - `remove` 只移除 open-wot 管理的内容,不覆盖其他 Server 或用户配置。
145
+ - 默认安装面向组件使用者的 `wot-ui-v2` Skill;仓库维护 Skill `wot-ui-cli` 不会默认安装。
136
146
 
137
- 可通过 `--with` 限制能力范围:
147
+ 只接入部分能力:
138
148
 
139
149
  ```bash
140
150
  wot agent init --client codex --with mcp
141
151
  wot agent init --client claude --with skill,instructions
142
- wot agent status --client claude --with skill,instructions
143
- wot agent doctor --client claude --with skill,instructions
144
- wot agent init --client cursor --dry-run
145
152
  ```
146
153
 
147
- `status` 和 `doctor` 只检查 `--with` 选中的能力;未选择 MCP 时,`doctor` 不会启动 MCP Server。
154
+ <details>
155
+ <summary><strong>不想自己操作?复制这段话给 AI</strong></summary>
156
+
157
+ ```text
158
+ 请在当前项目中接入 wot-ui 的 AI 开发能力:
159
+
160
+ 1. 确认 Node.js >= 20。
161
+ 2. 安装或更新 `@wot-ui/cli@latest`;优先全局安装,不要使用 sudo。权限受限时改用 `npx -y @wot-ui/cli@latest` 执行后续命令。
162
+ 3. 识别当前客户端:Claude Code=claude、Cursor=cursor、VS Code=vscode、Codex=codex。无法确定时先询问我。
163
+ 4. 执行 `wot agent init --client <client-id> --scope project --with mcp,skill,instructions --yes`。
164
+ 5. 执行 `wot agent doctor --client <client-id> --scope project --with mcp,skill,instructions`。
165
+ 6. 告诉我修改了哪些文件、doctor 结果,以及是否需要重启客户端或批准 MCP。
166
+
167
+ 请保留已有 MCP Server 和用户内容;如果安全检查失败,说明原因,不要绕过。
168
+ ```
169
+
170
+ </details>
171
+
172
+ ## 在终端使用
173
+
174
+ 推荐全局安装:
175
+
176
+ ```bash
177
+ npm install -g @wot-ui/cli@latest
178
+ wot -V
179
+ ```
180
+
181
+ 一次性查询也可以直接使用 package runner:
148
182
 
149
- `init` 和 `remove` 支持 `--dry-run`。写操作在交互式终端中会请求确认;脚本和 CI 必须显式传入 `--yes`。重复执行是幂等的,删除操作只移除 `wot-ui` MCP 条目、未修改的内置 Skill 文件和 open-wot 托管 Instructions 区块。
183
+ ```bash
184
+ npx -y @wot-ui/cli@latest info Button
185
+ pnpm dlx @wot-ui/cli@latest info Button
186
+ ```
150
187
 
151
- 若 Instructions 中的 open-wot 标记残缺、顺序错误或重复,CLI 会拒绝修改,避免误删用户内容。
188
+ ### 组件知识
152
189
 
153
- ### 通用参数
190
+ | 命令 | 用途 |
191
+ | --- | --- |
192
+ | `wot list [keyword]` | 按名称、中文名、标签、分类或描述查找组件 |
193
+ | `wot info <component>` | 查询 props、events、slots 和 CSS 变量 |
194
+ | `wot doc <component>` | 获取完整 Markdown 文档 |
195
+ | `wot demo <component> [name]` | 查看 demo 列表或指定 demo 源码 |
196
+ | `wot token [component]` | 查询组件 CSS 变量 |
197
+ | `wot changelog [versionOrComponent] [component]` | 按版本或组件查询更新记录 |
154
198
 
155
- 多数查询命令支持以下参数:
199
+ ```bash
200
+ wot list button
201
+ wot info Button
202
+ wot demo Button demo-1
203
+ wot token Button
204
+ ```
156
205
 
157
- - `--format text`(默认)或 `--format json`:输出格式
158
- - `--version <ver>`:指定 wot-ui 版本,支持以下格式:
159
- - `2.0`(minor,自动解析到最新 patch)
160
- - `2.0.4`(exact patch)
161
- - `latest`(始终使用最新稳定版)
162
- - 不传时自动从项目 `node_modules/@wot-ui/ui` 或 `package.json` 依赖声明检测,检测不到则回退到最新版
206
+ ### 项目分析
163
207
 
164
- 示例:
208
+ | 命令 | 用途 |
209
+ | --- | --- |
210
+ | `wot doctor [dir]` | 检查依赖、运行环境和基础集成 |
211
+ | `wot usage [dir]` | 统计 `.vue` 文件中的 `wd-*` 使用情况 |
212
+ | `wot lint [dir]` | 检查未知组件、空按钮等问题 |
213
+
214
+ ### 版本与结构化输出
165
215
 
166
216
  ```bash
167
- wot info Button --version 2.0.0
168
- wot doc Button --version 2.0
169
- wot list --format json --version latest
217
+ wot info Button --version 2.0
218
+ wot info Button --version 2.0.4
219
+ wot list --version latest --format json
170
220
  ```
171
221
 
172
- ## MCP 集成
222
+ 不传 `--version` 时,CLI 会依次检查项目安装版本、依赖声明和最新离线数据。查询命令支持 `--format text|json|markdown`;结构化结果写入 stdout,诊断信息保持在 stderr。
173
223
 
174
- `wot mcp` 保留默认启动 stdio Server 的行为;在脚本或文档中也可以使用语义更明确的 `wot mcp serve`。
224
+ ## 只配置 MCP
175
225
 
176
- 推荐使用 CLI 自动配置:
226
+ 如果只需要 MCP,不需要 Skill 和 Instructions:
177
227
 
178
228
  ```bash
179
229
  wot mcp list
180
230
  wot mcp init --client cursor
181
231
  wot mcp status --client cursor
182
232
  wot mcp doctor --client cursor
233
+ wot mcp remove --client cursor
183
234
  ```
184
235
 
185
- 支持的客户端和 project scope 配置位置:
236
+ 支持的项目配置:
186
237
 
187
- | Client | 配置文件 | 根字段 |
238
+ | Client | 文件 | 配置根字段 |
188
239
  | --- | --- | --- |
189
240
  | Claude Code | `.mcp.json` | `mcpServers` |
190
241
  | Cursor | `.cursor/mcp.json` | `mcpServers` |
191
242
  | VS Code | `.vscode/mcp.json` | `servers` |
192
243
  | Codex | `.codex/config.toml` | `mcp_servers.wot-ui` |
193
244
 
194
- Claude Code、Cursor 和 Codex 同时支持 `--scope user`;VS Code 当前使用 project scope。管理命令支持 `--format json`,`init`、`status`、`doctor`、`remove` 和 `print` 支持通过 `--pin [version]` 固定生成配置中的 `@wot-ui/cli` 版本;只有会写文件的 `init` 和 `remove` 支持 `--dry-run`。
195
-
196
- dry-run 和 JSON 结果只输出托管配置节点的安全预览,不输出配置文件完整内容或其他 Server 的环境变量。写操作还可以使用 `--client all` 一次处理所有支持当前 scope 的客户端。
197
-
198
- Codex adapter 会在写入前后验证完整 TOML。若现有配置使用 `[mcp_servers.wot-ui.env]` 等外部嵌套子表,CLI 会拒绝自动接管或删除;请先将自定义字段迁移到主 Server 定义,再重新执行命令。
245
+ ```bash
246
+ wot mcp print --client cursor # 只预览配置
247
+ wot mcp init --client cursor --dry-run # 预览文件变更
248
+ wot mcp init --client all # 配置所有客户端
249
+ wot mcp init --client codex --pin # 固定当前 CLI 版本
250
+ ```
199
251
 
200
- `doctor` 分三层检查配置、MCP handshake 和客户端注册状态。Handshake 会验证 Server 名称以及 `wot_status`、`wot_list` 核心工具;Claude Code 和 Codex 会进一步调用客户端 CLI 查询注册状态。Cursor、VS Code 没有稳定查询接口时会显示 `server-ready`,提示用户重启客户端并在 MCP 面板确认,而不会将它描述为客户端已经就绪。需要用户批准或信任项目时退出码为 `2`,配置或 handshake 失败时退出码为 `1`。
252
+ Claude Code、Cursor 和 Codex 支持 `--scope user`;VS Code 当前使用 project scope。`doctor` 会验证配置和真实 MCP handshake,并在客户端支持时继续检查注册状态。
201
253
 
202
- 只需要查看配置而不写文件时:
254
+ 直接启动 stdio Server:
203
255
 
204
256
  ```bash
205
- wot mcp print --client vscode
257
+ wot mcp # 默认启动
258
+ wot mcp serve # 语义明确的等价写法
206
259
  ```
207
260
 
208
- 也可以手动配置。推荐使用无需全局安装的 `npx` 方式:
261
+ <details>
262
+ <summary><strong>手动配置 MCP</strong></summary>
209
263
 
210
- 将以下配置加入支持 MCP 的客户端:
264
+ 自动配置默认使用 `npx` 启动 Server,避免桌面应用读取不到终端的全局 `PATH`:
211
265
 
212
266
  ```json
213
267
  {
@@ -220,7 +274,7 @@ wot mcp print --client vscode
220
274
  }
221
275
  ```
222
276
 
223
- 如果已经全局安装 CLI,并且 AI 客户端可以从 `PATH` 中找到 `wot`,也可以使用:
277
+ 已全局安装且客户端能够找到 `wot` 时,也可以使用:
224
278
 
225
279
  ```json
226
280
  {
@@ -233,130 +287,169 @@ wot mcp print --client vscode
233
287
  }
234
288
  ```
235
289
 
236
- 桌面应用不一定会继承终端中的 npm 全局 `PATH`,因此默认配置和 `wot mcp init` 仍使用兼容性更好的 `npx` 方式。
290
+ </details>
237
291
 
238
- 当前 MCP Server 提供以下 tools:
292
+ <details>
293
+ <summary><strong>8 个 MCP tools</strong></summary>
239
294
 
240
- | Tool | 功能 | 主要参数 |
241
- | --- | --- | --- |
242
- | `wot_status` | 查看 MCP Server 与 `@wot-ui/cli` 状态,包括当前版本、是否有 CLI 更新及更新命令。 | 无 |
243
- | `wot_list` | 列出当前离线知识库中的组件摘要,不包含完整文档、API 与 demo 源码,适合在生成页面前发现可用组件。 | `version` |
244
- | `wot_info` | 查询单个组件的 props、events、slots、CSS 变量等结构化信息。 | `component`, `version` |
245
- | `wot_doc` | 获取单个组件的完整 markdown 文档,适合需要阅读用法细节或限制说明时调用。 | `component`, `version` |
246
- | `wot_demo` | 获取不含源码的 demo 摘要列表;指定 demo 名称时获取完整示例源码。 | `component`, `demo`, `version` |
247
- | `wot_token` | 查询组件 CSS 变量;不传组件名时返回所有组件的 CSS 变量摘要。 | `component`, `version` |
248
- | `wot_changelog` | 查询 wot-ui v2 离线数据中的更新记录,可按版本或组件过滤。 | `version`, `component` |
249
- | `wot_lint` | 扫描本地项目中的 wot-ui 使用问题,例如未知组件、空按钮等规则。 | `dir`, `version` |
295
+ | Tool | 能力 |
296
+ | --- | --- |
297
+ | `wot_status` | Server、CLI 版本与更新状态 |
298
+ | `wot_list` | 组件发现与摘要 |
299
+ | `wot_info` | props、events、slots、CSS 变量 |
300
+ | `wot_doc` | 完整组件文档 |
301
+ | `wot_demo` | demo 摘要或指定示例源码 |
302
+ | `wot_token` | 组件 CSS 变量 |
303
+ | `wot_changelog` | 版本与组件更新记录 |
304
+ | `wot_lint` | 项目中的 wot-ui 使用问题 |
250
305
 
251
- 其中 `version` 支持与 CLI 一致的写法,例如 `2.0`、`2.0.4`、`latest`;不传时会按项目依赖或离线数据自动解析。
306
+ </details>
252
307
 
253
- 为控制 Agent 上下文占用,MCP 的 `wot_list` 只返回 `name`、`nameZh`、`tag`、`category`、`description` 和 `since`;需要组件 API、文档或示例源码时,再调用 `wot_info`、`wot_doc` 或带具体 demo 名称的 `wot_demo`。CLI 的 `list --format json` 与 `demo --format json` 继续保留原有详细结构,避免影响已有脚本。
308
+ ## 完整命令速查
254
309
 
255
- ## 数据来源
310
+ <details>
311
+ <summary><strong>展开全部命令和参数</strong></summary>
256
312
 
257
- 当前版本聚焦 `wot-ui v2`。仓库内的离线数据来自 `wot-ui/wot-ui` 源码,主要提取自:
313
+ ### 组件知识与项目分析
258
314
 
259
- - `docs/component/*.md`
260
- - `docs/guide/changelog.md`
261
- - `src/uni_modules/wot-ui/components/*/index.scss`
315
+ | 命令 | 说明 |
316
+ | --- | --- |
317
+ | `wot list [keyword]` | 查找组件 |
318
+ | `wot info <component>` | 查询组件 API |
319
+ | `wot doc <component>` | 获取完整文档 |
320
+ | `wot demo <component> [name]` | 查询 demo |
321
+ | `wot token [component]` | 查询 CSS 变量 |
322
+ | `wot changelog [versionOrComponent] [component]` | 查询更新记录 |
323
+ | `wot doctor [dir]` | 诊断项目环境 |
324
+ | `wot usage [dir]` | 分析组件使用情况 |
325
+ | `wot lint [dir]` | 检查组件使用问题 |
262
326
 
263
- `data/` 目录保存每个 stable patch 版本的独立快照(`v2.0.0.json`、`v2.0.1.json`、…),以及一个始终指向最新版的 `v2.json`。
327
+ 以上查询命令都支持 `--version <version>` 和 `--format text|json|markdown`。
264
328
 
265
- ### 更新数据
329
+ ### Agent
266
330
 
267
- **全量同步所有历史 tag(推荐,首次或需要补全历史版本时使用):**
331
+ | 命令 | 说明 |
332
+ | --- | --- |
333
+ | `wot agent list` | 列出支持和检测到的客户端 |
334
+ | `wot agent init` | 初始化 MCP、Skill 和 Instructions |
335
+ | `wot agent status` | 检查三类能力的配置状态 |
336
+ | `wot agent doctor` | 检查文件并执行真实 MCP handshake |
337
+ | `wot agent remove` | 删除 open-wot 管理的接入内容 |
268
338
 
269
- ```bash
270
- pnpm sync:clone
271
- ```
339
+ `init`、`status`、`doctor` 和 `remove` 支持:
272
340
 
273
- 克隆 wot-ui 仓库(`--filter=tree:0 --no-checkout`,不下载文件树),按所有 stable tag 逐一 checkout + 提取,已有快照自动跳过。
341
+ - `--client auto|all|claude|cursor|vscode|codex`
342
+ - `--scope project|user`
343
+ - `--with mcp,skill,instructions`
344
+ - `--cwd <directory>`
345
+ - `--format text|json`
346
+ - `--pin [version]`
274
347
 
275
- **仅更新最新版本(快速,CI 单版本触发时使用):**
348
+ 其中 `init`、`remove` 额外支持 `--dry-run` 和 `--yes`,`doctor` 支持 `--timeout <milliseconds>`。
276
349
 
277
- ```bash
278
- pnpm extract:clone
279
- ```
350
+ ### MCP
280
351
 
281
- **使用本地已有的 wot-ui 仓库:**
352
+ | 命令 | 说明 |
353
+ | --- | --- |
354
+ | `wot mcp` | 启动 stdio Server |
355
+ | `wot mcp serve` | 显式启动 stdio Server |
356
+ | `wot mcp list` | 列出客户端和检测结果 |
357
+ | `wot mcp init` | 写入 MCP 配置 |
358
+ | `wot mcp status` | 检查 MCP 配置 |
359
+ | `wot mcp doctor` | 验证配置、handshake 和客户端状态 |
360
+ | `wot mcp remove` | 删除托管的 MCP 配置 |
361
+ | `wot mcp print` | 输出单个客户端的配置片段 |
282
362
 
283
- ```bash
284
- # 全量多版本
285
- pnpm sync --wot-dir ../wot-ui
363
+ `init`、`status`、`doctor`、`remove` 和 `print` 支持 `--client`、`--scope`、`--cwd`、`--format` 和 `--pin`;`init`、`remove` 额外支持 `--dry-run`、`--yes`,`doctor` 支持 `--timeout`。`list` 支持 `--cwd` 和 `--format`;`print` 必须指定一个具体客户端,不能使用 `auto` 或 `all`。
286
364
 
287
- # 单个版本,手动指定 checkout 后提取
288
- pnpm extract --wot-dir ../wot-ui --output data/v2.0.4.json
365
+ 随时可以查看 CLI 自带帮助:
366
+
367
+ ```bash
368
+ wot --help
369
+ wot agent init --help
370
+ wot mcp doctor --help
289
371
  ```
290
372
 
291
- ## 开发本仓库
373
+ </details>
374
+
375
+ ## 安全设计
376
+
377
+ open-wot 会修改客户端配置,因此写入流程默认保守:
292
378
 
293
- 当前根目录就是主发布包,核心源码位于 `src`,离线数据位于 `data`,提取脚本位于 `scripts`。
379
+ - 先计算 ChangePlan,再确认或执行。
380
+ - 支持 `--dry-run` 和 JSON 预览。
381
+ - 保留已有 Server、JSONC 注释和非托管 TOML。
382
+ - 使用原子写入,并在失败时回滚。
383
+ - 遇到非法配置或无法安全接管的结构时直接停止。
384
+ - Agent Instructions 使用明确的托管标记,避免误删用户内容。
294
385
 
295
- ### 环境要求
386
+ ## 开发 open-wot
296
387
 
297
- - Node.js `>= 20`
298
- - pnpm `10.x`
388
+ 环境要求:Node.js `>= 20`、pnpm `10.25.x`。
299
389
 
300
- ### 安装依赖
390
+ ### 安装与开发
301
391
 
302
392
  ```bash
303
393
  pnpm install
394
+ pnpm dev # 监听源码并持续构建 dist/
304
395
  ```
305
396
 
306
- ### 常用开发命令
397
+ 也可以直接运行 TypeScript 源码:
307
398
 
308
399
  ```bash
309
- pnpm lint # ESLint 检查
310
- pnpm typecheck # TypeScript 类型检查
311
- pnpm test # 单元测试
312
- pnpm build # 构建产物到 dist/
313
- pnpm compress # 压缩 data/*.json → data/*.json.gz(发布前自动执行)
400
+ pnpm exec tsx src/index.ts list
401
+ pnpm exec tsx src/index.ts info Button --version 2.0
402
+ pnpm exec tsx src/index.ts mcp
314
403
  ```
315
404
 
316
- ### 本地调试 CLI
317
-
318
- 直接运行源码入口最方便:
405
+ 调试最终构建产物:
319
406
 
320
407
  ```bash
321
- pnpm exec tsx src/index.ts list
322
- pnpm exec tsx src/index.ts info Button
323
- pnpm exec tsx src/index.ts info Button --version 2.0.0
324
- pnpm exec tsx src/index.ts doc Button --version 2.0
408
+ pnpm build
409
+ node dist/index.mjs list
410
+ node dist/index.mjs mcp doctor --client cursor
325
411
  ```
326
412
 
327
- 如果要调试构建产物:
413
+ ### 提交前验证
328
414
 
329
415
  ```bash
416
+ pnpm lint
417
+ pnpm typecheck
418
+ pnpm test
330
419
  pnpm build
331
- node dist/index.mjs list
332
- node dist/index.mjs info Button --version 2.0.0
333
420
  ```
334
421
 
335
- ### 本地调试 MCP
422
+ 测试开发:
336
423
 
337
424
  ```bash
338
- pnpm exec tsx src/index.ts mcp
425
+ pnpm test:watch
426
+ pnpm test:coverage
339
427
  ```
340
428
 
341
- MCP 走 stdio,终端无交互输出属于正常现象。若要查看 tools 与 prompts 的调用过程,建议配合 MCP Inspector 或编辑器内置 MCP 客户端调试。
429
+ CI 会在 Node.js 20/22 以及 Ubuntu、Windows、macOS 上执行对应检查。
342
430
 
343
- ## 自动化流程
431
+ ### 更新离线数据
344
432
 
345
- - `.github/workflows/ci.yml`:在 `push`/`PR` 时执行 lint、typecheck、build、test(多 OS × Node 版本矩阵)
346
- - `.github/workflows/sync.yml`:每日 02:00 UTC 自动检测 `@wot-ui/ui` 最新版本,有更新时拉取全量多版本快照并创建同步 PR;也可手动触发单版本提取
347
- - `.github/workflows/release.yml`:`v*` tag 触发自动发布 `@wot-ui/cli` 到 npm;`prepublishOnly` 依次执行 `pnpm build` 和 `pnpm compress`,发布包携带压缩后的组件数据及 `versions.json` 版本索引
348
- - `.github/workflows/coverage-upload.yml`:`v*` tag 触发,上传测试覆盖率到 Codecov
433
+ ```bash
434
+ pnpm sync:clone # 同步全部 stable 快照
435
+ pnpm extract:clone # 只提取最新版本
436
+ ```
349
437
 
350
- ## 当前边界
438
+ 已有本地 wot-ui 仓库时:
351
439
 
352
- - 当前仅支持 `wot-ui v2`
353
- - `usage` 与 `lint` 当前聚焦 `.vue` 文件中的 `<wd-*>` 标签及相关 import
354
- - 提取脚本优先从 SCSS 源码解析 CSS 变量,并在必要时回退到 markdown 表格
440
+ ```bash
441
+ pnpm sync --wot-dir ../wot-ui
442
+ pnpm extract --wot-dir ../wot-ui --output data/v2.0.4.json
443
+ ```
355
444
 
356
- ## 相关文档
445
+ 修改 CLI、MCP、数据提取、Skill 或发布文件时,需要执行的定向验证不同。完整仓库结构、验证矩阵、打包与提交流程见 [CONTRIBUTING.md](./CONTRIBUTING.md)。
446
+
447
+ ## 当前边界
357
448
 
358
- - [CONTRIBUTING.md](CONTRIBUTING.md):贡献与开发流程
449
+ - 当前仅支持 wot-ui v2。
450
+ - `usage` 与 `lint` 聚焦 `.vue` 文件中的 `<wd-*>` 标签及相关 import。
451
+ - 提取脚本优先从 SCSS 解析 CSS 变量,必要时回退到 Markdown 表格。
359
452
 
360
453
  ## License
361
454
 
362
- [MIT](./LICENSE) License © wot-ui
455
+ [MIT](./LICENSE.md) License © wot-ui
Binary file
package/data/v2.json.gz CHANGED
Binary file
@@ -10,6 +10,7 @@
10
10
  "v2": {
11
11
  "2.0": "2.0.8",
12
12
  "2.1": "2.1.0",
13
- "2.2": "2.2.0"
13
+ "2.2": "2.2.0",
14
+ "2.3": "2.3.0"
14
15
  }
15
16
  }
Binary file
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as version, a as filterComponents, d as formatStatusLabel, f as writeStderrLine, g as name, h as loadMetadataFile, i as lintProject, m as resolveVersion, o as findComponent, p as detectVersion, r as analyzeUsage, s as listComponents, t as checkForCliUpdate, u as formatLogMessage } from "./update-check-YZ9xD4u9.mjs";
2
+ import { _ as version, a as filterComponents, d as formatStatusLabel, f as writeStderrLine, g as name, h as loadMetadataFile, i as lintProject, m as resolveVersion, o as findComponent, p as detectVersion, r as analyzeUsage, s as listComponents, t as checkForCliUpdate, u as formatLogMessage } from "./update-check-vahhrKL6.mjs";
3
3
  import process from "node:process";
4
4
  import { Command } from "commander";
5
5
  import { constants, existsSync, readFileSync } from "node:fs";
@@ -2126,7 +2126,7 @@ async function runSafely(options, action) {
2126
2126
  }
2127
2127
  }
2128
2128
  async function startServer() {
2129
- const { startMcpServer } = await import("./server-B4R7zC43.mjs");
2129
+ const { startMcpServer } = await import("./server-tl_9acKR.mjs");
2130
2130
  await startMcpServer();
2131
2131
  }
2132
2132
  function registerMcpCommand(program) {
@@ -1,4 +1,4 @@
1
- import { _ as version, c as toComponentSummary, g as name, h as loadMetadataFile, i as lintProject, l as toDemoSummary, m as resolveVersion, n as getCliUpdateStatus, o as findComponent, s as listComponents } from "./update-check-YZ9xD4u9.mjs";
1
+ import { _ as version, c as toComponentSummary, g as name, h as loadMetadataFile, i as lintProject, l as toDemoSummary, m as resolveVersion, n as getCliUpdateStatus, o as findComponent, s as listComponents } from "./update-check-vahhrKL6.mjs";
2
2
  import process from "node:process";
3
3
  import { McpServer, StdioServerTransport } from "@modelcontextprotocol/server";
4
4
  import * as z from "zod/v4";
@@ -8,7 +8,7 @@ import { parse } from "@vue/compiler-sfc";
8
8
 
9
9
  //#region package.json
10
10
  var name = "@wot-ui/cli";
11
- var version = "1.0.5-beta.1";
11
+ var version = "1.0.6";
12
12
 
13
13
  //#endregion
14
14
  //#region src/data/loader.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wot-ui/cli",
3
3
  "type": "module",
4
- "version": "1.0.5-beta.1",
4
+ "version": "1.0.6",
5
5
  "description": "面向 wot-ui 的 CLI、MCP 与数据提取工具集",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/antfu",
@@ -70,6 +70,10 @@
70
70
  "scripts": {
71
71
  "build": "tsdown",
72
72
  "dev": "tsdown --watch",
73
+ "site:dev": "pnpm --filter @open-wot/website dev",
74
+ "site:build": "pnpm --filter @open-wot/website build",
75
+ "site:build:next": "pnpm --filter @open-wot/website build:next",
76
+ "site:lint": "pnpm --filter @open-wot/website lint",
73
77
  "extract": "tsx scripts/extract.ts",
74
78
  "extract:clone": "rm -rf /tmp/open-wot-wot-ui && git clone --depth 1 https://github.com/wot-ui/wot-ui.git /tmp/open-wot-wot-ui && pnpm extract --wot-dir /tmp/open-wot-wot-ui --output data/v2.json",
75
79
  "sync": "tsx scripts/sync.ts",
@@ -1,73 +1,108 @@
1
1
  ---
2
2
  name: wot-ui-cli
3
- description: '回答、使用、调试 @wot-ui/cli 时使用。关键词:wot、@wot-ui/cli、CLI、MCP、doctor、usage、lint、list、info、doc、demo、token、changelog、extract、wot mcp。适用于命令查询、参数说明、MCP 接入、本地调试、数据提取与 open-wot 仓库维护。'
4
- argument-hint: '命令名、参数、MCP 场景、调试问题或数据提取需求'
3
+ description: 使用、调试或维护 @wot-ui/cli 与 open-wot 仓库。适用于 wot CLI 命令、Agent/MCP 接入、doctor/usage/lint、组件知识查询、客户端 adapter、离线数据提取、构建测试、发布包检查和仓库开发;如果任务是直接编写 wd-* 组件页面或解释组件 API,应改用 wot-ui-v2 skill。
5
4
  ---
6
5
 
7
- # Wot UI CLI Skill
6
+ # Wot UI CLI
8
7
 
9
- 这个 skill 用于让 Agent 在处理 `@wot-ui/cli` 本身相关的问题时,优先基于本仓库 README 与实际命令能力回答,而不是把它误当成纯组件库文档。
8
+ 处理 `@wot-ui/cli`、MCP、Agent 接入和 open-wot 仓库维护任务时,基于当前源码、`package.json` 和 README 行事,不根据旧文档猜测命令。
10
9
 
11
- ## 适用场景
10
+ ## 路由
12
11
 
13
- - 用户询问 `wot` 命令怎么用。
14
- - 用户需要区分 `list`、`info`、`doc`、`demo`、`token`、`changelog`、`doctor`、`usage`、`lint`、`mcp`、`extract` 的用途。
15
- - 用户要接入 MCP Server,或需要 `wot mcp` 的配置与调试方法。
16
- - 用户要在本仓库中调试 `@wot-ui/cli`、验证构建产物、重新提取数据。
17
- - 用户的问题本质上是 open-wot 仓库维护问题,而不是单纯的 wot-ui 组件使用问题。
12
+ - CLI、MCP、Agent、数据提取或仓库开发:使用本 Skill。
13
+ - 组件选型、页面代码、props、主题和组件问题:使用 `wot-ui-v2` Skill。
14
+ - 通过 CLI 查询组件知识时,保留 CLI 使用语境;需要生成组件代码时再切换到 `wot-ui-v2`。
18
15
 
19
- ## 适用范围
16
+ ## 工作流
20
17
 
21
- - 关注对象是 `@wot-ui/cli` 这个工具包,以及仓库 `open-wot` 的开发维护流程。
22
- - 重点覆盖命令能力、通用参数、MCP、离线数据来源、提取流程、本地调试和发布包边界。
23
- - 如果任务是生成 `wd-*` 页面代码、解释组件 props 或给出主题定制方案,应优先使用 `wot-ui-v2` skill。
24
-
25
- ## 推荐流程
26
-
27
- 1. 先确认用户是在问 CLI 工具本身,还是在借 CLI 查询组件知识。
28
- 2. 如果是命令使用问题,优先按命令类别回答:组件知识、项目分析、MCP、数据提取、仓库开发。
29
- 3. 如果是仓库维护问题,优先给出本仓库里的实际调试命令,而不是泛泛而谈。
30
- 4. 如果涉及组件内容本身,可引导或切换到 `wot-ui-v2` skill。
18
+ 1. 先查看 `README.md`、`package.json#scripts` 和相关源码。
19
+ 2. 修改 CLI、MCP、prompt、数据结构或 Skill 后,同步测试与 README。
20
+ 3. 写配置前先运行 `--dry-run`,使用隔离 `--cwd`,不要修改真实用户配置。
21
+ 4. 修改命令输出后,至少运行一个真实源码或构建产物命令。
22
+ 5. 提交前运行 `pnpm lint && pnpm typecheck && pnpm test && pnpm build`。
31
23
 
32
24
  ## 命令分组
33
25
 
34
- ### 组件知识查询
35
-
36
- - `wot list`
37
- - `wot info <Component>`
38
- - `wot doc <Component>`
39
- - `wot demo <Component> [name]`
40
- - `wot token [Component]`
41
- - `wot changelog [version] [component]`
42
-
43
- ### 项目分析
44
-
45
- - `wot doctor [dir]`
46
- - `wot usage [dir]`
47
- - `wot lint [dir]`
48
-
49
- ### MCP
50
-
51
- - `wot mcp`
52
-
53
- ### 数据提取与仓库维护
54
-
55
- - `pnpm extract:cli --wot-dir ../wot-ui --output data/v2.json`
56
- - `pnpm extract:clone`
57
- - `pnpm exec tsx src/index.ts <command>`
58
- - `pnpm build`
59
- - `node dist/index.mjs <command>`
60
-
61
- ## 工作规则
62
-
63
- - 包名是 `@wot-ui/cli`,实际可执行命令是 `wot`。
64
- - 回答命令问题时,优先用仓库 README 中已承诺的行为和参数,不臆造未声明子命令。
65
- - 回答本地调试问题时,优先给源码入口:`pnpm exec tsx src/index.ts ...`。
66
- - 回答构建产物问题时,再给 `node dist/index.mjs ...`。
67
- - 回答 MCP 问题时,要说明 `wot mcp` 走 stdio,终端无交互输出通常是正常现象。
68
- - 回答提取逻辑问题时,要说明数据主要来自上游 `wot-ui/wot-ui` 的 markdown 与 SCSS 源码。
69
- - 当用户问的是组件知识但入口是 CLI,也要保留“这是通过 CLI 查询组件知识”这一层语义。
70
-
71
- ## 参考资料
72
-
73
- - [Wot UI CLI 概览](./references/overview.md)
26
+ 组件知识:
27
+
28
+ ```bash
29
+ wot list [keyword]
30
+ wot info <component>
31
+ wot doc <component>
32
+ wot demo <component> [name]
33
+ wot token [component]
34
+ wot changelog [versionOrComponent] [component]
35
+ ```
36
+
37
+ 项目分析:
38
+
39
+ ```bash
40
+ wot doctor [dir]
41
+ wot usage [dir]
42
+ wot lint [dir]
43
+ ```
44
+
45
+ Agent 接入:
46
+
47
+ ```bash
48
+ wot agent list
49
+ wot agent init --client cursor
50
+ wot agent status --client cursor
51
+ wot agent doctor --client cursor
52
+ wot agent remove --client cursor
53
+ wot agent init --client all
54
+ ```
55
+
56
+ MCP 管理:
57
+
58
+ ```bash
59
+ wot mcp
60
+ wot mcp serve
61
+ wot mcp list
62
+ wot mcp init --client cursor
63
+ wot mcp status --client cursor
64
+ wot mcp doctor --client cursor
65
+ wot mcp remove --client cursor
66
+ wot mcp print --client cursor
67
+ ```
68
+
69
+ 查询命令支持 `--version` 和 `--format text|json|markdown`。Agent/MCP 管理命令支持的具体选项以 `--help` 和源码为准;写操作优先使用 `--dry-run`。
70
+
71
+ ## 仓库开发
72
+
73
+ ```bash
74
+ pnpm install
75
+ pnpm dev
76
+ pnpm exec tsx src/index.ts list
77
+ pnpm build
78
+ node dist/index.mjs list
79
+ ```
80
+
81
+ 更新离线数据:
82
+
83
+ ```bash
84
+ pnpm sync:clone
85
+ pnpm extract:clone
86
+ pnpm sync --wot-dir ../wot-ui
87
+ pnpm extract --wot-dir ../wot-ui --output data/v2.0.4.json
88
+ ```
89
+
90
+ 发布包检查:
91
+
92
+ ```bash
93
+ pnpm build
94
+ pnpm compress
95
+ pnpm exec publint
96
+ npm pack --dry-run --json
97
+ ```
98
+
99
+ ## MCP 注意事项
100
+
101
+ - `wot mcp` 使用 stdio,终端无普通输出通常正常。
102
+ - `doctor` 验证配置和真实 handshake;部分客户端还会检查注册状态。
103
+ - `--client all` 在 project scope 处理四个支持客户端。
104
+ - 保留已有 Server、JSONC 注释、非托管 TOML 和用户 Instructions。
105
+
106
+ ## 参考
107
+
108
+ 需要完整命令矩阵、目录职责、验证要求、数据与发布流程时,读取 [references/overview.md](./references/overview.md)。
@@ -1,215 +1,164 @@
1
1
  # Wot UI CLI Overview
2
2
 
3
- 本文件根据本仓库 README 整理,目标是让 Agent 快速理解 `@wot-ui/cli` 的能力边界、命令分组、MCP 接入方式、开发调试路径与数据来源。
3
+ ## 目录
4
4
 
5
- ## Package Identity
5
+ - [定位](#定位)
6
+ - [命令矩阵](#命令矩阵)
7
+ - [Agent 与 MCP](#agent-与-mcp)
8
+ - [仓库目录](#仓库目录)
9
+ - [开发与验证](#开发与验证)
10
+ - [数据更新](#数据更新)
11
+ - [发布包与发布](#发布包与发布)
6
12
 
7
- - 包名:`@wot-ui/cli`
8
- - 仓库:open-wot
9
- - 可执行命令:`wot`
10
- - 核心定位:wot-ui 的 AI 工具链仓库,提供 CLI、MCP Server、离线组件知识库与数据提取脚本。
11
-
12
- ## Repository Positioning
13
-
14
- - 面向 wot-ui v2 的组件知识查询工具。
15
- - 面向本地项目的组件使用分析与 lint 工具。
16
- - 面向 AI 客户端的 MCP stdio 服务。
17
- - 面向仓库维护者的数据提取与同步工作流。
18
-
19
- ## Core Capabilities
20
-
21
- ### Component Knowledge
22
-
23
- - `list`:列出可用组件。
24
- - `info <Component>`:查看 props、events、slots、CSS 变量。
25
- - `doc <Component>`:输出组件 markdown 文档。
26
- - `demo <Component> [name]`:查看 demo 列表或指定 demo 源码。
27
- - `token [Component]`:查看组件 CSS 变量与默认值。
28
- - `changelog [version] [component]`:查看版本更新记录。
29
-
30
- ### Project Analysis
31
-
32
- - `doctor [dir]`:检查项目依赖、运行环境与基础集成情况。
33
- - `usage [dir]`:统计 `.vue` 文件中的 `wd-*` 使用情况。
34
- - `lint [dir]`:检查未知组件、空按钮等规则。
35
-
36
- ### MCP Server
37
-
38
- - `mcp`:启动 MCP stdio server。
39
-
40
- ## Typical User Flows
41
-
42
- ### Query Component Knowledge Through CLI
43
-
44
- 常用顺序:
45
-
46
- 1. `wot list`
47
- 2. `wot info Button`
48
- 3. `wot demo Button basic`
49
- 4. `wot doc Button`
50
- 5. `wot token Button`
51
-
52
- ### Analyze A Local Project
53
-
54
- 常用顺序:
13
+ ## 定位
55
14
 
56
- 1. `wot doctor ./my-project`
57
- 2. `wot usage ./my-project`
58
- 3. `wot lint ./my-project`
59
-
60
- ### Run MCP In A Client
61
-
62
- 推荐自动接入:
63
-
64
- ```bash
65
- wot agent init --client cursor
66
- wot agent status --client cursor
67
- wot agent doctor --client cursor
68
- ```
69
-
70
- 只管理 MCP 时使用:
15
+ - npm 包:`@wot-ui/cli`
16
+ - 可执行命令:`wot`
17
+ - Node.js:`>= 20`
18
+ - 包管理器:pnpm `10.25.x`
19
+ - 数据范围:wot-ui v2
20
+ - 核心能力:CLI 查询、项目分析、MCP Server、Agent 接入、多版本离线知识和数据提取
21
+
22
+ ## 命令矩阵
23
+
24
+ ### 组件知识与项目分析
25
+
26
+ | 命令 | 用途 |
27
+ | --- | --- |
28
+ | `wot list [keyword]` | 按名称、中文名、标签、分类或描述查找组件 |
29
+ | `wot info <component>` | props、events、slots、CSS 变量 |
30
+ | `wot doc <component>` | 完整 Markdown 文档 |
31
+ | `wot demo <component> [name]` | demo 列表或指定源码 |
32
+ | `wot token [component]` | 组件 CSS 变量 |
33
+ | `wot changelog [versionOrComponent] [component]` | 版本或组件更新记录 |
34
+ | `wot doctor [dir]` | 项目环境与依赖诊断 |
35
+ | `wot usage [dir]` | `.vue` 文件中的组件使用统计 |
36
+ | `wot lint [dir]` | 未知组件、空按钮等规则 |
37
+
38
+ 查询命令支持 `--version <version>` 和 `--format text|json|markdown`。
39
+
40
+ ### Agent
41
+
42
+ | 子命令 | 用途 |
43
+ | --- | --- |
44
+ | `list` | 列出支持和检测到的客户端 |
45
+ | `init` | 初始化 MCP、Skill 和 Instructions |
46
+ | `status` | 检查三类能力 |
47
+ | `doctor` | 检查文件和真实 MCP handshake |
48
+ | `remove` | 删除 open-wot 托管内容 |
49
+
50
+ `init/status/doctor/remove` 支持 `--client auto|all|claude|cursor|vscode|codex`、`--scope`、`--with`、`--cwd`、`--format` 和 `--pin`。`init/remove` 支持 `--dry-run`、`--yes`;`doctor` 支持 `--timeout`。
51
+
52
+ ### MCP
53
+
54
+ | 子命令 | 用途 |
55
+ | --- | --- |
56
+ | `wot mcp` / `wot mcp serve` | 启动 stdio Server |
57
+ | `list` | 客户端检测 |
58
+ | `init` | 写入 MCP 配置 |
59
+ | `status` | 检查配置 |
60
+ | `doctor` | 配置、handshake 和客户端状态检查 |
61
+ | `remove` | 删除托管配置 |
62
+ | `print` | 输出单客户端配置片段 |
63
+
64
+ ## Agent 与 MCP
65
+
66
+ 支持的 project scope 配置:
67
+
68
+ | Client | 文件 |
69
+ | --- | --- |
70
+ | Claude Code | `.mcp.json` |
71
+ | Cursor | `.cursor/mcp.json` |
72
+ | VS Code | `.vscode/mcp.json` |
73
+ | Codex | `.codex/config.toml` |
74
+
75
+ 一次接入所有客户端:
71
76
 
72
77
  ```bash
73
- wot mcp init --client cursor
74
- wot mcp print --client cursor
75
- wot mcp status --client cursor
76
- wot mcp doctor --client cursor
77
- wot mcp remove --client cursor
78
+ wot agent init --client all
79
+ wot agent doctor --client all --timeout 30000
78
80
  ```
79
81
 
80
- 所有写操作支持 `--dry-run`;Agent 或 CI 非交互执行时显式传入 `--yes`。
82
+ 默认 Agent 接入安装 MCP、`wot-ui-v2` Skill 和托管 Instructions。`wot-ui-cli` Skill 随 npm 包发布,但不默认安装到组件使用项目。
81
83
 
82
- 典型配置:
84
+ MCP 提供 8 个 tools:
83
85
 
84
- ```json
85
- {
86
- "mcpServers": {
87
- "wot-ui": {
88
- "command": "npx",
89
- "args": ["-y", "@wot-ui/cli", "mcp"]
90
- }
91
- }
92
- }
86
+ ```text
87
+ wot_status
88
+ wot_list
89
+ wot_info
90
+ wot_doc
91
+ wot_demo
92
+ wot_token
93
+ wot_changelog
94
+ wot_lint
93
95
  ```
94
96
 
95
- 当前 README 明确列出的 MCP tools 有:
96
-
97
- - `wot_list`
98
- - `wot_info`
99
- - `wot_doc`
100
- - `wot_demo`
101
- - `wot_token`
102
- - `wot_changelog`
103
- - `wot_lint`
104
-
105
- ## Common Flags
106
-
107
- 多数查询命令支持:
108
-
109
- - `--format text`
110
- - `--format json`
111
- - `--version v2`
112
-
113
- ## Install And Run
114
-
115
- ### Global Install
116
-
117
- ```bash
118
- npm install -g @wot-ui/cli
97
+ ## 仓库目录
98
+
99
+ ```text
100
+ src/commands CLI 子命令
101
+ src/application MCP/Agent 编排和 ChangePlan
102
+ src/mcp Server、tools、prompts、adapters
103
+ src/data loader 和版本解析
104
+ src/utils 文件、终端、项目扫描等公共能力
105
+ scripts extract、sync、compress
106
+ data 多版本离线数据
107
+ skills Agent Skills
108
+ test 测试
119
109
  ```
120
110
 
121
- 安装后直接用 `wot`。
111
+ ## 开发与验证
122
112
 
123
- ### Source Mode In This Repo
113
+ 安装和调试:
124
114
 
125
115
  ```bash
126
- pnpm exec tsx src/index.ts list
116
+ pnpm install
117
+ pnpm dev
127
118
  pnpm exec tsx src/index.ts info Button
128
- pnpm exec tsx src/index.ts mcp
119
+ pnpm build
120
+ node dist/index.mjs info Button
129
121
  ```
130
122
 
131
- 适合本地调试源码,不依赖全局安装。
132
-
133
- ### Built Artifact Mode
123
+ 提交前:
134
124
 
135
125
  ```bash
126
+ pnpm lint
127
+ pnpm typecheck
128
+ pnpm test
136
129
  pnpm build
137
- node dist/index.mjs list
138
130
  ```
139
131
 
140
- 适合验证构建产物行为。
141
-
142
- ## MCP Operational Notes
143
-
144
- - `wot mcp` 走 stdio。
145
- - 终端里没有交互输出通常是正常现象。
146
- - 若要调试 tool 与 prompt 调用过程,建议配合 MCP Inspector 或编辑器内置 MCP 客户端。
132
+ 定向要求:
147
133
 
148
- ## Data Source And Extraction
134
+ - CLI 输出变化:运行真实命令,同步 README 和命令测试。
135
+ - MCP/Agent:使用隔离目录验证 dry-run、幂等、doctor 和 remove。
136
+ - 数据结构:验证历史快照兼容 commands 与 MCP。
137
+ - Skills:验证 `agent init --dry-run` 和 npm 包文件列表。
138
+ - package exports/files:运行 publint 和 npm pack。
149
139
 
150
- 当前版本聚焦 `wot-ui v2`。
140
+ ## 数据更新
151
141
 
152
- 离线数据主要提取自上游 `wot-ui/wot-ui` 的:
153
-
154
- - `docs/component/*.md`
155
- - `docs/guide/changelog.md`
156
- - `src/uni_modules/wot-ui/components/*/index.scss`
157
-
158
- 重新生成数据有两种方式:
159
-
160
- ### Use A Local Wot UI Repo
161
-
162
- ```bash
163
- pnpm extract:cli --wot-dir ../wot-ui --output data/v2.json
164
- ```
165
-
166
- ### Clone Latest Upstream And Extract
142
+ 离线数据来自上游 wot-ui 的组件 Markdown、changelog 和 SCSS。
167
143
 
168
144
  ```bash
145
+ pnpm sync:clone
169
146
  pnpm extract:clone
147
+ pnpm sync --wot-dir ../wot-ui
148
+ pnpm extract --wot-dir ../wot-ui --output data/v2.0.4.json
170
149
  ```
171
150
 
172
- ## Repo Layout
173
-
174
- - `src`:CLI、MCP 与项目分析源码。
175
- - `data`:离线组件元数据。
176
- - `scripts`:提取脚本。
177
- - `skills`:面向 Agent 的技能说明。
178
- - `test`:根包测试。
151
+ 提取后运行 `pnpm test && pnpm build`,并检查 `data/versions.json`、目标快照和 `data/v2.json`。
179
152
 
180
- ## Local Development Commands
181
-
182
- ### Environment
183
-
184
- - Node.js `>= 20`
185
- - pnpm `10.x`
186
-
187
- ### Install
188
-
189
- ```bash
190
- pnpm install
191
- ```
192
-
193
- ### Common Validation
194
-
195
- ```bash
196
- pnpm lint
197
- pnpm test:all
198
- pnpm build:all
199
- pnpm typecheck:all
200
- ```
201
-
202
- ### Package-Level Commands
153
+ ## 发布包与发布
203
154
 
204
155
  ```bash
205
156
  pnpm build
206
- pnpm test
207
- pnpm typecheck
157
+ pnpm compress
158
+ pnpm exec publint
159
+ npm pack --dry-run --json
208
160
  ```
209
161
 
210
- ## Agent Guidance
162
+ 发布包应包含 `dist/`、压缩数据、`data/versions.json`、`skills/wot-ui-v2` 和 `skills/wot-ui-cli`。
211
163
 
212
- - 如果用户问的是命令怎么用,按“命令组 + 示例命令 + 输出用途”来回答。
213
- - 如果用户问的是仓库维护或调试,优先给本仓库中的真实命令和目录。
214
- - 如果用户问的是组件本身怎么写页面,不要停留在 CLI 层,应切换到 `wot-ui-v2` skill。
215
- - 不要把 `wot` 命令和 `@wot-ui/ui` 组件库 API 混为一谈。
164
+ 维护者使用 `pnpm release`。bumpp 默认更新版本、提交、创建 tag 并推送;`v*` tag 触发 GitHub Actions 发布。发布后检查 npm 版本、文件和 dist-tags,预发布版本不要占用 `latest`。