blun-king-cli 5.2.1 → 5.2.2

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.
Files changed (2) hide show
  1. package/blun-cli.js +39 -45
  2. package/package.json +1 -1
package/blun-cli.js CHANGED
@@ -2646,56 +2646,50 @@ async function main() {
2646
2646
  }
2647
2647
  }
2648
2648
 
2649
- // API Key check — prompt if missing (BEFORE header, so user sees it immediately)
2650
- // Test if key actually works by hitting /health
2651
- var hasKey = false;
2649
+ // API Key — ALWAYS prompt (like Claude Code login)
2652
2650
  var existingKey = config.api.key || config.auth.api_key || "";
2651
+ console.log("");
2652
+ console.log(C.yellow + C.bold + " API Key" + C.reset);
2653
2653
  if (existingKey.length > 3) {
2654
- try {
2655
- var testH = await apiCall("GET", "/health");
2656
- hasKey = (testH.status === 200);
2657
- } catch(e) { hasKey = false; }
2658
- }
2659
- if (!hasKey) {
2660
- console.log("");
2661
- console.log(C.yellow + C.bold + " API Key required" + C.reset);
2662
- if (existingKey.length > 3) {
2663
- console.log(C.red + " Saved key didn't work — please re-enter." + C.reset);
2664
- }
2654
+ console.log(C.gray + " Current: " + C.green + existingKey.slice(0, 8) + "..." + C.reset);
2655
+ console.log(C.gray + " Press Enter to keep, or type a new key:" + C.reset);
2656
+ } else {
2665
2657
  console.log(C.gray + " Enter your BLUN King API key:" + C.reset);
2666
- process.stdout.write(C.brightBlue + " API Key: " + C.reset);
2667
- var apiKeyAnswer = await new Promise(function(resolve) {
2668
- var buf = "";
2669
- process.stdin.setRawMode(true);
2670
- process.stdin.resume();
2671
- process.stdin.setEncoding("utf8");
2672
- function onKeyApi(key) {
2673
- if (key === "\x03") { process.exit(0); }
2674
- if (key === "\r" || key === "\n") {
2675
- process.stdin.removeListener("data", onKeyApi);
2676
- process.stdin.setRawMode(false);
2677
- process.stdin.pause();
2678
- process.stdout.write("\n");
2679
- resolve(buf.trim());
2680
- return;
2681
- }
2682
- if (key === "\x7f" || key === "\b") {
2683
- if (buf.length > 0) { buf = buf.slice(0, -1); process.stdout.write("\b \b"); }
2684
- return;
2685
- }
2686
- buf += key;
2687
- process.stdout.write("*");
2658
+ }
2659
+ process.stdout.write(C.brightBlue + " API Key: " + C.reset);
2660
+ var apiKeyAnswer = await new Promise(function(resolve) {
2661
+ var buf = "";
2662
+ process.stdin.setRawMode(true);
2663
+ process.stdin.resume();
2664
+ process.stdin.setEncoding("utf8");
2665
+ function onKeyApi(key) {
2666
+ if (key === "\x03") { process.exit(0); }
2667
+ if (key === "\r" || key === "\n") {
2668
+ process.stdin.removeListener("data", onKeyApi);
2669
+ process.stdin.setRawMode(false);
2670
+ process.stdin.pause();
2671
+ process.stdout.write("\n");
2672
+ resolve(buf.trim());
2673
+ return;
2688
2674
  }
2689
- process.stdin.on("data", onKeyApi);
2690
- });
2691
- if (apiKeyAnswer) {
2692
- config.api.key = apiKeyAnswer;
2693
- config.auth.api_key = apiKeyAnswer;
2694
- saveConfig(config);
2695
- printSuccess("API key saved.");
2696
- } else {
2697
- printError("No API key — some features won't work.");
2675
+ if (key === "\x7f" || key === "\b") {
2676
+ if (buf.length > 0) { buf = buf.slice(0, -1); process.stdout.write("\b \b"); }
2677
+ return;
2678
+ }
2679
+ buf += key;
2680
+ process.stdout.write("*");
2698
2681
  }
2682
+ process.stdin.on("data", onKeyApi);
2683
+ });
2684
+ if (apiKeyAnswer) {
2685
+ config.api.key = apiKeyAnswer;
2686
+ config.auth.api_key = apiKeyAnswer;
2687
+ saveConfig(config);
2688
+ printSuccess("API key saved.");
2689
+ } else if (existingKey.length > 3) {
2690
+ printSuccess("Using saved key.");
2691
+ } else {
2692
+ printError("No API key — some features won't work.");
2699
2693
  }
2700
2694
 
2701
2695
  printHeader();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "BLUN King CLI — Your local AI assistant powered by Gemma4",
5
5
  "type": "commonjs",
6
6
  "bin": {