bugzero 0.0.67 → 0.0.69
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 +20 -1
- package/dist/index.js +192 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ bugzero rescue
|
|
|
111
111
|
- **Framework detection.** Identifies Next.js, NestJS, Vite, Remix, Astro, SvelteKit, Nuxt, Angular, Create React App, or a plain TypeScript project from its config files and dependencies, and shows the result in the run banner.
|
|
112
112
|
- **Package manager detection.** Runs build, lint, and test with the tool your project actually uses — npm, pnpm, yarn, or bun. It checks the `packageManager` field in `package.json` first, then `pnpm-workspace.yaml` or a lockfile, and falls back to npm.
|
|
113
113
|
- **Script-aware validation.** Only runs the build, lint, and test scripts your `package.json` actually defines. A missing script is reported as skipped rather than failed, so a project without a `lint` script no longer shows a false lint failure. You can also give any step [your own command](#your-own-commands). Pointing `--path` at a directory with no `package.json` stops immediately with a clear error, unless `.bugzerorc` gives it [a command to run](#your-own-commands).
|
|
114
|
-
- **Error parsing.** Recognizes TypeScript compiler errors (file, line, column, message), ESLint errors,
|
|
114
|
+
- **Error parsing.** Recognizes TypeScript compiler errors (file, line, column, message), ESLint errors, Jest failures, pytest failures and Go compiler and test errors to classify what broke and how many errors were found. Output in any other format is still passed to the model as raw logs.
|
|
115
115
|
|
|
116
116
|
### Integrations and output
|
|
117
117
|
|
|
@@ -373,6 +373,25 @@ To run something other than your `package.json` scripts, add `commands`:
|
|
|
373
373
|
|
|
374
374
|
These commands run on your machine exactly as written, so, as with `package.json` scripts, only run BugZero on projects you trust.
|
|
375
375
|
|
|
376
|
+
### Python projects
|
|
377
|
+
|
|
378
|
+
A folder with a `pyproject.toml`, `setup.py`, `setup.cfg`, `requirements.txt` (or `requirements-dev.txt` and the like), `Pipfile`, `pytest.ini` or `tox.ini` and no `package.json` is a Python project. BugZero shows it as `python`, and with no settings at all it runs your tests with `python -m pytest`, as long as the project clearly uses pytest (a `pytest.ini`, a `conftest.py`, a pytest section in its config, or pytest in its requirements) and pytest can really be run.
|
|
379
|
+
|
|
380
|
+
- The Python used is the project's own `.venv` or `venv` folder if it has one, otherwise `python3` (on Windows, `python`, then `py`).
|
|
381
|
+
- Nothing else is run by default. For a build or lint step, add `commands`, for example `{"commands": {"build": "mypy .", "lint": "ruff check ."}}`. A `test` command of your own replaces the default, and `"test": false` turns it off.
|
|
382
|
+
- If pytest is set up but cannot be run (it is not installed), BugZero stops and says so, rather than asking the model to fix a missing install.
|
|
383
|
+
- A folder that also has a `package.json` is treated as a Node.js project, as before.
|
|
384
|
+
- pytest output is understood: each failed test, and each file that could not be imported, counts as one error. That lets BugZero stop early when attempts are not getting anywhere. Re-running only the failing test files between attempts is still for Jest and Vitest.
|
|
385
|
+
|
|
386
|
+
### Go projects
|
|
387
|
+
|
|
388
|
+
A folder with a `go.mod` (or `go.work`) and no `package.json` is a Go project. BugZero shows it as `go`, and with no settings at all it builds it with `go build ./...` and tests it with `go test ./...`.
|
|
389
|
+
|
|
390
|
+
- There is no default lint step. To add one, set `commands`, for example `{"commands": {"lint": "go vet ./..."}}`. A command of your own replaces the default for that step, and `false` turns it off.
|
|
391
|
+
- If Go cannot be run (it is not installed, or not on your `PATH`), BugZero stops and says so.
|
|
392
|
+
- A folder that also has a `go.mod` and Python files is treated as Go. A folder that also has a `package.json` is treated as Node.js, as before.
|
|
393
|
+
- `go build`, `go vet` and `go test` output is understood: each compiler error counts as one error, and so does each failed test, so BugZero can tell when attempts are not getting anywhere and stop early.
|
|
394
|
+
|
|
376
395
|
---
|
|
377
396
|
|
|
378
397
|
## Reports
|
package/dist/index.js
CHANGED
|
@@ -1385,11 +1385,17 @@ var require_dist4 = __commonJS({
|
|
|
1385
1385
|
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1386
1386
|
var index_exports = {};
|
|
1387
1387
|
__export(index_exports, {
|
|
1388
|
+
defaultGoCommands: () => defaultGoCommands,
|
|
1389
|
+
defaultProjectCommands: () => defaultProjectCommands,
|
|
1390
|
+
defaultPythonCommands: () => defaultPythonCommands,
|
|
1388
1391
|
detectPackageManager: () => detectPackageManager2,
|
|
1389
1392
|
detectTestRunner: () => detectTestRunner,
|
|
1390
1393
|
findFailingTestFiles: () => findFailingTestFiles,
|
|
1394
|
+
findPython: () => findPython,
|
|
1391
1395
|
getRunScriptCommand: () => getRunScriptCommand,
|
|
1392
1396
|
hasPackageJson: () => hasPackageJson,
|
|
1397
|
+
isGoProject: () => isGoProject,
|
|
1398
|
+
isPythonProject: () => isPythonProject,
|
|
1393
1399
|
parseErrors: () => parseErrors,
|
|
1394
1400
|
planFocusedTests: () => planFocusedTests,
|
|
1395
1401
|
readScriptText: () => readScriptText,
|
|
@@ -1402,7 +1408,8 @@ var require_dist4 = __commonJS({
|
|
|
1402
1408
|
runStep: () => runStep,
|
|
1403
1409
|
runTests: () => runTests,
|
|
1404
1410
|
runValidationPipeline: () => runValidationPipeline,
|
|
1405
|
-
usableFocusedResult: () => usableFocusedResult
|
|
1411
|
+
usableFocusedResult: () => usableFocusedResult,
|
|
1412
|
+
usesPytest: () => usesPytest
|
|
1406
1413
|
});
|
|
1407
1414
|
module2.exports = __toCommonJS(index_exports);
|
|
1408
1415
|
var import_fs2 = __toESM2(require("fs"));
|
|
@@ -1547,6 +1554,12 @@ var require_dist4 = __commonJS({
|
|
|
1547
1554
|
var ESLINT_ERROR_RE = /^\s+(\d+):(\d+)\s+error\s+(.+)$/gm;
|
|
1548
1555
|
var JEST_FAIL_RE = /● (.+)/g;
|
|
1549
1556
|
var JEST_FILE_RE = /FAIL\s+([\w/\\.\-]+)/g;
|
|
1557
|
+
var PYTEST_LINE_RE = /^(?:FAILED|ERROR)[ \t]+(\S+?\.py)(?:::(.+?))?(?:[ \t]+-[ \t]+(.*))?$/gm;
|
|
1558
|
+
var GO_COMPILE_RE = /^(?:vet: )?(?:\.[\\/])?([^\s:]+\.go):(\d+):(\d+): (.+)$/gm;
|
|
1559
|
+
var GO_TEST_FAIL_RE = /^--- FAIL: (\S+) \([\d.]+s\)$/;
|
|
1560
|
+
var GO_TEST_DETAIL_RE = /^\s+([^\s:]+\.go):(\d+): (.*)$/;
|
|
1561
|
+
var GO_OUTPUT_END_RE = /^(?:--- |=== |FAIL|ok\s|PASS|\?\s)/;
|
|
1562
|
+
var ANSI_RE = /\u001b\[[0-9;]*[A-Za-z]/g;
|
|
1550
1563
|
function parseErrors(rawOutput) {
|
|
1551
1564
|
const output = rawOutput.replace(/\r\n/g, "\n");
|
|
1552
1565
|
const errors = [];
|
|
@@ -1584,6 +1597,48 @@ var require_dist4 = __commonJS({
|
|
|
1584
1597
|
});
|
|
1585
1598
|
}
|
|
1586
1599
|
if (errors.length > 0) return errors;
|
|
1600
|
+
for (const m of output.replace(ANSI_RE, "").matchAll(PYTEST_LINE_RE)) {
|
|
1601
|
+
const [raw, file, test, reason] = m;
|
|
1602
|
+
errors.push({
|
|
1603
|
+
type: "pytest",
|
|
1604
|
+
file,
|
|
1605
|
+
message: `${test ?? file}${reason ? ` - ${reason.trim()}` : ""}`,
|
|
1606
|
+
raw
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
if (errors.length > 0) return errors;
|
|
1610
|
+
for (const m of output.matchAll(GO_COMPILE_RE)) {
|
|
1611
|
+
errors.push({
|
|
1612
|
+
type: "go",
|
|
1613
|
+
file: m[1],
|
|
1614
|
+
line: parseInt(m[2], 10),
|
|
1615
|
+
column: parseInt(m[3], 10),
|
|
1616
|
+
message: m[4].trim(),
|
|
1617
|
+
raw: m[0]
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
if (errors.length > 0) return errors;
|
|
1621
|
+
const lines = output.split("\n");
|
|
1622
|
+
for (const [index, line] of lines.entries()) {
|
|
1623
|
+
const failed = line.match(GO_TEST_FAIL_RE);
|
|
1624
|
+
if (!failed) continue;
|
|
1625
|
+
let detail = null;
|
|
1626
|
+
let panic;
|
|
1627
|
+
for (const next of lines.slice(index + 1, index + 40)) {
|
|
1628
|
+
if (GO_OUTPUT_END_RE.test(next)) break;
|
|
1629
|
+
detail ??= next.match(GO_TEST_DETAIL_RE);
|
|
1630
|
+
if (panic === void 0 && next.startsWith("panic: ")) panic = next.trim();
|
|
1631
|
+
}
|
|
1632
|
+
const reason = detail ? detail[3].trim() : panic;
|
|
1633
|
+
errors.push({
|
|
1634
|
+
type: "go",
|
|
1635
|
+
file: detail?.[1],
|
|
1636
|
+
line: detail ? parseInt(detail[2], 10) : void 0,
|
|
1637
|
+
message: reason ? `${failed[1]}: ${reason}` : failed[1],
|
|
1638
|
+
raw: line
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
if (errors.length > 0) return errors;
|
|
1587
1642
|
if (output.trim()) {
|
|
1588
1643
|
errors.push({
|
|
1589
1644
|
type: "unknown",
|
|
@@ -1634,7 +1689,7 @@ var require_dist4 = __commonJS({
|
|
|
1634
1689
|
var import_fs32 = __toESM2(require("fs"));
|
|
1635
1690
|
var import_shared4 = require_dist2();
|
|
1636
1691
|
var MAX_FOCUSED_FILES = 10;
|
|
1637
|
-
var
|
|
1692
|
+
var ANSI_RE2 = /\u001b\[[0-9;]*[A-Za-z]/g;
|
|
1638
1693
|
var FAIL_LINE_RE = /^[ \t]*FAIL[ \t]+(?:\|[^|\n]*\|[ \t]+)?(\S+)/gm;
|
|
1639
1694
|
var TEST_FILE_RE = /\.(test|spec)\.[cm]?[jt]sx?$|(^|\/)__tests__\//;
|
|
1640
1695
|
var SAFE_PATH_RE = /^[A-Za-z0-9_@.+/-]+$/;
|
|
@@ -1649,7 +1704,7 @@ var require_dist4 = __commonJS({
|
|
|
1649
1704
|
return names.size === 1 ? [...names][0] : null;
|
|
1650
1705
|
}
|
|
1651
1706
|
function findFailingTestFiles(cwd, output) {
|
|
1652
|
-
const text = output.replace(
|
|
1707
|
+
const text = output.replace(ANSI_RE2, "").replace(/\r\n/g, "\n");
|
|
1653
1708
|
const files = [];
|
|
1654
1709
|
for (const match of text.matchAll(FAIL_LINE_RE)) {
|
|
1655
1710
|
const candidate = match[1].replace(/\\/g, "/").replace(/^\.\//, "");
|
|
@@ -1688,6 +1743,91 @@ var require_dist4 = __commonJS({
|
|
|
1688
1743
|
if (result.timedOut) return true;
|
|
1689
1744
|
return findFailingTestFiles(cwd, result.output).length > 0;
|
|
1690
1745
|
}
|
|
1746
|
+
var import_child_process2 = require("child_process");
|
|
1747
|
+
var import_fs4 = __toESM2(require("fs"));
|
|
1748
|
+
var import_path42 = __toESM2(require("path"));
|
|
1749
|
+
var MARKER_FILES = ["pyproject.toml", "setup.py", "setup.cfg", "Pipfile", "pytest.ini", "tox.ini"];
|
|
1750
|
+
function requirementsFiles(cwd) {
|
|
1751
|
+
try {
|
|
1752
|
+
return import_fs4.default.readdirSync(cwd).filter((name) => /^requirements([-_.].+)?\.txt$/i.test(name));
|
|
1753
|
+
} catch {
|
|
1754
|
+
return [];
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
function isPythonProject(cwd = process.cwd()) {
|
|
1758
|
+
return MARKER_FILES.some((file) => import_fs4.default.existsSync(import_path42.default.join(cwd, file))) || requirementsFiles(cwd).length > 0;
|
|
1759
|
+
}
|
|
1760
|
+
function readText(file) {
|
|
1761
|
+
try {
|
|
1762
|
+
return import_fs4.default.readFileSync(file, "utf-8");
|
|
1763
|
+
} catch {
|
|
1764
|
+
return "";
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
function usesPytest(cwd = process.cwd()) {
|
|
1768
|
+
const exists = (file) => import_fs4.default.existsSync(import_path42.default.join(cwd, file));
|
|
1769
|
+
if (exists("pytest.ini") || exists("conftest.py") || exists("tests/conftest.py") || exists("test/conftest.py")) return true;
|
|
1770
|
+
const pyproject = readText(import_path42.default.join(cwd, "pyproject.toml"));
|
|
1771
|
+
if (/\[tool\.pytest/.test(pyproject) || /["']pytest(?![\w.-])/.test(pyproject) || /^\s*pytest\s*=/m.test(pyproject)) return true;
|
|
1772
|
+
if (/^\[(?:tool:)?pytest\]/m.test(readText(import_path42.default.join(cwd, "setup.cfg")))) return true;
|
|
1773
|
+
if (/^\[(?:tool:)?pytest\]/m.test(readText(import_path42.default.join(cwd, "tox.ini")))) return true;
|
|
1774
|
+
if (/^\s*pytest\s*=/m.test(readText(import_path42.default.join(cwd, "Pipfile")))) return true;
|
|
1775
|
+
return requirementsFiles(cwd).some((name) => /^\s*pytest(?![\w.-])/im.test(readText(import_path42.default.join(cwd, name))));
|
|
1776
|
+
}
|
|
1777
|
+
function runsPytest(python, cwd) {
|
|
1778
|
+
const program2 = /[\\/]/.test(python) ? import_path42.default.resolve(cwd, python) : python;
|
|
1779
|
+
return (0, import_child_process2.spawnSync)(program2, ["-m", "pytest", "--version"], { cwd, stdio: "ignore", timeout: 2e4 }).status === 0;
|
|
1780
|
+
}
|
|
1781
|
+
function runsPython(command) {
|
|
1782
|
+
const result = (0, import_child_process2.spawnSync)(command, ["--version"], { stdio: "ignore", timeout: 5e3 });
|
|
1783
|
+
return result.status === 0;
|
|
1784
|
+
}
|
|
1785
|
+
function findPython(cwd, options = {}) {
|
|
1786
|
+
const platform = options.platform ?? process.platform;
|
|
1787
|
+
const works = options.works ?? runsPython;
|
|
1788
|
+
for (const folder of [".venv", "venv"]) {
|
|
1789
|
+
const interpreter = platform === "win32" ? import_path42.default.join(folder, "Scripts", "python.exe") : import_path42.default.join(folder, "bin", "python");
|
|
1790
|
+
if (import_fs4.default.existsSync(import_path42.default.join(cwd, interpreter))) return interpreter;
|
|
1791
|
+
}
|
|
1792
|
+
return (platform === "win32" ? ["python", "py"] : ["python3", "python"]).find((command) => works(command));
|
|
1793
|
+
}
|
|
1794
|
+
function defaultPythonCommands(cwd, options = {}) {
|
|
1795
|
+
if (hasPackageJson(cwd) || !isPythonProject(cwd) || !usesPytest(cwd)) return void 0;
|
|
1796
|
+
const python = findPython(cwd, options);
|
|
1797
|
+
if (python === void 0 || !(options.pytestWorks ?? runsPytest)(python, cwd)) return void 0;
|
|
1798
|
+
return { test: `${python} -m pytest` };
|
|
1799
|
+
}
|
|
1800
|
+
var import_child_process3 = require("child_process");
|
|
1801
|
+
var import_fs5 = __toESM2(require("fs"));
|
|
1802
|
+
var import_path5 = __toESM2(require("path"));
|
|
1803
|
+
function isGoProject(cwd = process.cwd()) {
|
|
1804
|
+
return ["go.mod", "go.work"].some((file) => import_fs5.default.existsSync(import_path5.default.join(cwd, file)));
|
|
1805
|
+
}
|
|
1806
|
+
function runsGo(command) {
|
|
1807
|
+
return (0, import_child_process3.spawnSync)(command, ["version"], { stdio: "ignore", timeout: 1e4 }).status === 0;
|
|
1808
|
+
}
|
|
1809
|
+
function defaultGoCommands(cwd, options = {}) {
|
|
1810
|
+
if (hasPackageJson(cwd) || !isGoProject(cwd)) return void 0;
|
|
1811
|
+
if (!(options.works ?? runsGo)("go")) return void 0;
|
|
1812
|
+
return { build: "go build ./...", test: "go test ./..." };
|
|
1813
|
+
}
|
|
1814
|
+
function only(commands, steps) {
|
|
1815
|
+
if (commands === void 0) return void 0;
|
|
1816
|
+
const kept = Object.fromEntries(Object.entries(commands).filter(([step]) => steps.includes(step)));
|
|
1817
|
+
return Object.keys(kept).length === 0 ? void 0 : kept;
|
|
1818
|
+
}
|
|
1819
|
+
function defaultProjectCommands(cwd, options = {}) {
|
|
1820
|
+
const steps = options.steps ?? ["build", "lint", "test"];
|
|
1821
|
+
if (steps.includes("build") || steps.includes("test")) {
|
|
1822
|
+
const go = only(defaultGoCommands(cwd, options.go), steps);
|
|
1823
|
+
if (go) return { kind: "Go", commands: go };
|
|
1824
|
+
}
|
|
1825
|
+
if (steps.includes("test")) {
|
|
1826
|
+
const python = only(defaultPythonCommands(cwd, options.python), steps);
|
|
1827
|
+
if (python) return { kind: "Python", commands: python };
|
|
1828
|
+
}
|
|
1829
|
+
return void 0;
|
|
1830
|
+
}
|
|
1691
1831
|
}
|
|
1692
1832
|
});
|
|
1693
1833
|
|
|
@@ -2967,7 +3107,7 @@ var require_dist8 = __commonJS({
|
|
|
2967
3107
|
DEFAULT_PATIENCE: () => DEFAULT_PATIENCE,
|
|
2968
3108
|
REPORT_FILENAME: () => REPORT_FILENAME2,
|
|
2969
3109
|
detectFramework: () => detectFramework2,
|
|
2970
|
-
detectPackageManager: () =>
|
|
3110
|
+
detectPackageManager: () => import_analyzers4.detectPackageManager,
|
|
2971
3111
|
orchestrate: () => orchestrate2,
|
|
2972
3112
|
orchestrateAndFix: () => orchestrateAndFix2,
|
|
2973
3113
|
projectPackageManager: () => projectPackageManager2,
|
|
@@ -2982,6 +3122,7 @@ var require_dist8 = __commonJS({
|
|
|
2982
3122
|
module2.exports = __toCommonJS(index_exports);
|
|
2983
3123
|
var import_fs2 = __toESM2(require("fs"));
|
|
2984
3124
|
var import_path3 = __toESM2(require("path"));
|
|
3125
|
+
var import_analyzers = require_dist4();
|
|
2985
3126
|
function detectFramework2(cwd = process.cwd()) {
|
|
2986
3127
|
const has = (...files) => files.some((f) => import_fs2.default.existsSync(import_path3.default.join(cwd, f)));
|
|
2987
3128
|
if (has("next.config.js", "next.config.ts", "next.config.mjs")) return "nextjs";
|
|
@@ -3005,9 +3146,13 @@ var require_dist8 = __commonJS({
|
|
|
3005
3146
|
}
|
|
3006
3147
|
}
|
|
3007
3148
|
if (has("tsconfig.json")) return "typescript";
|
|
3149
|
+
if (!has("package.json")) {
|
|
3150
|
+
if ((0, import_analyzers.isGoProject)(cwd)) return "go";
|
|
3151
|
+
if ((0, import_analyzers.isPythonProject)(cwd)) return "python";
|
|
3152
|
+
}
|
|
3008
3153
|
return "unknown";
|
|
3009
3154
|
}
|
|
3010
|
-
var
|
|
3155
|
+
var import_analyzers3 = require_dist4();
|
|
3011
3156
|
var import_agents = require_dist7();
|
|
3012
3157
|
var import_shared22 = require_dist2();
|
|
3013
3158
|
var import_fs3 = __toESM2(require("fs"));
|
|
@@ -3208,19 +3353,28 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3208
3353
|
}
|
|
3209
3354
|
return commands;
|
|
3210
3355
|
}
|
|
3211
|
-
var
|
|
3356
|
+
var import_analyzers2 = require_dist4();
|
|
3212
3357
|
var import_fs22 = __toESM2(require("fs"));
|
|
3213
3358
|
var import_path22 = __toESM2(require("path"));
|
|
3214
3359
|
var hasPackageJson = (cwd) => import_fs22.default.existsSync(import_path22.default.join(cwd, "package.json"));
|
|
3215
3360
|
function assertProject(cwd, commands = {}) {
|
|
3216
3361
|
if (hasPackageJson(cwd)) return;
|
|
3217
3362
|
if (Object.values(commands).some((command) => typeof command === "string")) return;
|
|
3363
|
+
if ((0, import_analyzers2.isGoProject)(cwd)) {
|
|
3364
|
+
throw new Error(
|
|
3365
|
+
`No package.json found in ${cwd}. This looks like a Go project, but BugZero could not run the go command (is Go installed and on your PATH?). Install it, or set "commands" in .bugzerorc (see the README).`
|
|
3366
|
+
);
|
|
3367
|
+
}
|
|
3368
|
+
if ((0, import_analyzers2.isPythonProject)(cwd)) {
|
|
3369
|
+
const why = (0, import_analyzers2.usesPytest)(cwd) ? "BugZero found pytest set up but could not run it (is it installed? A .venv or venv folder in the project is used when there is one). Install it, or" : "BugZero found no test setup it knows (pytest). To tell it how to check the project,";
|
|
3370
|
+
throw new Error(`No package.json found in ${cwd}. This looks like a Python project. ${why} set "commands" in .bugzerorc (see the README).`);
|
|
3371
|
+
}
|
|
3218
3372
|
throw new Error(
|
|
3219
3373
|
`No package.json found in ${cwd}. Point --path at a Node.js project, or, to check a project of another kind, set "commands" in .bugzerorc (see the README).`
|
|
3220
3374
|
);
|
|
3221
3375
|
}
|
|
3222
3376
|
function projectPackageManager2(cwd) {
|
|
3223
|
-
return hasPackageJson(cwd) ? (0,
|
|
3377
|
+
return hasPackageJson(cwd) ? (0, import_analyzers2.detectPackageManager)(cwd) : "none";
|
|
3224
3378
|
}
|
|
3225
3379
|
var import_ai_provider = require_dist5();
|
|
3226
3380
|
var REPORT_FILENAME2 = "bugzero-report.md";
|
|
@@ -3236,14 +3390,24 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3236
3390
|
const base = stoppedAfter !== void 0 ? `Stopped early: ${stoppedAfter} attempt${stoppedAfter === 1 ? "" : "s"} in a row made no progress (the errors did not get fewer and no later step was reached), so the remaining attempts were not used. Try a different model with 'bugzero vibe', or use --patience 0 to keep going regardless.` : `Max attempts (${maxAttempts}) reached without a successful build.`;
|
|
3237
3391
|
return declined > 0 ? `${base} You declined ${declined} proposed ${plural}.` : base;
|
|
3238
3392
|
}
|
|
3239
|
-
function projectCommands(configured) {
|
|
3240
|
-
const
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3393
|
+
function projectCommands(cwd, configured) {
|
|
3394
|
+
const own = resolveCommands(configured);
|
|
3395
|
+
const wanted = ["build", "test"].filter((step) => own[step] === void 0);
|
|
3396
|
+
const found = wanted.length === 0 ? void 0 : (0, import_analyzers3.defaultProjectCommands)(cwd, { steps: [...wanted] });
|
|
3397
|
+
const defaults = found?.commands ?? {};
|
|
3398
|
+
const all = { ...defaults, ...own };
|
|
3399
|
+
return { commands: Object.keys(all).length === 0 ? void 0 : all, own, defaults, kind: found?.kind };
|
|
3400
|
+
}
|
|
3401
|
+
function announceCommands({ own, defaults, kind }) {
|
|
3402
|
+
const steps = ["build", "lint", "test"];
|
|
3403
|
+
const listed = steps.filter((step) => own[step] !== void 0).map((step) => `${step}: ${own[step] === false ? "off" : own[step]}`);
|
|
3404
|
+
if (listed.length > 0) console.log(`[BugZero] Commands from .bugzerorc: ${listed.join(" | ")}`);
|
|
3405
|
+
for (const step of steps) {
|
|
3406
|
+
if (own[step] !== void 0 || defaults[step] === void 0) continue;
|
|
3407
|
+
console.log(
|
|
3408
|
+
`[BugZero] ${kind} project: running ${step === "test" ? "tests" : step} with ${defaults[step]} (a default; set "commands" in .bugzerorc to change it).`
|
|
3409
|
+
);
|
|
3410
|
+
}
|
|
3247
3411
|
}
|
|
3248
3412
|
function statusLabel(result) {
|
|
3249
3413
|
if (result.disabled) return "\u23ED\uFE0F Skipped (turned off in .bugzerorc)";
|
|
@@ -3254,14 +3418,14 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3254
3418
|
async function orchestrate2(options = {}) {
|
|
3255
3419
|
const cwd = options.cwd ?? process.cwd();
|
|
3256
3420
|
const timeoutMs = resolveTimeoutMs2(options.timeoutSeconds);
|
|
3257
|
-
const
|
|
3258
|
-
assertProject(cwd, commands);
|
|
3259
|
-
announceCommands(
|
|
3260
|
-
const stepOptions = { timeoutMs, commands };
|
|
3421
|
+
const project = projectCommands(cwd, (0, import_config2.getLocalConfig)(cwd).commands);
|
|
3422
|
+
assertProject(cwd, project.commands);
|
|
3423
|
+
announceCommands(project);
|
|
3424
|
+
const stepOptions = { timeoutMs, commands: project.commands };
|
|
3261
3425
|
const [build, lint, test] = await Promise.all([
|
|
3262
|
-
(0,
|
|
3263
|
-
(0,
|
|
3264
|
-
(0,
|
|
3426
|
+
(0, import_analyzers3.runBuild)(cwd, stepOptions),
|
|
3427
|
+
(0, import_analyzers3.runLint)(cwd, stepOptions),
|
|
3428
|
+
(0, import_analyzers3.runTests)(cwd, stepOptions)
|
|
3265
3429
|
]);
|
|
3266
3430
|
await writeReport(cwd, "hunt", {
|
|
3267
3431
|
success: build.success && lint.success && test.success,
|
|
@@ -3282,9 +3446,10 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3282
3446
|
const maxTokens = resolveMaxTokens2(options.maxTokens, config.maxTokens);
|
|
3283
3447
|
const tools = resolveTools(options.tools, config.tools);
|
|
3284
3448
|
const maxToolRequests = resolveMaxToolRequests2(options.maxToolRequests, config.maxToolRequests);
|
|
3285
|
-
const
|
|
3449
|
+
const project = projectCommands(cwd, config.commands);
|
|
3450
|
+
const commands = project.commands;
|
|
3286
3451
|
assertProject(cwd, commands);
|
|
3287
|
-
announceCommands(
|
|
3452
|
+
announceCommands(project);
|
|
3288
3453
|
const announceTools = () => {
|
|
3289
3454
|
if (tools) {
|
|
3290
3455
|
console.log(
|
|
@@ -3295,7 +3460,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3295
3460
|
}
|
|
3296
3461
|
};
|
|
3297
3462
|
console.log(`[BugZero] Running validation pipeline in: ${cwd}`);
|
|
3298
|
-
const pipelineResult = await (0,
|
|
3463
|
+
const pipelineResult = await (0, import_analyzers3.runValidationPipeline)(cwd, { timeoutMs, commands });
|
|
3299
3464
|
if (pipelineResult.success) {
|
|
3300
3465
|
console.log("[BugZero] Validation already passing \u2014 nothing to fix.");
|
|
3301
3466
|
if (options.printPrompt) {
|
|
@@ -3311,7 +3476,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3311
3476
|
});
|
|
3312
3477
|
return { success: true, attempts: 0, finalOutput: "" };
|
|
3313
3478
|
}
|
|
3314
|
-
const errors = (0,
|
|
3479
|
+
const errors = (0, import_analyzers3.parseErrors)(pipelineResult.output);
|
|
3315
3480
|
console.log(`[BugZero] Detected ${errors.length} error(s) (type: ${errors[0]?.type ?? "unknown"})`);
|
|
3316
3481
|
if (options.printPrompt) {
|
|
3317
3482
|
console.log("[BugZero] --print-prompt: showing the first prompt without sending it.");
|
|
@@ -3636,7 +3801,7 @@ ${rawOutput}
|
|
|
3636
3801
|
}
|
|
3637
3802
|
return spend;
|
|
3638
3803
|
}
|
|
3639
|
-
var
|
|
3804
|
+
var import_analyzers4 = require_dist4();
|
|
3640
3805
|
}
|
|
3641
3806
|
});
|
|
3642
3807
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugzero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.69",
|
|
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)",
|