bugzero 0.0.8 → 0.0.10

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.
@@ -1,16 +1,14 @@
1
1
 
2
- > bugzero@0.0.7 build D:\WD projects\OpsPilot\packages\cli
3
- > tsup src/index.ts --format esm --dts
2
+ > bugzero@0.0.10 build D:\WD projects\OpsPilot\packages\cli
3
+ > tsup src/index.ts --format cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.1
8
8
  CLI Target: es2022
9
- ESM Build start
10
- ESM dist\dist-FQYNA36C.js 85.00 B
11
- ESM dist\index.js 31.38 KB
12
- ESM dist\chunk-4ANZDGVD.js 16.11 KB
13
- ESM ⚡️ Build success in 150ms
9
+ CJS Build start
10
+ CJS dist\index.js 47.28 KB
11
+ CJS ⚡️ Build success in 393ms
14
12
  DTS Build start
15
- DTS ⚡️ Build success in 1813ms
13
+ DTS ⚡️ Build success in 1398ms
16
14
  DTS dist\index.d.ts 20.00 B
package/dist/index.js CHANGED
@@ -1,32 +1,441 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- __commonJS,
4
- __require,
5
- __toESM,
6
- require_dist
7
- } from "./chunk-4ANZDGVD.js";
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"(exports, module) {
420
+ "../analyzers/dist/index.js"(exports2, module2) {
12
421
  "use strict";
13
- var __defProp = Object.defineProperty;
14
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
- var __getOwnPropNames = Object.getOwnPropertyNames;
16
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- __defProp(target, name, { get: all[name], enumerable: true });
428
+ __defProp2(target, name, { get: all[name], enumerable: true });
20
429
  };
21
- var __copyProps = (to, from, except, desc) => {
430
+ var __copyProps2 = (to, from, except, desc) => {
22
431
  if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
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) => __copyProps(__defProp({}, "__esModule", { value: true }), 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,14 +444,18 @@ var require_dist2 = __commonJS({
35
444
  runLint: () => runLint,
36
445
  runTests: () => runTests
37
446
  });
38
- module.exports = __toCommonJS(index_exports);
447
+ module2.exports = __toCommonJS(index_exports);
39
448
  async function runCommand(command, cwd) {
40
449
  const { execa } = await import("execa");
41
450
  try {
42
451
  const result = await execa(command, {
43
452
  shell: true,
44
453
  cwd: cwd ?? process.cwd(),
45
- all: true
454
+ all: true,
455
+ env: {
456
+ ...process.env,
457
+ CI: "true"
458
+ }
46
459
  });
47
460
  return {
48
461
  success: true,
@@ -112,43 +525,43 @@ var require_dist2 = __commonJS({
112
525
 
113
526
  // ../ai-provider/dist/index.js
114
527
  var require_dist3 = __commonJS({
115
- "../ai-provider/dist/index.js"(exports, module) {
528
+ "../ai-provider/dist/index.js"(exports2, module2) {
116
529
  "use strict";
117
- var __create = Object.create;
118
- var __defProp = Object.defineProperty;
119
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
120
- var __getOwnPropNames = Object.getOwnPropertyNames;
121
- var __getProtoOf = Object.getPrototypeOf;
122
- var __hasOwnProp = Object.prototype.hasOwnProperty;
530
+ var __create2 = Object.create;
531
+ var __defProp2 = Object.defineProperty;
532
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
533
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
534
+ var __getProtoOf2 = Object.getPrototypeOf;
535
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
123
536
  var __export = (target, all) => {
124
537
  for (var name in all)
125
- __defProp(target, name, { get: all[name], enumerable: true });
538
+ __defProp2(target, name, { get: all[name], enumerable: true });
126
539
  };
127
- var __copyProps = (to, from, except, desc) => {
540
+ var __copyProps2 = (to, from, except, desc) => {
128
541
  if (from && typeof from === "object" || typeof from === "function") {
129
- for (let key of __getOwnPropNames(from))
130
- if (!__hasOwnProp.call(to, key) && key !== except)
131
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
542
+ for (let key of __getOwnPropNames2(from))
543
+ if (!__hasOwnProp2.call(to, key) && key !== except)
544
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
132
545
  }
133
546
  return to;
134
547
  };
135
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
548
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
136
549
  // If the importer is in node compatibility mode or this is not an ESM
137
550
  // file that has been converted to a CommonJS file using a Babel-
138
551
  // compatible transform (i.e. "__esModule" has not been set), then set
139
552
  // "default" to the CommonJS "module.exports" for node compatibility.
140
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
553
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
141
554
  mod
142
555
  ));
143
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
556
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
144
557
  var index_exports = {};
145
558
  __export(index_exports, {
146
559
  OpenRouterProvider: () => OpenRouterProvider
147
560
  });
148
- module.exports = __toCommonJS(index_exports);
149
- var import_axios = __toESM2(__require("axios"));
150
- var import_fs = __toESM2(__require("fs"));
151
- var import_path2 = __toESM2(__require("path"));
561
+ module2.exports = __toCommonJS(index_exports);
562
+ var import_axios = __toESM2(require("axios"));
563
+ var import_fs = __toESM2(require("fs"));
564
+ var import_path2 = __toESM2(require("path"));
152
565
  function resolveModel(cwd) {
153
566
  try {
154
567
  const configPath = import_path2.default.resolve(cwd ?? process.cwd(), ".bugzerorc");
@@ -209,30 +622,30 @@ var require_dist3 = __commonJS({
209
622
 
210
623
  // ../prompts/dist/index.js
211
624
  var require_dist4 = __commonJS({
212
- "../prompts/dist/index.js"(exports, module) {
625
+ "../prompts/dist/index.js"(exports2, module2) {
213
626
  "use strict";
214
- var __defProp = Object.defineProperty;
215
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
216
- var __getOwnPropNames = Object.getOwnPropertyNames;
217
- var __hasOwnProp = Object.prototype.hasOwnProperty;
627
+ var __defProp2 = Object.defineProperty;
628
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
629
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
630
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
218
631
  var __export = (target, all) => {
219
632
  for (var name in all)
220
- __defProp(target, name, { get: all[name], enumerable: true });
633
+ __defProp2(target, name, { get: all[name], enumerable: true });
221
634
  };
222
- var __copyProps = (to, from, except, desc) => {
635
+ var __copyProps2 = (to, from, except, desc) => {
223
636
  if (from && typeof from === "object" || typeof from === "function") {
224
- for (let key of __getOwnPropNames(from))
225
- if (!__hasOwnProp.call(to, key) && key !== except)
226
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
637
+ for (let key of __getOwnPropNames2(from))
638
+ if (!__hasOwnProp2.call(to, key) && key !== except)
639
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
227
640
  }
228
641
  return to;
229
642
  };
230
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
643
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
231
644
  var index_exports = {};
232
645
  __export(index_exports, {
233
646
  buildAnalysisPrompt: () => buildAnalysisPrompt
234
647
  });
235
- module.exports = __toCommonJS(index_exports);
648
+ module2.exports = __toCommonJS(index_exports);
236
649
  function buildAnalysisPrompt(errorOutput, cwd) {
237
650
  return `You are an expert software engineer specialising in fixing build, lint, and test failures.
238
651
 
@@ -267,42 +680,42 @@ Critical rules:
267
680
 
268
681
  // ../patcher/dist/index.js
269
682
  var require_dist5 = __commonJS({
270
- "../patcher/dist/index.js"(exports, module) {
683
+ "../patcher/dist/index.js"(exports2, module2) {
271
684
  "use strict";
272
- var __create = Object.create;
273
- var __defProp = Object.defineProperty;
274
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
275
- var __getOwnPropNames = Object.getOwnPropertyNames;
276
- var __getProtoOf = Object.getPrototypeOf;
277
- var __hasOwnProp = Object.prototype.hasOwnProperty;
685
+ var __create2 = Object.create;
686
+ var __defProp2 = Object.defineProperty;
687
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
688
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
689
+ var __getProtoOf2 = Object.getPrototypeOf;
690
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
278
691
  var __export = (target, all) => {
279
692
  for (var name in all)
280
- __defProp(target, name, { get: all[name], enumerable: true });
693
+ __defProp2(target, name, { get: all[name], enumerable: true });
281
694
  };
282
- var __copyProps = (to, from, except, desc) => {
695
+ var __copyProps2 = (to, from, except, desc) => {
283
696
  if (from && typeof from === "object" || typeof from === "function") {
284
- for (let key of __getOwnPropNames(from))
285
- if (!__hasOwnProp.call(to, key) && key !== except)
286
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
697
+ for (let key of __getOwnPropNames2(from))
698
+ if (!__hasOwnProp2.call(to, key) && key !== except)
699
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
287
700
  }
288
701
  return to;
289
702
  };
290
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
703
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
291
704
  // If the importer is in node compatibility mode or this is not an ESM
292
705
  // file that has been converted to a CommonJS file using a Babel-
293
706
  // compatible transform (i.e. "__esModule" has not been set), then set
294
707
  // "default" to the CommonJS "module.exports" for node compatibility.
295
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
708
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
296
709
  mod
297
710
  ));
298
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
711
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
299
712
  var index_exports = {};
300
713
  __export(index_exports, {
301
714
  applyPatch: () => applyPatch
302
715
  });
303
- module.exports = __toCommonJS(index_exports);
304
- var import_fs = __toESM2(__require("fs"));
305
- var import_path2 = __toESM2(__require("path"));
716
+ module2.exports = __toCommonJS(index_exports);
717
+ var import_fs = __toESM2(require("fs"));
718
+ var import_path2 = __toESM2(require("path"));
306
719
  function applyPatch(absoluteFilePath, search, replace) {
307
720
  try {
308
721
  if (!import_fs.default.existsSync(absoluteFilePath)) {
@@ -332,43 +745,43 @@ var require_dist5 = __commonJS({
332
745
 
333
746
  // ../agents/dist/index.js
334
747
  var require_dist6 = __commonJS({
335
- "../agents/dist/index.js"(exports, module) {
748
+ "../agents/dist/index.js"(exports2, module2) {
336
749
  "use strict";
337
- var __create = Object.create;
338
- var __defProp = Object.defineProperty;
339
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
340
- var __getOwnPropNames = Object.getOwnPropertyNames;
341
- var __getProtoOf = Object.getPrototypeOf;
342
- var __hasOwnProp = Object.prototype.hasOwnProperty;
750
+ var __create2 = Object.create;
751
+ var __defProp2 = Object.defineProperty;
752
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
753
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
754
+ var __getProtoOf2 = Object.getPrototypeOf;
755
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
343
756
  var __export = (target, all) => {
344
757
  for (var name in all)
345
- __defProp(target, name, { get: all[name], enumerable: true });
758
+ __defProp2(target, name, { get: all[name], enumerable: true });
346
759
  };
347
- var __copyProps = (to, from, except, desc) => {
760
+ var __copyProps2 = (to, from, except, desc) => {
348
761
  if (from && typeof from === "object" || typeof from === "function") {
349
- for (let key of __getOwnPropNames(from))
350
- if (!__hasOwnProp.call(to, key) && key !== except)
351
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
762
+ for (let key of __getOwnPropNames2(from))
763
+ if (!__hasOwnProp2.call(to, key) && key !== except)
764
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
352
765
  }
353
766
  return to;
354
767
  };
355
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
768
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
356
769
  // If the importer is in node compatibility mode or this is not an ESM
357
770
  // file that has been converted to a CommonJS file using a Babel-
358
771
  // compatible transform (i.e. "__esModule" has not been set), then set
359
772
  // "default" to the CommonJS "module.exports" for node compatibility.
360
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
773
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
361
774
  mod
362
775
  ));
363
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
776
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
364
777
  var index_exports = {};
365
778
  __export(index_exports, {
366
779
  workflow: () => workflow
367
780
  });
368
- module.exports = __toCommonJS(index_exports);
369
- var import_langgraph2 = __require("@langchain/langgraph");
370
- var import_path2 = __toESM2(__require("path"));
371
- var import_langgraph = __require("@langchain/langgraph");
781
+ module2.exports = __toCommonJS(index_exports);
782
+ var import_langgraph2 = require("@langchain/langgraph");
783
+ var import_path2 = __toESM2(require("path"));
784
+ var import_langgraph = require("@langchain/langgraph");
372
785
  var GraphState = import_langgraph.Annotation.Root({
373
786
  /** Absolute path to the project being fixed */
374
787
  cwd: (0, import_langgraph.Annotation)({
@@ -482,44 +895,44 @@ var require_dist6 = __commonJS({
482
895
 
483
896
  // ../core/dist/index.js
484
897
  var require_dist7 = __commonJS({
485
- "../core/dist/index.js"(exports, module) {
898
+ "../core/dist/index.js"(exports2, module2) {
486
899
  "use strict";
487
- var __create = Object.create;
488
- var __defProp = Object.defineProperty;
489
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
490
- var __getOwnPropNames = Object.getOwnPropertyNames;
491
- var __getProtoOf = Object.getPrototypeOf;
492
- var __hasOwnProp = Object.prototype.hasOwnProperty;
900
+ var __create2 = Object.create;
901
+ var __defProp2 = Object.defineProperty;
902
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
903
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
904
+ var __getProtoOf2 = Object.getPrototypeOf;
905
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
493
906
  var __export = (target, all) => {
494
907
  for (var name in all)
495
- __defProp(target, name, { get: all[name], enumerable: true });
908
+ __defProp2(target, name, { get: all[name], enumerable: true });
496
909
  };
497
- var __copyProps = (to, from, except, desc) => {
910
+ var __copyProps2 = (to, from, except, desc) => {
498
911
  if (from && typeof from === "object" || typeof from === "function") {
499
- for (let key of __getOwnPropNames(from))
500
- if (!__hasOwnProp.call(to, key) && key !== except)
501
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
912
+ for (let key of __getOwnPropNames2(from))
913
+ if (!__hasOwnProp2.call(to, key) && key !== except)
914
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
502
915
  }
503
916
  return to;
504
917
  };
505
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
918
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
506
919
  // If the importer is in node compatibility mode or this is not an ESM
507
920
  // file that has been converted to a CommonJS file using a Babel-
508
921
  // compatible transform (i.e. "__esModule" has not been set), then set
509
922
  // "default" to the CommonJS "module.exports" for node compatibility.
510
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
923
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
511
924
  mod
512
925
  ));
513
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
926
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
514
927
  var index_exports = {};
515
928
  __export(index_exports, {
516
929
  detectFramework: () => detectFramework2,
517
930
  orchestrate: () => orchestrate2,
518
931
  orchestrateAndFix: () => orchestrateAndFix2
519
932
  });
520
- module.exports = __toCommonJS(index_exports);
521
- var import_fs = __toESM2(__require("fs"));
522
- var import_path2 = __toESM2(__require("path"));
933
+ module2.exports = __toCommonJS(index_exports);
934
+ var import_fs = __toESM2(require("fs"));
935
+ var import_path2 = __toESM2(require("path"));
523
936
  function detectFramework2(cwd = process.cwd()) {
524
937
  const has = (...files) => files.some((f) => import_fs.default.existsSync(import_path2.default.join(cwd, f)));
525
938
  if (has("next.config.js", "next.config.ts", "next.config.mjs")) return "nextjs";
@@ -595,14 +1008,14 @@ var require_dist7 = __commonJS({
595
1008
  });
596
1009
 
597
1010
  // src/index.ts
598
- var import_config = __toESM(require_dist(), 1);
599
- var import_core = __toESM(require_dist7(), 1);
600
- import { Command } from "commander";
601
- import path from "path";
602
- var program = new Command();
1011
+ var import_config = __toESM(require_dist());
1012
+ var import_commander = require("commander");
1013
+ var import_path = __toESM(require("path"));
1014
+ var import_core = __toESM(require_dist7());
1015
+ var program = new import_commander.Command();
603
1016
  program.name("bugzero").description("AI-powered build issue fixer \u2014 detects and repairs build errors automatically").version("0.0.1");
604
1017
  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 = path.resolve(opts.path);
1018
+ const cwd = import_path.default.resolve(opts.path);
606
1019
  const framework = (0, import_core.detectFramework)(cwd);
607
1020
  console.log(`
608
1021
  \u{1F50D} BugZero \u2014 Analyzing project`);
@@ -638,7 +1051,7 @@ ${allPassed ? "\u2705 All checks passed" : "\u274C Issues found \u2014 run 'bugz
638
1051
  process.exit(allPassed ? 0 : 1);
639
1052
  });
640
1053
  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 = path.resolve(opts.path);
1054
+ const cwd = import_path.default.resolve(opts.path);
642
1055
  const maxAttempts = parseInt(opts.maxAttempts, 10);
643
1056
  const dryRun = opts.dryRun;
644
1057
  const framework = (0, import_core.detectFramework)(cwd);
@@ -671,7 +1084,7 @@ program.command("protect").description("[Deprecated] Use 'hunt' instead").action
671
1084
  console.log(result);
672
1085
  });
673
1086
  program.command("vibe").description("Select which AI model (brain) to use for resolving bugs").action(async () => {
674
- const { getLocalConfig, saveLocalConfig } = await import("./dist-FQYNA36C.js");
1087
+ const { getLocalConfig, saveLocalConfig } = await Promise.resolve().then(() => __toESM(require_dist()));
675
1088
  const readline = await import("readline");
676
1089
  const axios = (await import("axios")).default;
677
1090
  console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugzero",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
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/config": "0.0.1",
16
- "@opspilot/core": "0.0.1",
17
- "@opspilot/agents": "0.0.1"
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 esm --dts"
22
+ "build": "tsup src/index.ts --format cjs --dts"
24
23
  }
25
24
  }