bugzero 0.0.9 → 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.9 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.20 KB
11
- CJS ⚡️ Build success in 122ms
10
+ CJS dist\index.js 49.36 KB
11
+ CJS ⚡️ Build success in 76ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1127ms
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) {
@@ -451,7 +462,11 @@ var require_dist2 = __commonJS({
451
462
  const result = await execa(command, {
452
463
  shell: true,
453
464
  cwd: cwd ?? process.cwd(),
454
- all: true
465
+ all: true,
466
+ env: {
467
+ ...process.env,
468
+ CI: "true"
469
+ }
455
470
  });
456
471
  return {
457
472
  success: true,
@@ -516,6 +531,40 @@ var require_dist2 = __commonJS({
516
531
  }
517
532
  return errors;
518
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
+ }
519
568
  }
520
569
  });
521
570
 
@@ -863,12 +912,12 @@ var require_dist6 = __commonJS({
863
912
  return {};
864
913
  }
865
914
  async function verifyNode(state) {
866
- console.log("[BugZero] Re-running build to verify fix\u2026");
867
- 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);
868
917
  if (result.success) {
869
- console.log("[BugZero] \u2705 Build succeeded!");
918
+ console.log("[BugZero] \u2705 Validation succeeded!");
870
919
  } else {
871
- 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.`);
872
921
  }
873
922
  return {
874
923
  success: result.success,
@@ -968,26 +1017,26 @@ var require_dist7 = __commonJS({
968
1017
  async function orchestrateAndFix2(options = {}) {
969
1018
  const cwd = options.cwd ?? process.cwd();
970
1019
  const maxAttempts = options.maxAttempts ?? 3;
971
- console.log(`[BugZero] Running build in: ${cwd}`);
972
- const buildResult = await (0, import_analyzers.runBuild)(cwd);
973
- if (buildResult.success) {
974
- console.log("[BugZero] Build already passing \u2014 nothing to fix.");
975
- 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: "" };
976
1025
  }
977
- const errors = (0, import_analyzers.parseErrors)(buildResult.output);
1026
+ const errors = (0, import_analyzers.parseErrors)(pipelineResult.output);
978
1027
  console.log(`[BugZero] Detected ${errors.length} error(s) (type: ${errors[0]?.type ?? "unknown"})`);
979
1028
  if (options.dryRun) {
980
1029
  console.log("[BugZero] Dry-run mode \u2014 skipping AI fix.");
981
1030
  return {
982
1031
  success: false,
983
1032
  attempts: 0,
984
- finalOutput: buildResult.output,
1033
+ finalOutput: pipelineResult.output,
985
1034
  error: "Dry-run: analysis complete, no files modified."
986
1035
  };
987
1036
  }
988
1037
  const finalState = await import_agents.workflow.invoke({
989
1038
  cwd,
990
- logs: buildResult.output,
1039
+ logs: pipelineResult.output,
991
1040
  maxAttempts,
992
1041
  attempts: 0,
993
1042
  success: false
@@ -995,7 +1044,7 @@ var require_dist7 = __commonJS({
995
1044
  return {
996
1045
  success: finalState.success,
997
1046
  attempts: finalState.attempts,
998
- finalOutput: finalState.logs || buildResult.output,
1047
+ finalOutput: finalState.logs || pipelineResult.output,
999
1048
  appliedFix: finalState.fixSuggestion ?? void 0,
1000
1049
  error: finalState.success ? void 0 : `Max attempts (${maxAttempts}) reached without a successful build.`
1001
1050
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugzero",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "bin": {
5
5
  "bugzero": "dist/index.js"
6
6
  },