mcp-probe-kit 1.15.1 → 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 (162) 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/debug.d.ts +1 -13
  48. package/build/tools/debug.js +18 -16
  49. package/build/tools/estimate.d.ts +1 -19
  50. package/build/tools/estimate.js +36 -6
  51. package/build/tools/fix_bug.d.ts +1 -13
  52. package/build/tools/fix_bug.js +24 -6
  53. package/build/tools/gen_mock.d.ts +1 -19
  54. package/build/tools/gen_mock.js +42 -227
  55. package/build/tools/genapi.d.ts +1 -13
  56. package/build/tools/genapi.js +18 -15
  57. package/build/tools/genchangelog.d.ts +1 -13
  58. package/build/tools/genchangelog.js +36 -212
  59. package/build/tools/gencommit.d.ts +1 -7
  60. package/build/tools/gencommit.js +21 -13
  61. package/build/tools/gendoc.d.ts +1 -13
  62. package/build/tools/gendoc.js +18 -15
  63. package/build/tools/genpr.d.ts +1 -13
  64. package/build/tools/genpr.js +28 -157
  65. package/build/tools/genreadme.d.ts +1 -13
  66. package/build/tools/genreadme.js +22 -587
  67. package/build/tools/gensql.d.ts +1 -13
  68. package/build/tools/gensql.js +24 -283
  69. package/build/tools/gentest.d.ts +1 -13
  70. package/build/tools/gentest.js +49 -16
  71. package/build/tools/index.d.ts +0 -10
  72. package/build/tools/index.js +0 -10
  73. package/build/tools/init_component_catalog.d.ts +3 -20
  74. package/build/tools/init_component_catalog.js +141 -786
  75. package/build/tools/init_project.d.ts +7 -13
  76. package/build/tools/init_project.js +54 -16
  77. package/build/tools/init_project_context.d.ts +1 -13
  78. package/build/tools/init_project_context.js +41 -14
  79. package/build/tools/perf.d.ts +1 -13
  80. package/build/tools/perf.js +18 -15
  81. package/build/tools/refactor.d.ts +1 -13
  82. package/build/tools/refactor.js +54 -15
  83. package/build/tools/render_ui.d.ts +2 -19
  84. package/build/tools/render_ui.js +201 -347
  85. package/build/tools/resolve_conflict.d.ts +1 -13
  86. package/build/tools/resolve_conflict.js +18 -15
  87. package/build/tools/security_scan.d.ts +1 -13
  88. package/build/tools/security_scan.js +16 -5
  89. package/build/tools/start_api.d.ts +7 -13
  90. package/build/tools/start_api.js +69 -157
  91. package/build/tools/start_bugfix.d.ts +1 -7
  92. package/build/tools/start_bugfix.js +38 -2
  93. package/build/tools/start_doc.d.ts +7 -13
  94. package/build/tools/start_doc.js +76 -169
  95. package/build/tools/start_feature.d.ts +1 -7
  96. package/build/tools/start_feature.js +54 -2
  97. package/build/tools/start_onboard.d.ts +1 -7
  98. package/build/tools/start_onboard.js +40 -2
  99. package/build/tools/start_ralph.d.ts +1 -7
  100. package/build/tools/start_ralph.js +88 -2
  101. package/build/tools/start_refactor.d.ts +7 -13
  102. package/build/tools/start_refactor.js +75 -148
  103. package/build/tools/start_release.d.ts +7 -13
  104. package/build/tools/start_release.js +56 -131
  105. package/build/tools/start_review.d.ts +7 -13
  106. package/build/tools/start_review.js +70 -142
  107. package/build/tools/start_ui.d.ts +1 -7
  108. package/build/tools/start_ui.js +98 -8
  109. package/build/tools/ui-ux-tools.d.ts +3 -39
  110. package/build/tools/ui-ux-tools.js +201 -125
  111. package/docs/data/tools.js +864 -0
  112. package/docs/index.html +594 -0
  113. package/docs/pages/all-tools.html +649 -0
  114. package/docs/pages/examples.html +564 -0
  115. package/docs/pages/getting-started.html +529 -0
  116. package/docs/pages/migration.html +308 -0
  117. package/docs/specs/algorithm-enhancement/roadmap.md +619 -0
  118. package/docs/specs/vnext-upgrade/00-OVERVIEW.md +258 -0
  119. package/docs/specs/vnext-upgrade/BETA_RELEASE_GUIDE.md +328 -0
  120. package/docs/specs/vnext-upgrade/GITHUB_DISCUSSION_TEMPLATE.md +236 -0
  121. package/docs/specs/vnext-upgrade/M8.9-PROGRESS-UPDATE.md +248 -0
  122. package/docs/specs/vnext-upgrade/PROGRESS-SUMMARY.md +195 -0
  123. package/docs/specs/vnext-upgrade/QUICK_REFERENCE.md +338 -0
  124. package/docs/specs/vnext-upgrade/README.md +125 -0
  125. package/docs/specs/vnext-upgrade/STATUS-UPDATE-2026-01-26.md +230 -0
  126. package/docs/specs/vnext-upgrade/TOOL_CLEANUP.md +343 -0
  127. package/docs/specs/vnext-upgrade/completed/M1-M2-SUMMARY.md +27 -0
  128. package/docs/specs/vnext-upgrade/completed/M3_COMPLETION_SUMMARY.md +273 -0
  129. package/docs/specs/vnext-upgrade/completed/M4-SUMMARY.md +19 -0
  130. package/docs/specs/vnext-upgrade/completed/M5_COMPLETION_SUMMARY.md +0 -0
  131. package/docs/specs/vnext-upgrade/completed/M8.1-SUMMARY.md +247 -0
  132. package/docs/specs/vnext-upgrade/completed/M8.2-SUMMARY.md +296 -0
  133. package/docs/specs/vnext-upgrade/completed/M8.3-SUMMARY.md +241 -0
  134. package/docs/specs/vnext-upgrade/completed/M8.3-TEST-SUMMARY.md +216 -0
  135. package/docs/specs/vnext-upgrade/completed/M8.4-SUMMARY.md +217 -0
  136. package/docs/specs/vnext-upgrade/completed/M8.4-TEST-SUMMARY.md +198 -0
  137. package/docs/specs/vnext-upgrade/completed/M8.5-SUMMARY.md +202 -0
  138. package/docs/specs/vnext-upgrade/completed/M8.5-TEST-SUMMARY.md +223 -0
  139. package/docs/specs/vnext-upgrade/completed/M8.6-SUMMARY.md +299 -0
  140. package/docs/specs/vnext-upgrade/completed/M8.8-TEST-SUMMARY.md +216 -0
  141. package/docs/specs/vnext-upgrade/completed/TOOL-CLEANUP-SUMMARY.md +210 -0
  142. package/docs/specs/vnext-upgrade/design.md +848 -0
  143. package/docs/specs/vnext-upgrade/requirements.md +221 -0
  144. package/docs/specs/vnext-upgrade/tasks/00-INDEX.md +335 -0
  145. package/docs/specs/vnext-upgrade/tasks/M8.1-SCHEMA-DEFINITION.md +300 -0
  146. package/docs/specs/vnext-upgrade/tasks/M8.2-P1-TOOLS.md +249 -0
  147. package/docs/specs/vnext-upgrade/tasks/M8.3-GENERATION-TOOLS.md +49 -0
  148. package/docs/specs/vnext-upgrade/tasks/M8.4-ORCHESTRATION-TOOLS.md +28 -0
  149. package/docs/specs/vnext-upgrade/tasks/M8.5-PROJECT-TOOLS.md +29 -0
  150. package/docs/specs/vnext-upgrade/tasks/M8.6-UI-TOOLS.md +66 -0
  151. package/docs/specs/vnext-upgrade/tasks/M8.7-HELPER-TOOLS.md +24 -0
  152. package/docs/specs/vnext-upgrade/tasks/M8.8-INTEGRATION-TESTS.md +90 -0
  153. package/docs/specs/vnext-upgrade/tasks/M8.9-DOCUMENTATION.md +103 -0
  154. package/docs/styles/docs.css +556 -0
  155. package/docs/styles/page.css +815 -0
  156. package/docs/vnext/MCP_2025-11-25_GUIDE.md +276 -0
  157. package/docs/vnext/vNext-PRD.md +488 -0
  158. package/package.json +6 -6
  159. package/docs/BEST_PRACTICES.md +0 -1185
  160. package/docs/HOW_TO_TRIGGER.md +0 -1141
  161. package/docs/MCP-Probe-Kit-/344/275/277/347/224/250/346/211/213/345/206/214.html +0 -544
  162. package/docs/MCP-Probe-Kit-/344/275/277/347/224/250/346/211/213/345/206/214.md +0 -1447
@@ -0,0 +1,1017 @@
1
+ /**
2
+ * 结构化输出 Schema 定义(P0 工具)
3
+ * 用于 MCP 2025-11-25 协议的 structuredContent
4
+ *
5
+ * 注意:其他工具的 Schema 已按功能分类到 src/schemas/output/ 目录:
6
+ * - core-tools.ts: 核心开发工具 (code_review, debug, fix_bug, gentest, refactor, security_scan, perf)
7
+ * - generation-tools.ts: 代码生成工具 (gendoc, genapi, gensql, genreadme, genui, gen_mock, etc.)
8
+ * - workflow-tools.ts: 工作流编排工具 (start_review, start_release, start_refactor, start_api, start_doc)
9
+ * - project-tools.ts: 项目管理工具 (init_project, add_feature, analyze_project, estimate, etc.)
10
+ * - ui-ux-tools.ts: UI/UX 工具 (ui_design_system, ui_search, design2code, etc.)
11
+ * - helper-tools.ts: 辅助工具 (detect_shell, init_setting, gen_skill)
12
+ *
13
+ * 使用方式:
14
+ * import { CodeReviewReportSchema, DebugReportSchema } from '@/schemas/output';
15
+ */
16
+ /**
17
+ * Commit Message Schema
18
+ * 用于 gencommit 工具的结构化输出
19
+ */
20
+ export const CommitMessageSchema = {
21
+ type: 'object',
22
+ properties: {
23
+ type: {
24
+ type: 'string',
25
+ description: 'Commit 类型:feat/fix/docs/refactor/test/chore/style/perf',
26
+ enum: ['feat', 'fix', 'docs', 'refactor', 'test', 'chore', 'style', 'perf', 'ci', 'build', 'revert'],
27
+ },
28
+ scope: {
29
+ type: 'string',
30
+ description: 'Commit 范围(可选)',
31
+ },
32
+ subject: {
33
+ type: 'string',
34
+ description: 'Commit 主题(简短描述)',
35
+ },
36
+ body: {
37
+ type: 'string',
38
+ description: 'Commit 正文(详细描述)',
39
+ },
40
+ footer: {
41
+ type: 'string',
42
+ description: 'Commit 页脚(Breaking Changes、Issue 引用等)',
43
+ },
44
+ fullMessage: {
45
+ type: 'string',
46
+ description: '完整的 commit message(可直接使用)',
47
+ },
48
+ emoji: {
49
+ type: 'string',
50
+ description: 'Emoji 前缀(如果使用 conventional+emoji 风格)',
51
+ },
52
+ },
53
+ required: ['type', 'subject', 'fullMessage'],
54
+ };
55
+ /**
56
+ * Workflow Report Schema
57
+ * 用于 start_* 编排工具的结构化输出
58
+ */
59
+ export const WorkflowReportSchema = {
60
+ type: 'object',
61
+ properties: {
62
+ summary: {
63
+ type: 'string',
64
+ description: '工作流执行摘要(一句话)',
65
+ },
66
+ status: {
67
+ type: 'string',
68
+ description: '执行状态',
69
+ enum: ['success', 'partial', 'failed', 'pending'],
70
+ },
71
+ steps: {
72
+ type: 'array',
73
+ description: '执行步骤列表',
74
+ items: {
75
+ type: 'object',
76
+ properties: {
77
+ name: {
78
+ type: 'string',
79
+ description: '步骤名称',
80
+ },
81
+ status: {
82
+ type: 'string',
83
+ description: '步骤状态',
84
+ enum: ['completed', 'skipped', 'failed', 'pending'],
85
+ },
86
+ description: {
87
+ type: 'string',
88
+ description: '步骤描述',
89
+ },
90
+ output: {
91
+ type: 'string',
92
+ description: '步骤输出(可选)',
93
+ },
94
+ },
95
+ required: ['name', 'status'],
96
+ },
97
+ },
98
+ artifacts: {
99
+ type: 'array',
100
+ description: '生成的文件/产物',
101
+ items: {
102
+ type: 'object',
103
+ properties: {
104
+ path: {
105
+ type: 'string',
106
+ description: '文件路径',
107
+ },
108
+ type: {
109
+ type: 'string',
110
+ description: '文件类型',
111
+ enum: ['code', 'doc', 'config', 'test', 'spec'],
112
+ },
113
+ purpose: {
114
+ type: 'string',
115
+ description: '文件用途',
116
+ },
117
+ content: {
118
+ type: 'string',
119
+ description: '文件内容(可选)',
120
+ },
121
+ },
122
+ required: ['path', 'type', 'purpose'],
123
+ },
124
+ },
125
+ nextSteps: {
126
+ type: 'array',
127
+ description: '后续建议步骤',
128
+ items: {
129
+ type: 'string',
130
+ },
131
+ },
132
+ warnings: {
133
+ type: 'array',
134
+ description: '警告信息',
135
+ items: {
136
+ type: 'string',
137
+ },
138
+ },
139
+ metadata: {
140
+ type: 'object',
141
+ description: '额外元数据(工具特定)',
142
+ additionalProperties: true,
143
+ },
144
+ },
145
+ required: ['summary', 'status', 'steps'],
146
+ };
147
+ /**
148
+ * Bug Fix Report Schema
149
+ * 用于 start_bugfix 的特定字段
150
+ */
151
+ export const BugFixReportSchema = {
152
+ type: 'object',
153
+ allOf: [
154
+ { $ref: '#/definitions/WorkflowReport' },
155
+ ],
156
+ properties: {
157
+ rootCause: {
158
+ type: 'string',
159
+ description: '根本原因分析',
160
+ },
161
+ fixPlan: {
162
+ type: 'string',
163
+ description: '修复方案',
164
+ },
165
+ testPlan: {
166
+ type: 'string',
167
+ description: '测试计划',
168
+ },
169
+ commitDraft: {
170
+ type: 'object',
171
+ description: '提交草稿(使用 CommitMessageSchema)',
172
+ },
173
+ affectedFiles: {
174
+ type: 'array',
175
+ description: '受影响的文件',
176
+ items: {
177
+ type: 'string',
178
+ },
179
+ },
180
+ },
181
+ required: ['rootCause', 'fixPlan', 'testPlan'],
182
+ };
183
+ /**
184
+ * Feature Development Report Schema
185
+ * 用于 start_feature 的特定字段
186
+ */
187
+ export const FeatureReportSchema = {
188
+ type: 'object',
189
+ allOf: [
190
+ { $ref: '#/definitions/WorkflowReport' },
191
+ ],
192
+ properties: {
193
+ specArtifacts: {
194
+ type: 'array',
195
+ description: '规格文档产物',
196
+ items: {
197
+ type: 'object',
198
+ properties: {
199
+ path: {
200
+ type: 'string',
201
+ description: '文档路径',
202
+ },
203
+ type: {
204
+ type: 'string',
205
+ description: '文档类型',
206
+ enum: ['requirements', 'design', 'tasks', 'api-spec'],
207
+ },
208
+ },
209
+ required: ['path', 'type'],
210
+ },
211
+ },
212
+ estimate: {
213
+ type: 'object',
214
+ description: '工作量估算',
215
+ properties: {
216
+ storyPoints: {
217
+ type: 'number',
218
+ description: '故事点',
219
+ },
220
+ optimistic: {
221
+ type: 'string',
222
+ description: '乐观估计(如 "2-3天")',
223
+ },
224
+ normal: {
225
+ type: 'string',
226
+ description: '正常估计',
227
+ },
228
+ pessimistic: {
229
+ type: 'string',
230
+ description: '悲观估计',
231
+ },
232
+ },
233
+ },
234
+ dependencies: {
235
+ type: 'array',
236
+ description: '依赖项',
237
+ items: {
238
+ type: 'string',
239
+ },
240
+ },
241
+ },
242
+ required: ['specArtifacts', 'estimate'],
243
+ };
244
+ /**
245
+ * UI Development Report Schema
246
+ * 用于 start_ui 的特定字段
247
+ */
248
+ export const UIReportSchema = {
249
+ type: 'object',
250
+ allOf: [
251
+ { $ref: '#/definitions/WorkflowReport' },
252
+ ],
253
+ properties: {
254
+ designSystem: {
255
+ type: 'object',
256
+ description: '设计系统配置',
257
+ properties: {
258
+ colors: {
259
+ type: 'object',
260
+ description: '色彩系统',
261
+ },
262
+ typography: {
263
+ type: 'object',
264
+ description: '字体系统',
265
+ },
266
+ spacing: {
267
+ type: 'object',
268
+ description: '间距系统',
269
+ },
270
+ },
271
+ },
272
+ catalog: {
273
+ type: 'object',
274
+ description: '组件目录',
275
+ properties: {
276
+ components: {
277
+ type: 'array',
278
+ description: '可用组件列表',
279
+ items: {
280
+ type: 'object',
281
+ properties: {
282
+ name: {
283
+ type: 'string',
284
+ },
285
+ category: {
286
+ type: 'string',
287
+ },
288
+ },
289
+ },
290
+ },
291
+ },
292
+ },
293
+ renderedCode: {
294
+ type: 'object',
295
+ description: '渲染的代码',
296
+ properties: {
297
+ framework: {
298
+ type: 'string',
299
+ description: '框架',
300
+ enum: ['react', 'vue', 'html'],
301
+ },
302
+ code: {
303
+ type: 'string',
304
+ description: '生成的代码',
305
+ },
306
+ },
307
+ },
308
+ consistencyRules: {
309
+ type: 'array',
310
+ description: '一致性规则',
311
+ items: {
312
+ type: 'string',
313
+ },
314
+ },
315
+ },
316
+ required: ['designSystem', 'renderedCode'],
317
+ };
318
+ /**
319
+ * Onboarding Report Schema
320
+ * 用于 start_onboard 的特定字段
321
+ */
322
+ export const OnboardingReportSchema = {
323
+ type: 'object',
324
+ allOf: [
325
+ { $ref: '#/definitions/WorkflowReport' },
326
+ ],
327
+ properties: {
328
+ projectSummary: {
329
+ type: 'object',
330
+ description: '项目概览',
331
+ properties: {
332
+ name: {
333
+ type: 'string',
334
+ },
335
+ description: {
336
+ type: 'string',
337
+ },
338
+ techStack: {
339
+ type: 'array',
340
+ items: {
341
+ type: 'string',
342
+ },
343
+ },
344
+ architecture: {
345
+ type: 'string',
346
+ },
347
+ },
348
+ },
349
+ architectureNotes: {
350
+ type: 'string',
351
+ description: '架构说明',
352
+ },
353
+ quickstart: {
354
+ type: 'object',
355
+ description: '快速开始指南',
356
+ properties: {
357
+ setup: {
358
+ type: 'array',
359
+ description: '设置步骤',
360
+ items: {
361
+ type: 'string',
362
+ },
363
+ },
364
+ commonTasks: {
365
+ type: 'array',
366
+ description: '常见任务',
367
+ items: {
368
+ type: 'object',
369
+ properties: {
370
+ task: {
371
+ type: 'string',
372
+ },
373
+ command: {
374
+ type: 'string',
375
+ },
376
+ },
377
+ },
378
+ },
379
+ },
380
+ },
381
+ keyFiles: {
382
+ type: 'array',
383
+ description: '关键文件',
384
+ items: {
385
+ type: 'object',
386
+ properties: {
387
+ path: {
388
+ type: 'string',
389
+ },
390
+ purpose: {
391
+ type: 'string',
392
+ },
393
+ },
394
+ },
395
+ },
396
+ },
397
+ required: ['projectSummary', 'quickstart'],
398
+ };
399
+ /**
400
+ * Ralph Loop Report Schema
401
+ * 用于 start_ralph 的特定字段
402
+ */
403
+ export const RalphLoopReportSchema = {
404
+ type: 'object',
405
+ allOf: [
406
+ { $ref: '#/definitions/WorkflowReport' },
407
+ ],
408
+ properties: {
409
+ loopPolicy: {
410
+ type: 'object',
411
+ description: '循环策略',
412
+ properties: {
413
+ maxIterations: {
414
+ type: 'number',
415
+ description: '最大迭代次数',
416
+ },
417
+ maxMinutes: {
418
+ type: 'number',
419
+ description: '最大运行分钟数',
420
+ },
421
+ confirmEvery: {
422
+ type: 'number',
423
+ description: '每几轮确认一次',
424
+ },
425
+ cooldownSeconds: {
426
+ type: 'number',
427
+ description: '冷却秒数',
428
+ },
429
+ },
430
+ },
431
+ iterations: {
432
+ type: 'array',
433
+ description: '迭代历史',
434
+ items: {
435
+ type: 'object',
436
+ properties: {
437
+ iteration: {
438
+ type: 'number',
439
+ },
440
+ status: {
441
+ type: 'string',
442
+ enum: ['success', 'failed', 'stopped'],
443
+ },
444
+ testsPass: {
445
+ type: 'boolean',
446
+ },
447
+ changes: {
448
+ type: 'string',
449
+ description: 'Git diff 摘要',
450
+ },
451
+ },
452
+ },
453
+ },
454
+ stopConditions: {
455
+ type: 'object',
456
+ description: '停止条件',
457
+ properties: {
458
+ reason: {
459
+ type: 'string',
460
+ description: '停止原因',
461
+ },
462
+ metConditions: {
463
+ type: 'array',
464
+ description: '满足的条件',
465
+ items: {
466
+ type: 'string',
467
+ },
468
+ },
469
+ },
470
+ },
471
+ safetyChecks: {
472
+ type: 'array',
473
+ description: '安全检查结果',
474
+ items: {
475
+ type: 'object',
476
+ properties: {
477
+ check: {
478
+ type: 'string',
479
+ },
480
+ passed: {
481
+ type: 'boolean',
482
+ },
483
+ message: {
484
+ type: 'string',
485
+ },
486
+ },
487
+ },
488
+ },
489
+ },
490
+ required: ['loopPolicy', 'iterations', 'stopConditions'],
491
+ };
492
+ // ============================================================================
493
+ // 第 2 组: P1 高价值工具 Schema(7 个)
494
+ // ============================================================================
495
+ /**
496
+ * Code Review Report Schema
497
+ * 用于 code_review 工具的结构化输出
498
+ */
499
+ export const CodeReviewReportSchema = {
500
+ type: 'object',
501
+ properties: {
502
+ summary: {
503
+ type: 'string',
504
+ description: '审查总结',
505
+ },
506
+ overallScore: {
507
+ type: 'number',
508
+ minimum: 0,
509
+ maximum: 100,
510
+ description: '总体评分(0-100)',
511
+ },
512
+ issues: {
513
+ type: 'array',
514
+ description: '问题列表',
515
+ items: {
516
+ type: 'object',
517
+ properties: {
518
+ severity: {
519
+ type: 'string',
520
+ enum: ['critical', 'high', 'medium', 'low', 'info'],
521
+ description: '严重程度',
522
+ },
523
+ category: {
524
+ type: 'string',
525
+ enum: ['security', 'performance', 'quality', 'style', 'best-practice'],
526
+ description: '问题类别',
527
+ },
528
+ line: {
529
+ type: 'number',
530
+ description: '行号',
531
+ },
532
+ file: {
533
+ type: 'string',
534
+ description: '文件路径',
535
+ },
536
+ message: {
537
+ type: 'string',
538
+ description: '问题描述',
539
+ },
540
+ suggestion: {
541
+ type: 'string',
542
+ description: '修复建议',
543
+ },
544
+ code: {
545
+ type: 'string',
546
+ description: '问题代码片段',
547
+ },
548
+ },
549
+ required: ['severity', 'category', 'message'],
550
+ },
551
+ },
552
+ strengths: {
553
+ type: 'array',
554
+ items: { type: 'string' },
555
+ description: '代码优点',
556
+ },
557
+ recommendations: {
558
+ type: 'array',
559
+ items: { type: 'string' },
560
+ description: '改进建议',
561
+ },
562
+ metrics: {
563
+ type: 'object',
564
+ description: '代码指标',
565
+ properties: {
566
+ complexity: { type: 'number', description: '复杂度' },
567
+ maintainability: { type: 'number', description: '可维护性' },
568
+ testCoverage: { type: 'number', description: '测试覆盖率' },
569
+ },
570
+ },
571
+ },
572
+ required: ['summary', 'overallScore', 'issues'],
573
+ };
574
+ /**
575
+ * Debug Report Schema
576
+ * 用于 debug 工具的结构化输出
577
+ */
578
+ export const DebugReportSchema = {
579
+ type: 'object',
580
+ properties: {
581
+ summary: {
582
+ type: 'string',
583
+ description: '调试摘要',
584
+ },
585
+ rootCause: {
586
+ type: 'string',
587
+ description: '根本原因分析',
588
+ },
589
+ errorType: {
590
+ type: 'string',
591
+ enum: ['syntax', 'runtime', 'logic', 'performance', 'memory', 'network', 'unknown'],
592
+ description: '错误类型',
593
+ },
594
+ location: {
595
+ type: 'object',
596
+ description: '错误位置',
597
+ properties: {
598
+ file: { type: 'string' },
599
+ line: { type: 'number' },
600
+ column: { type: 'number' },
601
+ function: { type: 'string' },
602
+ },
603
+ },
604
+ stackTrace: {
605
+ type: 'array',
606
+ description: '堆栈跟踪',
607
+ items: {
608
+ type: 'object',
609
+ properties: {
610
+ file: { type: 'string' },
611
+ line: { type: 'number' },
612
+ function: { type: 'string' },
613
+ },
614
+ },
615
+ },
616
+ debugStrategy: {
617
+ type: 'array',
618
+ description: '调试策略',
619
+ items: { type: 'string' },
620
+ },
621
+ solutions: {
622
+ type: 'array',
623
+ description: '解决方案列表',
624
+ items: {
625
+ type: 'object',
626
+ properties: {
627
+ title: { type: 'string' },
628
+ description: { type: 'string' },
629
+ code: { type: 'string' },
630
+ priority: { type: 'string', enum: ['high', 'medium', 'low'] },
631
+ },
632
+ required: ['title', 'description'],
633
+ },
634
+ },
635
+ relatedIssues: {
636
+ type: 'array',
637
+ description: '相关问题',
638
+ items: { type: 'string' },
639
+ },
640
+ },
641
+ required: ['summary', 'rootCause', 'errorType', 'solutions'],
642
+ };
643
+ /**
644
+ * Bug Analysis Schema
645
+ * 用于 fix_bug 工具的结构化输出
646
+ */
647
+ export const BugAnalysisSchema = {
648
+ type: 'object',
649
+ properties: {
650
+ summary: {
651
+ type: 'string',
652
+ description: 'Bug 摘要',
653
+ },
654
+ bugType: {
655
+ type: 'string',
656
+ enum: ['functional', 'performance', 'security', 'ui', 'data', 'integration'],
657
+ description: 'Bug 类型',
658
+ },
659
+ severity: {
660
+ type: 'string',
661
+ enum: ['critical', 'high', 'medium', 'low'],
662
+ description: '严重程度',
663
+ },
664
+ rootCause: {
665
+ type: 'string',
666
+ description: '根本原因',
667
+ },
668
+ affectedComponents: {
669
+ type: 'array',
670
+ description: '受影响的组件',
671
+ items: { type: 'string' },
672
+ },
673
+ affectedFiles: {
674
+ type: 'array',
675
+ description: '受影响的文件',
676
+ items: { type: 'string' },
677
+ },
678
+ fixPlan: {
679
+ type: 'object',
680
+ description: '修复计划',
681
+ properties: {
682
+ steps: {
683
+ type: 'array',
684
+ items: { type: 'string' },
685
+ },
686
+ estimatedTime: { type: 'string' },
687
+ risks: {
688
+ type: 'array',
689
+ items: { type: 'string' },
690
+ },
691
+ },
692
+ required: ['steps'],
693
+ },
694
+ testPlan: {
695
+ type: 'object',
696
+ description: '测试计划',
697
+ properties: {
698
+ unitTests: {
699
+ type: 'array',
700
+ items: { type: 'string' },
701
+ },
702
+ integrationTests: {
703
+ type: 'array',
704
+ items: { type: 'string' },
705
+ },
706
+ manualTests: {
707
+ type: 'array',
708
+ items: { type: 'string' },
709
+ },
710
+ },
711
+ },
712
+ preventionMeasures: {
713
+ type: 'array',
714
+ description: '预防措施',
715
+ items: { type: 'string' },
716
+ },
717
+ },
718
+ required: ['summary', 'bugType', 'severity', 'rootCause', 'fixPlan', 'testPlan'],
719
+ };
720
+ /**
721
+ * Test Suite Schema
722
+ * 用于 gentest 工具的结构化输出
723
+ */
724
+ export const TestSuiteSchema = {
725
+ type: 'object',
726
+ properties: {
727
+ summary: {
728
+ type: 'string',
729
+ description: '测试套件摘要',
730
+ },
731
+ framework: {
732
+ type: 'string',
733
+ enum: ['jest', 'vitest', 'mocha', 'jasmine', 'pytest', 'junit'],
734
+ description: '测试框架',
735
+ },
736
+ testCases: {
737
+ type: 'array',
738
+ description: '测试用例列表',
739
+ items: {
740
+ type: 'object',
741
+ properties: {
742
+ name: { type: 'string', description: '测试名称' },
743
+ description: { type: 'string', description: '测试描述' },
744
+ type: {
745
+ type: 'string',
746
+ enum: ['unit', 'integration', 'e2e', 'performance'],
747
+ description: '测试类型',
748
+ },
749
+ code: { type: 'string', description: '测试代码' },
750
+ assertions: {
751
+ type: 'array',
752
+ items: { type: 'string' },
753
+ description: '断言列表',
754
+ },
755
+ },
756
+ required: ['name', 'type', 'code'],
757
+ },
758
+ },
759
+ edgeCases: {
760
+ type: 'array',
761
+ description: '边界条件测试',
762
+ items: {
763
+ type: 'object',
764
+ properties: {
765
+ scenario: { type: 'string' },
766
+ input: { type: 'string' },
767
+ expectedOutput: { type: 'string' },
768
+ },
769
+ },
770
+ },
771
+ mockData: {
772
+ type: 'object',
773
+ description: 'Mock 数据定义',
774
+ additionalProperties: true,
775
+ },
776
+ coverage: {
777
+ type: 'object',
778
+ description: '覆盖率目标',
779
+ properties: {
780
+ statements: { type: 'number' },
781
+ branches: { type: 'number' },
782
+ functions: { type: 'number' },
783
+ lines: { type: 'number' },
784
+ },
785
+ },
786
+ },
787
+ required: ['summary', 'framework', 'testCases'],
788
+ };
789
+ /**
790
+ * Refactor Plan Schema
791
+ * 用于 refactor 工具的结构化输出
792
+ */
793
+ export const RefactorPlanSchema = {
794
+ type: 'object',
795
+ properties: {
796
+ summary: {
797
+ type: 'string',
798
+ description: '重构摘要',
799
+ },
800
+ goal: {
801
+ type: 'string',
802
+ enum: ['improve_readability', 'reduce_complexity', 'improve_performance', 'improve_maintainability', 'modernize'],
803
+ description: '重构目标',
804
+ },
805
+ currentIssues: {
806
+ type: 'array',
807
+ description: '当前问题',
808
+ items: { type: 'string' },
809
+ },
810
+ refactoringSteps: {
811
+ type: 'array',
812
+ description: '重构步骤',
813
+ items: {
814
+ type: 'object',
815
+ properties: {
816
+ step: { type: 'number' },
817
+ title: { type: 'string' },
818
+ description: { type: 'string' },
819
+ before: { type: 'string', description: '重构前代码' },
820
+ after: { type: 'string', description: '重构后代码' },
821
+ rationale: { type: 'string', description: '重构理由' },
822
+ },
823
+ required: ['step', 'title', 'description'],
824
+ },
825
+ },
826
+ riskAssessment: {
827
+ type: 'object',
828
+ description: '风险评估',
829
+ properties: {
830
+ level: { type: 'string', enum: ['low', 'medium', 'high'] },
831
+ risks: {
832
+ type: 'array',
833
+ items: { type: 'string' },
834
+ },
835
+ mitigations: {
836
+ type: 'array',
837
+ items: { type: 'string' },
838
+ },
839
+ },
840
+ required: ['level', 'risks'],
841
+ },
842
+ rollbackPlan: {
843
+ type: 'string',
844
+ description: '回滚计划',
845
+ },
846
+ estimatedEffort: {
847
+ type: 'object',
848
+ description: '预估工作量',
849
+ properties: {
850
+ hours: { type: 'number' },
851
+ complexity: { type: 'string', enum: ['low', 'medium', 'high'] },
852
+ },
853
+ },
854
+ expectedBenefits: {
855
+ type: 'array',
856
+ description: '预期收益',
857
+ items: { type: 'string' },
858
+ },
859
+ },
860
+ required: ['summary', 'goal', 'refactoringSteps', 'riskAssessment'],
861
+ };
862
+ /**
863
+ * Security Report Schema
864
+ * 用于 security_scan 工具的结构化输出
865
+ */
866
+ export const SecurityReportSchema = {
867
+ type: 'object',
868
+ properties: {
869
+ summary: {
870
+ type: 'string',
871
+ description: '安全扫描摘要',
872
+ },
873
+ overallRisk: {
874
+ type: 'string',
875
+ enum: ['critical', 'high', 'medium', 'low', 'none'],
876
+ description: '总体风险等级',
877
+ },
878
+ vulnerabilities: {
879
+ type: 'array',
880
+ description: '漏洞列表',
881
+ items: {
882
+ type: 'object',
883
+ properties: {
884
+ id: { type: 'string', description: '漏洞ID' },
885
+ type: {
886
+ type: 'string',
887
+ enum: ['injection', 'xss', 'csrf', 'auth', 'crypto', 'data-exposure', 'dos', 'other'],
888
+ description: '漏洞类型',
889
+ },
890
+ severity: {
891
+ type: 'string',
892
+ enum: ['critical', 'high', 'medium', 'low'],
893
+ description: '严重程度',
894
+ },
895
+ title: { type: 'string' },
896
+ description: { type: 'string' },
897
+ location: {
898
+ type: 'object',
899
+ properties: {
900
+ file: { type: 'string' },
901
+ line: { type: 'number' },
902
+ code: { type: 'string' },
903
+ },
904
+ },
905
+ cwe: { type: 'string', description: 'CWE编号' },
906
+ cvss: { type: 'number', description: 'CVSS评分' },
907
+ remediation: { type: 'string', description: '修复建议' },
908
+ references: {
909
+ type: 'array',
910
+ items: { type: 'string' },
911
+ description: '参考链接',
912
+ },
913
+ },
914
+ required: ['type', 'severity', 'title', 'description'],
915
+ },
916
+ },
917
+ complianceChecks: {
918
+ type: 'array',
919
+ description: '合规性检查',
920
+ items: {
921
+ type: 'object',
922
+ properties: {
923
+ standard: { type: 'string', description: '标准名称(如OWASP Top 10)' },
924
+ passed: { type: 'boolean' },
925
+ details: { type: 'string' },
926
+ },
927
+ },
928
+ },
929
+ recommendations: {
930
+ type: 'array',
931
+ description: '安全建议',
932
+ items: { type: 'string' },
933
+ },
934
+ },
935
+ required: ['summary', 'overallRisk', 'vulnerabilities'],
936
+ };
937
+ /**
938
+ * Performance Report Schema
939
+ * 用于 perf 工具的结构化输出
940
+ */
941
+ export const PerformanceReportSchema = {
942
+ type: 'object',
943
+ properties: {
944
+ summary: {
945
+ type: 'string',
946
+ description: '性能分析摘要',
947
+ },
948
+ overallScore: {
949
+ type: 'number',
950
+ minimum: 0,
951
+ maximum: 100,
952
+ description: '总体性能评分',
953
+ },
954
+ bottlenecks: {
955
+ type: 'array',
956
+ description: '性能瓶颈',
957
+ items: {
958
+ type: 'object',
959
+ properties: {
960
+ type: {
961
+ type: 'string',
962
+ enum: ['algorithm', 'memory', 'database', 'network', 'rendering', 'io'],
963
+ description: '瓶颈类型',
964
+ },
965
+ severity: {
966
+ type: 'string',
967
+ enum: ['critical', 'high', 'medium', 'low'],
968
+ },
969
+ location: {
970
+ type: 'object',
971
+ properties: {
972
+ file: { type: 'string' },
973
+ line: { type: 'number' },
974
+ function: { type: 'string' },
975
+ },
976
+ },
977
+ description: { type: 'string' },
978
+ impact: { type: 'string', description: '性能影响' },
979
+ currentMetric: { type: 'string', description: '当前指标' },
980
+ },
981
+ required: ['type', 'severity', 'description'],
982
+ },
983
+ },
984
+ metrics: {
985
+ type: 'object',
986
+ description: '性能指标',
987
+ properties: {
988
+ executionTime: { type: 'number', description: '执行时间(ms)' },
989
+ memoryUsage: { type: 'number', description: '内存使用(MB)' },
990
+ cpuUsage: { type: 'number', description: 'CPU使用率(%)' },
991
+ throughput: { type: 'number', description: '吞吐量' },
992
+ latency: { type: 'number', description: '延迟(ms)' },
993
+ },
994
+ },
995
+ optimizations: {
996
+ type: 'array',
997
+ description: '优化建议',
998
+ items: {
999
+ type: 'object',
1000
+ properties: {
1001
+ title: { type: 'string' },
1002
+ description: { type: 'string' },
1003
+ priority: { type: 'string', enum: ['high', 'medium', 'low'] },
1004
+ expectedImprovement: { type: 'string', description: '预期提升' },
1005
+ implementation: { type: 'string', description: '实现方法' },
1006
+ },
1007
+ required: ['title', 'description', 'priority'],
1008
+ },
1009
+ },
1010
+ benchmarks: {
1011
+ type: 'object',
1012
+ description: '基准测试结果',
1013
+ additionalProperties: true,
1014
+ },
1015
+ },
1016
+ required: ['summary', 'overallScore', 'bottlenecks', 'optimizations'],
1017
+ };