bugzero 0.0.64 → 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 +25 -2
- package/dist/index.js +82 -20
- 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,34 @@ 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
|
+
### 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
|
@@ -1366,6 +1366,7 @@ var require_dist4 = __commonJS({
|
|
|
1366
1366
|
runFocusedTests: () => runFocusedTests,
|
|
1367
1367
|
runLint: () => runLint,
|
|
1368
1368
|
runScript: () => runScript,
|
|
1369
|
+
runStep: () => runStep,
|
|
1369
1370
|
runTests: () => runTests,
|
|
1370
1371
|
runValidationPipeline: () => runValidationPipeline,
|
|
1371
1372
|
usableFocusedResult: () => usableFocusedResult
|
|
@@ -1425,6 +1426,8 @@ var require_dist4 = __commonJS({
|
|
|
1425
1426
|
shell: true,
|
|
1426
1427
|
cwd: cwd ?? process.cwd(),
|
|
1427
1428
|
all: true,
|
|
1429
|
+
preferLocal: options.localBins === true,
|
|
1430
|
+
localDir: cwd ?? process.cwd(),
|
|
1428
1431
|
env: {
|
|
1429
1432
|
...process.env,
|
|
1430
1433
|
CI: "true"
|
|
@@ -1488,15 +1491,21 @@ var require_dist4 = __commonJS({
|
|
|
1488
1491
|
return void 0;
|
|
1489
1492
|
}
|
|
1490
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
|
+
}
|
|
1491
1500
|
async function runScript(script, cwd, options) {
|
|
1492
1501
|
if (!readScripts(cwd).includes(script)) {
|
|
1493
1502
|
return { success: true, output: "", skipped: true };
|
|
1494
1503
|
}
|
|
1495
1504
|
return runCommand(getRunScriptCommand(detectPackageManager3(cwd), script), cwd, options);
|
|
1496
1505
|
}
|
|
1497
|
-
var runBuild = (cwd, options) =>
|
|
1498
|
-
var runLint = (cwd, options) =>
|
|
1499
|
-
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);
|
|
1500
1509
|
var TS_ERROR_RE = /^(.+)\((\d+),(\d+)\):\s+error\s+TS\d+:\s+(.+)$/gm;
|
|
1501
1510
|
var ESLINT_ERROR_RE = /^\s+(\d+):(\d+)\s+error\s+(.+)$/gm;
|
|
1502
1511
|
var JEST_FAIL_RE = /● (.+)/g;
|
|
@@ -1556,20 +1565,29 @@ var require_dist4 = __commonJS({
|
|
|
1556
1565
|
const targetCwd = cwd ?? process.cwd();
|
|
1557
1566
|
const scripts = readScripts(targetCwd);
|
|
1558
1567
|
let ranAnyStep = false;
|
|
1568
|
+
let turnedOff = false;
|
|
1559
1569
|
for (const { step, label, run } of STEPS) {
|
|
1560
|
-
|
|
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)) {
|
|
1561
1577
|
console.log(`[BugZero] Skipping ${label}: no "${step}" script in package.json.`);
|
|
1562
1578
|
continue;
|
|
1563
1579
|
}
|
|
1564
1580
|
ranAnyStep = true;
|
|
1565
|
-
console.log(`[BugZero] Running ${label}...`);
|
|
1581
|
+
console.log(command === void 0 ? `[BugZero] Running ${label}...` : `[BugZero] Running ${label}: ${command}`);
|
|
1566
1582
|
const result = await run(targetCwd, options);
|
|
1567
1583
|
if (!result.success) {
|
|
1568
1584
|
return { success: false, step, output: result.output };
|
|
1569
1585
|
}
|
|
1570
1586
|
}
|
|
1571
1587
|
if (!ranAnyStep) {
|
|
1572
|
-
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
|
+
);
|
|
1573
1591
|
}
|
|
1574
1592
|
return { success: true, step: "none", output: "" };
|
|
1575
1593
|
}
|
|
@@ -1609,19 +1627,21 @@ var require_dist4 = __commonJS({
|
|
|
1609
1627
|
}
|
|
1610
1628
|
return files.length > MAX_FOCUSED_FILES ? [] : files;
|
|
1611
1629
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
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)}`;
|
|
1615
1633
|
}
|
|
1616
|
-
function planFocusedTests(cwd, output) {
|
|
1617
|
-
|
|
1634
|
+
function planFocusedTests(cwd, output, command) {
|
|
1635
|
+
if (command === false) return null;
|
|
1636
|
+
const runner = detectTestRunner(command ?? readScriptText(cwd, "test"));
|
|
1618
1637
|
if (runner === null) return null;
|
|
1619
1638
|
const files = findFailingTestFiles(cwd, output);
|
|
1620
1639
|
if (files.length === 0) return null;
|
|
1621
|
-
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) };
|
|
1622
1642
|
}
|
|
1623
1643
|
function runFocusedTests(plan, cwd, options) {
|
|
1624
|
-
return runCommand(plan.command, cwd, options);
|
|
1644
|
+
return runCommand(plan.command, cwd, { ...options, localBins: plan.localBins });
|
|
1625
1645
|
}
|
|
1626
1646
|
function usableFocusedResult(cwd, result) {
|
|
1627
1647
|
if (result.success) return false;
|
|
@@ -2244,6 +2264,11 @@ var require_dist7 = __commonJS({
|
|
|
2244
2264
|
reducer: (_, value) => value ?? 3,
|
|
2245
2265
|
default: () => 3
|
|
2246
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
|
+
}),
|
|
2247
2272
|
/** Per-command timeout in milliseconds for validation steps (undefined = no limit) */
|
|
2248
2273
|
timeoutMs: (0, import_langgraph.Annotation)({
|
|
2249
2274
|
reducer: (_, value) => value,
|
|
@@ -2785,7 +2810,7 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
2785
2810
|
async function validate(state) {
|
|
2786
2811
|
const options = { timeoutMs: state.timeoutMs };
|
|
2787
2812
|
if (state.focusTests !== false && state.progress?.last.step === "test") {
|
|
2788
|
-
const plan = (0, import_analyzers2.planFocusedTests)(state.cwd, state.logs);
|
|
2813
|
+
const plan = (0, import_analyzers2.planFocusedTests)(state.cwd, state.logs, state.commands?.test);
|
|
2789
2814
|
if (plan) {
|
|
2790
2815
|
console.log(
|
|
2791
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`
|
|
@@ -2799,7 +2824,7 @@ Any other files from that same suggestion were rolled back to keep the change at
|
|
|
2799
2824
|
);
|
|
2800
2825
|
}
|
|
2801
2826
|
}
|
|
2802
|
-
return (0, import_analyzers2.runValidationPipeline)(state.cwd, options);
|
|
2827
|
+
return (0, import_analyzers2.runValidationPipeline)(state.cwd, { ...options, commands: state.commands });
|
|
2803
2828
|
}
|
|
2804
2829
|
async function verifyNode(state) {
|
|
2805
2830
|
if (state.patchFailed) {
|
|
@@ -3112,6 +3137,28 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3112
3137
|
}
|
|
3113
3138
|
return value;
|
|
3114
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
|
+
}
|
|
3115
3162
|
var import_fs22 = __toESM2(require("fs"));
|
|
3116
3163
|
var import_path22 = __toESM2(require("path"));
|
|
3117
3164
|
function assertNodeProject(cwd) {
|
|
@@ -3133,7 +3180,15 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3133
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.`;
|
|
3134
3181
|
return declined > 0 ? `${base} You declined ${declined} proposed ${plural}.` : base;
|
|
3135
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
|
+
}
|
|
3136
3190
|
function statusLabel(result) {
|
|
3191
|
+
if (result.disabled) return "\u23ED\uFE0F Skipped (turned off in .bugzerorc)";
|
|
3137
3192
|
if (result.skipped) return "\u23ED\uFE0F Skipped (no script defined)";
|
|
3138
3193
|
return result.success ? "\u2705 Passed" : "\u274C Failed";
|
|
3139
3194
|
}
|
|
@@ -3141,10 +3196,12 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3141
3196
|
const cwd = options.cwd ?? process.cwd();
|
|
3142
3197
|
assertNodeProject(cwd);
|
|
3143
3198
|
const timeoutMs = resolveTimeoutMs2(options.timeoutSeconds);
|
|
3199
|
+
const commands = projectCommands((0, import_config2.getLocalConfig)(cwd).commands);
|
|
3200
|
+
const stepOptions = { timeoutMs, commands };
|
|
3144
3201
|
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,
|
|
3202
|
+
(0, import_analyzers.runBuild)(cwd, stepOptions),
|
|
3203
|
+
(0, import_analyzers.runLint)(cwd, stepOptions),
|
|
3204
|
+
(0, import_analyzers.runTests)(cwd, stepOptions)
|
|
3148
3205
|
]);
|
|
3149
3206
|
await writeReport(cwd, "hunt", {
|
|
3150
3207
|
success: build.success && lint.success && test.success,
|
|
@@ -3166,6 +3223,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3166
3223
|
const maxTokens = resolveMaxTokens2(options.maxTokens, config.maxTokens);
|
|
3167
3224
|
const tools = resolveTools(options.tools, config.tools);
|
|
3168
3225
|
const maxToolRequests = resolveMaxToolRequests2(options.maxToolRequests, config.maxToolRequests);
|
|
3226
|
+
const commands = projectCommands(config.commands);
|
|
3169
3227
|
const announceTools = () => {
|
|
3170
3228
|
if (tools) {
|
|
3171
3229
|
console.log(
|
|
@@ -3176,7 +3234,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3176
3234
|
}
|
|
3177
3235
|
};
|
|
3178
3236
|
console.log(`[BugZero] Running validation pipeline in: ${cwd}`);
|
|
3179
|
-
const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd, { timeoutMs });
|
|
3237
|
+
const pipelineResult = await (0, import_analyzers.runValidationPipeline)(cwd, { timeoutMs, commands });
|
|
3180
3238
|
if (pipelineResult.success) {
|
|
3181
3239
|
console.log("[BugZero] Validation already passing \u2014 nothing to fix.");
|
|
3182
3240
|
if (options.printPrompt) {
|
|
@@ -3235,6 +3293,7 @@ Re-run without \`--dry-run\` to let BugZero attempt a fix.
|
|
|
3235
3293
|
maxTokens,
|
|
3236
3294
|
tools,
|
|
3237
3295
|
maxToolRequests,
|
|
3296
|
+
commands,
|
|
3238
3297
|
initialStep: pipelineResult.step
|
|
3239
3298
|
});
|
|
3240
3299
|
const result = {
|
|
@@ -3779,7 +3838,10 @@ program.command("hunt").description("Run build, lint, and tests \u2014 report is
|
|
|
3779
3838
|
console.log();
|
|
3780
3839
|
const { build, lint, test } = await (0, import_core.orchestrate)({ cwd, timeoutSeconds, aiReport: opts.aiReport });
|
|
3781
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");
|
|
3782
|
-
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
|
+
};
|
|
3783
3845
|
console.log(` Build: ${label(build)}`);
|
|
3784
3846
|
console.log(` Lint: ${label(lint)}`);
|
|
3785
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)",
|