blun-king-cli 2.2.0 → 2.3.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.
Files changed (2) hide show
  1. package/bin/blun.js +103 -1
  2. package/package.json +1 -1
package/bin/blun.js CHANGED
@@ -2394,6 +2394,48 @@ async function main() {
2394
2394
  refreshUI();
2395
2395
  }
2396
2396
 
2397
+ // Intent detection: natural language → slash command
2398
+ var INTENTS = [
2399
+ { patterns: ["verbinde.*telegram", "connect.*telegram", "telegram.*verbind", "telegram.*setup", "telegram.*einricht"], cmd: "/plugin telegram" },
2400
+ { patterns: ["verbinde.*github", "connect.*github", "github.*setup"], cmd: "/plugin github" },
2401
+ { patterns: ["verbinde.*slack", "connect.*slack", "slack.*setup"], cmd: "/plugin slack" },
2402
+ { patterns: ["verbinde.*docker", "connect.*docker", "docker.*setup"], cmd: "/plugin docker" },
2403
+ { patterns: ["plugin.*install", "plugin.*hinzuf", "erweiterung"], cmd: "/plugin" },
2404
+ { patterns: ["mcp.*server", "mcp.*install", "mcp.*einricht"], cmd: "/mcp" },
2405
+ { patterns: ["welches model", "which model", "modell.*wechsel", "model.*switch", "anderes.*model"], cmd: "/model" },
2406
+ { patterns: ["permission", "berechtigung", "zugriff", "erlaubnis"], cmd: "/permissions" },
2407
+ { patterns: ["einstellung", "setting", "config", "konfigur"], cmd: "/config" },
2408
+ { patterns: ["health.*check", "gesundheit", "status.*check", "alles.*ok", "laeuft.*alles"], cmd: "/health" },
2409
+ { patterns: ["zeig.*skills", "was kannst", "show.*skills", "faehigkeit"], cmd: "/skills" },
2410
+ { patterns: ["zeig.*agent", "list.*agent", "welche.*agent"], cmd: "/agents" },
2411
+ { patterns: ["screenshot.*mach", "screenshot.*von", "take.*screenshot"], cmd: null, extract: function(t) { var m = t.match(/(?:screenshot|bildschirmfoto).*?(https?:\/\/\S+)/i); return m ? "/screenshot " + m[1] : "/screenshot"; } },
2412
+ { patterns: ["hilfe", "help", "was geht", "befehle"], cmd: "/help" },
2413
+ { patterns: ["doctor", "diagnose", "problem.*check"], cmd: "/doctor" },
2414
+ { patterns: ["login", "anmeld", "einlogg"], cmd: "/login" },
2415
+ { patterns: ["logout", "abmeld", "auslogg"], cmd: "/logout" },
2416
+ { patterns: ["komprimier", "compact", "zusammenfass"], cmd: "/compact" },
2417
+ { patterns: ["kosten", "verbrauch", "cost", "tokens.*used"], cmd: "/cost" },
2418
+ { patterns: ["update.*check", "neue.*version", "aktualisier"], cmd: "/versions" },
2419
+ { patterns: ["speicher", "memory.*show", "was weisst.*du", "erinnerung"], cmd: "/memory" },
2420
+ { patterns: ["hook", "webhook"], cmd: "/hooks" },
2421
+ ];
2422
+
2423
+ function detectIntent(text) {
2424
+ var lower = text.toLowerCase();
2425
+ // Skip if text is long (probably a real chat message)
2426
+ if (text.length > 120) return null;
2427
+ for (var i = 0; i < INTENTS.length; i++) {
2428
+ var intent = INTENTS[i];
2429
+ for (var j = 0; j < intent.patterns.length; j++) {
2430
+ if (new RegExp(intent.patterns[j], "i").test(lower)) {
2431
+ if (intent.extract) return intent.extract(text);
2432
+ return intent.cmd;
2433
+ }
2434
+ }
2435
+ }
2436
+ return null;
2437
+ }
2438
+
2397
2439
  async function processInput(input) {
2398
2440
  processing = true;
2399
2441
  eraseUI();
@@ -2416,7 +2458,16 @@ async function main() {
2416
2458
  await handleCommand(input);
2417
2459
  runHook("post", input.split(/\s+/)[0].slice(1));
2418
2460
  } else {
2419
- await sendChat(input);
2461
+ // Intent detection — natural language → command
2462
+ var detected = detectIntent(input);
2463
+ if (detected) {
2464
+ printInfo("→ " + detected);
2465
+ runHook("pre", detected.split(/\s+/)[0].slice(1));
2466
+ await handleCommand(detected);
2467
+ runHook("post", detected.split(/\s+/)[0].slice(1));
2468
+ } else {
2469
+ await sendChat(input);
2470
+ }
2420
2471
  }
2421
2472
 
2422
2473
  inputBuffer = "";
@@ -2458,6 +2509,57 @@ async function main() {
2458
2509
  return;
2459
2510
  }
2460
2511
 
2512
+ // Ctrl+V — paste (check clipboard for image)
2513
+ if (key === "\x16") {
2514
+ (async function() {
2515
+ try {
2516
+ var imgPath = path.join(os.tmpdir(), "blun_paste_" + Date.now() + ".png");
2517
+ var isWin = process.platform === "win32";
2518
+ if (isWin) {
2519
+ var psCmd = "powershell -NoProfile -Command \"$img = Get-Clipboard -Format Image; if($img){ $img.Save('" + imgPath.replace(/\\/g, "\\\\") + "'); Write-Output 'OK' } else { Write-Output 'NO' }\"";
2520
+ var psResult = require("child_process").execSync(psCmd, { encoding: "utf8", timeout: 5000 }).trim();
2521
+ if (psResult === "OK" && fs.existsSync(imgPath)) {
2522
+ eraseUI();
2523
+ printInfo("Image pasted from clipboard");
2524
+ var imgData = fs.readFileSync(imgPath).toString("base64");
2525
+ var prompt = inputBuffer.trim() || "Describe this image";
2526
+ processing = true;
2527
+ var resp = await apiCall("POST", "/chat", {
2528
+ message: prompt,
2529
+ image: imgData,
2530
+ history: chatHistory.slice(-10)
2531
+ });
2532
+ if (resp.status === 200) {
2533
+ chatHistory.push({ role: "user", content: "[image] " + prompt });
2534
+ chatHistory.push({ role: "assistant", content: resp.data.answer });
2535
+ printAnswer(resp.data.answer, "vision");
2536
+ } else {
2537
+ printError(resp.data.error || "Vision error");
2538
+ }
2539
+ inputBuffer = "";
2540
+ cursorPos = 0;
2541
+ processing = false;
2542
+ drawPrompt();
2543
+ try { fs.unlinkSync(imgPath); } catch(e) {}
2544
+ return;
2545
+ }
2546
+ }
2547
+ // No image — just paste text from clipboard
2548
+ if (isWin) {
2549
+ var clipText = require("child_process").execSync("powershell -NoProfile -Command Get-Clipboard", { encoding: "utf8", timeout: 3000 }).trim();
2550
+ if (clipText) {
2551
+ inputBuffer += clipText;
2552
+ cursorPos = inputBuffer.length;
2553
+ refreshUI();
2554
+ }
2555
+ }
2556
+ } catch(e) {
2557
+ // Fallback: ignore paste errors
2558
+ }
2559
+ })();
2560
+ return;
2561
+ }
2562
+
2461
2563
  // Tab — autocomplete from menu
2462
2564
  if (key === "\t") {
2463
2565
  if (menuVisible && menuItems.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "BLUN King CLI — Premium KI Console",
5
5
  "bin": {
6
6
  "blun": "./bin/blun.js"