mcp-probe-kit 3.0.24 → 3.2.0
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 +755 -779
- package/build/index.js +42 -41
- package/build/lib/__tests__/spec-validator.unit.test.js +115 -0
- package/build/lib/agents-md-template.js +32 -32
- package/build/lib/memory-orchestration.js +29 -8
- package/build/lib/skill-bridge.js +12 -12
- package/build/lib/spec-validator.d.ts +36 -0
- package/build/lib/spec-validator.js +103 -0
- package/build/lib/template-loader.js +149 -47
- package/build/lib/tool-annotations.d.ts +30 -0
- package/build/lib/tool-annotations.js +55 -0
- package/build/lib/toolset-manager.js +2 -0
- package/build/resources/index.d.ts +4 -0
- package/build/resources/index.js +4 -0
- package/build/resources/tool-params-guide.d.ts +571 -0
- package/build/resources/tool-params-guide.js +488 -0
- package/build/resources/ui-ux-data/guidelines/vercel-web-interface.json +1632 -1632
- package/build/resources/ui-ux-data/metadata.json +30 -30
- package/build/resources/ui-ux-data/shadcn/blocks.json +2541 -2541
- package/build/resources/ui-ux-data/shadcn/components.json +997 -997
- package/build/resources/ui-ux-data/themes/presets.json +483 -483
- package/build/schemas/index.d.ts +22 -22
- package/build/schemas/memory-tools.d.ts +0 -22
- package/build/schemas/memory-tools.js +0 -14
- package/build/schemas/project-tools.d.ts +22 -0
- package/build/schemas/project-tools.js +23 -0
- package/build/tools/analyze_project.d.ts +1 -0
- package/build/tools/analyze_project.js +527 -0
- package/build/tools/check_deps.d.ts +13 -0
- package/build/tools/check_deps.js +204 -0
- package/build/tools/check_spec.d.ts +7 -0
- package/build/tools/check_spec.js +81 -0
- package/build/tools/code_insight.js +41 -41
- package/build/tools/convert.d.ts +13 -0
- package/build/tools/convert.js +599 -0
- package/build/tools/css_order.d.ts +13 -0
- package/build/tools/css_order.js +81 -0
- package/build/tools/debug.d.ts +13 -0
- package/build/tools/debug.js +131 -0
- package/build/tools/design2code.d.ts +20 -0
- package/build/tools/design2code.js +426 -0
- package/build/tools/detect_shell.d.ts +6 -0
- package/build/tools/detect_shell.js +151 -0
- package/build/tools/explain.d.ts +13 -0
- package/build/tools/explain.js +390 -0
- package/build/tools/fix.d.ts +13 -0
- package/build/tools/fix.js +303 -0
- package/build/tools/fix_bug.js +161 -161
- package/build/tools/gen_mock.d.ts +22 -0
- package/build/tools/gen_mock.js +269 -0
- package/build/tools/gen_skill.d.ts +13 -0
- package/build/tools/gen_skill.js +560 -0
- package/build/tools/genapi.d.ts +13 -0
- package/build/tools/genapi.js +174 -0
- package/build/tools/genchangelog.d.ts +13 -0
- package/build/tools/genchangelog.js +250 -0
- package/build/tools/gencommit.js +60 -60
- package/build/tools/gendoc.d.ts +13 -0
- package/build/tools/gendoc.js +232 -0
- package/build/tools/genpr.d.ts +13 -0
- package/build/tools/genpr.js +194 -0
- package/build/tools/genreadme.d.ts +13 -0
- package/build/tools/genreadme.js +626 -0
- package/build/tools/gensql.d.ts +13 -0
- package/build/tools/gensql.js +320 -0
- package/build/tools/genui.d.ts +13 -0
- package/build/tools/genui.js +803 -0
- package/build/tools/index.d.ts +1 -1
- package/build/tools/index.js +1 -1
- package/build/tools/init_component_catalog.d.ts +22 -0
- package/build/tools/init_component_catalog.js +809 -0
- package/build/tools/init_project_context.js +432 -432
- package/build/tools/init_setting.d.ts +13 -0
- package/build/tools/init_setting.js +47 -0
- package/build/tools/perf.d.ts +13 -0
- package/build/tools/perf.js +409 -0
- package/build/tools/render_ui.d.ts +22 -0
- package/build/tools/render_ui.js +384 -0
- package/build/tools/resolve_conflict.d.ts +13 -0
- package/build/tools/resolve_conflict.js +349 -0
- package/build/tools/security_scan.d.ts +22 -0
- package/build/tools/security_scan.js +323 -0
- package/build/tools/split.d.ts +13 -0
- package/build/tools/split.js +599 -0
- package/build/tools/start_api.d.ts +13 -0
- package/build/tools/start_api.js +193 -0
- package/build/tools/start_bugfix.js +254 -243
- package/build/tools/start_doc.d.ts +13 -0
- package/build/tools/start_doc.js +207 -0
- package/build/tools/start_feature.js +162 -127
- package/build/tools/start_product.js +1 -1
- package/build/tools/start_refactor.d.ts +13 -0
- package/build/tools/start_refactor.js +188 -0
- package/build/tools/start_release.d.ts +13 -0
- package/build/tools/start_release.js +167 -0
- package/build/tools/start_review.d.ts +13 -0
- package/build/tools/start_review.js +175 -0
- package/build/tools/start_ui.js +426 -412
- package/build/tools/ui-ux-tools.js +290 -290
- package/build/utils/__tests__/vercel-guidelines-sync.unit.test.js +12 -12
- package/build/utils/themes-sync.js +8 -8
- package/package.json +81 -83
- package/build/lib/__tests__/memory-orchestration.unit.test.js +0 -88
- package/build/lib/__tests__/memory-payload.unit.test.js +0 -35
- package/build/lib/cursor-history-client.d.ts +0 -54
- package/build/lib/cursor-history-client.js +0 -240
- package/build/tools/__tests__/cursor-history.unit.test.js +0 -38
- package/build/tools/cursor_read_conversation.d.ts +0 -7
- package/build/tools/cursor_read_conversation.js +0 -36
- package/docs/.mcp-probe/layout.json +0 -11
- package/docs/CNAME +0 -1
- package/docs/assets/font/MaterialSymbolsOutlined.codepoints +0 -4102
- package/docs/assets/font/MaterialSymbolsOutlined.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-400.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-700.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-900.ttf +0 -0
- package/docs/assets/js/i18n.js +0 -375
- package/docs/assets/js/tailwind.js +0 -83
- package/docs/assets/logo-zh.png +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/data/tools.js +0 -523
- package/docs/i18n/all-tools/en.json +0 -190
- package/docs/i18n/all-tools/ja.json +0 -171
- package/docs/i18n/all-tools/ko.json +0 -171
- package/docs/i18n/all-tools/zh-CN.json +0 -190
- package/docs/i18n/en.json +0 -626
- package/docs/i18n/ja.json +0 -602
- package/docs/i18n/ko.json +0 -602
- package/docs/i18n/zh-CN.json +0 -626
- package/docs/index.html +0 -327
- package/docs/memory-local-setup.md +0 -315
- package/docs/memory-local-setup.zh-CN.md +0 -283
- package/docs/pages/all-tools.html +0 -515
- package/docs/pages/examples.html +0 -717
- package/docs/pages/getting-started.html +0 -964
- package/docs/pages/migration.html +0 -308
- package/docs/specs/user-auth/design.md +0 -82
- package/docs/specs/user-auth/requirements.md +0 -52
- package/docs/specs/user-auth/tasks.md +0 -55
- /package/build/lib/__tests__/{memory-orchestration.unit.test.d.ts → spec-validator.unit.test.d.ts} +0 -0
- /package/build/{lib/__tests__/memory-payload.unit.test.d.ts → utils/design-docs-generator.d.ts} +0 -0
- /package/build/{tools/__tests__/cursor-history.unit.test.d.ts → utils/design-docs-generator.js} +0 -0
package/build/tools/start_ui.js
CHANGED
|
@@ -110,300 +110,300 @@ function resolveTemplateProfile(rawProfile, description) {
|
|
|
110
110
|
warning: `模板档位 \"${rawProfile}\" 不支持,已回退为 ${fallback}`,
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
const PROMPT_TEMPLATE_GUIDED = `# 快速开始
|
|
114
|
-
|
|
115
|
-
**职责说明**: 本工具仅提供执行指导,不执行实际操作。请按顺序调用以下 MCP 工具。
|
|
116
|
-
|
|
117
|
-
执行以下工具:
|
|
118
|
-
|
|
119
|
-
1. 检查 \`docs/project-context.md\` 是否存在,不存在则调用 \`init_project_context\`
|
|
120
|
-
2. 检查 \`docs/design-system.md\` 是否存在,不存在则调用 \`ui_design_system --product_type="{productType}" --stack="{framework}"\`
|
|
121
|
-
3. 检查 \`docs/ui/component-catalog.json\` 是否存在,不存在则调用 \`init_component_catalog\`
|
|
122
|
-
4. \`ui_search --mode=template --query="{description}"\`
|
|
123
|
-
5. 选择模板并保存到 \`docs/ui/{templateName}.json\`
|
|
124
|
-
6. \`render_ui --template="docs/ui/{templateName}.json" --framework="{framework}"\`
|
|
125
|
-
7. 将生成的 UI 文档添加到 \`docs/project-context.md\` 索引中
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## 步骤 1: 生成项目上下文(如不存在)📋
|
|
130
|
-
|
|
131
|
-
**检查**: 查看 \`docs/project-context.md\` 是否存在
|
|
132
|
-
|
|
133
|
-
**如果不存在,调用工具**: \`init_project_context\`
|
|
134
|
-
**参数**: 无(使用默认配置)
|
|
135
|
-
|
|
136
|
-
**预期输出**:
|
|
137
|
-
- \`docs/project-context.md\` - 项目上下文索引文件
|
|
138
|
-
- \`docs/project-context/\` - 项目文档目录
|
|
139
|
-
|
|
140
|
-
**失败处理**: 确保 docs 目录存在且有写入权限
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
## 步骤 2: 生成设计系统(如不存在)🎨
|
|
145
|
-
|
|
146
|
-
**检查**: 查看 \`docs/design-system.md\` 是否存在
|
|
147
|
-
|
|
148
|
-
**如果不存在,调用工具**: \`ui_design_system\`
|
|
149
|
-
**参数**:
|
|
150
|
-
\`\`\`json
|
|
151
|
-
{
|
|
152
|
-
"product_type": "{productType}",
|
|
153
|
-
"stack": "{framework}",
|
|
154
|
-
"description": "{description}"
|
|
155
|
-
}
|
|
156
|
-
\`\`\`
|
|
157
|
-
|
|
158
|
-
**预期输出**: \`docs/design-system.json\` 和 \`docs/design-system.md\`
|
|
159
|
-
**失败处理**: 检查 docs 目录是否存在,确保有写入权限
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## 步骤 3: 生成组件目录(如不存在)📦
|
|
164
|
-
|
|
165
|
-
**检查**: 查看 \`docs/ui/component-catalog.json\` 是否存在
|
|
166
|
-
|
|
167
|
-
**如果不存在,调用工具**: \`init_component_catalog\`
|
|
168
|
-
**参数**: 无
|
|
169
|
-
|
|
170
|
-
**预期输出**: \`docs/ui/component-catalog.json\`
|
|
171
|
-
**失败处理**: 确保步骤 2 的设计系统文件已生成
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## 步骤 4: 搜索 UI 模板 🔍
|
|
176
|
-
|
|
177
|
-
**工具**: \`ui_search\`
|
|
178
|
-
**参数**:
|
|
179
|
-
\`\`\`json
|
|
180
|
-
{
|
|
181
|
-
"mode": "template",
|
|
182
|
-
"query": "{description}"
|
|
183
|
-
}
|
|
184
|
-
\`\`\`
|
|
185
|
-
|
|
186
|
-
**预期输出**: 匹配的模板列表(可能为空)
|
|
187
|
-
**失败处理**: 如果没有找到模板,创建最小模板文件再进入渲染步骤
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## 步骤 5: 保存模板文件 🧩
|
|
192
|
-
|
|
193
|
-
**操作**: 从搜索结果选择模板或创建最小模板
|
|
194
|
-
|
|
195
|
-
**保存路径**: \`docs/ui/{templateName}.json\`
|
|
196
|
-
|
|
197
|
-
**最小模板示例**:
|
|
198
|
-
\`\`\`json
|
|
199
|
-
{
|
|
200
|
-
"name": "UiTemplate",
|
|
201
|
-
"description": "{description}",
|
|
202
|
-
"layout": "sectioned"
|
|
203
|
-
}
|
|
204
|
-
\`\`\`
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## 步骤 6: 渲染最终代码 💻
|
|
209
|
-
|
|
210
|
-
**工具**: \`render_ui\`
|
|
211
|
-
**参数**:
|
|
212
|
-
\`\`\`json
|
|
213
|
-
{
|
|
214
|
-
"template": "docs/ui/{templateName}.json",
|
|
215
|
-
"framework": "{framework}"
|
|
216
|
-
}
|
|
217
|
-
\`\`\`
|
|
218
|
-
|
|
219
|
-
**预期输出**: 完整的 {framework} 组件代码
|
|
220
|
-
**失败处理**: 如果模板不存在,请先完成步骤 5 保存模板文件
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## 步骤 7: 更新项目上下文索引 📝
|
|
225
|
-
|
|
226
|
-
**操作**: 将生成的 UI 文档添加到 \`docs/project-context.md\` 中
|
|
227
|
-
|
|
228
|
-
**添加内容**:
|
|
229
|
-
在 "## 📚 文档导航" 部分添加:
|
|
230
|
-
|
|
231
|
-
\`\`\`markdown
|
|
232
|
-
### [UI 设计系统](./design-system.md)
|
|
233
|
-
项目的 UI 设计规范,包括颜色、字体、组件样式等
|
|
234
|
-
|
|
235
|
-
### [UI 组件目录](./ui/component-catalog.json)
|
|
236
|
-
可用的 UI 组件及其属性定义
|
|
237
|
-
\`\`\`
|
|
238
|
-
|
|
239
|
-
在 "## 💡 开发时查看对应文档" 部分的 "添加新功能" 下添加:
|
|
240
|
-
\`\`\`markdown
|
|
241
|
-
- **UI 设计系统**: [design-system.md](./design-system.md) - 查看设计规范
|
|
242
|
-
- **UI 组件目录**: [ui/component-catalog.json](./ui/component-catalog.json) - 查看可用组件
|
|
243
|
-
\`\`\`
|
|
244
|
-
|
|
245
|
-
**预期结果**: \`docs/project-context.md\` 包含 UI 相关文档的链接
|
|
246
|
-
**失败处理**: 如果文件不存在,跳过此步骤
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## 高级选项
|
|
251
|
-
|
|
252
|
-
### 自定义设计系统
|
|
253
|
-
编辑 \`docs/design-system.json\` 修改颜色、字体等,然后重新运行。
|
|
254
|
-
|
|
255
|
-
### 自定义组件
|
|
256
|
-
编辑 \`docs/ui/component-catalog.json\` 添加新组件定义。
|
|
257
|
-
|
|
258
|
-
### 常见问题
|
|
259
|
-
|
|
260
|
-
**Q: 设计系统文件已存在,还需要重新生成吗?**
|
|
261
|
-
A: 不需要。如果文件已存在,直接跳过步骤 1。
|
|
262
|
-
|
|
263
|
-
**Q: 如何使用自定义模板?**
|
|
264
|
-
A: 在 \`docs/ui/\` 目录创建 JSON 模板文件,然后在步骤 4 中指定模板路径。
|
|
113
|
+
const PROMPT_TEMPLATE_GUIDED = `# 快速开始
|
|
114
|
+
|
|
115
|
+
**职责说明**: 本工具仅提供执行指导,不执行实际操作。请按顺序调用以下 MCP 工具。
|
|
116
|
+
|
|
117
|
+
执行以下工具:
|
|
118
|
+
|
|
119
|
+
1. 检查 \`docs/project-context.md\` 是否存在,不存在则调用 \`init_project_context\`
|
|
120
|
+
2. 检查 \`docs/design-system.md\` 是否存在,不存在则调用 \`ui_design_system --product_type="{productType}" --stack="{framework}"\`
|
|
121
|
+
3. 检查 \`docs/ui/component-catalog.json\` 是否存在,不存在则调用 \`init_component_catalog\`
|
|
122
|
+
4. \`ui_search --mode=template --query="{description}"\`
|
|
123
|
+
5. 选择模板并保存到 \`docs/ui/{templateName}.json\`
|
|
124
|
+
6. \`render_ui --template="docs/ui/{templateName}.json" --framework="{framework}"\`
|
|
125
|
+
7. 将生成的 UI 文档添加到 \`docs/project-context.md\` 索引中
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 步骤 1: 生成项目上下文(如不存在)📋
|
|
130
|
+
|
|
131
|
+
**检查**: 查看 \`docs/project-context.md\` 是否存在
|
|
132
|
+
|
|
133
|
+
**如果不存在,调用工具**: \`init_project_context\`
|
|
134
|
+
**参数**: 无(使用默认配置)
|
|
135
|
+
|
|
136
|
+
**预期输出**:
|
|
137
|
+
- \`docs/project-context.md\` - 项目上下文索引文件
|
|
138
|
+
- \`docs/project-context/\` - 项目文档目录
|
|
139
|
+
|
|
140
|
+
**失败处理**: 确保 docs 目录存在且有写入权限
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 步骤 2: 生成设计系统(如不存在)🎨
|
|
145
|
+
|
|
146
|
+
**检查**: 查看 \`docs/design-system.md\` 是否存在
|
|
147
|
+
|
|
148
|
+
**如果不存在,调用工具**: \`ui_design_system\`
|
|
149
|
+
**参数**:
|
|
150
|
+
\`\`\`json
|
|
151
|
+
{
|
|
152
|
+
"product_type": "{productType}",
|
|
153
|
+
"stack": "{framework}",
|
|
154
|
+
"description": "{description}"
|
|
155
|
+
}
|
|
156
|
+
\`\`\`
|
|
157
|
+
|
|
158
|
+
**预期输出**: \`docs/design-system.json\` 和 \`docs/design-system.md\`
|
|
159
|
+
**失败处理**: 检查 docs 目录是否存在,确保有写入权限
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 步骤 3: 生成组件目录(如不存在)📦
|
|
164
|
+
|
|
165
|
+
**检查**: 查看 \`docs/ui/component-catalog.json\` 是否存在
|
|
166
|
+
|
|
167
|
+
**如果不存在,调用工具**: \`init_component_catalog\`
|
|
168
|
+
**参数**: 无
|
|
169
|
+
|
|
170
|
+
**预期输出**: \`docs/ui/component-catalog.json\`
|
|
171
|
+
**失败处理**: 确保步骤 2 的设计系统文件已生成
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 步骤 4: 搜索 UI 模板 🔍
|
|
176
|
+
|
|
177
|
+
**工具**: \`ui_search\`
|
|
178
|
+
**参数**:
|
|
179
|
+
\`\`\`json
|
|
180
|
+
{
|
|
181
|
+
"mode": "template",
|
|
182
|
+
"query": "{description}"
|
|
183
|
+
}
|
|
184
|
+
\`\`\`
|
|
185
|
+
|
|
186
|
+
**预期输出**: 匹配的模板列表(可能为空)
|
|
187
|
+
**失败处理**: 如果没有找到模板,创建最小模板文件再进入渲染步骤
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## 步骤 5: 保存模板文件 🧩
|
|
192
|
+
|
|
193
|
+
**操作**: 从搜索结果选择模板或创建最小模板
|
|
194
|
+
|
|
195
|
+
**保存路径**: \`docs/ui/{templateName}.json\`
|
|
196
|
+
|
|
197
|
+
**最小模板示例**:
|
|
198
|
+
\`\`\`json
|
|
199
|
+
{
|
|
200
|
+
"name": "UiTemplate",
|
|
201
|
+
"description": "{description}",
|
|
202
|
+
"layout": "sectioned"
|
|
203
|
+
}
|
|
204
|
+
\`\`\`
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 步骤 6: 渲染最终代码 💻
|
|
209
|
+
|
|
210
|
+
**工具**: \`render_ui\`
|
|
211
|
+
**参数**:
|
|
212
|
+
\`\`\`json
|
|
213
|
+
{
|
|
214
|
+
"template": "docs/ui/{templateName}.json",
|
|
215
|
+
"framework": "{framework}"
|
|
216
|
+
}
|
|
217
|
+
\`\`\`
|
|
218
|
+
|
|
219
|
+
**预期输出**: 完整的 {framework} 组件代码
|
|
220
|
+
**失败处理**: 如果模板不存在,请先完成步骤 5 保存模板文件
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 步骤 7: 更新项目上下文索引 📝
|
|
225
|
+
|
|
226
|
+
**操作**: 将生成的 UI 文档添加到 \`docs/project-context.md\` 中
|
|
227
|
+
|
|
228
|
+
**添加内容**:
|
|
229
|
+
在 "## 📚 文档导航" 部分添加:
|
|
230
|
+
|
|
231
|
+
\`\`\`markdown
|
|
232
|
+
### [UI 设计系统](./design-system.md)
|
|
233
|
+
项目的 UI 设计规范,包括颜色、字体、组件样式等
|
|
234
|
+
|
|
235
|
+
### [UI 组件目录](./ui/component-catalog.json)
|
|
236
|
+
可用的 UI 组件及其属性定义
|
|
237
|
+
\`\`\`
|
|
238
|
+
|
|
239
|
+
在 "## 💡 开发时查看对应文档" 部分的 "添加新功能" 下添加:
|
|
240
|
+
\`\`\`markdown
|
|
241
|
+
- **UI 设计系统**: [design-system.md](./design-system.md) - 查看设计规范
|
|
242
|
+
- **UI 组件目录**: [ui/component-catalog.json](./ui/component-catalog.json) - 查看可用组件
|
|
243
|
+
\`\`\`
|
|
244
|
+
|
|
245
|
+
**预期结果**: \`docs/project-context.md\` 包含 UI 相关文档的链接
|
|
246
|
+
**失败处理**: 如果文件不存在,跳过此步骤
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 高级选项
|
|
251
|
+
|
|
252
|
+
### 自定义设计系统
|
|
253
|
+
编辑 \`docs/design-system.json\` 修改颜色、字体等,然后重新运行。
|
|
254
|
+
|
|
255
|
+
### 自定义组件
|
|
256
|
+
编辑 \`docs/ui/component-catalog.json\` 添加新组件定义。
|
|
257
|
+
|
|
258
|
+
### 常见问题
|
|
259
|
+
|
|
260
|
+
**Q: 设计系统文件已存在,还需要重新生成吗?**
|
|
261
|
+
A: 不需要。如果文件已存在,直接跳过步骤 1。
|
|
262
|
+
|
|
263
|
+
**Q: 如何使用自定义模板?**
|
|
264
|
+
A: 在 \`docs/ui/\` 目录创建 JSON 模板文件,然后在步骤 4 中指定模板路径。
|
|
265
265
|
`;
|
|
266
|
-
const PROMPT_TEMPLATE_STRICT = `# UI 开发编排(严格)
|
|
267
|
-
|
|
268
|
-
**职责说明**: 本工具仅提供执行指导,不执行实际操作。请按顺序调用以下 MCP 工具。
|
|
269
|
-
|
|
270
|
-
## ✅ 执行计划
|
|
271
|
-
|
|
272
|
-
1. 检查 \`docs/project-context.md\`,缺失则调用 \`init_project_context\`
|
|
273
|
-
2. 检查 \`docs/design-system.md\`,缺失则调用 \`ui_design_system --product_type="{productType}" --stack="{framework}"\`
|
|
274
|
-
3. 检查 \`docs/ui/component-catalog.json\`,缺失则调用 \`init_component_catalog\`
|
|
275
|
-
4. \`ui_search --mode=template --query="{description}"\`
|
|
276
|
-
5. 选择模板并保存到 \`docs/ui/{templateName}.json\`
|
|
277
|
-
6. \`render_ui --template="docs/ui/{templateName}.json" --framework="{framework}"\`
|
|
278
|
-
7. 将生成的 UI 文档添加到 \`docs/project-context.md\` 索引中
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
## 步骤 1: 生成项目上下文(如不存在)
|
|
283
|
-
|
|
284
|
-
**检查**: \`docs/project-context.md\`
|
|
285
|
-
**缺失则调用**: \`init_project_context\`
|
|
286
|
-
**预期输出**: \`docs/project-context.md\`
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
## 步骤 2: 生成设计系统(如不存在)
|
|
291
|
-
|
|
292
|
-
**检查**: \`docs/design-system.md\`
|
|
293
|
-
**缺失则调用**: \`ui_design_system\`
|
|
294
|
-
\`\`\`json
|
|
295
|
-
{
|
|
296
|
-
"product_type": "{productType}",
|
|
297
|
-
"stack": "{framework}",
|
|
298
|
-
"description": "{description}"
|
|
299
|
-
}
|
|
300
|
-
\`\`\`
|
|
301
|
-
**预期输出**: \`docs/design-system.json\`、\`docs/design-system.md\`
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## 步骤 3: 生成组件目录(如不存在)
|
|
306
|
-
|
|
307
|
-
**检查**: \`docs/ui/component-catalog.json\`
|
|
308
|
-
**缺失则调用**: \`init_component_catalog\`
|
|
309
|
-
**预期输出**: \`docs/ui/component-catalog.json\`
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
## 步骤 4: 搜索模板
|
|
314
|
-
|
|
315
|
-
**工具**: \`ui_search\`
|
|
316
|
-
\`\`\`json
|
|
317
|
-
{ "mode": "template", "query": "{description}" }
|
|
318
|
-
\`\`\`
|
|
319
|
-
|
|
320
|
-
---
|
|
321
|
-
|
|
322
|
-
## 步骤 5: 保存模板文件
|
|
323
|
-
|
|
324
|
-
**操作**: 从搜索结果选择模板或创建最小模板
|
|
325
|
-
|
|
326
|
-
**保存路径**: \`docs/ui/{templateName}.json\`
|
|
327
|
-
|
|
328
|
-
---
|
|
329
|
-
|
|
330
|
-
## 步骤 6: 渲染代码
|
|
331
|
-
|
|
332
|
-
**工具**: \`render_ui\`
|
|
333
|
-
\`\`\`json
|
|
334
|
-
{ "template": "docs/ui/{templateName}.json", "framework": "{framework}" }
|
|
335
|
-
\`\`\`
|
|
336
|
-
|
|
337
|
-
---
|
|
338
|
-
|
|
339
|
-
## 步骤 7: 更新项目上下文索引
|
|
340
|
-
|
|
341
|
-
将 UI 文档链接添加到 \`docs/project-context.md\`
|
|
266
|
+
const PROMPT_TEMPLATE_STRICT = `# UI 开发编排(严格)
|
|
267
|
+
|
|
268
|
+
**职责说明**: 本工具仅提供执行指导,不执行实际操作。请按顺序调用以下 MCP 工具。
|
|
269
|
+
|
|
270
|
+
## ✅ 执行计划
|
|
271
|
+
|
|
272
|
+
1. 检查 \`docs/project-context.md\`,缺失则调用 \`init_project_context\`
|
|
273
|
+
2. 检查 \`docs/design-system.md\`,缺失则调用 \`ui_design_system --product_type="{productType}" --stack="{framework}"\`
|
|
274
|
+
3. 检查 \`docs/ui/component-catalog.json\`,缺失则调用 \`init_component_catalog\`
|
|
275
|
+
4. \`ui_search --mode=template --query="{description}"\`
|
|
276
|
+
5. 选择模板并保存到 \`docs/ui/{templateName}.json\`
|
|
277
|
+
6. \`render_ui --template="docs/ui/{templateName}.json" --framework="{framework}"\`
|
|
278
|
+
7. 将生成的 UI 文档添加到 \`docs/project-context.md\` 索引中
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 步骤 1: 生成项目上下文(如不存在)
|
|
283
|
+
|
|
284
|
+
**检查**: \`docs/project-context.md\`
|
|
285
|
+
**缺失则调用**: \`init_project_context\`
|
|
286
|
+
**预期输出**: \`docs/project-context.md\`
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## 步骤 2: 生成设计系统(如不存在)
|
|
291
|
+
|
|
292
|
+
**检查**: \`docs/design-system.md\`
|
|
293
|
+
**缺失则调用**: \`ui_design_system\`
|
|
294
|
+
\`\`\`json
|
|
295
|
+
{
|
|
296
|
+
"product_type": "{productType}",
|
|
297
|
+
"stack": "{framework}",
|
|
298
|
+
"description": "{description}"
|
|
299
|
+
}
|
|
300
|
+
\`\`\`
|
|
301
|
+
**预期输出**: \`docs/design-system.json\`、\`docs/design-system.md\`
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 步骤 3: 生成组件目录(如不存在)
|
|
306
|
+
|
|
307
|
+
**检查**: \`docs/ui/component-catalog.json\`
|
|
308
|
+
**缺失则调用**: \`init_component_catalog\`
|
|
309
|
+
**预期输出**: \`docs/ui/component-catalog.json\`
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## 步骤 4: 搜索模板
|
|
314
|
+
|
|
315
|
+
**工具**: \`ui_search\`
|
|
316
|
+
\`\`\`json
|
|
317
|
+
{ "mode": "template", "query": "{description}" }
|
|
318
|
+
\`\`\`
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 步骤 5: 保存模板文件
|
|
323
|
+
|
|
324
|
+
**操作**: 从搜索结果选择模板或创建最小模板
|
|
325
|
+
|
|
326
|
+
**保存路径**: \`docs/ui/{templateName}.json\`
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 步骤 6: 渲染代码
|
|
331
|
+
|
|
332
|
+
**工具**: \`render_ui\`
|
|
333
|
+
\`\`\`json
|
|
334
|
+
{ "template": "docs/ui/{templateName}.json", "framework": "{framework}" }
|
|
335
|
+
\`\`\`
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## 步骤 7: 更新项目上下文索引
|
|
340
|
+
|
|
341
|
+
将 UI 文档链接添加到 \`docs/project-context.md\`
|
|
342
342
|
`;
|
|
343
|
-
const LOOP_PROMPT_TEMPLATE_GUIDED = `# 🧭 UI 需求澄清与补全(Requirements Loop)
|
|
344
|
-
|
|
345
|
-
本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐 UI 需求关键要素。
|
|
346
|
-
|
|
347
|
-
## 🎯 目标
|
|
348
|
-
UI 需求:{description}
|
|
349
|
-
|
|
350
|
-
## ✅ 规则
|
|
351
|
-
1. **不覆盖用户原始描述**
|
|
352
|
-
2. **补全内容必须标注来源**(User / Derived / Assumption)
|
|
353
|
-
3. **假设必须进入待确认列表**
|
|
354
|
-
4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
## 🔁 执行步骤(每轮)
|
|
359
|
-
|
|
360
|
-
### 1) 生成待确认问题
|
|
361
|
-
使用 \`ask_user\` 提问,问题来源于 UI 需求补全清单(目标/交互/状态/设备/可访问性)。
|
|
362
|
-
|
|
363
|
-
### 2) 更新结构化输出
|
|
364
|
-
将回答补入 \`requirements\`,并标注来源。
|
|
365
|
-
|
|
366
|
-
### 3) 自检与结束
|
|
367
|
-
若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入 UI 执行计划。
|
|
368
|
-
|
|
369
|
-
---
|
|
370
|
-
|
|
371
|
-
## ✅ 结束后继续
|
|
372
|
-
当满足结束条件时,按 delegated plan 执行:
|
|
373
|
-
- 设计系统 → 组件目录 → 模板搜索 → 保存模板 → 渲染代码 → 更新上下文
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
*编排工具: MCP Probe Kit - start_ui (requirements loop)*
|
|
343
|
+
const LOOP_PROMPT_TEMPLATE_GUIDED = `# 🧭 UI 需求澄清与补全(Requirements Loop)
|
|
344
|
+
|
|
345
|
+
本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐 UI 需求关键要素。
|
|
346
|
+
|
|
347
|
+
## 🎯 目标
|
|
348
|
+
UI 需求:{description}
|
|
349
|
+
|
|
350
|
+
## ✅ 规则
|
|
351
|
+
1. **不覆盖用户原始描述**
|
|
352
|
+
2. **补全内容必须标注来源**(User / Derived / Assumption)
|
|
353
|
+
3. **假设必须进入待确认列表**
|
|
354
|
+
4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## 🔁 执行步骤(每轮)
|
|
359
|
+
|
|
360
|
+
### 1) 生成待确认问题
|
|
361
|
+
使用 \`ask_user\` 提问,问题来源于 UI 需求补全清单(目标/交互/状态/设备/可访问性)。
|
|
362
|
+
|
|
363
|
+
### 2) 更新结构化输出
|
|
364
|
+
将回答补入 \`requirements\`,并标注来源。
|
|
365
|
+
|
|
366
|
+
### 3) 自检与结束
|
|
367
|
+
若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入 UI 执行计划。
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## ✅ 结束后继续
|
|
372
|
+
当满足结束条件时,按 delegated plan 执行:
|
|
373
|
+
- 设计系统 → 组件目录 → 模板搜索 → 保存模板 → 渲染代码 → 更新上下文
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
*编排工具: MCP Probe Kit - start_ui (requirements loop)*
|
|
378
378
|
`;
|
|
379
|
-
const LOOP_PROMPT_TEMPLATE_STRICT = `# 🧭 UI 需求澄清与补全(Requirements Loop | 严格)
|
|
380
|
-
|
|
381
|
-
本模式用于稳健补全 UI 需求关键要素,不改变用户意图。
|
|
382
|
-
|
|
383
|
-
## 🎯 目标
|
|
384
|
-
UI 需求:{description}
|
|
385
|
-
|
|
386
|
-
## ✅ 规则
|
|
387
|
-
1. 不覆盖用户原始描述
|
|
388
|
-
2. 补全内容必须标注来源(User / Derived / Assumption)
|
|
389
|
-
3. 假设必须进入待确认列表
|
|
390
|
-
4. 每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}
|
|
391
|
-
|
|
392
|
-
---
|
|
393
|
-
|
|
394
|
-
## 🔁 执行步骤(每轮)
|
|
395
|
-
1) 使用 \`ask_user\` 提问补全关键信息
|
|
396
|
-
2) 更新结构化输出并标注来源
|
|
397
|
-
3) 若 \`openQuestions\` 为空且无高风险假设则结束
|
|
398
|
-
|
|
399
|
-
---
|
|
400
|
-
|
|
401
|
-
## ✅ 结束后继续
|
|
402
|
-
当满足结束条件时,按 delegated plan 执行 UI 计划
|
|
403
|
-
|
|
404
|
-
---
|
|
405
|
-
|
|
406
|
-
*编排工具: MCP Probe Kit - start_ui (requirements loop)*
|
|
379
|
+
const LOOP_PROMPT_TEMPLATE_STRICT = `# 🧭 UI 需求澄清与补全(Requirements Loop | 严格)
|
|
380
|
+
|
|
381
|
+
本模式用于稳健补全 UI 需求关键要素,不改变用户意图。
|
|
382
|
+
|
|
383
|
+
## 🎯 目标
|
|
384
|
+
UI 需求:{description}
|
|
385
|
+
|
|
386
|
+
## ✅ 规则
|
|
387
|
+
1. 不覆盖用户原始描述
|
|
388
|
+
2. 补全内容必须标注来源(User / Derived / Assumption)
|
|
389
|
+
3. 假设必须进入待确认列表
|
|
390
|
+
4. 每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## 🔁 执行步骤(每轮)
|
|
395
|
+
1) 使用 \`ask_user\` 提问补全关键信息
|
|
396
|
+
2) 更新结构化输出并标注来源
|
|
397
|
+
3) 若 \`openQuestions\` 为空且无高风险假设则结束
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## ✅ 结束后继续
|
|
402
|
+
当满足结束条件时,按 delegated plan 执行 UI 计划
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
*编排工具: MCP Probe Kit - start_ui (requirements loop)*
|
|
407
407
|
`;
|
|
408
408
|
function buildUiQuestions(questionBudget) {
|
|
409
409
|
const base = [
|
|
@@ -565,6 +565,17 @@ export async function startUi(args, context) {
|
|
|
565
565
|
headerNotes.push(buildSkillHeaderNote(skillBridge));
|
|
566
566
|
const memoryContext = await loadMemoryInjectionContext(description || templateName, 'ui');
|
|
567
567
|
const memoryGuideSection = renderMemoryGuideSection(memoryContext);
|
|
568
|
+
// 记忆优先:先复用历史 UI 资产/模式并规避历史 UI 坑,再进入设计与渲染
|
|
569
|
+
const memoryRecallStep = memoryContext.enabled
|
|
570
|
+
? [{
|
|
571
|
+
id: 'recall-memory',
|
|
572
|
+
tool: 'search_memory',
|
|
573
|
+
when: '开干前(下方「历史经验与坑」已自动注入相似 UI 资产与坑;需要更多时再调)',
|
|
574
|
+
args: { query: description || templateName, limit: 5 },
|
|
575
|
+
outputs: [],
|
|
576
|
+
note: '先复用历史可复用 UI 组件/布局/交互模式,并规避历史 UI 坑(交互/兼容性/可访问性)',
|
|
577
|
+
}]
|
|
578
|
+
: [];
|
|
568
579
|
// 验证 mode 参数
|
|
569
580
|
const validModes = ["auto", "manual"];
|
|
570
581
|
if (mode && !validModes.includes(mode)) {
|
|
@@ -572,15 +583,15 @@ export async function startUi(args, context) {
|
|
|
572
583
|
content: [
|
|
573
584
|
{
|
|
574
585
|
type: "text",
|
|
575
|
-
text: `❌ 无效的模式: ${mode}
|
|
576
|
-
|
|
577
|
-
**有效选项**: auto, manual
|
|
578
|
-
|
|
579
|
-
**示例**:
|
|
580
|
-
\`\`\`
|
|
581
|
-
start_ui "登录页面" --mode=manual
|
|
582
|
-
start_ui "用户列表" --mode=auto
|
|
583
|
-
\`\`\`
|
|
586
|
+
text: `❌ 无效的模式: ${mode}
|
|
587
|
+
|
|
588
|
+
**有效选项**: auto, manual
|
|
589
|
+
|
|
590
|
+
**示例**:
|
|
591
|
+
\`\`\`
|
|
592
|
+
start_ui "登录页面" --mode=manual
|
|
593
|
+
start_ui "用户列表" --mode=auto
|
|
594
|
+
\`\`\`
|
|
584
595
|
`,
|
|
585
596
|
},
|
|
586
597
|
],
|
|
@@ -596,11 +607,11 @@ start_ui "用户列表" --mode=auto
|
|
|
596
607
|
content: [
|
|
597
608
|
{
|
|
598
609
|
type: "text",
|
|
599
|
-
text: `❌ 缺少必要参数
|
|
600
|
-
|
|
601
|
-
**用法**:
|
|
602
|
-
\`\`\`
|
|
603
|
-
start_ui <描述> --requirements_mode=loop
|
|
610
|
+
text: `❌ 缺少必要参数
|
|
611
|
+
|
|
612
|
+
**用法**:
|
|
613
|
+
\`\`\`
|
|
614
|
+
start_ui <描述> --requirements_mode=loop
|
|
604
615
|
\`\`\``,
|
|
605
616
|
},
|
|
606
617
|
],
|
|
@@ -629,6 +640,7 @@ start_ui <描述> --requirements_mode=loop
|
|
|
629
640
|
const plan = {
|
|
630
641
|
mode: 'delegated',
|
|
631
642
|
steps: [
|
|
643
|
+
...memoryRecallStep,
|
|
632
644
|
skillBridgeStep,
|
|
633
645
|
{
|
|
634
646
|
id: 'loop-1',
|
|
@@ -712,17 +724,17 @@ start_ui <描述> --requirements_mode=loop
|
|
|
712
724
|
],
|
|
713
725
|
notes: [
|
|
714
726
|
...headerNotes,
|
|
715
|
-
...(memoryContext.enabled ? ['
|
|
727
|
+
...(memoryContext.enabled ? ['记忆优先: 已自动注入相似历史 UI 资产与坑(见顶部),先复用并规避同类坑;再决定是否沉淀'] : []),
|
|
716
728
|
],
|
|
717
729
|
});
|
|
718
730
|
const loopTemplate = profileDecision.resolved === 'strict'
|
|
719
731
|
? LOOP_PROMPT_TEMPLATE_STRICT
|
|
720
732
|
: LOOP_PROMPT_TEMPLATE_GUIDED;
|
|
721
|
-
const
|
|
733
|
+
const renderedLoopPrompt = loopTemplate
|
|
722
734
|
.replace(/{description}/g, description)
|
|
723
735
|
.replace(/{question_budget}/g, String(questionBudget))
|
|
724
|
-
.replace(/{assumption_cap}/g, String(assumptionCap))
|
|
725
|
-
|
|
736
|
+
.replace(/{assumption_cap}/g, String(assumptionCap));
|
|
737
|
+
const guide = header + memoryGuideSection + skillBridgeSection + renderedLoopPrompt;
|
|
726
738
|
const loopReport = {
|
|
727
739
|
mode: 'loop',
|
|
728
740
|
round: 1,
|
|
@@ -780,88 +792,89 @@ start_ui <描述> --requirements_mode=loop
|
|
|
780
792
|
const inferredStack = framework; // 保持用户指定的技术栈,或默认为 react
|
|
781
793
|
// 5. 生成智能执行计划
|
|
782
794
|
const searchQuery = description || templateName;
|
|
783
|
-
const smartPlanGuided = `# 🚀 智能 UI 开发计划
|
|
784
|
-
|
|
785
|
-
基于您的描述 "**${description}**",AI 引擎已为您规划了最佳开发路径。
|
|
786
|
-
|
|
787
|
-
## 🧠 智能分析结果
|
|
788
|
-
|
|
789
|
-
- **产品类型**: ${inferredProductType}
|
|
790
|
-
- **推荐风格**: ${recommendation.style.primary}
|
|
791
|
-
- **关键特性**: ${inferredKeywords}
|
|
792
|
-
- **技术栈**: ${inferredStack}
|
|
793
|
-
|
|
794
|
-
---
|
|
795
|
-
|
|
796
|
-
## 📋 执行步骤(已自动优化参数)
|
|
797
|
-
|
|
798
|
-
请按顺序执行以下命令:
|
|
799
|
-
|
|
800
|
-
### 1. 生成项目上下文 📋
|
|
801
|
-
\`\`\`bash
|
|
802
|
-
init_project_context
|
|
803
|
-
\`\`\`
|
|
804
|
-
|
|
805
|
-
### 2. 生成设计系统 🎨
|
|
806
|
-
\`\`\`bash
|
|
807
|
-
ui_design_system --product_type="${inferredProductType}" --stack="${inferredStack}" --keywords="${inferredKeywords}" --description="${description}"
|
|
808
|
-
\`\`\`
|
|
809
|
-
|
|
810
|
-
### 3. 生成组件目录 📦
|
|
811
|
-
\`\`\`bash
|
|
812
|
-
init_component_catalog
|
|
813
|
-
\`\`\`
|
|
814
|
-
|
|
815
|
-
### 4. 生成 UI 模板 📄
|
|
816
|
-
\`\`\`bash
|
|
817
|
-
# 搜索现有模板或生成新模板
|
|
818
|
-
ui_search --mode=template --query="${searchQuery}"
|
|
819
|
-
\`\`\`
|
|
820
|
-
|
|
821
|
-
### 5. 保存模板文件 🧩
|
|
822
|
-
\`\`\`bash
|
|
823
|
-
# 将选中的模板保存到本地
|
|
824
|
-
# 目标路径:docs/ui/${templateName}.json
|
|
825
|
-
\`\`\`
|
|
826
|
-
|
|
827
|
-
### 6. 渲染代码 💻
|
|
828
|
-
\`\`\`bash
|
|
829
|
-
render_ui docs/ui/${templateName}.json --framework="${inferredStack}"
|
|
830
|
-
\`\`\`
|
|
831
|
-
|
|
832
|
-
### 7. 更新项目上下文 📝
|
|
833
|
-
将生成的 UI 文档链接添加到 \`docs/project-context.md\` 的文档导航部分。
|
|
834
|
-
|
|
835
|
-
---
|
|
836
|
-
|
|
837
|
-
## 💡 为什么选择这个方案?
|
|
838
|
-
|
|
839
|
-
${recommendation.reasoning}
|
|
795
|
+
const smartPlanGuided = `# 🚀 智能 UI 开发计划
|
|
796
|
+
|
|
797
|
+
基于您的描述 "**${description}**",AI 引擎已为您规划了最佳开发路径。
|
|
798
|
+
|
|
799
|
+
## 🧠 智能分析结果
|
|
800
|
+
|
|
801
|
+
- **产品类型**: ${inferredProductType}
|
|
802
|
+
- **推荐风格**: ${recommendation.style.primary}
|
|
803
|
+
- **关键特性**: ${inferredKeywords}
|
|
804
|
+
- **技术栈**: ${inferredStack}
|
|
805
|
+
|
|
806
|
+
---
|
|
807
|
+
|
|
808
|
+
## 📋 执行步骤(已自动优化参数)
|
|
809
|
+
|
|
810
|
+
请按顺序执行以下命令:
|
|
811
|
+
|
|
812
|
+
### 1. 生成项目上下文 📋
|
|
813
|
+
\`\`\`bash
|
|
814
|
+
init_project_context
|
|
815
|
+
\`\`\`
|
|
816
|
+
|
|
817
|
+
### 2. 生成设计系统 🎨
|
|
818
|
+
\`\`\`bash
|
|
819
|
+
ui_design_system --product_type="${inferredProductType}" --stack="${inferredStack}" --keywords="${inferredKeywords}" --description="${description}"
|
|
820
|
+
\`\`\`
|
|
821
|
+
|
|
822
|
+
### 3. 生成组件目录 📦
|
|
823
|
+
\`\`\`bash
|
|
824
|
+
init_component_catalog
|
|
825
|
+
\`\`\`
|
|
826
|
+
|
|
827
|
+
### 4. 生成 UI 模板 📄
|
|
828
|
+
\`\`\`bash
|
|
829
|
+
# 搜索现有模板或生成新模板
|
|
830
|
+
ui_search --mode=template --query="${searchQuery}"
|
|
831
|
+
\`\`\`
|
|
832
|
+
|
|
833
|
+
### 5. 保存模板文件 🧩
|
|
834
|
+
\`\`\`bash
|
|
835
|
+
# 将选中的模板保存到本地
|
|
836
|
+
# 目标路径:docs/ui/${templateName}.json
|
|
837
|
+
\`\`\`
|
|
838
|
+
|
|
839
|
+
### 6. 渲染代码 💻
|
|
840
|
+
\`\`\`bash
|
|
841
|
+
render_ui docs/ui/${templateName}.json --framework="${inferredStack}"
|
|
842
|
+
\`\`\`
|
|
843
|
+
|
|
844
|
+
### 7. 更新项目上下文 📝
|
|
845
|
+
将生成的 UI 文档链接添加到 \`docs/project-context.md\` 的文档导航部分。
|
|
846
|
+
|
|
847
|
+
---
|
|
848
|
+
|
|
849
|
+
## 💡 为什么选择这个方案?
|
|
850
|
+
|
|
851
|
+
${recommendation.reasoning}
|
|
840
852
|
`;
|
|
841
|
-
const smartPlanStrict = `# 🚀 智能 UI 开发计划(严格)
|
|
842
|
-
|
|
843
|
-
## 🧠 智能分析结果
|
|
844
|
-
|
|
845
|
-
- **产品类型**: ${inferredProductType}
|
|
846
|
-
- **推荐风格**: ${recommendation.style.primary}
|
|
847
|
-
- **关键特性**: ${inferredKeywords}
|
|
848
|
-
- **技术栈**: ${inferredStack}
|
|
849
|
-
|
|
850
|
-
---
|
|
851
|
-
|
|
852
|
-
## 📋 执行步骤
|
|
853
|
-
|
|
854
|
-
1) init_project_context
|
|
855
|
-
2) ui_design_system --product_type="${inferredProductType}" --stack="${inferredStack}" --keywords="${inferredKeywords}" --description="${description}"
|
|
856
|
-
3) init_component_catalog
|
|
857
|
-
4) ui_search --mode=template --query="${searchQuery}"
|
|
858
|
-
5) 保存模板到 docs/ui/${templateName}.json
|
|
859
|
-
6) render_ui docs/ui/${templateName}.json --framework="${inferredStack}"
|
|
860
|
-
7) 更新 project-context.md 索引
|
|
853
|
+
const smartPlanStrict = `# 🚀 智能 UI 开发计划(严格)
|
|
854
|
+
|
|
855
|
+
## 🧠 智能分析结果
|
|
856
|
+
|
|
857
|
+
- **产品类型**: ${inferredProductType}
|
|
858
|
+
- **推荐风格**: ${recommendation.style.primary}
|
|
859
|
+
- **关键特性**: ${inferredKeywords}
|
|
860
|
+
- **技术栈**: ${inferredStack}
|
|
861
|
+
|
|
862
|
+
---
|
|
863
|
+
|
|
864
|
+
## 📋 执行步骤
|
|
865
|
+
|
|
866
|
+
1) init_project_context
|
|
867
|
+
2) ui_design_system --product_type="${inferredProductType}" --stack="${inferredStack}" --keywords="${inferredKeywords}" --description="${description}"
|
|
868
|
+
3) init_component_catalog
|
|
869
|
+
4) ui_search --mode=template --query="${searchQuery}"
|
|
870
|
+
5) 保存模板到 docs/ui/${templateName}.json
|
|
871
|
+
6) render_ui docs/ui/${templateName}.json --framework="${inferredStack}"
|
|
872
|
+
7) 更新 project-context.md 索引
|
|
861
873
|
`;
|
|
862
874
|
const plan = {
|
|
863
875
|
mode: 'delegated',
|
|
864
876
|
steps: [
|
|
877
|
+
...memoryRecallStep,
|
|
865
878
|
skillBridgeStep,
|
|
866
879
|
{
|
|
867
880
|
id: 'context',
|
|
@@ -929,10 +942,10 @@ ${recommendation.reasoning}
|
|
|
929
942
|
],
|
|
930
943
|
notes: [
|
|
931
944
|
...headerNotes,
|
|
932
|
-
...(memoryContext.enabled ? ['
|
|
945
|
+
...(memoryContext.enabled ? ['记忆优先: 已自动注入相似历史 UI 资产与坑(见顶部),先复用并规避同类坑'] : []),
|
|
933
946
|
],
|
|
934
947
|
});
|
|
935
|
-
const smartPlan = header + skillBridgeSection + (profileDecision.resolved === 'strict' ? smartPlanStrict : smartPlanGuided)
|
|
948
|
+
const smartPlan = header + memoryGuideSection + skillBridgeSection + (profileDecision.resolved === 'strict' ? smartPlanStrict : smartPlanGuided);
|
|
936
949
|
// Create structured UI report for auto mode
|
|
937
950
|
const uiReport = {
|
|
938
951
|
summary: `智能 UI 开发:${description}`,
|
|
@@ -1015,23 +1028,23 @@ ${recommendation.reasoning}
|
|
|
1015
1028
|
content: [
|
|
1016
1029
|
{
|
|
1017
1030
|
type: "text",
|
|
1018
|
-
text: `❌ 缺少必要参数
|
|
1019
|
-
|
|
1020
|
-
**用法**:
|
|
1021
|
-
\`\`\`
|
|
1022
|
-
start_ui <描述> [--framework=react|vue|html]
|
|
1023
|
-
\`\`\`
|
|
1024
|
-
|
|
1025
|
-
**示例**:
|
|
1026
|
-
\`\`\`
|
|
1027
|
-
start_ui "登录页面"
|
|
1028
|
-
start_ui "用户列表" --framework=vue
|
|
1029
|
-
start_ui "设置页面" --framework=react
|
|
1030
|
-
\`\`\`
|
|
1031
|
-
|
|
1032
|
-
**提示**:
|
|
1033
|
-
- 确保已运行 \`ui_design_system\` 生成设计系统
|
|
1034
|
-
- 组件目录会自动生成(如果不存在)
|
|
1031
|
+
text: `❌ 缺少必要参数
|
|
1032
|
+
|
|
1033
|
+
**用法**:
|
|
1034
|
+
\`\`\`
|
|
1035
|
+
start_ui <描述> [--framework=react|vue|html]
|
|
1036
|
+
\`\`\`
|
|
1037
|
+
|
|
1038
|
+
**示例**:
|
|
1039
|
+
\`\`\`
|
|
1040
|
+
start_ui "登录页面"
|
|
1041
|
+
start_ui "用户列表" --framework=vue
|
|
1042
|
+
start_ui "设置页面" --framework=react
|
|
1043
|
+
\`\`\`
|
|
1044
|
+
|
|
1045
|
+
**提示**:
|
|
1046
|
+
- 确保已运行 \`ui_design_system\` 生成设计系统
|
|
1047
|
+
- 组件目录会自动生成(如果不存在)
|
|
1035
1048
|
`,
|
|
1036
1049
|
},
|
|
1037
1050
|
],
|
|
@@ -1060,21 +1073,22 @@ start_ui "设置页面" --framework=react
|
|
|
1060
1073
|
],
|
|
1061
1074
|
notes: [
|
|
1062
1075
|
...headerNotes,
|
|
1063
|
-
...(memoryContext.enabled ? ['
|
|
1076
|
+
...(memoryContext.enabled ? ['记忆优先: 已自动注入相似历史 UI 资产与坑(见顶部),先复用并规避同类坑'] : []),
|
|
1064
1077
|
],
|
|
1065
1078
|
});
|
|
1066
1079
|
const baseTemplate = profileDecision.resolved === 'strict'
|
|
1067
1080
|
? PROMPT_TEMPLATE_STRICT
|
|
1068
1081
|
: PROMPT_TEMPLATE_GUIDED;
|
|
1069
|
-
let
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
guide
|
|
1082
|
+
let body = skillBridgeSection + baseTemplate;
|
|
1083
|
+
body = safeReplace(body, '{description}', escapeJson(description));
|
|
1084
|
+
body = safeReplace(body, '{productType}', productType);
|
|
1085
|
+
body = safeReplace(body, '{framework}', framework);
|
|
1086
|
+
body = safeReplace(body, '{templateName}', templateName);
|
|
1087
|
+
const guide = header + memoryGuideSection + body;
|
|
1075
1088
|
const plan = {
|
|
1076
1089
|
mode: 'delegated',
|
|
1077
1090
|
steps: [
|
|
1091
|
+
...memoryRecallStep,
|
|
1078
1092
|
skillBridgeStep,
|
|
1079
1093
|
{
|
|
1080
1094
|
id: 'context',
|