@wot-ui/cli 1.0.5-beta.1 → 1.0.5
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 +288 -195
- package/dist/index.mjs +2 -2
- package/dist/{server-B4R7zC43.mjs → server-DDRLv2Z2.mjs} +1 -1
- package/dist/{update-check-YZ9xD4u9.mjs → update-check-BacAuhBM.mjs} +1 -1
- package/package.json +5 -1
- package/skills/wot-ui-cli/SKILL.md +96 -61
- package/skills/wot-ui-cli/references/overview.md +123 -174
package/README.md
CHANGED
|
@@ -1,213 +1,267 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
7
|
+
<h1 align="center">@wot-ui/cli</h1>
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
<p align="center"><strong>让 AI 真正懂 wot-ui。</strong></p>
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
```
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
```text
|
|
53
|
+
MCP Server AI 可以按需调用 8 个 wot-ui tools
|
|
54
|
+
wot-ui-v2 Skill AI 知道何时、如何选择和使用组件
|
|
55
|
+
Instructions AI 在生成代码前主动查询真实组件知识
|
|
33
56
|
```
|
|
34
57
|
|
|
35
|
-
|
|
58
|
+
使用其他客户端时,只需替换 client id:
|
|
36
59
|
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
45
|
-
|
|
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
|
-
|
|
71
|
+
`--client all` 在 project scope 下会处理 Claude Code、Cursor、VS Code 和 Codex;在 user scope 下只处理支持用户级配置的客户端。
|
|
51
72
|
|
|
52
|
-
|
|
73
|
+
配置完成后重启客户端;如果出现“信任项目”或“批准 MCP Server”的提示,请按客户端指引确认。
|
|
53
74
|
|
|
54
|
-
|
|
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
|
-
```
|
|
61
|
-
|
|
62
|
-
wot
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
81
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
- `wot lint [dir]`:检查未知组件、空按钮等规则
|
|
94
|
+
Button 按钮 (wd-button)
|
|
95
|
+
按钮用于触发一个操作,如提交表单或打开链接。
|
|
92
96
|
|
|
93
|
-
|
|
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
|
-
|
|
104
|
+
Events:
|
|
105
|
+
- click (`event`): 点击事件
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
Slots:
|
|
108
|
+
- default: 按钮内容
|
|
109
|
+
```
|
|
98
110
|
|
|
99
|
-
|
|
100
|
-
请在当前项目根目录接入 wot-ui 的 AI 开发能力,并直接执行所需命令:
|
|
111
|
+
## 给 AI 使用(推荐)
|
|
101
112
|
|
|
102
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
- 在客户端项目配置中注册 `wot-ui` MCP Server
|
|
127
|
-
- 安装仓库内置的 `wot-ui-v2` Skill
|
|
128
|
-
- 在 `AGENTS.md` 或 `CLAUDE.md` 中维护 open-wot 自己拥有的 Instructions 区块
|
|
132
|
+
多客户端项目:
|
|
129
133
|
|
|
130
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
183
|
+
```bash
|
|
184
|
+
npx -y @wot-ui/cli@latest info Button
|
|
185
|
+
pnpm dlx @wot-ui/cli@latest info Button
|
|
186
|
+
```
|
|
150
187
|
|
|
151
|
-
|
|
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
|
-
|
|
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
|
|
168
|
-
wot
|
|
169
|
-
wot list --
|
|
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
|
-
|
|
222
|
+
不传 `--version` 时,CLI 会依次检查项目安装版本、依赖声明和最新离线数据。查询命令支持 `--format text|json|markdown`;结构化结果写入 stdout,诊断信息保持在 stderr。
|
|
173
223
|
|
|
174
|
-
|
|
224
|
+
## 只配置 MCP
|
|
175
225
|
|
|
176
|
-
|
|
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
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
-
|
|
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
|
|
257
|
+
wot mcp # 默认启动
|
|
258
|
+
wot mcp serve # 语义明确的等价写法
|
|
206
259
|
```
|
|
207
260
|
|
|
208
|
-
|
|
261
|
+
<details>
|
|
262
|
+
<summary><strong>手动配置 MCP</strong></summary>
|
|
209
263
|
|
|
210
|
-
|
|
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
|
-
|
|
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
|
-
|
|
290
|
+
</details>
|
|
237
291
|
|
|
238
|
-
|
|
292
|
+
<details>
|
|
293
|
+
<summary><strong>8 个 MCP tools</strong></summary>
|
|
239
294
|
|
|
240
|
-
| Tool |
|
|
241
|
-
| --- | --- |
|
|
242
|
-
| `wot_status` |
|
|
243
|
-
| `wot_list` |
|
|
244
|
-
| `wot_info` |
|
|
245
|
-
| `wot_doc` |
|
|
246
|
-
| `wot_demo` |
|
|
247
|
-
| `wot_token` |
|
|
248
|
-
| `wot_changelog` |
|
|
249
|
-
| `wot_lint` |
|
|
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
|
-
|
|
306
|
+
</details>
|
|
252
307
|
|
|
253
|
-
|
|
308
|
+
## 完整命令速查
|
|
254
309
|
|
|
255
|
-
|
|
310
|
+
<details>
|
|
311
|
+
<summary><strong>展开全部命令和参数</strong></summary>
|
|
256
312
|
|
|
257
|
-
|
|
313
|
+
### 组件知识与项目分析
|
|
258
314
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
327
|
+
以上查询命令都支持 `--version <version>` 和 `--format text|json|markdown`。
|
|
264
328
|
|
|
265
|
-
###
|
|
329
|
+
### Agent
|
|
266
330
|
|
|
267
|
-
|
|
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
|
-
|
|
270
|
-
pnpm sync:clone
|
|
271
|
-
```
|
|
339
|
+
`init`、`status`、`doctor` 和 `remove` 支持:
|
|
272
340
|
|
|
273
|
-
|
|
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
|
-
|
|
348
|
+
其中 `init`、`remove` 额外支持 `--dry-run` 和 `--yes`,`doctor` 支持 `--timeout <milliseconds>`。
|
|
276
349
|
|
|
277
|
-
|
|
278
|
-
pnpm extract:clone
|
|
279
|
-
```
|
|
350
|
+
### MCP
|
|
280
351
|
|
|
281
|
-
|
|
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
|
-
|
|
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
|
-
|
|
288
|
-
|
|
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
|
-
|
|
379
|
+
- 先计算 ChangePlan,再确认或执行。
|
|
380
|
+
- 支持 `--dry-run` 和 JSON 预览。
|
|
381
|
+
- 保留已有 Server、JSONC 注释和非托管 TOML。
|
|
382
|
+
- 使用原子写入,并在失败时回滚。
|
|
383
|
+
- 遇到非法配置或无法安全接管的结构时直接停止。
|
|
384
|
+
- Agent Instructions 使用明确的托管标记,避免误删用户内容。
|
|
294
385
|
|
|
295
|
-
|
|
386
|
+
## 开发 open-wot
|
|
296
387
|
|
|
297
|
-
|
|
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
|
|
310
|
-
pnpm
|
|
311
|
-
pnpm
|
|
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
|
-
|
|
317
|
-
|
|
318
|
-
直接运行源码入口最方便:
|
|
405
|
+
调试最终构建产物:
|
|
319
406
|
|
|
320
407
|
```bash
|
|
321
|
-
pnpm
|
|
322
|
-
|
|
323
|
-
|
|
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
|
-
|
|
422
|
+
测试开发:
|
|
336
423
|
|
|
337
424
|
```bash
|
|
338
|
-
pnpm
|
|
425
|
+
pnpm test:watch
|
|
426
|
+
pnpm test:coverage
|
|
339
427
|
```
|
|
340
428
|
|
|
341
|
-
|
|
429
|
+
CI 会在 Node.js 20/22 以及 Ubuntu、Windows、macOS 上执行对应检查。
|
|
342
430
|
|
|
343
|
-
|
|
431
|
+
### 更新离线数据
|
|
344
432
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
433
|
+
```bash
|
|
434
|
+
pnpm sync:clone # 同步全部 stable 快照
|
|
435
|
+
pnpm extract:clone # 只提取最新版本
|
|
436
|
+
```
|
|
349
437
|
|
|
350
|
-
|
|
438
|
+
已有本地 wot-ui 仓库时:
|
|
351
439
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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
|
-
-
|
|
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
|
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-
|
|
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-BacAuhBM.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-
|
|
2129
|
+
const { startMcpServer } = await import("./server-DDRLv2Z2.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-
|
|
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-BacAuhBM.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { McpServer, StdioServerTransport } from "@modelcontextprotocol/server";
|
|
4
4
|
import * as z from "zod/v4";
|
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
|
|
4
|
+
"version": "1.0.5",
|
|
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:
|
|
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
|
|
6
|
+
# Wot UI CLI
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
处理 `@wot-ui/cli`、MCP、Agent 接入和 open-wot 仓库维护任务时,基于当前源码、`package.json` 和 README 行事,不根据旧文档猜测命令。
|
|
10
9
|
|
|
11
|
-
##
|
|
10
|
+
## 路由
|
|
12
11
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
3
|
+
## 目录
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- [定位](#定位)
|
|
6
|
+
- [命令矩阵](#命令矩阵)
|
|
7
|
+
- [Agent 与 MCP](#agent-与-mcp)
|
|
8
|
+
- [仓库目录](#仓库目录)
|
|
9
|
+
- [开发与验证](#开发与验证)
|
|
10
|
+
- [数据更新](#数据更新)
|
|
11
|
+
- [发布包与发布](#发布包与发布)
|
|
6
12
|
|
|
7
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
|
74
|
-
wot
|
|
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
|
-
|
|
82
|
+
默认 Agent 接入安装 MCP、`wot-ui-v2` Skill 和托管 Instructions。`wot-ui-cli` Skill 随 npm 包发布,但不默认安装到组件使用项目。
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
MCP 提供 8 个 tools:
|
|
83
85
|
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
111
|
+
## 开发与验证
|
|
122
112
|
|
|
123
|
-
|
|
113
|
+
安装和调试:
|
|
124
114
|
|
|
125
115
|
```bash
|
|
126
|
-
pnpm
|
|
116
|
+
pnpm install
|
|
117
|
+
pnpm dev
|
|
127
118
|
pnpm exec tsx src/index.ts info Button
|
|
128
|
-
pnpm
|
|
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
|
-
|
|
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
|
-
|
|
140
|
+
## 数据更新
|
|
151
141
|
|
|
152
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
|
207
|
-
pnpm
|
|
157
|
+
pnpm compress
|
|
158
|
+
pnpm exec publint
|
|
159
|
+
npm pack --dry-run --json
|
|
208
160
|
```
|
|
209
161
|
|
|
210
|
-
|
|
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`。
|