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.
- package/.turbo/turbo-build.log +4 -4
- package/dist/index.js +39 -9
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> bugzero@0.0.
|
|
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
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
|
-
[32mCJS[39m [1mdist\index.js [22m[
|
|
11
|
-
[32mCJS[39m ⚡️ Build success in
|
|
10
|
+
[32mCJS[39m [1mdist\index.js [22m[32m70.06 KB[39m
|
|
11
|
+
[32mCJS[39m ⚡️ Build success in 75ms
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mDTS[39m ⚡️ Build success in
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 1335ms
|
|
14
14
|
[32mDTS[39m [1mdist\index.d.ts [22m[32m20.00 B[39m
|
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 =
|
|
399
|
-
if (
|
|
400
|
-
const content =
|
|
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 =
|
|
409
|
-
|
|
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",
|