bugzero 0.0.63 → 0.0.65
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 +27 -4
- package/dist/index.js +90 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ bugzero rescue
|
|
|
101
101
|
|
|
102
102
|
- **Backups on every patch.** Each file BugZero modifies gets a `.opspilot.bak` copy of its original content first. The backup is written once per run, so it always restores what you had, even if the fix took several attempts. A leftover backup from an earlier run is replaced.
|
|
103
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.
|
|
104
|
-
- **Protected files.** BugZero never edits secrets (`.env`, `.env.*`, `*.pem`, `*.key`, `.npmrc`, `.netrc`, `.pypirc`), `.git/`, CI configuration (`.github/workflows/`, `.gitlab-ci.yml`, `.circleci/`, and similar), lockfiles (`package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`), `node_modules/`,
|
|
104
|
+
- **Protected files.** BugZero never edits secrets (`.env`, `.env.*`, `*.pem`, `*.key`, `.npmrc`, `.netrc`, `.pypirc`), `.git/`, CI configuration (`.github/workflows/`, `.gitlab-ci.yml`, `.circleci/`, and similar), lockfiles (`package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`), `node_modules/`, its own `.opspilot.bak` backups, or its settings file `.bugzerorc`. A patch to one of them is refused before any file changes, and the model is told to fix the problem elsewhere. Secret files are also never sent to the model, even if an error log names them. You can adjust the list in `.bugzerorc` (see Configuration), except that a fix can never edit `.bugzerorc` itself, so it cannot change these rules. Files you add with `protect` also cannot be read or searched by the model when you use `--tools`.
|
|
105
105
|
- **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.
|
|
106
106
|
- **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.
|
|
107
107
|
- **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.
|
|
@@ -110,7 +110,7 @@ bugzero rescue
|
|
|
110
110
|
|
|
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
|
-
- **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. Pointing `--path` at a directory with no `package.json` stops immediately with a clear error.
|
|
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.
|
|
114
114
|
- **Error parsing.** Recognizes TypeScript compiler errors (file, line, column, message), ESLint errors, and Jest failures 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
|
|
@@ -318,7 +318,7 @@ The full list, with sizes and limits, is in [docs/PRIVACY.md](https://github.com
|
|
|
318
318
|
|
|
319
319
|
## Configuration
|
|
320
320
|
|
|
321
|
-
BugZero reads a `.bugzerorc` JSON file in your target project directory to pick up model preferences and
|
|
321
|
+
BugZero reads a `.bugzerorc` JSON file in your target project directory to pick up model preferences, file protection and other settings:
|
|
322
322
|
|
|
323
323
|
```json
|
|
324
324
|
{
|
|
@@ -337,17 +337,40 @@ BugZero reads a `.bugzerorc` JSON file in your target project directory to pick
|
|
|
337
337
|
|---|---|
|
|
338
338
|
| `model` | The OpenRouter model to use. Set it with `bugzero vibe`. |
|
|
339
339
|
| `protect` | Extra files BugZero must never edit, added to the built-in list (see Protected files above). With tools on, the model cannot read or search them either. |
|
|
340
|
-
| `allow` | Files from the built-in list that BugZero may edit and read after all, such as `.env.example`. A `protect` pattern still wins. |
|
|
340
|
+
| `allow` | Files from the built-in list that BugZero may edit and read after all, such as `.env.example`. A `protect` pattern still wins, and `.bugzerorc` is never editable. |
|
|
341
341
|
| `patience` | How many attempts in a row may make no progress before `rescue` stops early. Default 2, `0` turns it off. `--patience` overrides it. |
|
|
342
342
|
| `focusTests` | Set to `false` to always run the full pipeline, instead of re-running only the failing test files between attempts. Default `true`. `--no-focus-tests` overrides it. |
|
|
343
343
|
| `maxTokens` | The most AI tokens a `rescue` run may use, the report included. Not set or `0` means no limit. `--max-tokens` overrides it. |
|
|
344
344
|
| `tools` | Set to `true` to let the model ask to read and search project files during `rescue`, which sends more of your code. Default `false`. `--tools` and `--no-tools` override it. |
|
|
345
345
|
| `maxToolRequests` | With tools, the most requests per fix attempt, from 1 to 20. Default 3. `--max-tool-requests` overrides it. |
|
|
346
|
+
| `commands` | Your own build, lint and test commands (see [Your own commands](#your-own-commands)). |
|
|
346
347
|
|
|
347
348
|
Patterns are relative to the project and ignore case. `*` matches within a folder, `**` matches across folders, `?` matches one character, and a trailing `/` means a folder and everything in it. A pattern with no `/` matches that name at any depth, so `.env.*` also covers `apps/web/.env.local`; a pattern with a `/` is anchored to the project root. All keys are optional.
|
|
348
349
|
|
|
349
350
|
`bugzero vibe` creates the file if it is missing and only changes `model`, so your other settings are kept.
|
|
350
351
|
|
|
352
|
+
### Your own commands
|
|
353
|
+
|
|
354
|
+
To run something other than your `package.json` scripts, add `commands`:
|
|
355
|
+
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"commands": {
|
|
359
|
+
"build": "tsc -p tsconfig.build.json",
|
|
360
|
+
"lint": false,
|
|
361
|
+
"test": "vitest run"
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
- Each of `build`, `lint` and `test` takes a command to run, or `false` to skip that step. A step you do not list runs the script of the same name, as before.
|
|
367
|
+
- A command runs in your shell from the project folder, finds programs in `node_modules/.bin` as a script would, and is subject to `--timeout`. `hunt`, `rescue` and the GitHub Action all use it.
|
|
368
|
+
- Re-running only the failing test files still works when the `test` command is a single plain Jest or Vitest command such as `vitest run`. With any other command the full pipeline runs.
|
|
369
|
+
- The settings are read once, when a run starts. A step name or value BugZero does not understand stops the run before anything is executed.
|
|
370
|
+
- The project still needs a `package.json`.
|
|
371
|
+
|
|
372
|
+
These commands run on your machine exactly as written, so, as with `package.json` scripts, only run BugZero on projects you trust.
|
|
373
|
+
|
|
351
374
|
---
|
|
352
375
|
|
|
353
376
|
## Reports
|
package/dist/index.js
CHANGED
|
@@ -502,6 +502,7 @@ var require_dist2 = __commonJS({
|
|
|
502
502
|
DEFAULT_UNREADABLE_PATTERNS: () => DEFAULT_UNREADABLE_PATTERNS,
|
|
503
503
|
MAX_REPLY_TOKENS: () => MAX_REPLY_TOKENS,
|
|
504
504
|
MIN_REPLY_TOKENS: () => MIN_REPLY_TOKENS,
|
|
505
|
+
SETTINGS_PATTERNS: () => SETTINGS_PATTERNS,
|
|
505
506
|
checkBudget: () => checkBudget,
|
|
506
507
|
countCallTokens: () => countCallTokens,
|
|
507
508
|
createProtectedPathRules: () => createProtectedPathRules2,
|
|
@@ -595,6 +596,7 @@ var require_dist2 = __commonJS({
|
|
|
595
596
|
"*.opspilot.bak",
|
|
596
597
|
"*.opspilot.bak.sha"
|
|
597
598
|
];
|
|
599
|
+
var SETTINGS_PATTERNS = [".bugzerorc"];
|
|
598
600
|
function normalizePath(relPath) {
|
|
599
601
|
return relPath.replace(/\\/g, "/").replace(/^(\.\/)+/, "").replace(/^\/+/, "").toLowerCase();
|
|
600
602
|
}
|
|
@@ -639,6 +641,7 @@ var require_dist2 = __commonJS({
|
|
|
639
641
|
const defaults = compileAll(DEFAULT_PROTECTED_PATTERNS);
|
|
640
642
|
const secrets = compileAll(DEFAULT_SECRET_PATTERNS);
|
|
641
643
|
const unreadable = compileAll(DEFAULT_UNREADABLE_PATTERNS);
|
|
644
|
+
const settingsFiles = compileAll(SETTINGS_PATTERNS);
|
|
642
645
|
const extra = compileAll(settings.protect);
|
|
643
646
|
const allowed = compileAll(settings.allow);
|
|
644
647
|
const blockedUnlessAllowed = (matchers, relPath) => {
|
|
@@ -648,9 +651,10 @@ var require_dist2 = __commonJS({
|
|
|
648
651
|
};
|
|
649
652
|
const blockedOrProtected = (matchers, relPath) => firstMatch(extra, normalizePath(relPath))?.pattern ?? blockedUnlessAllowed(matchers, relPath);
|
|
650
653
|
return {
|
|
651
|
-
editBlockedBy: (relPath) => blockedOrProtected(defaults, relPath),
|
|
654
|
+
editBlockedBy: (relPath) => firstMatch(settingsFiles, normalizePath(relPath))?.pattern ?? blockedOrProtected(defaults, relPath),
|
|
652
655
|
secretBlockedBy: (relPath) => blockedUnlessAllowed(secrets, relPath),
|
|
653
|
-
readBlockedBy: (relPath) => blockedOrProtected(unreadable, relPath)
|
|
656
|
+
readBlockedBy: (relPath) => blockedOrProtected(unreadable, relPath),
|
|
657
|
+
restoreBlockedBy: (relPath) => blockedOrProtected(defaults, relPath)
|
|
654
658
|
};
|
|
655
659
|
}
|
|
656
660
|
function toRelative(root, target) {
|
|
@@ -1276,7 +1280,7 @@ var require_dist3 = __commonJS({
|
|
|
1276
1280
|
entries.push(entry("failed", "The file is outside the project."));
|
|
1277
1281
|
continue;
|
|
1278
1282
|
}
|
|
1279
|
-
const blockedBy = (0, import_shared32.projectRelativePaths)(root, target).map((relPath) => protection.
|
|
1283
|
+
const blockedBy = (0, import_shared32.projectRelativePaths)(root, target).map((relPath) => protection.restoreBlockedBy(relPath)).find((pattern) => pattern !== void 0);
|
|
1280
1284
|
if (blockedBy !== void 0) {
|
|
1281
1285
|
entries.push(entry("protected", `It is protected (it matches "${blockedBy}"), so BugZero does not write to it.`));
|
|
1282
1286
|
continue;
|
|
@@ -1362,6 +1366,7 @@ var require_dist4 = __commonJS({
|
|
|
1362
1366
|
runFocusedTests: () => runFocusedTests,
|
|
1363
1367
|
runLint: () => runLint,
|
|
1364
1368
|
runScript: () => runScript,
|
|
1369
|
+
runStep: () => runStep,
|
|
1365
1370
|
runTests: () => runTests,
|
|
1366
1371
|
runValidationPipeline: () => runValidationPipeline,
|
|
1367
1372
|
usableFocusedResult: () => usableFocusedResult
|
|
@@ -1421,6 +1426,8 @@ var require_dist4 = __commonJS({
|
|
|
1421
1426
|
shell: true,
|
|
1422
1427
|
cwd: cwd ?? process.cwd(),
|
|
1423
1428
|
all: true,
|
|
1429
|
+
preferLocal: options.localBins === true,
|
|
1430
|
+
localDir: cwd ?? process.cwd(),
|
|
1424
1431
|
env: {
|
|
1425
1432
|
...process.env,
|
|
1426
1433
|
CI: "true"
|
|
@@ -1484,15 +1491,21 @@ var require_dist4 = __commonJS({
|
|
|
1484
1491
|
return void 0;
|
|
1485
1492
|
}
|
|
1486
1493
|
}
|
|
1494
|
+
async function runStep(step, cwd, options) {
|
|
1495
|
+
const command = options?.commands?.[step];
|
|
1496
|
+
if (command === false) return { success: true, output: "", skipped: true, disabled: true };
|
|
1497
|
+
if (command !== void 0) return runCommand(command, cwd, { ...options, localBins: true });
|
|
1498
|
+
return runScript(step, cwd, options);
|
|
1499
|
+
}
|
|
1487
1500
|
async function runScript(script, cwd, options) {
|
|
1488
1501
|
if (!readScripts(cwd).includes(script)) {
|
|
1489
1502
|
return { success: true, output: "", skipped: true };
|
|
1490
1503
|
}
|
|
1491
1504
|
return runCommand(getRunScriptCommand(detectPackageManager3(cwd), script), cwd, options);
|
|
1492
1505
|
}
|
|
1493
|
-
var runBuild = (cwd, options) =>
|
|
1494
|
-
var runLint = (cwd, options) =>
|
|
1495
|
-
var runTests = (cwd, options) =>
|
|
1506
|
+
var runBuild = (cwd, options) => runStep("build", cwd, options);
|
|
1507
|
+
var runLint = (cwd, options) => runStep("lint", cwd, options);
|
|
1508
|
+
var runTests = (cwd, options) => runStep("test", cwd, options);
|
|
1496
1509
|
var TS_ERROR_RE = /^(.+)\((\d+),(\d+)\):\s+error\s+TS\d+:\s+(.+)$/gm;
|
|
1497
1510
|
var ESLINT_ERROR_RE = /^\s+(\d+):(\d+)\s+error\s+(.+)$/gm;
|
|
1498
1511
|
var JEST_FAIL_RE = /● (.+)/g;
|
|
@@ -1552,20 +1565,29 @@ var require_dist4 = __commonJS({
|
|
|
1552
1565
|
const targetCwd = cwd ?? process.cwd();
|
|
1553
1566
|
const scripts = readScripts(targetCwd);
|
|
1554
1567
|
let ranAnyStep = false;
|
|
1568
|
+
let turnedOff = false;
|
|
1555
1569
|
for (const { step, label, run } of STEPS) {
|
|
1556
|
-
|
|
1570
|
+
const command = options?.commands?.[step];
|
|
1571
|
+
if (command === false) {
|
|
1572
|
+
turnedOff = true;
|
|
1573
|
+
console.log(`[BugZero] Skipping ${label}: turned off in .bugzerorc.`);
|
|
1574
|
+
continue;
|
|
1575
|
+
}
|
|
1576
|
+
if (command === void 0 && !scripts.includes(step)) {
|
|
1557
1577
|
console.log(`[BugZero] Skipping ${label}: no "${step}" script in package.json.`);
|
|
1558
1578
|
continue;
|
|
1559
1579
|
}
|
|
1560
1580
|
ranAnyStep = true;
|
|
1561
|
-
console.log(`[BugZero] Running ${label}...`);
|
|
1581
|
+
console.log(command === void 0 ? `[BugZero] Running ${label}...` : `[BugZero] Running ${label}: ${command}`);
|
|
1562
1582
|
const result = await run(targetCwd, options);
|
|
1563
1583
|
if (!result.success) {
|
|
1564
1584
|
return { success: false, step, output: result.output };
|
|
1565
1585
|
}
|
|
1566
1586
|
}
|
|
1567
1587
|
if (!ranAnyStep) {
|
|
1568
|
-
console.warn(
|
|
1588
|
+
console.warn(
|
|
1589
|
+
turnedOff ? "[BugZero] Every step is turned off or has no script \u2014 nothing to validate." : "[BugZero] No build, lint, or test scripts found in package.json \u2014 nothing to validate."
|
|
1590
|
+
);
|
|
1569
1591
|
}
|
|
1570
1592
|
return { success: true, step: "none", output: "" };
|
|
1571
1593
|
}
|
|
@@ -1605,19 +1627,21 @@ var require_dist4 = __commonJS({
|
|
|
1605
1627
|
}
|
|
1606
1628
|
return files.length > MAX_FOCUSED_FILES ? [] : files;
|
|
1607
1629
|
}
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
return manager === "npm" ? `npm run test -- ${
|
|
1630
|
+
var quoted = (files) => files.map((file) => `"${file}"`).join(" ");
|
|
1631
|
+
function scriptCommand(manager, files) {
|
|
1632
|
+
return manager === "npm" ? `npm run test -- ${quoted(files)}` : `${manager} run test ${quoted(files)}`;
|
|
1611
1633
|
}
|
|
1612
|
-
function planFocusedTests(cwd, output) {
|
|
1613
|
-
|
|
1634
|
+
function planFocusedTests(cwd, output, command) {
|
|
1635
|
+
if (command === false) return null;
|
|
1636
|
+
const runner = detectTestRunner(command ?? readScriptText(cwd, "test"));
|
|
1614
1637
|
if (runner === null) return null;
|
|
1615
1638
|
const files = findFailingTestFiles(cwd, output);
|
|
1616
1639
|
if (files.length === 0) return null;
|
|
1617
|
-
return { runner, files, command:
|
|
1640
|
+
if (command !== void 0) return { runner, files, command: `${command} ${quoted(files)}`, localBins: true };
|
|
1641
|
+
return { runner, files, command: scriptCommand(detectPackageManager3(cwd), files) };
|
|
1618
1642
|
}
|
|
1619
1643
|
function runFocusedTests(plan, cwd, options) {
|
|
1620
|
-
return runCommand(plan.command, cwd, options);
|
|
1644
|
+
return runCommand(plan.command, cwd, { ...options, localBins: plan.localBins });
|
|
1621
1645
|
}
|
|
1622
1646
|
function usableFocusedResult(cwd, result) {
|
|
1623
1647
|
if (result.success) return false;
|
|
@@ -2053,7 +2077,7 @@ Reply with ONLY a valid JSON object in this exact shape \u2014 no markdown fence
|
|
|
2053
2077
|
Critical rules:
|
|
2054
2078
|
- "patches" must contain at least one entry. Only include more than one when the fix truly requires editing multiple files \u2014 most fixes need just one.
|
|
2055
2079
|
- Each "filePath" must be a relative path from the project root (no leading /).
|
|
2056
|
-
- Never change secret files (.env and key files), lockfiles, CI workflow files, .git or node_modules. Patches to them are rejected, so fix the problem in another file.
|
|
2080
|
+
- Never change secret files (.env and key files), lockfiles, CI workflow files, .bugzerorc, .git or node_modules. Patches to them are rejected, so fix the problem in another file.
|
|
2057
2081
|
- Each "search" must be an EXACT character-for-character substring of that file's current content.
|
|
2058
2082
|
- Each "replace" must be syntactically valid code.
|
|
2059
2083
|
- If two patches target the same file, list them in the order they should be applied, and make sure each "search" reflects the file's content *after* the previous patch in this list has been applied to it.
|
|
@@ -2240,6 +2264,11 @@ var require_dist7 = __commonJS({
|
|
|
2240
2264
|
reducer: (_, value) => value ?? 3,
|
|
2241
2265
|
default: () => 3
|
|
2242
2266
|
}),
|
|
2267
|
+
/** The project's own build, lint and test commands (undefined = its package.json scripts) */
|
|
2268
|
+
commands: (0, import_langgraph.Annotation)({
|
|
2269
|
+
reducer: (_, value) => value,
|
|
2270
|
+
default: () => void 0
|
|
2271
|
+
}),
|
|
2243
2272
|
/** Per-command timeout in milliseconds for validation steps (undefined = no limit) */
|
|
2244
2273
|
timeoutMs: (0, import_langgraph.Annotation)({
|
|
2245
2274
|
reducer: (_, value) => value,
|
|
@@ -2781,7 +2810,7 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
2781
2810
|
async function validate(state) {
|
|
2782
2811
|
const options = { timeoutMs: state.timeoutMs };
|
|
2783
2812
|
if (state.focusTests !== false && state.progress?.last.step === "test") {
|
|
2784
|
-
const plan = (0, import_analyzers2.planFocusedTests)(state.cwd, state.logs);
|
|
2813
|
+
const plan = (0, import_analyzers2.planFocusedTests)(state.cwd, state.logs, state.commands?.test);
|
|
2785
2814
|
if (plan) {
|
|
2786
2815
|
console.log(
|
|
2787
2816
|
`[BugZero] Re-running only the failing test file${plan.files.length === 1 ? "" : "s"}: ${plan.files.join(", ")} (the full pipeline runs once they pass)\u2026`
|
|
@@ -2795,7 +2824,7 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
2795
2824
|
);
|
|
2796
2825
|
}
|
|
2797
2826
|
}
|
|
2798
|
-
return (0, import_analyzers2.runValidationPipeline)(state.cwd, options);
|
|
2827
|
+
return (0, import_analyzers2.runValidationPipeline)(state.cwd, { ...options, commands: state.commands });
|
|
2799
2828
|
}
|
|
2800
2829
|
async function verifyNode(state) {
|
|
2801
2830
|
if (state.patchFailed) {
|
|
@@ -3108,6 +3137,28 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3108
3137
|
}
|
|
3109
3138
|
return value;
|
|
3110
3139
|
}
|
|
3140
|
+
var STEP_NAMES = ["build", "lint", "test"];
|
|
3141
|
+
function resolveCommands(configured) {
|
|
3142
|
+
if (configured === void 0) return {};
|
|
3143
|
+
if (typeof configured !== "object" || configured === null || Array.isArray(configured)) {
|
|
3144
|
+
throw new Error(
|
|
3145
|
+
'commands in .bugzerorc must be an object such as {"build": "tsc -p .", "lint": false}, with any of build, lint and test.'
|
|
3146
|
+
);
|
|
3147
|
+
}
|
|
3148
|
+
const commands = {};
|
|
3149
|
+
for (const [step, command] of Object.entries(configured)) {
|
|
3150
|
+
if (!STEP_NAMES.includes(step)) {
|
|
3151
|
+
throw new Error(`commands in .bugzerorc: "${step}" is not a step. Use build, lint or test.`);
|
|
3152
|
+
}
|
|
3153
|
+
if (command !== false && (typeof command !== "string" || command.trim() === "")) {
|
|
3154
|
+
throw new Error(
|
|
3155
|
+
`commands.${step} in .bugzerorc must be a command to run, or false to skip the step (received ${JSON.stringify(command)}).`
|
|
3156
|
+
);
|
|
3157
|
+
}
|
|
3158
|
+
commands[step] = command;
|
|
3159
|
+
}
|
|
3160
|
+
return commands;
|
|
3161
|
+
}
|
|
3111
3162
|
var import_fs22 = __toESM2(require("fs"));
|
|
3112
3163
|
var import_path22 = __toESM2(require("path"));
|
|
3113
3164
|
function assertNodeProject(cwd) {
|
|
@@ -3129,7 +3180,15 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3129
3180
|
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.`;
|
|
3130
3181
|
return declined > 0 ? `${base} You declined ${declined} proposed ${plural}.` : base;
|
|
3131
3182
|
}
|
|
3183
|
+
function projectCommands(configured) {
|
|
3184
|
+
const commands = resolveCommands(configured);
|
|
3185
|
+
const listed = ["build", "lint", "test"].filter((step) => commands[step] !== void 0).map((step) => `${step}: ${commands[step] === false ? "off" : commands[step]}`);
|
|
3186
|
+
if (listed.length === 0) return void 0;
|
|
3187
|
+
console.log(`[BugZero] Commands from .bugzerorc: ${listed.join(" | ")}`);
|
|
3188
|
+
return commands;
|
|
3189
|
+
}
|
|
3132
3190
|
function statusLabel(result) {
|
|
3191
|
+
if (result.disabled) return "\u23ED\uFE0F Skipped (turned off in .bugzerorc)";
|
|
3133
3192
|
if (result.skipped) return "\u23ED\uFE0F Skipped (no script defined)";
|
|
3134
3193
|
return result.success ? "\u2705 Passed" : "\u274C Failed";
|
|
3135
3194
|
}
|
|
@@ -3137,10 +3196,12 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3137
3196
|
const cwd = options.cwd ?? process.cwd();
|
|
3138
3197
|
assertNodeProject(cwd);
|
|
3139
3198
|
const timeoutMs = resolveTimeoutMs2(options.timeoutSeconds);
|
|
3199
|
+
const commands = projectCommands((0, import_config2.getLocalConfig)(cwd).commands);
|
|
3200
|
+
const stepOptions = { timeoutMs, commands };
|
|
3140
3201
|
const [build, lint, test] = await Promise.all([
|
|
3141
|
-
(0, import_analyzers.runBuild)(cwd,
|
|
3142
|
-
(0, import_analyzers.runLint)(cwd,
|
|
3143
|
-
(0, import_analyzers.runTests)(cwd,
|
|
3202
|
+
(0, import_analyzers.runBuild)(cwd, stepOptions),
|
|
3203
|
+
(0, import_analyzers.runLint)(cwd, stepOptions),
|
|
3204
|
+
(0, import_analyzers.runTests)(cwd, stepOptions)
|
|
3144
3205
|
]);
|
|
3145
3206
|
await writeReport(cwd, "hunt", {
|
|
3146
3207
|
success: build.success && lint.success && test.success,
|
|
@@ -3162,6 +3223,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3162
3223
|
const maxTokens = resolveMaxTokens2(options.maxTokens, config.maxTokens);
|
|
3163
3224
|
const tools = resolveTools(options.tools, config.tools);
|
|
3164
3225
|
const maxToolRequests = resolveMaxToolRequests2(options.maxToolRequests, config.maxToolRequests);
|
|
3226
|
+
const commands = projectCommands(config.commands);
|
|
3165
3227
|
const announceTools = () => {
|
|
3166
3228
|
if (tools) {
|
|
3167
3229
|
console.log(
|
|
@@ -3172,7 +3234,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3172
3234
|
}
|
|
3173
3235
|
};
|
|
3174
3236
|
console.log(`[BugZero] Running validation pipeline in: ${cwd}`);
|
|
3175
|
-
const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd, { timeoutMs });
|
|
3237
|
+
const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd, { timeoutMs, commands });
|
|
3176
3238
|
if (pipelineResult.success) {
|
|
3177
3239
|
console.log("[BugZero] Validation already passing \u2014 nothing to fix.");
|
|
3178
3240
|
if (options.printPrompt) {
|
|
@@ -3231,6 +3293,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3231
3293
|
maxTokens,
|
|
3232
3294
|
tools,
|
|
3233
3295
|
maxToolRequests,
|
|
3296
|
+
commands,
|
|
3234
3297
|
initialStep: pipelineResult.step
|
|
3235
3298
|
});
|
|
3236
3299
|
const result = {
|
|
@@ -3775,7 +3838,10 @@ program.command("hunt").description("Run build, lint, and tests \u2014 report is
|
|
|
3775
3838
|
console.log();
|
|
3776
3839
|
const { build, lint, test } = await (0, import_core.orchestrate)({ cwd, timeoutSeconds, aiReport: opts.aiReport });
|
|
3777
3840
|
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");
|
|
3778
|
-
const label = (r) =>
|
|
3841
|
+
const label = (r) => {
|
|
3842
|
+
if (r.skipped) return r.disabled ? "\u23ED\uFE0F Skipped (turned off in .bugzerorc)" : "\u23ED\uFE0F Skipped (no script)";
|
|
3843
|
+
return r.success ? "\u2705 Passed" : "\u274C Failed (see report)";
|
|
3844
|
+
};
|
|
3779
3845
|
console.log(` Build: ${label(build)}`);
|
|
3780
3846
|
console.log(` Lint: ${label(lint)}`);
|
|
3781
3847
|
console.log(` Tests: ${label(test)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugzero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
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)",
|