mcp-probe-kit 3.1.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.
Files changed (119) hide show
  1. package/README.md +15 -5
  2. package/build/index.js +5 -2
  3. package/build/lib/__tests__/memory-orchestration.unit.test.js +88 -0
  4. package/build/lib/__tests__/memory-payload.unit.test.js +35 -0
  5. package/build/lib/__tests__/quality-constraints.unit.test.d.ts +1 -0
  6. package/build/lib/__tests__/quality-constraints.unit.test.js +54 -0
  7. package/build/lib/__tests__/spec-validator.unit.test.d.ts +1 -0
  8. package/build/lib/__tests__/spec-validator.unit.test.js +147 -0
  9. package/build/lib/agents-md-template.js +32 -32
  10. package/build/lib/cursor-history-client.d.ts +54 -0
  11. package/build/lib/cursor-history-client.js +240 -0
  12. package/build/lib/memory-orchestration.js +29 -8
  13. package/build/lib/quality-constraints.d.ts +54 -0
  14. package/build/lib/quality-constraints.js +155 -0
  15. package/build/lib/skill-bridge.js +12 -12
  16. package/build/lib/spec-validator.d.ts +36 -0
  17. package/build/lib/spec-validator.js +116 -0
  18. package/build/lib/template-loader.js +223 -61
  19. package/build/lib/tool-annotations.d.ts +30 -0
  20. package/build/lib/tool-annotations.js +55 -0
  21. package/build/lib/toolset-manager.js +2 -0
  22. package/build/resources/ui-ux-data/guidelines/vercel-web-interface.json +1632 -1632
  23. package/build/resources/ui-ux-data/metadata.json +30 -30
  24. package/build/resources/ui-ux-data/shadcn/blocks.json +2541 -2541
  25. package/build/resources/ui-ux-data/shadcn/components.json +997 -997
  26. package/build/resources/ui-ux-data/themes/presets.json +483 -483
  27. package/build/schemas/index.d.ts +22 -0
  28. package/build/schemas/project-tools.d.ts +22 -0
  29. package/build/schemas/project-tools.js +23 -0
  30. package/build/tools/__tests__/cursor-history.unit.test.d.ts +1 -0
  31. package/build/tools/__tests__/cursor-history.unit.test.js +38 -0
  32. package/build/tools/check_spec.d.ts +7 -0
  33. package/build/tools/check_spec.js +81 -0
  34. package/build/tools/code_insight.js +41 -41
  35. package/build/tools/code_review.js +11 -4
  36. package/build/tools/cursor_read_conversation.d.ts +7 -0
  37. package/build/tools/cursor_read_conversation.js +36 -0
  38. package/build/tools/fix_bug.js +161 -161
  39. package/build/tools/gencommit.js +60 -60
  40. package/build/tools/index.d.ts +1 -0
  41. package/build/tools/index.js +1 -0
  42. package/build/tools/init_project_context.js +432 -432
  43. package/build/tools/start_bugfix.js +21 -10
  44. package/build/tools/start_feature.js +46 -11
  45. package/build/tools/start_product.js +1 -1
  46. package/build/tools/start_ui.js +44 -13
  47. package/build/tools/ui-ux-tools.d.ts +3 -0
  48. package/build/tools/ui-ux-tools.js +302 -290
  49. package/build/utils/__tests__/vercel-guidelines-sync.unit.test.js +12 -12
  50. package/build/utils/design-reasoning-engine.d.ts +2 -0
  51. package/build/utils/design-reasoning-engine.js +3 -0
  52. package/build/utils/themes-sync.js +8 -8
  53. package/package.json +4 -3
  54. package/build/resources/index.d.ts +0 -4
  55. package/build/resources/index.js +0 -4
  56. package/build/resources/tool-params-guide.d.ts +0 -571
  57. package/build/resources/tool-params-guide.js +0 -488
  58. package/build/tools/analyze_project.d.ts +0 -1
  59. package/build/tools/analyze_project.js +0 -527
  60. package/build/tools/check_deps.d.ts +0 -13
  61. package/build/tools/check_deps.js +0 -204
  62. package/build/tools/convert.d.ts +0 -13
  63. package/build/tools/convert.js +0 -599
  64. package/build/tools/css_order.d.ts +0 -13
  65. package/build/tools/css_order.js +0 -81
  66. package/build/tools/debug.d.ts +0 -13
  67. package/build/tools/debug.js +0 -131
  68. package/build/tools/design2code.d.ts +0 -20
  69. package/build/tools/design2code.js +0 -426
  70. package/build/tools/detect_shell.d.ts +0 -6
  71. package/build/tools/detect_shell.js +0 -151
  72. package/build/tools/explain.d.ts +0 -13
  73. package/build/tools/explain.js +0 -390
  74. package/build/tools/fix.d.ts +0 -13
  75. package/build/tools/fix.js +0 -303
  76. package/build/tools/gen_mock.d.ts +0 -22
  77. package/build/tools/gen_mock.js +0 -269
  78. package/build/tools/gen_skill.d.ts +0 -13
  79. package/build/tools/gen_skill.js +0 -560
  80. package/build/tools/genapi.d.ts +0 -13
  81. package/build/tools/genapi.js +0 -174
  82. package/build/tools/genchangelog.d.ts +0 -13
  83. package/build/tools/genchangelog.js +0 -250
  84. package/build/tools/gendoc.d.ts +0 -13
  85. package/build/tools/gendoc.js +0 -232
  86. package/build/tools/genpr.d.ts +0 -13
  87. package/build/tools/genpr.js +0 -194
  88. package/build/tools/genreadme.d.ts +0 -13
  89. package/build/tools/genreadme.js +0 -626
  90. package/build/tools/gensql.d.ts +0 -13
  91. package/build/tools/gensql.js +0 -320
  92. package/build/tools/genui.d.ts +0 -13
  93. package/build/tools/genui.js +0 -803
  94. package/build/tools/init_component_catalog.d.ts +0 -22
  95. package/build/tools/init_component_catalog.js +0 -809
  96. package/build/tools/init_setting.d.ts +0 -13
  97. package/build/tools/init_setting.js +0 -47
  98. package/build/tools/perf.d.ts +0 -13
  99. package/build/tools/perf.js +0 -409
  100. package/build/tools/render_ui.d.ts +0 -22
  101. package/build/tools/render_ui.js +0 -384
  102. package/build/tools/resolve_conflict.d.ts +0 -13
  103. package/build/tools/resolve_conflict.js +0 -349
  104. package/build/tools/security_scan.d.ts +0 -22
  105. package/build/tools/security_scan.js +0 -323
  106. package/build/tools/split.d.ts +0 -13
  107. package/build/tools/split.js +0 -599
  108. package/build/tools/start_api.d.ts +0 -13
  109. package/build/tools/start_api.js +0 -193
  110. package/build/tools/start_doc.d.ts +0 -13
  111. package/build/tools/start_doc.js +0 -207
  112. package/build/tools/start_refactor.d.ts +0 -13
  113. package/build/tools/start_refactor.js +0 -188
  114. package/build/tools/start_release.d.ts +0 -13
  115. package/build/tools/start_release.js +0 -167
  116. package/build/tools/start_review.d.ts +0 -13
  117. package/build/tools/start_review.js +0 -175
  118. /package/build/{utils/design-docs-generator.d.ts → lib/__tests__/memory-orchestration.unit.test.d.ts} +0 -0
  119. /package/build/{utils/design-docs-generator.js → lib/__tests__/memory-payload.unit.test.d.ts} +0 -0
@@ -425,6 +425,17 @@ ${graphContext.highlights.length > 0
425
425
  `;
426
426
  const memoryContext = await loadMemoryInjectionContext([errorMessage, stackTrace, codeContext].filter(Boolean).join("\n"), "bugfix");
427
427
  const memoryGuideSection = renderMemoryGuideSection(memoryContext);
428
+ // 记忆优先:先消化历史同类 Bug 的根因/修复(坑),再做 TBP 真因分析
429
+ const memoryRecallStep = memoryContext.enabled
430
+ ? [{
431
+ id: 'recall-memory',
432
+ tool: 'search_memory',
433
+ when: '开干前(下方「历史经验与坑」已自动注入相似历史修复;需要更多同类案例时再调)',
434
+ args: { query: errorMessage, limit: 5 },
435
+ outputs: [],
436
+ note: '先看历史同类 Bug 的根因与已验证修复,优先复用其修复路径并规避同类坑;据此收敛 TBP-4/5/6 的真因方向',
437
+ }]
438
+ : [];
428
439
  if (requirementsMode === "loop") {
429
440
  throwIfAborted(context?.signal, "start_bugfix(loop) 已取消");
430
441
  await reportToolProgress(context, 70, "start_bugfix: 生成 loop 计划");
@@ -450,6 +461,7 @@ ${graphContext.highlights.length > 0
450
461
  const plan = {
451
462
  mode: 'delegated',
452
463
  steps: [
464
+ ...memoryRecallStep,
453
465
  {
454
466
  id: 'context',
455
467
  tool: 'init_project_context',
@@ -512,19 +524,18 @@ ${graphContext.highlights.length > 0
512
524
  ],
513
525
  notes: [
514
526
  ...headerNotes,
515
- ...(memoryContext.enabled ? ['记忆系统: 已启用,历史修复经验全文已自动注入,结束后评估沉淀'] : []),
527
+ ...(memoryContext.enabled ? ['记忆优先: 已自动注入历史同类 Bug 的根因与修复(见顶部),先复用、规避同类坑;结束后评估沉淀'] : []),
516
528
  ],
517
529
  });
518
530
  const loopTemplate = profileDecision.resolved === 'strict'
519
531
  ? LOOP_PROMPT_TEMPLATE_STRICT
520
532
  : LOOP_PROMPT_TEMPLATE_GUIDED;
521
- const guide = (header + loopTemplate
533
+ const renderedLoopPrompt = loopTemplate
522
534
  .replace(/{error_message}/g, errorMessage)
523
535
  .replace(/{analysis_mode}/g, analysisMode)
524
536
  .replace(/{question_budget}/g, String(questionBudget))
525
- .replace(/{assumption_cap}/g, String(assumptionCap)))
526
- + graphGuideSection
527
- + memoryGuideSection;
537
+ .replace(/{assumption_cap}/g, String(assumptionCap));
538
+ const guide = header + memoryGuideSection + renderedLoopPrompt + graphGuideSection;
528
539
  const loopReport = {
529
540
  mode: 'loop',
530
541
  round: 1,
@@ -577,22 +588,22 @@ ${graphContext.highlights.length > 0
577
588
  ],
578
589
  notes: [
579
590
  ...headerNotes,
580
- ...(memoryContext.enabled ? ['记忆系统: 已启用,相似历史经验全文已自动注入'] : []),
591
+ ...(memoryContext.enabled ? ['记忆优先: 已自动注入历史同类 Bug 的根因与修复(见顶部),先复用、规避同类坑'] : []),
581
592
  ],
582
593
  });
583
594
  const promptTemplate = profileDecision.resolved === 'strict'
584
595
  ? PROMPT_TEMPLATE_STRICT
585
596
  : PROMPT_TEMPLATE_GUIDED;
586
- const guide = (header + promptTemplate
597
+ const renderedPrompt = promptTemplate
587
598
  .replace(/{error_message}/g, errorMessage)
588
599
  .replace(/{stack_trace}/g, stackTrace)
589
600
  .replace(/{analysis_mode}/g, analysisMode)
590
- .replace(/{stack_trace_section}/g, stackTraceSection))
591
- + graphGuideSection
592
- + memoryGuideSection;
601
+ .replace(/{stack_trace_section}/g, stackTraceSection);
602
+ const guide = header + memoryGuideSection + renderedPrompt + graphGuideSection;
593
603
  const plan = {
594
604
  mode: 'delegated',
595
605
  steps: [
606
+ ...memoryRecallStep,
596
607
  {
597
608
  id: 'context',
598
609
  tool: 'init_project_context',
@@ -91,7 +91,14 @@ const PROMPT_TEMPLATE = `# 🚀 新功能开发编排(委托式)
91
91
  - \`{docs_dir}/specs/{feature_name}/design.md\`
92
92
  - \`{docs_dir}/specs/{feature_name}/tasks.md\`
93
93
 
94
- ### 2) 工作量估算
94
+ ### 2) 校验规格完整性(闸门)
95
+ **调用**: \`check_spec\`
96
+ \`\`\`json
97
+ { "feature_name": "{feature_name}", "docs_dir": "{docs_dir}" }
98
+ \`\`\`
99
+ **未通过**:按报告逐条补全 requirements/design/tasks 后**重跑 check_spec**;**通过前不要写实现代码**。
100
+
101
+ ### 3) 工作量估算
95
102
  **调用**: \`estimate\`
96
103
  \`\`\`json
97
104
  {
@@ -305,6 +312,17 @@ ${graphContext.highlights.length > 0
305
312
  .join("\n");
306
313
  const memoryContext = await loadMemoryInjectionContext(`${featureName}\n${description}`, 'feature');
307
314
  const memoryGuideSection = renderMemoryGuideSection(memoryContext);
315
+ // 记忆优先:把"先检索消化历史经验/坑"作为编排的显式第一步
316
+ const memoryRecallStep = memoryContext.enabled
317
+ ? [{
318
+ id: 'recall-memory',
319
+ tool: 'search_memory',
320
+ when: '开干前(下方「历史经验与坑」已自动注入 top 命中;需要更多历史需求/坑时再调)',
321
+ args: { query: `${featureName} ${description}`, limit: 5 },
322
+ outputs: [],
323
+ note: '先消化历史经验与可复用模式,并逐条核对「历史坑」是否已在本次设计中规避;据此收敛需求范围,并把要点填入 requirements.md 的「历史经验与坑」节',
324
+ }]
325
+ : [];
308
326
  if (requirementsMode === "loop") {
309
327
  throwIfAborted(context?.signal, "start_feature(loop) 已取消");
310
328
  await reportToolProgress(context, 70, "start_feature: 生成 loop 计划");
@@ -330,6 +348,7 @@ ${graphContext.highlights.length > 0
330
348
  const plan = {
331
349
  mode: 'delegated',
332
350
  steps: [
351
+ ...memoryRecallStep,
333
352
  {
334
353
  id: 'context',
335
354
  tool: 'init_project_context',
@@ -369,6 +388,14 @@ ${graphContext.highlights.length > 0
369
388
  `${docsDir}/specs/${featureName}/tasks.md`,
370
389
  ],
371
390
  },
391
+ {
392
+ id: 'check-spec',
393
+ tool: 'check_spec',
394
+ when: 'stopConditions.ready=true 且 requirements/design/tasks 已落盘',
395
+ args: { feature_name: featureName, docs_dir: docsDir, ...(projectRoot ? { project_root: projectRoot } : {}) },
396
+ outputs: [],
397
+ note: '未通过则按报告补全规格后重跑 check_spec;通过前不要写实现代码',
398
+ },
372
399
  {
373
400
  id: 'estimate',
374
401
  tool: 'estimate',
@@ -392,17 +419,16 @@ ${graphContext.highlights.length > 0
392
419
  notes: [
393
420
  `模板档位: ${templateProfile}`,
394
421
  graphStatusNote,
395
- ...(memoryContext.enabled ? ['记忆系统: 已启用,历史经验全文已自动注入,结束后评估是否沉淀'] : []),
422
+ ...(memoryContext.enabled ? ['记忆优先: 已自动注入历史经验与坑(见顶部),开干前先消化、约束范围并规避同类坑;结束后评估是否沉淀'] : []),
396
423
  ],
397
424
  });
398
- const guide = (header + LOOP_PROMPT_TEMPLATE
425
+ const renderedLoopPrompt = LOOP_PROMPT_TEMPLATE
399
426
  .replace(/{feature_name}/g, featureName)
400
427
  .replace(/{description}/g, description)
401
428
  .replace(/{project_root}/g, toWorkspacePath(projectRoot))
402
429
  .replace(/{question_budget}/g, String(questionBudget))
403
- .replace(/{assumption_cap}/g, String(assumptionCap)))
404
- + graphGuideSection
405
- + memoryGuideSection;
430
+ .replace(/{assumption_cap}/g, String(assumptionCap));
431
+ const guide = header + memoryGuideSection + renderedLoopPrompt + graphGuideSection;
406
432
  const loopReport = {
407
433
  mode: 'loop',
408
434
  round: 1,
@@ -452,20 +478,20 @@ ${graphContext.highlights.length > 0
452
478
  notes: [
453
479
  `模板档位: ${templateProfile}`,
454
480
  graphStatusNote,
455
- ...(memoryContext.enabled ? ['记忆系统: 已启用,历史经验全文已自动注入'] : []),
481
+ ...(memoryContext.enabled ? ['记忆优先: 已自动注入历史经验与坑(见顶部),开干前先消化、约束范围并规避同类坑'] : []),
456
482
  ],
457
483
  });
458
- const guide = (header + PROMPT_TEMPLATE
484
+ const renderedPrompt = PROMPT_TEMPLATE
459
485
  .replace(/{feature_name}/g, featureName)
460
486
  .replace(/{description}/g, description)
461
487
  .replace(/{docs_dir}/g, docsDir)
462
488
  .replace(/{project_root}/g, (projectRoot || process.cwd()).replace(/\\/g, "/"))
463
- .replace(/{template_profile}/g, templateProfile))
464
- + graphGuideSection
465
- + memoryGuideSection;
489
+ .replace(/{template_profile}/g, templateProfile);
490
+ const guide = header + memoryGuideSection + renderedPrompt + graphGuideSection;
466
491
  const plan = {
467
492
  mode: 'delegated',
468
493
  steps: [
494
+ ...memoryRecallStep,
469
495
  {
470
496
  id: 'context',
471
497
  tool: 'init_project_context',
@@ -487,6 +513,14 @@ ${graphContext.highlights.length > 0
487
513
  `${docsDir}/specs/${featureName}/tasks.md`,
488
514
  ],
489
515
  },
516
+ {
517
+ id: 'check-spec',
518
+ tool: 'check_spec',
519
+ when: 'requirements/design/tasks 落盘后、进入估算/实现前',
520
+ args: { feature_name: featureName, docs_dir: docsDir, ...(projectRoot ? { project_root: projectRoot } : {}) },
521
+ outputs: [],
522
+ note: '未通过则按报告逐条补全规格后重跑 check_spec;通过前不要写实现代码',
523
+ },
490
524
  {
491
525
  id: 'estimate',
492
526
  tool: 'estimate',
@@ -526,6 +560,7 @@ ${graphContext.highlights.length > 0
526
560
  `如果缺少 ${graphDocs.latestMarkdownPath} / ${graphDocs.latestJsonPath},先调用 init_project_context 补齐图谱初始化`,
527
561
  `优先读取 ${graphDocs.latestMarkdownPath} 获取模块依赖与调用链摘要`,
528
562
  '调用 add_feature 工具生成功能规格文档',
563
+ '调用 check_spec 校验规格完整性,未通过先补全再重跑(通过前不要写实现代码)',
529
564
  '调用 estimate 工具进行工作量估算',
530
565
  '按照 tasks.md 开始开发',
531
566
  ],
@@ -89,7 +89,7 @@ export async function startProduct(args, context) {
89
89
  ],
90
90
  notes: [buildSkillHeaderNote(skillBridge)],
91
91
  });
92
- const guidanceText = header + skillBridgeSection + `# 🚀 产品设计工作流执行指导
92
+ const guidanceText = header + skillBridgeSection + `# 🚀 产品设计工作流执行指导
93
93
 
94
94
  基于${requirementsSource},请按照以下步骤完成从需求到 HTML 原型的完整产品设计流程。
95
95
 
@@ -18,6 +18,17 @@ import { resolveWorkspaceRoot, isLikelyProjectNamedRelativePath, buildProjectRoo
18
18
  import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
19
19
  import { buildMemoryPlanStep, loadMemoryInjectionContext, renderMemoryGuideSection, } from "../lib/memory-orchestration.js";
20
20
  import { isShadcnStack } from "../lib/shadcn-ui.js";
21
+ import { renderUiHardRules, renderUiBannedList, renderPreFlightChecklist } from "../lib/quality-constraints.js";
22
+ /** 渲染代码步骤统一注入的 UI 硬约束 + 黑名单 + 交付前自检 */
23
+ const UI_CONSTRAINTS_BLOCK = `
24
+
25
+ ---
26
+
27
+ ${renderUiHardRules()}
28
+
29
+ ${renderUiBannedList()}
30
+
31
+ ${renderPreFlightChecklist()}`;
21
32
  function buildShadcnBlocksPlanStep(description, framework) {
22
33
  if (!isShadcnStack(framework)) {
23
34
  return [];
@@ -262,6 +273,10 @@ A: 不需要。如果文件已存在,直接跳过步骤 1。
262
273
 
263
274
  **Q: 如何使用自定义模板?**
264
275
  A: 在 \`docs/ui/\` 目录创建 JSON 模板文件,然后在步骤 4 中指定模板路径。
276
+
277
+ ---
278
+
279
+ ${UI_CONSTRAINTS_BLOCK}
265
280
  `;
266
281
  const PROMPT_TEMPLATE_STRICT = `# UI 开发编排(严格)
267
282
 
@@ -339,6 +354,8 @@ const PROMPT_TEMPLATE_STRICT = `# UI 开发编排(严格)
339
354
  ## 步骤 7: 更新项目上下文索引
340
355
 
341
356
  将 UI 文档链接添加到 \`docs/project-context.md\`
357
+
358
+ ${UI_CONSTRAINTS_BLOCK}
342
359
  `;
343
360
  const LOOP_PROMPT_TEMPLATE_GUIDED = `# 🧭 UI 需求澄清与补全(Requirements Loop)
344
361
 
@@ -565,6 +582,17 @@ export async function startUi(args, context) {
565
582
  headerNotes.push(buildSkillHeaderNote(skillBridge));
566
583
  const memoryContext = await loadMemoryInjectionContext(description || templateName, 'ui');
567
584
  const memoryGuideSection = renderMemoryGuideSection(memoryContext);
585
+ // 记忆优先:先复用历史 UI 资产/模式并规避历史 UI 坑,再进入设计与渲染
586
+ const memoryRecallStep = memoryContext.enabled
587
+ ? [{
588
+ id: 'recall-memory',
589
+ tool: 'search_memory',
590
+ when: '开干前(下方「历史经验与坑」已自动注入相似 UI 资产与坑;需要更多时再调)',
591
+ args: { query: description || templateName, limit: 5 },
592
+ outputs: [],
593
+ note: '先复用历史可复用 UI 组件/布局/交互模式,并规避历史 UI 坑(交互/兼容性/可访问性)',
594
+ }]
595
+ : [];
568
596
  // 验证 mode 参数
569
597
  const validModes = ["auto", "manual"];
570
598
  if (mode && !validModes.includes(mode)) {
@@ -629,6 +657,7 @@ start_ui <描述> --requirements_mode=loop
629
657
  const plan = {
630
658
  mode: 'delegated',
631
659
  steps: [
660
+ ...memoryRecallStep,
632
661
  skillBridgeStep,
633
662
  {
634
663
  id: 'loop-1',
@@ -712,17 +741,17 @@ start_ui <描述> --requirements_mode=loop
712
741
  ],
713
742
  notes: [
714
743
  ...headerNotes,
715
- ...(memoryContext.enabled ? ['记忆系统: 已启用,先复用历史 UI 资产,再决定是否沉淀本次结果'] : []),
744
+ ...(memoryContext.enabled ? ['记忆优先: 已自动注入相似历史 UI 资产与坑(见顶部),先复用并规避同类坑;再决定是否沉淀'] : []),
716
745
  ],
717
746
  });
718
747
  const loopTemplate = profileDecision.resolved === 'strict'
719
748
  ? LOOP_PROMPT_TEMPLATE_STRICT
720
749
  : LOOP_PROMPT_TEMPLATE_GUIDED;
721
- const guide = header + skillBridgeSection + loopTemplate
750
+ const renderedLoopPrompt = loopTemplate
722
751
  .replace(/{description}/g, description)
723
752
  .replace(/{question_budget}/g, String(questionBudget))
724
- .replace(/{assumption_cap}/g, String(assumptionCap))
725
- + memoryGuideSection;
753
+ .replace(/{assumption_cap}/g, String(assumptionCap));
754
+ const guide = header + memoryGuideSection + skillBridgeSection + renderedLoopPrompt;
726
755
  const loopReport = {
727
756
  mode: 'loop',
728
757
  round: 1,
@@ -862,6 +891,7 @@ ${recommendation.reasoning}
862
891
  const plan = {
863
892
  mode: 'delegated',
864
893
  steps: [
894
+ ...memoryRecallStep,
865
895
  skillBridgeStep,
866
896
  {
867
897
  id: 'context',
@@ -929,10 +959,10 @@ ${recommendation.reasoning}
929
959
  ],
930
960
  notes: [
931
961
  ...headerNotes,
932
- ...(memoryContext.enabled ? ['记忆系统: 已启用,相似历史 UI 经验全文已自动注入'] : []),
962
+ ...(memoryContext.enabled ? ['记忆优先: 已自动注入相似历史 UI 资产与坑(见顶部),先复用并规避同类坑'] : []),
933
963
  ],
934
964
  });
935
- const smartPlan = header + skillBridgeSection + (profileDecision.resolved === 'strict' ? smartPlanStrict : smartPlanGuided) + memoryGuideSection;
965
+ const smartPlan = header + memoryGuideSection + skillBridgeSection + (profileDecision.resolved === 'strict' ? smartPlanStrict : smartPlanGuided);
936
966
  // Create structured UI report for auto mode
937
967
  const uiReport = {
938
968
  summary: `智能 UI 开发:${description}`,
@@ -1060,21 +1090,22 @@ start_ui "设置页面" --framework=react
1060
1090
  ],
1061
1091
  notes: [
1062
1092
  ...headerNotes,
1063
- ...(memoryContext.enabled ? ['记忆系统: 已启用,相似历史 UI 经验全文已自动注入'] : []),
1093
+ ...(memoryContext.enabled ? ['记忆优先: 已自动注入相似历史 UI 资产与坑(见顶部),先复用并规避同类坑'] : []),
1064
1094
  ],
1065
1095
  });
1066
1096
  const baseTemplate = profileDecision.resolved === 'strict'
1067
1097
  ? PROMPT_TEMPLATE_STRICT
1068
1098
  : PROMPT_TEMPLATE_GUIDED;
1069
- let guide = header + skillBridgeSection + baseTemplate;
1070
- guide = safeReplace(guide, '{description}', escapeJson(description));
1071
- guide = safeReplace(guide, '{productType}', productType);
1072
- guide = safeReplace(guide, '{framework}', framework);
1073
- guide = safeReplace(guide, '{templateName}', templateName);
1074
- guide += memoryGuideSection;
1099
+ let body = skillBridgeSection + baseTemplate;
1100
+ body = safeReplace(body, '{description}', escapeJson(description));
1101
+ body = safeReplace(body, '{productType}', productType);
1102
+ body = safeReplace(body, '{framework}', framework);
1103
+ body = safeReplace(body, '{templateName}', templateName);
1104
+ const guide = header + memoryGuideSection + body;
1075
1105
  const plan = {
1076
1106
  mode: 'delegated',
1077
1107
  steps: [
1108
+ ...memoryRecallStep,
1078
1109
  skillBridgeStep,
1079
1110
  {
1080
1111
  id: 'context',
@@ -26,6 +26,9 @@ export interface CreationGuidance {
26
26
  layout: string[];
27
27
  config: string[];
28
28
  tips: string[];
29
+ hardRules: string;
30
+ banned: string;
31
+ preFlight: string;
29
32
  }
30
33
  /**
31
34
  * UI 设计系统输出接口(重构版)