mcp-probe-kit 3.0.18 → 3.0.19

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.
Files changed (37) hide show
  1. package/README.md +75 -50
  2. package/build/lib/__tests__/agents-md-template.unit.test.d.ts +1 -0
  3. package/build/lib/__tests__/agents-md-template.unit.test.js +25 -0
  4. package/build/lib/__tests__/project-context-layout.unit.test.d.ts +1 -0
  5. package/build/lib/__tests__/project-context-layout.unit.test.js +80 -0
  6. package/build/lib/agents-md-template.d.ts +25 -0
  7. package/build/lib/agents-md-template.js +55 -0
  8. package/build/lib/memory-orchestration.d.ts +3 -1
  9. package/build/lib/memory-orchestration.js +71 -5
  10. package/build/lib/merge-agents-md.d.ts +6 -0
  11. package/build/lib/merge-agents-md.js +51 -0
  12. package/build/lib/project-context-layout.d.ts +78 -0
  13. package/build/lib/project-context-layout.js +350 -0
  14. package/build/lib/workspace-root.js +6 -1
  15. package/build/resources/ui-ux-data/metadata.json +1 -1
  16. package/build/schemas/index.d.ts +25 -3
  17. package/build/schemas/memory-tools.d.ts +1 -1
  18. package/build/schemas/memory-tools.js +1 -1
  19. package/build/schemas/project-tools.d.ts +24 -2
  20. package/build/schemas/project-tools.js +24 -2
  21. package/build/tools/__tests__/code_insight.unit.test.js +3 -3
  22. package/build/tools/__tests__/init_project_context.unit.test.js +32 -21
  23. package/build/tools/__tests__/start_feature.unit.test.js +2 -1
  24. package/build/tools/code_insight.js +11 -9
  25. package/build/tools/init_project_context.js +563 -506
  26. package/build/tools/start_bugfix.js +254 -248
  27. package/build/tools/start_feature.js +137 -131
  28. package/build/tools/start_ui.js +402 -402
  29. package/docs/.mcp-probe/layout.json +11 -0
  30. package/docs/i18n/en.json +36 -5
  31. package/docs/i18n/ja.json +9 -2
  32. package/docs/i18n/ko.json +9 -2
  33. package/docs/i18n/zh-CN.json +36 -5
  34. package/docs/memory-local-setup.md +314 -0
  35. package/docs/memory-local-setup.zh-CN.md +280 -0
  36. package/docs/pages/getting-started.html +249 -31
  37. package/package.json +1 -1
@@ -89,300 +89,300 @@ function resolveTemplateProfile(rawProfile, description) {
89
89
  warning: `模板档位 \"${rawProfile}\" 不支持,已回退为 ${fallback}`,
90
90
  };
91
91
  }
92
- const PROMPT_TEMPLATE_GUIDED = `# 快速开始
93
-
94
- **职责说明**: 本工具仅提供执行指导,不执行实际操作。请按顺序调用以下 MCP 工具。
95
-
96
- 执行以下工具:
97
-
98
- 1. 检查 \`docs/project-context.md\` 是否存在,不存在则调用 \`init_project_context\`
99
- 2. 检查 \`docs/design-system.md\` 是否存在,不存在则调用 \`ui_design_system --product_type="{productType}" --stack="{framework}"\`
100
- 3. 检查 \`docs/ui/component-catalog.json\` 是否存在,不存在则调用 \`init_component_catalog\`
101
- 4. \`ui_search --mode=template --query="{description}"\`
102
- 5. 选择模板并保存到 \`docs/ui/{templateName}.json\`
103
- 6. \`render_ui --template="docs/ui/{templateName}.json" --framework="{framework}"\`
104
- 7. 将生成的 UI 文档添加到 \`docs/project-context.md\` 索引中
105
-
106
- ---
107
-
108
- ## 步骤 1: 生成项目上下文(如不存在)📋
109
-
110
- **检查**: 查看 \`docs/project-context.md\` 是否存在
111
-
112
- **如果不存在,调用工具**: \`init_project_context\`
113
- **参数**: 无(使用默认配置)
114
-
115
- **预期输出**:
116
- - \`docs/project-context.md\` - 项目上下文索引文件
117
- - \`docs/project-context/\` - 项目文档目录
118
-
119
- **失败处理**: 确保 docs 目录存在且有写入权限
120
-
121
- ---
122
-
123
- ## 步骤 2: 生成设计系统(如不存在)🎨
124
-
125
- **检查**: 查看 \`docs/design-system.md\` 是否存在
126
-
127
- **如果不存在,调用工具**: \`ui_design_system\`
128
- **参数**:
129
- \`\`\`json
130
- {
131
- "product_type": "{productType}",
132
- "stack": "{framework}",
133
- "description": "{description}"
134
- }
135
- \`\`\`
136
-
137
- **预期输出**: \`docs/design-system.json\` 和 \`docs/design-system.md\`
138
- **失败处理**: 检查 docs 目录是否存在,确保有写入权限
139
-
140
- ---
141
-
142
- ## 步骤 3: 生成组件目录(如不存在)📦
143
-
144
- **检查**: 查看 \`docs/ui/component-catalog.json\` 是否存在
145
-
146
- **如果不存在,调用工具**: \`init_component_catalog\`
147
- **参数**: 无
148
-
149
- **预期输出**: \`docs/ui/component-catalog.json\`
150
- **失败处理**: 确保步骤 2 的设计系统文件已生成
151
-
152
- ---
153
-
154
- ## 步骤 4: 搜索 UI 模板 🔍
155
-
156
- **工具**: \`ui_search\`
157
- **参数**:
158
- \`\`\`json
159
- {
160
- "mode": "template",
161
- "query": "{description}"
162
- }
163
- \`\`\`
164
-
165
- **预期输出**: 匹配的模板列表(可能为空)
166
- **失败处理**: 如果没有找到模板,创建最小模板文件再进入渲染步骤
167
-
168
- ---
169
-
170
- ## 步骤 5: 保存模板文件 🧩
171
-
172
- **操作**: 从搜索结果选择模板或创建最小模板
173
-
174
- **保存路径**: \`docs/ui/{templateName}.json\`
175
-
176
- **最小模板示例**:
177
- \`\`\`json
178
- {
179
- "name": "UiTemplate",
180
- "description": "{description}",
181
- "layout": "sectioned"
182
- }
183
- \`\`\`
184
-
185
- ---
186
-
187
- ## 步骤 6: 渲染最终代码 💻
188
-
189
- **工具**: \`render_ui\`
190
- **参数**:
191
- \`\`\`json
192
- {
193
- "template": "docs/ui/{templateName}.json",
194
- "framework": "{framework}"
195
- }
196
- \`\`\`
197
-
198
- **预期输出**: 完整的 {framework} 组件代码
199
- **失败处理**: 如果模板不存在,请先完成步骤 5 保存模板文件
200
-
201
- ---
202
-
203
- ## 步骤 7: 更新项目上下文索引 📝
204
-
205
- **操作**: 将生成的 UI 文档添加到 \`docs/project-context.md\` 中
206
-
207
- **添加内容**:
208
- 在 "## 📚 文档导航" 部分添加:
209
-
210
- \`\`\`markdown
211
- ### [UI 设计系统](./design-system.md)
212
- 项目的 UI 设计规范,包括颜色、字体、组件样式等
213
-
214
- ### [UI 组件目录](./ui/component-catalog.json)
215
- 可用的 UI 组件及其属性定义
216
- \`\`\`
217
-
218
- 在 "## 💡 开发时查看对应文档" 部分的 "添加新功能" 下添加:
219
- \`\`\`markdown
220
- - **UI 设计系统**: [design-system.md](./design-system.md) - 查看设计规范
221
- - **UI 组件目录**: [ui/component-catalog.json](./ui/component-catalog.json) - 查看可用组件
222
- \`\`\`
223
-
224
- **预期结果**: \`docs/project-context.md\` 包含 UI 相关文档的链接
225
- **失败处理**: 如果文件不存在,跳过此步骤
226
-
227
- ---
228
-
229
- ## 高级选项
230
-
231
- ### 自定义设计系统
232
- 编辑 \`docs/design-system.json\` 修改颜色、字体等,然后重新运行。
233
-
234
- ### 自定义组件
235
- 编辑 \`docs/ui/component-catalog.json\` 添加新组件定义。
236
-
237
- ### 常见问题
238
-
239
- **Q: 设计系统文件已存在,还需要重新生成吗?**
240
- A: 不需要。如果文件已存在,直接跳过步骤 1。
241
-
242
- **Q: 如何使用自定义模板?**
243
- A: 在 \`docs/ui/\` 目录创建 JSON 模板文件,然后在步骤 4 中指定模板路径。
92
+ const PROMPT_TEMPLATE_GUIDED = `# 快速开始
93
+
94
+ **职责说明**: 本工具仅提供执行指导,不执行实际操作。请按顺序调用以下 MCP 工具。
95
+
96
+ 执行以下工具:
97
+
98
+ 1. 检查 \`docs/project-context.md\` 是否存在,不存在则调用 \`init_project_context\`
99
+ 2. 检查 \`docs/design-system.md\` 是否存在,不存在则调用 \`ui_design_system --product_type="{productType}" --stack="{framework}"\`
100
+ 3. 检查 \`docs/ui/component-catalog.json\` 是否存在,不存在则调用 \`init_component_catalog\`
101
+ 4. \`ui_search --mode=template --query="{description}"\`
102
+ 5. 选择模板并保存到 \`docs/ui/{templateName}.json\`
103
+ 6. \`render_ui --template="docs/ui/{templateName}.json" --framework="{framework}"\`
104
+ 7. 将生成的 UI 文档添加到 \`docs/project-context.md\` 索引中
105
+
106
+ ---
107
+
108
+ ## 步骤 1: 生成项目上下文(如不存在)📋
109
+
110
+ **检查**: 查看 \`docs/project-context.md\` 是否存在
111
+
112
+ **如果不存在,调用工具**: \`init_project_context\`
113
+ **参数**: 无(使用默认配置)
114
+
115
+ **预期输出**:
116
+ - \`docs/project-context.md\` - 项目上下文索引文件
117
+ - \`docs/project-context/\` - 项目文档目录
118
+
119
+ **失败处理**: 确保 docs 目录存在且有写入权限
120
+
121
+ ---
122
+
123
+ ## 步骤 2: 生成设计系统(如不存在)🎨
124
+
125
+ **检查**: 查看 \`docs/design-system.md\` 是否存在
126
+
127
+ **如果不存在,调用工具**: \`ui_design_system\`
128
+ **参数**:
129
+ \`\`\`json
130
+ {
131
+ "product_type": "{productType}",
132
+ "stack": "{framework}",
133
+ "description": "{description}"
134
+ }
135
+ \`\`\`
136
+
137
+ **预期输出**: \`docs/design-system.json\` 和 \`docs/design-system.md\`
138
+ **失败处理**: 检查 docs 目录是否存在,确保有写入权限
139
+
140
+ ---
141
+
142
+ ## 步骤 3: 生成组件目录(如不存在)📦
143
+
144
+ **检查**: 查看 \`docs/ui/component-catalog.json\` 是否存在
145
+
146
+ **如果不存在,调用工具**: \`init_component_catalog\`
147
+ **参数**: 无
148
+
149
+ **预期输出**: \`docs/ui/component-catalog.json\`
150
+ **失败处理**: 确保步骤 2 的设计系统文件已生成
151
+
152
+ ---
153
+
154
+ ## 步骤 4: 搜索 UI 模板 🔍
155
+
156
+ **工具**: \`ui_search\`
157
+ **参数**:
158
+ \`\`\`json
159
+ {
160
+ "mode": "template",
161
+ "query": "{description}"
162
+ }
163
+ \`\`\`
164
+
165
+ **预期输出**: 匹配的模板列表(可能为空)
166
+ **失败处理**: 如果没有找到模板,创建最小模板文件再进入渲染步骤
167
+
168
+ ---
169
+
170
+ ## 步骤 5: 保存模板文件 🧩
171
+
172
+ **操作**: 从搜索结果选择模板或创建最小模板
173
+
174
+ **保存路径**: \`docs/ui/{templateName}.json\`
175
+
176
+ **最小模板示例**:
177
+ \`\`\`json
178
+ {
179
+ "name": "UiTemplate",
180
+ "description": "{description}",
181
+ "layout": "sectioned"
182
+ }
183
+ \`\`\`
184
+
185
+ ---
186
+
187
+ ## 步骤 6: 渲染最终代码 💻
188
+
189
+ **工具**: \`render_ui\`
190
+ **参数**:
191
+ \`\`\`json
192
+ {
193
+ "template": "docs/ui/{templateName}.json",
194
+ "framework": "{framework}"
195
+ }
196
+ \`\`\`
197
+
198
+ **预期输出**: 完整的 {framework} 组件代码
199
+ **失败处理**: 如果模板不存在,请先完成步骤 5 保存模板文件
200
+
201
+ ---
202
+
203
+ ## 步骤 7: 更新项目上下文索引 📝
204
+
205
+ **操作**: 将生成的 UI 文档添加到 \`docs/project-context.md\` 中
206
+
207
+ **添加内容**:
208
+ 在 "## 📚 文档导航" 部分添加:
209
+
210
+ \`\`\`markdown
211
+ ### [UI 设计系统](./design-system.md)
212
+ 项目的 UI 设计规范,包括颜色、字体、组件样式等
213
+
214
+ ### [UI 组件目录](./ui/component-catalog.json)
215
+ 可用的 UI 组件及其属性定义
216
+ \`\`\`
217
+
218
+ 在 "## 💡 开发时查看对应文档" 部分的 "添加新功能" 下添加:
219
+ \`\`\`markdown
220
+ - **UI 设计系统**: [design-system.md](./design-system.md) - 查看设计规范
221
+ - **UI 组件目录**: [ui/component-catalog.json](./ui/component-catalog.json) - 查看可用组件
222
+ \`\`\`
223
+
224
+ **预期结果**: \`docs/project-context.md\` 包含 UI 相关文档的链接
225
+ **失败处理**: 如果文件不存在,跳过此步骤
226
+
227
+ ---
228
+
229
+ ## 高级选项
230
+
231
+ ### 自定义设计系统
232
+ 编辑 \`docs/design-system.json\` 修改颜色、字体等,然后重新运行。
233
+
234
+ ### 自定义组件
235
+ 编辑 \`docs/ui/component-catalog.json\` 添加新组件定义。
236
+
237
+ ### 常见问题
238
+
239
+ **Q: 设计系统文件已存在,还需要重新生成吗?**
240
+ A: 不需要。如果文件已存在,直接跳过步骤 1。
241
+
242
+ **Q: 如何使用自定义模板?**
243
+ A: 在 \`docs/ui/\` 目录创建 JSON 模板文件,然后在步骤 4 中指定模板路径。
244
244
  `;
245
- const PROMPT_TEMPLATE_STRICT = `# UI 开发编排(严格)
246
-
247
- **职责说明**: 本工具仅提供执行指导,不执行实际操作。请按顺序调用以下 MCP 工具。
248
-
249
- ## ✅ 执行计划
250
-
251
- 1. 检查 \`docs/project-context.md\`,缺失则调用 \`init_project_context\`
252
- 2. 检查 \`docs/design-system.md\`,缺失则调用 \`ui_design_system --product_type="{productType}" --stack="{framework}"\`
253
- 3. 检查 \`docs/ui/component-catalog.json\`,缺失则调用 \`init_component_catalog\`
254
- 4. \`ui_search --mode=template --query="{description}"\`
255
- 5. 选择模板并保存到 \`docs/ui/{templateName}.json\`
256
- 6. \`render_ui --template="docs/ui/{templateName}.json" --framework="{framework}"\`
257
- 7. 将生成的 UI 文档添加到 \`docs/project-context.md\` 索引中
258
-
259
- ---
260
-
261
- ## 步骤 1: 生成项目上下文(如不存在)
262
-
263
- **检查**: \`docs/project-context.md\`
264
- **缺失则调用**: \`init_project_context\`
265
- **预期输出**: \`docs/project-context.md\`
266
-
267
- ---
268
-
269
- ## 步骤 2: 生成设计系统(如不存在)
270
-
271
- **检查**: \`docs/design-system.md\`
272
- **缺失则调用**: \`ui_design_system\`
273
- \`\`\`json
274
- {
275
- "product_type": "{productType}",
276
- "stack": "{framework}",
277
- "description": "{description}"
278
- }
279
- \`\`\`
280
- **预期输出**: \`docs/design-system.json\`、\`docs/design-system.md\`
281
-
282
- ---
283
-
284
- ## 步骤 3: 生成组件目录(如不存在)
285
-
286
- **检查**: \`docs/ui/component-catalog.json\`
287
- **缺失则调用**: \`init_component_catalog\`
288
- **预期输出**: \`docs/ui/component-catalog.json\`
289
-
290
- ---
291
-
292
- ## 步骤 4: 搜索模板
293
-
294
- **工具**: \`ui_search\`
295
- \`\`\`json
296
- { "mode": "template", "query": "{description}" }
297
- \`\`\`
298
-
299
- ---
300
-
301
- ## 步骤 5: 保存模板文件
302
-
303
- **操作**: 从搜索结果选择模板或创建最小模板
304
-
305
- **保存路径**: \`docs/ui/{templateName}.json\`
306
-
307
- ---
308
-
309
- ## 步骤 6: 渲染代码
310
-
311
- **工具**: \`render_ui\`
312
- \`\`\`json
313
- { "template": "docs/ui/{templateName}.json", "framework": "{framework}" }
314
- \`\`\`
315
-
316
- ---
317
-
318
- ## 步骤 7: 更新项目上下文索引
319
-
320
- 将 UI 文档链接添加到 \`docs/project-context.md\`
245
+ const PROMPT_TEMPLATE_STRICT = `# UI 开发编排(严格)
246
+
247
+ **职责说明**: 本工具仅提供执行指导,不执行实际操作。请按顺序调用以下 MCP 工具。
248
+
249
+ ## ✅ 执行计划
250
+
251
+ 1. 检查 \`docs/project-context.md\`,缺失则调用 \`init_project_context\`
252
+ 2. 检查 \`docs/design-system.md\`,缺失则调用 \`ui_design_system --product_type="{productType}" --stack="{framework}"\`
253
+ 3. 检查 \`docs/ui/component-catalog.json\`,缺失则调用 \`init_component_catalog\`
254
+ 4. \`ui_search --mode=template --query="{description}"\`
255
+ 5. 选择模板并保存到 \`docs/ui/{templateName}.json\`
256
+ 6. \`render_ui --template="docs/ui/{templateName}.json" --framework="{framework}"\`
257
+ 7. 将生成的 UI 文档添加到 \`docs/project-context.md\` 索引中
258
+
259
+ ---
260
+
261
+ ## 步骤 1: 生成项目上下文(如不存在)
262
+
263
+ **检查**: \`docs/project-context.md\`
264
+ **缺失则调用**: \`init_project_context\`
265
+ **预期输出**: \`docs/project-context.md\`
266
+
267
+ ---
268
+
269
+ ## 步骤 2: 生成设计系统(如不存在)
270
+
271
+ **检查**: \`docs/design-system.md\`
272
+ **缺失则调用**: \`ui_design_system\`
273
+ \`\`\`json
274
+ {
275
+ "product_type": "{productType}",
276
+ "stack": "{framework}",
277
+ "description": "{description}"
278
+ }
279
+ \`\`\`
280
+ **预期输出**: \`docs/design-system.json\`、\`docs/design-system.md\`
281
+
282
+ ---
283
+
284
+ ## 步骤 3: 生成组件目录(如不存在)
285
+
286
+ **检查**: \`docs/ui/component-catalog.json\`
287
+ **缺失则调用**: \`init_component_catalog\`
288
+ **预期输出**: \`docs/ui/component-catalog.json\`
289
+
290
+ ---
291
+
292
+ ## 步骤 4: 搜索模板
293
+
294
+ **工具**: \`ui_search\`
295
+ \`\`\`json
296
+ { "mode": "template", "query": "{description}" }
297
+ \`\`\`
298
+
299
+ ---
300
+
301
+ ## 步骤 5: 保存模板文件
302
+
303
+ **操作**: 从搜索结果选择模板或创建最小模板
304
+
305
+ **保存路径**: \`docs/ui/{templateName}.json\`
306
+
307
+ ---
308
+
309
+ ## 步骤 6: 渲染代码
310
+
311
+ **工具**: \`render_ui\`
312
+ \`\`\`json
313
+ { "template": "docs/ui/{templateName}.json", "framework": "{framework}" }
314
+ \`\`\`
315
+
316
+ ---
317
+
318
+ ## 步骤 7: 更新项目上下文索引
319
+
320
+ 将 UI 文档链接添加到 \`docs/project-context.md\`
321
321
  `;
322
- const LOOP_PROMPT_TEMPLATE_GUIDED = `# 🧭 UI 需求澄清与补全(Requirements Loop)
323
-
324
- 本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐 UI 需求关键要素。
325
-
326
- ## 🎯 目标
327
- UI 需求:{description}
328
-
329
- ## ✅ 规则
330
- 1. **不覆盖用户原始描述**
331
- 2. **补全内容必须标注来源**(User / Derived / Assumption)
332
- 3. **假设必须进入待确认列表**
333
- 4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
334
-
335
- ---
336
-
337
- ## 🔁 执行步骤(每轮)
338
-
339
- ### 1) 生成待确认问题
340
- 使用 \`ask_user\` 提问,问题来源于 UI 需求补全清单(目标/交互/状态/设备/可访问性)。
341
-
342
- ### 2) 更新结构化输出
343
- 将回答补入 \`requirements\`,并标注来源。
344
-
345
- ### 3) 自检与结束
346
- 若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入 UI 执行计划。
347
-
348
- ---
349
-
350
- ## ✅ 结束后继续
351
- 当满足结束条件时,按 delegated plan 执行:
352
- - 设计系统 → 组件目录 → 模板搜索 → 保存模板 → 渲染代码 → 更新上下文
353
-
354
- ---
355
-
356
- *编排工具: MCP Probe Kit - start_ui (requirements loop)*
322
+ const LOOP_PROMPT_TEMPLATE_GUIDED = `# 🧭 UI 需求澄清与补全(Requirements Loop)
323
+
324
+ 本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐 UI 需求关键要素。
325
+
326
+ ## 🎯 目标
327
+ UI 需求:{description}
328
+
329
+ ## ✅ 规则
330
+ 1. **不覆盖用户原始描述**
331
+ 2. **补全内容必须标注来源**(User / Derived / Assumption)
332
+ 3. **假设必须进入待确认列表**
333
+ 4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
334
+
335
+ ---
336
+
337
+ ## 🔁 执行步骤(每轮)
338
+
339
+ ### 1) 生成待确认问题
340
+ 使用 \`ask_user\` 提问,问题来源于 UI 需求补全清单(目标/交互/状态/设备/可访问性)。
341
+
342
+ ### 2) 更新结构化输出
343
+ 将回答补入 \`requirements\`,并标注来源。
344
+
345
+ ### 3) 自检与结束
346
+ 若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入 UI 执行计划。
347
+
348
+ ---
349
+
350
+ ## ✅ 结束后继续
351
+ 当满足结束条件时,按 delegated plan 执行:
352
+ - 设计系统 → 组件目录 → 模板搜索 → 保存模板 → 渲染代码 → 更新上下文
353
+
354
+ ---
355
+
356
+ *编排工具: MCP Probe Kit - start_ui (requirements loop)*
357
357
  `;
358
- const LOOP_PROMPT_TEMPLATE_STRICT = `# 🧭 UI 需求澄清与补全(Requirements Loop | 严格)
359
-
360
- 本模式用于稳健补全 UI 需求关键要素,不改变用户意图。
361
-
362
- ## 🎯 目标
363
- UI 需求:{description}
364
-
365
- ## ✅ 规则
366
- 1. 不覆盖用户原始描述
367
- 2. 补全内容必须标注来源(User / Derived / Assumption)
368
- 3. 假设必须进入待确认列表
369
- 4. 每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}
370
-
371
- ---
372
-
373
- ## 🔁 执行步骤(每轮)
374
- 1) 使用 \`ask_user\` 提问补全关键信息
375
- 2) 更新结构化输出并标注来源
376
- 3) 若 \`openQuestions\` 为空且无高风险假设则结束
377
-
378
- ---
379
-
380
- ## ✅ 结束后继续
381
- 当满足结束条件时,按 delegated plan 执行 UI 计划
382
-
383
- ---
384
-
385
- *编排工具: MCP Probe Kit - start_ui (requirements loop)*
358
+ const LOOP_PROMPT_TEMPLATE_STRICT = `# 🧭 UI 需求澄清与补全(Requirements Loop | 严格)
359
+
360
+ 本模式用于稳健补全 UI 需求关键要素,不改变用户意图。
361
+
362
+ ## 🎯 目标
363
+ UI 需求:{description}
364
+
365
+ ## ✅ 规则
366
+ 1. 不覆盖用户原始描述
367
+ 2. 补全内容必须标注来源(User / Derived / Assumption)
368
+ 3. 假设必须进入待确认列表
369
+ 4. 每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}
370
+
371
+ ---
372
+
373
+ ## 🔁 执行步骤(每轮)
374
+ 1) 使用 \`ask_user\` 提问补全关键信息
375
+ 2) 更新结构化输出并标注来源
376
+ 3) 若 \`openQuestions\` 为空且无高风险假设则结束
377
+
378
+ ---
379
+
380
+ ## ✅ 结束后继续
381
+ 当满足结束条件时,按 delegated plan 执行 UI 计划
382
+
383
+ ---
384
+
385
+ *编排工具: MCP Probe Kit - start_ui (requirements loop)*
386
386
  `;
387
387
  function buildUiQuestions(questionBudget) {
388
388
  const base = [
@@ -551,15 +551,15 @@ export async function startUi(args, context) {
551
551
  content: [
552
552
  {
553
553
  type: "text",
554
- text: `❌ 无效的模式: ${mode}
555
-
556
- **有效选项**: auto, manual
557
-
558
- **示例**:
559
- \`\`\`
560
- start_ui "登录页面" --mode=manual
561
- start_ui "用户列表" --mode=auto
562
- \`\`\`
554
+ text: `❌ 无效的模式: ${mode}
555
+
556
+ **有效选项**: auto, manual
557
+
558
+ **示例**:
559
+ \`\`\`
560
+ start_ui "登录页面" --mode=manual
561
+ start_ui "用户列表" --mode=auto
562
+ \`\`\`
563
563
  `,
564
564
  },
565
565
  ],
@@ -575,11 +575,11 @@ start_ui "用户列表" --mode=auto
575
575
  content: [
576
576
  {
577
577
  type: "text",
578
- text: `❌ 缺少必要参数
579
-
580
- **用法**:
581
- \`\`\`
582
- start_ui <描述> --requirements_mode=loop
578
+ text: `❌ 缺少必要参数
579
+
580
+ **用法**:
581
+ \`\`\`
582
+ start_ui <描述> --requirements_mode=loop
583
583
  \`\`\``,
584
584
  },
585
585
  ],
@@ -678,7 +678,7 @@ start_ui <描述> --requirements_mode=loop
678
678
  action: 'update_project_context',
679
679
  outputs: ['docs/project-context.md'],
680
680
  },
681
- ...(memoryContext.enabled ? [buildMemoryPlanStep()] : []),
681
+ ...(memoryContext.enabled ? [buildMemoryPlanStep('ui')] : []),
682
682
  ],
683
683
  };
684
684
  const header = renderOrchestrationHeader({
@@ -758,84 +758,84 @@ start_ui <描述> --requirements_mode=loop
758
758
  const inferredStack = framework; // 保持用户指定的技术栈,或默认为 react
759
759
  // 5. 生成智能执行计划
760
760
  const searchQuery = description || templateName;
761
- const smartPlanGuided = `# 🚀 智能 UI 开发计划
762
-
763
- 基于您的描述 "**${description}**",AI 引擎已为您规划了最佳开发路径。
764
-
765
- ## 🧠 智能分析结果
766
-
767
- - **产品类型**: ${inferredProductType}
768
- - **推荐风格**: ${recommendation.style.primary}
769
- - **关键特性**: ${inferredKeywords}
770
- - **技术栈**: ${inferredStack}
771
-
772
- ---
773
-
774
- ## 📋 执行步骤(已自动优化参数)
775
-
776
- 请按顺序执行以下命令:
777
-
778
- ### 1. 生成项目上下文 📋
779
- \`\`\`bash
780
- init_project_context
781
- \`\`\`
782
-
783
- ### 2. 生成设计系统 🎨
784
- \`\`\`bash
785
- ui_design_system --product_type="${inferredProductType}" --stack="${inferredStack}" --keywords="${inferredKeywords}" --description="${description}"
786
- \`\`\`
787
-
788
- ### 3. 生成组件目录 📦
789
- \`\`\`bash
790
- init_component_catalog
791
- \`\`\`
792
-
793
- ### 4. 生成 UI 模板 📄
794
- \`\`\`bash
795
- # 搜索现有模板或生成新模板
796
- ui_search --mode=template --query="${searchQuery}"
797
- \`\`\`
798
-
799
- ### 5. 保存模板文件 🧩
800
- \`\`\`bash
801
- # 将选中的模板保存到本地
802
- # 目标路径:docs/ui/${templateName}.json
803
- \`\`\`
804
-
805
- ### 6. 渲染代码 💻
806
- \`\`\`bash
807
- render_ui docs/ui/${templateName}.json --framework="${inferredStack}"
808
- \`\`\`
809
-
810
- ### 7. 更新项目上下文 📝
811
- 将生成的 UI 文档链接添加到 \`docs/project-context.md\` 的文档导航部分。
812
-
813
- ---
814
-
815
- ## 💡 为什么选择这个方案?
816
-
817
- ${recommendation.reasoning}
761
+ const smartPlanGuided = `# 🚀 智能 UI 开发计划
762
+
763
+ 基于您的描述 "**${description}**",AI 引擎已为您规划了最佳开发路径。
764
+
765
+ ## 🧠 智能分析结果
766
+
767
+ - **产品类型**: ${inferredProductType}
768
+ - **推荐风格**: ${recommendation.style.primary}
769
+ - **关键特性**: ${inferredKeywords}
770
+ - **技术栈**: ${inferredStack}
771
+
772
+ ---
773
+
774
+ ## 📋 执行步骤(已自动优化参数)
775
+
776
+ 请按顺序执行以下命令:
777
+
778
+ ### 1. 生成项目上下文 📋
779
+ \`\`\`bash
780
+ init_project_context
781
+ \`\`\`
782
+
783
+ ### 2. 生成设计系统 🎨
784
+ \`\`\`bash
785
+ ui_design_system --product_type="${inferredProductType}" --stack="${inferredStack}" --keywords="${inferredKeywords}" --description="${description}"
786
+ \`\`\`
787
+
788
+ ### 3. 生成组件目录 📦
789
+ \`\`\`bash
790
+ init_component_catalog
791
+ \`\`\`
792
+
793
+ ### 4. 生成 UI 模板 📄
794
+ \`\`\`bash
795
+ # 搜索现有模板或生成新模板
796
+ ui_search --mode=template --query="${searchQuery}"
797
+ \`\`\`
798
+
799
+ ### 5. 保存模板文件 🧩
800
+ \`\`\`bash
801
+ # 将选中的模板保存到本地
802
+ # 目标路径:docs/ui/${templateName}.json
803
+ \`\`\`
804
+
805
+ ### 6. 渲染代码 💻
806
+ \`\`\`bash
807
+ render_ui docs/ui/${templateName}.json --framework="${inferredStack}"
808
+ \`\`\`
809
+
810
+ ### 7. 更新项目上下文 📝
811
+ 将生成的 UI 文档链接添加到 \`docs/project-context.md\` 的文档导航部分。
812
+
813
+ ---
814
+
815
+ ## 💡 为什么选择这个方案?
816
+
817
+ ${recommendation.reasoning}
818
818
  `;
819
- const smartPlanStrict = `# 🚀 智能 UI 开发计划(严格)
820
-
821
- ## 🧠 智能分析结果
822
-
823
- - **产品类型**: ${inferredProductType}
824
- - **推荐风格**: ${recommendation.style.primary}
825
- - **关键特性**: ${inferredKeywords}
826
- - **技术栈**: ${inferredStack}
827
-
828
- ---
829
-
830
- ## 📋 执行步骤
831
-
832
- 1) init_project_context
833
- 2) ui_design_system --product_type="${inferredProductType}" --stack="${inferredStack}" --keywords="${inferredKeywords}" --description="${description}"
834
- 3) init_component_catalog
835
- 4) ui_search --mode=template --query="${searchQuery}"
836
- 5) 保存模板到 docs/ui/${templateName}.json
837
- 6) render_ui docs/ui/${templateName}.json --framework="${inferredStack}"
838
- 7) 更新 project-context.md 索引
819
+ const smartPlanStrict = `# 🚀 智能 UI 开发计划(严格)
820
+
821
+ ## 🧠 智能分析结果
822
+
823
+ - **产品类型**: ${inferredProductType}
824
+ - **推荐风格**: ${recommendation.style.primary}
825
+ - **关键特性**: ${inferredKeywords}
826
+ - **技术栈**: ${inferredStack}
827
+
828
+ ---
829
+
830
+ ## 📋 执行步骤
831
+
832
+ 1) init_project_context
833
+ 2) ui_design_system --product_type="${inferredProductType}" --stack="${inferredStack}" --keywords="${inferredKeywords}" --description="${description}"
834
+ 3) init_component_catalog
835
+ 4) ui_search --mode=template --query="${searchQuery}"
836
+ 5) 保存模板到 docs/ui/${templateName}.json
837
+ 6) render_ui docs/ui/${templateName}.json --framework="${inferredStack}"
838
+ 7) 更新 project-context.md 索引
839
839
  `;
840
840
  const plan = {
841
841
  mode: 'delegated',
@@ -894,7 +894,7 @@ ${recommendation.reasoning}
894
894
  action: 'update_project_context',
895
895
  outputs: ['docs/project-context.md'],
896
896
  },
897
- ...(memoryContext.enabled ? [buildMemoryPlanStep()] : []),
897
+ ...(memoryContext.enabled ? [buildMemoryPlanStep('ui')] : []),
898
898
  ],
899
899
  };
900
900
  const header = renderOrchestrationHeader({
@@ -992,23 +992,23 @@ ${recommendation.reasoning}
992
992
  content: [
993
993
  {
994
994
  type: "text",
995
- text: `❌ 缺少必要参数
996
-
997
- **用法**:
998
- \`\`\`
999
- start_ui <描述> [--framework=react|vue|html]
1000
- \`\`\`
1001
-
1002
- **示例**:
1003
- \`\`\`
1004
- start_ui "登录页面"
1005
- start_ui "用户列表" --framework=vue
1006
- start_ui "设置页面" --framework=react
1007
- \`\`\`
1008
-
1009
- **提示**:
1010
- - 确保已运行 \`ui_design_system\` 生成设计系统
1011
- - 组件目录会自动生成(如果不存在)
995
+ text: `❌ 缺少必要参数
996
+
997
+ **用法**:
998
+ \`\`\`
999
+ start_ui <描述> [--framework=react|vue|html]
1000
+ \`\`\`
1001
+
1002
+ **示例**:
1003
+ \`\`\`
1004
+ start_ui "登录页面"
1005
+ start_ui "用户列表" --framework=vue
1006
+ start_ui "设置页面" --framework=react
1007
+ \`\`\`
1008
+
1009
+ **提示**:
1010
+ - 确保已运行 \`ui_design_system\` 生成设计系统
1011
+ - 组件目录会自动生成(如果不存在)
1012
1012
  `,
1013
1013
  },
1014
1014
  ],
@@ -1105,7 +1105,7 @@ start_ui "设置页面" --framework=react
1105
1105
  action: 'update_project_context',
1106
1106
  outputs: ['docs/project-context.md'],
1107
1107
  },
1108
- ...(memoryContext.enabled ? [buildMemoryPlanStep()] : []),
1108
+ ...(memoryContext.enabled ? [buildMemoryPlanStep('ui')] : []),
1109
1109
  ],
1110
1110
  };
1111
1111
  // Create structured UI report for manual mode