@wot-ui/cli 1.0.4 → 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 +356 -124
- package/dist/index.mjs +1903 -9
- package/dist/{server-Cbs8eIrc.mjs → server-DDRLv2Z2.mjs} +6 -3
- package/dist/{update-check-DlG1c3ZB.mjs → update-check-BacAuhBM.mjs} +34 -3
- package/package.json +10 -2
- package/skills/wot-ui-cli/SKILL.md +108 -0
- package/skills/wot-ui-cli/references/overview.md +164 -0
- package/skills/wot-ui-v2/SKILL.md +46 -0
- package/skills/wot-ui-v2/references/overview.md +85 -0
package/README.md
CHANGED
|
@@ -1,91 +1,280 @@
|
|
|
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
|
-
|
|
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>
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
---
|
|
32
|
+
|
|
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`。
|
|
20
43
|
|
|
21
44
|
```bash
|
|
22
|
-
npm install -g @wot-ui/cli
|
|
45
|
+
npm install -g @wot-ui/cli@latest
|
|
46
|
+
wot agent init --client cursor
|
|
47
|
+
wot agent doctor --client cursor
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
完成后,当前项目会获得:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
MCP Server AI 可以按需调用 8 个 wot-ui tools
|
|
54
|
+
wot-ui-v2 Skill AI 知道何时、如何选择和使用组件
|
|
55
|
+
Instructions AI 在生成代码前主动查询真实组件知识
|
|
23
56
|
```
|
|
24
57
|
|
|
25
|
-
|
|
58
|
+
使用其他客户端时,只需替换 client id:
|
|
26
59
|
|
|
27
|
-
|
|
60
|
+
| Claude Code | Cursor | VS Code | Codex |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `claude` | `cursor` | `vscode` | `codex` |
|
|
28
63
|
|
|
29
|
-
|
|
64
|
+
同时使用多个 AI 客户端时,可以一次完成全部项目级配置:
|
|
30
65
|
|
|
31
66
|
```bash
|
|
32
|
-
|
|
67
|
+
wot agent init --client all
|
|
68
|
+
wot agent doctor --client all --timeout 30000
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`--client all` 在 project scope 下会处理 Claude Code、Cursor、VS Code 和 Codex;在 user scope 下只处理支持用户级配置的客户端。
|
|
72
|
+
|
|
73
|
+
配置完成后重启客户端;如果出现“信任项目”或“批准 MCP Server”的提示,请按客户端指引确认。
|
|
74
|
+
|
|
75
|
+
## ✨ 它解决什么问题
|
|
76
|
+
|
|
77
|
+
没有上下文的 AI 容易混用 Vue 组件库 API、使用不存在的属性,或者生成与项目版本不匹配的代码。Open Wot 在 AI 写代码前补上准确的 wot-ui 上下文:
|
|
78
|
+
|
|
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
|
|
33
87
|
```
|
|
34
88
|
|
|
35
|
-
|
|
89
|
+
它也可以单独作为一个快速的组件知识 CLI:
|
|
90
|
+
|
|
91
|
+
```console
|
|
92
|
+
$ wot info Button
|
|
93
|
+
|
|
94
|
+
Button 按钮 (wd-button)
|
|
95
|
+
按钮用于触发一个操作,如提交表单或打开链接。
|
|
96
|
+
|
|
97
|
+
Props:
|
|
98
|
+
- type: string = primary
|
|
99
|
+
- variant: string = base
|
|
100
|
+
- size: string = medium
|
|
101
|
+
- disabled: boolean = false
|
|
102
|
+
- loading: boolean = false
|
|
103
|
+
|
|
104
|
+
Events:
|
|
105
|
+
- click (`event`): 点击事件
|
|
106
|
+
|
|
107
|
+
Slots:
|
|
108
|
+
- default: 按钮内容
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 给 AI 使用(推荐)
|
|
112
|
+
|
|
113
|
+
`agent init` 是推荐入口,它会同时配置 MCP、安装 Skill,并写入由 open-wot 管理的项目 Instructions。
|
|
36
114
|
|
|
37
115
|
```bash
|
|
38
|
-
wot
|
|
39
|
-
wot
|
|
40
|
-
wot
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
wot
|
|
47
|
-
wot
|
|
116
|
+
wot agent init --client cursor
|
|
117
|
+
wot agent status --client cursor
|
|
118
|
+
wot agent doctor --client cursor
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
整个生命周期都可以通过 CLI 管理:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
wot agent list
|
|
125
|
+
wot agent init --client cursor --dry-run
|
|
126
|
+
wot agent init --client cursor
|
|
127
|
+
wot agent status --client cursor
|
|
128
|
+
wot agent doctor --client cursor
|
|
129
|
+
wot agent remove --client cursor
|
|
48
130
|
```
|
|
49
131
|
|
|
50
|
-
|
|
132
|
+
多客户端项目:
|
|
133
|
+
|
|
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
|
+
```
|
|
140
|
+
|
|
141
|
+
- `--dry-run` 只展示变更计划,不写文件。
|
|
142
|
+
- 交互式写操作会请求确认;Agent 或 CI 中显式传入 `--yes`。
|
|
143
|
+
- 重复执行 `init` 不会重复插入配置。
|
|
144
|
+
- `remove` 只移除 open-wot 管理的内容,不覆盖其他 Server 或用户配置。
|
|
145
|
+
- 默认安装面向组件使用者的 `wot-ui-v2` Skill;仓库维护 Skill `wot-ui-cli` 不会默认安装。
|
|
146
|
+
|
|
147
|
+
只接入部分能力:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
wot agent init --client codex --with mcp
|
|
151
|
+
wot agent init --client claude --with skill,instructions
|
|
152
|
+
```
|
|
153
|
+
|
|
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:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npx -y @wot-ui/cli@latest info Button
|
|
185
|
+
pnpm dlx @wot-ui/cli@latest info Button
|
|
186
|
+
```
|
|
51
187
|
|
|
52
188
|
### 组件知识
|
|
53
189
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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]` | 按版本或组件查询更新记录 |
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
wot list button
|
|
201
|
+
wot info Button
|
|
202
|
+
wot demo Button demo-1
|
|
203
|
+
wot token Button
|
|
204
|
+
```
|
|
60
205
|
|
|
61
206
|
### 项目分析
|
|
62
207
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
208
|
+
| 命令 | 用途 |
|
|
209
|
+
| --- | --- |
|
|
210
|
+
| `wot doctor [dir]` | 检查依赖、运行环境和基础集成 |
|
|
211
|
+
| `wot usage [dir]` | 统计 `.vue` 文件中的 `wd-*` 使用情况 |
|
|
212
|
+
| `wot lint [dir]` | 检查未知组件、空按钮等问题 |
|
|
66
213
|
|
|
67
|
-
###
|
|
214
|
+
### 版本与结构化输出
|
|
68
215
|
|
|
69
|
-
|
|
216
|
+
```bash
|
|
217
|
+
wot info Button --version 2.0
|
|
218
|
+
wot info Button --version 2.0.4
|
|
219
|
+
wot list --version latest --format json
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
不传 `--version` 时,CLI 会依次检查项目安装版本、依赖声明和最新离线数据。查询命令支持 `--format text|json|markdown`;结构化结果写入 stdout,诊断信息保持在 stderr。
|
|
223
|
+
|
|
224
|
+
## 只配置 MCP
|
|
225
|
+
|
|
226
|
+
如果只需要 MCP,不需要 Skill 和 Instructions:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
wot mcp list
|
|
230
|
+
wot mcp init --client cursor
|
|
231
|
+
wot mcp status --client cursor
|
|
232
|
+
wot mcp doctor --client cursor
|
|
233
|
+
wot mcp remove --client cursor
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
支持的项目配置:
|
|
237
|
+
|
|
238
|
+
| Client | 文件 | 配置根字段 |
|
|
239
|
+
| --- | --- | --- |
|
|
240
|
+
| Claude Code | `.mcp.json` | `mcpServers` |
|
|
241
|
+
| Cursor | `.cursor/mcp.json` | `mcpServers` |
|
|
242
|
+
| VS Code | `.vscode/mcp.json` | `servers` |
|
|
243
|
+
| Codex | `.codex/config.toml` | `mcp_servers.wot-ui` |
|
|
244
|
+
|
|
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
|
+
```
|
|
70
251
|
|
|
71
|
-
|
|
72
|
-
- `--version <ver>`:指定 wot-ui 版本,支持以下格式:
|
|
73
|
-
- `2.0`(minor,自动解析到最新 patch)
|
|
74
|
-
- `2.0.4`(exact patch)
|
|
75
|
-
- `latest`(始终使用最新稳定版)
|
|
76
|
-
- 不传时自动从项目 `node_modules/@wot-ui/ui` 或 `package.json` 依赖声明检测,检测不到则回退到最新版
|
|
252
|
+
Claude Code、Cursor 和 Codex 支持 `--scope user`;VS Code 当前使用 project scope。`doctor` 会验证配置和真实 MCP handshake,并在客户端支持时继续检查注册状态。
|
|
77
253
|
|
|
78
|
-
|
|
254
|
+
直接启动 stdio Server:
|
|
79
255
|
|
|
80
256
|
```bash
|
|
81
|
-
wot
|
|
82
|
-
wot
|
|
83
|
-
wot list --format json --version latest
|
|
257
|
+
wot mcp # 默认启动
|
|
258
|
+
wot mcp serve # 语义明确的等价写法
|
|
84
259
|
```
|
|
85
260
|
|
|
86
|
-
|
|
261
|
+
<details>
|
|
262
|
+
<summary><strong>手动配置 MCP</strong></summary>
|
|
87
263
|
|
|
88
|
-
|
|
264
|
+
自动配置默认使用 `npx` 启动 Server,避免桌面应用读取不到终端的全局 `PATH`:
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"mcpServers": {
|
|
269
|
+
"wot-ui": {
|
|
270
|
+
"command": "npx",
|
|
271
|
+
"args": ["-y", "@wot-ui/cli", "mcp"]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
已全局安装且客户端能够找到 `wot` 时,也可以使用:
|
|
89
278
|
|
|
90
279
|
```json
|
|
91
280
|
{
|
|
@@ -98,126 +287,169 @@ wot list --format json --version latest
|
|
|
98
287
|
}
|
|
99
288
|
```
|
|
100
289
|
|
|
101
|
-
|
|
290
|
+
</details>
|
|
102
291
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
| `wot_status` | 查看 MCP Server 与 `@wot-ui/cli` 状态,包括当前版本、是否有 CLI 更新及更新命令。 | 无 |
|
|
106
|
-
| `wot_list` | 列出当前离线知识库中的 wot-ui 组件元数据,适合在生成页面前发现可用组件。 | `version` |
|
|
107
|
-
| `wot_info` | 查询单个组件的 props、events、slots、CSS 变量等结构化信息。 | `component`, `version` |
|
|
108
|
-
| `wot_doc` | 获取单个组件的完整 markdown 文档,适合需要阅读用法细节或限制说明时调用。 | `component`, `version` |
|
|
109
|
-
| `wot_demo` | 获取组件 demo 列表,或按 demo 名称获取指定示例源码。 | `component`, `demo`, `version` |
|
|
110
|
-
| `wot_token` | 查询组件 CSS 变量;不传组件名时返回所有组件的 CSS 变量摘要。 | `component`, `version` |
|
|
111
|
-
| `wot_changelog` | 查询 wot-ui v2 离线数据中的更新记录,可按版本或组件过滤。 | `version`, `component` |
|
|
112
|
-
| `wot_lint` | 扫描本地项目中的 wot-ui 使用问题,例如未知组件、空按钮等规则。 | `dir`, `version` |
|
|
292
|
+
<details>
|
|
293
|
+
<summary><strong>8 个 MCP tools</strong></summary>
|
|
113
294
|
|
|
114
|
-
|
|
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 使用问题 |
|
|
115
305
|
|
|
116
|
-
|
|
306
|
+
</details>
|
|
117
307
|
|
|
118
|
-
|
|
308
|
+
## 完整命令速查
|
|
119
309
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
- `src/uni_modules/wot-ui/components/*/index.scss`
|
|
310
|
+
<details>
|
|
311
|
+
<summary><strong>展开全部命令和参数</strong></summary>
|
|
123
312
|
|
|
124
|
-
|
|
313
|
+
### 组件知识与项目分析
|
|
125
314
|
|
|
126
|
-
|
|
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]` | 检查组件使用问题 |
|
|
127
326
|
|
|
128
|
-
|
|
327
|
+
以上查询命令都支持 `--version <version>` 和 `--format text|json|markdown`。
|
|
129
328
|
|
|
130
|
-
|
|
131
|
-
pnpm sync:clone
|
|
132
|
-
```
|
|
329
|
+
### Agent
|
|
133
330
|
|
|
134
|
-
|
|
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 管理的接入内容 |
|
|
135
338
|
|
|
136
|
-
|
|
339
|
+
`init`、`status`、`doctor` 和 `remove` 支持:
|
|
137
340
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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]`
|
|
141
347
|
|
|
142
|
-
|
|
348
|
+
其中 `init`、`remove` 额外支持 `--dry-run` 和 `--yes`,`doctor` 支持 `--timeout <milliseconds>`。
|
|
143
349
|
|
|
144
|
-
|
|
145
|
-
# 全量多版本
|
|
146
|
-
pnpm sync --wot-dir ../wot-ui
|
|
350
|
+
### MCP
|
|
147
351
|
|
|
148
|
-
|
|
149
|
-
|
|
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` | 输出单个客户端的配置片段 |
|
|
362
|
+
|
|
363
|
+
`init`、`status`、`doctor`、`remove` 和 `print` 支持 `--client`、`--scope`、`--cwd`、`--format` 和 `--pin`;`init`、`remove` 额外支持 `--dry-run`、`--yes`,`doctor` 支持 `--timeout`。`list` 支持 `--cwd` 和 `--format`;`print` 必须指定一个具体客户端,不能使用 `auto` 或 `all`。
|
|
364
|
+
|
|
365
|
+
随时可以查看 CLI 自带帮助:
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
wot --help
|
|
369
|
+
wot agent init --help
|
|
370
|
+
wot mcp doctor --help
|
|
150
371
|
```
|
|
151
372
|
|
|
152
|
-
|
|
373
|
+
</details>
|
|
374
|
+
|
|
375
|
+
## 安全设计
|
|
153
376
|
|
|
154
|
-
|
|
377
|
+
open-wot 会修改客户端配置,因此写入流程默认保守:
|
|
155
378
|
|
|
156
|
-
|
|
379
|
+
- 先计算 ChangePlan,再确认或执行。
|
|
380
|
+
- 支持 `--dry-run` 和 JSON 预览。
|
|
381
|
+
- 保留已有 Server、JSONC 注释和非托管 TOML。
|
|
382
|
+
- 使用原子写入,并在失败时回滚。
|
|
383
|
+
- 遇到非法配置或无法安全接管的结构时直接停止。
|
|
384
|
+
- Agent Instructions 使用明确的托管标记,避免误删用户内容。
|
|
157
385
|
|
|
158
|
-
|
|
159
|
-
- pnpm `10.x`
|
|
386
|
+
## 开发 open-wot
|
|
160
387
|
|
|
161
|
-
|
|
388
|
+
环境要求:Node.js `>= 20`、pnpm `10.25.x`。
|
|
389
|
+
|
|
390
|
+
### 安装与开发
|
|
162
391
|
|
|
163
392
|
```bash
|
|
164
393
|
pnpm install
|
|
394
|
+
pnpm dev # 监听源码并持续构建 dist/
|
|
165
395
|
```
|
|
166
396
|
|
|
167
|
-
|
|
397
|
+
也可以直接运行 TypeScript 源码:
|
|
168
398
|
|
|
169
399
|
```bash
|
|
170
|
-
pnpm
|
|
171
|
-
pnpm
|
|
172
|
-
pnpm
|
|
173
|
-
pnpm build # 构建产物到 dist/
|
|
174
|
-
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
|
|
175
403
|
```
|
|
176
404
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
直接运行源码入口最方便:
|
|
405
|
+
调试最终构建产物:
|
|
180
406
|
|
|
181
407
|
```bash
|
|
182
|
-
pnpm
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
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
|
|
186
411
|
```
|
|
187
412
|
|
|
188
|
-
|
|
413
|
+
### 提交前验证
|
|
189
414
|
|
|
190
415
|
```bash
|
|
416
|
+
pnpm lint
|
|
417
|
+
pnpm typecheck
|
|
418
|
+
pnpm test
|
|
191
419
|
pnpm build
|
|
192
|
-
node dist/index.mjs list
|
|
193
|
-
node dist/index.mjs info Button --version 2.0.0
|
|
194
420
|
```
|
|
195
421
|
|
|
196
|
-
|
|
422
|
+
测试开发:
|
|
197
423
|
|
|
198
424
|
```bash
|
|
199
|
-
pnpm
|
|
425
|
+
pnpm test:watch
|
|
426
|
+
pnpm test:coverage
|
|
200
427
|
```
|
|
201
428
|
|
|
202
|
-
|
|
429
|
+
CI 会在 Node.js 20/22 以及 Ubuntu、Windows、macOS 上执行对应检查。
|
|
203
430
|
|
|
204
|
-
|
|
431
|
+
### 更新离线数据
|
|
205
432
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
433
|
+
```bash
|
|
434
|
+
pnpm sync:clone # 同步全部 stable 快照
|
|
435
|
+
pnpm extract:clone # 只提取最新版本
|
|
436
|
+
```
|
|
210
437
|
|
|
211
|
-
|
|
438
|
+
已有本地 wot-ui 仓库时:
|
|
212
439
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
440
|
+
```bash
|
|
441
|
+
pnpm sync --wot-dir ../wot-ui
|
|
442
|
+
pnpm extract --wot-dir ../wot-ui --output data/v2.0.4.json
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
修改 CLI、MCP、数据提取、Skill 或发布文件时,需要执行的定向验证不同。完整仓库结构、验证矩阵、打包与提交流程见 [CONTRIBUTING.md](./CONTRIBUTING.md)。
|
|
216
446
|
|
|
217
|
-
##
|
|
447
|
+
## 当前边界
|
|
218
448
|
|
|
219
|
-
-
|
|
449
|
+
- 当前仅支持 wot-ui v2。
|
|
450
|
+
- `usage` 与 `lint` 聚焦 `.vue` 文件中的 `<wd-*>` 标签及相关 import。
|
|
451
|
+
- 提取脚本优先从 SCSS 解析 CSS 变量,必要时回退到 Markdown 表格。
|
|
220
452
|
|
|
221
453
|
## License
|
|
222
454
|
|
|
223
|
-
[MIT](./LICENSE) License © wot-ui
|
|
455
|
+
[MIT](./LICENSE.md) License © wot-ui
|