bugzero 0.0.7 → 0.0.9
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/.turbo/turbo-build.log +6 -8
- package/README.md +0 -5
- package/dist/index.js +521 -112
- package/package.json +5 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
> bugzero@0.0.
|
|
3
|
-
> tsup src/index.ts --format
|
|
2
|
+
> bugzero@0.0.9 build D:\WD projects\OpsPilot\packages\cli
|
|
3
|
+
> tsup src/index.ts --format cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[32mESM[39m [1mdist\chunk-4ANZDGVD.js [22m[32m16.11 KB[39m
|
|
13
|
-
[32mESM[39m ⚡️ Build success in 150ms
|
|
9
|
+
[34mCJS[39m Build start
|
|
10
|
+
[32mCJS[39m [1mdist\index.js [22m[32m47.20 KB[39m
|
|
11
|
+
[32mCJS[39m ⚡️ Build success in 122ms
|
|
14
12
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 1127ms
|
|
16
14
|
[32mDTS[39m [1mdist\index.d.ts [22m[32m20.00 B[39m
|
package/README.md
CHANGED
|
@@ -239,8 +239,3 @@ If BugZero saved you debugging hours in production or deployment pipelines, cons
|
|
|
239
239
|
|
|
240
240
|
[](https://www.buymeacoffee.com/saksham_)
|
|
241
241
|
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
## License
|
|
245
|
-
|
|
246
|
-
MIT — see [LICENSE](LICENSE) for details.
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,441 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
// ../../node_modules/.pnpm/dotenv@17.4.2/node_modules/dotenv/lib/main.js
|
|
30
|
+
var require_main = __commonJS({
|
|
31
|
+
"../../node_modules/.pnpm/dotenv@17.4.2/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
32
|
+
"use strict";
|
|
33
|
+
var fs = require("fs");
|
|
34
|
+
var path2 = require("path");
|
|
35
|
+
var os = require("os");
|
|
36
|
+
var crypto = require("crypto");
|
|
37
|
+
var TIPS = [
|
|
38
|
+
"\u25C8 encrypted .env [www.dotenvx.com]",
|
|
39
|
+
"\u25C8 secrets for agents [www.dotenvx.com]",
|
|
40
|
+
"\u2301 auth for agents [www.vestauth.com]",
|
|
41
|
+
"\u2318 custom filepath { path: '/custom/path/.env' }",
|
|
42
|
+
"\u2318 enable debugging { debug: true }",
|
|
43
|
+
"\u2318 override existing { override: true }",
|
|
44
|
+
"\u2318 suppress logs { quiet: true }",
|
|
45
|
+
"\u2318 multiple files { path: ['.env.local', '.env'] }"
|
|
46
|
+
];
|
|
47
|
+
function _getRandomTip() {
|
|
48
|
+
return TIPS[Math.floor(Math.random() * TIPS.length)];
|
|
49
|
+
}
|
|
50
|
+
function parseBoolean(value) {
|
|
51
|
+
if (typeof value === "string") {
|
|
52
|
+
return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
|
|
53
|
+
}
|
|
54
|
+
return Boolean(value);
|
|
55
|
+
}
|
|
56
|
+
function supportsAnsi() {
|
|
57
|
+
return process.stdout.isTTY;
|
|
58
|
+
}
|
|
59
|
+
function dim(text) {
|
|
60
|
+
return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
|
|
61
|
+
}
|
|
62
|
+
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
63
|
+
function parse(src) {
|
|
64
|
+
const obj = {};
|
|
65
|
+
let lines = src.toString();
|
|
66
|
+
lines = lines.replace(/\r\n?/mg, "\n");
|
|
67
|
+
let match;
|
|
68
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
69
|
+
const key = match[1];
|
|
70
|
+
let value = match[2] || "";
|
|
71
|
+
value = value.trim();
|
|
72
|
+
const maybeQuote = value[0];
|
|
73
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
74
|
+
if (maybeQuote === '"') {
|
|
75
|
+
value = value.replace(/\\n/g, "\n");
|
|
76
|
+
value = value.replace(/\\r/g, "\r");
|
|
77
|
+
}
|
|
78
|
+
obj[key] = value;
|
|
79
|
+
}
|
|
80
|
+
return obj;
|
|
81
|
+
}
|
|
82
|
+
function _parseVault(options) {
|
|
83
|
+
options = options || {};
|
|
84
|
+
const vaultPath = _vaultPath(options);
|
|
85
|
+
options.path = vaultPath;
|
|
86
|
+
const result = DotenvModule.configDotenv(options);
|
|
87
|
+
if (!result.parsed) {
|
|
88
|
+
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
89
|
+
err.code = "MISSING_DATA";
|
|
90
|
+
throw err;
|
|
91
|
+
}
|
|
92
|
+
const keys = _dotenvKey(options).split(",");
|
|
93
|
+
const length = keys.length;
|
|
94
|
+
let decrypted;
|
|
95
|
+
for (let i = 0; i < length; i++) {
|
|
96
|
+
try {
|
|
97
|
+
const key = keys[i].trim();
|
|
98
|
+
const attrs = _instructions(result, key);
|
|
99
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
100
|
+
break;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (i + 1 >= length) {
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return DotenvModule.parse(decrypted);
|
|
108
|
+
}
|
|
109
|
+
function _warn(message) {
|
|
110
|
+
console.error(`\u26A0 ${message}`);
|
|
111
|
+
}
|
|
112
|
+
function _debug(message) {
|
|
113
|
+
console.log(`\u2506 ${message}`);
|
|
114
|
+
}
|
|
115
|
+
function _log(message) {
|
|
116
|
+
console.log(`\u25C7 ${message}`);
|
|
117
|
+
}
|
|
118
|
+
function _dotenvKey(options) {
|
|
119
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
120
|
+
return options.DOTENV_KEY;
|
|
121
|
+
}
|
|
122
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
123
|
+
return process.env.DOTENV_KEY;
|
|
124
|
+
}
|
|
125
|
+
return "";
|
|
126
|
+
}
|
|
127
|
+
function _instructions(result, dotenvKey) {
|
|
128
|
+
let uri;
|
|
129
|
+
try {
|
|
130
|
+
uri = new URL(dotenvKey);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (error.code === "ERR_INVALID_URL") {
|
|
133
|
+
const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
134
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
const key = uri.password;
|
|
140
|
+
if (!key) {
|
|
141
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
142
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
143
|
+
throw err;
|
|
144
|
+
}
|
|
145
|
+
const environment = uri.searchParams.get("environment");
|
|
146
|
+
if (!environment) {
|
|
147
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
148
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
149
|
+
throw err;
|
|
150
|
+
}
|
|
151
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
152
|
+
const ciphertext = result.parsed[environmentKey];
|
|
153
|
+
if (!ciphertext) {
|
|
154
|
+
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
155
|
+
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
156
|
+
throw err;
|
|
157
|
+
}
|
|
158
|
+
return { ciphertext, key };
|
|
159
|
+
}
|
|
160
|
+
function _vaultPath(options) {
|
|
161
|
+
let possibleVaultPath = null;
|
|
162
|
+
if (options && options.path && options.path.length > 0) {
|
|
163
|
+
if (Array.isArray(options.path)) {
|
|
164
|
+
for (const filepath of options.path) {
|
|
165
|
+
if (fs.existsSync(filepath)) {
|
|
166
|
+
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
possibleVaultPath = path2.resolve(process.cwd(), ".env.vault");
|
|
174
|
+
}
|
|
175
|
+
if (fs.existsSync(possibleVaultPath)) {
|
|
176
|
+
return possibleVaultPath;
|
|
177
|
+
}
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
function _resolveHome(envPath) {
|
|
181
|
+
return envPath[0] === "~" ? path2.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
182
|
+
}
|
|
183
|
+
function _configVault(options) {
|
|
184
|
+
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
185
|
+
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
186
|
+
if (debug || !quiet) {
|
|
187
|
+
_log("loading env from encrypted .env.vault");
|
|
188
|
+
}
|
|
189
|
+
const parsed = DotenvModule._parseVault(options);
|
|
190
|
+
let processEnv = process.env;
|
|
191
|
+
if (options && options.processEnv != null) {
|
|
192
|
+
processEnv = options.processEnv;
|
|
193
|
+
}
|
|
194
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
195
|
+
return { parsed };
|
|
196
|
+
}
|
|
197
|
+
function configDotenv(options) {
|
|
198
|
+
const dotenvPath = path2.resolve(process.cwd(), ".env");
|
|
199
|
+
let encoding = "utf8";
|
|
200
|
+
let processEnv = process.env;
|
|
201
|
+
if (options && options.processEnv != null) {
|
|
202
|
+
processEnv = options.processEnv;
|
|
203
|
+
}
|
|
204
|
+
let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
205
|
+
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
206
|
+
if (options && options.encoding) {
|
|
207
|
+
encoding = options.encoding;
|
|
208
|
+
} else {
|
|
209
|
+
if (debug) {
|
|
210
|
+
_debug("no encoding is specified (UTF-8 is used by default)");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
let optionPaths = [dotenvPath];
|
|
214
|
+
if (options && options.path) {
|
|
215
|
+
if (!Array.isArray(options.path)) {
|
|
216
|
+
optionPaths = [_resolveHome(options.path)];
|
|
217
|
+
} else {
|
|
218
|
+
optionPaths = [];
|
|
219
|
+
for (const filepath of options.path) {
|
|
220
|
+
optionPaths.push(_resolveHome(filepath));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
let lastError;
|
|
225
|
+
const parsedAll = {};
|
|
226
|
+
for (const path3 of optionPaths) {
|
|
227
|
+
try {
|
|
228
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path3, { encoding }));
|
|
229
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
|
230
|
+
} catch (e) {
|
|
231
|
+
if (debug) {
|
|
232
|
+
_debug(`failed to load ${path3} ${e.message}`);
|
|
233
|
+
}
|
|
234
|
+
lastError = e;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
238
|
+
debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
|
|
239
|
+
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
240
|
+
if (debug || !quiet) {
|
|
241
|
+
const keysCount = Object.keys(populated).length;
|
|
242
|
+
const shortPaths = [];
|
|
243
|
+
for (const filePath of optionPaths) {
|
|
244
|
+
try {
|
|
245
|
+
const relative = path2.relative(process.cwd(), filePath);
|
|
246
|
+
shortPaths.push(relative);
|
|
247
|
+
} catch (e) {
|
|
248
|
+
if (debug) {
|
|
249
|
+
_debug(`failed to load ${filePath} ${e.message}`);
|
|
250
|
+
}
|
|
251
|
+
lastError = e;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
_log(`injected env (${keysCount}) from ${shortPaths.join(",")} ${dim(`// tip: ${_getRandomTip()}`)}`);
|
|
255
|
+
}
|
|
256
|
+
if (lastError) {
|
|
257
|
+
return { parsed: parsedAll, error: lastError };
|
|
258
|
+
} else {
|
|
259
|
+
return { parsed: parsedAll };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function config(options) {
|
|
263
|
+
if (_dotenvKey(options).length === 0) {
|
|
264
|
+
return DotenvModule.configDotenv(options);
|
|
265
|
+
}
|
|
266
|
+
const vaultPath = _vaultPath(options);
|
|
267
|
+
if (!vaultPath) {
|
|
268
|
+
_warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`);
|
|
269
|
+
return DotenvModule.configDotenv(options);
|
|
270
|
+
}
|
|
271
|
+
return DotenvModule._configVault(options);
|
|
272
|
+
}
|
|
273
|
+
function decrypt(encrypted, keyStr) {
|
|
274
|
+
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
275
|
+
let ciphertext = Buffer.from(encrypted, "base64");
|
|
276
|
+
const nonce = ciphertext.subarray(0, 12);
|
|
277
|
+
const authTag = ciphertext.subarray(-16);
|
|
278
|
+
ciphertext = ciphertext.subarray(12, -16);
|
|
279
|
+
try {
|
|
280
|
+
const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
|
|
281
|
+
aesgcm.setAuthTag(authTag);
|
|
282
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
283
|
+
} catch (error) {
|
|
284
|
+
const isRange = error instanceof RangeError;
|
|
285
|
+
const invalidKeyLength = error.message === "Invalid key length";
|
|
286
|
+
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
287
|
+
if (isRange || invalidKeyLength) {
|
|
288
|
+
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
289
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
290
|
+
throw err;
|
|
291
|
+
} else if (decryptionFailed) {
|
|
292
|
+
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
293
|
+
err.code = "DECRYPTION_FAILED";
|
|
294
|
+
throw err;
|
|
295
|
+
} else {
|
|
296
|
+
throw error;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function populate(processEnv, parsed, options = {}) {
|
|
301
|
+
const debug = Boolean(options && options.debug);
|
|
302
|
+
const override = Boolean(options && options.override);
|
|
303
|
+
const populated = {};
|
|
304
|
+
if (typeof parsed !== "object") {
|
|
305
|
+
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
306
|
+
err.code = "OBJECT_REQUIRED";
|
|
307
|
+
throw err;
|
|
308
|
+
}
|
|
309
|
+
for (const key of Object.keys(parsed)) {
|
|
310
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
311
|
+
if (override === true) {
|
|
312
|
+
processEnv[key] = parsed[key];
|
|
313
|
+
populated[key] = parsed[key];
|
|
314
|
+
}
|
|
315
|
+
if (debug) {
|
|
316
|
+
if (override === true) {
|
|
317
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
318
|
+
} else {
|
|
319
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
processEnv[key] = parsed[key];
|
|
324
|
+
populated[key] = parsed[key];
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return populated;
|
|
328
|
+
}
|
|
329
|
+
var DotenvModule = {
|
|
330
|
+
configDotenv,
|
|
331
|
+
_configVault,
|
|
332
|
+
_parseVault,
|
|
333
|
+
config,
|
|
334
|
+
decrypt,
|
|
335
|
+
parse,
|
|
336
|
+
populate
|
|
337
|
+
};
|
|
338
|
+
module2.exports.configDotenv = DotenvModule.configDotenv;
|
|
339
|
+
module2.exports._configVault = DotenvModule._configVault;
|
|
340
|
+
module2.exports._parseVault = DotenvModule._parseVault;
|
|
341
|
+
module2.exports.config = DotenvModule.config;
|
|
342
|
+
module2.exports.decrypt = DotenvModule.decrypt;
|
|
343
|
+
module2.exports.parse = DotenvModule.parse;
|
|
344
|
+
module2.exports.populate = DotenvModule.populate;
|
|
345
|
+
module2.exports = DotenvModule;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
// ../config/dist/index.js
|
|
350
|
+
var require_dist = __commonJS({
|
|
351
|
+
"../config/dist/index.js"(exports2, module2) {
|
|
352
|
+
"use strict";
|
|
353
|
+
var __create2 = Object.create;
|
|
354
|
+
var __defProp2 = Object.defineProperty;
|
|
355
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
356
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
357
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
358
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
359
|
+
var __export = (target, all) => {
|
|
360
|
+
for (var name in all)
|
|
361
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
362
|
+
};
|
|
363
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
364
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
365
|
+
for (let key of __getOwnPropNames2(from))
|
|
366
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
367
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
368
|
+
}
|
|
369
|
+
return to;
|
|
370
|
+
};
|
|
371
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
372
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
373
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
374
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
375
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
376
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
377
|
+
mod
|
|
378
|
+
));
|
|
379
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
380
|
+
var index_exports = {};
|
|
381
|
+
__export(index_exports, {
|
|
382
|
+
env: () => env,
|
|
383
|
+
getLocalConfig: () => getLocalConfig,
|
|
384
|
+
getSelectedModel: () => getSelectedModel,
|
|
385
|
+
saveLocalConfig: () => saveLocalConfig
|
|
386
|
+
});
|
|
387
|
+
module2.exports = __toCommonJS(index_exports);
|
|
388
|
+
var import_dotenv = __toESM2(require_main());
|
|
389
|
+
import_dotenv.default.config();
|
|
390
|
+
var env = {
|
|
391
|
+
openRouterKey: process.env.OPENROUTER_API_KEY
|
|
392
|
+
};
|
|
393
|
+
var import_fs = __toESM2(require("fs"));
|
|
394
|
+
var import_path2 = __toESM2(require("path"));
|
|
395
|
+
var CONFIG_FILENAME = ".bugzerorc";
|
|
396
|
+
function getLocalConfig(cwd = process.cwd()) {
|
|
397
|
+
try {
|
|
398
|
+
const configPath = import_path2.default.resolve(cwd, CONFIG_FILENAME);
|
|
399
|
+
if (import_fs.default.existsSync(configPath)) {
|
|
400
|
+
const content = import_fs.default.readFileSync(configPath, "utf-8");
|
|
401
|
+
return JSON.parse(content);
|
|
402
|
+
}
|
|
403
|
+
} catch (e) {
|
|
404
|
+
}
|
|
405
|
+
return {};
|
|
406
|
+
}
|
|
407
|
+
function saveLocalConfig(config, cwd = process.cwd()) {
|
|
408
|
+
const configPath = import_path2.default.resolve(cwd, CONFIG_FILENAME);
|
|
409
|
+
import_fs.default.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
410
|
+
}
|
|
411
|
+
function getSelectedModel(cwd = process.cwd()) {
|
|
412
|
+
const config = getLocalConfig(cwd);
|
|
413
|
+
return config.model || "deepseek/deepseek-chat";
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
});
|
|
8
417
|
|
|
9
418
|
// ../analyzers/dist/index.js
|
|
10
419
|
var require_dist2 = __commonJS({
|
|
11
|
-
"../analyzers/dist/index.js"(
|
|
420
|
+
"../analyzers/dist/index.js"(exports2, module2) {
|
|
12
421
|
"use strict";
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
422
|
+
var __defProp2 = Object.defineProperty;
|
|
423
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
424
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
425
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
17
426
|
var __export = (target, all) => {
|
|
18
427
|
for (var name in all)
|
|
19
|
-
|
|
428
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
20
429
|
};
|
|
21
|
-
var
|
|
430
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
22
431
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of
|
|
24
|
-
if (!
|
|
25
|
-
|
|
432
|
+
for (let key of __getOwnPropNames2(from))
|
|
433
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
434
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
26
435
|
}
|
|
27
436
|
return to;
|
|
28
437
|
};
|
|
29
|
-
var __toCommonJS = (mod) =>
|
|
438
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
30
439
|
var index_exports = {};
|
|
31
440
|
__export(index_exports, {
|
|
32
441
|
parseErrors: () => parseErrors,
|
|
@@ -35,7 +444,7 @@ var require_dist2 = __commonJS({
|
|
|
35
444
|
runLint: () => runLint,
|
|
36
445
|
runTests: () => runTests
|
|
37
446
|
});
|
|
38
|
-
|
|
447
|
+
module2.exports = __toCommonJS(index_exports);
|
|
39
448
|
async function runCommand(command, cwd) {
|
|
40
449
|
const { execa } = await import("execa");
|
|
41
450
|
try {
|
|
@@ -112,43 +521,43 @@ var require_dist2 = __commonJS({
|
|
|
112
521
|
|
|
113
522
|
// ../ai-provider/dist/index.js
|
|
114
523
|
var require_dist3 = __commonJS({
|
|
115
|
-
"../ai-provider/dist/index.js"(
|
|
524
|
+
"../ai-provider/dist/index.js"(exports2, module2) {
|
|
116
525
|
"use strict";
|
|
117
|
-
var
|
|
118
|
-
var
|
|
119
|
-
var
|
|
120
|
-
var
|
|
121
|
-
var
|
|
122
|
-
var
|
|
526
|
+
var __create2 = Object.create;
|
|
527
|
+
var __defProp2 = Object.defineProperty;
|
|
528
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
529
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
530
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
531
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
123
532
|
var __export = (target, all) => {
|
|
124
533
|
for (var name in all)
|
|
125
|
-
|
|
534
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
126
535
|
};
|
|
127
|
-
var
|
|
536
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
128
537
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
129
|
-
for (let key of
|
|
130
|
-
if (!
|
|
131
|
-
|
|
538
|
+
for (let key of __getOwnPropNames2(from))
|
|
539
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
540
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
132
541
|
}
|
|
133
542
|
return to;
|
|
134
543
|
};
|
|
135
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ?
|
|
544
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
136
545
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
137
546
|
// file that has been converted to a CommonJS file using a Babel-
|
|
138
547
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
139
548
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
140
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
549
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
141
550
|
mod
|
|
142
551
|
));
|
|
143
|
-
var __toCommonJS = (mod) =>
|
|
552
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
144
553
|
var index_exports = {};
|
|
145
554
|
__export(index_exports, {
|
|
146
555
|
OpenRouterProvider: () => OpenRouterProvider
|
|
147
556
|
});
|
|
148
|
-
|
|
149
|
-
var import_axios = __toESM2(
|
|
150
|
-
var import_fs = __toESM2(
|
|
151
|
-
var import_path2 = __toESM2(
|
|
557
|
+
module2.exports = __toCommonJS(index_exports);
|
|
558
|
+
var import_axios = __toESM2(require("axios"));
|
|
559
|
+
var import_fs = __toESM2(require("fs"));
|
|
560
|
+
var import_path2 = __toESM2(require("path"));
|
|
152
561
|
function resolveModel(cwd) {
|
|
153
562
|
try {
|
|
154
563
|
const configPath = import_path2.default.resolve(cwd ?? process.cwd(), ".bugzerorc");
|
|
@@ -209,30 +618,30 @@ var require_dist3 = __commonJS({
|
|
|
209
618
|
|
|
210
619
|
// ../prompts/dist/index.js
|
|
211
620
|
var require_dist4 = __commonJS({
|
|
212
|
-
"../prompts/dist/index.js"(
|
|
621
|
+
"../prompts/dist/index.js"(exports2, module2) {
|
|
213
622
|
"use strict";
|
|
214
|
-
var
|
|
215
|
-
var
|
|
216
|
-
var
|
|
217
|
-
var
|
|
623
|
+
var __defProp2 = Object.defineProperty;
|
|
624
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
625
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
626
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
218
627
|
var __export = (target, all) => {
|
|
219
628
|
for (var name in all)
|
|
220
|
-
|
|
629
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
221
630
|
};
|
|
222
|
-
var
|
|
631
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
223
632
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
224
|
-
for (let key of
|
|
225
|
-
if (!
|
|
226
|
-
|
|
633
|
+
for (let key of __getOwnPropNames2(from))
|
|
634
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
635
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
227
636
|
}
|
|
228
637
|
return to;
|
|
229
638
|
};
|
|
230
|
-
var __toCommonJS = (mod) =>
|
|
639
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
231
640
|
var index_exports = {};
|
|
232
641
|
__export(index_exports, {
|
|
233
642
|
buildAnalysisPrompt: () => buildAnalysisPrompt
|
|
234
643
|
});
|
|
235
|
-
|
|
644
|
+
module2.exports = __toCommonJS(index_exports);
|
|
236
645
|
function buildAnalysisPrompt(errorOutput, cwd) {
|
|
237
646
|
return `You are an expert software engineer specialising in fixing build, lint, and test failures.
|
|
238
647
|
|
|
@@ -267,42 +676,42 @@ Critical rules:
|
|
|
267
676
|
|
|
268
677
|
// ../patcher/dist/index.js
|
|
269
678
|
var require_dist5 = __commonJS({
|
|
270
|
-
"../patcher/dist/index.js"(
|
|
679
|
+
"../patcher/dist/index.js"(exports2, module2) {
|
|
271
680
|
"use strict";
|
|
272
|
-
var
|
|
273
|
-
var
|
|
274
|
-
var
|
|
275
|
-
var
|
|
276
|
-
var
|
|
277
|
-
var
|
|
681
|
+
var __create2 = Object.create;
|
|
682
|
+
var __defProp2 = Object.defineProperty;
|
|
683
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
684
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
685
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
686
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
278
687
|
var __export = (target, all) => {
|
|
279
688
|
for (var name in all)
|
|
280
|
-
|
|
689
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
281
690
|
};
|
|
282
|
-
var
|
|
691
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
283
692
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
284
|
-
for (let key of
|
|
285
|
-
if (!
|
|
286
|
-
|
|
693
|
+
for (let key of __getOwnPropNames2(from))
|
|
694
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
695
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
287
696
|
}
|
|
288
697
|
return to;
|
|
289
698
|
};
|
|
290
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ?
|
|
699
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
291
700
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
292
701
|
// file that has been converted to a CommonJS file using a Babel-
|
|
293
702
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
294
703
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
295
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
704
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
296
705
|
mod
|
|
297
706
|
));
|
|
298
|
-
var __toCommonJS = (mod) =>
|
|
707
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
299
708
|
var index_exports = {};
|
|
300
709
|
__export(index_exports, {
|
|
301
710
|
applyPatch: () => applyPatch
|
|
302
711
|
});
|
|
303
|
-
|
|
304
|
-
var import_fs = __toESM2(
|
|
305
|
-
var import_path2 = __toESM2(
|
|
712
|
+
module2.exports = __toCommonJS(index_exports);
|
|
713
|
+
var import_fs = __toESM2(require("fs"));
|
|
714
|
+
var import_path2 = __toESM2(require("path"));
|
|
306
715
|
function applyPatch(absoluteFilePath, search, replace) {
|
|
307
716
|
try {
|
|
308
717
|
if (!import_fs.default.existsSync(absoluteFilePath)) {
|
|
@@ -332,43 +741,43 @@ var require_dist5 = __commonJS({
|
|
|
332
741
|
|
|
333
742
|
// ../agents/dist/index.js
|
|
334
743
|
var require_dist6 = __commonJS({
|
|
335
|
-
"../agents/dist/index.js"(
|
|
744
|
+
"../agents/dist/index.js"(exports2, module2) {
|
|
336
745
|
"use strict";
|
|
337
|
-
var
|
|
338
|
-
var
|
|
339
|
-
var
|
|
340
|
-
var
|
|
341
|
-
var
|
|
342
|
-
var
|
|
746
|
+
var __create2 = Object.create;
|
|
747
|
+
var __defProp2 = Object.defineProperty;
|
|
748
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
749
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
750
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
751
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
343
752
|
var __export = (target, all) => {
|
|
344
753
|
for (var name in all)
|
|
345
|
-
|
|
754
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
346
755
|
};
|
|
347
|
-
var
|
|
756
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
348
757
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
349
|
-
for (let key of
|
|
350
|
-
if (!
|
|
351
|
-
|
|
758
|
+
for (let key of __getOwnPropNames2(from))
|
|
759
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
760
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
352
761
|
}
|
|
353
762
|
return to;
|
|
354
763
|
};
|
|
355
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ?
|
|
764
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
356
765
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
357
766
|
// file that has been converted to a CommonJS file using a Babel-
|
|
358
767
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
359
768
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
360
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
769
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
361
770
|
mod
|
|
362
771
|
));
|
|
363
|
-
var __toCommonJS = (mod) =>
|
|
772
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
364
773
|
var index_exports = {};
|
|
365
774
|
__export(index_exports, {
|
|
366
775
|
workflow: () => workflow
|
|
367
776
|
});
|
|
368
|
-
|
|
369
|
-
var import_langgraph2 =
|
|
370
|
-
var import_path2 = __toESM2(
|
|
371
|
-
var import_langgraph =
|
|
777
|
+
module2.exports = __toCommonJS(index_exports);
|
|
778
|
+
var import_langgraph2 = require("@langchain/langgraph");
|
|
779
|
+
var import_path2 = __toESM2(require("path"));
|
|
780
|
+
var import_langgraph = require("@langchain/langgraph");
|
|
372
781
|
var GraphState = import_langgraph.Annotation.Root({
|
|
373
782
|
/** Absolute path to the project being fixed */
|
|
374
783
|
cwd: (0, import_langgraph.Annotation)({
|
|
@@ -482,44 +891,44 @@ var require_dist6 = __commonJS({
|
|
|
482
891
|
|
|
483
892
|
// ../core/dist/index.js
|
|
484
893
|
var require_dist7 = __commonJS({
|
|
485
|
-
"../core/dist/index.js"(
|
|
894
|
+
"../core/dist/index.js"(exports2, module2) {
|
|
486
895
|
"use strict";
|
|
487
|
-
var
|
|
488
|
-
var
|
|
489
|
-
var
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
var
|
|
896
|
+
var __create2 = Object.create;
|
|
897
|
+
var __defProp2 = Object.defineProperty;
|
|
898
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
899
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
900
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
901
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
493
902
|
var __export = (target, all) => {
|
|
494
903
|
for (var name in all)
|
|
495
|
-
|
|
904
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
496
905
|
};
|
|
497
|
-
var
|
|
906
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
498
907
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
499
|
-
for (let key of
|
|
500
|
-
if (!
|
|
501
|
-
|
|
908
|
+
for (let key of __getOwnPropNames2(from))
|
|
909
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
910
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
502
911
|
}
|
|
503
912
|
return to;
|
|
504
913
|
};
|
|
505
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ?
|
|
914
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
506
915
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
507
916
|
// file that has been converted to a CommonJS file using a Babel-
|
|
508
917
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
509
918
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
510
|
-
isNodeMode || !mod || !mod.__esModule ?
|
|
919
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
511
920
|
mod
|
|
512
921
|
));
|
|
513
|
-
var __toCommonJS = (mod) =>
|
|
922
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
514
923
|
var index_exports = {};
|
|
515
924
|
__export(index_exports, {
|
|
516
925
|
detectFramework: () => detectFramework2,
|
|
517
926
|
orchestrate: () => orchestrate2,
|
|
518
927
|
orchestrateAndFix: () => orchestrateAndFix2
|
|
519
928
|
});
|
|
520
|
-
|
|
521
|
-
var import_fs = __toESM2(
|
|
522
|
-
var import_path2 = __toESM2(
|
|
929
|
+
module2.exports = __toCommonJS(index_exports);
|
|
930
|
+
var import_fs = __toESM2(require("fs"));
|
|
931
|
+
var import_path2 = __toESM2(require("path"));
|
|
523
932
|
function detectFramework2(cwd = process.cwd()) {
|
|
524
933
|
const has = (...files) => files.some((f) => import_fs.default.existsSync(import_path2.default.join(cwd, f)));
|
|
525
934
|
if (has("next.config.js", "next.config.ts", "next.config.mjs")) return "nextjs";
|
|
@@ -595,14 +1004,14 @@ var require_dist7 = __commonJS({
|
|
|
595
1004
|
});
|
|
596
1005
|
|
|
597
1006
|
// src/index.ts
|
|
598
|
-
var import_config = __toESM(require_dist()
|
|
599
|
-
var
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
var program = new Command();
|
|
1007
|
+
var import_config = __toESM(require_dist());
|
|
1008
|
+
var import_commander = require("commander");
|
|
1009
|
+
var import_path = __toESM(require("path"));
|
|
1010
|
+
var import_core = __toESM(require_dist7());
|
|
1011
|
+
var program = new import_commander.Command();
|
|
603
1012
|
program.name("bugzero").description("AI-powered build issue fixer \u2014 detects and repairs build errors automatically").version("0.0.1");
|
|
604
1013
|
program.command("hunt").description("Run build, lint, and tests \u2014 report issues without modifying files").option("-p, --path <dir>", "Path to the target project", ".").action(async (opts) => {
|
|
605
|
-
const cwd =
|
|
1014
|
+
const cwd = import_path.default.resolve(opts.path);
|
|
606
1015
|
const framework = (0, import_core.detectFramework)(cwd);
|
|
607
1016
|
console.log(`
|
|
608
1017
|
\u{1F50D} BugZero \u2014 Analyzing project`);
|
|
@@ -638,7 +1047,7 @@ ${allPassed ? "\u2705 All checks passed" : "\u274C Issues found \u2014 run 'bugz
|
|
|
638
1047
|
process.exit(allPassed ? 0 : 1);
|
|
639
1048
|
});
|
|
640
1049
|
program.command("rescue").description("Detect build failures and automatically apply AI-generated fixes").option("-p, --path <dir>", "Path to the target project", ".").option("-n, --max-attempts <number>", "Maximum AI fix attempts", "3").option("--dry-run", "Analyse only \u2014 print what would be fixed without writing files", false).action(async (opts) => {
|
|
641
|
-
const cwd =
|
|
1050
|
+
const cwd = import_path.default.resolve(opts.path);
|
|
642
1051
|
const maxAttempts = parseInt(opts.maxAttempts, 10);
|
|
643
1052
|
const dryRun = opts.dryRun;
|
|
644
1053
|
const framework = (0, import_core.detectFramework)(cwd);
|
|
@@ -671,7 +1080,7 @@ program.command("protect").description("[Deprecated] Use 'hunt' instead").action
|
|
|
671
1080
|
console.log(result);
|
|
672
1081
|
});
|
|
673
1082
|
program.command("vibe").description("Select which AI model (brain) to use for resolving bugs").action(async () => {
|
|
674
|
-
const { getLocalConfig, saveLocalConfig } = await
|
|
1083
|
+
const { getLocalConfig, saveLocalConfig } = await Promise.resolve().then(() => __toESM(require_dist()));
|
|
675
1084
|
const readline = await import("readline");
|
|
676
1085
|
const axios = (await import("axios")).default;
|
|
677
1086
|
console.log(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugzero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"bin": {
|
|
5
5
|
"bugzero": "dist/index.js"
|
|
6
6
|
},
|
|
@@ -12,14 +12,13 @@
|
|
|
12
12
|
"execa": "^7.2.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@opspilot/
|
|
16
|
-
"@opspilot/
|
|
17
|
-
"@opspilot/core": "
|
|
15
|
+
"@opspilot/agents": "workspace:*",
|
|
16
|
+
"@opspilot/config": "workspace:*",
|
|
17
|
+
"@opspilot/core": "workspace:*"
|
|
18
18
|
},
|
|
19
19
|
"main": "./dist/index.js",
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
|
-
"type": "module",
|
|
22
21
|
"scripts": {
|
|
23
|
-
"build": "tsup src/index.ts --format
|
|
22
|
+
"build": "tsup src/index.ts --format cjs --dts"
|
|
24
23
|
}
|
|
25
24
|
}
|