mcp-probe-kit 1.15.0 → 2.0.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.
Files changed (165) hide show
  1. package/README.md +113 -1642
  2. package/build/index.js +75 -42
  3. package/build/lib/elicitation-helper.d.ts +73 -0
  4. package/build/lib/elicitation-helper.js +130 -0
  5. package/build/lib/response.d.ts +32 -0
  6. package/build/lib/response.js +28 -0
  7. package/build/lib/tasks-manager.d.ts +116 -0
  8. package/build/lib/tasks-manager.js +217 -0
  9. package/build/lib/toolset-manager.d.ts +48 -0
  10. package/build/lib/toolset-manager.js +112 -0
  11. package/build/schemas/basic-tools.d.ts +0 -32
  12. package/build/schemas/basic-tools.js +0 -34
  13. package/build/schemas/code-analysis-tools.d.ts +0 -36
  14. package/build/schemas/code-analysis-tools.js +0 -38
  15. package/build/schemas/code-gen-tools.d.ts +0 -44
  16. package/build/schemas/code-gen-tools.js +0 -46
  17. package/build/schemas/doc-util-tools.d.ts +0 -54
  18. package/build/schemas/doc-util-tools.js +0 -58
  19. package/build/schemas/index.d.ts +0 -188
  20. package/build/schemas/orchestration-tools.d.ts +0 -22
  21. package/build/schemas/orchestration-tools.js +0 -23
  22. package/build/schemas/output/core-tools.d.ts +817 -0
  23. package/build/schemas/output/core-tools.js +421 -0
  24. package/build/schemas/output/generation-tools.d.ts +936 -0
  25. package/build/schemas/output/generation-tools.js +446 -0
  26. package/build/schemas/output/helper-tools.d.ts +243 -0
  27. package/build/schemas/output/helper-tools.js +138 -0
  28. package/build/schemas/output/index.d.ts +76 -0
  29. package/build/schemas/output/index.js +96 -0
  30. package/build/schemas/output/project-tools.d.ts +702 -0
  31. package/build/schemas/output/project-tools.js +339 -0
  32. package/build/schemas/output/ui-ux-tools.d.ts +469 -0
  33. package/build/schemas/output/ui-ux-tools.js +218 -0
  34. package/build/schemas/output/workflow-tools.d.ts +267 -0
  35. package/build/schemas/output/workflow-tools.js +179 -0
  36. package/build/schemas/structured-output.d.ts +1317 -0
  37. package/build/schemas/structured-output.js +1017 -0
  38. package/build/tools/__tests__/start_ui.integration.test.js +5 -5
  39. package/build/tools/__tests__/start_ui.property.test.js +11 -11
  40. package/build/tools/add_feature.d.ts +1 -13
  41. package/build/tools/add_feature.js +48 -13
  42. package/build/tools/analyze_project.js +57 -18
  43. package/build/tools/check_deps.d.ts +1 -13
  44. package/build/tools/check_deps.js +24 -15
  45. package/build/tools/code_review.d.ts +1 -13
  46. package/build/tools/code_review.js +19 -16
  47. package/build/tools/css_order.js +55 -55
  48. package/build/tools/debug.d.ts +1 -13
  49. package/build/tools/debug.js +18 -16
  50. package/build/tools/estimate.d.ts +1 -19
  51. package/build/tools/estimate.js +36 -6
  52. package/build/tools/fix_bug.d.ts +1 -13
  53. package/build/tools/fix_bug.js +24 -6
  54. package/build/tools/gen_mock.d.ts +1 -19
  55. package/build/tools/gen_mock.js +42 -227
  56. package/build/tools/genapi.d.ts +1 -13
  57. package/build/tools/genapi.js +18 -15
  58. package/build/tools/genchangelog.d.ts +1 -13
  59. package/build/tools/genchangelog.js +36 -212
  60. package/build/tools/gencommit.d.ts +1 -7
  61. package/build/tools/gencommit.js +21 -13
  62. package/build/tools/gendoc.d.ts +1 -13
  63. package/build/tools/gendoc.js +18 -15
  64. package/build/tools/genpr.d.ts +1 -13
  65. package/build/tools/genpr.js +28 -157
  66. package/build/tools/genreadme.d.ts +1 -13
  67. package/build/tools/genreadme.js +22 -587
  68. package/build/tools/gensql.d.ts +1 -13
  69. package/build/tools/gensql.js +24 -283
  70. package/build/tools/gentest.d.ts +1 -13
  71. package/build/tools/gentest.js +49 -16
  72. package/build/tools/index.d.ts +0 -10
  73. package/build/tools/index.js +0 -10
  74. package/build/tools/init_component_catalog.d.ts +3 -20
  75. package/build/tools/init_component_catalog.js +141 -786
  76. package/build/tools/init_project.d.ts +7 -13
  77. package/build/tools/init_project.js +54 -16
  78. package/build/tools/init_project_context.d.ts +1 -13
  79. package/build/tools/init_project_context.js +41 -14
  80. package/build/tools/perf.d.ts +1 -13
  81. package/build/tools/perf.js +18 -15
  82. package/build/tools/refactor.d.ts +1 -13
  83. package/build/tools/refactor.js +54 -15
  84. package/build/tools/render_ui.d.ts +2 -19
  85. package/build/tools/render_ui.js +201 -347
  86. package/build/tools/resolve_conflict.d.ts +1 -13
  87. package/build/tools/resolve_conflict.js +18 -15
  88. package/build/tools/security_scan.d.ts +1 -13
  89. package/build/tools/security_scan.js +16 -5
  90. package/build/tools/start_api.d.ts +7 -13
  91. package/build/tools/start_api.js +69 -157
  92. package/build/tools/start_bugfix.d.ts +1 -7
  93. package/build/tools/start_bugfix.js +38 -2
  94. package/build/tools/start_doc.d.ts +7 -13
  95. package/build/tools/start_doc.js +76 -169
  96. package/build/tools/start_feature.d.ts +1 -7
  97. package/build/tools/start_feature.js +54 -2
  98. package/build/tools/start_onboard.d.ts +1 -7
  99. package/build/tools/start_onboard.js +40 -2
  100. package/build/tools/start_ralph.d.ts +1 -7
  101. package/build/tools/start_ralph.js +88 -2
  102. package/build/tools/start_refactor.d.ts +7 -13
  103. package/build/tools/start_refactor.js +75 -148
  104. package/build/tools/start_release.d.ts +7 -13
  105. package/build/tools/start_release.js +56 -131
  106. package/build/tools/start_review.d.ts +7 -13
  107. package/build/tools/start_review.js +70 -142
  108. package/build/tools/start_ui.d.ts +1 -7
  109. package/build/tools/start_ui.js +98 -8
  110. package/build/tools/ui-ux-tools.d.ts +3 -39
  111. package/build/tools/ui-ux-tools.js +201 -125
  112. package/docs/data/tools.js +864 -0
  113. package/docs/index.html +594 -0
  114. package/docs/pages/all-tools.html +649 -0
  115. package/docs/pages/examples.html +564 -0
  116. package/docs/pages/getting-started.html +529 -0
  117. package/docs/pages/migration.html +308 -0
  118. package/docs/specs/algorithm-enhancement/roadmap.md +619 -0
  119. package/docs/specs/vnext-upgrade/00-OVERVIEW.md +258 -0
  120. package/docs/specs/vnext-upgrade/BETA_RELEASE_GUIDE.md +328 -0
  121. package/docs/specs/vnext-upgrade/GITHUB_DISCUSSION_TEMPLATE.md +236 -0
  122. package/docs/specs/vnext-upgrade/M8.9-PROGRESS-UPDATE.md +248 -0
  123. package/docs/specs/vnext-upgrade/PROGRESS-SUMMARY.md +195 -0
  124. package/docs/specs/vnext-upgrade/QUICK_REFERENCE.md +338 -0
  125. package/docs/specs/vnext-upgrade/README.md +125 -0
  126. package/docs/specs/vnext-upgrade/STATUS-UPDATE-2026-01-26.md +230 -0
  127. package/docs/specs/vnext-upgrade/TOOL_CLEANUP.md +343 -0
  128. package/docs/specs/vnext-upgrade/completed/M1-M2-SUMMARY.md +27 -0
  129. package/docs/specs/vnext-upgrade/completed/M3_COMPLETION_SUMMARY.md +273 -0
  130. package/docs/specs/vnext-upgrade/completed/M4-SUMMARY.md +19 -0
  131. package/docs/specs/vnext-upgrade/completed/M5_COMPLETION_SUMMARY.md +0 -0
  132. package/docs/specs/vnext-upgrade/completed/M8.1-SUMMARY.md +247 -0
  133. package/docs/specs/vnext-upgrade/completed/M8.2-SUMMARY.md +296 -0
  134. package/docs/specs/vnext-upgrade/completed/M8.3-SUMMARY.md +241 -0
  135. package/docs/specs/vnext-upgrade/completed/M8.3-TEST-SUMMARY.md +216 -0
  136. package/docs/specs/vnext-upgrade/completed/M8.4-SUMMARY.md +217 -0
  137. package/docs/specs/vnext-upgrade/completed/M8.4-TEST-SUMMARY.md +198 -0
  138. package/docs/specs/vnext-upgrade/completed/M8.5-SUMMARY.md +202 -0
  139. package/docs/specs/vnext-upgrade/completed/M8.5-TEST-SUMMARY.md +223 -0
  140. package/docs/specs/vnext-upgrade/completed/M8.6-SUMMARY.md +299 -0
  141. package/docs/specs/vnext-upgrade/completed/M8.8-TEST-SUMMARY.md +216 -0
  142. package/docs/specs/vnext-upgrade/completed/TOOL-CLEANUP-SUMMARY.md +210 -0
  143. package/docs/specs/vnext-upgrade/design.md +848 -0
  144. package/docs/specs/vnext-upgrade/requirements.md +221 -0
  145. package/docs/specs/vnext-upgrade/tasks/00-INDEX.md +335 -0
  146. package/docs/specs/vnext-upgrade/tasks/M8.1-SCHEMA-DEFINITION.md +300 -0
  147. package/docs/specs/vnext-upgrade/tasks/M8.2-P1-TOOLS.md +249 -0
  148. package/docs/specs/vnext-upgrade/tasks/M8.3-GENERATION-TOOLS.md +49 -0
  149. package/docs/specs/vnext-upgrade/tasks/M8.4-ORCHESTRATION-TOOLS.md +28 -0
  150. package/docs/specs/vnext-upgrade/tasks/M8.5-PROJECT-TOOLS.md +29 -0
  151. package/docs/specs/vnext-upgrade/tasks/M8.6-UI-TOOLS.md +66 -0
  152. package/docs/specs/vnext-upgrade/tasks/M8.7-HELPER-TOOLS.md +24 -0
  153. package/docs/specs/vnext-upgrade/tasks/M8.8-INTEGRATION-TESTS.md +90 -0
  154. package/docs/specs/vnext-upgrade/tasks/M8.9-DOCUMENTATION.md +103 -0
  155. package/docs/styles/docs.css +556 -0
  156. package/docs/styles/page.css +815 -0
  157. package/docs/vnext/MCP_2025-11-25_GUIDE.md +276 -0
  158. package/docs/vnext/vNext-PRD.md +488 -0
  159. package/package.json +4 -4
  160. package/build/utils/design-docs-generator.d.ts +0 -1
  161. package/build/utils/design-docs-generator.js +0 -1
  162. package/docs/BEST_PRACTICES.md +0 -1185
  163. package/docs/HOW_TO_TRIGGER.md +0 -1141
  164. package/docs/MCP-Probe-Kit-/344/275/277/347/224/250/346/211/213/345/206/214.html +0 -544
  165. package/docs/MCP-Probe-Kit-/344/275/277/347/224/250/346/211/213/345/206/214.md +0 -1447
@@ -9,6 +9,7 @@ import { DesignReasoningEngine } from '../utils/design-reasoning-engine.js';
9
9
  import { ASCIIBoxFormatter } from '../utils/ascii-box-formatter.js';
10
10
  import { syncUIDataToCache } from '../utils/ui-sync.js';
11
11
  import { formatDesignSystemJson } from '../utils/design-system-json-formatter.js';
12
+ import { okStructured } from '../lib/response.js';
12
13
  // 全局数据加载器实例
13
14
  let dataLoader = null;
14
15
  let reasoningEngine = null;
@@ -277,12 +278,7 @@ ${creationGuidance.config.map((topic, i) => `${i + 1}. ${topic}`).join('\n')}
277
278
  ### 创作提示
278
279
  ${creationGuidance.tips.map((tip, i) => `${i + 1}. ${tip}`).join('\n')}
279
280
  `;
280
- // 返回新的输出格式(Requirements: 2.1, 2.5, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6)
281
- return {
282
- content: [
283
- {
284
- type: "text",
285
- text: `# ✅ 设计系统推荐已生成
281
+ const message = `# 设计系统推荐已生成
286
282
 
287
283
  **产品类型**: ${request.productType}
288
284
  **技术栈**: ${request.stack || 'html'}
@@ -377,18 +373,42 @@ ${guidanceText}
377
373
  ---
378
374
 
379
375
  🚀 **准备好了吗?让我们开始创建第一个文件吧!**
380
- `,
381
- },
382
- ],
376
+ `;
377
+ // 构建结构化数据对象
378
+ const structuredData = {
379
+ summary: `设计系统推荐已生成 - ${request.productType}`,
380
+ productType: request.productType,
381
+ colors: {
382
+ primary: recommendation.colors?.primary || {},
383
+ secondary: recommendation.colors?.secondary || {},
384
+ neutral: {},
385
+ semantic: {},
386
+ },
387
+ typography: {
388
+ fontFamilies: {},
389
+ fontSizes: {},
390
+ fontWeights: {},
391
+ lineHeights: {},
392
+ },
393
+ spacing: {},
394
+ breakpoints: {},
395
+ components: [],
396
+ documentation: asciiBox,
383
397
  };
398
+ // 返回结构化输出(Requirements: 2.1, 2.5, 6.1, 6.2, 6.3, 6.4, 6.5, 6.6)
399
+ return okStructured(message, structuredData, {
400
+ schema: (await import('../schemas/output/ui-ux-tools.js')).DesignSystemSchema,
401
+ });
384
402
  }
385
403
  catch (error) {
386
404
  const errorMessage = error instanceof Error ? error.message : String(error);
387
- return {
388
- content: [
389
- {
390
- type: "text",
391
- text: `❌ 设计系统生成失败: ${errorMessage}
405
+ const errorData = {
406
+ summary: "设计系统生成失败",
407
+ productType: args.product_type || 'Unknown',
408
+ colors: {},
409
+ typography: {},
410
+ };
411
+ return okStructured(`❌ 设计系统生成失败: ${errorMessage}
392
412
 
393
413
  **可能的原因**:
394
414
  1. 数据未加载完成
@@ -399,11 +419,9 @@ ${guidanceText}
399
419
  1. 提供更具体的产品类型(如 "SaaS", "E-commerce", "Healthcare")
400
420
  2. 添加产品描述帮助推理引擎理解需求
401
421
  3. 检查数据是否已同步(使用 \`sync_ui_data\` 工具)
402
- `,
403
- },
404
- ],
405
- isError: true,
406
- };
422
+ `, errorData, {
423
+ schema: (await import('../schemas/output/ui-ux-tools.js')).DesignSystemSchema,
424
+ });
407
425
  }
408
426
  }
409
427
  /**
@@ -431,11 +449,7 @@ export async function uiSearch(args) {
431
449
  **样式**: ${comp.styles ? Object.keys(comp.styles).join(', ') : '无'}
432
450
  `;
433
451
  }).join('\n---\n\n');
434
- return {
435
- content: [
436
- {
437
- type: "text",
438
- text: `# 📦 组件目录
452
+ const message = `# 📦 组件目录
439
453
 
440
454
  共 ${components.length} 个可用组件
441
455
 
@@ -444,24 +458,36 @@ export async function uiSearch(args) {
444
458
  ${componentList}
445
459
 
446
460
  **提示**: 这些组件可以在 UI 模板中使用
447
- `,
448
- },
449
- ],
461
+ `;
462
+ const structuredData = {
463
+ summary: `组件目录 - ${components.length} 个组件`,
464
+ query: 'catalog',
465
+ category: 'components',
466
+ results: components.map((comp) => ({
467
+ id: comp.name,
468
+ title: comp.name,
469
+ description: comp.description || '无描述',
470
+ category: 'component',
471
+ })),
472
+ totalResults: components.length,
450
473
  };
474
+ return okStructured(message, structuredData, {
475
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
476
+ });
451
477
  }
452
478
  catch (error) {
453
- return {
454
- content: [
455
- {
456
- type: "text",
457
- text: `❌ 未找到组件目录文件
479
+ const errorData = {
480
+ summary: "未找到组件目录",
481
+ query: 'catalog',
482
+ results: [],
483
+ totalResults: 0,
484
+ };
485
+ return okStructured(`❌ 未找到组件目录文件
458
486
 
459
487
  请先运行 \`init_component_catalog\` 生成组件目录。
460
- `,
461
- },
462
- ],
463
- isError: true,
464
- };
488
+ `, errorData, {
489
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
490
+ });
465
491
  }
466
492
  }
467
493
  // 模式 2: template - 搜索 UI 模板
@@ -476,11 +502,14 @@ ${componentList}
476
502
  const files = await fs.readdir(templatesDir);
477
503
  const jsonFiles = files.filter(f => f.endsWith('.json'));
478
504
  if (jsonFiles.length === 0) {
479
- return {
480
- content: [
481
- {
482
- type: "text",
483
- text: `📭 暂无可用模板
505
+ const emptyData = {
506
+ summary: "暂无可用模板",
507
+ query: query || 'template',
508
+ category: 'template',
509
+ results: [],
510
+ totalResults: 0,
511
+ };
512
+ return okStructured(`📭 暂无可用模板
484
513
 
485
514
  **建议**:
486
515
  1. 使用 \`start_ui\` 生成新模板
@@ -492,10 +521,9 @@ ${componentList}
492
521
  start_ui "登录页面"
493
522
  start_ui "用户列表"
494
523
  \`\`\`
495
- `,
496
- },
497
- ],
498
- };
524
+ `, emptyData, {
525
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
526
+ });
499
527
  }
500
528
  // 读取所有模板内容
501
529
  const templates = await Promise.all(jsonFiles.map(async (file) => {
@@ -517,20 +545,27 @@ start_ui "用户列表"
517
545
  t.description.toLowerCase().includes(lowerQuery));
518
546
  }
519
547
  if (filteredTemplates.length === 0) {
520
- return {
521
- content: [
522
- {
523
- type: "text",
524
- text: `未找到匹配的模板
548
+ const noMatchData = {
549
+ summary: "未找到匹配的模板",
550
+ query: query,
551
+ category: 'template',
552
+ results: templates.map(t => ({
553
+ id: t.file,
554
+ title: t.name,
555
+ description: t.description,
556
+ category: 'template',
557
+ })),
558
+ totalResults: 0,
559
+ };
560
+ return okStructured(`未找到匹配的模板
525
561
 
526
562
  **查询**: ${query}
527
563
  **可用模板**: ${templates.map(t => t.name).join(', ')}
528
564
 
529
565
  **建议**: 使用 \`start_ui "${query}"\` 生成新模板
530
- `,
531
- },
532
- ],
533
- };
566
+ `, noMatchData, {
567
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
568
+ });
534
569
  }
535
570
  // 格式化模板列表
536
571
  const templateList = filteredTemplates.map((t, index) => {
@@ -545,11 +580,7 @@ ${JSON.stringify(t.template, null, 2)}
545
580
  \`\`\`
546
581
  `;
547
582
  }).join('\n---\n\n');
548
- return {
549
- content: [
550
- {
551
- type: "text",
552
- text: `# 📄 UI 模板搜索结果
583
+ const message = `# 📄 UI 模板搜索结果
553
584
 
554
585
  找到 ${filteredTemplates.length} 个匹配模板
555
586
 
@@ -561,17 +592,33 @@ ${templateList}
561
592
  \`\`\`
562
593
  render_ui docs/ui/pages/<文件名>.json --framework=react
563
594
  \`\`\`
564
- `,
565
- },
566
- ],
595
+ `;
596
+ const structuredData = {
597
+ summary: `找到 ${filteredTemplates.length} 个模板`,
598
+ query: query || 'template',
599
+ category: 'template',
600
+ results: filteredTemplates.map(t => ({
601
+ id: t.file,
602
+ title: t.name,
603
+ description: t.description,
604
+ category: 'template',
605
+ preview: JSON.stringify(t.template, null, 2),
606
+ })),
607
+ totalResults: filteredTemplates.length,
567
608
  };
609
+ return okStructured(message, structuredData, {
610
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
611
+ });
568
612
  }
569
613
  catch (error) {
570
- return {
571
- content: [
572
- {
573
- type: "text",
574
- text: `📭 暂无可用模板
614
+ const errorData = {
615
+ summary: "暂无可用模板",
616
+ query: query || 'template',
617
+ category: 'template',
618
+ results: [],
619
+ totalResults: 0,
620
+ };
621
+ return okStructured(`📭 暂无可用模板
575
622
 
576
623
  模板目录不存在或为空。
577
624
 
@@ -585,10 +632,9 @@ start_ui "设置页面"
585
632
  \`\`\`
586
633
 
587
634
  模板会自动保存到 \`docs/ui/pages/\` 目录。
588
- `,
589
- },
590
- ],
591
- };
635
+ `, errorData, {
636
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
637
+ });
592
638
  }
593
639
  }
594
640
  // 模式 3: search - 默认搜索模式(原有功能)
@@ -602,11 +648,14 @@ start_ui "设置页面"
602
648
  };
603
649
  const results = searchEngine.search(query, options);
604
650
  if (results.length === 0) {
605
- return {
606
- content: [
607
- {
608
- type: "text",
609
- text: `未找到匹配的 UI/UX 数据。
651
+ const noResultData = {
652
+ summary: "未找到匹配的 UI/UX 数据",
653
+ query: query,
654
+ category: options.category,
655
+ results: [],
656
+ totalResults: 0,
657
+ };
658
+ return okStructured(`未找到匹配的 UI/UX 数据。
610
659
 
611
660
  **搜索条件:**
612
661
  - 查询: ${query}
@@ -617,10 +666,9 @@ start_ui "设置页面"
617
666
  1. 尝试使用更通用的关键词
618
667
  2. 检查拼写是否正确
619
668
  3. 移除类别或技术栈限制
620
- `,
621
- },
622
- ],
623
- };
669
+ `, noResultData, {
670
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
671
+ });
624
672
  }
625
673
  // 格式化结果
626
674
  const formattedResults = results.map((result, index) => {
@@ -639,11 +687,7 @@ start_ui "设置页面"
639
687
  ${fields}
640
688
  `;
641
689
  }).join('\n---\n\n');
642
- return {
643
- content: [
644
- {
645
- type: "text",
646
- text: `# UI/UX 搜索结果
690
+ const message = `# UI/UX 搜索结果
647
691
 
648
692
  找到 ${results.length} 条匹配结果
649
693
 
@@ -655,22 +699,36 @@ ${fields}
655
699
  ---
656
700
 
657
701
  ${formattedResults}
658
- `,
659
- },
660
- ],
702
+ `;
703
+ const structuredData = {
704
+ summary: `找到 ${results.length} 条结果`,
705
+ query: query,
706
+ category: options.category,
707
+ results: results.map(result => ({
708
+ id: result.data.id || result.data.name || '',
709
+ title: result.data.title || result.data.name || '',
710
+ description: result.data.description || '',
711
+ category: result.category,
712
+ score: result.score,
713
+ preview: JSON.stringify(result.data, null, 2),
714
+ })),
715
+ totalResults: results.length,
661
716
  };
717
+ return okStructured(message, structuredData, {
718
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
719
+ });
662
720
  }
663
721
  catch (error) {
664
722
  const errorMessage = error instanceof Error ? error.message : String(error);
665
- return {
666
- content: [
667
- {
668
- type: "text",
669
- text: `❌ UI 搜索失败: ${errorMessage}`,
670
- },
671
- ],
672
- isError: true,
723
+ const errorData = {
724
+ summary: "UI 搜索失败",
725
+ query: args.query || '',
726
+ results: [],
727
+ totalResults: 0,
673
728
  };
729
+ return okStructured(`❌ UI 搜索失败: ${errorMessage}`, errorData, {
730
+ schema: (await import('../schemas/output/ui-ux-tools.js')).UISearchResultSchema,
731
+ });
674
732
  }
675
733
  }
676
734
  /**
@@ -687,20 +745,22 @@ export async function syncUiData(args) {
687
745
  try {
688
746
  const updateInfo = await cacheManager.checkUpdate();
689
747
  if (!updateInfo.hasUpdate) {
690
- return {
691
- content: [
692
- {
693
- type: "text",
694
- text: `✅ UI/UX 数据已是最新版本
748
+ const upToDateData = {
749
+ summary: "UI/UX 数据已是最新版本",
750
+ status: 'success',
751
+ synced: {},
752
+ version: updateInfo.currentVersion || 'unknown',
753
+ timestamp: new Date().toISOString(),
754
+ };
755
+ return okStructured(`✅ UI/UX 数据已是最新版本
695
756
 
696
757
  **当前版本:** ${updateInfo.currentVersion}
697
758
  **最新版本:** ${updateInfo.latestVersion}
698
759
 
699
760
  无需更新。如需强制同步,请使用 \`force: true\` 参数。
700
- `,
701
- },
702
- ],
703
- };
761
+ `, upToDateData, {
762
+ schema: (await import('../schemas/output/ui-ux-tools.js')).SyncReportSchema,
763
+ });
704
764
  }
705
765
  console.log(`Update available: ${updateInfo.currentVersion || 'none'} -> ${updateInfo.latestVersion}`);
706
766
  }
@@ -715,27 +775,45 @@ export async function syncUiData(args) {
715
775
  await dataLoader.reload();
716
776
  }
717
777
  const cacheDir = dataLoader?.getCacheManager().getCacheDir() || '';
718
- return {
719
- content: [
720
- {
721
- type: "text",
722
- text: `✅ UI/UX 数据同步成功
778
+ // 获取同步的数据统计
779
+ const loader = await getDataLoader();
780
+ const searchEngine = loader.getSearchEngine();
781
+ const syncedData = {
782
+ summary: "UI/UX 数据同步成功",
783
+ status: 'success',
784
+ synced: {
785
+ colors: (searchEngine.getCategoryData('colors') || []).length,
786
+ icons: (searchEngine.getCategoryData('icons') || []).length,
787
+ components: (searchEngine.getCategoryData('products') || []).length,
788
+ patterns: (searchEngine.getCategoryData('landing') || []).length,
789
+ },
790
+ timestamp: new Date().toISOString(),
791
+ };
792
+ return okStructured(`✅ UI/UX 数据同步成功
723
793
 
724
794
  数据已更新到缓存目录: ${cacheDir}
725
795
 
796
+ **同步统计:**
797
+ - 颜色: ${syncedData.synced.colors} 条
798
+ - 图标: ${syncedData.synced.icons} 条
799
+ - 组件: ${syncedData.synced.components} 条
800
+ - 模式: ${syncedData.synced.patterns} 条
801
+
726
802
  **提示:** 数据已自动重新加载,可以立即使用最新数据。
727
- `,
728
- },
729
- ],
730
- };
803
+ `, syncedData, {
804
+ schema: (await import('../schemas/output/ui-ux-tools.js')).SyncReportSchema,
805
+ });
731
806
  }
732
807
  catch (error) {
733
808
  const errorMessage = error instanceof Error ? error.message : String(error);
734
- return {
735
- content: [
736
- {
737
- type: "text",
738
- text: `❌ UI 数据同步失败: ${errorMessage}
809
+ const errorData = {
810
+ summary: "UI 数据同步失败",
811
+ status: 'failed',
812
+ synced: {},
813
+ timestamp: new Date().toISOString(),
814
+ errors: [errorMessage],
815
+ };
816
+ return okStructured(`❌ UI 数据同步失败: ${errorMessage}
739
817
 
740
818
  **可能的原因:**
741
819
  1. 网络连接问题
@@ -747,10 +825,8 @@ export async function syncUiData(args) {
747
825
  1. 检查网络连接
748
826
  2. 稍后重试
749
827
  3. 使用 \`verbose: true\` 查看详细日志
750
- `,
751
- },
752
- ],
753
- isError: true,
754
- };
828
+ `, errorData, {
829
+ schema: (await import('../schemas/output/ui-ux-tools.js')).SyncReportSchema,
830
+ });
755
831
  }
756
832
  }