bugzero 0.0.10 → 0.0.12
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/.turbo/turbo-build.log +4 -4
- package/dist/index.js +75 -14
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> bugzero@0.0.
|
|
2
|
+
> bugzero@0.0.12 build D:\WD projects\OpsPilot\packages\cli
|
|
3
3
|
> tsup src/index.ts --format cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
|
-
[32mCJS[39m [1mdist\index.js [22m[
|
|
11
|
-
[32mCJS[39m ⚡️ Build success in
|
|
10
|
+
[32mCJS[39m [1mdist\index.js [22m[32m49.97 KB[39m
|
|
11
|
+
[32mCJS[39m ⚡️ Build success in 105ms
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mDTS[39m ⚡️ Build success in
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 1226ms
|
|
14
14
|
[32mDTS[39m [1mdist\index.d.ts [22m[32m20.00 B[39m
|
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
|
|
|
@@ -861,18 +906,34 @@ var require_dist6 = __commonJS({
|
|
|
861
906
|
const result = (0, import_patcher.applyPatch)(absolutePath, search, replace);
|
|
862
907
|
if (!result.success) {
|
|
863
908
|
console.error(`[BugZero] Patch failed: ${result.error}`);
|
|
909
|
+
const updatedLogs = `${state.logs}
|
|
910
|
+
|
|
911
|
+
\u26A0\uFE0F [BugZero System Warning] Your previous patch suggestion for "${filePath}" failed with the following error:
|
|
912
|
+
- ${result.error}
|
|
913
|
+
|
|
914
|
+
Please check if the file path is correct relative to the project root and make sure you target the correct file that contains the build error.`;
|
|
915
|
+
return {
|
|
916
|
+
logs: updatedLogs
|
|
917
|
+
};
|
|
864
918
|
} else {
|
|
865
919
|
console.log(`[BugZero] Backup saved to: ${result.backupPath}`);
|
|
866
920
|
}
|
|
867
921
|
return {};
|
|
868
922
|
}
|
|
869
923
|
async function verifyNode(state) {
|
|
870
|
-
|
|
871
|
-
|
|
924
|
+
if (state.logs.includes("[BugZero System Warning]")) {
|
|
925
|
+
console.log("[BugZero] Skipping validation pipeline because the patch failed to apply.");
|
|
926
|
+
return {
|
|
927
|
+
success: false,
|
|
928
|
+
logs: state.logs
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
console.log("[BugZero] Re-running validation pipeline to verify fix\u2026");
|
|
932
|
+
const result = await (0, import_analyzers.runValidationPipeline)(state.cwd);
|
|
872
933
|
if (result.success) {
|
|
873
|
-
console.log("[BugZero] \u2705
|
|
934
|
+
console.log("[BugZero] \u2705 Validation succeeded!");
|
|
874
935
|
} else {
|
|
875
|
-
console.log(
|
|
936
|
+
console.log(`[BugZero] \u274C Validation failed at step "${result.step}". New error output captured.`);
|
|
876
937
|
}
|
|
877
938
|
return {
|
|
878
939
|
success: result.success,
|
|
@@ -972,26 +1033,26 @@ var require_dist7 = __commonJS({
|
|
|
972
1033
|
async function orchestrateAndFix2(options = {}) {
|
|
973
1034
|
const cwd = options.cwd ?? process.cwd();
|
|
974
1035
|
const maxAttempts = options.maxAttempts ?? 3;
|
|
975
|
-
console.log(`[BugZero] Running
|
|
976
|
-
const
|
|
977
|
-
if (
|
|
978
|
-
console.log("[BugZero]
|
|
979
|
-
return { success: true, attempts: 0, finalOutput:
|
|
1036
|
+
console.log(`[BugZero] Running validation pipeline in: ${cwd}`);
|
|
1037
|
+
const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd);
|
|
1038
|
+
if (pipelineResult.success) {
|
|
1039
|
+
console.log("[BugZero] Validation already passing \u2014 nothing to fix.");
|
|
1040
|
+
return { success: true, attempts: 0, finalOutput: "" };
|
|
980
1041
|
}
|
|
981
|
-
const errors = (0, import_analyzers.parseErrors)(
|
|
1042
|
+
const errors = (0, import_analyzers.parseErrors)(pipelineResult.output);
|
|
982
1043
|
console.log(`[BugZero] Detected ${errors.length} error(s) (type: ${errors[0]?.type ?? "unknown"})`);
|
|
983
1044
|
if (options.dryRun) {
|
|
984
1045
|
console.log("[BugZero] Dry-run mode \u2014 skipping AI fix.");
|
|
985
1046
|
return {
|
|
986
1047
|
success: false,
|
|
987
1048
|
attempts: 0,
|
|
988
|
-
finalOutput:
|
|
1049
|
+
finalOutput: pipelineResult.output,
|
|
989
1050
|
error: "Dry-run: analysis complete, no files modified."
|
|
990
1051
|
};
|
|
991
1052
|
}
|
|
992
1053
|
const finalState = await import_agents.workflow.invoke({
|
|
993
1054
|
cwd,
|
|
994
|
-
logs:
|
|
1055
|
+
logs: pipelineResult.output,
|
|
995
1056
|
maxAttempts,
|
|
996
1057
|
attempts: 0,
|
|
997
1058
|
success: false
|
|
@@ -999,7 +1060,7 @@ var require_dist7 = __commonJS({
|
|
|
999
1060
|
return {
|
|
1000
1061
|
success: finalState.success,
|
|
1001
1062
|
attempts: finalState.attempts,
|
|
1002
|
-
finalOutput: finalState.logs ||
|
|
1063
|
+
finalOutput: finalState.logs || pipelineResult.output,
|
|
1003
1064
|
appliedFix: finalState.fixSuggestion ?? void 0,
|
|
1004
1065
|
error: finalState.success ? void 0 : `Max attempts (${maxAttempts}) reached without a successful build.`
|
|
1005
1066
|
};
|