bugzero 0.0.68 → 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 +10 -1
- package/dist/index.js +85 -5
- 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, Jest failures
|
|
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
|
|
|
@@ -383,6 +383,15 @@ A folder with a `pyproject.toml`, `setup.py`, `setup.cfg`, `requirements.txt` (o
|
|
|
383
383
|
- A folder that also has a `package.json` is treated as a Node.js project, as before.
|
|
384
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
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
|
+
|
|
386
395
|
---
|
|
387
396
|
|
|
388
397
|
## Reports
|
package/dist/index.js
CHANGED
|
@@ -1385,6 +1385,8 @@ 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,
|
|
1388
1390
|
defaultPythonCommands: () => defaultPythonCommands,
|
|
1389
1391
|
detectPackageManager: () => detectPackageManager2,
|
|
1390
1392
|
detectTestRunner: () => detectTestRunner,
|
|
@@ -1392,6 +1394,7 @@ var require_dist4 = __commonJS({
|
|
|
1392
1394
|
findPython: () => findPython,
|
|
1393
1395
|
getRunScriptCommand: () => getRunScriptCommand,
|
|
1394
1396
|
hasPackageJson: () => hasPackageJson,
|
|
1397
|
+
isGoProject: () => isGoProject,
|
|
1395
1398
|
isPythonProject: () => isPythonProject,
|
|
1396
1399
|
parseErrors: () => parseErrors,
|
|
1397
1400
|
planFocusedTests: () => planFocusedTests,
|
|
@@ -1552,6 +1555,10 @@ var require_dist4 = __commonJS({
|
|
|
1552
1555
|
var JEST_FAIL_RE = /● (.+)/g;
|
|
1553
1556
|
var JEST_FILE_RE = /FAIL\s+([\w/\\.\-]+)/g;
|
|
1554
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)/;
|
|
1555
1562
|
var ANSI_RE = /\u001b\[[0-9;]*[A-Za-z]/g;
|
|
1556
1563
|
function parseErrors(rawOutput) {
|
|
1557
1564
|
const output = rawOutput.replace(/\r\n/g, "\n");
|
|
@@ -1600,6 +1607,38 @@ var require_dist4 = __commonJS({
|
|
|
1600
1607
|
});
|
|
1601
1608
|
}
|
|
1602
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;
|
|
1603
1642
|
if (output.trim()) {
|
|
1604
1643
|
errors.push({
|
|
1605
1644
|
type: "unknown",
|
|
@@ -1758,6 +1797,37 @@ var require_dist4 = __commonJS({
|
|
|
1758
1797
|
if (python === void 0 || !(options.pytestWorks ?? runsPytest)(python, cwd)) return void 0;
|
|
1759
1798
|
return { test: `${python} -m pytest` };
|
|
1760
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
|
+
}
|
|
1761
1831
|
}
|
|
1762
1832
|
});
|
|
1763
1833
|
|
|
@@ -3076,7 +3146,10 @@ var require_dist8 = __commonJS({
|
|
|
3076
3146
|
}
|
|
3077
3147
|
}
|
|
3078
3148
|
if (has("tsconfig.json")) return "typescript";
|
|
3079
|
-
if (!has("package.json")
|
|
3149
|
+
if (!has("package.json")) {
|
|
3150
|
+
if ((0, import_analyzers.isGoProject)(cwd)) return "go";
|
|
3151
|
+
if ((0, import_analyzers.isPythonProject)(cwd)) return "python";
|
|
3152
|
+
}
|
|
3080
3153
|
return "unknown";
|
|
3081
3154
|
}
|
|
3082
3155
|
var import_analyzers3 = require_dist4();
|
|
@@ -3287,6 +3360,11 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3287
3360
|
function assertProject(cwd, commands = {}) {
|
|
3288
3361
|
if (hasPackageJson(cwd)) return;
|
|
3289
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
|
+
}
|
|
3290
3368
|
if ((0, import_analyzers2.isPythonProject)(cwd)) {
|
|
3291
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,";
|
|
3292
3370
|
throw new Error(`No package.json found in ${cwd}. This looks like a Python project. ${why} set "commands" in .bugzerorc (see the README).`);
|
|
@@ -3314,18 +3392,20 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3314
3392
|
}
|
|
3315
3393
|
function projectCommands(cwd, configured) {
|
|
3316
3394
|
const own = resolveCommands(configured);
|
|
3317
|
-
const
|
|
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 ?? {};
|
|
3318
3398
|
const all = { ...defaults, ...own };
|
|
3319
|
-
return { commands: Object.keys(all).length === 0 ? void 0 : all, own, defaults };
|
|
3399
|
+
return { commands: Object.keys(all).length === 0 ? void 0 : all, own, defaults, kind: found?.kind };
|
|
3320
3400
|
}
|
|
3321
|
-
function announceCommands({ own, defaults }) {
|
|
3401
|
+
function announceCommands({ own, defaults, kind }) {
|
|
3322
3402
|
const steps = ["build", "lint", "test"];
|
|
3323
3403
|
const listed = steps.filter((step) => own[step] !== void 0).map((step) => `${step}: ${own[step] === false ? "off" : own[step]}`);
|
|
3324
3404
|
if (listed.length > 0) console.log(`[BugZero] Commands from .bugzerorc: ${listed.join(" | ")}`);
|
|
3325
3405
|
for (const step of steps) {
|
|
3326
3406
|
if (own[step] !== void 0 || defaults[step] === void 0) continue;
|
|
3327
3407
|
console.log(
|
|
3328
|
-
`[BugZero]
|
|
3408
|
+
`[BugZero] ${kind} project: running ${step === "test" ? "tests" : step} with ${defaults[step]} (a default; set "commands" in .bugzerorc to change it).`
|
|
3329
3409
|
);
|
|
3330
3410
|
}
|
|
3331
3411
|
}
|
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)",
|