bugzero 0.0.46 → 0.0.47
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 +1 -0
- package/dist/index.js +112 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,6 +100,7 @@ bugzero rescue
|
|
|
100
100
|
### Safety
|
|
101
101
|
|
|
102
102
|
- **Backups on every patch.** Each file BugZero modifies gets a `.opspilot.bak` copy of its original content first.
|
|
103
|
+
- **Project boundary.** BugZero only reads and edits files inside the project you point it at. A patch whose path leaves the project (with `../`, an absolute path elsewhere, or a symlink or junction that points out) is refused before any file changes, and the model is told why. Files outside the project are never added to what is sent to the model, even if an error log mentions them.
|
|
103
104
|
- **Dry-run mode.** `bugzero rescue --dry-run` runs validation and error analysis, but makes no fix attempts and never modifies your source files (it still writes a report that diagnoses the failures it found). It exits with code 1 if it found failures and 0 if everything already passes, so you can use it as a check in scripts.
|
|
104
105
|
- **Prompt size limits.** Very long error output and very large source files are shortened before being sent to the model (for logs, the start and end are kept), so a big failure can't exceed the model's context window or waste tokens.
|
|
105
106
|
- **Command timeouts.** `--timeout <seconds>` (available on both `hunt` and `rescue`) stops any build, lint, or test command that runs longer than that. It kills the whole process tree rather than just the shell, so a hung test run cannot linger in the background, and the step is reported as failed along with whatever output it produced. Without it, a command that hangs will hang BugZero too, so it is worth setting in CI.
|
package/dist/index.js
CHANGED
|
@@ -817,8 +817,94 @@ var require_dist3 = __commonJS({
|
|
|
817
817
|
}
|
|
818
818
|
});
|
|
819
819
|
|
|
820
|
-
// ../../packages/
|
|
820
|
+
// ../../packages/shared/dist/index.js
|
|
821
821
|
var require_dist4 = __commonJS({
|
|
822
|
+
"../../packages/shared/dist/index.js"(exports2, module2) {
|
|
823
|
+
"use strict";
|
|
824
|
+
var __create2 = Object.create;
|
|
825
|
+
var __defProp2 = Object.defineProperty;
|
|
826
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
827
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
828
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
829
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
830
|
+
var __export = (target, all) => {
|
|
831
|
+
for (var name in all)
|
|
832
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
833
|
+
};
|
|
834
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
835
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
836
|
+
for (let key of __getOwnPropNames2(from))
|
|
837
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
838
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
839
|
+
}
|
|
840
|
+
return to;
|
|
841
|
+
};
|
|
842
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
843
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
844
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
845
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
846
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
847
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
848
|
+
mod
|
|
849
|
+
));
|
|
850
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
851
|
+
var index_exports = {};
|
|
852
|
+
__export(index_exports, {
|
|
853
|
+
isInsideDirectory: () => isInsideDirectory,
|
|
854
|
+
isLexicallyInside: () => isLexicallyInside,
|
|
855
|
+
resolveInsideProject: () => resolveInsideProject,
|
|
856
|
+
uniqueFilePaths: () => uniqueFilePaths3
|
|
857
|
+
});
|
|
858
|
+
module2.exports = __toCommonJS(index_exports);
|
|
859
|
+
function uniqueFilePaths3(patches) {
|
|
860
|
+
return [...new Set(patches.map((patch) => patch.filePath))];
|
|
861
|
+
}
|
|
862
|
+
var import_fs2 = __toESM2(require("fs"));
|
|
863
|
+
var import_path2 = __toESM2(require("path"));
|
|
864
|
+
function isLexicallyInside(root, target) {
|
|
865
|
+
const relative = import_path2.default.relative(import_path2.default.resolve(root), import_path2.default.resolve(target));
|
|
866
|
+
const escapes = relative === ".." || relative.startsWith(`..${import_path2.default.sep}`) || import_path2.default.isAbsolute(relative);
|
|
867
|
+
return !escapes;
|
|
868
|
+
}
|
|
869
|
+
function isInsideDirectory(root, target) {
|
|
870
|
+
const absoluteTarget = import_path2.default.resolve(target);
|
|
871
|
+
if (!isLexicallyInside(root, absoluteTarget)) return false;
|
|
872
|
+
try {
|
|
873
|
+
let probe = absoluteTarget;
|
|
874
|
+
while (!import_fs2.default.existsSync(probe)) {
|
|
875
|
+
const parent = import_path2.default.dirname(probe);
|
|
876
|
+
if (parent === probe) return false;
|
|
877
|
+
probe = parent;
|
|
878
|
+
}
|
|
879
|
+
return isLexicallyInside(import_fs2.default.realpathSync.native(root), import_fs2.default.realpathSync.native(probe));
|
|
880
|
+
} catch {
|
|
881
|
+
return false;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function resolveInsideProject(cwd, filePath) {
|
|
885
|
+
if (typeof filePath !== "string" || filePath.trim() === "") {
|
|
886
|
+
return { ok: false, error: "The file path is empty. Use a path relative to the project root." };
|
|
887
|
+
}
|
|
888
|
+
if (filePath.includes("\0")) {
|
|
889
|
+
return { ok: false, error: "The file path contains a null character." };
|
|
890
|
+
}
|
|
891
|
+
const absolutePath = import_path2.default.resolve(cwd, filePath);
|
|
892
|
+
if (import_path2.default.resolve(cwd) === absolutePath) {
|
|
893
|
+
return { ok: false, error: `"${filePath}" is the project directory itself, not a file.` };
|
|
894
|
+
}
|
|
895
|
+
if (!isInsideDirectory(cwd, absolutePath)) {
|
|
896
|
+
return {
|
|
897
|
+
ok: false,
|
|
898
|
+
error: `"${filePath}" is outside the project directory. Use a path relative to the project root.`
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
return { ok: true, absolutePath };
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
// ../../packages/prompts/dist/index.js
|
|
907
|
+
var require_dist5 = __commonJS({
|
|
822
908
|
"../../packages/prompts/dist/index.js"(exports2, module2) {
|
|
823
909
|
"use strict";
|
|
824
910
|
var __create2 = Object.create;
|
|
@@ -854,6 +940,7 @@ var require_dist4 = __commonJS({
|
|
|
854
940
|
truncateLogs: () => truncateLogs
|
|
855
941
|
});
|
|
856
942
|
module2.exports = __toCommonJS(index_exports);
|
|
943
|
+
var import_shared3 = require_dist4();
|
|
857
944
|
var import_fs2 = __toESM2(require("fs"));
|
|
858
945
|
var import_path2 = __toESM2(require("path"));
|
|
859
946
|
var MAX_LOG_CHARS = 2e4;
|
|
@@ -919,7 +1006,7 @@ ${tail}`;
|
|
|
919
1006
|
for (const candidate of candidates) {
|
|
920
1007
|
const absPathCandidate = import_path2.default.isAbsolute(candidate) ? candidate : import_path2.default.resolve(cwd, candidate);
|
|
921
1008
|
const resolved = resolveExistingPathPrefix(absPathCandidate);
|
|
922
|
-
if (resolved) {
|
|
1009
|
+
if (resolved && (0, import_shared3.isInsideDirectory)(cwd, resolved)) {
|
|
923
1010
|
resolvedPaths.add(import_path2.default.resolve(resolved));
|
|
924
1011
|
}
|
|
925
1012
|
}
|
|
@@ -1065,7 +1152,7 @@ Critical rules:
|
|
|
1065
1152
|
});
|
|
1066
1153
|
|
|
1067
1154
|
// ../../packages/patcher/dist/index.js
|
|
1068
|
-
var
|
|
1155
|
+
var require_dist6 = __commonJS({
|
|
1069
1156
|
"../../packages/patcher/dist/index.js"(exports2, module2) {
|
|
1070
1157
|
"use strict";
|
|
1071
1158
|
var __create2 = Object.create;
|
|
@@ -1229,8 +1316,8 @@ var require_dist5 = __commonJS({
|
|
|
1229
1316
|
return { success: false, error: err.message };
|
|
1230
1317
|
}
|
|
1231
1318
|
}
|
|
1319
|
+
var import_shared3 = require_dist4();
|
|
1232
1320
|
var import_fs22 = __toESM2(require("fs"));
|
|
1233
|
-
var import_path22 = __toESM2(require("path"));
|
|
1234
1321
|
function rollback(originalContent, backupPaths) {
|
|
1235
1322
|
for (const [absolutePath, content] of originalContent) {
|
|
1236
1323
|
try {
|
|
@@ -1249,11 +1336,23 @@ var require_dist5 = __commonJS({
|
|
|
1249
1336
|
if (patches.length === 0) {
|
|
1250
1337
|
return { success: false, error: "No patches to apply.", applied: [] };
|
|
1251
1338
|
}
|
|
1339
|
+
const absolutePaths = [];
|
|
1340
|
+
for (const patch of patches) {
|
|
1341
|
+
const resolved = (0, import_shared3.resolveInsideProject)(cwd, patch.filePath);
|
|
1342
|
+
if (!resolved.ok) {
|
|
1343
|
+
return {
|
|
1344
|
+
success: false,
|
|
1345
|
+
error: `Failed to patch "${patch.filePath}": ${resolved.error}`,
|
|
1346
|
+
applied: []
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
absolutePaths.push(resolved.absolutePath);
|
|
1350
|
+
}
|
|
1252
1351
|
const originalContent = /* @__PURE__ */ new Map();
|
|
1253
1352
|
const backupPaths = /* @__PURE__ */ new Set();
|
|
1254
1353
|
const applied = [];
|
|
1255
|
-
for (const patch of patches) {
|
|
1256
|
-
const absolutePath =
|
|
1354
|
+
for (const [index, patch] of patches.entries()) {
|
|
1355
|
+
const absolutePath = absolutePaths[index];
|
|
1257
1356
|
if (!originalContent.has(absolutePath)) {
|
|
1258
1357
|
try {
|
|
1259
1358
|
originalContent.set(absolutePath, import_fs22.default.readFileSync(absolutePath, "utf-8"));
|
|
@@ -1289,7 +1388,7 @@ var require_dist5 = __commonJS({
|
|
|
1289
1388
|
});
|
|
1290
1389
|
|
|
1291
1390
|
// ../../packages/agents/dist/index.js
|
|
1292
|
-
var
|
|
1391
|
+
var require_dist7 = __commonJS({
|
|
1293
1392
|
"../../packages/agents/dist/index.js"(exports2, module2) {
|
|
1294
1393
|
"use strict";
|
|
1295
1394
|
var __defProp2 = Object.defineProperty;
|
|
@@ -1398,8 +1497,8 @@ var require_dist6 = __commonJS({
|
|
|
1398
1497
|
})
|
|
1399
1498
|
});
|
|
1400
1499
|
var import_ai_provider = require_dist3();
|
|
1401
|
-
var import_prompts =
|
|
1402
|
-
var import_patcher =
|
|
1500
|
+
var import_prompts = require_dist5();
|
|
1501
|
+
var import_patcher = require_dist6();
|
|
1403
1502
|
var import_analyzers = require_dist2();
|
|
1404
1503
|
var provider = new import_ai_provider.OpenRouterProvider();
|
|
1405
1504
|
async function analyzeNode(state) {
|
|
@@ -1507,38 +1606,6 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
1507
1606
|
}
|
|
1508
1607
|
});
|
|
1509
1608
|
|
|
1510
|
-
// ../../packages/shared/dist/index.js
|
|
1511
|
-
var require_dist7 = __commonJS({
|
|
1512
|
-
"../../packages/shared/dist/index.js"(exports2, module2) {
|
|
1513
|
-
"use strict";
|
|
1514
|
-
var __defProp2 = Object.defineProperty;
|
|
1515
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1516
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1517
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1518
|
-
var __export = (target, all) => {
|
|
1519
|
-
for (var name in all)
|
|
1520
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
1521
|
-
};
|
|
1522
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
1523
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
1524
|
-
for (let key of __getOwnPropNames2(from))
|
|
1525
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
1526
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1527
|
-
}
|
|
1528
|
-
return to;
|
|
1529
|
-
};
|
|
1530
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1531
|
-
var index_exports = {};
|
|
1532
|
-
__export(index_exports, {
|
|
1533
|
-
uniqueFilePaths: () => uniqueFilePaths3
|
|
1534
|
-
});
|
|
1535
|
-
module2.exports = __toCommonJS(index_exports);
|
|
1536
|
-
function uniqueFilePaths3(patches) {
|
|
1537
|
-
return [...new Set(patches.map((patch) => patch.filePath))];
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
});
|
|
1541
|
-
|
|
1542
1609
|
// ../../packages/core/dist/index.js
|
|
1543
1610
|
var require_dist8 = __commonJS({
|
|
1544
1611
|
"../../packages/core/dist/index.js"(exports2, module2) {
|
|
@@ -1610,8 +1677,8 @@ var require_dist8 = __commonJS({
|
|
|
1610
1677
|
return "unknown";
|
|
1611
1678
|
}
|
|
1612
1679
|
var import_analyzers = require_dist2();
|
|
1613
|
-
var import_agents =
|
|
1614
|
-
var import_shared3 =
|
|
1680
|
+
var import_agents = require_dist7();
|
|
1681
|
+
var import_shared3 = require_dist4();
|
|
1615
1682
|
var import_fs3 = __toESM2(require("fs"));
|
|
1616
1683
|
var import_path3 = __toESM2(require("path"));
|
|
1617
1684
|
var import_url = require("url");
|
|
@@ -2012,7 +2079,7 @@ var import_path = __toESM(require("path"));
|
|
|
2012
2079
|
var import_core = __toESM(require_dist8());
|
|
2013
2080
|
|
|
2014
2081
|
// src/json-output.ts
|
|
2015
|
-
var import_shared = __toESM(
|
|
2082
|
+
var import_shared = __toESM(require_dist4());
|
|
2016
2083
|
function stepStatus(step) {
|
|
2017
2084
|
if (step.skipped) return "skipped";
|
|
2018
2085
|
return step.success ? "passed" : "failed";
|
|
@@ -2069,7 +2136,7 @@ function buildErrorJson(message) {
|
|
|
2069
2136
|
}
|
|
2070
2137
|
|
|
2071
2138
|
// src/summary.ts
|
|
2072
|
-
var import_shared2 = __toESM(
|
|
2139
|
+
var import_shared2 = __toESM(require_dist4());
|
|
2073
2140
|
function tokenLines(result) {
|
|
2074
2141
|
if (result.promptTokens === void 0 || result.completionTokens === void 0) return [];
|
|
2075
2142
|
const total = result.promptTokens + result.completionTokens;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugzero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
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)",
|