mcp-probe-kit 2.3.0 → 2.5.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 (186) hide show
  1. package/README.md +131 -48
  2. package/build/index.js +1 -7
  3. package/build/lib/guidance.d.ts +8 -0
  4. package/build/lib/guidance.js +30 -0
  5. package/build/lib/orchestration-guidance.d.ts +8 -0
  6. package/build/lib/orchestration-guidance.js +16 -0
  7. package/build/lib/template-loader.d.ts +25 -0
  8. package/build/lib/template-loader.js +473 -0
  9. package/build/lib/toolset-manager.d.ts +4 -4
  10. package/build/lib/toolset-manager.js +10 -13
  11. package/build/schemas/code-analysis-tools.d.ts +0 -18
  12. package/build/schemas/code-analysis-tools.js +0 -19
  13. package/build/schemas/doc-util-tools.d.ts +0 -9
  14. package/build/schemas/doc-util-tools.js +0 -10
  15. package/build/schemas/index.d.ts +46 -47
  16. package/build/schemas/orchestration-tools.d.ts +42 -2
  17. package/build/schemas/orchestration-tools.js +42 -2
  18. package/build/schemas/output/core-tools.d.ts +1 -117
  19. package/build/schemas/output/core-tools.js +1 -60
  20. package/build/schemas/output/index.d.ts +5 -4
  21. package/build/schemas/output/index.js +6 -4
  22. package/build/schemas/output/product-design-tools.d.ts +160 -0
  23. package/build/schemas/output/product-design-tools.js +75 -0
  24. package/build/schemas/output/project-tools.d.ts +1 -217
  25. package/build/schemas/output/project-tools.js +1 -103
  26. package/build/schemas/project-tools.d.ts +4 -18
  27. package/build/schemas/project-tools.js +4 -19
  28. package/build/schemas/structured-output.d.ts +309 -99
  29. package/build/schemas/structured-output.js +174 -72
  30. package/build/schemas/ui-ux-schemas.d.ts +26 -0
  31. package/build/schemas/ui-ux-schemas.js +26 -0
  32. package/build/tools/__tests__/add_feature.template.test.d.ts +4 -0
  33. package/build/tools/__tests__/add_feature.template.test.js +47 -0
  34. package/build/tools/__tests__/start_bugfix.unit.test.d.ts +4 -0
  35. package/build/tools/__tests__/start_bugfix.unit.test.js +85 -0
  36. package/build/tools/__tests__/start_feature.unit.test.d.ts +4 -0
  37. package/build/tools/__tests__/start_feature.unit.test.js +83 -0
  38. package/build/tools/__tests__/start_ui.integration.test.js +4 -3
  39. package/build/tools/__tests__/start_ui.loop.test.d.ts +4 -0
  40. package/build/tools/__tests__/start_ui.loop.test.js +24 -0
  41. package/build/tools/__tests__/start_ui.unit.test.js +39 -1
  42. package/build/tools/add_feature.js +184 -406
  43. package/build/tools/ask_user.js +18 -5
  44. package/build/tools/code_review.js +8 -1
  45. package/build/tools/estimate.js +9 -2
  46. package/build/tools/fix_bug.js +9 -2
  47. package/build/tools/gen_mock.js +8 -1
  48. package/build/tools/gen_prd.d.ts +1 -7
  49. package/build/tools/gen_prd.js +41 -27
  50. package/build/tools/gen_prototype.d.ts +1 -7
  51. package/build/tools/gen_prototype.js +47 -27
  52. package/build/tools/genapi.js +8 -1
  53. package/build/tools/genchangelog.js +8 -1
  54. package/build/tools/gencommit.d.ts +1 -1
  55. package/build/tools/gencommit.js +49 -18
  56. package/build/tools/gendoc.js +9 -1
  57. package/build/tools/genpr.js +8 -1
  58. package/build/tools/genreadme.js +8 -1
  59. package/build/tools/gensql.js +8 -1
  60. package/build/tools/gentest.js +8 -1
  61. package/build/tools/index.d.ts +0 -3
  62. package/build/tools/index.js +0 -3
  63. package/build/tools/interview.d.ts +1 -13
  64. package/build/tools/interview.js +96 -31
  65. package/build/tools/perf.js +8 -1
  66. package/build/tools/refactor.js +8 -1
  67. package/build/tools/resolve_conflict.js +8 -1
  68. package/build/tools/security_scan.js +9 -2
  69. package/build/tools/start_api.js +44 -4
  70. package/build/tools/start_bugfix.js +377 -15
  71. package/build/tools/start_doc.js +40 -4
  72. package/build/tools/start_feature.js +287 -92
  73. package/build/tools/start_onboard.js +83 -100
  74. package/build/tools/start_product.d.ts +1 -1
  75. package/build/tools/start_product.js +183 -6
  76. package/build/tools/start_ralph.js +51 -2
  77. package/build/tools/start_refactor.js +39 -4
  78. package/build/tools/start_release.js +33 -4
  79. package/build/tools/start_review.js +39 -4
  80. package/build/tools/start_ui.js +669 -52
  81. package/build/utils/design-reasoning-engine.d.ts +5 -0
  82. package/build/utils/design-reasoning-engine.js +85 -5
  83. package/docs/data/tools.js +308 -478
  84. package/docs/index.html +1 -1
  85. package/docs/pages/all-tools.html +37 -22
  86. package/docs/pages/examples.html +100 -35
  87. package/docs/pages/getting-started.html +43 -3
  88. package/docs/pages/migration.html +14 -8
  89. package/package.json +79 -79
  90. package/build/lib/analysis-tasks.d.ts +0 -35
  91. package/build/lib/analysis-tasks.js +0 -788
  92. package/build/lib/elicitation-helper.d.ts +0 -73
  93. package/build/lib/elicitation-helper.js +0 -130
  94. package/build/lib/task-generator.d.ts +0 -11
  95. package/build/lib/task-generator.js +0 -109
  96. package/build/lib/template-generator.d.ts +0 -14
  97. package/build/lib/template-generator.js +0 -62
  98. package/build/lib/templates/backend-templates.d.ts +0 -8
  99. package/build/lib/templates/backend-templates.js +0 -26
  100. package/build/resources/index.d.ts +0 -4
  101. package/build/resources/index.js +0 -4
  102. package/build/resources/tool-params-guide.d.ts +0 -571
  103. package/build/resources/tool-params-guide.js +0 -488
  104. package/build/tools/analyze_project.d.ts +0 -1
  105. package/build/tools/analyze_project.js +0 -566
  106. package/build/tools/check_deps.d.ts +0 -1
  107. package/build/tools/check_deps.js +0 -213
  108. package/build/tools/convert.d.ts +0 -13
  109. package/build/tools/convert.js +0 -599
  110. package/build/tools/css_order.d.ts +0 -13
  111. package/build/tools/css_order.js +0 -81
  112. package/build/tools/debug.d.ts +0 -1
  113. package/build/tools/debug.js +0 -133
  114. package/build/tools/design2code.d.ts +0 -20
  115. package/build/tools/design2code.js +0 -426
  116. package/build/tools/detect_shell.d.ts +0 -6
  117. package/build/tools/detect_shell.js +0 -151
  118. package/build/tools/explain.d.ts +0 -13
  119. package/build/tools/explain.js +0 -390
  120. package/build/tools/fix.d.ts +0 -13
  121. package/build/tools/fix.js +0 -303
  122. package/build/tools/gen_skill.d.ts +0 -13
  123. package/build/tools/gen_skill.js +0 -560
  124. package/build/tools/genui.d.ts +0 -13
  125. package/build/tools/genui.js +0 -803
  126. package/build/tools/init_setting.d.ts +0 -13
  127. package/build/tools/init_setting.js +0 -47
  128. package/build/tools/split.d.ts +0 -13
  129. package/build/tools/split.js +0 -599
  130. package/build/tools/templates/architecture-template.d.ts +0 -5
  131. package/build/tools/templates/architecture-template.js +0 -42
  132. package/build/tools/templates/coding-standards-template.d.ts +0 -5
  133. package/build/tools/templates/coding-standards-template.js +0 -41
  134. package/build/tools/templates/dependencies-template.d.ts +0 -5
  135. package/build/tools/templates/dependencies-template.js +0 -38
  136. package/build/tools/templates/index-template.d.ts +0 -5
  137. package/build/tools/templates/index-template.js +0 -64
  138. package/build/tools/templates/tech-stack-template.d.ts +0 -5
  139. package/build/tools/templates/tech-stack-template.js +0 -35
  140. package/build/tools/templates/workflows-template.d.ts +0 -5
  141. package/build/tools/templates/workflows-template.js +0 -31
  142. package/docs/specs/algorithm-enhancement/roadmap.md +0 -619
  143. package/docs/specs/project-context-modular/design.md +0 -722
  144. package/docs/specs/project-context-modular/example-output.md +0 -123
  145. package/docs/specs/project-context-modular/implementation-v2.md +0 -275
  146. package/docs/specs/project-context-modular/requirements.md +0 -234
  147. package/docs/specs/project-context-modular/tasks.md +0 -386
  148. package/docs/specs/v2.1-planning.md +0 -335
  149. package/docs/specs/vnext-upgrade/00-OVERVIEW.md +0 -258
  150. package/docs/specs/vnext-upgrade/BETA_RELEASE_GUIDE.md +0 -328
  151. package/docs/specs/vnext-upgrade/GITHUB_DISCUSSION_TEMPLATE.md +0 -236
  152. package/docs/specs/vnext-upgrade/M8.9-PROGRESS-UPDATE.md +0 -248
  153. package/docs/specs/vnext-upgrade/PROGRESS-SUMMARY.md +0 -195
  154. package/docs/specs/vnext-upgrade/QUICK_REFERENCE.md +0 -338
  155. package/docs/specs/vnext-upgrade/README.md +0 -125
  156. package/docs/specs/vnext-upgrade/STATUS-UPDATE-2026-01-26.md +0 -230
  157. package/docs/specs/vnext-upgrade/TOOL_CLEANUP.md +0 -343
  158. package/docs/specs/vnext-upgrade/completed/M1-M2-SUMMARY.md +0 -27
  159. package/docs/specs/vnext-upgrade/completed/M3_COMPLETION_SUMMARY.md +0 -273
  160. package/docs/specs/vnext-upgrade/completed/M4-SUMMARY.md +0 -19
  161. package/docs/specs/vnext-upgrade/completed/M5_COMPLETION_SUMMARY.md +0 -0
  162. package/docs/specs/vnext-upgrade/completed/M8.1-SUMMARY.md +0 -247
  163. package/docs/specs/vnext-upgrade/completed/M8.2-SUMMARY.md +0 -296
  164. package/docs/specs/vnext-upgrade/completed/M8.3-SUMMARY.md +0 -241
  165. package/docs/specs/vnext-upgrade/completed/M8.3-TEST-SUMMARY.md +0 -216
  166. package/docs/specs/vnext-upgrade/completed/M8.4-SUMMARY.md +0 -217
  167. package/docs/specs/vnext-upgrade/completed/M8.4-TEST-SUMMARY.md +0 -198
  168. package/docs/specs/vnext-upgrade/completed/M8.5-SUMMARY.md +0 -202
  169. package/docs/specs/vnext-upgrade/completed/M8.5-TEST-SUMMARY.md +0 -223
  170. package/docs/specs/vnext-upgrade/completed/M8.6-SUMMARY.md +0 -299
  171. package/docs/specs/vnext-upgrade/completed/M8.8-TEST-SUMMARY.md +0 -216
  172. package/docs/specs/vnext-upgrade/completed/TOOL-CLEANUP-SUMMARY.md +0 -210
  173. package/docs/specs/vnext-upgrade/design.md +0 -848
  174. package/docs/specs/vnext-upgrade/requirements.md +0 -221
  175. package/docs/specs/vnext-upgrade/tasks/00-INDEX.md +0 -335
  176. package/docs/specs/vnext-upgrade/tasks/M8.1-SCHEMA-DEFINITION.md +0 -300
  177. package/docs/specs/vnext-upgrade/tasks/M8.2-P1-TOOLS.md +0 -249
  178. package/docs/specs/vnext-upgrade/tasks/M8.3-GENERATION-TOOLS.md +0 -49
  179. package/docs/specs/vnext-upgrade/tasks/M8.4-ORCHESTRATION-TOOLS.md +0 -28
  180. package/docs/specs/vnext-upgrade/tasks/M8.5-PROJECT-TOOLS.md +0 -29
  181. package/docs/specs/vnext-upgrade/tasks/M8.6-UI-TOOLS.md +0 -66
  182. package/docs/specs/vnext-upgrade/tasks/M8.7-HELPER-TOOLS.md +0 -24
  183. package/docs/specs/vnext-upgrade/tasks/M8.8-INTEGRATION-TESTS.md +0 -90
  184. package/docs/specs/vnext-upgrade/tasks/M8.9-DOCUMENTATION.md +0 -103
  185. package/docs/vnext/MCP_2025-11-25_GUIDE.md +0 -276
  186. package/docs/vnext/vNext-PRD.md +0 -488
@@ -0,0 +1,473 @@
1
+ import { promises as fs } from 'fs';
2
+ import { existsSync } from 'fs';
3
+ import { dirname, join, resolve } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ const DEFAULT_PROFILE = 'guided';
6
+ const TEMPLATE_VALIDATORS = {
7
+ 'specs/feature/requirements.md': {
8
+ requiredSections: ['功能概述', '需求列表', '非功能需求', '依赖关系'],
9
+ requiredFields: ['用户故事', '验收标准'],
10
+ minAcceptanceCount: 1,
11
+ },
12
+ 'specs/feature/design.md': {
13
+ requiredSections: ['概述', '技术方案', '数据模型', 'API 设计', '文件结构', '设计决策', '风险评估'],
14
+ requiredFields: ['技术选型'],
15
+ },
16
+ 'specs/feature/tasks.md': {
17
+ requiredSections: ['概述', '任务列表', '检查点', '文件变更清单'],
18
+ requiredFields: ['阶段 1', '阶段 2', '阶段 3'],
19
+ },
20
+ };
21
+ const EMBEDDED_TEMPLATES = {
22
+ 'specs/feature/guided/requirements.md': `# 需求文档:{feature_name}
23
+
24
+ ## 功能概述
25
+
26
+ {description}
27
+
28
+ ## 术语定义
29
+
30
+ - **[术语1]**: [填写:定义]
31
+ - **[术语2]**: [填写:定义]
32
+
33
+ ---
34
+
35
+ ## 需求列表
36
+
37
+ ### 需求 1: [填写:需求标题]
38
+
39
+ **用户故事:** 作为 [填写:角色],我想要 [填写:功能],以便 [填写:目标]。
40
+
41
+ #### 验收标准
42
+
43
+ 1. WHEN [填写:触发条件] THEN 系统 SHALL [填写:响应]
44
+ 2. WHILE [填写:状态条件] THE 系统 SHALL [填写:响应]
45
+ 3. IF [填写:异常条件] THEN 系统 SHALL [填写:处理方式]
46
+
47
+ ---
48
+
49
+ ## 非功能需求
50
+
51
+ ### 性能要求
52
+ - [填写:性能相关需求]
53
+
54
+ ### 安全要求
55
+ - [填写:安全相关需求]
56
+
57
+ ### 兼容性要求
58
+ - [填写:兼容性相关需求]
59
+
60
+ ---
61
+
62
+ ## 依赖关系
63
+
64
+ - [填写:列出与其他功能的依赖]
65
+
66
+ ---
67
+
68
+ ## 检查清单
69
+
70
+ - [ ] 需求覆盖核心场景与边界场景
71
+ - [ ] 验收标准使用 EARS 格式
72
+ - [ ] 非功能需求明确
73
+ - [ ] 依赖关系完整
74
+ `,
75
+ 'specs/feature/guided/design.md': `# 设计文档:{feature_name}
76
+
77
+ ## 概述
78
+
79
+ {description}
80
+
81
+ 本设计文档描述 {feature_name} 功能的技术实现方案。
82
+
83
+ ---
84
+
85
+ ## 技术方案
86
+
87
+ ### 技术选型
88
+
89
+ | 类别 | 选择 | 理由 |
90
+ |------|------|------|
91
+ | [填写:类别] | [填写:技术] | [填写:选择理由] |
92
+
93
+ ### 架构设计
94
+
95
+ [填写:描述功能的架构设计,参考项目现有架构]
96
+
97
+ \`\`\`
98
+ [填写:架构图或流程图,使用 ASCII 或 Mermaid]
99
+ \`\`\`
100
+
101
+ ---
102
+
103
+ ## 数据模型
104
+
105
+ [填写:如果功能涉及数据存储,描述数据模型]
106
+
107
+ ---
108
+
109
+ ## API 设计
110
+
111
+ [填写:如果功能涉及 API,描述 API 设计]
112
+
113
+ ---
114
+
115
+ ## 文件结构
116
+
117
+ [填写:描述功能涉及的文件和目录]
118
+
119
+ \`\`\`
120
+ [项目目录]/
121
+ ├── [填写:新增文件1]
122
+ ├── [填写:新增文件2]
123
+ └── [填写:修改文件]
124
+ \`\`\`
125
+
126
+ ---
127
+
128
+ ## 设计决策
129
+
130
+ ### 决策 1: [填写:决策标题]
131
+
132
+ **问题**: [填写:描述面临的问题]
133
+
134
+ **选项**:
135
+ 1. [填写:选项 A]: [填写:描述]
136
+ 2. [填写:选项 B]: [填写:描述]
137
+
138
+ **决策**: 选择 [填写:选项]
139
+
140
+ **理由**: [填写:解释选择的理由]
141
+
142
+ ---
143
+
144
+ ## 风险评估
145
+
146
+ | 风险 | 影响 | 缓解措施 |
147
+ |------|------|----------|
148
+ | [填写:风险描述] | [填写:高/中/低] | [填写:缓解措施] |
149
+
150
+ ---
151
+
152
+ ## 检查清单
153
+
154
+ - [ ] 技术方案与现有架构一致
155
+ - [ ] 数据模型与接口定义清晰
156
+ - [ ] 关键设计决策已记录
157
+ `,
158
+ 'specs/feature/guided/tasks.md': `# 任务清单:{feature_name}
159
+
160
+ ## 概述
161
+
162
+ 实现 {feature_name} 功能的任务分解。
163
+
164
+ ---
165
+
166
+ ## 任务列表
167
+
168
+ ### 阶段 1: 准备工作
169
+
170
+ - [ ] 1.1 [填写:任务标题]
171
+ - [填写:具体操作说明]
172
+ - _需求: [填写:对应的需求编号]_
173
+
174
+ ---
175
+
176
+ ### 阶段 2: 核心实现
177
+
178
+ - [ ] 2.1 [填写:任务标题]
179
+ - [填写:具体操作说明]
180
+ - _需求: [填写:对应的需求编号]_
181
+
182
+ ---
183
+
184
+ ### 阶段 3: 集成测试
185
+
186
+ - [ ] 3.1 [填写:任务标题]
187
+ - [填写:具体操作说明]
188
+ - _需求: [填写:对应的需求编号]_
189
+
190
+ ---
191
+
192
+ ## 检查点
193
+
194
+ - [ ] 阶段 1 完成后:[填写:验证内容]
195
+ - [ ] 阶段 2 完成后:[填写:验证内容]
196
+ - [ ] 阶段 3 完成后:[填写:验证内容]
197
+
198
+ ---
199
+
200
+ ## 文件变更清单
201
+
202
+ | 文件 | 操作 | 说明 |
203
+ |------|------|------|
204
+ | [填写:文件路径] | 新建/修改 | [填写:说明] |
205
+
206
+ ---
207
+
208
+ ## 检查清单
209
+
210
+ - [ ] 任务分阶段合理
211
+ - [ ] 每项任务可执行且可验证
212
+ - [ ] 任务与需求一一对应
213
+ `,
214
+ 'specs/feature/strict/requirements.md': `# 需求文档:{feature_name}
215
+
216
+ ## 功能概述
217
+
218
+ {description}
219
+
220
+ ---
221
+
222
+ ## 需求列表
223
+
224
+ ### 需求 1: [填写:需求标题]
225
+
226
+ **用户故事:** 作为 [填写:角色],我想要 [填写:功能],以便 [填写:目标]。
227
+
228
+ #### 验收标准
229
+
230
+ 1. WHEN [填写:触发条件] THEN 系统 SHALL [填写:响应]
231
+ 2. IF [填写:异常条件] THEN 系统 SHALL [填写:处理方式]
232
+
233
+ ---
234
+
235
+ ## 非功能需求
236
+
237
+ - [填写:性能/安全/兼容性]
238
+
239
+ ---
240
+
241
+ ## 依赖关系
242
+
243
+ - [填写:列出依赖]
244
+ `,
245
+ 'specs/feature/strict/design.md': `# 设计文档:{feature_name}
246
+
247
+ ## 概述
248
+
249
+ {description}
250
+
251
+ ---
252
+
253
+ ## 技术方案
254
+
255
+ ### 技术选型
256
+
257
+ | 类别 | 选择 | 理由 |
258
+ |------|------|------|
259
+ | [填写:类别] | [填写:技术] | [填写:理由] |
260
+
261
+ ### 架构设计
262
+
263
+ [填写:架构说明]
264
+
265
+ ---
266
+
267
+ ## 数据模型
268
+
269
+ [填写:数据结构或表设计]
270
+
271
+ ---
272
+
273
+ ## API 设计
274
+
275
+ | 方法 | 路径 | 描述 |
276
+ |------|------|------|
277
+ | [填写:GET/POST/...] | [填写:/path] | [填写:描述] |
278
+
279
+ ---
280
+
281
+ ## 文件结构
282
+
283
+ [填写:涉及的文件]
284
+
285
+ ---
286
+
287
+ ## 设计决策
288
+
289
+ ### 决策 1: [填写:决策标题]
290
+
291
+ **问题**: [填写:问题]
292
+ **选项**: [填写:选项]
293
+ **决策**: [填写:结论]
294
+
295
+ ---
296
+
297
+ ## 风险评估
298
+
299
+ | 风险 | 影响 | 缓解措施 |
300
+ |------|------|----------|
301
+ | [填写:风险描述] | [填写:高/中/低] | [填写:缓解措施] |
302
+ `,
303
+ 'specs/feature/strict/tasks.md': `# 任务清单:{feature_name}
304
+
305
+ ## 概述
306
+
307
+ 实现 {feature_name} 的任务分解。
308
+
309
+ ---
310
+
311
+ ## 任务列表
312
+
313
+ ### 阶段 1: 准备工作
314
+
315
+ - [ ] 1.1 [填写:任务标题]
316
+
317
+ ---
318
+
319
+ ### 阶段 2: 核心实现
320
+
321
+ - [ ] 2.1 [填写:任务标题]
322
+
323
+ ---
324
+
325
+ ### 阶段 3: 集成测试
326
+
327
+ - [ ] 3.1 [填写:任务标题]
328
+
329
+ ---
330
+
331
+ ## 检查点
332
+
333
+ - [ ] 阶段 1 完成后:[填写:验证内容]
334
+ - [ ] 阶段 2 完成后:[填写:验证内容]
335
+ - [ ] 阶段 3 完成后:[填写:验证内容]
336
+
337
+ ---
338
+
339
+ ## 文件变更清单
340
+
341
+ | 文件 | 操作 | 说明 |
342
+ |------|------|------|
343
+ | [填写:文件路径] | 新建/修改 | [填写:说明] |
344
+ `,
345
+ };
346
+ export function normalizeTemplateProfile(input) {
347
+ const normalized = (input || '').toLowerCase().trim();
348
+ if (normalized === 'strict') {
349
+ return 'strict';
350
+ }
351
+ return DEFAULT_PROFILE;
352
+ }
353
+ function findPackageRoot(startDir) {
354
+ let current = startDir;
355
+ for (let i = 0; i < 8; i += 1) {
356
+ if (existsSync(join(current, 'package.json'))) {
357
+ return current;
358
+ }
359
+ const parent = dirname(current);
360
+ if (parent === current) {
361
+ break;
362
+ }
363
+ current = parent;
364
+ }
365
+ return startDir;
366
+ }
367
+ function getPackageRoot() {
368
+ const moduleFile = fileURLToPath(import.meta.url);
369
+ const moduleDir = dirname(moduleFile);
370
+ return findPackageRoot(moduleDir);
371
+ }
372
+ function buildTemplateKey(category, name, file) {
373
+ return `${category}/${name}/${file}`;
374
+ }
375
+ function getValidator(category, name, file) {
376
+ const key = buildTemplateKey(category, name, file);
377
+ return TEMPLATE_VALIDATORS[key];
378
+ }
379
+ function validateTemplate(content, rule) {
380
+ const missingSections = [];
381
+ const missingFields = [];
382
+ const warnings = [];
383
+ if (rule) {
384
+ for (const section of rule.requiredSections) {
385
+ const sectionPattern = new RegExp(`^#{1,6}\\s+${escapeRegExp(section)}\\s*$`, 'm');
386
+ if (!sectionPattern.test(content)) {
387
+ missingSections.push(section);
388
+ }
389
+ }
390
+ for (const field of rule.requiredFields) {
391
+ if (!content.includes(field)) {
392
+ missingFields.push(field);
393
+ }
394
+ }
395
+ if (rule.minAcceptanceCount) {
396
+ const count = countMatches(content, /验收标准/g);
397
+ if (count < rule.minAcceptanceCount) {
398
+ warnings.push(`验收标准数量不足(至少 ${rule.minAcceptanceCount})`);
399
+ }
400
+ }
401
+ }
402
+ const hasUnresolved = /{[a-z_]+}/i.test(content);
403
+ if (hasUnresolved) {
404
+ warnings.push('存在未替换的占位符');
405
+ }
406
+ const passed = missingSections.length === 0 && missingFields.length === 0 && warnings.length === 0;
407
+ return {
408
+ passed,
409
+ missingSections,
410
+ missingFields,
411
+ warnings,
412
+ };
413
+ }
414
+ function escapeRegExp(value) {
415
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
416
+ }
417
+ function countMatches(content, pattern) {
418
+ const matches = content.match(pattern);
419
+ return matches ? matches.length : 0;
420
+ }
421
+ function renderTemplate(content, variables) {
422
+ let rendered = content;
423
+ if (variables) {
424
+ for (const [key, value] of Object.entries(variables)) {
425
+ rendered = rendered.split(`{${key}}`).join(value);
426
+ }
427
+ }
428
+ const unresolved = rendered.match(/{[a-z_]+}/gi) || [];
429
+ return { rendered, unresolved };
430
+ }
431
+ async function readFileIfExists(filePath) {
432
+ try {
433
+ await fs.access(filePath);
434
+ return await fs.readFile(filePath, 'utf-8');
435
+ }
436
+ catch (error) {
437
+ return null;
438
+ }
439
+ }
440
+ export async function loadTemplate(request) {
441
+ const projectRoot = request.projectRoot || process.cwd();
442
+ const packageRoot = request.packageRoot || getPackageRoot();
443
+ const templateRelPath = join('templates', request.category, request.name, request.profile, request.file);
444
+ const projectTemplatePath = resolve(projectRoot, templateRelPath);
445
+ const repoTemplatePath = resolve(packageRoot, templateRelPath);
446
+ let content = await readFileIfExists(projectTemplatePath);
447
+ let source = 'project';
448
+ if (!content) {
449
+ content = await readFileIfExists(repoTemplatePath);
450
+ source = 'repo';
451
+ }
452
+ if (!content) {
453
+ const embeddedKey = `${request.category}/${request.name}/${request.profile}/${request.file}`;
454
+ content = EMBEDDED_TEMPLATES[embeddedKey] || '';
455
+ source = 'embedded';
456
+ }
457
+ const { rendered, unresolved } = renderTemplate(content, request.variables);
458
+ const rule = getValidator(request.category, request.name, request.file);
459
+ const validation = validateTemplate(rendered, rule);
460
+ if (unresolved.length > 0) {
461
+ validation.passed = false;
462
+ validation.warnings.push(`未替换占位符: ${Array.from(new Set(unresolved)).join(', ')}`);
463
+ }
464
+ if (!content) {
465
+ validation.passed = false;
466
+ validation.warnings.push('模板内容为空,已使用空模板作为占位');
467
+ }
468
+ return {
469
+ content: rendered,
470
+ source,
471
+ validation,
472
+ };
473
+ }
@@ -6,10 +6,10 @@ export type ToolsetType = 'core' | 'ui' | 'workflow' | 'full';
6
6
  /**
7
7
  * 工具集定义
8
8
  *
9
- * - core: 14 个核心工具(高频使用)
10
- * - ui: 5 个 UI/UX 工具(推荐使用 start_ui 统一入口)
11
- * - workflow: 27 个工作流工具(包含 core + 编排工具)
12
- * - full: 所有 39 个工具(默认)
9
+ * - core: 核心工具(高频使用)
10
+ * - ui: UI/UX 工具(推荐使用 start_ui 统一入口)
11
+ * - workflow: 工作流工具(包含 core + 编排工具)
12
+ * - full: 所有工具(默认)
13
13
  */
14
14
  export declare const TOOLSET_DEFINITIONS: {
15
15
  core: string[];
@@ -2,20 +2,20 @@
2
2
  * 工具集管理器
3
3
  * 根据环境变量 MCP_TOOLSET 过滤工具列表
4
4
  */
5
+ import { allToolSchemas } from '../schemas/index.js';
5
6
  /**
6
7
  * 工具集定义
7
8
  *
8
- * - core: 14 个核心工具(高频使用)
9
- * - ui: 5 个 UI/UX 工具(推荐使用 start_ui 统一入口)
10
- * - workflow: 27 个工作流工具(包含 core + 编排工具)
11
- * - full: 所有 39 个工具(默认)
9
+ * - core: 核心工具(高频使用)
10
+ * - ui: UI/UX 工具(推荐使用 start_ui 统一入口)
11
+ * - workflow: 工作流工具(包含 core + 编排工具)
12
+ * - full: 所有工具(默认)
12
13
  */
13
14
  export const TOOLSET_DEFINITIONS = {
14
- // 核心工具集(14 个)- 最常用的基础工具
15
+ // 核心工具集 - 最常用的基础工具
15
16
  core: [
16
17
  'gencommit',
17
18
  'code_review',
18
- 'debug',
19
19
  'gentest',
20
20
  'gendoc',
21
21
  'refactor',
@@ -25,10 +25,9 @@ export const TOOLSET_DEFINITIONS = {
25
25
  'genapi',
26
26
  'gensql',
27
27
  'genreadme',
28
- 'check_deps',
29
28
  'gen_mock',
30
29
  ],
31
- // UI/UX 工具集(5 个)- 对外工具,推荐使用 start_ui 统一入口
30
+ // UI/UX 工具集 - 对外工具,推荐使用 start_ui 统一入口
32
31
  ui: [
33
32
  'start_ui', // ⭐ 统一入口(编排工具)
34
33
  'ui_search', // 搜索 UI/UX 数据库
@@ -36,12 +35,11 @@ export const TOOLSET_DEFINITIONS = {
36
35
  'sync_ui_data', // 同步 UI 数据
37
36
  // 注意:不包含内部工具 init_component_catalog 和 render_ui
38
37
  ],
39
- // 工作流工具集(27 个)- 包含核心工具 + 编排工具
38
+ // 工作流工具集 - 包含核心工具 + 编排工具
40
39
  workflow: [
41
40
  // 核心工具(复用)
42
41
  'gencommit',
43
42
  'code_review',
44
- 'debug',
45
43
  'gentest',
46
44
  'gendoc',
47
45
  'refactor',
@@ -51,7 +49,6 @@ export const TOOLSET_DEFINITIONS = {
51
49
  'genapi',
52
50
  'gensql',
53
51
  'genreadme',
54
- 'check_deps',
55
52
  'gen_mock',
56
53
  // 编排工具(10 个)
57
54
  'start_feature',
@@ -68,7 +65,7 @@ export const TOOLSET_DEFINITIONS = {
68
65
  'interview',
69
66
  'ask_user',
70
67
  ],
71
- // 完整工具集(39 个)- 包含所有工具(包括内部工具)
68
+ // 完整工具集 - 包含所有工具(包括内部工具)
72
69
  full: 'all',
73
70
  };
74
71
  /**
@@ -105,7 +102,7 @@ export function getToolsetFromEnv() {
105
102
  */
106
103
  export function getToolsetSize(toolset) {
107
104
  if (toolset === 'full') {
108
- return 39;
105
+ return allToolSchemas.length;
109
106
  }
110
107
  const allowedTools = TOOLSET_DEFINITIONS[toolset];
111
108
  return allowedTools.length;
@@ -2,24 +2,6 @@
2
2
  * 代码分析工具的 Schema 定义
3
3
  */
4
4
  export declare const codeAnalysisToolSchemas: readonly [{
5
- readonly name: "debug";
6
- readonly description: "当用户遇到错误、需要调试问题时使用。分析错误信息和堆栈跟踪,定位问题根因,提供调试策略和解决方案";
7
- readonly inputSchema: {
8
- readonly type: "object";
9
- readonly properties: {
10
- readonly error: {
11
- readonly type: "string";
12
- readonly description: "错误信息。可以是错误消息、堆栈跟踪或完整的错误输出";
13
- };
14
- readonly context: {
15
- readonly type: "string";
16
- readonly description: "相关代码上下文。可选,有助于更准确的分析";
17
- };
18
- };
19
- readonly required: readonly [];
20
- readonly additionalProperties: true;
21
- };
22
- }, {
23
5
  readonly name: "code_review";
24
6
  readonly description: "当用户需要审查代码质量、检查代码问题时使用。审查代码的质量、安全性、性能,输出结构化问题清单(severity/category/suggestion)";
25
7
  readonly inputSchema: {
@@ -2,25 +2,6 @@
2
2
  * 代码分析工具的 Schema 定义
3
3
  */
4
4
  export const codeAnalysisToolSchemas = [
5
- {
6
- name: "debug",
7
- description: "当用户遇到错误、需要调试问题时使用。分析错误信息和堆栈跟踪,定位问题根因,提供调试策略和解决方案",
8
- inputSchema: {
9
- type: "object",
10
- properties: {
11
- error: {
12
- type: "string",
13
- description: "错误信息。可以是错误消息、堆栈跟踪或完整的错误输出",
14
- },
15
- context: {
16
- type: "string",
17
- description: "相关代码上下文。可选,有助于更准确的分析",
18
- },
19
- },
20
- required: [],
21
- additionalProperties: true,
22
- },
23
- },
24
5
  {
25
6
  name: "code_review",
26
7
  description: "当用户需要审查代码质量、检查代码问题时使用。审查代码的质量、安全性、性能,输出结构化问题清单(severity/category/suggestion)",
@@ -19,13 +19,4 @@ export declare const docUtilToolSchemas: readonly [{
19
19
  readonly required: readonly [];
20
20
  readonly additionalProperties: true;
21
21
  };
22
- }, {
23
- readonly name: "check_deps";
24
- readonly description: "当用户需要检查项目依赖健康度、查找过期依赖时使用。检查依赖版本、安全漏洞、体积,输出升级建议";
25
- readonly inputSchema: {
26
- readonly type: "object";
27
- readonly properties: {};
28
- readonly required: readonly [];
29
- readonly additionalProperties: true;
30
- };
31
22
  }];
@@ -22,14 +22,4 @@ export const docUtilToolSchemas = [
22
22
  additionalProperties: true,
23
23
  },
24
24
  },
25
- {
26
- name: "check_deps",
27
- description: "当用户需要检查项目依赖健康度、查找过期依赖时使用。检查依赖版本、安全漏洞、体积,输出升级建议",
28
- inputSchema: {
29
- type: "object",
30
- properties: {},
31
- required: [],
32
- additionalProperties: true,
33
- },
34
- },
35
25
  ];