blun-king-cli 2.3.2 → 2.4.0
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/bin/blun.js +32 -4
- package/package.json +1 -1
package/bin/blun.js
CHANGED
|
@@ -2267,6 +2267,31 @@ async function main() {
|
|
|
2267
2267
|
printHeader();
|
|
2268
2268
|
checkForUpdates();
|
|
2269
2269
|
|
|
2270
|
+
// API Key check — prompt if missing
|
|
2271
|
+
if (!config.api.key && !process.argv.includes("--api-key")) {
|
|
2272
|
+
console.log("");
|
|
2273
|
+
console.log(C.yellow + " " + BOX.bot + " No API key configured." + C.reset);
|
|
2274
|
+
console.log(C.gray + " Enter your BLUN King API key (or press Enter to skip):" + C.reset);
|
|
2275
|
+
var apiKeyAnswer = await new Promise(function(resolve) {
|
|
2276
|
+
var rlKey = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
2277
|
+
rlKey.question(C.brightBlue + " API Key: " + C.reset, function(answer) {
|
|
2278
|
+
rlKey.close();
|
|
2279
|
+
resolve(answer.trim());
|
|
2280
|
+
});
|
|
2281
|
+
});
|
|
2282
|
+
if (apiKeyAnswer) {
|
|
2283
|
+
config.api.key = apiKeyAnswer;
|
|
2284
|
+
// Save to config file
|
|
2285
|
+
var cfgFile = path.join(CONFIG_DIR, "config.json");
|
|
2286
|
+
var cfgData = {};
|
|
2287
|
+
if (fs.existsSync(cfgFile)) { try { cfgData = JSON.parse(fs.readFileSync(cfgFile, "utf8")); } catch(e) {} }
|
|
2288
|
+
if (!cfgData.api) cfgData.api = {};
|
|
2289
|
+
cfgData.api.key = apiKeyAnswer;
|
|
2290
|
+
fs.writeFileSync(cfgFile, JSON.stringify(cfgData, null, 2));
|
|
2291
|
+
printSuccess("API key saved.");
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2270
2295
|
// Load session history for this workdir
|
|
2271
2296
|
var session = loadSessionHistory();
|
|
2272
2297
|
chatHistory = session.history.slice(-20);
|
|
@@ -2329,7 +2354,7 @@ async function main() {
|
|
|
2329
2354
|
var w = Math.min(getTermWidth() - 4, 76);
|
|
2330
2355
|
var displayText = inputBuffer;
|
|
2331
2356
|
if (displayText.length > w - 4) displayText = displayText.slice(-(w - 4));
|
|
2332
|
-
var pad = Math.max(0, w -
|
|
2357
|
+
var pad = Math.max(0, w - 3 - displayText.length);
|
|
2333
2358
|
var lines = 0;
|
|
2334
2359
|
|
|
2335
2360
|
// Box top
|
|
@@ -2342,11 +2367,14 @@ async function main() {
|
|
|
2342
2367
|
// Status bar (permission mode + model + workdir)
|
|
2343
2368
|
var rawPerm = getSetting("permissions.defaultMode");
|
|
2344
2369
|
var permMode = typeof rawPerm === "string" ? rawPerm : "ask";
|
|
2345
|
-
|
|
2346
|
-
var
|
|
2370
|
+
// Check if --dangerously-skip-permissions or godmode
|
|
2371
|
+
var isDangerous = process.argv.includes("--dangerously-skip-permissions") || permMode === "allow";
|
|
2372
|
+
var permLabel = isDangerous ? "GOD MODE" : permMode === "deny" ? "LOCKED" : "ask permission";
|
|
2373
|
+
var permIcon = isDangerous ? "\u26A1" : permMode === "deny" ? "\u2718" : "\u2753";
|
|
2374
|
+
var permColor = isDangerous ? C.red + C.bold : permMode === "deny" ? C.red : C.yellow;
|
|
2347
2375
|
var modelName = typeof config.model === "string" ? config.model : (config.model && config.model.name ? config.model.name : "default");
|
|
2348
2376
|
var wdShort = config.workdir ? path.basename(config.workdir) : "~";
|
|
2349
|
-
var statusLine = permColor + " " + permIcon + " " +
|
|
2377
|
+
var statusLine = permColor + " " + permIcon + " " + permLabel + C.reset + C.dim + " \u2502 " + C.reset +
|
|
2350
2378
|
C.cyan + modelName + C.reset + C.dim + " \u2502 " + C.reset +
|
|
2351
2379
|
C.dim + wdShort + C.reset;
|
|
2352
2380
|
process.stdout.write("\x1b[2K" + statusLine + "\n"); lines++;
|