bugzero 0.0.38 → 0.0.40
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 +1 -1
- package/dist/index.js +55 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ bugzero rescue
|
|
|
100
100
|
### Safety
|
|
101
101
|
|
|
102
102
|
- **Backups on every patch.** Each file BugZero modifies gets a `.opspilot.bak` copy of its original content first.
|
|
103
|
-
- **Dry-run mode.** `bugzero rescue --dry-run` runs validation and error analysis, but makes no fix attempts and never modifies your source files (a report is still written).
|
|
103
|
+
- **Dry-run mode.** `bugzero rescue --dry-run` runs validation and error analysis, but makes no fix attempts and never modifies your source files (a report is still written). 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.
|
|
104
104
|
- **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.
|
|
105
105
|
|
|
106
106
|
### Project awareness
|
package/dist/index.js
CHANGED
|
@@ -1816,6 +1816,58 @@ var import_commander = require("commander");
|
|
|
1816
1816
|
var import_fs = __toESM(require("fs"));
|
|
1817
1817
|
var import_path = __toESM(require("path"));
|
|
1818
1818
|
var import_core = __toESM(require_dist7());
|
|
1819
|
+
|
|
1820
|
+
// src/summary.ts
|
|
1821
|
+
function tokenLines(result) {
|
|
1822
|
+
if (result.promptTokens === void 0 || result.completionTokens === void 0) return [];
|
|
1823
|
+
const total = result.promptTokens + result.completionTokens;
|
|
1824
|
+
return [` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${total}`];
|
|
1825
|
+
}
|
|
1826
|
+
function buildRescueSummary(result, options) {
|
|
1827
|
+
if (result.success && result.attempts === 0) {
|
|
1828
|
+
return {
|
|
1829
|
+
exitCode: 0,
|
|
1830
|
+
lines: ["\u2705 Nothing to fix \u2014 your project already passes its build, lint, and tests."]
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
if (result.success) {
|
|
1834
|
+
const lines2 = [
|
|
1835
|
+
`\u2705 Build fixed after ${result.attempts} attempt(s)!`,
|
|
1836
|
+
` Model: ${result.modelUsed || "unknown"}`,
|
|
1837
|
+
...tokenLines(result)
|
|
1838
|
+
];
|
|
1839
|
+
if (result.appliedFix) {
|
|
1840
|
+
const { patches, explanation, rootCause } = result.appliedFix;
|
|
1841
|
+
lines2.push(
|
|
1842
|
+
` File${patches.length === 1 ? "" : "s"}: ${patches.map((p) => p.filePath).join(", ")}`,
|
|
1843
|
+
` Reason: ${explanation}`,
|
|
1844
|
+
` Root cause: ${rootCause}`
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1847
|
+
return { exitCode: 0, lines: lines2 };
|
|
1848
|
+
}
|
|
1849
|
+
if (options.dryRun) {
|
|
1850
|
+
return {
|
|
1851
|
+
exitCode: 1,
|
|
1852
|
+
lines: [
|
|
1853
|
+
"\u{1F50D} Dry run complete \u2014 failures were detected, but no fixes were attempted and no files were modified.",
|
|
1854
|
+
" Re-run without --dry-run to let BugZero attempt a fix.",
|
|
1855
|
+
"",
|
|
1856
|
+
"\u{1F449} Full error logs have been listed in the generated report."
|
|
1857
|
+
]
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
const lines = [
|
|
1861
|
+
`\u274C Could not fix build after ${result.attempts} attempt(s).`,
|
|
1862
|
+
` Model: ${result.modelUsed || "unknown"}`,
|
|
1863
|
+
...tokenLines(result)
|
|
1864
|
+
];
|
|
1865
|
+
if (result.error) lines.push(` ${result.error}`);
|
|
1866
|
+
lines.push("", "\u{1F449} Full unresolved error logs have been listed in the generated report.");
|
|
1867
|
+
return { exitCode: 1, lines };
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
// src/index.ts
|
|
1819
1871
|
var { version } = JSON.parse(import_fs.default.readFileSync(import_path.default.join(__dirname, "..", "package.json"), "utf-8"));
|
|
1820
1872
|
var program = new import_commander.Command();
|
|
1821
1873
|
program.name("bugzero").description("AI-powered build issue fixer \u2014 detects and repairs build errors automatically").version(version);
|
|
@@ -1865,30 +1917,10 @@ program.command("rescue").description("Detect build failures and automatically a
|
|
|
1865
1917
|
console.log();
|
|
1866
1918
|
const result = await (0, import_core.orchestrateAndFix)({ cwd, maxAttempts, dryRun });
|
|
1867
1919
|
console.log("\n\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");
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
console.log(` Model: ${result.modelUsed || "unknown"}`);
|
|
1871
|
-
if (result.promptTokens !== void 0 && result.completionTokens !== void 0) {
|
|
1872
|
-
console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
|
|
1873
|
-
}
|
|
1874
|
-
if (result.appliedFix) {
|
|
1875
|
-
const files = result.appliedFix.patches.map((p) => p.filePath).join(", ");
|
|
1876
|
-
console.log(` File${result.appliedFix.patches.length === 1 ? "" : "s"}: ${files}`);
|
|
1877
|
-
console.log(` Reason: ${result.appliedFix.explanation}`);
|
|
1878
|
-
console.log(` Root cause: ${result.appliedFix.rootCause}`);
|
|
1879
|
-
}
|
|
1880
|
-
} else {
|
|
1881
|
-
console.log(`\u274C Could not fix build after ${result.attempts} attempt(s).`);
|
|
1882
|
-
console.log(` Model: ${result.modelUsed || "unknown"}`);
|
|
1883
|
-
if (result.promptTokens !== void 0 && result.completionTokens !== void 0) {
|
|
1884
|
-
console.log(` Tokens: Prompt: ${result.promptTokens} | Completion: ${result.completionTokens} | Total: ${result.promptTokens + result.completionTokens}`);
|
|
1885
|
-
}
|
|
1886
|
-
if (result.error) console.log(` ${result.error}`);
|
|
1887
|
-
console.log(`
|
|
1888
|
-
\u{1F449} Full unresolved error logs have been listed in the generated report.`);
|
|
1889
|
-
}
|
|
1920
|
+
const summary = buildRescueSummary(result, { dryRun });
|
|
1921
|
+
for (const line of summary.lines) console.log(line);
|
|
1890
1922
|
console.log();
|
|
1891
|
-
process.exit(
|
|
1923
|
+
process.exit(summary.exitCode);
|
|
1892
1924
|
} catch (error) {
|
|
1893
1925
|
console.error(`
|
|
1894
1926
|
\u274C [BugZero] Execution failed: ${error.message || error}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugzero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
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)",
|