mcp-probe-kit 3.0.5 → 3.0.7
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 +458 -431
- package/build/index.js +875 -141
- package/build/lib/gitnexus-bridge.d.ts +58 -0
- package/build/lib/gitnexus-bridge.js +379 -0
- 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/lib/toolset-manager.d.ts +1 -1
- package/build/lib/toolset-manager.js +7 -5
- package/build/schemas/code-analysis-tools.d.ts +46 -0
- package/build/schemas/code-analysis-tools.js +47 -0
- package/build/schemas/git-tools.js +16 -16
- package/build/schemas/index.d.ts +46 -0
- package/build/tools/__tests__/code_insight.unit.test.d.ts +1 -0
- package/build/tools/__tests__/code_insight.unit.test.js +35 -0
- 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/code_insight.d.ts +8 -0
- package/build/tools/code_insight.js +129 -0
- package/build/tools/index.d.ts +1 -0
- package/build/tools/index.js +1 -0
- package/build/tools/interview.js +9 -9
- package/build/tools/start_bugfix.d.ts +2 -1
- package/build/tools/start_bugfix.js +170 -126
- package/build/tools/start_feature.d.ts +2 -1
- package/build/tools/start_feature.js +156 -112
- 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 +122 -21
- package/docs/assets/js/tailwind.js +83 -83
- package/docs/data/tools.js +419 -399
- 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/pages/all-tools.html +514 -352
- package/docs/pages/examples.html +689 -689
- package/docs/pages/getting-started.html +589 -589
- package/docs/pages/migration.html +298 -298
- package/docs/specs/user-auth/design.md +82 -0
- package/docs/specs/user-auth/requirements.md +52 -0
- package/docs/specs/user-auth/tasks.md +55 -0
- package/package.json +5 -5
- 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
package/build/tools/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { initProject } from "./init_project.js";
|
|
2
2
|
export { gencommit } from "./gencommit.js";
|
|
3
3
|
export { codeReview } from "./code_review.js";
|
|
4
|
+
export { codeInsight } from "./code_insight.js";
|
|
4
5
|
export { gentest } from "./gentest.js";
|
|
5
6
|
export { refactor } from "./refactor.js";
|
|
6
7
|
export { initProjectContext } from "./init_project_context.js";
|
package/build/tools/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { initProject } from "./init_project.js";
|
|
2
2
|
export { gencommit } from "./gencommit.js";
|
|
3
3
|
export { codeReview } from "./code_review.js";
|
|
4
|
+
export { codeInsight } from "./code_insight.js";
|
|
4
5
|
export { gentest } from "./gentest.js";
|
|
5
6
|
export { refactor } from "./refactor.js";
|
|
6
7
|
export { initProjectContext } from "./init_project_context.js";
|
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,8 @@ 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";
|
|
6
|
+
import { buildBugfixGraphContext } from "../lib/gitnexus-bridge.js";
|
|
5
7
|
function decideTemplateProfile(description) {
|
|
6
8
|
const text = description || '';
|
|
7
9
|
const lengthScore = text.length >= 200 ? 2 : text.length >= 120 ? 1 : 0;
|
|
@@ -40,11 +42,11 @@ function resolveTemplateProfile(rawProfile, description) {
|
|
|
40
42
|
warning: `模板档位 "${rawProfile}" 不支持,已回退为 ${fallback}`,
|
|
41
43
|
};
|
|
42
44
|
}
|
|
43
|
-
const PROMPT_TEMPLATE_GUIDED = `# 🐛 Bug 修复编排指南
|
|
44
|
-
|
|
45
|
-
## 🎯 目标
|
|
46
|
-
|
|
47
|
-
修复以下 Bug:
|
|
45
|
+
const PROMPT_TEMPLATE_GUIDED = `# 🐛 Bug 修复编排指南
|
|
46
|
+
|
|
47
|
+
## 🎯 目标
|
|
48
|
+
|
|
49
|
+
修复以下 Bug:
|
|
48
50
|
|
|
49
51
|
**错误信息**:
|
|
50
52
|
\`\`\`
|
|
@@ -133,125 +135,125 @@ const PROMPT_TEMPLATE_GUIDED = `# 🐛 Bug 修复编排指南
|
|
|
133
135
|
|
|
134
136
|
---
|
|
135
137
|
|
|
136
|
-
*编排工具: MCP Probe Kit - start_bugfix*
|
|
138
|
+
*编排工具: MCP Probe Kit - start_bugfix*
|
|
137
139
|
`;
|
|
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*
|
|
140
|
+
const PROMPT_TEMPLATE_STRICT = `# 🐛 Bug 修复编排(严格)
|
|
141
|
+
|
|
142
|
+
## 🎯 目标
|
|
143
|
+
修复 Bug:{error_message}
|
|
144
|
+
|
|
145
|
+
{stack_trace_section}
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## ✅ 执行计划(按顺序)
|
|
150
|
+
|
|
151
|
+
1) 检查 \`docs/project-context.md\`,缺失则调用 \`init_project_context\`
|
|
152
|
+
2) 调用 \`fix_bug\`
|
|
153
|
+
\`\`\`json
|
|
154
|
+
{
|
|
155
|
+
"error_message": "{error_message}",
|
|
156
|
+
"stack_trace": "{stack_trace}"
|
|
157
|
+
}
|
|
158
|
+
\`\`\`
|
|
159
|
+
3) 调用 \`gentest\`
|
|
160
|
+
\`\`\`json
|
|
161
|
+
{
|
|
162
|
+
"code": "[修复后的代码]",
|
|
163
|
+
"framework": "[根据项目上下文选择: jest/vitest/mocha]"
|
|
164
|
+
}
|
|
165
|
+
\`\`\`
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## ✅ 输出汇总
|
|
170
|
+
1. Bug 原因
|
|
171
|
+
2. 修复方案
|
|
172
|
+
3. 修改文件
|
|
173
|
+
4. 测试覆盖
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
*编排工具: MCP Probe Kit - start_bugfix*
|
|
176
178
|
`;
|
|
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)*
|
|
179
|
+
const LOOP_PROMPT_TEMPLATE_GUIDED = `# 🧭 Bug 需求澄清与补全(Requirements Loop)
|
|
180
|
+
|
|
181
|
+
本模式用于**生产级稳健补全**:在不改变用户意图的前提下补齐 Bug 修复所需关键信息。
|
|
182
|
+
|
|
183
|
+
## 🎯 目标
|
|
184
|
+
修复 Bug:{error_message}
|
|
185
|
+
|
|
186
|
+
## ✅ 规则
|
|
187
|
+
1. **不覆盖用户原始描述**
|
|
188
|
+
2. **补全内容必须标注来源**(User / Derived / Assumption)
|
|
189
|
+
3. **假设必须进入待确认列表**
|
|
190
|
+
4. **每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}**
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 🔁 执行步骤(每轮)
|
|
195
|
+
|
|
196
|
+
### 1) 生成待确认问题
|
|
197
|
+
使用 \`ask_user\` 提问,问题来源于 Bug 修复补全清单(复现/环境/期望/影响/验证)。
|
|
198
|
+
|
|
199
|
+
**调用示例**:
|
|
200
|
+
\`\`\`json
|
|
201
|
+
{
|
|
202
|
+
"questions": [
|
|
203
|
+
{ "question": "复现步骤是什么?", "context": "复现步骤", "required": true },
|
|
204
|
+
{ "question": "期望行为是什么?", "context": "期望行为", "required": true }
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
\`\`\`
|
|
208
|
+
|
|
209
|
+
### 2) 更新结构化输出
|
|
210
|
+
将回答补入 \`requirements\`,并标注来源:
|
|
211
|
+
- User:用户明确回答
|
|
212
|
+
- Derived:合理推导
|
|
213
|
+
- Assumption:无法确认但补全(需确认)
|
|
214
|
+
|
|
215
|
+
### 3) 自检与结束
|
|
216
|
+
若 \`openQuestions\` 为空且无高风险假设,则结束 loop,进入修复流程。
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## ✅ 结束后继续
|
|
221
|
+
当满足结束条件时,执行:
|
|
222
|
+
1. 调用 \`fix_bug\` 进行定位与修复
|
|
223
|
+
2. 调用 \`gentest\` 生成回归测试
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
*编排工具: MCP Probe Kit - start_bugfix (requirements loop)*
|
|
226
228
|
`;
|
|
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)*
|
|
229
|
+
const LOOP_PROMPT_TEMPLATE_STRICT = `# 🧭 Bug 需求澄清与补全(Requirements Loop | 严格)
|
|
230
|
+
|
|
231
|
+
本模式用于稳健补全关键信息,不改变用户意图。
|
|
232
|
+
|
|
233
|
+
## 🎯 目标
|
|
234
|
+
修复 Bug:{error_message}
|
|
235
|
+
|
|
236
|
+
## ✅ 规则
|
|
237
|
+
1. 不覆盖用户原始描述
|
|
238
|
+
2. 补全内容标注来源(User / Derived / Assumption)
|
|
239
|
+
3. 假设进入待确认列表
|
|
240
|
+
4. 每轮问题 ≤ {question_budget},假设 ≤ {assumption_cap}
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## 🔁 执行步骤(每轮)
|
|
245
|
+
1) 使用 \`ask_user\` 提问补全关键信息
|
|
246
|
+
2) 更新结构化输出并标注来源
|
|
247
|
+
3) 若 \`openQuestions\` 为空且无高风险假设则结束
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## ✅ 结束后继续
|
|
252
|
+
当满足结束条件时,调用 \`fix_bug\` 与 \`gentest\`
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
*编排工具: MCP Probe Kit - start_bugfix (requirements loop)*
|
|
255
257
|
`;
|
|
256
258
|
function buildBugfixQuestions(questionBudget) {
|
|
257
259
|
const base = [
|
|
@@ -264,8 +266,10 @@ function buildBugfixQuestions(questionBudget) {
|
|
|
264
266
|
];
|
|
265
267
|
return base.slice(0, Math.max(0, questionBudget));
|
|
266
268
|
}
|
|
267
|
-
export async function startBugfix(args) {
|
|
269
|
+
export async function startBugfix(args, context) {
|
|
268
270
|
try {
|
|
271
|
+
throwIfAborted(context?.signal, "start_bugfix 已取消");
|
|
272
|
+
await reportToolProgress(context, 10, "start_bugfix: 解析参数");
|
|
269
273
|
// 智能参数解析,支持自然语言输入
|
|
270
274
|
const parsedArgs = parseArgs(args, {
|
|
271
275
|
defaultValues: {
|
|
@@ -295,6 +299,8 @@ export async function startBugfix(args) {
|
|
|
295
299
|
const maxRounds = getNumber(parsedArgs.loop_max_rounds, 2);
|
|
296
300
|
const questionBudget = getNumber(parsedArgs.loop_question_budget, 5);
|
|
297
301
|
const assumptionCap = getNumber(parsedArgs.loop_assumption_cap, 3);
|
|
302
|
+
throwIfAborted(context?.signal, "start_bugfix 已取消");
|
|
303
|
+
await reportToolProgress(context, 35, "start_bugfix: 参数解析完成");
|
|
298
304
|
if (!errorMessage) {
|
|
299
305
|
throw new Error("缺少必填参数: error_message(错误信息)");
|
|
300
306
|
}
|
|
@@ -319,7 +325,37 @@ export async function startBugfix(args) {
|
|
|
319
325
|
if (profileDecision.warning) {
|
|
320
326
|
headerNotes.push(profileDecision.warning);
|
|
321
327
|
}
|
|
328
|
+
throwIfAborted(context?.signal, "start_bugfix 已取消");
|
|
329
|
+
await reportToolProgress(context, 55, "start_bugfix: 获取代码图谱上下文");
|
|
330
|
+
const graphContext = await buildBugfixGraphContext({
|
|
331
|
+
errorMessage,
|
|
332
|
+
stackTrace,
|
|
333
|
+
signal: context?.signal,
|
|
334
|
+
});
|
|
335
|
+
const graphStatusNote = graphContext.available
|
|
336
|
+
? `图谱增强: 可用(${graphContext.mode})`
|
|
337
|
+
: "图谱增强: 已降级(自动回退)";
|
|
338
|
+
headerNotes.push(graphStatusNote);
|
|
339
|
+
const graphCodeContext = graphContext.available
|
|
340
|
+
? [
|
|
341
|
+
`图谱摘要: ${graphContext.summary}`,
|
|
342
|
+
...graphContext.highlights.slice(0, 3).map((item) => `图谱线索: ${item}`),
|
|
343
|
+
]
|
|
344
|
+
.filter(Boolean)
|
|
345
|
+
.join("\n")
|
|
346
|
+
: "";
|
|
347
|
+
const graphGuideSection = `
|
|
348
|
+
|
|
349
|
+
## 🧠 代码图谱上下文(可选增强)
|
|
350
|
+
- 状态: ${graphContext.available ? "可用" : "降级"}
|
|
351
|
+
- 摘要: ${graphContext.summary}
|
|
352
|
+
${graphContext.highlights.length > 0
|
|
353
|
+
? `- 线索:\n${graphContext.highlights.slice(0, 3).map((item) => ` - ${item}`).join("\n")}`
|
|
354
|
+
: "- 线索: 无"}
|
|
355
|
+
`;
|
|
322
356
|
if (requirementsMode === "loop") {
|
|
357
|
+
throwIfAborted(context?.signal, "start_bugfix(loop) 已取消");
|
|
358
|
+
await reportToolProgress(context, 70, "start_bugfix: 生成 loop 计划");
|
|
323
359
|
const openQuestions = buildBugfixQuestions(questionBudget).map((q, index) => ({
|
|
324
360
|
id: `Q-${index + 1}`,
|
|
325
361
|
...q,
|
|
@@ -373,6 +409,7 @@ export async function startBugfix(args) {
|
|
|
373
409
|
args: {
|
|
374
410
|
error_message: errorMessage,
|
|
375
411
|
...(stackTrace ? { stack_trace: stackTrace } : {}),
|
|
412
|
+
...(graphCodeContext ? { code_context: graphCodeContext } : {}),
|
|
376
413
|
},
|
|
377
414
|
outputs: [],
|
|
378
415
|
},
|
|
@@ -400,10 +437,11 @@ export async function startBugfix(args) {
|
|
|
400
437
|
const loopTemplate = profileDecision.resolved === 'strict'
|
|
401
438
|
? LOOP_PROMPT_TEMPLATE_STRICT
|
|
402
439
|
: LOOP_PROMPT_TEMPLATE_GUIDED;
|
|
403
|
-
const guide = header + loopTemplate
|
|
440
|
+
const guide = (header + loopTemplate
|
|
404
441
|
.replace(/{error_message}/g, errorMessage)
|
|
405
442
|
.replace(/{question_budget}/g, String(questionBudget))
|
|
406
|
-
.replace(/{assumption_cap}/g, String(assumptionCap))
|
|
443
|
+
.replace(/{assumption_cap}/g, String(assumptionCap)))
|
|
444
|
+
+ graphGuideSection;
|
|
407
445
|
const loopReport = {
|
|
408
446
|
mode: 'loop',
|
|
409
447
|
round: 1,
|
|
@@ -430,8 +468,10 @@ export async function startBugfix(args) {
|
|
|
430
468
|
metadata: {
|
|
431
469
|
plan,
|
|
432
470
|
template: templateMeta,
|
|
471
|
+
graphContext,
|
|
433
472
|
},
|
|
434
473
|
};
|
|
474
|
+
await reportToolProgress(context, 95, "start_bugfix: loop 输出已生成");
|
|
435
475
|
return okStructured(guide, loopReport, {
|
|
436
476
|
schema: RequirementsLoopSchema,
|
|
437
477
|
note: 'AI 应按轮次澄清 Bug 需求并更新结构化输出,满足结束条件后再进入 fix_bug / gentest',
|
|
@@ -452,10 +492,11 @@ export async function startBugfix(args) {
|
|
|
452
492
|
const promptTemplate = profileDecision.resolved === 'strict'
|
|
453
493
|
? PROMPT_TEMPLATE_STRICT
|
|
454
494
|
: PROMPT_TEMPLATE_GUIDED;
|
|
455
|
-
const guide = header + promptTemplate
|
|
495
|
+
const guide = (header + promptTemplate
|
|
456
496
|
.replace(/{error_message}/g, errorMessage)
|
|
457
497
|
.replace(/{stack_trace}/g, stackTrace)
|
|
458
|
-
.replace(/{stack_trace_section}/g, stackTraceSection)
|
|
498
|
+
.replace(/{stack_trace_section}/g, stackTraceSection))
|
|
499
|
+
+ graphGuideSection;
|
|
459
500
|
const plan = {
|
|
460
501
|
mode: 'delegated',
|
|
461
502
|
steps: [
|
|
@@ -472,6 +513,7 @@ export async function startBugfix(args) {
|
|
|
472
513
|
args: {
|
|
473
514
|
error_message: errorMessage,
|
|
474
515
|
...(stackTrace ? { stack_trace: stackTrace } : {}),
|
|
516
|
+
...(graphCodeContext ? { code_context: graphCodeContext } : {}),
|
|
475
517
|
},
|
|
476
518
|
outputs: [],
|
|
477
519
|
},
|
|
@@ -521,8 +563,10 @@ export async function startBugfix(args) {
|
|
|
521
563
|
metadata: {
|
|
522
564
|
plan,
|
|
523
565
|
template: templateMeta,
|
|
566
|
+
graphContext,
|
|
524
567
|
},
|
|
525
568
|
};
|
|
569
|
+
await reportToolProgress(context, 95, "start_bugfix: 执行计划输出已生成");
|
|
526
570
|
return okStructured(guide, bugfixReport, {
|
|
527
571
|
schema: BugFixReportSchema,
|
|
528
572
|
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;
|