blun-king-cli 5.2.0 → 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 +41 -53
  2. package/package.json +1 -1
package/blun-cli.js CHANGED
@@ -2595,14 +2595,8 @@ async function main() {
2595
2595
  }
2596
2596
 
2597
2597
  if (!process.argv.includes("--no-workdir-prompt") && !process.argv.includes("--trust")) {
2598
- var trustedDirs = [];
2599
- var trustFile = path.join(CONFIG_DIR, "trusted.json");
2600
- if (fs.existsSync(trustFile)) {
2601
- try { trustedDirs = JSON.parse(fs.readFileSync(trustFile, "utf8")); } catch(e) {}
2602
- }
2603
- var isTrusted = trustedDirs.includes(process.cwd());
2604
-
2605
- if (!isTrusted) {
2598
+ // Always ask — like Claude Code (every session)
2599
+ {
2606
2600
  console.log("");
2607
2601
  console.log(C.yellow + C.bold + " Quick safety check:" + C.reset);
2608
2602
  console.log(C.gray + " Is " + C.brightWhite + process.cwd() + C.gray + " a project you trust?" + C.reset);
@@ -2652,56 +2646,50 @@ async function main() {
2652
2646
  }
2653
2647
  }
2654
2648
 
2655
- // API Key check — prompt if missing (BEFORE header, so user sees it immediately)
2656
- // Test if key actually works by hitting /health
2657
- var hasKey = false;
2649
+ // API Key — ALWAYS prompt (like Claude Code login)
2658
2650
  var existingKey = config.api.key || config.auth.api_key || "";
2651
+ console.log("");
2652
+ console.log(C.yellow + C.bold + " API Key" + C.reset);
2659
2653
  if (existingKey.length > 3) {
2660
- try {
2661
- var testH = await apiCall("GET", "/health");
2662
- hasKey = (testH.status === 200);
2663
- } catch(e) { hasKey = false; }
2664
- }
2665
- if (!hasKey) {
2666
- console.log("");
2667
- console.log(C.yellow + C.bold + " API Key required" + C.reset);
2668
- if (existingKey.length > 3) {
2669
- console.log(C.red + " Saved key didn't work — please re-enter." + C.reset);
2670
- }
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 {
2671
2657
  console.log(C.gray + " Enter your BLUN King API key:" + C.reset);
2672
- process.stdout.write(C.brightBlue + " API Key: " + C.reset);
2673
- var apiKeyAnswer = await new Promise(function(resolve) {
2674
- var buf = "";
2675
- process.stdin.setRawMode(true);
2676
- process.stdin.resume();
2677
- process.stdin.setEncoding("utf8");
2678
- function onKeyApi(key) {
2679
- if (key === "\x03") { process.exit(0); }
2680
- if (key === "\r" || key === "\n") {
2681
- process.stdin.removeListener("data", onKeyApi);
2682
- process.stdin.setRawMode(false);
2683
- process.stdin.pause();
2684
- process.stdout.write("\n");
2685
- resolve(buf.trim());
2686
- return;
2687
- }
2688
- if (key === "\x7f" || key === "\b") {
2689
- if (buf.length > 0) { buf = buf.slice(0, -1); process.stdout.write("\b \b"); }
2690
- return;
2691
- }
2692
- buf += key;
2693
- 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;
2694
2674
  }
2695
- process.stdin.on("data", onKeyApi);
2696
- });
2697
- if (apiKeyAnswer) {
2698
- config.api.key = apiKeyAnswer;
2699
- config.auth.api_key = apiKeyAnswer;
2700
- saveConfig(config);
2701
- printSuccess("API key saved.");
2702
- } else {
2703
- 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("*");
2704
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.");
2705
2693
  }
2706
2694
 
2707
2695
  printHeader();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "5.2.0",
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": {