@wot-ui/cli 0.0.1-beta.10
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/LICENSE.md +21 -0
- package/README.md +189 -0
- package/data/v2.json +19827 -0
- package/data/versions.json +10 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +414 -0
- package/dist/scanner-_isnOGJK.mjs +203 -0
- package/dist/server-BLoIUV7u.mjs +248 -0
- package/package.json +82 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-PRESENT Wot UI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Open Wot
|
|
2
|
+
|
|
3
|
+
open-wot 是 wot-ui 的 AI 工具链仓库,当前对外发布的核心包为 `@wot-ui/cli`。它提供命令行工具、MCP Server、离线组件知识库与数据提取脚本,用于把 wot-ui v2 的组件知识接入编辑器、AI Agent 和本地工程分析流程。
|
|
4
|
+
|
|
5
|
+
## 仓库定位
|
|
6
|
+
|
|
7
|
+
- 面向 wot-ui v2 的组件知识查询工具
|
|
8
|
+
- 面向本地项目的组件使用分析与 lint 工具
|
|
9
|
+
- 面向 AI 客户端的 MCP stdio 服务
|
|
10
|
+
- 面向仓库维护者的数据提取与同步工作流
|
|
11
|
+
|
|
12
|
+
## 核心能力
|
|
13
|
+
|
|
14
|
+
- 组件知识查询:`list`、`info`、`doc`、`demo`、`token`、`changelog`
|
|
15
|
+
- 项目分析:`doctor`、`usage`、`lint`
|
|
16
|
+
- MCP Server:`wot mcp`
|
|
17
|
+
- 元数据提取:从 `wot-ui/wot-ui` 源码生成本地 `v2.json`
|
|
18
|
+
|
|
19
|
+
## 安装
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @wot-ui/cli
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
安装完成后可直接使用 `wot` 命令。
|
|
26
|
+
|
|
27
|
+
如果你在仓库内本地调试,推荐直接运行源码入口,而不是依赖全局命令:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm exec tsx src/index.ts list
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 快速开始
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
wot list
|
|
37
|
+
wot info Button
|
|
38
|
+
wot demo Button basic
|
|
39
|
+
wot doc Button
|
|
40
|
+
wot token Button
|
|
41
|
+
wot changelog
|
|
42
|
+
wot doctor ./my-project
|
|
43
|
+
wot usage ./my-project
|
|
44
|
+
wot lint ./my-project
|
|
45
|
+
wot mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 命令说明
|
|
49
|
+
|
|
50
|
+
### 组件知识
|
|
51
|
+
|
|
52
|
+
- `wot list`:列出可用的 wot-ui 组件
|
|
53
|
+
- `wot info <Component>`:查看组件 props、events、slots、CSS 变量
|
|
54
|
+
- `wot doc <Component>`:输出组件 markdown 文档
|
|
55
|
+
- `wot demo <Component> [name]`:查看 demo 列表或指定 demo 源码
|
|
56
|
+
- `wot token [Component]`:查看组件 CSS 变量与默认值
|
|
57
|
+
- `wot changelog [version] [component]`:查看版本更新记录
|
|
58
|
+
|
|
59
|
+
### 项目分析
|
|
60
|
+
|
|
61
|
+
- `wot doctor [dir]`:检查项目依赖、运行环境与基础集成情况
|
|
62
|
+
- `wot usage [dir]`:统计 `.vue` 文件中的 `wd-*` 使用情况
|
|
63
|
+
- `wot lint [dir]`:检查未知组件、空按钮等规则
|
|
64
|
+
|
|
65
|
+
### 通用参数
|
|
66
|
+
|
|
67
|
+
多数查询命令支持以下参数:
|
|
68
|
+
|
|
69
|
+
- `--format text`
|
|
70
|
+
- `--format json`
|
|
71
|
+
- `--version v2`
|
|
72
|
+
|
|
73
|
+
## MCP 集成
|
|
74
|
+
|
|
75
|
+
将以下配置加入支持 MCP 的客户端:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"wot-ui": {
|
|
81
|
+
"command": "wot",
|
|
82
|
+
"args": ["mcp"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
当前 MCP Server 提供以下 tools:
|
|
89
|
+
|
|
90
|
+
- `wot_list`
|
|
91
|
+
- `wot_info`
|
|
92
|
+
- `wot_doc`
|
|
93
|
+
- `wot_demo`
|
|
94
|
+
- `wot_token`
|
|
95
|
+
- `wot_changelog`
|
|
96
|
+
- `wot_lint`
|
|
97
|
+
|
|
98
|
+
## 数据来源
|
|
99
|
+
|
|
100
|
+
当前版本聚焦 `wot-ui v2`。仓库内的离线数据来自 `wot-ui/wot-ui` 源码,主要提取自:
|
|
101
|
+
|
|
102
|
+
- `docs/component/*.md`
|
|
103
|
+
- `docs/guide/changelog.md`
|
|
104
|
+
- `src/uni_modules/wot-ui/components/*/index.scss`
|
|
105
|
+
|
|
106
|
+
重新生成本地数据有两种方式。
|
|
107
|
+
|
|
108
|
+
使用本地已有的 wot-ui 仓库:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
pnpm extract:cli --wot-dir ../wot-ui --output data/v2.json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
直接克隆最新的 wot-ui 仓库并提取:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm extract:clone
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 开发本仓库
|
|
121
|
+
|
|
122
|
+
当前根目录就是主发布包,核心源码位于 `src`,离线数据位于 `data`,提取脚本位于 `scripts`。
|
|
123
|
+
|
|
124
|
+
### 环境要求
|
|
125
|
+
|
|
126
|
+
- Node.js `>= 20`
|
|
127
|
+
- pnpm `10.x`
|
|
128
|
+
|
|
129
|
+
### 安装依赖
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pnpm install
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 常用开发命令
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pnpm lint
|
|
139
|
+
pnpm test:all
|
|
140
|
+
pnpm build:all
|
|
141
|
+
pnpm typecheck:all
|
|
142
|
+
pnpm build:cli
|
|
143
|
+
pnpm test:cli
|
|
144
|
+
pnpm typecheck:cli
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 本地调试 CLI
|
|
148
|
+
|
|
149
|
+
直接运行源码入口最方便:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pnpm exec tsx src/index.ts list
|
|
153
|
+
pnpm exec tsx src/index.ts info Button
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
如果要调试构建产物:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pnpm build:cli
|
|
160
|
+
node dist/index.mjs list
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 本地调试 MCP
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
pnpm exec tsx src/index.ts mcp
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
MCP 走 stdio,终端无交互输出属于正常现象。若要查看 tools 与 prompts 的调用过程,建议配合 MCP Inspector 或编辑器内置 MCP 客户端调试。
|
|
170
|
+
|
|
171
|
+
## 自动化流程
|
|
172
|
+
|
|
173
|
+
- `.github/workflows/ci.yml`:执行主包的 lint、typecheck、build、test
|
|
174
|
+
- `.github/workflows/release.yml`:在 `v*` tag 上通过 reusable workflow 发布 `@wot-ui/cli`
|
|
175
|
+
- `.github/workflows/sync.yml`:拉取上游 `wot-ui/wot-ui`,提取最新元数据,并自动创建同步 PR
|
|
176
|
+
|
|
177
|
+
## 当前边界
|
|
178
|
+
|
|
179
|
+
- 当前仅支持 `wot-ui v2`
|
|
180
|
+
- `usage` 与 `lint` 当前聚焦 `.vue` 文件中的 `<wd-*>` 标签及相关 import
|
|
181
|
+
- 提取脚本优先从 SCSS 源码解析 CSS 变量,并在必要时回退到 markdown 表格
|
|
182
|
+
|
|
183
|
+
## 相关文档
|
|
184
|
+
|
|
185
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md):贡献与开发流程
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
[MIT](./LICENSE) License © wot-ui
|