Skip to content

Commit e8b0aa3

Browse files
committed
feat: 端到端验收通过 + MCP闭环 + VSCode插件v1.0打磨 + Rust迁移D盘
- 端到端验收: 引擎+前端11页+蓝本测试(83%/11Bug)+用户系统API全通+MCP闭环 - API增强: TestReportResponse新增StepDetail+BugDetail(含日志切片) - VSCode插件v1.0: Bug列表(严重度标签)+步骤详情折叠+重测按钮+发送给AI修复 - 插件修复: pass_rate百分比显示、engineClient添加StepDetail/BugDetail接口 - 前端修复: AppLayout端口8000改为8900 - 插件图标: 生成icon.png(128x128) - 文档更新: 项目规划+开发备忘录记录今日进展和下次待办
1 parent b4f3852 commit e8b0aa3

13 files changed

Lines changed: 646 additions & 62 deletions

File tree

desktop/src/components/AppLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default function AppLayout() {
6868

6969
{/* 底部引擎状态 */}
7070
<div className="px-4 py-3 border-t border-gray-800 text-xs text-gray-500">
71-
引擎: 127.0.0.1:8000
71+
引擎: 127.0.0.1:8900
7272
</div>
7373
</aside>
7474

extension/resources/icon.png

4.67 KB
Loading

extension/src/engineClient.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,28 @@ export interface HealthResponse {
1717
browser_ready: boolean;
1818
}
1919

20+
/** 单步执行详情 */
21+
export interface StepDetail {
22+
step: number;
23+
action: string;
24+
description: string;
25+
status: string;
26+
duration_seconds: number;
27+
error_message: string;
28+
screenshot_path: string | null;
29+
}
30+
31+
/** Bug 详情(含日志切片) */
32+
export interface BugDetail {
33+
severity: string;
34+
title: string;
35+
description: string;
36+
category: string;
37+
location: string;
38+
step_number: number | null;
39+
screenshot_path: string | null;
40+
}
41+
2042
/** 测试报告响应 */
2143
export interface TestReportResponse {
2244
test_name: string;
@@ -28,6 +50,8 @@ export interface TestReportResponse {
2850
pass_rate: number;
2951
duration_seconds: number;
3052
report_markdown: string;
53+
steps: StepDetail[];
54+
bugs: BugDetail[];
3155
repair_summary: string | null;
3256
fixed_bug_count: number | null;
3357
}

extension/src/extension.ts

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,22 @@ export function activate(context: vscode.ExtensionContext): void {
9797
project_path: projectPath,
9898
});
9999

100-
const passRate = (report.pass_rate * 100).toFixed(0);
100+
const passRate = report.pass_rate.toFixed(0);
101101
const msg = `测试完成 | 通过率 ${passRate}% | Bug ${report.bug_count} 个`;
102102

103103
if (report.bug_count === 0) {
104104
vscode.window.showInformationMessage(`✅ ${msg}`);
105105
} else {
106106
const action = await vscode.window.showWarningMessage(
107107
`⚠️ ${msg}`,
108+
"复制Bug给AI",
108109
"查看报告",
109110
);
110-
if (action === "查看报告") {
111+
if (action === "复制Bug给AI") {
112+
const bugSummary = formatBugSummaryForAI(report);
113+
await vscode.env.clipboard.writeText(bugSummary);
114+
vscode.window.showInformationMessage("Bug摘要已复制到剪贴板,粘贴到聊天窗口让AI修复");
115+
} else if (action === "查看报告") {
111116
showReport(report.report_markdown);
112117
}
113118
}
@@ -157,14 +162,24 @@ export function activate(context: vscode.ExtensionContext): void {
157162
base_url: baseUrl || undefined,
158163
});
159164

160-
const passRate = (report.pass_rate * 100).toFixed(0);
165+
const passRate = report.pass_rate.toFixed(0);
161166
const msg = `蓝本测试完成 | 通过率 ${passRate}% | Bug ${report.bug_count} 个`;
162167

163168
if (report.bug_count === 0) {
164169
vscode.window.showInformationMessage(`✅ ${msg}`);
165170
} else {
166-
const action = await vscode.window.showWarningMessage(`⚠️ ${msg}`, "查看报告");
167-
if (action === "查看报告") { showReport(report.report_markdown); }
171+
const action = await vscode.window.showWarningMessage(
172+
`⚠️ ${msg}`,
173+
"复制Bug给AI",
174+
"查看报告",
175+
);
176+
if (action === "复制Bug给AI") {
177+
const bugSummary = formatBugSummaryForAI(report);
178+
await vscode.env.clipboard.writeText(bugSummary);
179+
vscode.window.showInformationMessage("Bug摘要已复制到剪贴板,粘贴到聊天窗口让AI修复");
180+
} else if (action === "查看报告") {
181+
showReport(report.report_markdown);
182+
}
168183
}
169184
outputChannel.appendLine("─".repeat(40));
170185
outputChannel.appendLine(report.report_markdown);
@@ -273,7 +288,7 @@ export function activate(context: vscode.ExtensionContext): void {
273288
auto_repair: config.get<boolean>("autoRepair", false),
274289
project_path: folderPath,
275290
});
276-
const passRate = (report.pass_rate * 100).toFixed(0);
291+
const passRate = report.pass_rate.toFixed(0);
277292
vscode.window.showInformationMessage(
278293
`TestPilot AI 完成 | 通过率 ${passRate}% | Bug ${report.bug_count} 个`,
279294
);
@@ -312,6 +327,32 @@ export function deactivate(): void {
312327
outputChannel?.appendLine("[TestPilot AI] 插件已停用");
313328
}
314329

330+
/** 格式化Bug摘要,方便粘贴给编程AI修复 */
331+
function formatBugSummaryForAI(report: { test_name: string; url: string; pass_rate: number; bug_count: number; bugs?: Array<{ severity: string; title: string; description: string; step_number?: number | null }>; report_markdown: string }): string {
332+
const lines: string[] = [
333+
`TestPilot AI 发现 ${report.bug_count} 个Bug,请修复:`,
334+
`测试: ${report.test_name} | URL: ${report.url} | 通过率: ${report.pass_rate.toFixed(0)}%`,
335+
"",
336+
];
337+
338+
const bugs = report.bugs || [];
339+
if (bugs.length > 0) {
340+
bugs.forEach((bug, i) => {
341+
const step = bug.step_number ? ` (步骤#${bug.step_number})` : "";
342+
lines.push(`${i + 1}. [${bug.severity.toUpperCase()}] ${bug.title}${step}`);
343+
if (bug.description) {
344+
const desc = bug.description.split("\n")[0].substring(0, 150);
345+
lines.push(` ${desc}`);
346+
}
347+
});
348+
} else {
349+
lines.push(report.report_markdown.substring(0, 1000));
350+
}
351+
352+
lines.push("", "修复后请调用 run_blueprint_test 重新测试。");
353+
return lines.join("\n");
354+
}
355+
315356
/** 在新的编辑器标签页中显示 Markdown 报告 */
316357
function showReport(markdown: string): void {
317358
const doc = vscode.workspace.openTextDocument({

0 commit comments

Comments
 (0)