mcp-probe-kit 3.2.0 → 3.3.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 +10 -0
- package/build/lib/__tests__/memory-orchestration.unit.test.js +88 -0
- package/build/lib/__tests__/memory-payload.unit.test.js +35 -0
- package/build/lib/__tests__/quality-constraints.unit.test.d.ts +1 -0
- package/build/lib/__tests__/quality-constraints.unit.test.js +54 -0
- package/build/lib/__tests__/spec-validator.unit.test.js +106 -74
- package/build/lib/agents-md-template.js +32 -32
- package/build/lib/cursor-history-client.d.ts +54 -0
- package/build/lib/cursor-history-client.js +240 -0
- package/build/lib/quality-constraints.d.ts +54 -0
- package/build/lib/quality-constraints.js +155 -0
- package/build/lib/skill-bridge.js +12 -12
- package/build/lib/spec-validator.js +16 -3
- package/build/lib/template-loader.js +83 -23
- 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/tools/__tests__/cursor-history.unit.test.d.ts +1 -0
- package/build/tools/__tests__/cursor-history.unit.test.js +38 -0
- package/build/tools/check_spec.js +16 -16
- package/build/tools/code_insight.js +41 -41
- package/build/tools/code_review.js +11 -4
- package/build/tools/cursor_read_conversation.d.ts +7 -0
- package/build/tools/cursor_read_conversation.js +36 -0
- package/build/tools/fix_bug.js +161 -161
- package/build/tools/gencommit.js +60 -60
- package/build/tools/init_project_context.js +432 -432
- package/build/tools/start_product.js +1 -1
- package/build/tools/start_ui.js +17 -0
- package/build/tools/ui-ux-tools.d.ts +3 -0
- package/build/tools/ui-ux-tools.js +302 -290
- package/build/utils/__tests__/vercel-guidelines-sync.unit.test.js +12 -12
- package/build/utils/design-reasoning-engine.d.ts +2 -0
- package/build/utils/design-reasoning-engine.js +3 -0
- package/build/utils/themes-sync.js +8 -8
- package/package.json +3 -2
- package/build/resources/index.d.ts +0 -4
- package/build/resources/index.js +0 -4
- package/build/resources/tool-params-guide.d.ts +0 -571
- package/build/resources/tool-params-guide.js +0 -488
- package/build/tools/analyze_project.d.ts +0 -1
- package/build/tools/analyze_project.js +0 -527
- package/build/tools/check_deps.d.ts +0 -13
- package/build/tools/check_deps.js +0 -204
- package/build/tools/convert.d.ts +0 -13
- package/build/tools/convert.js +0 -599
- package/build/tools/css_order.d.ts +0 -13
- package/build/tools/css_order.js +0 -81
- package/build/tools/debug.d.ts +0 -13
- package/build/tools/debug.js +0 -131
- package/build/tools/design2code.d.ts +0 -20
- package/build/tools/design2code.js +0 -426
- package/build/tools/detect_shell.d.ts +0 -6
- package/build/tools/detect_shell.js +0 -151
- package/build/tools/explain.d.ts +0 -13
- package/build/tools/explain.js +0 -390
- package/build/tools/fix.d.ts +0 -13
- package/build/tools/fix.js +0 -303
- package/build/tools/gen_mock.d.ts +0 -22
- package/build/tools/gen_mock.js +0 -269
- package/build/tools/gen_skill.d.ts +0 -13
- package/build/tools/gen_skill.js +0 -560
- package/build/tools/genapi.d.ts +0 -13
- package/build/tools/genapi.js +0 -174
- package/build/tools/genchangelog.d.ts +0 -13
- package/build/tools/genchangelog.js +0 -250
- package/build/tools/gendoc.d.ts +0 -13
- package/build/tools/gendoc.js +0 -232
- package/build/tools/genpr.d.ts +0 -13
- package/build/tools/genpr.js +0 -194
- package/build/tools/genreadme.d.ts +0 -13
- package/build/tools/genreadme.js +0 -626
- package/build/tools/gensql.d.ts +0 -13
- package/build/tools/gensql.js +0 -320
- package/build/tools/genui.d.ts +0 -13
- package/build/tools/genui.js +0 -803
- package/build/tools/init_component_catalog.d.ts +0 -22
- package/build/tools/init_component_catalog.js +0 -809
- package/build/tools/init_setting.d.ts +0 -13
- package/build/tools/init_setting.js +0 -47
- package/build/tools/perf.d.ts +0 -13
- package/build/tools/perf.js +0 -409
- package/build/tools/render_ui.d.ts +0 -22
- package/build/tools/render_ui.js +0 -384
- package/build/tools/resolve_conflict.d.ts +0 -13
- package/build/tools/resolve_conflict.js +0 -349
- package/build/tools/security_scan.d.ts +0 -22
- package/build/tools/security_scan.js +0 -323
- package/build/tools/split.d.ts +0 -13
- package/build/tools/split.js +0 -599
- package/build/tools/start_api.d.ts +0 -13
- package/build/tools/start_api.js +0 -193
- package/build/tools/start_doc.d.ts +0 -13
- package/build/tools/start_doc.js +0 -207
- package/build/tools/start_refactor.d.ts +0 -13
- package/build/tools/start_refactor.js +0 -188
- package/build/tools/start_release.d.ts +0 -13
- package/build/tools/start_release.js +0 -167
- package/build/tools/start_review.d.ts +0 -13
- package/build/tools/start_review.js +0 -175
- /package/build/{utils/design-docs-generator.d.ts → lib/__tests__/memory-orchestration.unit.test.d.ts} +0 -0
- /package/build/{utils/design-docs-generator.js → lib/__tests__/memory-payload.unit.test.d.ts} +0 -0
|
@@ -10,6 +10,7 @@ import { ASCIIBoxFormatter } from '../utils/ascii-box-formatter.js';
|
|
|
10
10
|
import { syncUIDataToCache, checkUISourcesUpdate } from '../utils/ui-sync.js';
|
|
11
11
|
import { formatShadcnResult, formatGuidelineResult, formatThemeResult, isGuidelineCategory, isShadcnCategory, isShadcnStack, isThemeCategory, pickThemeForProductType } from '../lib/shadcn-ui.js';
|
|
12
12
|
import { formatDesignSystemJson } from '../utils/design-system-json-formatter.js';
|
|
13
|
+
import { renderUiHardRules, renderUiBannedList, renderPreFlightChecklist } from '../lib/quality-constraints.js';
|
|
13
14
|
import { okStructured } from '../lib/response.js';
|
|
14
15
|
import { reportToolProgress, throwIfAborted, } from '../lib/tool-execution-context.js';
|
|
15
16
|
// 全局数据加载器实例
|
|
@@ -185,6 +186,9 @@ export function generateCreationGuidance(productType, stack) {
|
|
|
185
186
|
layout,
|
|
186
187
|
config,
|
|
187
188
|
tips,
|
|
189
|
+
hardRules: renderUiHardRules(),
|
|
190
|
+
banned: renderUiBannedList(),
|
|
191
|
+
preFlight: renderPreFlightChecklist(),
|
|
188
192
|
};
|
|
189
193
|
}
|
|
190
194
|
/**
|
|
@@ -264,24 +268,24 @@ export async function uiDesignSystem(args) {
|
|
|
264
268
|
? pickThemeForProductType(loader.getSearchEngine().getCategoryData('ui-themes') || [], request.productType)
|
|
265
269
|
: undefined;
|
|
266
270
|
const themeSection = themeRecommendation
|
|
267
|
-
? `
|
|
268
|
-
## 🎨 推荐 shadcn 主题(内嵌预设)
|
|
269
|
-
|
|
270
|
-
- **主题**: ${themeRecommendation.title} (\`${themeRecommendation.name}\`)
|
|
271
|
-
- **说明**: ${themeRecommendation.description}
|
|
272
|
-
- **操作**: 将下方 CSS variables 写入 \`app/globals.css\`;也可用 \`ui_search --category=ui-themes --query="${request.productType}"\`
|
|
273
|
-
|
|
274
|
-
\`\`\`css
|
|
275
|
-
${themeRecommendation.globalsCssSnippet}
|
|
276
|
-
\`\`\`
|
|
271
|
+
? `
|
|
272
|
+
## 🎨 推荐 shadcn 主题(内嵌预设)
|
|
273
|
+
|
|
274
|
+
- **主题**: ${themeRecommendation.title} (\`${themeRecommendation.name}\`)
|
|
275
|
+
- **说明**: ${themeRecommendation.description}
|
|
276
|
+
- **操作**: 将下方 CSS variables 写入 \`app/globals.css\`;也可用 \`ui_search --category=ui-themes --query="${request.productType}"\`
|
|
277
|
+
|
|
278
|
+
\`\`\`css
|
|
279
|
+
${themeRecommendation.globalsCssSnippet}
|
|
280
|
+
\`\`\`
|
|
277
281
|
`
|
|
278
282
|
: '';
|
|
279
283
|
const vercelSection = isShadcnStack(request.stack)
|
|
280
|
-
? `
|
|
281
|
-
## ✅ Vercel 界面规范(实现时对照)
|
|
282
|
-
|
|
283
|
-
- 检索: \`ui_search --category=ui-guidelines-vercel --query="form accessibility animation"\`
|
|
284
|
-
- 重点: 表单可访问性、\`prefers-reduced-motion\`、对比度、键盘焦点、禁止 \`transition: all\`
|
|
284
|
+
? `
|
|
285
|
+
## ✅ Vercel 界面规范(实现时对照)
|
|
286
|
+
|
|
287
|
+
- 检索: \`ui_search --category=ui-guidelines-vercel --query="form accessibility animation"\`
|
|
288
|
+
- 重点: 表单可访问性、\`prefers-reduced-motion\`、对比度、键盘焦点、禁止 \`transition: all\`
|
|
285
289
|
`
|
|
286
290
|
: '';
|
|
287
291
|
// 构建输出对象
|
|
@@ -297,126 +301,134 @@ ${themeRecommendation.globalsCssSnippet}
|
|
|
297
301
|
.map(file => `${file.order}. **${file.path}** ${file.required ? '(必需)' : '(可选)'}\n ${file.purpose}`)
|
|
298
302
|
.join('\n\n');
|
|
299
303
|
// 格式化创作指导
|
|
300
|
-
const guidanceText = `
|
|
301
|
-
### 设计原则文档主题
|
|
302
|
-
${creationGuidance.principles.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
|
|
303
|
-
|
|
304
|
-
### 交互规范文档主题
|
|
305
|
-
${creationGuidance.interaction.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
|
|
306
|
-
|
|
307
|
-
### 布局规范文档主题
|
|
308
|
-
${creationGuidance.layout.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
|
|
309
|
-
|
|
310
|
-
### 技术配置文档主题
|
|
311
|
-
${creationGuidance.config.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
|
|
312
|
-
|
|
313
|
-
### 创作提示
|
|
314
|
-
${creationGuidance.tips.map((tip, i) => `${i + 1}. ${tip}`).join('\n')}
|
|
304
|
+
const guidanceText = `
|
|
305
|
+
### 设计原则文档主题
|
|
306
|
+
${creationGuidance.principles.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
|
|
307
|
+
|
|
308
|
+
### 交互规范文档主题
|
|
309
|
+
${creationGuidance.interaction.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
|
|
310
|
+
|
|
311
|
+
### 布局规范文档主题
|
|
312
|
+
${creationGuidance.layout.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
|
|
313
|
+
|
|
314
|
+
### 技术配置文档主题
|
|
315
|
+
${creationGuidance.config.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
|
|
316
|
+
|
|
317
|
+
### 创作提示
|
|
318
|
+
${creationGuidance.tips.map((tip, i) => `${i + 1}. ${tip}`).join('\n')}
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
${creationGuidance.hardRules}
|
|
323
|
+
|
|
324
|
+
${creationGuidance.banned}
|
|
325
|
+
|
|
326
|
+
${creationGuidance.preFlight}
|
|
315
327
|
`;
|
|
316
|
-
const message = `# ✅ 设计系统推荐已生成
|
|
317
|
-
|
|
318
|
-
**产品类型**: ${request.productType}
|
|
319
|
-
**技术栈**: ${request.stack || 'html'}
|
|
320
|
-
${request.targetAudience ? `**目标用户**: ${request.targetAudience}` : ''}
|
|
321
|
-
|
|
322
|
-
---
|
|
323
|
-
|
|
324
|
-
## 🎨 1. 核心设计推荐(ASCII Box)
|
|
325
|
-
|
|
326
|
-
以下是基于 AI 推理引擎生成的核心设计推荐:
|
|
327
|
-
|
|
328
|
-
\`\`\`
|
|
329
|
-
${asciiBox}
|
|
330
|
-
\`\`\`
|
|
331
|
-
|
|
332
|
-
---
|
|
333
|
-
|
|
334
|
-
## 📊 2. 精确配置数据(JSON)
|
|
335
|
-
|
|
336
|
-
以下是机器可读的设计系统配置,包含所有精确数值:
|
|
337
|
-
|
|
338
|
-
\`\`\`json
|
|
339
|
-
${JSON.stringify(designSystemJson, null, 2)}
|
|
340
|
-
\`\`\`
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
## 📁 3. 文件索引(按创建顺序)
|
|
345
|
-
|
|
346
|
-
请严格按照以下顺序创建文件:
|
|
347
|
-
|
|
348
|
-
${fileIndexList}
|
|
349
|
-
|
|
350
|
-
**注意**: design-system.md 是最后创建的主文档,它应该包含完整的设计系统概览和 ASCII Box 推荐。
|
|
351
|
-
|
|
352
|
-
---
|
|
353
|
-
|
|
354
|
-
## 📝 4. 文档创作指导
|
|
355
|
-
|
|
356
|
-
以下是各类文档应包含的关键主题。**请根据上述 ASCII Box 推荐和 JSON 数据自由创作内容,不要使用固定模板**:
|
|
357
|
-
|
|
358
|
-
${guidanceText}
|
|
359
|
-
${themeSection}
|
|
360
|
-
${vercelSection}
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
## ✨ 请根据以上推荐和指导创建文档
|
|
365
|
-
|
|
366
|
-
**现在,请按照文件索引的顺序,逐个创建设计系统文档。**
|
|
367
|
-
|
|
368
|
-
### 创作要求:
|
|
369
|
-
|
|
370
|
-
1. **使用核心数据**:
|
|
371
|
-
- 将 ASCII Box 中的核心推荐作为设计依据
|
|
372
|
-
- 使用 JSON 数据中的精确数值(颜色代码、字体大小、间距值等)
|
|
373
|
-
- 确保所有数值与 JSON 配置保持一致
|
|
374
|
-
|
|
375
|
-
2. **遵循文件顺序**:
|
|
376
|
-
- 严格按照文件索引的顺序创建(1→2→3→4→5→6→7)
|
|
377
|
-
- design-system.json 最先创建(包含所有精确配置)
|
|
378
|
-
- design-system.md 最后创建(包含完整概览)
|
|
379
|
-
|
|
380
|
-
3. **自由创作内容**:
|
|
381
|
-
- 参考创作指导中的主题列表
|
|
382
|
-
- 根据产品类型 "${request.productType}" 调整重点
|
|
383
|
-
${request.stack ? `- 提供 ${request.stack} 的具体实现示例` : ''}
|
|
384
|
-
- 不要局限于固定模板,发挥创造力
|
|
385
|
-
|
|
386
|
-
4. **保持一致性**:
|
|
387
|
-
- 所有文档使用相同的设计 Token(颜色、字体、间距)
|
|
388
|
-
- 确保术语和命名规范统一
|
|
389
|
-
- 交叉引用其他文档时保持准确
|
|
390
|
-
|
|
391
|
-
5. **提供实用示例**:
|
|
392
|
-
- 包含具体的代码示例(不要抽象描述)
|
|
393
|
-
- 展示实际应用场景
|
|
394
|
-
- 参考反模式(antiPatterns)提供"应避免"的建议
|
|
395
|
-
${isShadcnStack(request.stack) ? `
|
|
396
|
-
6. **shadcn/ui 实现路径**(${request.stack}):
|
|
397
|
-
- 用 \`ui_search --category=ui-themes\` 确认主题;上文的 globals.css 片段可直接使用
|
|
398
|
-
- 用 \`ui_search --category=shadcn-blocks --query="..."\` 找 block,再 \`npx shadcn@latest add <name>\`
|
|
399
|
-
- 用 \`ui_search --category=ui-guidelines-vercel\` 对照 Vercel 规范
|
|
400
|
-
- 在 block 基础上改文案/数据,不要从零写 Card/Button
|
|
401
|
-
` : ''}
|
|
402
|
-
|
|
403
|
-
### 开始创作:
|
|
404
|
-
|
|
405
|
-
**第一步**:创建 \`docs/design-system.json\`,包含所有精确配置数据(使用上面的 JSON)
|
|
406
|
-
|
|
407
|
-
**第二步**:创建 \`docs/design-guidelines/README.md\`,提供设计指南的索引和导航
|
|
408
|
-
|
|
409
|
-
**第三步至第六步**:依次创建四个设计指南文档(principles、interaction、layout、config)
|
|
410
|
-
|
|
411
|
-
**最后一步**:创建 \`docs/design-system.md\`,包含以下内容:
|
|
412
|
-
- ASCII Box 推荐(核心设计)
|
|
413
|
-
- 完整的设计系统概览
|
|
414
|
-
- **文件索引**(列出所有设计文档的链接,方便后续查看和使用)
|
|
415
|
-
- 快速开始指南
|
|
416
|
-
|
|
417
|
-
---
|
|
418
|
-
|
|
419
|
-
🚀 **准备好了吗?让我们开始创建第一个文件吧!**
|
|
328
|
+
const message = `# ✅ 设计系统推荐已生成
|
|
329
|
+
|
|
330
|
+
**产品类型**: ${request.productType}
|
|
331
|
+
**技术栈**: ${request.stack || 'html'}
|
|
332
|
+
${request.targetAudience ? `**目标用户**: ${request.targetAudience}` : ''}
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## 🎨 1. 核心设计推荐(ASCII Box)
|
|
337
|
+
|
|
338
|
+
以下是基于 AI 推理引擎生成的核心设计推荐:
|
|
339
|
+
|
|
340
|
+
\`\`\`
|
|
341
|
+
${asciiBox}
|
|
342
|
+
\`\`\`
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## 📊 2. 精确配置数据(JSON)
|
|
347
|
+
|
|
348
|
+
以下是机器可读的设计系统配置,包含所有精确数值:
|
|
349
|
+
|
|
350
|
+
\`\`\`json
|
|
351
|
+
${JSON.stringify(designSystemJson, null, 2)}
|
|
352
|
+
\`\`\`
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## 📁 3. 文件索引(按创建顺序)
|
|
357
|
+
|
|
358
|
+
请严格按照以下顺序创建文件:
|
|
359
|
+
|
|
360
|
+
${fileIndexList}
|
|
361
|
+
|
|
362
|
+
**注意**: design-system.md 是最后创建的主文档,它应该包含完整的设计系统概览和 ASCII Box 推荐。
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## 📝 4. 文档创作指导
|
|
367
|
+
|
|
368
|
+
以下是各类文档应包含的关键主题。**请根据上述 ASCII Box 推荐和 JSON 数据自由创作内容,不要使用固定模板**:
|
|
369
|
+
|
|
370
|
+
${guidanceText}
|
|
371
|
+
${themeSection}
|
|
372
|
+
${vercelSection}
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## ✨ 请根据以上推荐和指导创建文档
|
|
377
|
+
|
|
378
|
+
**现在,请按照文件索引的顺序,逐个创建设计系统文档。**
|
|
379
|
+
|
|
380
|
+
### 创作要求:
|
|
381
|
+
|
|
382
|
+
1. **使用核心数据**:
|
|
383
|
+
- 将 ASCII Box 中的核心推荐作为设计依据
|
|
384
|
+
- 使用 JSON 数据中的精确数值(颜色代码、字体大小、间距值等)
|
|
385
|
+
- 确保所有数值与 JSON 配置保持一致
|
|
386
|
+
|
|
387
|
+
2. **遵循文件顺序**:
|
|
388
|
+
- 严格按照文件索引的顺序创建(1→2→3→4→5→6→7)
|
|
389
|
+
- design-system.json 最先创建(包含所有精确配置)
|
|
390
|
+
- design-system.md 最后创建(包含完整概览)
|
|
391
|
+
|
|
392
|
+
3. **自由创作内容**:
|
|
393
|
+
- 参考创作指导中的主题列表
|
|
394
|
+
- 根据产品类型 "${request.productType}" 调整重点
|
|
395
|
+
${request.stack ? `- 提供 ${request.stack} 的具体实现示例` : ''}
|
|
396
|
+
- 不要局限于固定模板,发挥创造力
|
|
397
|
+
|
|
398
|
+
4. **保持一致性**:
|
|
399
|
+
- 所有文档使用相同的设计 Token(颜色、字体、间距)
|
|
400
|
+
- 确保术语和命名规范统一
|
|
401
|
+
- 交叉引用其他文档时保持准确
|
|
402
|
+
|
|
403
|
+
5. **提供实用示例**:
|
|
404
|
+
- 包含具体的代码示例(不要抽象描述)
|
|
405
|
+
- 展示实际应用场景
|
|
406
|
+
- 参考反模式(antiPatterns)提供"应避免"的建议
|
|
407
|
+
${isShadcnStack(request.stack) ? `
|
|
408
|
+
6. **shadcn/ui 实现路径**(${request.stack}):
|
|
409
|
+
- 用 \`ui_search --category=ui-themes\` 确认主题;上文的 globals.css 片段可直接使用
|
|
410
|
+
- 用 \`ui_search --category=shadcn-blocks --query="..."\` 找 block,再 \`npx shadcn@latest add <name>\`
|
|
411
|
+
- 用 \`ui_search --category=ui-guidelines-vercel\` 对照 Vercel 规范
|
|
412
|
+
- 在 block 基础上改文案/数据,不要从零写 Card/Button
|
|
413
|
+
` : ''}
|
|
414
|
+
|
|
415
|
+
### 开始创作:
|
|
416
|
+
|
|
417
|
+
**第一步**:创建 \`docs/design-system.json\`,包含所有精确配置数据(使用上面的 JSON)
|
|
418
|
+
|
|
419
|
+
**第二步**:创建 \`docs/design-guidelines/README.md\`,提供设计指南的索引和导航
|
|
420
|
+
|
|
421
|
+
**第三步至第六步**:依次创建四个设计指南文档(principles、interaction、layout、config)
|
|
422
|
+
|
|
423
|
+
**最后一步**:创建 \`docs/design-system.md\`,包含以下内容:
|
|
424
|
+
- ASCII Box 推荐(核心设计)
|
|
425
|
+
- 完整的设计系统概览
|
|
426
|
+
- **文件索引**(列出所有设计文档的链接,方便后续查看和使用)
|
|
427
|
+
- 快速开始指南
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
🚀 **准备好了吗?让我们开始创建第一个文件吧!**
|
|
420
432
|
`;
|
|
421
433
|
// 构建结构化数据对象
|
|
422
434
|
const structuredData = {
|
|
@@ -452,17 +464,17 @@ ${isShadcnStack(request.stack) ? `
|
|
|
452
464
|
colors: {},
|
|
453
465
|
typography: {},
|
|
454
466
|
};
|
|
455
|
-
return okStructured(`❌ 设计系统生成失败: ${errorMessage}
|
|
456
|
-
|
|
457
|
-
**可能的原因**:
|
|
458
|
-
1. 数据未加载完成
|
|
459
|
-
2. 产品类型不明确
|
|
460
|
-
3. 数据格式错误
|
|
461
|
-
|
|
462
|
-
**建议**:
|
|
463
|
-
1. 提供更具体的产品类型(如 "SaaS", "E-commerce", "Healthcare")
|
|
464
|
-
2. 添加产品描述帮助推理引擎理解需求
|
|
465
|
-
3. 检查数据是否已同步(使用 \`sync_ui_data\` 工具)
|
|
467
|
+
return okStructured(`❌ 设计系统生成失败: ${errorMessage}
|
|
468
|
+
|
|
469
|
+
**可能的原因**:
|
|
470
|
+
1. 数据未加载完成
|
|
471
|
+
2. 产品类型不明确
|
|
472
|
+
3. 数据格式错误
|
|
473
|
+
|
|
474
|
+
**建议**:
|
|
475
|
+
1. 提供更具体的产品类型(如 "SaaS", "E-commerce", "Healthcare")
|
|
476
|
+
2. 添加产品描述帮助推理引擎理解需求
|
|
477
|
+
3. 检查数据是否已同步(使用 \`sync_ui_data\` 工具)
|
|
466
478
|
`, errorData, {
|
|
467
479
|
schema: (await import('../schemas/output/ui-ux-tools.js')).DesignSystemSchema,
|
|
468
480
|
});
|
|
@@ -486,22 +498,22 @@ export async function uiSearch(args) {
|
|
|
486
498
|
// 格式化组件列表
|
|
487
499
|
const components = catalog.components || [];
|
|
488
500
|
const componentList = components.map((comp, index) => {
|
|
489
|
-
return `### ${index + 1}. ${comp.name}
|
|
490
|
-
|
|
491
|
-
**描述**: ${comp.description || '无'}
|
|
492
|
-
**Props**: ${Object.keys(comp.props || {}).join(', ')}
|
|
493
|
-
**样式**: ${comp.styles ? Object.keys(comp.styles).join(', ') : '无'}
|
|
501
|
+
return `### ${index + 1}. ${comp.name}
|
|
502
|
+
|
|
503
|
+
**描述**: ${comp.description || '无'}
|
|
504
|
+
**Props**: ${Object.keys(comp.props || {}).join(', ')}
|
|
505
|
+
**样式**: ${comp.styles ? Object.keys(comp.styles).join(', ') : '无'}
|
|
494
506
|
`;
|
|
495
507
|
}).join('\n---\n\n');
|
|
496
|
-
const message = `# 📦 组件目录
|
|
497
|
-
|
|
498
|
-
共 ${components.length} 个可用组件
|
|
499
|
-
|
|
500
|
-
---
|
|
501
|
-
|
|
502
|
-
${componentList}
|
|
503
|
-
|
|
504
|
-
**提示**: 这些组件可以在 UI 模板中使用
|
|
508
|
+
const message = `# 📦 组件目录
|
|
509
|
+
|
|
510
|
+
共 ${components.length} 个可用组件
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
${componentList}
|
|
515
|
+
|
|
516
|
+
**提示**: 这些组件可以在 UI 模板中使用
|
|
505
517
|
`;
|
|
506
518
|
const structuredData = {
|
|
507
519
|
summary: `组件目录 - ${components.length} 个组件`,
|
|
@@ -526,9 +538,9 @@ ${componentList}
|
|
|
526
538
|
results: [],
|
|
527
539
|
totalResults: 0,
|
|
528
540
|
};
|
|
529
|
-
return okStructured(`❌ 未找到组件目录文件
|
|
530
|
-
|
|
531
|
-
请先运行 \`init_component_catalog\` 生成组件目录。
|
|
541
|
+
return okStructured(`❌ 未找到组件目录文件
|
|
542
|
+
|
|
543
|
+
请先运行 \`init_component_catalog\` 生成组件目录。
|
|
532
544
|
`, errorData, {
|
|
533
545
|
schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
|
|
534
546
|
});
|
|
@@ -553,18 +565,18 @@ ${componentList}
|
|
|
553
565
|
results: [],
|
|
554
566
|
totalResults: 0,
|
|
555
567
|
};
|
|
556
|
-
return okStructured(`📭 暂无可用模板
|
|
557
|
-
|
|
558
|
-
**建议**:
|
|
559
|
-
1. 使用 \`start_ui\` 生成新模板
|
|
560
|
-
2. 模板会自动保存到 \`docs/ui/pages/\` 目录
|
|
561
|
-
3. 下次可以直接搜索使用
|
|
562
|
-
|
|
563
|
-
**示例**:
|
|
564
|
-
\`\`\`
|
|
565
|
-
start_ui "登录页面"
|
|
566
|
-
start_ui "用户列表"
|
|
567
|
-
\`\`\`
|
|
568
|
+
return okStructured(`📭 暂无可用模板
|
|
569
|
+
|
|
570
|
+
**建议**:
|
|
571
|
+
1. 使用 \`start_ui\` 生成新模板
|
|
572
|
+
2. 模板会自动保存到 \`docs/ui/pages/\` 目录
|
|
573
|
+
3. 下次可以直接搜索使用
|
|
574
|
+
|
|
575
|
+
**示例**:
|
|
576
|
+
\`\`\`
|
|
577
|
+
start_ui "登录页面"
|
|
578
|
+
start_ui "用户列表"
|
|
579
|
+
\`\`\`
|
|
568
580
|
`, emptyData, {
|
|
569
581
|
schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
|
|
570
582
|
});
|
|
@@ -601,41 +613,41 @@ start_ui "用户列表"
|
|
|
601
613
|
})),
|
|
602
614
|
totalResults: 0,
|
|
603
615
|
};
|
|
604
|
-
return okStructured(`未找到匹配的模板
|
|
605
|
-
|
|
606
|
-
**查询**: ${query}
|
|
607
|
-
**可用模板**: ${templates.map(t => t.name).join(', ')}
|
|
608
|
-
|
|
609
|
-
**建议**: 使用 \`start_ui "${query}"\` 生成新模板
|
|
616
|
+
return okStructured(`未找到匹配的模板
|
|
617
|
+
|
|
618
|
+
**查询**: ${query}
|
|
619
|
+
**可用模板**: ${templates.map(t => t.name).join(', ')}
|
|
620
|
+
|
|
621
|
+
**建议**: 使用 \`start_ui "${query}"\` 生成新模板
|
|
610
622
|
`, noMatchData, {
|
|
611
623
|
schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
|
|
612
624
|
});
|
|
613
625
|
}
|
|
614
626
|
// 格式化模板列表
|
|
615
627
|
const templateList = filteredTemplates.map((t, index) => {
|
|
616
|
-
return `### ${index + 1}. ${t.name}
|
|
617
|
-
|
|
618
|
-
**文件**: \`docs/ui/pages/${t.file}\`
|
|
619
|
-
**描述**: ${t.description}
|
|
620
|
-
**组件数**: ${JSON.stringify(t.template).match(/"type":/g)?.length || 0}
|
|
621
|
-
|
|
622
|
-
\`\`\`json
|
|
623
|
-
${JSON.stringify(t.template, null, 2)}
|
|
624
|
-
\`\`\`
|
|
628
|
+
return `### ${index + 1}. ${t.name}
|
|
629
|
+
|
|
630
|
+
**文件**: \`docs/ui/pages/${t.file}\`
|
|
631
|
+
**描述**: ${t.description}
|
|
632
|
+
**组件数**: ${JSON.stringify(t.template).match(/"type":/g)?.length || 0}
|
|
633
|
+
|
|
634
|
+
\`\`\`json
|
|
635
|
+
${JSON.stringify(t.template, null, 2)}
|
|
636
|
+
\`\`\`
|
|
625
637
|
`;
|
|
626
638
|
}).join('\n---\n\n');
|
|
627
|
-
const message = `# 📄 UI 模板搜索结果
|
|
628
|
-
|
|
629
|
-
找到 ${filteredTemplates.length} 个匹配模板
|
|
630
|
-
|
|
631
|
-
---
|
|
632
|
-
|
|
633
|
-
${templateList}
|
|
634
|
-
|
|
635
|
-
**使用方法**:
|
|
636
|
-
\`\`\`
|
|
637
|
-
render_ui docs/ui/pages/<文件名>.json --framework=react
|
|
638
|
-
\`\`\`
|
|
639
|
+
const message = `# 📄 UI 模板搜索结果
|
|
640
|
+
|
|
641
|
+
找到 ${filteredTemplates.length} 个匹配模板
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
${templateList}
|
|
646
|
+
|
|
647
|
+
**使用方法**:
|
|
648
|
+
\`\`\`
|
|
649
|
+
render_ui docs/ui/pages/<文件名>.json --framework=react
|
|
650
|
+
\`\`\`
|
|
639
651
|
`;
|
|
640
652
|
const structuredData = {
|
|
641
653
|
summary: `找到 ${filteredTemplates.length} 个模板`,
|
|
@@ -662,20 +674,20 @@ render_ui docs/ui/pages/<文件名>.json --framework=react
|
|
|
662
674
|
results: [],
|
|
663
675
|
totalResults: 0,
|
|
664
676
|
};
|
|
665
|
-
return okStructured(`📭 暂无可用模板
|
|
666
|
-
|
|
667
|
-
模板目录不存在或为空。
|
|
668
|
-
|
|
669
|
-
**建议**:
|
|
670
|
-
使用 \`start_ui\` 生成第一个模板:
|
|
671
|
-
|
|
672
|
-
\`\`\`
|
|
673
|
-
start_ui "登录页面"
|
|
674
|
-
start_ui "用户列表"
|
|
675
|
-
start_ui "设置页面"
|
|
676
|
-
\`\`\`
|
|
677
|
-
|
|
678
|
-
模板会自动保存到 \`docs/ui/pages/\` 目录。
|
|
677
|
+
return okStructured(`📭 暂无可用模板
|
|
678
|
+
|
|
679
|
+
模板目录不存在或为空。
|
|
680
|
+
|
|
681
|
+
**建议**:
|
|
682
|
+
使用 \`start_ui\` 生成第一个模板:
|
|
683
|
+
|
|
684
|
+
\`\`\`
|
|
685
|
+
start_ui "登录页面"
|
|
686
|
+
start_ui "用户列表"
|
|
687
|
+
start_ui "设置页面"
|
|
688
|
+
\`\`\`
|
|
689
|
+
|
|
690
|
+
模板会自动保存到 \`docs/ui/pages/\` 目录。
|
|
679
691
|
`, errorData, {
|
|
680
692
|
schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
|
|
681
693
|
});
|
|
@@ -699,17 +711,17 @@ start_ui "设置页面"
|
|
|
699
711
|
results: [],
|
|
700
712
|
totalResults: 0,
|
|
701
713
|
};
|
|
702
|
-
return okStructured(`未找到匹配的 UI/UX 数据。
|
|
703
|
-
|
|
704
|
-
**搜索条件:**
|
|
705
|
-
- 查询: ${query}
|
|
706
|
-
- 类别: ${options.category || '全部'}
|
|
707
|
-
- 技术栈: ${options.stack || '全部'}
|
|
708
|
-
|
|
709
|
-
**建议:**
|
|
710
|
-
1. 尝试使用更通用的关键词
|
|
711
|
-
2. 检查拼写是否正确
|
|
712
|
-
3. 移除类别或技术栈限制
|
|
714
|
+
return okStructured(`未找到匹配的 UI/UX 数据。
|
|
715
|
+
|
|
716
|
+
**搜索条件:**
|
|
717
|
+
- 查询: ${query}
|
|
718
|
+
- 类别: ${options.category || '全部'}
|
|
719
|
+
- 技术栈: ${options.stack || '全部'}
|
|
720
|
+
|
|
721
|
+
**建议:**
|
|
722
|
+
1. 尝试使用更通用的关键词
|
|
723
|
+
2. 检查拼写是否正确
|
|
724
|
+
3. 移除类别或技术栈限制
|
|
713
725
|
`, noResultData, {
|
|
714
726
|
schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
|
|
715
727
|
});
|
|
@@ -718,21 +730,21 @@ start_ui "设置页面"
|
|
|
718
730
|
const formattedResults = results.map((result, index) => {
|
|
719
731
|
const data = result.data;
|
|
720
732
|
if (isShadcnCategory(result.category)) {
|
|
721
|
-
return `### ${index + 1}. ${data.name || data.title} (相关度: ${result.score.toFixed(2)})
|
|
722
|
-
|
|
723
|
-
${formatShadcnResult(data)}
|
|
733
|
+
return `### ${index + 1}. ${data.name || data.title} (相关度: ${result.score.toFixed(2)})
|
|
734
|
+
|
|
735
|
+
${formatShadcnResult(data)}
|
|
724
736
|
`;
|
|
725
737
|
}
|
|
726
738
|
if (isThemeCategory(result.category)) {
|
|
727
|
-
return `### ${index + 1}. ${data.title || data.name} (相关度: ${result.score.toFixed(2)})
|
|
728
|
-
|
|
729
|
-
${formatThemeResult(data)}
|
|
739
|
+
return `### ${index + 1}. ${data.title || data.name} (相关度: ${result.score.toFixed(2)})
|
|
740
|
+
|
|
741
|
+
${formatThemeResult(data)}
|
|
730
742
|
`;
|
|
731
743
|
}
|
|
732
744
|
if (isGuidelineCategory(result.category)) {
|
|
733
|
-
return `### ${index + 1}. ${data.level} (相关度: ${result.score.toFixed(2)})
|
|
734
|
-
|
|
735
|
-
${formatGuidelineResult(data)}
|
|
745
|
+
return `### ${index + 1}. ${data.level} (相关度: ${result.score.toFixed(2)})
|
|
746
|
+
|
|
747
|
+
${formatGuidelineResult(data)}
|
|
736
748
|
`;
|
|
737
749
|
}
|
|
738
750
|
const fields = Object.entries(data)
|
|
@@ -744,23 +756,23 @@ ${formatGuidelineResult(data)}
|
|
|
744
756
|
return `- **${key}**: ${value}`;
|
|
745
757
|
})
|
|
746
758
|
.join('\n');
|
|
747
|
-
return `### ${index + 1}. ${result.category} (相关度: ${result.score.toFixed(2)})
|
|
748
|
-
|
|
749
|
-
${fields}
|
|
759
|
+
return `### ${index + 1}. ${result.category} (相关度: ${result.score.toFixed(2)})
|
|
760
|
+
|
|
761
|
+
${fields}
|
|
750
762
|
`;
|
|
751
763
|
}).join('\n---\n\n');
|
|
752
|
-
const message = `# UI/UX 搜索结果
|
|
753
|
-
|
|
754
|
-
找到 ${results.length} 条匹配结果
|
|
755
|
-
|
|
756
|
-
**搜索条件:**
|
|
757
|
-
- 查询: ${query}
|
|
758
|
-
- 类别: ${options.category || '全部'}
|
|
759
|
-
- 技术栈: ${options.stack || '全部'}
|
|
760
|
-
|
|
761
|
-
---
|
|
762
|
-
|
|
763
|
-
${formattedResults}
|
|
764
|
+
const message = `# UI/UX 搜索结果
|
|
765
|
+
|
|
766
|
+
找到 ${results.length} 条匹配结果
|
|
767
|
+
|
|
768
|
+
**搜索条件:**
|
|
769
|
+
- 查询: ${query}
|
|
770
|
+
- 类别: ${options.category || '全部'}
|
|
771
|
+
- 技术栈: ${options.stack || '全部'}
|
|
772
|
+
|
|
773
|
+
---
|
|
774
|
+
|
|
775
|
+
${formattedResults}
|
|
764
776
|
`;
|
|
765
777
|
const structuredData = {
|
|
766
778
|
summary: `找到 ${results.length} 条结果`,
|
|
@@ -825,14 +837,14 @@ export async function syncUiData(args, context) {
|
|
|
825
837
|
version: updateInfo.uipro.current || updateInfo.uipro.latest,
|
|
826
838
|
timestamp: new Date().toISOString(),
|
|
827
839
|
};
|
|
828
|
-
return okStructured(`✅ UI/UX 数据已是最新版本
|
|
829
|
-
|
|
830
|
-
**uipro-cli:** ${updateInfo.uipro.current || 'unknown'} (latest ${updateInfo.uipro.latest})
|
|
831
|
-
**shadcn registry:** ${updateInfo.shadcn.current || 'unknown'} (latest ${updateInfo.shadcn.latest})
|
|
832
|
-
**ui-themes:** ${updateInfo.themes.current || 'unknown'} (latest ${updateInfo.themes.latest})
|
|
833
|
-
**vercel guidelines:** ${updateInfo.vercel.current || 'unknown'} (latest ${updateInfo.vercel.latest})
|
|
834
|
-
|
|
835
|
-
无需更新。如需强制同步,请使用 \`force: true\` 参数。
|
|
840
|
+
return okStructured(`✅ UI/UX 数据已是最新版本
|
|
841
|
+
|
|
842
|
+
**uipro-cli:** ${updateInfo.uipro.current || 'unknown'} (latest ${updateInfo.uipro.latest})
|
|
843
|
+
**shadcn registry:** ${updateInfo.shadcn.current || 'unknown'} (latest ${updateInfo.shadcn.latest})
|
|
844
|
+
**ui-themes:** ${updateInfo.themes.current || 'unknown'} (latest ${updateInfo.themes.latest})
|
|
845
|
+
**vercel guidelines:** ${updateInfo.vercel.current || 'unknown'} (latest ${updateInfo.vercel.latest})
|
|
846
|
+
|
|
847
|
+
无需更新。如需强制同步,请使用 \`force: true\` 参数。
|
|
836
848
|
`, upToDateData, {
|
|
837
849
|
schema: (await import('../schemas/output/ui-ux-tools.js')).SyncReportSchema,
|
|
838
850
|
});
|
|
@@ -878,26 +890,26 @@ export async function syncUiData(args, context) {
|
|
|
878
890
|
timestamp: new Date().toISOString(),
|
|
879
891
|
};
|
|
880
892
|
await reportToolProgress(context, 100, 'sync_ui_data: 同步完成');
|
|
881
|
-
return okStructured(`✅ UI/UX 数据同步成功
|
|
882
|
-
|
|
883
|
-
数据已更新到缓存目录: ${cacheDir}
|
|
884
|
-
下载版本: ${metadata?.version || 'unknown'}
|
|
885
|
-
|
|
886
|
-
**同步统计:**
|
|
887
|
-
- 颜色: ${syncedData.synced.colors} 条
|
|
888
|
-
- 图标: ${syncedData.synced.icons} 条
|
|
889
|
-
- 组件: ${syncedData.synced.components} 条
|
|
890
|
-
- 模式: ${syncedData.synced.patterns} 条
|
|
891
|
-
- shadcn blocks: ${syncedData.synced.shadcnBlocks || 0} 条
|
|
892
|
-
- shadcn components: ${syncedData.synced.shadcnComponents || 0} 条
|
|
893
|
-
- UI 主题: ${syncedData.synced.themes || 0} 套
|
|
894
|
-
- Vercel 规范: ${syncedData.synced.vercelGuidelines || 0} 条
|
|
895
|
-
|
|
896
|
-
**会话状态:**
|
|
897
|
-
- 当前会话使用版本: ${sessionInfo.activeVersion || 'unknown'}(source: ${sessionInfo.source})
|
|
898
|
-
- 下次启动生效版本: ${sessionInfo.pendingVersion || metadata?.version || 'unknown'}
|
|
899
|
-
|
|
900
|
-
**提示:** 为保证会话内结果一致,新数据将在下次启动后生效。
|
|
893
|
+
return okStructured(`✅ UI/UX 数据同步成功
|
|
894
|
+
|
|
895
|
+
数据已更新到缓存目录: ${cacheDir}
|
|
896
|
+
下载版本: ${metadata?.version || 'unknown'}
|
|
897
|
+
|
|
898
|
+
**同步统计:**
|
|
899
|
+
- 颜色: ${syncedData.synced.colors} 条
|
|
900
|
+
- 图标: ${syncedData.synced.icons} 条
|
|
901
|
+
- 组件: ${syncedData.synced.components} 条
|
|
902
|
+
- 模式: ${syncedData.synced.patterns} 条
|
|
903
|
+
- shadcn blocks: ${syncedData.synced.shadcnBlocks || 0} 条
|
|
904
|
+
- shadcn components: ${syncedData.synced.shadcnComponents || 0} 条
|
|
905
|
+
- UI 主题: ${syncedData.synced.themes || 0} 套
|
|
906
|
+
- Vercel 规范: ${syncedData.synced.vercelGuidelines || 0} 条
|
|
907
|
+
|
|
908
|
+
**会话状态:**
|
|
909
|
+
- 当前会话使用版本: ${sessionInfo.activeVersion || 'unknown'}(source: ${sessionInfo.source})
|
|
910
|
+
- 下次启动生效版本: ${sessionInfo.pendingVersion || metadata?.version || 'unknown'}
|
|
911
|
+
|
|
912
|
+
**提示:** 为保证会话内结果一致,新数据将在下次启动后生效。
|
|
901
913
|
`, syncedData, {
|
|
902
914
|
schema: (await import('../schemas/output/ui-ux-tools.js')).SyncReportSchema,
|
|
903
915
|
});
|
|
@@ -911,18 +923,18 @@ export async function syncUiData(args, context) {
|
|
|
911
923
|
timestamp: new Date().toISOString(),
|
|
912
924
|
errors: [errorMessage],
|
|
913
925
|
};
|
|
914
|
-
return okStructured(`❌ UI 数据同步失败: ${errorMessage}
|
|
915
|
-
|
|
916
|
-
**可能的原因:**
|
|
917
|
-
1. 网络连接问题
|
|
918
|
-
2. npm registry 不可访问
|
|
919
|
-
3. 磁盘空间不足
|
|
920
|
-
4. 权限问题
|
|
921
|
-
|
|
922
|
-
**建议:**
|
|
923
|
-
1. 检查网络连接
|
|
924
|
-
2. 稍后重试
|
|
925
|
-
3. 使用 \`verbose: true\` 查看详细日志
|
|
926
|
+
return okStructured(`❌ UI 数据同步失败: ${errorMessage}
|
|
927
|
+
|
|
928
|
+
**可能的原因:**
|
|
929
|
+
1. 网络连接问题
|
|
930
|
+
2. npm registry 不可访问
|
|
931
|
+
3. 磁盘空间不足
|
|
932
|
+
4. 权限问题
|
|
933
|
+
|
|
934
|
+
**建议:**
|
|
935
|
+
1. 检查网络连接
|
|
936
|
+
2. 稍后重试
|
|
937
|
+
3. 使用 \`verbose: true\` 查看详细日志
|
|
926
938
|
`, errorData, {
|
|
927
939
|
schema: (await import('../schemas/output/ui-ux-tools.js')).SyncReportSchema,
|
|
928
940
|
});
|