bugzero 0.0.27 → 0.0.28

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.27 build D:\WD projects\OpsPilot\packages\cli
2
+ > bugzero@0.0.28 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 70.06 KB
11
- CJS ⚡️ Build success in 75ms
10
+ CJS dist\index.js 70.42 KB
11
+ CJS ⚡️ Build success in 111ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1335ms
13
+ DTS ⚡️ Build success in 2699ms
14
14
  DTS dist\index.d.ts 20.00 B
package/dist/index.js CHANGED
@@ -1541,62 +1541,74 @@ var import_core = __toESM(require_dist7());
1541
1541
  var program = new import_commander.Command();
1542
1542
  program.name("bugzero").description("AI-powered build issue fixer \u2014 detects and repairs build errors automatically").version("0.0.1");
1543
1543
  program.command("hunt").description("Run build, lint, and tests \u2014 report issues without modifying files").option("-p, --path <dir>", "Path to the target project", ".").action(async (opts) => {
1544
- const cwd = import_path.default.resolve(opts.path);
1545
- const framework = (0, import_core.detectFramework)(cwd);
1546
- console.log(`
1544
+ try {
1545
+ const cwd = import_path.default.resolve(opts.path);
1546
+ const framework = (0, import_core.detectFramework)(cwd);
1547
+ console.log(`
1547
1548
  \u{1F50D} BugZero \u2014 Analyzing project`);
1548
- console.log(` Path: ${cwd}`);
1549
- console.log(` Framework: ${framework}
1549
+ console.log(` Path: ${cwd}`);
1550
+ console.log(` Framework: ${framework}
1550
1551
  `);
1551
- const { build, lint, test } = await (0, import_core.orchestrate)({ cwd });
1552
- console.log("\u2500\u2500 Pipeline Summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1553
- console.log(` Build: ${build.success ? "\u2705 Passed" : "\u274C Failed (see report)"}`);
1554
- console.log(` Lint: ${lint.success ? "\u2705 Passed" : "\u274C Failed (see report)"}`);
1555
- console.log(` Tests: ${test.success ? "\u2705 Passed" : "\u274C Failed (see report)"}`);
1556
- console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1557
- const allPassed = build.success && lint.success && test.success;
1558
- console.log(`
1552
+ const { build, lint, test } = await (0, import_core.orchestrate)({ cwd });
1553
+ console.log("\u2500\u2500 Pipeline Summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1554
+ console.log(` Build: ${build.success ? "\u2705 Passed" : "\u274C Failed (see report)"}`);
1555
+ console.log(` Lint: ${lint.success ? "\u2705 Passed" : "\u274C Failed (see report)"}`);
1556
+ console.log(` Tests: ${test.success ? "\u2705 Passed" : "\u274C Failed (see report)"}`);
1557
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1558
+ const allPassed = build.success && lint.success && test.success;
1559
+ console.log(`
1559
1560
  ${allPassed ? "\u2705 All checks passed" : "\u274C Issues found \u2014 run 'bugzero rescue' to repair"}
1560
1561
  `);
1561
- process.exit(allPassed ? 0 : 1);
1562
+ process.exit(allPassed ? 0 : 1);
1563
+ } catch (error) {
1564
+ console.error(`
1565
+ \u274C [BugZero] Execution failed: ${error.message || error}`);
1566
+ process.exit(1);
1567
+ }
1562
1568
  });
1563
1569
  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) => {
1564
- const cwd = import_path.default.resolve(opts.path);
1565
- const maxAttempts = parseInt(opts.maxAttempts, 10);
1566
- const dryRun = opts.dryRun;
1567
- const framework = (0, import_core.detectFramework)(cwd);
1568
- console.log(`
1569
- \u{1F916} BugZero Fix`);
1570
- console.log(` Path: ${cwd}`);
1571
- console.log(` Framework: ${framework}`);
1572
- console.log(` Max attempts: ${maxAttempts}`);
1573
- if (dryRun) console.log(` Mode: DRY RUN (no files will be modified)`);
1574
- console.log();
1575
- const result = await (0, import_core.orchestrateAndFix)({ cwd, maxAttempts, dryRun });
1576
- console.log("\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1577
- if (result.success) {
1578
- console.log(`\u2705 Build fixed after ${result.attempts} attempt(s)!`);
1579
- console.log(` Model: ${result.modelUsed || "unknown"}`);
1580
- if (result.promptTokens !== void 0 && result.completionTokens !== void 0) {
1581
- console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
1582
- }
1583
- if (result.appliedFix) {
1584
- console.log(` File: ${result.appliedFix.filePath}`);
1585
- console.log(` Reason: ${result.appliedFix.explanation}`);
1586
- console.log(` Root cause: ${result.appliedFix.rootCause}`);
1587
- }
1588
- } else {
1589
- console.log(`\u274C Could not fix build after ${result.attempts} attempt(s).`);
1590
- console.log(` Model: ${result.modelUsed || "unknown"}`);
1591
- if (result.promptTokens !== void 0 && result.completionTokens !== void 0) {
1592
- console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
1593
- }
1594
- if (result.error) console.log(` ${result.error}`);
1570
+ try {
1571
+ const cwd = import_path.default.resolve(opts.path);
1572
+ const maxAttempts = parseInt(opts.maxAttempts, 10);
1573
+ const dryRun = opts.dryRun;
1574
+ const framework = (0, import_core.detectFramework)(cwd);
1595
1575
  console.log(`
1576
+ \u{1F916} BugZero Fix`);
1577
+ console.log(` Path: ${cwd}`);
1578
+ console.log(` Framework: ${framework}`);
1579
+ console.log(` Max attempts: ${maxAttempts}`);
1580
+ if (dryRun) console.log(` Mode: DRY RUN (no files will be modified)`);
1581
+ console.log();
1582
+ const result = await (0, import_core.orchestrateAndFix)({ cwd, maxAttempts, dryRun });
1583
+ console.log("\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1584
+ if (result.success) {
1585
+ console.log(`\u2705 Build fixed after ${result.attempts} attempt(s)!`);
1586
+ console.log(` Model: ${result.modelUsed || "unknown"}`);
1587
+ if (result.promptTokens !== void 0 && result.completionTokens !== void 0) {
1588
+ console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
1589
+ }
1590
+ if (result.appliedFix) {
1591
+ console.log(` File: ${result.appliedFix.filePath}`);
1592
+ console.log(` Reason: ${result.appliedFix.explanation}`);
1593
+ console.log(` Root cause: ${result.appliedFix.rootCause}`);
1594
+ }
1595
+ } else {
1596
+ console.log(`\u274C Could not fix build after ${result.attempts} attempt(s).`);
1597
+ console.log(` Model: ${result.modelUsed || "unknown"}`);
1598
+ if (result.promptTokens !== void 0 && result.completionTokens !== void 0) {
1599
+ console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
1600
+ }
1601
+ if (result.error) console.log(` ${result.error}`);
1602
+ console.log(`
1596
1603
  \u{1F449} Full unresolved error logs have been listed in the generated report.`);
1604
+ }
1605
+ console.log();
1606
+ process.exit(result.success ? 0 : 1);
1607
+ } catch (error) {
1608
+ console.error(`
1609
+ \u274C [BugZero] Execution failed: ${error.message || error}`);
1610
+ process.exit(1);
1597
1611
  }
1598
- console.log();
1599
- process.exit(result.success ? 0 : 1);
1600
1612
  });
1601
1613
  program.command("protect").description("[Deprecated] Use 'hunt' instead").action(async () => {
1602
1614
  console.warn("\u26A0\uFE0F 'protect' is deprecated \u2014 use 'bugzero hunt' instead.\n");
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "bugzero",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
+ "license": "MIT",
4
5
  "bin": {
5
6
  "bugzero": "dist/index.js"
6
7
  },
package/src/index.ts CHANGED
@@ -19,24 +19,29 @@ program
19
19
  .description("Run build, lint, and tests — report issues without modifying files")
20
20
  .option("-p, --path <dir>", "Path to the target project", ".")
21
21
  .action(async (opts) => {
22
- const cwd = path.resolve(opts.path);
23
- const framework = detectFramework(cwd);
24
-
25
- console.log(`\n🔍 BugZero — Analyzing project`);
26
- console.log(` Path: ${cwd}`);
27
- console.log(` Framework: ${framework}\n`);
28
-
29
- const { build, lint, test } = await orchestrate({ cwd });
30
-
31
- console.log("── Pipeline Summary ───────────────────────────");
32
- console.log(` Build: ${build.success ? "✅ Passed" : "❌ Failed (see report)"}`);
33
- console.log(` Lint: ${lint.success ? "✅ Passed" : "❌ Failed (see report)"}`);
34
- console.log(` Tests: ${test.success ? "✅ Passed" : "❌ Failed (see report)"}`);
35
- console.log("───────────────────────────────────────────────");
36
-
37
- const allPassed = build.success && lint.success && test.success;
38
- console.log(`\n${allPassed ? "✅ All checks passed" : "❌ Issues found — run 'bugzero rescue' to repair"}\n`);
39
- process.exit(allPassed ? 0 : 1);
22
+ try {
23
+ const cwd = path.resolve(opts.path);
24
+ const framework = detectFramework(cwd);
25
+
26
+ console.log(`\n🔍 BugZero — Analyzing project`);
27
+ console.log(` Path: ${cwd}`);
28
+ console.log(` Framework: ${framework}\n`);
29
+
30
+ const { build, lint, test } = await orchestrate({ cwd });
31
+
32
+ console.log("── Pipeline Summary ───────────────────────────");
33
+ console.log(` Build: ${build.success ? "✅ Passed" : "❌ Failed (see report)"}`);
34
+ console.log(` Lint: ${lint.success ? "✅ Passed" : "❌ Failed (see report)"}`);
35
+ console.log(` Tests: ${test.success ? "✅ Passed" : "❌ Failed (see report)"}`);
36
+ console.log("───────────────────────────────────────────────");
37
+
38
+ const allPassed = build.success && lint.success && test.success;
39
+ console.log(`\n${allPassed ? "✅ All checks passed" : "❌ Issues found — run 'bugzero rescue' to repair"}\n`);
40
+ process.exit(allPassed ? 0 : 1);
41
+ } catch (error: any) {
42
+ console.error(`\n❌ [BugZero] Execution failed: ${error.message || error}`);
43
+ process.exit(1);
44
+ }
40
45
  });
41
46
 
42
47
  // ── bugzero rescue ───────────────────────────────────────────────────────────
@@ -47,44 +52,49 @@ program
47
52
  .option("-n, --max-attempts <number>", "Maximum AI fix attempts", "3")
48
53
  .option("--dry-run", "Analyse only — print what would be fixed without writing files", false)
49
54
  .action(async (opts) => {
50
- const cwd = path.resolve(opts.path);
51
- const maxAttempts = parseInt(opts.maxAttempts, 10);
52
- const dryRun: boolean = opts.dryRun;
53
- const framework = detectFramework(cwd);
54
-
55
- console.log(`\n🤖 BugZero Fix`);
56
- console.log(` Path: ${cwd}`);
57
- console.log(` Framework: ${framework}`);
58
- console.log(` Max attempts: ${maxAttempts}`);
59
- if (dryRun) console.log(` Mode: DRY RUN (no files will be modified)`);
60
- console.log();
61
-
62
- const result = await orchestrateAndFix({ cwd, maxAttempts, dryRun });
63
-
64
- console.log("\n──────────────────────────────────────────────");
65
- if (result.success) {
66
- console.log(`✅ Build fixed after ${result.attempts} attempt(s)!`);
67
- console.log(` Model: ${result.modelUsed || "unknown"}`);
68
- if (result.promptTokens !== undefined && result.completionTokens !== undefined) {
69
- console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
70
- }
71
- if (result.appliedFix) {
72
- console.log(` File: ${result.appliedFix.filePath}`);
73
- console.log(` Reason: ${result.appliedFix.explanation}`);
74
- console.log(` Root cause: ${result.appliedFix.rootCause}`);
75
- }
76
- } else {
77
- console.log(`❌ Could not fix build after ${result.attempts} attempt(s).`);
78
- console.log(` Model: ${result.modelUsed || "unknown"}`);
79
- if (result.promptTokens !== undefined && result.completionTokens !== undefined) {
80
- console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
55
+ try {
56
+ const cwd = path.resolve(opts.path);
57
+ const maxAttempts = parseInt(opts.maxAttempts, 10);
58
+ const dryRun: boolean = opts.dryRun;
59
+ const framework = detectFramework(cwd);
60
+
61
+ console.log(`\n🤖 BugZero Fix`);
62
+ console.log(` Path: ${cwd}`);
63
+ console.log(` Framework: ${framework}`);
64
+ console.log(` Max attempts: ${maxAttempts}`);
65
+ if (dryRun) console.log(` Mode: DRY RUN (no files will be modified)`);
66
+ console.log();
67
+
68
+ const result = await orchestrateAndFix({ cwd, maxAttempts, dryRun });
69
+
70
+ console.log("\n──────────────────────────────────────────────");
71
+ if (result.success) {
72
+ console.log(`✅ Build fixed after ${result.attempts} attempt(s)!`);
73
+ console.log(` Model: ${result.modelUsed || "unknown"}`);
74
+ if (result.promptTokens !== undefined && result.completionTokens !== undefined) {
75
+ console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
76
+ }
77
+ if (result.appliedFix) {
78
+ console.log(` File: ${result.appliedFix.filePath}`);
79
+ console.log(` Reason: ${result.appliedFix.explanation}`);
80
+ console.log(` Root cause: ${result.appliedFix.rootCause}`);
81
+ }
82
+ } else {
83
+ console.log(`❌ Could not fix build after ${result.attempts} attempt(s).`);
84
+ console.log(` Model: ${result.modelUsed || "unknown"}`);
85
+ if (result.promptTokens !== undefined && result.completionTokens !== undefined) {
86
+ console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
87
+ }
88
+ if (result.error) console.log(` ${result.error}`);
89
+ console.log(`\n👉 Full unresolved error logs have been listed in the generated report.`);
81
90
  }
82
- if (result.error) console.log(` ${result.error}`);
83
- console.log(`\n👉 Full unresolved error logs have been listed in the generated report.`);
84
- }
85
- console.log();
91
+ console.log();
86
92
 
87
- process.exit(result.success ? 0 : 1);
93
+ process.exit(result.success ? 0 : 1);
94
+ } catch (error: any) {
95
+ console.error(`\n❌ [BugZero] Execution failed: ${error.message || error}`);
96
+ process.exit(1);
97
+ }
88
98
  });
89
99
 
90
100
  // ── bugzero protect (legacy) ────────────────────────────────────────────────