bugzero 0.0.44 → 0.0.45

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.
Files changed (2) hide show
  1. package/dist/index.js +58 -8
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -1338,6 +1338,20 @@ 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
+ }),
1341
1355
  /** Number of fix attempts made so far */
1342
1356
  attempts: (0, import_langgraph.Annotation)({
1343
1357
  reducer: (_, value) => value,
@@ -1441,7 +1455,7 @@ Any other files from that same suggestion were rolled back to keep the change at
1441
1455
  console.log(`[BugZero] Note: exact match failed for ${applied.filePath} \u2014 patch applied via ${applied.matchStrategy} matching.`);
1442
1456
  }
1443
1457
  }
1444
- return {};
1458
+ return { appliedFix: state.fixSuggestion };
1445
1459
  }
1446
1460
  async function verifyNode(state) {
1447
1461
  if (state.logs.includes("[BugZero System Warning]")) {
@@ -1483,8 +1497,40 @@ Any other files from that same suggestion were rolled back to keep the change at
1483
1497
  }
1484
1498
  });
1485
1499
 
1486
- // ../../packages/core/dist/index.js
1500
+ // ../../packages/shared/dist/index.js
1487
1501
  var require_dist7 = __commonJS({
1502
+ "../../packages/shared/dist/index.js"(exports2, module2) {
1503
+ "use strict";
1504
+ var __defProp2 = Object.defineProperty;
1505
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1506
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
1507
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1508
+ var __export = (target, all) => {
1509
+ for (var name in all)
1510
+ __defProp2(target, name, { get: all[name], enumerable: true });
1511
+ };
1512
+ var __copyProps2 = (to, from, except, desc) => {
1513
+ if (from && typeof from === "object" || typeof from === "function") {
1514
+ for (let key of __getOwnPropNames2(from))
1515
+ if (!__hasOwnProp2.call(to, key) && key !== except)
1516
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1517
+ }
1518
+ return to;
1519
+ };
1520
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1521
+ var index_exports = {};
1522
+ __export(index_exports, {
1523
+ uniqueFilePaths: () => uniqueFilePaths3
1524
+ });
1525
+ module2.exports = __toCommonJS(index_exports);
1526
+ function uniqueFilePaths3(patches) {
1527
+ return [...new Set(patches.map((patch) => patch.filePath))];
1528
+ }
1529
+ }
1530
+ });
1531
+
1532
+ // ../../packages/core/dist/index.js
1533
+ var require_dist8 = __commonJS({
1488
1534
  "../../packages/core/dist/index.js"(exports2, module2) {
1489
1535
  "use strict";
1490
1536
  var __create2 = Object.create;
@@ -1555,6 +1601,7 @@ var require_dist7 = __commonJS({
1555
1601
  }
1556
1602
  var import_analyzers = require_dist2();
1557
1603
  var import_agents = require_dist6();
1604
+ var import_shared3 = require_dist7();
1558
1605
  var import_fs3 = __toESM2(require("fs"));
1559
1606
  var import_path3 = __toESM2(require("path"));
1560
1607
  var import_url = require("url");
@@ -1694,7 +1741,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
1694
1741
  success: finalState.success,
1695
1742
  attempts: finalState.attempts,
1696
1743
  finalOutput: finalState.logs || pipelineResult.output,
1697
- appliedFix: finalState.fixSuggestion ?? void 0,
1744
+ appliedFix: finalState.appliedFix ?? void 0,
1698
1745
  error: finalState.success ? void 0 : `Max attempts (${maxAttempts}) reached without a successful build.`,
1699
1746
  modelUsed: finalState.modelUsed,
1700
1747
  promptTokens: finalState.promptTokens,
@@ -1828,7 +1875,7 @@ ${logs}
1828
1875
  }
1829
1876
  } else if (success && appliedFix) {
1830
1877
  console.log("[BugZero] Calling AI to write solution summary report...");
1831
- const patchedFiles = appliedFix.patches.map((p) => p.filePath).join(", ");
1878
+ const patchedFiles = (0, import_shared3.uniqueFilePaths)(appliedFix.patches).join(", ");
1832
1879
  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
1880
  Here is the patch details:
1834
1881
  - Root Cause: ${appliedFix.rootCause}
@@ -1866,7 +1913,7 @@ Generate the Markdown report directly. Do not wrap it in markdown block fences (
1866
1913
  - **Token Usage:** ${promptTokens !== void 0 && completionTokens !== void 0 ? `Prompt: **${promptTokens}** | Completion: **${completionTokens}** | Total: **${promptTokens + completionTokens}**` : "*N/A*"}
1867
1914
 
1868
1915
  ## \u{1F6E0}\uFE0F Applied Solution
1869
- - **Target File(s):** ${appliedFix.patches.map((p) => `\`${p.filePath}\``).join(", ")}
1916
+ - **Target File(s):** ${(0, import_shared3.uniqueFilePaths)(appliedFix.patches).map((file) => `\`${file}\``).join(", ")}
1870
1917
  - **Root Cause:** ${appliedFix.rootCause}
1871
1918
  - **Explanation:** ${appliedFix.explanation}
1872
1919
 
@@ -1952,9 +1999,10 @@ var import_config = __toESM(require_dist());
1952
1999
  var import_commander = require("commander");
1953
2000
  var import_fs = __toESM(require("fs"));
1954
2001
  var import_path = __toESM(require("path"));
1955
- var import_core = __toESM(require_dist7());
2002
+ var import_core = __toESM(require_dist8());
1956
2003
 
1957
2004
  // src/json-output.ts
2005
+ var import_shared = __toESM(require_dist7());
1958
2006
  function stepStatus(step) {
1959
2007
  if (step.skipped) return "skipped";
1960
2008
  return step.success ? "passed" : "failed";
@@ -2000,7 +2048,7 @@ function buildRescueJson(result, info) {
2000
2048
  fix: result.appliedFix ? {
2001
2049
  rootCause: result.appliedFix.rootCause,
2002
2050
  explanation: result.appliedFix.explanation,
2003
- files: result.appliedFix.patches.map((p) => p.filePath)
2051
+ files: (0, import_shared.uniqueFilePaths)(result.appliedFix.patches)
2004
2052
  } : null,
2005
2053
  error: result.error ?? null,
2006
2054
  reportPath: info.reportPath
@@ -2011,6 +2059,7 @@ function buildErrorJson(message) {
2011
2059
  }
2012
2060
 
2013
2061
  // src/summary.ts
2062
+ var import_shared2 = __toESM(require_dist7());
2014
2063
  function tokenLines(result) {
2015
2064
  if (result.promptTokens === void 0 || result.completionTokens === void 0) return [];
2016
2065
  const total = result.promptTokens + result.completionTokens;
@@ -2031,8 +2080,9 @@ function buildRescueSummary(result, options) {
2031
2080
  ];
2032
2081
  if (result.appliedFix) {
2033
2082
  const { patches, explanation, rootCause } = result.appliedFix;
2083
+ const files = (0, import_shared2.uniqueFilePaths)(patches);
2034
2084
  lines2.push(
2035
- ` File${patches.length === 1 ? "" : "s"}: ${patches.map((p) => p.filePath).join(", ")}`,
2085
+ ` File${files.length === 1 ? "" : "s"}: ${files.join(", ")}`,
2036
2086
  ` Reason: ${explanation}`,
2037
2087
  ` Root cause: ${rootCause}`
2038
2088
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugzero",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
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",