bugzero 0.0.64 → 0.0.66
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 -2
- package/dist/index.js +145 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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
|
{
|
|
@@ -343,11 +343,36 @@ BugZero reads a `.bugzerorc` JSON file in your target project directory to pick
|
|
|
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
|
+
Mistakes are not ignored. If `.bugzerorc` is not valid JSON, or a setting has the wrong type (for example `protect` written as text instead of a list), BugZero stops and says what is wrong before it runs or sends anything. `bugzero undo` is the exception: it warns you and restores your files using the built-in protection rules. Save the file as UTF-8. Keys BugZero does not recognise are ignored, so check their spelling.
|
|
353
|
+
|
|
354
|
+
### Your own commands
|
|
355
|
+
|
|
356
|
+
To run something other than your `package.json` scripts, add `commands`:
|
|
357
|
+
|
|
358
|
+
```json
|
|
359
|
+
{
|
|
360
|
+
"commands": {
|
|
361
|
+
"build": "tsc -p tsconfig.build.json",
|
|
362
|
+
"lint": false,
|
|
363
|
+
"test": "vitest run"
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
- 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.
|
|
369
|
+
- 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.
|
|
370
|
+
- 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.
|
|
371
|
+
- 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.
|
|
372
|
+
- The project still needs a `package.json`.
|
|
373
|
+
|
|
374
|
+
These commands run on your machine exactly as written, so, as with `package.json` scripts, only run BugZero on projects you trust.
|
|
375
|
+
|
|
351
376
|
---
|
|
352
377
|
|
|
353
378
|
## Reports
|
package/dist/index.js
CHANGED
|
@@ -433,29 +433,61 @@ var require_dist = __commonJS({
|
|
|
433
433
|
var import_fs22 = __toESM2(require("fs"));
|
|
434
434
|
var import_path22 = __toESM2(require("path"));
|
|
435
435
|
var CONFIG_FILENAME = ".bugzerorc";
|
|
436
|
-
function
|
|
436
|
+
function configError(configPath, problem) {
|
|
437
|
+
return new Error(`${configPath} ${problem} Fix it, or delete the file to use the default settings.`);
|
|
438
|
+
}
|
|
439
|
+
function readConfigText(configPath) {
|
|
440
|
+
let bytes;
|
|
437
441
|
try {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
+
bytes = import_fs22.default.readFileSync(configPath);
|
|
443
|
+
} catch (error) {
|
|
444
|
+
const { code, message } = error;
|
|
445
|
+
if (code === "ENOENT" || code === "ENOTDIR") return void 0;
|
|
446
|
+
throw configError(configPath, `could not be read (${message}).`);
|
|
447
|
+
}
|
|
448
|
+
const utf16 = bytes[0] === 255 && bytes[1] === 254 || bytes[0] === 254 && bytes[1] === 255;
|
|
449
|
+
if (utf16) throw configError(configPath, "is saved as UTF-16, which BugZero cannot read. Save it as UTF-8.");
|
|
450
|
+
const text = bytes.toString("utf-8");
|
|
451
|
+
return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
|
|
452
|
+
}
|
|
453
|
+
function checkTypes(configPath, config) {
|
|
454
|
+
for (const key of ["protect", "allow"]) {
|
|
455
|
+
const value = config[key];
|
|
456
|
+
if (value !== void 0 && !(Array.isArray(value) && value.every((entry) => typeof entry === "string"))) {
|
|
457
|
+
throw configError(configPath, `has a "${key}" that is not a list of text, such as ["config/prod.json"].`);
|
|
442
458
|
}
|
|
443
|
-
} catch (e) {
|
|
444
459
|
}
|
|
445
|
-
|
|
460
|
+
if (config.model !== void 0 && typeof config.model !== "string") {
|
|
461
|
+
throw configError(configPath, 'has a "model" that is not text.');
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
function getLocalConfig(cwd = process.cwd()) {
|
|
465
|
+
const configPath = import_path22.default.resolve(cwd, CONFIG_FILENAME);
|
|
466
|
+
const text = readConfigText(configPath);
|
|
467
|
+
if (text === void 0 || text.trim() === "") return {};
|
|
468
|
+
let parsed;
|
|
469
|
+
try {
|
|
470
|
+
parsed = JSON.parse(text);
|
|
471
|
+
} catch (error) {
|
|
472
|
+
throw configError(configPath, `is not valid JSON (${error.message}).`);
|
|
473
|
+
}
|
|
474
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
475
|
+
throw configError(configPath, 'must hold a JSON object, such as {"model": "..."}.');
|
|
476
|
+
}
|
|
477
|
+
checkTypes(configPath, parsed);
|
|
478
|
+
return parsed;
|
|
446
479
|
}
|
|
447
480
|
function saveLocalConfig(config, cwd = process.cwd()) {
|
|
448
481
|
const configPath = import_path22.default.resolve(cwd, CONFIG_FILENAME);
|
|
449
482
|
const merged = { ...getLocalConfig(cwd), ...config };
|
|
450
483
|
import_fs22.default.writeFileSync(configPath, JSON.stringify(merged, null, 2), "utf-8");
|
|
451
484
|
}
|
|
452
|
-
function
|
|
453
|
-
|
|
454
|
-
return value.filter((entry) => typeof entry === "string" && entry.trim() !== "");
|
|
485
|
+
function entries(list) {
|
|
486
|
+
return (list ?? []).filter((entry) => entry.trim() !== "");
|
|
455
487
|
}
|
|
456
488
|
function getProtectionSettings2(cwd = process.cwd()) {
|
|
457
489
|
const config = getLocalConfig(cwd);
|
|
458
|
-
return { protect:
|
|
490
|
+
return { protect: entries(config.protect), allow: entries(config.allow) };
|
|
459
491
|
}
|
|
460
492
|
function getSelectedModel(cwd = process.cwd()) {
|
|
461
493
|
const config = getLocalConfig(cwd);
|
|
@@ -1366,6 +1398,7 @@ var require_dist4 = __commonJS({
|
|
|
1366
1398
|
runFocusedTests: () => runFocusedTests,
|
|
1367
1399
|
runLint: () => runLint,
|
|
1368
1400
|
runScript: () => runScript,
|
|
1401
|
+
runStep: () => runStep,
|
|
1369
1402
|
runTests: () => runTests,
|
|
1370
1403
|
runValidationPipeline: () => runValidationPipeline,
|
|
1371
1404
|
usableFocusedResult: () => usableFocusedResult
|
|
@@ -1425,6 +1458,8 @@ var require_dist4 = __commonJS({
|
|
|
1425
1458
|
shell: true,
|
|
1426
1459
|
cwd: cwd ?? process.cwd(),
|
|
1427
1460
|
all: true,
|
|
1461
|
+
preferLocal: options.localBins === true,
|
|
1462
|
+
localDir: cwd ?? process.cwd(),
|
|
1428
1463
|
env: {
|
|
1429
1464
|
...process.env,
|
|
1430
1465
|
CI: "true"
|
|
@@ -1488,15 +1523,21 @@ var require_dist4 = __commonJS({
|
|
|
1488
1523
|
return void 0;
|
|
1489
1524
|
}
|
|
1490
1525
|
}
|
|
1526
|
+
async function runStep(step, cwd, options) {
|
|
1527
|
+
const command = options?.commands?.[step];
|
|
1528
|
+
if (command === false) return { success: true, output: "", skipped: true, disabled: true };
|
|
1529
|
+
if (command !== void 0) return runCommand(command, cwd, { ...options, localBins: true });
|
|
1530
|
+
return runScript(step, cwd, options);
|
|
1531
|
+
}
|
|
1491
1532
|
async function runScript(script, cwd, options) {
|
|
1492
1533
|
if (!readScripts(cwd).includes(script)) {
|
|
1493
1534
|
return { success: true, output: "", skipped: true };
|
|
1494
1535
|
}
|
|
1495
1536
|
return runCommand(getRunScriptCommand(detectPackageManager3(cwd), script), cwd, options);
|
|
1496
1537
|
}
|
|
1497
|
-
var runBuild = (cwd, options) =>
|
|
1498
|
-
var runLint = (cwd, options) =>
|
|
1499
|
-
var runTests = (cwd, options) =>
|
|
1538
|
+
var runBuild = (cwd, options) => runStep("build", cwd, options);
|
|
1539
|
+
var runLint = (cwd, options) => runStep("lint", cwd, options);
|
|
1540
|
+
var runTests = (cwd, options) => runStep("test", cwd, options);
|
|
1500
1541
|
var TS_ERROR_RE = /^(.+)\((\d+),(\d+)\):\s+error\s+TS\d+:\s+(.+)$/gm;
|
|
1501
1542
|
var ESLINT_ERROR_RE = /^\s+(\d+):(\d+)\s+error\s+(.+)$/gm;
|
|
1502
1543
|
var JEST_FAIL_RE = /● (.+)/g;
|
|
@@ -1556,20 +1597,29 @@ var require_dist4 = __commonJS({
|
|
|
1556
1597
|
const targetCwd = cwd ?? process.cwd();
|
|
1557
1598
|
const scripts = readScripts(targetCwd);
|
|
1558
1599
|
let ranAnyStep = false;
|
|
1600
|
+
let turnedOff = false;
|
|
1559
1601
|
for (const { step, label, run } of STEPS) {
|
|
1560
|
-
|
|
1602
|
+
const command = options?.commands?.[step];
|
|
1603
|
+
if (command === false) {
|
|
1604
|
+
turnedOff = true;
|
|
1605
|
+
console.log(`[BugZero] Skipping ${label}: turned off in .bugzerorc.`);
|
|
1606
|
+
continue;
|
|
1607
|
+
}
|
|
1608
|
+
if (command === void 0 && !scripts.includes(step)) {
|
|
1561
1609
|
console.log(`[BugZero] Skipping ${label}: no "${step}" script in package.json.`);
|
|
1562
1610
|
continue;
|
|
1563
1611
|
}
|
|
1564
1612
|
ranAnyStep = true;
|
|
1565
|
-
console.log(`[BugZero] Running ${label}...`);
|
|
1613
|
+
console.log(command === void 0 ? `[BugZero] Running ${label}...` : `[BugZero] Running ${label}: ${command}`);
|
|
1566
1614
|
const result = await run(targetCwd, options);
|
|
1567
1615
|
if (!result.success) {
|
|
1568
1616
|
return { success: false, step, output: result.output };
|
|
1569
1617
|
}
|
|
1570
1618
|
}
|
|
1571
1619
|
if (!ranAnyStep) {
|
|
1572
|
-
console.warn(
|
|
1620
|
+
console.warn(
|
|
1621
|
+
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."
|
|
1622
|
+
);
|
|
1573
1623
|
}
|
|
1574
1624
|
return { success: true, step: "none", output: "" };
|
|
1575
1625
|
}
|
|
@@ -1609,19 +1659,21 @@ var require_dist4 = __commonJS({
|
|
|
1609
1659
|
}
|
|
1610
1660
|
return files.length > MAX_FOCUSED_FILES ? [] : files;
|
|
1611
1661
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
return manager === "npm" ? `npm run test -- ${
|
|
1662
|
+
var quoted = (files) => files.map((file) => `"${file}"`).join(" ");
|
|
1663
|
+
function scriptCommand(manager, files) {
|
|
1664
|
+
return manager === "npm" ? `npm run test -- ${quoted(files)}` : `${manager} run test ${quoted(files)}`;
|
|
1615
1665
|
}
|
|
1616
|
-
function planFocusedTests(cwd, output) {
|
|
1617
|
-
|
|
1666
|
+
function planFocusedTests(cwd, output, command) {
|
|
1667
|
+
if (command === false) return null;
|
|
1668
|
+
const runner = detectTestRunner(command ?? readScriptText(cwd, "test"));
|
|
1618
1669
|
if (runner === null) return null;
|
|
1619
1670
|
const files = findFailingTestFiles(cwd, output);
|
|
1620
1671
|
if (files.length === 0) return null;
|
|
1621
|
-
return { runner, files, command:
|
|
1672
|
+
if (command !== void 0) return { runner, files, command: `${command} ${quoted(files)}`, localBins: true };
|
|
1673
|
+
return { runner, files, command: scriptCommand(detectPackageManager3(cwd), files) };
|
|
1622
1674
|
}
|
|
1623
1675
|
function runFocusedTests(plan, cwd, options) {
|
|
1624
|
-
return runCommand(plan.command, cwd, options);
|
|
1676
|
+
return runCommand(plan.command, cwd, { ...options, localBins: plan.localBins });
|
|
1625
1677
|
}
|
|
1626
1678
|
function usableFocusedResult(cwd, result) {
|
|
1627
1679
|
if (result.success) return false;
|
|
@@ -2244,6 +2296,11 @@ var require_dist7 = __commonJS({
|
|
|
2244
2296
|
reducer: (_, value) => value ?? 3,
|
|
2245
2297
|
default: () => 3
|
|
2246
2298
|
}),
|
|
2299
|
+
/** The project's own build, lint and test commands (undefined = its package.json scripts) */
|
|
2300
|
+
commands: (0, import_langgraph.Annotation)({
|
|
2301
|
+
reducer: (_, value) => value,
|
|
2302
|
+
default: () => void 0
|
|
2303
|
+
}),
|
|
2247
2304
|
/** Per-command timeout in milliseconds for validation steps (undefined = no limit) */
|
|
2248
2305
|
timeoutMs: (0, import_langgraph.Annotation)({
|
|
2249
2306
|
reducer: (_, value) => value,
|
|
@@ -2785,7 +2842,7 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
2785
2842
|
async function validate(state) {
|
|
2786
2843
|
const options = { timeoutMs: state.timeoutMs };
|
|
2787
2844
|
if (state.focusTests !== false && state.progress?.last.step === "test") {
|
|
2788
|
-
const plan = (0, import_analyzers2.planFocusedTests)(state.cwd, state.logs);
|
|
2845
|
+
const plan = (0, import_analyzers2.planFocusedTests)(state.cwd, state.logs, state.commands?.test);
|
|
2789
2846
|
if (plan) {
|
|
2790
2847
|
console.log(
|
|
2791
2848
|
`[BugZero] Re-running only the failing test file${plan.files.length === 1 ? "" : "s"}: ${plan.files.join(", ")} (the full pipeline runs once they pass)\u2026`
|
|
@@ -2799,7 +2856,7 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
2799
2856
|
);
|
|
2800
2857
|
}
|
|
2801
2858
|
}
|
|
2802
|
-
return (0, import_analyzers2.runValidationPipeline)(state.cwd, options);
|
|
2859
|
+
return (0, import_analyzers2.runValidationPipeline)(state.cwd, { ...options, commands: state.commands });
|
|
2803
2860
|
}
|
|
2804
2861
|
async function verifyNode(state) {
|
|
2805
2862
|
if (state.patchFailed) {
|
|
@@ -3112,6 +3169,28 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3112
3169
|
}
|
|
3113
3170
|
return value;
|
|
3114
3171
|
}
|
|
3172
|
+
var STEP_NAMES = ["build", "lint", "test"];
|
|
3173
|
+
function resolveCommands(configured) {
|
|
3174
|
+
if (configured === void 0) return {};
|
|
3175
|
+
if (typeof configured !== "object" || configured === null || Array.isArray(configured)) {
|
|
3176
|
+
throw new Error(
|
|
3177
|
+
'commands in .bugzerorc must be an object such as {"build": "tsc -p .", "lint": false}, with any of build, lint and test.'
|
|
3178
|
+
);
|
|
3179
|
+
}
|
|
3180
|
+
const commands = {};
|
|
3181
|
+
for (const [step, command] of Object.entries(configured)) {
|
|
3182
|
+
if (!STEP_NAMES.includes(step)) {
|
|
3183
|
+
throw new Error(`commands in .bugzerorc: "${step}" is not a step. Use build, lint or test.`);
|
|
3184
|
+
}
|
|
3185
|
+
if (command !== false && (typeof command !== "string" || command.trim() === "")) {
|
|
3186
|
+
throw new Error(
|
|
3187
|
+
`commands.${step} in .bugzerorc must be a command to run, or false to skip the step (received ${JSON.stringify(command)}).`
|
|
3188
|
+
);
|
|
3189
|
+
}
|
|
3190
|
+
commands[step] = command;
|
|
3191
|
+
}
|
|
3192
|
+
return commands;
|
|
3193
|
+
}
|
|
3115
3194
|
var import_fs22 = __toESM2(require("fs"));
|
|
3116
3195
|
var import_path22 = __toESM2(require("path"));
|
|
3117
3196
|
function assertNodeProject(cwd) {
|
|
@@ -3133,7 +3212,15 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3133
3212
|
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.`;
|
|
3134
3213
|
return declined > 0 ? `${base} You declined ${declined} proposed ${plural}.` : base;
|
|
3135
3214
|
}
|
|
3215
|
+
function projectCommands(configured) {
|
|
3216
|
+
const commands = resolveCommands(configured);
|
|
3217
|
+
const listed = ["build", "lint", "test"].filter((step) => commands[step] !== void 0).map((step) => `${step}: ${commands[step] === false ? "off" : commands[step]}`);
|
|
3218
|
+
if (listed.length === 0) return void 0;
|
|
3219
|
+
console.log(`[BugZero] Commands from .bugzerorc: ${listed.join(" | ")}`);
|
|
3220
|
+
return commands;
|
|
3221
|
+
}
|
|
3136
3222
|
function statusLabel(result) {
|
|
3223
|
+
if (result.disabled) return "\u23ED\uFE0F Skipped (turned off in .bugzerorc)";
|
|
3137
3224
|
if (result.skipped) return "\u23ED\uFE0F Skipped (no script defined)";
|
|
3138
3225
|
return result.success ? "\u2705 Passed" : "\u274C Failed";
|
|
3139
3226
|
}
|
|
@@ -3141,10 +3228,12 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3141
3228
|
const cwd = options.cwd ?? process.cwd();
|
|
3142
3229
|
assertNodeProject(cwd);
|
|
3143
3230
|
const timeoutMs = resolveTimeoutMs2(options.timeoutSeconds);
|
|
3231
|
+
const commands = projectCommands((0, import_config2.getLocalConfig)(cwd).commands);
|
|
3232
|
+
const stepOptions = { timeoutMs, commands };
|
|
3144
3233
|
const [build, lint, test] = await Promise.all([
|
|
3145
|
-
(0, import_analyzers.runBuild)(cwd,
|
|
3146
|
-
(0, import_analyzers.runLint)(cwd,
|
|
3147
|
-
(0, import_analyzers.runTests)(cwd,
|
|
3234
|
+
(0, import_analyzers.runBuild)(cwd, stepOptions),
|
|
3235
|
+
(0, import_analyzers.runLint)(cwd, stepOptions),
|
|
3236
|
+
(0, import_analyzers.runTests)(cwd, stepOptions)
|
|
3148
3237
|
]);
|
|
3149
3238
|
await writeReport(cwd, "hunt", {
|
|
3150
3239
|
success: build.success && lint.success && test.success,
|
|
@@ -3166,6 +3255,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3166
3255
|
const maxTokens = resolveMaxTokens2(options.maxTokens, config.maxTokens);
|
|
3167
3256
|
const tools = resolveTools(options.tools, config.tools);
|
|
3168
3257
|
const maxToolRequests = resolveMaxToolRequests2(options.maxToolRequests, config.maxToolRequests);
|
|
3258
|
+
const commands = projectCommands(config.commands);
|
|
3169
3259
|
const announceTools = () => {
|
|
3170
3260
|
if (tools) {
|
|
3171
3261
|
console.log(
|
|
@@ -3176,7 +3266,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3176
3266
|
}
|
|
3177
3267
|
};
|
|
3178
3268
|
console.log(`[BugZero] Running validation pipeline in: ${cwd}`);
|
|
3179
|
-
const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd, { timeoutMs });
|
|
3269
|
+
const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd, { timeoutMs, commands });
|
|
3180
3270
|
if (pipelineResult.success) {
|
|
3181
3271
|
console.log("[BugZero] Validation already passing \u2014 nothing to fix.");
|
|
3182
3272
|
if (options.printPrompt) {
|
|
@@ -3235,6 +3325,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3235
3325
|
maxTokens,
|
|
3236
3326
|
tools,
|
|
3237
3327
|
maxToolRequests,
|
|
3328
|
+
commands,
|
|
3238
3329
|
initialStep: pipelineResult.step
|
|
3239
3330
|
});
|
|
3240
3331
|
const result = {
|
|
@@ -3779,7 +3870,10 @@ program.command("hunt").description("Run build, lint, and tests \u2014 report is
|
|
|
3779
3870
|
console.log();
|
|
3780
3871
|
const { build, lint, test } = await (0, import_core.orchestrate)({ cwd, timeoutSeconds, aiReport: opts.aiReport });
|
|
3781
3872
|
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");
|
|
3782
|
-
const label = (r) =>
|
|
3873
|
+
const label = (r) => {
|
|
3874
|
+
if (r.skipped) return r.disabled ? "\u23ED\uFE0F Skipped (turned off in .bugzerorc)" : "\u23ED\uFE0F Skipped (no script)";
|
|
3875
|
+
return r.success ? "\u2705 Passed" : "\u274C Failed (see report)";
|
|
3876
|
+
};
|
|
3783
3877
|
console.log(` Build: ${label(build)}`);
|
|
3784
3878
|
console.log(` Lint: ${label(lint)}`);
|
|
3785
3879
|
console.log(` Tests: ${label(test)}`);
|
|
@@ -3898,10 +3992,20 @@ program.command("rescue").description("Detect build failures and automatically a
|
|
|
3898
3992
|
program.command("undo").description("Put back the files BugZero changed, from the backups saved next to them").option("-p, --path <dir>", "Path to the target project", ".").option("--dry-run", "Show what would be restored without changing anything", false).option("--force", "Also restore files that were edited after BugZero fixed them (those edits are lost)", false).action((opts) => {
|
|
3899
3993
|
try {
|
|
3900
3994
|
const cwd = import_path2.default.resolve(opts.path);
|
|
3995
|
+
let settings;
|
|
3996
|
+
try {
|
|
3997
|
+
settings = (0, import_config.getProtectionSettings)(cwd);
|
|
3998
|
+
} catch (error) {
|
|
3999
|
+
console.warn(
|
|
4000
|
+
`
|
|
4001
|
+
\u26A0\uFE0F [BugZero] ${error.message}
|
|
4002
|
+
Undo is going ahead with the built-in protection rules; your protect and allow lists are not applied.`
|
|
4003
|
+
);
|
|
4004
|
+
}
|
|
3901
4005
|
const entries = (0, import_patcher2.undoChanges)(cwd, {
|
|
3902
4006
|
dryRun: opts.dryRun === true,
|
|
3903
4007
|
force: opts.force === true,
|
|
3904
|
-
protection: (0, import_shared3.createProtectedPathRules)(
|
|
4008
|
+
protection: (0, import_shared3.createProtectedPathRules)(settings)
|
|
3905
4009
|
});
|
|
3906
4010
|
const summary = buildUndoSummary(entries, { dryRun: opts.dryRun === true });
|
|
3907
4011
|
console.log();
|
|
@@ -3923,6 +4027,15 @@ program.command("vibe").description("Select which AI model (brain) to use for re
|
|
|
3923
4027
|
const { getLocalConfig, saveLocalConfig } = await Promise.resolve().then(() => __toESM(require_dist()));
|
|
3924
4028
|
const readline2 = await import("readline");
|
|
3925
4029
|
const axios = (await import("axios")).default;
|
|
4030
|
+
let currentModel;
|
|
4031
|
+
try {
|
|
4032
|
+
currentModel = getLocalConfig().model || "deepseek/deepseek-chat";
|
|
4033
|
+
} catch (error) {
|
|
4034
|
+
console.error(`
|
|
4035
|
+
\u274C [BugZero] Execution failed: ${error.message}`);
|
|
4036
|
+
process.exitCode = 1;
|
|
4037
|
+
return;
|
|
4038
|
+
}
|
|
3926
4039
|
console.log(`
|
|
3927
4040
|
\u{1F9E0} BugZero Brain Selector`);
|
|
3928
4041
|
console.log(`\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
|
|
@@ -3955,7 +4068,6 @@ program.command("vibe").description("Select which AI model (brain) to use for re
|
|
|
3955
4068
|
{ id: "meta-llama/llama-3.3-70b-instruct", name: "Llama 3.3 Instruct" }
|
|
3956
4069
|
];
|
|
3957
4070
|
}
|
|
3958
|
-
const currentModel = getLocalConfig().model || "deepseek/deepseek-chat";
|
|
3959
4071
|
console.log(`
|
|
3960
4072
|
Current active model: \x1B[36m${currentModel}\x1B[0m
|
|
3961
4073
|
`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugzero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66",
|
|
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)",
|