bugzero 0.0.8 → 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.
@@ -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.9 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.20 KB
11
+ CJS ⚡️ Build success in 122ms
14
12
  DTS Build start
15
- DTS ⚡️ Build success in 1813ms
13
+ DTS ⚡️ Build success in 1127ms
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,7 +444,7 @@ 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 {
@@ -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"(exports, module) {
524
+ "../ai-provider/dist/index.js"(exports2, module2) {
116
525
  "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;
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
- __defProp(target, name, { get: all[name], enumerable: true });
534
+ __defProp2(target, name, { get: all[name], enumerable: true });
126
535
  };
127
- var __copyProps = (to, from, except, desc) => {
536
+ var __copyProps2 = (to, from, except, desc) => {
128
537
  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 });
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 ? __create(__getProtoOf(mod)) : {}, __copyProps(
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 ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
549
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
141
550
  mod
142
551
  ));
143
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), 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
- 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"));
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"(exports, module) {
621
+ "../prompts/dist/index.js"(exports2, module2) {
213
622
  "use strict";
214
- var __defProp = Object.defineProperty;
215
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
216
- var __getOwnPropNames = Object.getOwnPropertyNames;
217
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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
- __defProp(target, name, { get: all[name], enumerable: true });
629
+ __defProp2(target, name, { get: all[name], enumerable: true });
221
630
  };
222
- var __copyProps = (to, from, except, desc) => {
631
+ var __copyProps2 = (to, from, except, desc) => {
223
632
  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 });
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) => __copyProps(__defProp({}, "__esModule", { value: true }), 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
- module.exports = __toCommonJS(index_exports);
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"(exports, module) {
679
+ "../patcher/dist/index.js"(exports2, module2) {
271
680
  "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;
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
- __defProp(target, name, { get: all[name], enumerable: true });
689
+ __defProp2(target, name, { get: all[name], enumerable: true });
281
690
  };
282
- var __copyProps = (to, from, except, desc) => {
691
+ var __copyProps2 = (to, from, except, desc) => {
283
692
  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 });
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 ? __create(__getProtoOf(mod)) : {}, __copyProps(
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 ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
704
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
296
705
  mod
297
706
  ));
298
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), 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
- module.exports = __toCommonJS(index_exports);
304
- var import_fs = __toESM2(__require("fs"));
305
- var import_path2 = __toESM2(__require("path"));
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"(exports, module) {
744
+ "../agents/dist/index.js"(exports2, module2) {
336
745
  "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;
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
- __defProp(target, name, { get: all[name], enumerable: true });
754
+ __defProp2(target, name, { get: all[name], enumerable: true });
346
755
  };
347
- var __copyProps = (to, from, except, desc) => {
756
+ var __copyProps2 = (to, from, except, desc) => {
348
757
  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 });
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 ? __create(__getProtoOf(mod)) : {}, __copyProps(
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 ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
769
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
361
770
  mod
362
771
  ));
363
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), 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
- 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");
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"(exports, module) {
894
+ "../core/dist/index.js"(exports2, module2) {
486
895
  "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;
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
- __defProp(target, name, { get: all[name], enumerable: true });
904
+ __defProp2(target, name, { get: all[name], enumerable: true });
496
905
  };
497
- var __copyProps = (to, from, except, desc) => {
906
+ var __copyProps2 = (to, from, except, desc) => {
498
907
  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 });
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 ? __create(__getProtoOf(mod)) : {}, __copyProps(
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 ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
919
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
511
920
  mod
512
921
  ));
513
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), 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
- module.exports = __toCommonJS(index_exports);
521
- var import_fs = __toESM2(__require("fs"));
522
- var import_path2 = __toESM2(__require("path"));
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(), 1);
599
- var import_core = __toESM(require_dist7(), 1);
600
- import { Command } from "commander";
601
- import path from "path";
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 = path.resolve(opts.path);
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 = path.resolve(opts.path);
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 import("./dist-FQYNA36C.js");
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.8",
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/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
  }