bugzero 0.0.26 → 0.0.27

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,5 +1,5 @@
1
1
 
2
- > bugzero@0.0.26 build D:\WD projects\OpsPilot\packages\cli
2
+ > bugzero@0.0.27 build D:\WD projects\OpsPilot\packages\cli
3
3
  > tsup src/index.ts --format cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -7,8 +7,8 @@
7
7
  CLI tsup v8.5.1
8
8
  CLI Target: es2022
9
9
  CJS Build start
10
- CJS dist\index.js 68.76 KB
11
- CJS ⚡️ Build success in 1065ms
10
+ CJS dist\index.js 70.06 KB
11
+ CJS ⚡️ Build success in 75ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 4371ms
13
+ DTS ⚡️ Build success in 1335ms
14
14
  DTS dist\index.d.ts 20.00 B
package/dist/index.js CHANGED
@@ -386,18 +386,36 @@ var require_dist = __commonJS({
386
386
  });
387
387
  module2.exports = __toCommonJS(index_exports);
388
388
  var import_dotenv = __toESM2(require_main());
389
- import_dotenv.default.config();
390
- var env = {
391
- openRouterKey: process.env.OPENROUTER_API_KEY
392
- };
393
389
  var import_fs = __toESM2(require("fs"));
394
390
  var import_path2 = __toESM2(require("path"));
391
+ function loadEnv() {
392
+ let dir = process.cwd();
393
+ while (true) {
394
+ const envPath = import_path2.default.join(dir, ".env");
395
+ if (import_fs.default.existsSync(envPath)) {
396
+ import_dotenv.default.config({ path: envPath });
397
+ return;
398
+ }
399
+ const parent = import_path2.default.dirname(dir);
400
+ if (parent === dir) {
401
+ break;
402
+ }
403
+ dir = parent;
404
+ }
405
+ import_dotenv.default.config();
406
+ }
407
+ loadEnv();
408
+ var env = {
409
+ openRouterKey: process.env.OPENROUTER_API_KEY || ""
410
+ };
411
+ var import_fs2 = __toESM2(require("fs"));
412
+ var import_path22 = __toESM2(require("path"));
395
413
  var CONFIG_FILENAME = ".bugzerorc";
396
414
  function getLocalConfig(cwd = process.cwd()) {
397
415
  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");
416
+ const configPath = import_path22.default.resolve(cwd, CONFIG_FILENAME);
417
+ if (import_fs2.default.existsSync(configPath)) {
418
+ const content = import_fs2.default.readFileSync(configPath, "utf-8");
401
419
  return JSON.parse(content);
402
420
  }
403
421
  } catch (e) {
@@ -405,8 +423,8 @@ var require_dist = __commonJS({
405
423
  return {};
406
424
  }
407
425
  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");
426
+ const configPath = import_path22.default.resolve(cwd, CONFIG_FILENAME);
427
+ import_fs2.default.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
410
428
  }
411
429
  function getSelectedModel(cwd = process.cwd()) {
412
430
  const config = getLocalConfig(cwd);
@@ -621,6 +639,18 @@ var require_dist3 = __commonJS({
621
639
  var OpenRouterProvider = class {
622
640
  async invoke(prompt, options) {
623
641
  const model = resolveModel(options?.cwd);
642
+ const apiKey = process.env.OPENROUTER_API_KEY;
643
+ if (!apiKey) {
644
+ console.error(`
645
+ \u274C [BugZero] Error: OPENROUTER_API_KEY environment variable is not set.`);
646
+ console.error(`\u{1F449} Please configure it using one of the following methods:`);
647
+ console.error(` - On macOS/Linux: export OPENROUTER_API_KEY="your_openrouter_api_key_here"`);
648
+ console.error(` - On Windows (PowerShell): $env:OPENROUTER_API_KEY="your_openrouter_api_key_here"`);
649
+ console.error(` - Or add it to a .env file at the root of the project you are fixing:`);
650
+ console.error(` OPENROUTER_API_KEY=your_openrouter_api_key_here
651
+ `);
652
+ throw new Error("Missing OPENROUTER_API_KEY environment variable.");
653
+ }
624
654
  try {
625
655
  const response = await import_axios.default.post(
626
656
  "https://openrouter.ai/api/v1/chat/completions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugzero",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "bin": {
5
5
  "bugzero": "dist/index.js"
6
6
  },