bugzero 0.0.44 → 0.0.46
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/dist/index.js +71 -11
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1338,6 +1338,29 @@ var require_dist6 = __commonJS({
|
|
|
1338
1338
|
reducer: (_, value) => value,
|
|
1339
1339
|
default: () => null
|
|
1340
1340
|
}),
|
|
1341
|
+
/**
|
|
1342
|
+
* Everything that has actually been written to disk so far, across ALL attempts.
|
|
1343
|
+
* `fixSuggestion` is replaced on every attempt, so it can't answer "what changed?" —
|
|
1344
|
+
* earlier attempts' edits stay on disk even after a later attempt proposes something new.
|
|
1345
|
+
* Patches accumulate in order; rootCause and explanation come from the latest applied attempt.
|
|
1346
|
+
*/
|
|
1347
|
+
appliedFix: (0, import_langgraph.Annotation)({
|
|
1348
|
+
reducer: (previous, applied) => applied === null ? previous : {
|
|
1349
|
+
rootCause: applied.rootCause,
|
|
1350
|
+
explanation: applied.explanation,
|
|
1351
|
+
patches: [...previous?.patches ?? [], ...applied.patches]
|
|
1352
|
+
},
|
|
1353
|
+
default: () => null
|
|
1354
|
+
}),
|
|
1355
|
+
/**
|
|
1356
|
+
* True when the current attempt's patch could not be applied, so there is nothing new to verify.
|
|
1357
|
+
* Every attempt sets it afresh. (This used to be inferred from a warning left in `logs`, which stayed
|
|
1358
|
+
* there after the failure and made every later attempt skip verification too.)
|
|
1359
|
+
*/
|
|
1360
|
+
patchFailed: (0, import_langgraph.Annotation)({
|
|
1361
|
+
reducer: (_, value) => value,
|
|
1362
|
+
default: () => false
|
|
1363
|
+
}),
|
|
1341
1364
|
/** Number of fix attempts made so far */
|
|
1342
1365
|
attempts: (0, import_langgraph.Annotation)({
|
|
1343
1366
|
reducer: (_, value) => value,
|
|
@@ -1416,7 +1439,7 @@ var require_dist6 = __commonJS({
|
|
|
1416
1439
|
async function applyFixNode(state) {
|
|
1417
1440
|
if (!state.fixSuggestion) {
|
|
1418
1441
|
console.warn("[BugZero] No fix suggestion available \u2014 skipping patch.");
|
|
1419
|
-
return {};
|
|
1442
|
+
return { patchFailed: false };
|
|
1420
1443
|
}
|
|
1421
1444
|
const { patches, explanation } = state.fixSuggestion;
|
|
1422
1445
|
const fileList = patches.map((p) => p.filePath).join(", ");
|
|
@@ -1432,7 +1455,8 @@ var require_dist6 = __commonJS({
|
|
|
1432
1455
|
|
|
1433
1456
|
Any other files from that same suggestion were rolled back to keep the change atomic. Please check if the file path(s) are correct relative to the project root and make sure you target the correct file(s) that contain the build error.`;
|
|
1434
1457
|
return {
|
|
1435
|
-
logs: updatedLogs
|
|
1458
|
+
logs: updatedLogs,
|
|
1459
|
+
patchFailed: true
|
|
1436
1460
|
};
|
|
1437
1461
|
}
|
|
1438
1462
|
for (const applied of result.applied) {
|
|
@@ -1441,10 +1465,10 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
1441
1465
|
console.log(`[BugZero] Note: exact match failed for ${applied.filePath} \u2014 patch applied via ${applied.matchStrategy} matching.`);
|
|
1442
1466
|
}
|
|
1443
1467
|
}
|
|
1444
|
-
return {};
|
|
1468
|
+
return { appliedFix: state.fixSuggestion, patchFailed: false };
|
|
1445
1469
|
}
|
|
1446
1470
|
async function verifyNode(state) {
|
|
1447
|
-
if (state.
|
|
1471
|
+
if (state.patchFailed) {
|
|
1448
1472
|
console.log("[BugZero] Skipping validation pipeline because the patch failed to apply.");
|
|
1449
1473
|
return {
|
|
1450
1474
|
success: false,
|
|
@@ -1483,8 +1507,40 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
1483
1507
|
}
|
|
1484
1508
|
});
|
|
1485
1509
|
|
|
1486
|
-
// ../../packages/
|
|
1510
|
+
// ../../packages/shared/dist/index.js
|
|
1487
1511
|
var require_dist7 = __commonJS({
|
|
1512
|
+
"../../packages/shared/dist/index.js"(exports2, module2) {
|
|
1513
|
+
"use strict";
|
|
1514
|
+
var __defProp2 = Object.defineProperty;
|
|
1515
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1516
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1517
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1518
|
+
var __export = (target, all) => {
|
|
1519
|
+
for (var name in all)
|
|
1520
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
1521
|
+
};
|
|
1522
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
1523
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1524
|
+
for (let key of __getOwnPropNames2(from))
|
|
1525
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
1526
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1527
|
+
}
|
|
1528
|
+
return to;
|
|
1529
|
+
};
|
|
1530
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1531
|
+
var index_exports = {};
|
|
1532
|
+
__export(index_exports, {
|
|
1533
|
+
uniqueFilePaths: () => uniqueFilePaths3
|
|
1534
|
+
});
|
|
1535
|
+
module2.exports = __toCommonJS(index_exports);
|
|
1536
|
+
function uniqueFilePaths3(patches) {
|
|
1537
|
+
return [...new Set(patches.map((patch) => patch.filePath))];
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
});
|
|
1541
|
+
|
|
1542
|
+
// ../../packages/core/dist/index.js
|
|
1543
|
+
var require_dist8 = __commonJS({
|
|
1488
1544
|
"../../packages/core/dist/index.js"(exports2, module2) {
|
|
1489
1545
|
"use strict";
|
|
1490
1546
|
var __create2 = Object.create;
|
|
@@ -1555,6 +1611,7 @@ var require_dist7 = __commonJS({
|
|
|
1555
1611
|
}
|
|
1556
1612
|
var import_analyzers = require_dist2();
|
|
1557
1613
|
var import_agents = require_dist6();
|
|
1614
|
+
var import_shared3 = require_dist7();
|
|
1558
1615
|
var import_fs3 = __toESM2(require("fs"));
|
|
1559
1616
|
var import_path3 = __toESM2(require("path"));
|
|
1560
1617
|
var import_url = require("url");
|
|
@@ -1694,7 +1751,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
1694
1751
|
success: finalState.success,
|
|
1695
1752
|
attempts: finalState.attempts,
|
|
1696
1753
|
finalOutput: finalState.logs || pipelineResult.output,
|
|
1697
|
-
appliedFix: finalState.
|
|
1754
|
+
appliedFix: finalState.appliedFix ?? void 0,
|
|
1698
1755
|
error: finalState.success ? void 0 : `Max attempts (${maxAttempts}) reached without a successful build.`,
|
|
1699
1756
|
modelUsed: finalState.modelUsed,
|
|
1700
1757
|
promptTokens: finalState.promptTokens,
|
|
@@ -1828,7 +1885,7 @@ ${logs}
|
|
|
1828
1885
|
}
|
|
1829
1886
|
} else if (success && appliedFix) {
|
|
1830
1887
|
console.log("[BugZero] Calling AI to write solution summary report...");
|
|
1831
|
-
const patchedFiles = appliedFix.patches
|
|
1888
|
+
const patchedFiles = (0, import_shared3.uniqueFilePaths)(appliedFix.patches).join(", ");
|
|
1832
1889
|
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: ${patchedFiles}.
|
|
1833
1890
|
Here is the patch details:
|
|
1834
1891
|
- Root Cause: ${appliedFix.rootCause}
|
|
@@ -1866,7 +1923,7 @@ Generate the Markdown report directly. Do not wrap it in markdown block fences (
|
|
|
1866
1923
|
- **Token Usage:** ${promptTokens !== void 0 && completionTokens !== void 0 ? `Prompt: **${promptTokens}** | Completion: **${completionTokens}** | Total: **${promptTokens + completionTokens}**` : "*N/A*"}
|
|
1867
1924
|
|
|
1868
1925
|
## \u{1F6E0}\uFE0F Applied Solution
|
|
1869
|
-
- **Target File(s):** ${appliedFix.patches.map((
|
|
1926
|
+
- **Target File(s):** ${(0, import_shared3.uniqueFilePaths)(appliedFix.patches).map((file) => `\`${file}\``).join(", ")}
|
|
1870
1927
|
- **Root Cause:** ${appliedFix.rootCause}
|
|
1871
1928
|
- **Explanation:** ${appliedFix.explanation}
|
|
1872
1929
|
|
|
@@ -1952,9 +2009,10 @@ var import_config = __toESM(require_dist());
|
|
|
1952
2009
|
var import_commander = require("commander");
|
|
1953
2010
|
var import_fs = __toESM(require("fs"));
|
|
1954
2011
|
var import_path = __toESM(require("path"));
|
|
1955
|
-
var import_core = __toESM(
|
|
2012
|
+
var import_core = __toESM(require_dist8());
|
|
1956
2013
|
|
|
1957
2014
|
// src/json-output.ts
|
|
2015
|
+
var import_shared = __toESM(require_dist7());
|
|
1958
2016
|
function stepStatus(step) {
|
|
1959
2017
|
if (step.skipped) return "skipped";
|
|
1960
2018
|
return step.success ? "passed" : "failed";
|
|
@@ -2000,7 +2058,7 @@ function buildRescueJson(result, info) {
|
|
|
2000
2058
|
fix: result.appliedFix ? {
|
|
2001
2059
|
rootCause: result.appliedFix.rootCause,
|
|
2002
2060
|
explanation: result.appliedFix.explanation,
|
|
2003
|
-
files: result.appliedFix.patches
|
|
2061
|
+
files: (0, import_shared.uniqueFilePaths)(result.appliedFix.patches)
|
|
2004
2062
|
} : null,
|
|
2005
2063
|
error: result.error ?? null,
|
|
2006
2064
|
reportPath: info.reportPath
|
|
@@ -2011,6 +2069,7 @@ function buildErrorJson(message) {
|
|
|
2011
2069
|
}
|
|
2012
2070
|
|
|
2013
2071
|
// src/summary.ts
|
|
2072
|
+
var import_shared2 = __toESM(require_dist7());
|
|
2014
2073
|
function tokenLines(result) {
|
|
2015
2074
|
if (result.promptTokens === void 0 || result.completionTokens === void 0) return [];
|
|
2016
2075
|
const total = result.promptTokens + result.completionTokens;
|
|
@@ -2031,8 +2090,9 @@ function buildRescueSummary(result, options) {
|
|
|
2031
2090
|
];
|
|
2032
2091
|
if (result.appliedFix) {
|
|
2033
2092
|
const { patches, explanation, rootCause } = result.appliedFix;
|
|
2093
|
+
const files = (0, import_shared2.uniqueFilePaths)(patches);
|
|
2034
2094
|
lines2.push(
|
|
2035
|
-
` File${
|
|
2095
|
+
` File${files.length === 1 ? "" : "s"}: ${files.join(", ")}`,
|
|
2036
2096
|
` Reason: ${explanation}`,
|
|
2037
2097
|
` Root cause: ${rootCause}`
|
|
2038
2098
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugzero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"description": "Autonomous AI-powered CLI and GitHub Action that detects build, lint, and test failures, generates multi-file patches, applies them atomically with fuzzy matching, and re-verifies until your project is green.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Saksham Agarwal (https://github.com/Saksham1800t)",
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@opspilot/agents": "workspace:*",
|
|
56
56
|
"@opspilot/config": "workspace:*",
|
|
57
|
-
"@opspilot/core": "workspace:*"
|
|
57
|
+
"@opspilot/core": "workspace:*",
|
|
58
|
+
"@opspilot/shared": "workspace:*"
|
|
58
59
|
},
|
|
59
60
|
"main": "./dist/index.js",
|
|
60
61
|
"types": "./dist/index.d.ts",
|