bugzero 0.0.10 → 0.0.11

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > bugzero@0.0.10 build D:\WD projects\OpsPilot\packages\cli
2
+ > bugzero@0.0.11 build D:\WD projects\OpsPilot\packages\cli
3
3
  > tsup src/index.ts --format cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -7,8 +7,8 @@
7
7
  CLI tsup v8.5.1
8
8
  CLI Target: es2022
9
9
  CJS Build start
10
- CJS dist\index.js 47.28 KB
11
- CJS ⚡️ Build success in 393ms
10
+ CJS dist\index.js 49.36 KB
11
+ CJS ⚡️ Build success in 76ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1398ms
13
+ DTS ⚡️ Build success in 1162ms
14
14
  DTS dist\index.d.ts 20.00 B
package/dist/index.js CHANGED
@@ -419,9 +419,11 @@ var require_dist = __commonJS({
419
419
  var require_dist2 = __commonJS({
420
420
  "../analyzers/dist/index.js"(exports2, module2) {
421
421
  "use strict";
422
+ var __create2 = Object.create;
422
423
  var __defProp2 = Object.defineProperty;
423
424
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
424
425
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
426
+ var __getProtoOf2 = Object.getPrototypeOf;
425
427
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
426
428
  var __export = (target, all) => {
427
429
  for (var name in all)
@@ -435,6 +437,14 @@ var require_dist2 = __commonJS({
435
437
  }
436
438
  return to;
437
439
  };
440
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
441
+ // If the importer is in node compatibility mode or this is not an ESM
442
+ // file that has been converted to a CommonJS file using a Babel-
443
+ // compatible transform (i.e. "__esModule" has not been set), then set
444
+ // "default" to the CommonJS "module.exports" for node compatibility.
445
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
446
+ mod
447
+ ));
438
448
  var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
439
449
  var index_exports = {};
440
450
  __export(index_exports, {
@@ -442,7 +452,8 @@ var require_dist2 = __commonJS({
442
452
  runBuild: () => runBuild,
443
453
  runCommand: () => runCommand,
444
454
  runLint: () => runLint,
445
- runTests: () => runTests
455
+ runTests: () => runTests,
456
+ runValidationPipeline: () => runValidationPipeline
446
457
  });
447
458
  module2.exports = __toCommonJS(index_exports);
448
459
  async function runCommand(command, cwd) {
@@ -520,6 +531,40 @@ var require_dist2 = __commonJS({
520
531
  }
521
532
  return errors;
522
533
  }
534
+ var import_fs = __toESM2(require("fs"));
535
+ var import_path2 = __toESM2(require("path"));
536
+ async function runValidationPipeline(cwd) {
537
+ const targetCwd = cwd ?? process.cwd();
538
+ let scripts = [];
539
+ try {
540
+ const pkgPath = import_path2.default.resolve(targetCwd, "package.json");
541
+ if (import_fs.default.existsSync(pkgPath)) {
542
+ const pkg = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf-8"));
543
+ scripts = Object.keys(pkg.scripts || {});
544
+ }
545
+ } catch {
546
+ }
547
+ console.log(`[BugZero] Running build...`);
548
+ const buildRes = await runBuild(targetCwd);
549
+ if (!buildRes.success) {
550
+ return { success: false, step: "build", output: buildRes.output };
551
+ }
552
+ if (scripts.includes("lint")) {
553
+ console.log(`[BugZero] Running lint...`);
554
+ const lintRes = await runLint(targetCwd);
555
+ if (!lintRes.success) {
556
+ return { success: false, step: "lint", output: lintRes.output };
557
+ }
558
+ }
559
+ if (scripts.includes("test")) {
560
+ console.log(`[BugZero] Running tests...`);
561
+ const testRes = await runTests(targetCwd);
562
+ if (!testRes.success) {
563
+ return { success: false, step: "test", output: testRes.output };
564
+ }
565
+ }
566
+ return { success: true, step: "none", output: "" };
567
+ }
523
568
  }
524
569
  });
525
570
 
@@ -867,12 +912,12 @@ var require_dist6 = __commonJS({
867
912
  return {};
868
913
  }
869
914
  async function verifyNode(state) {
870
- console.log("[BugZero] Re-running build to verify fix\u2026");
871
- const result = await (0, import_analyzers.runBuild)(state.cwd);
915
+ console.log("[BugZero] Re-running validation pipeline to verify fix\u2026");
916
+ const result = await (0, import_analyzers.runValidationPipeline)(state.cwd);
872
917
  if (result.success) {
873
- console.log("[BugZero] \u2705 Build succeeded!");
918
+ console.log("[BugZero] \u2705 Validation succeeded!");
874
919
  } else {
875
- console.log("[BugZero] \u274C Build still failing. New error output captured.");
920
+ console.log(`[BugZero] \u274C Validation failed at step "${result.step}". New error output captured.`);
876
921
  }
877
922
  return {
878
923
  success: result.success,
@@ -972,26 +1017,26 @@ var require_dist7 = __commonJS({
972
1017
  async function orchestrateAndFix2(options = {}) {
973
1018
  const cwd = options.cwd ?? process.cwd();
974
1019
  const maxAttempts = options.maxAttempts ?? 3;
975
- console.log(`[BugZero] Running build in: ${cwd}`);
976
- const buildResult = await (0, import_analyzers.runBuild)(cwd);
977
- if (buildResult.success) {
978
- console.log("[BugZero] Build already passing \u2014 nothing to fix.");
979
- return { success: true, attempts: 0, finalOutput: buildResult.output };
1020
+ console.log(`[BugZero] Running validation pipeline in: ${cwd}`);
1021
+ const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd);
1022
+ if (pipelineResult.success) {
1023
+ console.log("[BugZero] Validation already passing \u2014 nothing to fix.");
1024
+ return { success: true, attempts: 0, finalOutput: "" };
980
1025
  }
981
- const errors = (0, import_analyzers.parseErrors)(buildResult.output);
1026
+ const errors = (0, import_analyzers.parseErrors)(pipelineResult.output);
982
1027
  console.log(`[BugZero] Detected ${errors.length} error(s) (type: ${errors[0]?.type ?? "unknown"})`);
983
1028
  if (options.dryRun) {
984
1029
  console.log("[BugZero] Dry-run mode \u2014 skipping AI fix.");
985
1030
  return {
986
1031
  success: false,
987
1032
  attempts: 0,
988
- finalOutput: buildResult.output,
1033
+ finalOutput: pipelineResult.output,
989
1034
  error: "Dry-run: analysis complete, no files modified."
990
1035
  };
991
1036
  }
992
1037
  const finalState = await import_agents.workflow.invoke({
993
1038
  cwd,
994
- logs: buildResult.output,
1039
+ logs: pipelineResult.output,
995
1040
  maxAttempts,
996
1041
  attempts: 0,
997
1042
  success: false
@@ -999,7 +1044,7 @@ var require_dist7 = __commonJS({
999
1044
  return {
1000
1045
  success: finalState.success,
1001
1046
  attempts: finalState.attempts,
1002
- finalOutput: finalState.logs || buildResult.output,
1047
+ finalOutput: finalState.logs || pipelineResult.output,
1003
1048
  appliedFix: finalState.fixSuggestion ?? void 0,
1004
1049
  error: finalState.success ? void 0 : `Max attempts (${maxAttempts}) reached without a successful build.`
1005
1050
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugzero",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "bin": {
5
5
  "bugzero": "dist/index.js"
6
6
  },