bugzero 0.0.37 → 0.0.38

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 CHANGED
@@ -92,7 +92,7 @@ bugzero rescue
92
92
 
93
93
  ### Repair engine
94
94
 
95
- - **Autonomous repair loop.** `bugzero rescue` runs your build, lint, and tests. When something fails, it sends the error output — along with the relevant source files and directory listings as context — to an LLM, applies the fix the model proposes, and re-runs validation. It repeats, feeding any patch failures back to the model, until everything passes or the attempt limit is reached (3 by default; change it with `--max-attempts`). The loop is a stateful LangGraph graph: analyze, patch, verify.
95
+ - **Autonomous repair loop.** `bugzero rescue` runs your build, lint, and tests. When something fails, it sends the error output — along with the relevant source files and directory listings as context — to an LLM, applies the fix the model proposes, and re-runs validation. It repeats, feeding any patch failures back to the model, until everything passes or the attempt limit is reached (3 by default; change it with `--max-attempts`, which accepts any whole number of 1 or more). The loop is a stateful LangGraph graph: analyze, patch, verify.
96
96
  - **Multi-file patches.** One fix can edit several files at once — for example, a renamed export plus every file that imports it. All patches in an attempt are applied as a single atomic unit: if any one of them fails to apply, every file touched in that attempt is restored to its original content, so you never end up with a half-applied fix.
97
97
  - **Fuzzy patch matching.** LLMs rarely reproduce code byte-for-byte, so BugZero locates each patch in three tiers: an exact match first, then a whitespace-normalized line match (tolerates indentation and spacing drift), then a similarity-scored match (average per-line similarity of at least 85%). If two locations look equally plausible, it refuses to guess and reports a failed patch instead of risking an edit in the wrong place.
98
98
  - **Multi-model support.** Works with any model available on OpenRouter — DeepSeek, Claude, Gemini, GPT-4o, Llama, and more. Choose one interactively with `bugzero vibe`; the choice is saved per project in `.bugzerorc`.
package/dist/index.js CHANGED
@@ -1251,6 +1251,7 @@ var require_dist6 = __commonJS({
1251
1251
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1252
1252
  var index_exports = {};
1253
1253
  __export(index_exports, {
1254
+ runRepairWorkflow: () => runRepairWorkflow,
1254
1255
  workflow: () => workflow
1255
1256
  });
1256
1257
  module2.exports = __toCommonJS(index_exports);
@@ -1408,6 +1409,12 @@ Any other files from that same suggestion were rolled back to keep the change at
1408
1409
  return "analyze";
1409
1410
  }
1410
1411
  var workflow = new import_langgraph2.StateGraph(GraphState).addNode("analyze", analyzeNode).addNode("apply_fix", applyFixNode).addNode("verify", verifyNode).addEdge(import_langgraph2.START, "analyze").addEdge("analyze", "apply_fix").addEdge("apply_fix", "verify").addConditionalEdges("verify", shouldRetry).compile();
1412
+ function runRepairWorkflow(input) {
1413
+ return workflow.invoke(
1414
+ { ...input, attempts: 0, success: false },
1415
+ { recursionLimit: input.maxAttempts * 3 + 5 }
1416
+ );
1417
+ }
1411
1418
  }
1412
1419
  });
1413
1420
 
@@ -1444,10 +1451,12 @@ var require_dist7 = __commonJS({
1444
1451
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1445
1452
  var index_exports = {};
1446
1453
  __export(index_exports, {
1454
+ DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS,
1447
1455
  detectFramework: () => detectFramework2,
1448
1456
  detectPackageManager: () => import_analyzers2.detectPackageManager,
1449
1457
  orchestrate: () => orchestrate2,
1450
- orchestrateAndFix: () => orchestrateAndFix2
1458
+ orchestrateAndFix: () => orchestrateAndFix2,
1459
+ resolveMaxAttempts: () => resolveMaxAttempts2
1451
1460
  });
1452
1461
  module2.exports = __toCommonJS(index_exports);
1453
1462
  var import_fs2 = __toESM2(require("fs"));
@@ -1482,6 +1491,14 @@ var require_dist7 = __commonJS({
1482
1491
  var import_fs3 = __toESM2(require("fs"));
1483
1492
  var import_path3 = __toESM2(require("path"));
1484
1493
  var import_url = require("url");
1494
+ var DEFAULT_MAX_ATTEMPTS = 3;
1495
+ function resolveMaxAttempts2(value) {
1496
+ const attempts = value ?? DEFAULT_MAX_ATTEMPTS;
1497
+ if (!Number.isInteger(attempts) || attempts < 1) {
1498
+ throw new Error(`--max-attempts must be a whole number of 1 or more (received ${value}).`);
1499
+ }
1500
+ return attempts;
1501
+ }
1485
1502
  var import_fs22 = __toESM2(require("fs"));
1486
1503
  var import_path22 = __toESM2(require("path"));
1487
1504
  function assertNodeProject(cwd) {
@@ -1513,7 +1530,7 @@ var require_dist7 = __commonJS({
1513
1530
  async function orchestrateAndFix2(options = {}) {
1514
1531
  const cwd = options.cwd ?? process.cwd();
1515
1532
  assertNodeProject(cwd);
1516
- const maxAttempts = options.maxAttempts ?? 3;
1533
+ const maxAttempts = resolveMaxAttempts2(options.maxAttempts);
1517
1534
  console.log(`[BugZero] Running validation pipeline in: ${cwd}`);
1518
1535
  const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd);
1519
1536
  if (pipelineResult.success) {
@@ -1544,12 +1561,10 @@ var require_dist7 = __commonJS({
1544
1561
  error: "Dry-run: analysis complete, no files modified."
1545
1562
  };
1546
1563
  }
1547
- const finalState = await import_agents.workflow.invoke({
1564
+ const finalState = await (0, import_agents.runRepairWorkflow)({
1548
1565
  cwd,
1549
1566
  logs: pipelineResult.output,
1550
- maxAttempts,
1551
- attempts: 0,
1552
- success: false
1567
+ maxAttempts
1553
1568
  });
1554
1569
  const result = {
1555
1570
  success: finalState.success,
@@ -1836,7 +1851,7 @@ ${allPassed ? "\u2705 All checks passed" : "\u274C Issues found \u2014 run 'bugz
1836
1851
  program.command("rescue").description("Detect build failures and automatically apply AI-generated fixes").option("-p, --path <dir>", "Path to the target project", ".").option("-n, --max-attempts <number>", "Maximum AI fix attempts", "3").option("--dry-run", "Analyse only \u2014 print what would be fixed without writing files", false).action(async (opts) => {
1837
1852
  try {
1838
1853
  const cwd = import_path.default.resolve(opts.path);
1839
- const maxAttempts = parseInt(opts.maxAttempts, 10);
1854
+ const maxAttempts = (0, import_core.resolveMaxAttempts)(Number(opts.maxAttempts));
1840
1855
  const dryRun = opts.dryRun;
1841
1856
  const framework = (0, import_core.detectFramework)(cwd);
1842
1857
  const packageManager = (0, import_core.detectPackageManager)(cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugzero",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
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)",