mcp-probe-kit 3.0.3 → 3.0.6
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.
- package/README.md +457 -423
- package/build/index.js +434 -140
- package/build/lib/template-loader.js +317 -317
- package/build/lib/tool-execution-context.d.ts +8 -0
- package/build/lib/tool-execution-context.js +20 -0
- package/build/schemas/git-tools.js +16 -16
- package/build/tools/__tests__/start_bugfix.unit.test.js +14 -14
- package/build/tools/__tests__/start_ui.unit.test.js +11 -11
- package/build/tools/add_feature.js +79 -79
- package/build/tools/ask_user.js +5 -5
- package/build/tools/interview.js +9 -9
- package/build/tools/start_bugfix.d.ts +2 -1
- package/build/tools/start_bugfix.js +131 -122
- package/build/tools/start_feature.d.ts +2 -1
- package/build/tools/start_feature.js +113 -104
- package/build/tools/start_onboard.d.ts +2 -1
- package/build/tools/start_onboard.js +57 -51
- package/build/tools/start_product.d.ts +2 -1
- package/build/tools/start_product.js +9 -1
- package/build/tools/start_ralph.d.ts +2 -1
- package/build/tools/start_ralph.js +9 -3
- package/build/tools/start_ui.d.ts +2 -1
- package/build/tools/start_ui.js +102 -88
- package/build/tools/ui-ux-tools.d.ts +2 -1
- package/build/tools/ui-ux-tools.js +19 -3
- package/build/utils/ui-sync.d.ts +6 -2
- package/build/utils/ui-sync.js +125 -29
- package/docs/assets/font/MaterialSymbolsOutlined.codepoints +4102 -0
- package/docs/assets/font/MaterialSymbolsOutlined.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-400.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-700.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-900.ttf +0 -0
- package/docs/assets/js/i18n.js +375 -0
- package/docs/assets/js/tailwind.js +83 -83
- package/docs/assets/logo-zh.png +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/data/tools.js +21 -21
- package/docs/debug-i18n.html +163 -0
- package/docs/i18n/all-tools/en.json +157 -0
- package/docs/i18n/all-tools/ja.json +157 -0
- package/docs/i18n/all-tools/ko.json +157 -0
- package/docs/i18n/all-tools/zh-CN.json +157 -0
- package/docs/i18n/en.json +518 -0
- package/docs/i18n/ja.json +518 -0
- package/docs/i18n/ko.json +518 -0
- package/docs/i18n/zh-CN.json +518 -0
- package/docs/index.html +43 -32
- package/docs/pages/all-tools.html +514 -330
- package/docs/pages/examples.html +689 -673
- package/docs/pages/getting-started.html +589 -577
- package/docs/pages/migration.html +298 -283
- package/package.json +6 -6
- package/docs/project-context/architecture.md +0 -0
- package/docs/project-context/how-to-develop.md +0 -313
- package/docs/project-context/how-to-test.md +0 -457
- package/docs/project-context/tech-stack.md +0 -96
- package/docs/project-context.md +0 -53
- package/docs/specs/git-work-report/design.md +0 -568
- package/docs/specs/git-work-report/requirements.md +0 -131
- package/docs/specs/git-work-report/tasks.md +0 -197
|
@@ -23,22 +23,22 @@ export const gitToolSchemas = [
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: "git_work_report",
|
|
26
|
-
description: `基于 Git diff 分析生成工作报告(日报/周期报)
|
|
27
|
-
|
|
28
|
-
核心功能:
|
|
29
|
-
- 支持日报模式(单个日期)和周期报模式(日期范围)
|
|
30
|
-
- 自动读取指定日期的所有 Git 提交
|
|
31
|
-
- 对每个提交执行 git show 获取完整 diff
|
|
32
|
-
- 使用 AI 分析 diff 内容提取实际工作内容
|
|
33
|
-
|
|
34
|
-
输出格式:
|
|
35
|
-
- 只输出「工作内容」部分
|
|
36
|
-
- 每条以 - 开头,中文,简洁专业
|
|
37
|
-
- 格式:做了什么 + 改了哪里/达到什么效果
|
|
38
|
-
- 不输出:提交哈希、文件列表、统计数据、风险总结
|
|
39
|
-
|
|
40
|
-
使用示例:
|
|
41
|
-
- 日报:git_work_report --date 2026-1-27
|
|
26
|
+
description: `基于 Git diff 分析生成工作报告(日报/周期报)
|
|
27
|
+
|
|
28
|
+
核心功能:
|
|
29
|
+
- 支持日报模式(单个日期)和周期报模式(日期范围)
|
|
30
|
+
- 自动读取指定日期的所有 Git 提交
|
|
31
|
+
- 对每个提交执行 git show 获取完整 diff
|
|
32
|
+
- 使用 AI 分析 diff 内容提取实际工作内容
|
|
33
|
+
|
|
34
|
+
输出格式:
|
|
35
|
+
- 只输出「工作内容」部分
|
|
36
|
+
- 每条以 - 开头,中文,简洁专业
|
|
37
|
+
- 格式:做了什么 + 改了哪里/达到什么效果
|
|
38
|
+
- 不输出:提交哈希、文件列表、统计数据、风险总结
|
|
39
|
+
|
|
40
|
+
使用示例:
|
|
41
|
+
- 日报:git_work_report --date 2026-1-27
|
|
42
42
|
- 周期报:git_work_report --start_date 2026-2-1 --end_date 2026-2-6`,
|
|
43
43
|
inputSchema: {
|
|
44
44
|
type: "object",
|
|
@@ -47,20 +47,20 @@ describe('start_bugfix 单元测试', () => {
|
|
|
47
47
|
});
|
|
48
48
|
test('template_profile 自动选择 strict(结构化输入)', async () => {
|
|
49
49
|
const result = await startBugfix({
|
|
50
|
-
error_message: `## 复现步骤
|
|
51
|
-
1. 打开登录页
|
|
52
|
-
2. 输入错误账号
|
|
53
|
-
3. 点击登录
|
|
54
|
-
|
|
55
|
-
## 期望
|
|
56
|
-
提示错误信息并保持页面可交互
|
|
57
|
-
|
|
58
|
-
## 实际
|
|
59
|
-
页面白屏,控制台报错
|
|
60
|
-
|
|
61
|
-
## 环境
|
|
62
|
-
- 浏览器: Chrome 120
|
|
63
|
-
- 系统: Windows 11
|
|
50
|
+
error_message: `## 复现步骤
|
|
51
|
+
1. 打开登录页
|
|
52
|
+
2. 输入错误账号
|
|
53
|
+
3. 点击登录
|
|
54
|
+
|
|
55
|
+
## 期望
|
|
56
|
+
提示错误信息并保持页面可交互
|
|
57
|
+
|
|
58
|
+
## 实际
|
|
59
|
+
页面白屏,控制台报错
|
|
60
|
+
|
|
61
|
+
## 环境
|
|
62
|
+
- 浏览器: Chrome 120
|
|
63
|
+
- 系统: Windows 11
|
|
64
64
|
- 版本: v2.3.0`,
|
|
65
65
|
stack_trace: 'TypeError: Cannot read property',
|
|
66
66
|
template_profile: 'auto',
|
|
@@ -62,17 +62,17 @@ describe('start_ui 单元测试', () => {
|
|
|
62
62
|
describe('模板档位', () => {
|
|
63
63
|
test('auto 模式可自动选择 strict', async () => {
|
|
64
64
|
const result = await startUi({
|
|
65
|
-
description: `# 页面目标
|
|
66
|
-
需要一个带筛选和批量操作的管理后台,用于管理订单与用户数据,包含导出与权限控制。
|
|
67
|
-
|
|
68
|
-
## 关键交互
|
|
69
|
-
1. 支持筛选、排序、分页、导出
|
|
70
|
-
2. 批量启用/禁用、批量标签、批量删除
|
|
71
|
-
|
|
72
|
-
## 数据来源
|
|
73
|
-
来自订单服务与用户服务接口,刷新频率 30s
|
|
74
|
-
|
|
75
|
-
## 状态
|
|
65
|
+
description: `# 页面目标
|
|
66
|
+
需要一个带筛选和批量操作的管理后台,用于管理订单与用户数据,包含导出与权限控制。
|
|
67
|
+
|
|
68
|
+
## 关键交互
|
|
69
|
+
1. 支持筛选、排序、分页、导出
|
|
70
|
+
2. 批量启用/禁用、批量标签、批量删除
|
|
71
|
+
|
|
72
|
+
## 数据来源
|
|
73
|
+
来自订单服务与用户服务接口,刷新频率 30s
|
|
74
|
+
|
|
75
|
+
## 状态
|
|
76
76
|
空态、加载态、错误态、无权限提示、空筛选结果`,
|
|
77
77
|
template_profile: 'auto',
|
|
78
78
|
});
|
|
@@ -206,85 +206,85 @@ export async function addFeature(args) {
|
|
|
206
206
|
};
|
|
207
207
|
const fenceOpen = "````markdown";
|
|
208
208
|
const fenceClose = "````";
|
|
209
|
-
const guide = `# 添加新功能指南(模板驱动)
|
|
210
|
-
|
|
211
|
-
## 🎯 任务目标
|
|
212
|
-
|
|
213
|
-
为项目添加新功能:**${featureName}**
|
|
214
|
-
|
|
215
|
-
**功能描述**: ${description}
|
|
216
|
-
|
|
217
|
-
**模板档位**: ${templateProfile}${profileDecision.requested === 'auto' ? '(自动)' : ''}
|
|
218
|
-
${profileDecision.requested === 'auto' && profileDecision.reason ? `**选择理由**: ${profileDecision.reason}` : ''}
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## 📋 前置检查
|
|
223
|
-
|
|
224
|
-
1. 检查文件 \`${docsDir}/project-context.md\` 是否存在
|
|
225
|
-
2. 如果存在,读取并参考其中的技术栈、架构模式、编码规范
|
|
226
|
-
3. 如果不存在,建议先运行 \`init_project_context\` 工具
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## ✅ 模板校验结果
|
|
231
|
-
|
|
232
|
-
${formatValidation('requirements.md', requirementsTemplate.validation)}
|
|
233
|
-
${formatValidation('design.md', designTemplate.validation)}
|
|
234
|
-
${formatValidation('tasks.md', tasksTemplate.validation)}
|
|
235
|
-
${combinedValidation.warnings.length > 0 ? `- 其他警告: ${combinedValidation.warnings.join(';')}` : ''}
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
## 📝 创建文档
|
|
240
|
-
|
|
241
|
-
请在 \`${docsDir}/specs/${featureName}/\` 目录下创建以下三个文件:
|
|
242
|
-
|
|
243
|
-
### 文件 1: requirements.md
|
|
244
|
-
|
|
245
|
-
**文件路径**: \`${docsDir}/specs/${featureName}/requirements.md\`
|
|
246
|
-
**模板来源**: ${requirementsTemplate.source}
|
|
247
|
-
|
|
248
|
-
${fenceOpen}
|
|
249
|
-
${requirementsTemplate.content}
|
|
250
|
-
${fenceClose}
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
### 文件 2: design.md
|
|
255
|
-
|
|
256
|
-
**文件路径**: \`${docsDir}/specs/${featureName}/design.md\`
|
|
257
|
-
**模板来源**: ${designTemplate.source}
|
|
258
|
-
|
|
259
|
-
${fenceOpen}
|
|
260
|
-
${designTemplate.content}
|
|
261
|
-
${fenceClose}
|
|
262
|
-
|
|
263
|
-
---
|
|
264
|
-
|
|
265
|
-
### 文件 3: tasks.md
|
|
266
|
-
|
|
267
|
-
**文件路径**: \`${docsDir}/specs/${featureName}/tasks.md\`
|
|
268
|
-
**模板来源**: ${tasksTemplate.source}
|
|
269
|
-
|
|
270
|
-
${fenceOpen}
|
|
271
|
-
${tasksTemplate.content}
|
|
272
|
-
${fenceClose}
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## ✅ 完成后检查
|
|
277
|
-
|
|
278
|
-
- [ ] \`${docsDir}/specs/${featureName}/requirements.md\` 已创建
|
|
279
|
-
- [ ] \`${docsDir}/specs/${featureName}/design.md\` 已创建
|
|
280
|
-
- [ ] \`${docsDir}/specs/${featureName}/tasks.md\` 已创建
|
|
281
|
-
- [ ] 所有占位符已替换
|
|
282
|
-
- [ ] 内容与项目上下文一致(如有)
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
*指南版本: 1.1.0*
|
|
287
|
-
*工具: MCP Probe Kit - add_feature*
|
|
209
|
+
const guide = `# 添加新功能指南(模板驱动)
|
|
210
|
+
|
|
211
|
+
## 🎯 任务目标
|
|
212
|
+
|
|
213
|
+
为项目添加新功能:**${featureName}**
|
|
214
|
+
|
|
215
|
+
**功能描述**: ${description}
|
|
216
|
+
|
|
217
|
+
**模板档位**: ${templateProfile}${profileDecision.requested === 'auto' ? '(自动)' : ''}
|
|
218
|
+
${profileDecision.requested === 'auto' && profileDecision.reason ? `**选择理由**: ${profileDecision.reason}` : ''}
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 📋 前置检查
|
|
223
|
+
|
|
224
|
+
1. 检查文件 \`${docsDir}/project-context.md\` 是否存在
|
|
225
|
+
2. 如果存在,读取并参考其中的技术栈、架构模式、编码规范
|
|
226
|
+
3. 如果不存在,建议先运行 \`init_project_context\` 工具
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## ✅ 模板校验结果
|
|
231
|
+
|
|
232
|
+
${formatValidation('requirements.md', requirementsTemplate.validation)}
|
|
233
|
+
${formatValidation('design.md', designTemplate.validation)}
|
|
234
|
+
${formatValidation('tasks.md', tasksTemplate.validation)}
|
|
235
|
+
${combinedValidation.warnings.length > 0 ? `- 其他警告: ${combinedValidation.warnings.join(';')}` : ''}
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## 📝 创建文档
|
|
240
|
+
|
|
241
|
+
请在 \`${docsDir}/specs/${featureName}/\` 目录下创建以下三个文件:
|
|
242
|
+
|
|
243
|
+
### 文件 1: requirements.md
|
|
244
|
+
|
|
245
|
+
**文件路径**: \`${docsDir}/specs/${featureName}/requirements.md\`
|
|
246
|
+
**模板来源**: ${requirementsTemplate.source}
|
|
247
|
+
|
|
248
|
+
${fenceOpen}
|
|
249
|
+
${requirementsTemplate.content}
|
|
250
|
+
${fenceClose}
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### 文件 2: design.md
|
|
255
|
+
|
|
256
|
+
**文件路径**: \`${docsDir}/specs/${featureName}/design.md\`
|
|
257
|
+
**模板来源**: ${designTemplate.source}
|
|
258
|
+
|
|
259
|
+
${fenceOpen}
|
|
260
|
+
${designTemplate.content}
|
|
261
|
+
${fenceClose}
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### 文件 3: tasks.md
|
|
266
|
+
|
|
267
|
+
**文件路径**: \`${docsDir}/specs/${featureName}/tasks.md\`
|
|
268
|
+
**模板来源**: ${tasksTemplate.source}
|
|
269
|
+
|
|
270
|
+
${fenceOpen}
|
|
271
|
+
${tasksTemplate.content}
|
|
272
|
+
${fenceClose}
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## ✅ 完成后检查
|
|
277
|
+
|
|
278
|
+
- [ ] \`${docsDir}/specs/${featureName}/requirements.md\` 已创建
|
|
279
|
+
- [ ] \`${docsDir}/specs/${featureName}/design.md\` 已创建
|
|
280
|
+
- [ ] \`${docsDir}/specs/${featureName}/tasks.md\` 已创建
|
|
281
|
+
- [ ] 所有占位符已替换
|
|
282
|
+
- [ ] 内容与项目上下文一致(如有)
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
*指南版本: 1.1.0*
|
|
287
|
+
*工具: MCP Probe Kit - add_feature*
|
|
288
288
|
`;
|
|
289
289
|
return okText(guide, {
|
|
290
290
|
schema: (await import("../schemas/output/project-tools.js")).FeatureSpecSchema,
|
package/build/tools/ask_user.js
CHANGED
package/build/tools/interview.js
CHANGED
|
@@ -302,11 +302,11 @@ export async function interview(args) {
|
|
|
302
302
|
],
|
|
303
303
|
outputs: ["访谈问题列表或访谈记录文件"],
|
|
304
304
|
});
|
|
305
|
-
const text = `${header}# 📋 需求访谈工具
|
|
306
|
-
|
|
307
|
-
## 功能说明
|
|
308
|
-
|
|
309
|
-
在开发新功能前,通过结构化访谈澄清需求,避免理解偏差和返工。
|
|
305
|
+
const text = `${header}# 📋 需求访谈工具
|
|
306
|
+
|
|
307
|
+
## 功能说明
|
|
308
|
+
|
|
309
|
+
在开发新功能前,通过结构化访谈澄清需求,避免理解偏差和返工。
|
|
310
310
|
|
|
311
311
|
**核心理念**: 先慢下来,把问题想清楚,反而能更快地交付正确的解决方案。
|
|
312
312
|
|
|
@@ -354,10 +354,10 @@ interview --feature-name user-login --answers {...}
|
|
|
354
354
|
## 为什么需要访谈?
|
|
355
355
|
|
|
356
356
|
- ✅ 澄清需求,避免理解偏差
|
|
357
|
-
- ✅ 发现隐藏的约束和依赖
|
|
358
|
-
- ✅ 减少返工,提高交付质量
|
|
359
|
-
- ✅ 形成清晰的需求文档
|
|
360
|
-
|
|
357
|
+
- ✅ 发现隐藏的约束和依赖
|
|
358
|
+
- ✅ 减少返工,提高交付质量
|
|
359
|
+
- ✅ 形成清晰的需求文档
|
|
360
|
+
|
|
361
361
|
**先慢下来,反而能更快。**`;
|
|
362
362
|
const structuredData = {
|
|
363
363
|
summary: "需求访谈工具使用说明",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ToolExecutionContext } from "../lib/tool-execution-context.js";
|
|
2
|
+
export declare function startBugfix(args: any, context?: ToolExecutionContext): Promise<import("../lib/response.js").ToolResponse | {
|
|
2
3
|
content: {
|
|
3
4
|
type: string;
|
|
4
5
|
text: string;
|
|
@@ -2,6 +2,7 @@ import { parseArgs, getString, getNumber } from "../utils/parseArgs.js";
|
|
|
2
2
|
import { okStructured } from "../lib/response.js";
|
|
3
3
|
import { renderOrchestrationHeader } from "../lib/orchestration-guidance.js";
|
|
4
4
|
import { BugFixReportSchema, RequirementsLoopSchema } from "../schemas/structured-output.js";
|
|
5
|
+
import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
|
|
5
6
|
function decideTemplateProfile(description) {
|
|
6
7
|
const text = description || '';
|
|
7
8
|
const lengthScore = text.length >= 200 ? 2 : text.length >= 120 ? 1 : 0;
|
|
@@ -40,11 +41,11 @@ function resolveTemplateProfile(rawProfile, description) {
|
|
|
40
41
|
warning: `模板档位 "${rawProfile}" 不支持,已回退为 ${fallback}`,
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
|
-
const PROMPT_TEMPLATE_GUIDED = `# 🐛 Bug 修复编排指南
|
|
44
|
-
|
|
45
|
-
## 🎯 目标
|
|
46
|
-
|
|
47
|
-
修复以下 Bug:
|
|
44
|
+
const PROMPT_TEMPLATE_GUIDED = `# 🐛 Bug 修复编排指南
|
|
45
|
+
|
|
46
|
+
## 🎯 目标
|
|
47
|
+
|
|
48
|
+
修复以下 Bug:
|
|
48
49
|
|
|
49
50
|
**错误信息**:
|
|
50
51
|
\`\`\`
|
|
@@ -133,125 +134,125 @@ const PROMPT_TEMPLATE_GUIDED = `# 🐛 Bug 修复编排指南
|
|
|
133
134
|
|
|
134
135
|
---
|
|
135
136
|
|
|
136
|
-
*编排工具: MCP Probe Kit - start_bugfix*
|
|
137
|
+
*编排工具: MCP Probe Kit - start_bugfix*
|
|
137
138
|
`;
|
|
138
|
-
const PROMPT_TEMPLATE_STRICT = `# 🐛 Bug 修复编排(严格)
|
|
139
|
-
|
|
140
|
-
## 🎯 目标
|
|
141
|
-
修复 Bug:{error_message}
|
|
142
|
-
|
|
143
|
-
{stack_trace_section}
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## ✅ 执行计划(按顺序)
|
|
148
|
-
|
|
149
|
-
1) 检查 \`docs/project-context.md\`,缺失则调用 \`init_project_context\`
|
|
150
|
-
2) 调用 \`fix_bug\`
|
|
151
|
-
\`\`\`json
|
|
152
|
-
{
|
|
153
|
-
"error_message": "{error_message}",
|
|
154
|
-
"stack_trace": "{stack_trace}"
|
|
155
|
-
}
|
|
156
|
-
\`\`\`
|
|
157
|
-
3) 调用 \`gentest\`
|
|
158
|
-
\`\`\`json
|
|
159
|
-
{
|
|
160
|
-
"code": "[修复后的代码]",
|
|
161
|
-
"framework": "[根据项目上下文选择: jest/vitest/mocha]"
|
|
162
|
-
}
|
|
163
|
-
\`\`\`
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## ✅ 输出汇总
|
|
168
|
-
1. Bug 原因
|
|
169
|
-
2. 修复方案
|
|
170
|
-
3. 修改文件
|
|
171
|
-
4. 测试覆盖
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
*编排工具: MCP Probe Kit - start_bugfix*
|
|
139
|
+
const PROMPT_TEMPLATE_STRICT = `# 🐛 Bug 修复编排(严格)
|
|
140
|
+
|
|
141
|
+
## 🎯 目标
|
|
142
|
+
修复 Bug:{error_message}
|
|
143
|
+
|
|
144
|
+
{stack_trace_section}
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## ✅ 执行计划(按顺序)
|
|
149
|
+
|
|
150
|
+
1) 检查 \`docs/project-context.md\`,缺失则调用 \`init_project_context\`
|
|
151
|
+
2) 调用 \`fix_bug\`
|
|
152
|
+
\`\`\`json
|
|
153
|
+
{
|
|
154
|
+
"error_message": "{error_message}",
|
|
155
|
+
"stack_trace": "{stack_trace}"
|
|
156
|
+
}
|
|
157
|
+
\`\`\`
|
|
158
|
+
3) 调用 \`gentest\`
|
|
159
|
+
\`\`\`json
|
|
160
|
+
{
|
|
161
|
+
"code": "[修复后的代码]",
|
|
162
|
+
"framework": "[根据项目上下文选择: jest/vitest/mocha]"
|
|
163
|
+
}
|
|
164
|
+
\`\`\`
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## ✅ 输出汇总
|
|
169
|
+
1. Bug 原因
|
|
170
|
+
2. 修复方案
|
|
171
|
+
3. 修改文件
|
|
172
|
+
4. 测试覆盖
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
*编排工具: MCP Probe Kit - start_bugfix*
|
|
176
177
|
`;
|
|
177
|
-
const LOOP_PROMPT_TEMPLATE_GUIDED = `# 🧭 Bug 需求澄清与补全(Requirements Loop)
|
|
178
|
-
|
|
179
|
-
本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐 Bug 修复所需关键信息。
|
|
180
|
-
|
|
181
|
-
## 🎯 目标
|
|
182
|
-
修复 Bug:{error_message}
|
|
183
|
-
|
|
184
|
-
## ✅ 规则
|
|
185
|
-
1. **不覆盖用户原始描述**
|
|
186
|
-
2. **补全内容必须标注来源**(User / Derived / Assumption)
|
|
187
|
-
3. **假设必须进入待确认列表**
|
|
188
|
-
4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
## 🔁 执行步骤(每轮)
|
|
193
|
-
|
|
194
|
-
### 1) 生成待确认问题
|
|
195
|
-
使用 \`ask_user\` 提问,问题来源于 Bug 修复补全清单(复现/环境/期望/影响/验证)。
|
|
196
|
-
|
|
197
|
-
**调用示例**:
|
|
198
|
-
\`\`\`json
|
|
199
|
-
{
|
|
200
|
-
"questions": [
|
|
201
|
-
{ "question": "复现步骤是什么?", "context": "复现步骤", "required": true },
|
|
202
|
-
{ "question": "期望行为是什么?", "context": "期望行为", "required": true }
|
|
203
|
-
]
|
|
204
|
-
}
|
|
205
|
-
\`\`\`
|
|
206
|
-
|
|
207
|
-
### 2) 更新结构化输出
|
|
208
|
-
将回答补入 \`requirements\`,并标注来源:
|
|
209
|
-
- User:用户明确回答
|
|
210
|
-
- Derived:合理推导
|
|
211
|
-
- Assumption:无法确认但补全(需确认)
|
|
212
|
-
|
|
213
|
-
### 3) 自检与结束
|
|
214
|
-
若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入修复流程。
|
|
215
|
-
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## ✅ 结束后继续
|
|
219
|
-
当满足结束条件时,执行:
|
|
220
|
-
1. 调用 \`fix_bug\` 进行定位与修复
|
|
221
|
-
2. 调用 \`gentest\` 生成回归测试
|
|
222
|
-
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
*编排工具: MCP Probe Kit - start_bugfix (requirements loop)*
|
|
178
|
+
const LOOP_PROMPT_TEMPLATE_GUIDED = `# 🧭 Bug 需求澄清与补全(Requirements Loop)
|
|
179
|
+
|
|
180
|
+
本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐 Bug 修复所需关键信息。
|
|
181
|
+
|
|
182
|
+
## 🎯 目标
|
|
183
|
+
修复 Bug:{error_message}
|
|
184
|
+
|
|
185
|
+
## ✅ 规则
|
|
186
|
+
1. **不覆盖用户原始描述**
|
|
187
|
+
2. **补全内容必须标注来源**(User / Derived / Assumption)
|
|
188
|
+
3. **假设必须进入待确认列表**
|
|
189
|
+
4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 🔁 执行步骤(每轮)
|
|
194
|
+
|
|
195
|
+
### 1) 生成待确认问题
|
|
196
|
+
使用 \`ask_user\` 提问,问题来源于 Bug 修复补全清单(复现/环境/期望/影响/验证)。
|
|
197
|
+
|
|
198
|
+
**调用示例**:
|
|
199
|
+
\`\`\`json
|
|
200
|
+
{
|
|
201
|
+
"questions": [
|
|
202
|
+
{ "question": "复现步骤是什么?", "context": "复现步骤", "required": true },
|
|
203
|
+
{ "question": "期望行为是什么?", "context": "期望行为", "required": true }
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
\`\`\`
|
|
207
|
+
|
|
208
|
+
### 2) 更新结构化输出
|
|
209
|
+
将回答补入 \`requirements\`,并标注来源:
|
|
210
|
+
- User:用户明确回答
|
|
211
|
+
- Derived:合理推导
|
|
212
|
+
- Assumption:无法确认但补全(需确认)
|
|
213
|
+
|
|
214
|
+
### 3) 自检与结束
|
|
215
|
+
若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入修复流程。
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## ✅ 结束后继续
|
|
220
|
+
当满足结束条件时,执行:
|
|
221
|
+
1. 调用 \`fix_bug\` 进行定位与修复
|
|
222
|
+
2. 调用 \`gentest\` 生成回归测试
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
*编排工具: MCP Probe Kit - start_bugfix (requirements loop)*
|
|
226
227
|
`;
|
|
227
|
-
const LOOP_PROMPT_TEMPLATE_STRICT = `# 🧭 Bug 需求澄清与补全(Requirements Loop | 严格)
|
|
228
|
-
|
|
229
|
-
本模式用于稳健补全关键信息,不改变用户意图。
|
|
230
|
-
|
|
231
|
-
## 🎯 目标
|
|
232
|
-
修复 Bug:{error_message}
|
|
233
|
-
|
|
234
|
-
## ✅ 规则
|
|
235
|
-
1. 不覆盖用户原始描述
|
|
236
|
-
2. 补全内容标注来源(User / Derived / Assumption)
|
|
237
|
-
3. 假设进入待确认列表
|
|
238
|
-
4. 每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## 🔁 执行步骤(每轮)
|
|
243
|
-
1) 使用 \`ask_user\` 提问补全关键信息
|
|
244
|
-
2) 更新结构化输出并标注来源
|
|
245
|
-
3) 若 \`openQuestions\` 为空且无高风险假设则结束
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
## ✅ 结束后继续
|
|
250
|
-
当满足结束条件时,调用 \`fix_bug\` 与 \`gentest\`
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
*编排工具: MCP Probe Kit - start_bugfix (requirements loop)*
|
|
228
|
+
const LOOP_PROMPT_TEMPLATE_STRICT = `# 🧭 Bug 需求澄清与补全(Requirements Loop | 严格)
|
|
229
|
+
|
|
230
|
+
本模式用于稳健补全关键信息,不改变用户意图。
|
|
231
|
+
|
|
232
|
+
## 🎯 目标
|
|
233
|
+
修复 Bug:{error_message}
|
|
234
|
+
|
|
235
|
+
## ✅ 规则
|
|
236
|
+
1. 不覆盖用户原始描述
|
|
237
|
+
2. 补全内容标注来源(User / Derived / Assumption)
|
|
238
|
+
3. 假设进入待确认列表
|
|
239
|
+
4. 每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 🔁 执行步骤(每轮)
|
|
244
|
+
1) 使用 \`ask_user\` 提问补全关键信息
|
|
245
|
+
2) 更新结构化输出并标注来源
|
|
246
|
+
3) 若 \`openQuestions\` 为空且无高风险假设则结束
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## ✅ 结束后继续
|
|
251
|
+
当满足结束条件时,调用 \`fix_bug\` 与 \`gentest\`
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
*编排工具: MCP Probe Kit - start_bugfix (requirements loop)*
|
|
255
256
|
`;
|
|
256
257
|
function buildBugfixQuestions(questionBudget) {
|
|
257
258
|
const base = [
|
|
@@ -264,8 +265,10 @@ function buildBugfixQuestions(questionBudget) {
|
|
|
264
265
|
];
|
|
265
266
|
return base.slice(0, Math.max(0, questionBudget));
|
|
266
267
|
}
|
|
267
|
-
export async function startBugfix(args) {
|
|
268
|
+
export async function startBugfix(args, context) {
|
|
268
269
|
try {
|
|
270
|
+
throwIfAborted(context?.signal, "start_bugfix 已取消");
|
|
271
|
+
await reportToolProgress(context, 10, "start_bugfix: 解析参数");
|
|
269
272
|
// 智能参数解析,支持自然语言输入
|
|
270
273
|
const parsedArgs = parseArgs(args, {
|
|
271
274
|
defaultValues: {
|
|
@@ -295,6 +298,8 @@ export async function startBugfix(args) {
|
|
|
295
298
|
const maxRounds = getNumber(parsedArgs.loop_max_rounds, 2);
|
|
296
299
|
const questionBudget = getNumber(parsedArgs.loop_question_budget, 5);
|
|
297
300
|
const assumptionCap = getNumber(parsedArgs.loop_assumption_cap, 3);
|
|
301
|
+
throwIfAborted(context?.signal, "start_bugfix 已取消");
|
|
302
|
+
await reportToolProgress(context, 35, "start_bugfix: 参数解析完成");
|
|
298
303
|
if (!errorMessage) {
|
|
299
304
|
throw new Error("缺少必填参数: error_message(错误信息)");
|
|
300
305
|
}
|
|
@@ -320,6 +325,8 @@ export async function startBugfix(args) {
|
|
|
320
325
|
headerNotes.push(profileDecision.warning);
|
|
321
326
|
}
|
|
322
327
|
if (requirementsMode === "loop") {
|
|
328
|
+
throwIfAborted(context?.signal, "start_bugfix(loop) 已取消");
|
|
329
|
+
await reportToolProgress(context, 70, "start_bugfix: 生成 loop 计划");
|
|
323
330
|
const openQuestions = buildBugfixQuestions(questionBudget).map((q, index) => ({
|
|
324
331
|
id: `Q-${index + 1}`,
|
|
325
332
|
...q,
|
|
@@ -432,6 +439,7 @@ export async function startBugfix(args) {
|
|
|
432
439
|
template: templateMeta,
|
|
433
440
|
},
|
|
434
441
|
};
|
|
442
|
+
await reportToolProgress(context, 95, "start_bugfix: loop 输出已生成");
|
|
435
443
|
return okStructured(guide, loopReport, {
|
|
436
444
|
schema: RequirementsLoopSchema,
|
|
437
445
|
note: 'AI 应按轮次澄清 Bug 需求并更新结构化输出,满足结束条件后再进入 fix_bug / gentest',
|
|
@@ -523,6 +531,7 @@ export async function startBugfix(args) {
|
|
|
523
531
|
template: templateMeta,
|
|
524
532
|
},
|
|
525
533
|
};
|
|
534
|
+
await reportToolProgress(context, 95, "start_bugfix: 执行计划输出已生成");
|
|
526
535
|
return okStructured(guide, bugfixReport, {
|
|
527
536
|
schema: BugFixReportSchema,
|
|
528
537
|
note: 'AI 应该按照指南执行步骤,并在每个步骤完成后更新 structuredContent 中的状态',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ToolExecutionContext } from "../lib/tool-execution-context.js";
|
|
2
|
+
export declare function startFeature(args: any, context?: ToolExecutionContext): Promise<import("../lib/response.js").ToolResponse | {
|
|
2
3
|
content: {
|
|
3
4
|
type: string;
|
|
4
5
|
text: string;
|