bugzero 0.0.16 → 0.0.17
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/.turbo/turbo-build.log +4 -4
- package/README.md +2 -2
- package/dist/index.js +160 -47
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> bugzero@0.0.
|
|
2
|
+
> bugzero@0.0.17 build D:\WD projects\OpsPilot\packages\cli
|
|
3
3
|
> tsup src/index.ts --format cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
|
-
[32mCJS[39m [1mdist\index.js [22m[
|
|
11
|
-
[32mCJS[39m ⚡️ Build success in
|
|
10
|
+
[32mCJS[39m [1mdist\index.js [22m[32m63.10 KB[39m
|
|
11
|
+
[32mCJS[39m ⚡️ Build success in 102ms
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mDTS[39m ⚡️ Build success in
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 1876ms
|
|
14
14
|
[32mDTS[39m [1mdist\index.d.ts [22m[32m20.00 B[39m
|
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ bugzero rescue
|
|
|
77
77
|
| Error type parsing | Parses TypeScript, ESLint, and Jest error formats |
|
|
78
78
|
| Dry-run mode | Analyze and report without writing any files |
|
|
79
79
|
| Local model config | Save preferred model to `.bugzerorc` per project |
|
|
80
|
-
| Markdown Reports | Automatically generates a detailed
|
|
80
|
+
| Markdown Reports | Automatically generates a detailed Markdown report and opens it in your IDE (VS Code, Cursor, Windsurf, Sublime) as an unsaved editor tab, giving you the choice to save or discard it. |
|
|
81
81
|
|
|
82
82
|
---
|
|
83
83
|
|
|
@@ -168,7 +168,7 @@ This file is created automatically when you run `bugzero vibe`.
|
|
|
168
168
|
|
|
169
169
|
## Reports
|
|
170
170
|
|
|
171
|
-
Every time you run `bugzero hunt` or `bugzero rescue`, a detailed Markdown report is automatically
|
|
171
|
+
Every time you run `bugzero hunt` or `bugzero rescue`, a detailed Markdown report is generated and automatically opened in your IDE (VS Code, Cursor, Windsurf, or Sublime Text) as an unsaved editor tab. This avoids polluting your project workspace and gives you the choice to save it or discard it. The report includes:
|
|
172
172
|
- **Pipeline Summary:** Clear status checklist of your project's Build, Lint, and Test suites.
|
|
173
173
|
- **Detailed Error Outputs:** Full error logs from any failing checks.
|
|
174
174
|
- **AI Brain Details:** The exact OpenRouter model used.
|
package/dist/index.js
CHANGED
|
@@ -1059,8 +1059,7 @@ var require_dist7 = __commonJS({
|
|
|
1059
1059
|
}
|
|
1060
1060
|
var import_analyzers = require_dist2();
|
|
1061
1061
|
var import_agents = require_dist6();
|
|
1062
|
-
var
|
|
1063
|
-
var import_path22 = __toESM2(require("path"));
|
|
1062
|
+
var import_ai_provider = require_dist3();
|
|
1064
1063
|
async function orchestrate2(options = {}) {
|
|
1065
1064
|
const cwd = options.cwd ?? process.cwd();
|
|
1066
1065
|
const [build, lint, test] = await Promise.all([
|
|
@@ -1068,7 +1067,7 @@ var require_dist7 = __commonJS({
|
|
|
1068
1067
|
(0, import_analyzers.runLint)(cwd),
|
|
1069
1068
|
(0, import_analyzers.runTests)(cwd)
|
|
1070
1069
|
]);
|
|
1071
|
-
writeReport(cwd, "hunt", {
|
|
1070
|
+
await writeReport(cwd, "hunt", {
|
|
1072
1071
|
success: build.success && lint.success && test.success,
|
|
1073
1072
|
build,
|
|
1074
1073
|
lint,
|
|
@@ -1083,7 +1082,7 @@ var require_dist7 = __commonJS({
|
|
|
1083
1082
|
const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd);
|
|
1084
1083
|
if (pipelineResult.success) {
|
|
1085
1084
|
console.log("[BugZero] Validation already passing \u2014 nothing to fix.");
|
|
1086
|
-
writeReport(cwd, "rescue", {
|
|
1085
|
+
await writeReport(cwd, "rescue", {
|
|
1087
1086
|
success: true,
|
|
1088
1087
|
attempts: 0,
|
|
1089
1088
|
maxAttempts,
|
|
@@ -1095,7 +1094,7 @@ var require_dist7 = __commonJS({
|
|
|
1095
1094
|
console.log(`[BugZero] Detected ${errors.length} error(s) (type: ${errors[0]?.type ?? "unknown"})`);
|
|
1096
1095
|
if (options.dryRun) {
|
|
1097
1096
|
console.log("[BugZero] Dry-run mode \u2014 skipping AI fix.");
|
|
1098
|
-
writeReport(cwd, "rescue", {
|
|
1097
|
+
await writeReport(cwd, "rescue", {
|
|
1099
1098
|
success: false,
|
|
1100
1099
|
attempts: 0,
|
|
1101
1100
|
maxAttempts,
|
|
@@ -1126,7 +1125,7 @@ var require_dist7 = __commonJS({
|
|
|
1126
1125
|
promptTokens: finalState.promptTokens,
|
|
1127
1126
|
completionTokens: finalState.completionTokens
|
|
1128
1127
|
};
|
|
1129
|
-
writeReport(cwd, "rescue", {
|
|
1128
|
+
await writeReport(cwd, "rescue", {
|
|
1130
1129
|
success: result.success,
|
|
1131
1130
|
attempts: result.attempts,
|
|
1132
1131
|
maxAttempts,
|
|
@@ -1139,12 +1138,47 @@ var require_dist7 = __commonJS({
|
|
|
1139
1138
|
});
|
|
1140
1139
|
return result;
|
|
1141
1140
|
}
|
|
1142
|
-
function writeReport(cwd, type, data) {
|
|
1143
|
-
const reportPath = import_path22.default.join(cwd, "bugzero-report.md");
|
|
1141
|
+
async function writeReport(cwd, type, data) {
|
|
1144
1142
|
let content = "";
|
|
1143
|
+
const provider = new import_ai_provider.OpenRouterProvider();
|
|
1145
1144
|
if (type === "hunt") {
|
|
1146
1145
|
const { build, lint, test } = data;
|
|
1147
|
-
|
|
1146
|
+
if (!build.success || !lint.success || !test.success) {
|
|
1147
|
+
let logs = "";
|
|
1148
|
+
if (!build.success) logs += `[BUILD FAILURE]
|
|
1149
|
+
${build.output}
|
|
1150
|
+
|
|
1151
|
+
`;
|
|
1152
|
+
if (!lint.success) logs += `[LINT FAILURE]
|
|
1153
|
+
${lint.output}
|
|
1154
|
+
|
|
1155
|
+
`;
|
|
1156
|
+
if (!test.success) logs += `[TEST FAILURE]
|
|
1157
|
+
${test.output}
|
|
1158
|
+
|
|
1159
|
+
`;
|
|
1160
|
+
console.log("[BugZero] Calling AI to diagnose errors and write report...");
|
|
1161
|
+
const prompt = `You are an expert software engineer assistant. Below is the error output from a project's build, lint, and test checks.
|
|
1162
|
+
Please analyze the errors and generate a professional, beautifully formatted Markdown report summarizing:
|
|
1163
|
+
1. **Diagnosis:** Clear explanation of what failed and why.
|
|
1164
|
+
2. **Root Cause:** The underlying issue in the code/config.
|
|
1165
|
+
3. **Action Plan:** Step-by-step instructions on what files need to be modified and what exact changes to make.
|
|
1166
|
+
|
|
1167
|
+
Failed Checks Logs:
|
|
1168
|
+
${logs}
|
|
1169
|
+
|
|
1170
|
+
Generate the Markdown report directly. Do not wrap it in markdown block fences (\`\`\`markdown ... \`\`\`). Just write the markdown text directly.`;
|
|
1171
|
+
try {
|
|
1172
|
+
const result = await provider.invoke(prompt, { cwd });
|
|
1173
|
+
content = result.content;
|
|
1174
|
+
content += `
|
|
1175
|
+
|
|
1176
|
+
---
|
|
1177
|
+
### \u{1F50D} BugZero Hunt Metadata
|
|
1178
|
+
- **AI Brain (Model) used for Diagnosis:** \`${result.model || "unknown"}\`
|
|
1179
|
+
- **Token Usage for Diagnosis:** ${result.usage ? `Prompt: **${result.usage.prompt_tokens}** | Completion: **${result.usage.completion_tokens}** | Total: **${result.usage.total_tokens}**` : "*N/A*"}`;
|
|
1180
|
+
} catch (e) {
|
|
1181
|
+
content = `# \u{1F50D} BugZero Hunt Report
|
|
1148
1182
|
|
|
1149
1183
|
**Date:** ${(/* @__PURE__ */ new Date()).toLocaleString()}
|
|
1150
1184
|
**Project Path:** \`${cwd}\`
|
|
@@ -1155,56 +1189,68 @@ var require_dist7 = __commonJS({
|
|
|
1155
1189
|
- **Lint:** ${lint.success ? "\u2705 Passed" : "\u274C Failed"}
|
|
1156
1190
|
- **Test:** ${test.success ? "\u2705 Passed" : "\u274C Failed"}
|
|
1157
1191
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
content += `## \u274C Failed Checks & Error Output
|
|
1161
|
-
|
|
1162
|
-
`;
|
|
1163
|
-
if (!build.success) {
|
|
1164
|
-
content += `### \u{1F7E5} Build Failure
|
|
1165
|
-
\`\`\`text
|
|
1166
|
-
${build.output}
|
|
1167
|
-
\`\`\`
|
|
1168
|
-
|
|
1192
|
+
## \u274C Failed Checks & Error Output
|
|
1193
|
+
${logs}
|
|
1169
1194
|
`;
|
|
1170
1195
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
\`\`\`text
|
|
1174
|
-
${lint.output}
|
|
1175
|
-
\`\`\`
|
|
1196
|
+
} else {
|
|
1197
|
+
content = `# \u{1F50D} BugZero Hunt Report
|
|
1176
1198
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
content += `### \u{1F7E6} Test Failure
|
|
1181
|
-
\`\`\`text
|
|
1182
|
-
${test.output}
|
|
1183
|
-
\`\`\`
|
|
1199
|
+
**Date:** ${(/* @__PURE__ */ new Date()).toLocaleString()}
|
|
1200
|
+
**Project Path:** \`${cwd}\`
|
|
1201
|
+
**Framework:** \`${detectFramework2(cwd)}\`
|
|
1184
1202
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1203
|
+
## \u{1F4CA} Status Summary
|
|
1204
|
+
- **Build:** \u2705 Passed
|
|
1205
|
+
- **Lint:** \u2705 Passed
|
|
1206
|
+
- **Test:** \u2705 Passed
|
|
1207
|
+
|
|
1208
|
+
\u{1F389} **All checks passed! Your project is in perfect shape.**`;
|
|
1190
1209
|
}
|
|
1191
1210
|
} else {
|
|
1192
1211
|
const { success, attempts, maxAttempts, appliedFix, error, rawOutput, modelUsed, promptTokens, completionTokens } = data;
|
|
1193
|
-
|
|
1212
|
+
if (success && appliedFix) {
|
|
1213
|
+
console.log("[BugZero] Calling AI to write solution summary report...");
|
|
1214
|
+
const prompt = `You are an expert software engineer assistant. An automated AI agent successfully resolved a build/lint/test failure in a project located at "${cwd}" after ${attempts} attempts by applying a patch to "${appliedFix.filePath}".
|
|
1215
|
+
Here is the patch details:
|
|
1216
|
+
- Root Cause: ${appliedFix.rootCause}
|
|
1217
|
+
- Explanation: ${appliedFix.explanation}
|
|
1218
|
+
- Search code:
|
|
1219
|
+
${appliedFix.search}
|
|
1220
|
+
- Replace code:
|
|
1221
|
+
${appliedFix.replace}
|
|
1222
|
+
|
|
1223
|
+
Please generate a professional, beautifully formatted Markdown report summarizing:
|
|
1224
|
+
1. **Repair Summary:** Celebrate the success and explain the fix.
|
|
1225
|
+
2. **Details of the Solution:** Walk the developer through what was changed and why.
|
|
1226
|
+
3. **Verification:** Explain how it was verified (build, lint, tests passed).
|
|
1227
|
+
|
|
1228
|
+
Generate the Markdown report directly. Do not wrap it in markdown block fences (\`\`\`markdown ... \`\`\`). Just write the markdown text directly.`;
|
|
1229
|
+
try {
|
|
1230
|
+
const result = await provider.invoke(prompt, { cwd });
|
|
1231
|
+
content = result.content;
|
|
1232
|
+
content += `
|
|
1233
|
+
|
|
1234
|
+
---
|
|
1235
|
+
### \u{1F916} BugZero Rescue Metadata
|
|
1236
|
+
- **AI Brain (Model) used for Fix:** \`${modelUsed || "unknown"}\`
|
|
1237
|
+
- **Token Usage for Fix:** ${promptTokens !== void 0 && completionTokens !== void 0 ? `Prompt: **${promptTokens}** | Completion: **${completionTokens}** | Total: **${promptTokens + completionTokens}**` : "*N/A*"}
|
|
1238
|
+
- **AI Brain (Model) used for Report:** \`${result.model || "unknown"}\`
|
|
1239
|
+
- **Token Usage for Report:** ${result.usage ? `Prompt: **${result.usage.prompt_tokens}** | Completion: **${result.usage.completion_tokens}** | Total: **${result.usage.total_tokens}**` : "*N/A*"}`;
|
|
1240
|
+
} catch (e) {
|
|
1241
|
+
content = `# \u{1F916} BugZero Rescue Report
|
|
1194
1242
|
|
|
1195
1243
|
**Date:** ${(/* @__PURE__ */ new Date()).toLocaleString()}
|
|
1196
1244
|
**Project Path:** \`${cwd}\`
|
|
1197
1245
|
**Framework:** \`${detectFramework2(cwd)}\`
|
|
1198
1246
|
|
|
1199
1247
|
## \u{1F4CA} Repair Summary
|
|
1200
|
-
- **Status:**
|
|
1248
|
+
- **Status:** \u2705 Fixed successfully!
|
|
1201
1249
|
- **Attempts:** ${attempts} / ${maxAttempts}
|
|
1202
1250
|
- **AI Brain (Model):** \`${modelUsed || "unknown"}\`
|
|
1203
1251
|
- **Token Usage:** ${promptTokens !== void 0 && completionTokens !== void 0 ? `Prompt: **${promptTokens}** | Completion: **${completionTokens}** | Total: **${promptTokens + completionTokens}**` : "*N/A*"}
|
|
1204
1252
|
|
|
1205
|
-
|
|
1206
|
-
if (success && appliedFix) {
|
|
1207
|
-
content += `## \u{1F6E0}\uFE0F Applied Solution
|
|
1253
|
+
## \u{1F6E0}\uFE0F Applied Solution
|
|
1208
1254
|
- **Target File:** \`${appliedFix.filePath}\`
|
|
1209
1255
|
- **Root Cause:** ${appliedFix.rootCause}
|
|
1210
1256
|
- **Explanation:** ${appliedFix.explanation}
|
|
@@ -1220,8 +1266,44 @@ ${appliedFix.search}
|
|
|
1220
1266
|
${appliedFix.replace}
|
|
1221
1267
|
\`\`\`
|
|
1222
1268
|
`;
|
|
1269
|
+
}
|
|
1223
1270
|
} else {
|
|
1224
|
-
|
|
1271
|
+
console.log("[BugZero] Calling AI to analyze unresolved errors and write report...");
|
|
1272
|
+
const prompt = `You are an expert software engineer assistant. An automated AI agent tried to repair build/lint/test errors in a project located at "${cwd}", but could not resolve them after ${attempts} attempts.
|
|
1273
|
+
Below is the unresolved error logs.
|
|
1274
|
+
Please analyze these logs and generate a professional, beautifully formatted Markdown report summarizing:
|
|
1275
|
+
1. **Analysis of Unresolved Errors:** Explain why the AI fixes might have failed or what is still unresolved.
|
|
1276
|
+
2. **Manual Action Plan:** Provide detailed, step-by-step instructions for the developer on how to fix this manually.
|
|
1277
|
+
|
|
1278
|
+
Unresolved Error Logs:
|
|
1279
|
+
${rawOutput}
|
|
1280
|
+
|
|
1281
|
+
Generate the Markdown report directly. Do not wrap it in markdown block fences (\`\`\`markdown ... \`\`\`). Just write the markdown text directly.`;
|
|
1282
|
+
try {
|
|
1283
|
+
const result = await provider.invoke(prompt, { cwd });
|
|
1284
|
+
content = result.content;
|
|
1285
|
+
content += `
|
|
1286
|
+
|
|
1287
|
+
---
|
|
1288
|
+
### \u{1F916} BugZero Rescue Metadata
|
|
1289
|
+
- **AI Brain (Model) used for Fix Attempts:** \`${modelUsed || "unknown"}\`
|
|
1290
|
+
- **Token Usage for Fix Attempts:** ${promptTokens !== void 0 && completionTokens !== void 0 ? `Prompt: **${promptTokens}** | Completion: **${completionTokens}** | Total: **${promptTokens + completionTokens}**` : "*N/A*"}
|
|
1291
|
+
- **AI Brain (Model) used for Report:** \`${result.model || "unknown"}\`
|
|
1292
|
+
- **Token Usage for Report:** ${result.usage ? `Prompt: **${result.usage.prompt_tokens}** | Completion: **${result.usage.completion_tokens}** | Total: **${result.usage.total_tokens}**` : "*N/A*"}`;
|
|
1293
|
+
} catch (e) {
|
|
1294
|
+
content = `# \u{1F916} BugZero Rescue Report
|
|
1295
|
+
|
|
1296
|
+
**Date:** ${(/* @__PURE__ */ new Date()).toLocaleString()}
|
|
1297
|
+
**Project Path:** \`${cwd}\`
|
|
1298
|
+
**Framework:** \`${detectFramework2(cwd)}\`
|
|
1299
|
+
|
|
1300
|
+
## \u{1F4CA} Repair Summary
|
|
1301
|
+
- **Status:** \u274C Could not repair automatically
|
|
1302
|
+
- **Attempts:** ${attempts} / ${maxAttempts}
|
|
1303
|
+
- **AI Brain (Model):** \`${modelUsed || "unknown"}\`
|
|
1304
|
+
- **Token Usage:** ${promptTokens !== void 0 && completionTokens !== void 0 ? `Prompt: **${promptTokens}** | Completion: **${completionTokens}** | Total: **${promptTokens + completionTokens}**` : "*N/A*"}
|
|
1305
|
+
|
|
1306
|
+
## \u274C Failed to Repair
|
|
1225
1307
|
**Reason:** ${error || "Max attempts reached without finding a solution."}
|
|
1226
1308
|
|
|
1227
1309
|
### \u{1F7E5} Unresolved Errors & Logs
|
|
@@ -1229,15 +1311,46 @@ ${appliedFix.replace}
|
|
|
1229
1311
|
${rawOutput}
|
|
1230
1312
|
\`\`\`
|
|
1231
1313
|
`;
|
|
1314
|
+
}
|
|
1232
1315
|
}
|
|
1233
1316
|
}
|
|
1317
|
+
content += `
|
|
1318
|
+
|
|
1319
|
+
---
|
|
1320
|
+
*Report generated by **BugZero** on ${(/* @__PURE__ */ new Date()).toLocaleString()}*`;
|
|
1321
|
+
const opened = await openInIDE(content);
|
|
1322
|
+
if (!opened) {
|
|
1323
|
+
console.log("\n\u26A0\uFE0F Could not automatically open the report in your IDE (no compatible editor found in PATH).");
|
|
1324
|
+
console.log("Here is the generated report:\n");
|
|
1325
|
+
console.log(content);
|
|
1326
|
+
console.log("\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
async function openInIDE(content) {
|
|
1330
|
+
const editors = [
|
|
1331
|
+
{ cmd: "code", args: ["-"], name: "VS Code" },
|
|
1332
|
+
{ cmd: "cursor", args: ["-"], name: "Cursor" },
|
|
1333
|
+
{ cmd: "windsurf", args: ["-"], name: "Windsurf" },
|
|
1334
|
+
{ cmd: "subl", args: ["-"], name: "Sublime Text" }
|
|
1335
|
+
];
|
|
1234
1336
|
try {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1337
|
+
const { execa } = await import("execa");
|
|
1338
|
+
for (const editor of editors) {
|
|
1339
|
+
try {
|
|
1340
|
+
const proc = execa(editor.cmd, editor.args, { shell: true });
|
|
1341
|
+
if (proc.stdin) {
|
|
1342
|
+
proc.stdin.write(content);
|
|
1343
|
+
proc.stdin.end();
|
|
1344
|
+
await proc;
|
|
1345
|
+
console.log(`\u{1F5A5}\uFE0F Opened report as an unsaved tab in ${editor.name}.`);
|
|
1346
|
+
return true;
|
|
1347
|
+
}
|
|
1348
|
+
} catch (err) {
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1238
1351
|
} catch (e) {
|
|
1239
|
-
console.error(`\u26A0\uFE0F Failed to write report file: ${e.message}`);
|
|
1240
1352
|
}
|
|
1353
|
+
return false;
|
|
1241
1354
|
}
|
|
1242
1355
|
}
|
|
1243
1356
|
});
|