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
@@ -1,4 +1,5 @@
1
1
  import { parseArgs, getString } from "../utils/parseArgs.js";
2
+ import { okStructured } from "../lib/response.js";
2
3
  // genchangelog 工具实现
3
4
  export async function genchangelog(args) {
4
5
  try {
@@ -29,222 +30,45 @@ ${version || "请提供版本号(如:v1.2.0)"}
29
30
 
30
31
  ---
31
32
 
32
- ## Changelog 生成步骤
33
-
34
- ### 第一步:获取 Commit 历史
35
-
36
- 执行以下命令:
37
- \`\`\`bash
38
- # 查看 commit 历史
39
- git log ${from}..${to} --oneline --no-merges
40
-
41
- # 查看详细信息
42
- git log ${from}..${to} --pretty=format:"%h - %s (%an)" --no-merges
43
-
44
- # 查看所有 tags
45
- git tag -l
46
-
47
- # 查看贡献者
48
- git shortlog ${from}..${to} -sn
49
- \`\`\`
50
-
51
- ### 第二步:分类 Commits
52
-
53
- 按类型分组:
54
- - **✨ Features (feat)**:新功能
55
- - **🐛 Bug Fixes (fix)**:Bug 修复
56
- - **📝 Documentation (docs)**:文档变更
57
- - **💄 Styles (style)**:代码格式
58
- - **♻️ Refactoring (refactor)**:重构
59
- - **⚡ Performance (perf)**:性能优化
60
- - **✅ Tests (test)**:测试相关
61
- - **🔧 Chores (chore)**:构建/工具变更
62
- - **💥 BREAKING CHANGES**:破坏性变更
63
-
64
- ### 第三步:生成 Changelog
65
-
66
- **格式标准**:[Keep a Changelog](https://keepachangelog.com/)
67
-
68
- \`\`\`markdown
69
- # Changelog
70
-
71
- All notable changes to this project will be documented in this file.
72
-
73
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
74
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
75
-
76
- ## [版本号] - YYYY-MM-DD
77
-
78
- ### Added(新增)
79
- - 新功能 1 (#PR号)
80
- - 新功能 2 by @contributor
81
-
82
- ### Changed(变更)
83
- - 修改的功能 1
84
- - 修改的功能 2
85
-
86
- ### Deprecated(废弃)
87
- - 即将移除的功能
88
-
89
- ### Removed(移除)
90
- - 已移除的功能
91
-
92
- ### Fixed(修复)
93
- - Bug 修复 1 (#issue号)
94
- - Bug 修复 2
95
-
96
- ### Security(安全)
97
- - 安全漏洞修复
98
-
99
- ## [上一个版本] - YYYY-MM-DD
100
-
101
- ...
102
- \`\`\`
103
-
104
- ---
105
-
106
- ## Changelog 模板
107
-
108
- \`\`\`markdown
109
- # Changelog
110
-
111
- ## [${version || "1.2.0"}] - ${new Date().toISOString().split('T')[0]}
112
-
113
- ### ✨ Added
114
- - 新增用户认证功能 (#123) [@contributor1]
115
- - 新增数据导出功能 (#125)
116
- - 新增邮件通知系统
117
-
118
- ### 🔄 Changed
119
- - 优化数据库查询性能 (#130)
120
- - 更新 UI 设计风格
121
- - 升级依赖包到最新版本
122
-
123
- ### 🗑️ Deprecated
124
- - \`oldAPI()\` 方法即将在 v2.0 中移除,请使用 \`newAPI()\`
125
-
126
- ### ❌ Removed
127
- - 移除了废弃的 \`legacyFeature\`
128
- - 删除了未使用的配置项
129
-
130
- ### 🐛 Fixed
131
- - 修复登录页面样式错误 (#128)
132
- - 修复数据分页显示问题 (#132)
133
- - 修复内存泄漏问题 (#135)
134
-
135
- ### 🔒 Security
136
- - 修复 SQL 注入漏洞 (CVE-2024-XXXX)
137
- - 更新依赖以修复安全漏洞
138
-
139
- ### 💥 BREAKING CHANGES
140
- - API 端点从 \`/api/v1/users\` 改为 \`/api/v2/users\`
141
- - 配置文件格式从 JSON 改为 YAML
142
- - 最低 Node.js 版本要求提升到 18.x
143
-
144
- ### 📚 Documentation
145
- - 更新 README 文档
146
- - 添加 API 使用指南
147
- - 完善贡献指南
148
-
149
- ### 🏗️ Infrastructure
150
- - 升级 CI/CD 流程
151
- - 添加 Docker 支持
152
- - 配置自动化测试
153
-
154
- ### 👥 Contributors
155
- 感谢以下贡献者:
156
- - @contributor1 - 3 commits
157
- - @contributor2 - 2 commits
158
- - @contributor3 - 1 commit
159
-
160
- **Full Changelog**: https://github.com/owner/repo/compare/v1.1.0...v${version || "1.2.0"}
161
- \`\`\`
162
-
163
- ---
164
-
165
- ## Changelog 最佳实践
166
-
167
- ### 内容要求
168
-
169
- 1. **明确说明变更**
170
- - 用户能理解的语言(避免技术术语)
171
- - 说明影响范围
172
- - 提供迁移指南(破坏性变更)
173
-
174
- 2. **链接相关 Issue/PR**
175
- - 使用 (#123) 格式
176
- - 方便追溯详细信息
177
-
178
- 3. **归功贡献者**
179
- - 使用 @username 格式
180
- - 体现团队协作
181
-
182
- ### 版本规范
183
-
184
- **语义化版本 (Semantic Versioning)**:
185
- - **Major (X.0.0)**:破坏性变更
186
- - **Minor (x.X.0)**:新功能(向后兼容)
187
- - **Patch (x.x.X)**:Bug 修复
188
-
189
- ### 发布流程
190
-
191
- 1. 更新 CHANGELOG.md
192
- 2. 更新 package.json 版本号
193
- 3. 创建 Git tag:\`git tag -a v1.2.0 -m "Release v1.2.0"\`
194
- 4. 推送 tag:\`git push origin v1.2.0\`
195
- 5. 发布 GitHub Release
196
-
197
- ---
198
-
199
- ## 自动化工具
200
-
201
- **推荐工具**:
202
- - **standard-version**:自动生成 changelog
203
- - **conventional-changelog**:基于 commit 生成
204
- - **semantic-release**:自动发布版本
205
-
206
- **使用示例**:
207
- \`\`\`bash
208
- # 安装
209
- npm install -D standard-version
210
-
211
- # 生成 changelog
212
- npx standard-version
213
-
214
- # 首次发布
215
- npx standard-version --first-release
216
- \`\`\`
217
-
218
- ---
219
-
220
- ---
221
-
222
- ## ⚠️ 边界约束
223
-
224
- - ❌ 仅输出 CHANGELOG 文本,不自动写入文件
225
- - ❌ 不执行 git 命令
226
- - ✅ 输出完整的 CHANGELOG Markdown
227
-
228
- 现在请根据 commit 历史生成详细的 CHANGELOG.md 内容。`;
229
- return {
230
- content: [
231
- {
232
- type: "text",
233
- text: message,
234
- },
235
- ],
33
+ ## Changelog 生成指南
34
+
35
+ 请生成符合 [Keep a Changelog](https://keepachangelog.com/) 规范的 CHANGELOG,包括:
36
+
37
+ 1. **Added(新增)** - 新功能
38
+ 2. **Changed(变更)** - 功能修改
39
+ 3. **Deprecated(废弃)** - 即将移除的功能
40
+ 4. **Removed(移除)** - 已移除的功能
41
+ 5. **Fixed(修复)** - Bug 修复
42
+ 6. **Security(安全)** - 安全漏洞修复
43
+
44
+ **重要**: 请使用结构化输出格式返回结果。`;
45
+ // 创建结构化数据对象
46
+ const structuredData = {
47
+ summary: `生成 ${version || "新版本"} 的 Changelog`,
48
+ version: version || "",
49
+ date: new Date().toISOString().split('T')[0],
50
+ content: "", // AI 将填充实际的 Changelog 内容
51
+ changes: {
52
+ features: [],
53
+ fixes: [],
54
+ breaking: [],
55
+ },
236
56
  };
57
+ return okStructured(message, structuredData, {
58
+ schema: (await import("../schemas/output/generation-tools.js")).ChangelogSchema,
59
+ });
237
60
  }
238
61
  catch (error) {
239
62
  const errorMessage = error instanceof Error ? error.message : String(error);
240
- return {
241
- content: [
242
- {
243
- type: "text",
244
- text: `❌ 生成 Changelog 失败: ${errorMessage}`,
245
- },
246
- ],
247
- isError: true,
63
+ const errorData = {
64
+ summary: "Changelog 生成失败",
65
+ version: "",
66
+ date: new Date().toISOString().split('T')[0],
67
+ content: "",
68
+ changes: {},
248
69
  };
70
+ return okStructured(`❌ 生成 Changelog 失败: ${errorMessage}`, errorData, {
71
+ schema: (await import("../schemas/output/generation-tools.js")).ChangelogSchema,
72
+ });
249
73
  }
250
74
  }
@@ -1,10 +1,4 @@
1
- export declare function gencommit(args: any): Promise<{
2
- content: {
3
- type: string;
4
- text: string;
5
- }[];
6
- isError?: undefined;
7
- } | {
1
+ export declare function gencommit(args: any): Promise<import("../lib/response.js").ToolResponse | {
8
2
  content: {
9
3
  type: string;
10
4
  text: string;
@@ -1,4 +1,6 @@
1
1
  import { parseArgs, getString } from "../utils/parseArgs.js";
2
+ import { okStructured } from "../lib/response.js";
3
+ import { CommitMessageSchema } from "../schemas/structured-output.js";
2
4
  // gencommit 工具实现
3
5
  export async function gencommit(args) {
4
6
  try {
@@ -25,7 +27,7 @@ export async function gencommit(args) {
25
27
  if (input) {
26
28
  changes = input;
27
29
  }
28
- const message = `请按以下步骤生成规范的 Git commit 消息:
30
+ const textMessage = `请按以下步骤生成规范的 Git commit 消息:
29
31
 
30
32
  **第一步:获取变更信息**
31
33
  ${changes ? `已提供变更内容:\n${changes}` : `
@@ -109,19 +111,25 @@ chore: 🤖 升级依赖版本至 1.2.9
109
111
  💡 **提示**:
110
112
  - 如果暂存区为空,提示用户先使用 \`git add\` 添加文件
111
113
  - 如果变更较多,建议分多次提交
112
- - 确保 commit 消息清晰描述了"做了什么"和"为什么"
113
-
114
- ---
115
-
116
- 现在请开始执行上述步骤。`;
117
- return {
118
- content: [
119
- {
120
- type: "text",
121
- text: message,
122
- },
123
- ],
114
+ - 确保 commit 消息清晰描述了"做了什么"和"为什么"`;
115
+ // 创建示例结构化数据(用于演示格式)
116
+ // 注意:实际的 commit 数据应该由 AI 根据实际变更生成
117
+ const exampleCommitData = {
118
+ type: type || 'feat',
119
+ scope: '',
120
+ subject: '示例:添加新功能',
121
+ body: '这是一个示例 commit 消息\n\n实际使用时,AI 会根据代码变更生成真实的 commit 内容',
122
+ footer: '',
123
+ fullMessage: 'feat: 🎸 示例:添加新功能\n\n这是一个示例 commit 消息\n\n实际使用时,AI 会根据代码变更生成真实的 commit 内容',
124
+ emoji: '🎸',
124
125
  };
126
+ // 返回结构化输出
127
+ // textMessage 提供人类可读的指导信息
128
+ // exampleCommitData 提供结构化数据示例(AI 会根据实际情况生成真实数据)
129
+ return okStructured(textMessage, exampleCommitData, {
130
+ schema: CommitMessageSchema,
131
+ note: 'AI 应该根据实际代码变更生成真实的 commit 数据,而不是使用这个示例',
132
+ });
125
133
  }
126
134
  catch (error) {
127
135
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -1,13 +1 @@
1
- export declare function gendoc(args: any): Promise<{
2
- content: {
3
- type: string;
4
- text: string;
5
- }[];
6
- isError?: undefined;
7
- } | {
8
- content: {
9
- type: string;
10
- text: string;
11
- }[];
12
- isError: boolean;
13
- }>;
1
+ export declare function gendoc(args: any): Promise<import("../lib/response.js").ToolResponse>;
@@ -1,4 +1,5 @@
1
1
  import { parseArgs, getString } from "../utils/parseArgs.js";
2
+ import { okStructured } from "../lib/response.js";
2
3
  // gendoc 工具实现
3
4
  export async function gendoc(args) {
4
5
  try {
@@ -208,25 +209,27 @@ type TypeName = {
208
209
  2. 复杂逻辑的行内注释
209
210
  3. 使用示例
210
211
  4. 特殊情况说明`;
211
- return {
212
- content: [
213
- {
214
- type: "text",
215
- text: message,
216
- },
217
- ],
212
+ // 创建结构化数据对象
213
+ const documentation = {
214
+ summary: `为代码生成 ${style} 风格的${lang === "zh" ? "中文" : "英文"}注释`,
215
+ docType: style,
216
+ documentation: message,
217
+ functions: [],
218
218
  };
219
+ return okStructured(message, documentation, {
220
+ schema: (await import("../schemas/output/generation-tools.js")).DocumentationSchema,
221
+ });
219
222
  }
220
223
  catch (error) {
221
224
  const errorMessage = error instanceof Error ? error.message : String(error);
222
- return {
223
- content: [
224
- {
225
- type: "text",
226
- text: `❌ 生成注释失败: ${errorMessage}`,
227
- },
228
- ],
229
- isError: true,
225
+ const errorData = {
226
+ summary: `生成注释失败: ${errorMessage}`,
227
+ docType: 'jsdoc',
228
+ documentation: '',
229
+ functions: [],
230
230
  };
231
+ return okStructured(`❌ 生成注释失败: ${errorMessage}`, errorData, {
232
+ schema: (await import("../schemas/output/generation-tools.js")).DocumentationSchema,
233
+ });
231
234
  }
232
235
  }
@@ -1,13 +1 @@
1
- export declare function genpr(args: any): Promise<{
2
- content: {
3
- type: string;
4
- text: string;
5
- }[];
6
- isError?: undefined;
7
- } | {
8
- content: {
9
- type: string;
10
- text: string;
11
- }[];
12
- isError: boolean;
13
- }>;
1
+ export declare function genpr(args: any): Promise<import("../lib/response.js").ToolResponse>;
@@ -1,4 +1,5 @@
1
1
  import { parseArgs, getString } from "../utils/parseArgs.js";
2
+ import { okStructured } from "../lib/response.js";
2
3
  // genpr 工具实现
3
4
  export async function genpr(args) {
4
5
  try {
@@ -28,167 +29,37 @@ ${commits || "请先执行 git log 查看 commit 历史"}
28
29
 
29
30
  ## PR 描述生成指南
30
31
 
31
- ### 第一步:分析变更内容
32
-
33
- 执行以下命令获取详细信息:
34
- \`\`\`bash
35
- # 查看 commit 历史
36
- git log origin/main..HEAD --oneline
37
-
38
- # 查看具体变更
39
- git diff origin/main..HEAD --stat
40
-
41
- # 查看修改的文件
42
- git diff origin/main..HEAD --name-only
43
- \`\`\`
44
-
45
- ### 第二步:生成 PR 描述
46
-
47
- **标准 PR 模板**:
48
-
49
- \`\`\`markdown
50
- ## 📝 变更说明
51
-
52
- ### 概述
53
- 简要说明这个 PR 的目的和背景(2-3 句话)
54
-
55
- ### 变更内容
56
- - 🎨 UI/UX 改进:...
57
- - ✨ 新功能:...
58
- - 🐛 Bug 修复:...
59
- - ♻️ 重构:...
60
- - 📝 文档更新:...
61
- - 🚀 性能优化:...
62
-
63
- ## 🎯 解决的问题
64
-
65
- Closes #123
66
- Fixes #456
67
- Relates to #789
68
-
69
- ## 🔧 技术细节
70
-
71
- ### 主要修改
72
- 1. **模块 A**:修改内容和原因
73
- 2. **模块 B**:修改内容和原因
74
-
75
- ### 架构变更(如有)
76
- - 数据库 Schema 变更
77
- - API 接口变更
78
- - 配置文件变更
79
-
80
- ### 依赖变更(如有)
81
- - 新增依赖:\`package-name@version\`
82
- - 移除依赖:\`old-package\`
83
- - 升级依赖:\`package@old → package@new\`
84
-
85
- ## ✅ 测试计划
86
-
87
- ### 单元测试
88
- - [x] 新增测试用例覆盖新功能
89
- - [x] 所有测试通过
90
- - [x] 测试覆盖率 > 80%
91
-
92
- ### 集成测试
93
- - [x] API 接口测试通过
94
- - [x] 端到端测试通过
95
-
96
- ### 手动测试
97
- - [x] 功能 A 正常工作
98
- - [x] 功能 B 正常工作
99
- - [x] 边界情况验证
100
-
101
- ## 📸 截图/录屏(UI 变更时)
102
-
103
- ### Before
104
- ![Before Screenshot](url)
105
-
106
- ### After
107
- ![After Screenshot](url)
108
-
109
- ## ⚠️ 注意事项
110
-
111
- ### Breaking Changes(破坏性变更)
112
- - ⚠️ API 路径从 \`/old\` 改为 \`/new\`
113
- - ⚠️ 配置文件格式变更
114
-
115
- ### 部署注意
116
- - 需要执行数据库迁移:\`npm run migrate\`
117
- - 需要更新环境变量:\`NEW_VAR=value\`
118
- - 需要重启服务
119
-
120
- ### 向后兼容性
121
- - ✅ 完全兼容
122
- - ⚠️ 部分兼容(说明不兼容的部分)
123
- - ❌ 不兼容(需要特殊处理)
124
-
125
- ## 📋 Checklist
126
-
127
- - [ ] 代码通过 lint 检查
128
- - [ ] 所有测试通过
129
- - [ ] 文档已更新
130
- - [ ] Changelog 已更新
131
- - [ ] 性能影响已评估
132
- - [ ] 安全影响已评估
133
- - [ ] 代码已自我审查
134
- - [ ] 已添加必要的注释
135
-
136
- ## 🔗 相关链接
137
-
138
- - 设计文档:[链接]
139
- - 技术方案:[链接]
140
- - 相关 PR:#xxx
141
-
142
- ## 👥 审查者
143
-
144
- @reviewer1 @reviewer2
145
-
146
- ## 🙏 致谢
147
-
148
- 感谢 @contributor1 的建议
149
- \`\`\`
150
-
151
- ---
152
-
153
- ## PR 标题规范
154
-
155
- 格式:\`<type>(<scope>): <subject>\`
156
-
157
- **示例**:
158
- - \`feat(auth): 添加 OAuth2 登录支持\`
159
- - \`fix(api): 修复用户查询接口分页错误\`
160
- - \`refactor(ui): 重构组件层级结构\`
161
-
162
- ---
163
-
164
- ---
165
-
166
- ## ⚠️ 边界约束
167
-
168
- - ❌ 仅输出 PR 描述文本,不自动创建 PR
169
- - ❌ 不执行 git 命令
170
- - ✅ 输出完整的 PR 描述 Markdown
171
-
172
- 现在请根据变更内容生成完整的 PR 描述,并建议合适的审查者。`;
173
- return {
174
- content: [
175
- {
176
- type: "text",
177
- text: message,
178
- },
179
- ],
32
+ 请生成完整的 PR 描述,包括:
33
+
34
+ 1. **变更说明** - 概述和详细变更内容
35
+ 2. **解决的问题** - 关联的 Issue
36
+ 3. **技术细节** - 主要修改和架构变更
37
+ 4. **测试计划** - 测试覆盖情况
38
+ 5. **注意事项** - 破坏性变更、部署注意事项
39
+ 6. **Checklist** - 代码审查清单
40
+
41
+ **重要**: 请使用结构化输出格式返回结果。`;
42
+ // 创建结构化数据对象
43
+ const structuredData = {
44
+ summary: `生成 ${branch || "分支"} 的 PR 描述`,
45
+ title: "", // AI 将填充 PR 标题
46
+ description: "", // AI 将填充 PR 描述
47
+ type: "feature", // AI 将根据内容判断类型
180
48
  };
49
+ return okStructured(message, structuredData, {
50
+ schema: (await import("../schemas/output/generation-tools.js")).PullRequestSchema,
51
+ });
181
52
  }
182
53
  catch (error) {
183
54
  const errorMessage = error instanceof Error ? error.message : String(error);
184
- return {
185
- content: [
186
- {
187
- type: "text",
188
- text: `❌ 生成 PR 描述失败: ${errorMessage}`,
189
- },
190
- ],
191
- isError: true,
55
+ const errorData = {
56
+ summary: "PR 描述生成失败",
57
+ title: "",
58
+ description: "",
59
+ type: "feature",
192
60
  };
61
+ return okStructured(`❌ 生成 PR 描述失败: ${errorMessage}`, errorData, {
62
+ schema: (await import("../schemas/output/generation-tools.js")).PullRequestSchema,
63
+ });
193
64
  }
194
65
  }
@@ -1,13 +1 @@
1
- export declare function genreadme(args: any): Promise<{
2
- content: {
3
- type: string;
4
- text: string;
5
- }[];
6
- isError?: undefined;
7
- } | {
8
- content: {
9
- type: string;
10
- text: string;
11
- }[];
12
- isError: boolean;
13
- }>;
1
+ export declare function genreadme(args: any): Promise<import("../lib/response.js").ToolResponse>;