blun-king-cli 5.1.1 → 5.1.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.
- package/blun-cli.js +17 -14
- package/package.json +1 -1
package/blun-cli.js
CHANGED
|
@@ -2615,19 +2615,18 @@ async function main() {
|
|
|
2615
2615
|
];
|
|
2616
2616
|
var trustSel = 0;
|
|
2617
2617
|
|
|
2618
|
-
// Arrow key menu for trust selection
|
|
2618
|
+
// Arrow key menu for trust selection (PowerShell compatible)
|
|
2619
2619
|
var trustChoice = await new Promise(function(resolve) {
|
|
2620
2620
|
function renderTrustMenu() {
|
|
2621
|
-
//
|
|
2622
|
-
|
|
2621
|
+
// Use VT100 cursor save/restore for Windows compatibility
|
|
2622
|
+
process.stdout.write("\x1b[s"); // save cursor
|
|
2623
2623
|
trustOptions.forEach(function(opt, i) {
|
|
2624
2624
|
var prefix = i === trustSel ? C.green + C.bold + " \u276F " : " ";
|
|
2625
2625
|
var color = i === trustSel ? C.brightWhite + C.bold : C.gray;
|
|
2626
|
-
process.stdout.write(
|
|
2626
|
+
process.stdout.write(prefix + color + (i + 1) + ". " + opt.label + C.reset + "\x1b[K\n");
|
|
2627
2627
|
});
|
|
2628
|
+
process.stdout.write("\x1b[u"); // restore cursor
|
|
2628
2629
|
}
|
|
2629
|
-
// Initial render
|
|
2630
|
-
console.log(""); console.log(""); console.log("");
|
|
2631
2630
|
renderTrustMenu();
|
|
2632
2631
|
|
|
2633
2632
|
process.stdin.setRawMode(true);
|
|
@@ -2636,15 +2635,17 @@ async function main() {
|
|
|
2636
2635
|
function onKey(key) {
|
|
2637
2636
|
if (key === "\x1b[A") { trustSel = Math.max(0, trustSel - 1); renderTrustMenu(); return; }
|
|
2638
2637
|
if (key === "\x1b[B") { trustSel = Math.min(2, trustSel + 1); renderTrustMenu(); return; }
|
|
2639
|
-
if (key === "1") { trustSel = 0; process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve(trustOptions[0].action); return; }
|
|
2640
|
-
if (key === "2") { trustSel = 1; process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve(trustOptions[1].action); return; }
|
|
2641
|
-
if (key === "3") { trustSel = 2; process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve(trustOptions[2].action); return; }
|
|
2638
|
+
if (key === "1") { trustSel = 0; process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); process.stdout.write("\n\n\n"); resolve(trustOptions[0].action); return; }
|
|
2639
|
+
if (key === "2") { trustSel = 1; process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); process.stdout.write("\n\n\n"); resolve(trustOptions[1].action); return; }
|
|
2640
|
+
if (key === "3") { trustSel = 2; process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); process.stdout.write("\n\n\n"); resolve(trustOptions[2].action); return; }
|
|
2642
2641
|
if (key === "\r" || key === "\n") {
|
|
2643
2642
|
process.stdin.removeListener("data", onKey);
|
|
2644
2643
|
process.stdin.setRawMode(false);
|
|
2644
|
+
process.stdout.write("\n\n\n");
|
|
2645
2645
|
resolve(trustOptions[trustSel].action);
|
|
2646
2646
|
return;
|
|
2647
2647
|
}
|
|
2648
|
+
if (key === "\x03") { process.exit(0); }
|
|
2648
2649
|
}
|
|
2649
2650
|
process.stdin.on("data", onKey);
|
|
2650
2651
|
});
|
|
@@ -2740,14 +2741,14 @@ async function main() {
|
|
|
2740
2741
|
var modeSel = 0;
|
|
2741
2742
|
var modeChoice = await new Promise(function(resolve) {
|
|
2742
2743
|
function renderModeMenu() {
|
|
2743
|
-
process.stdout.write("\x1b[
|
|
2744
|
+
process.stdout.write("\x1b[s");
|
|
2744
2745
|
modeOptions.forEach(function(opt, i) {
|
|
2745
2746
|
var prefix = i === modeSel ? C.green + C.bold + " \u276F " : " ";
|
|
2746
2747
|
var color = i === modeSel ? C.brightWhite + C.bold : C.gray;
|
|
2747
|
-
process.stdout.write(
|
|
2748
|
+
process.stdout.write(prefix + color + (i + 1) + ". " + opt.label + C.reset + "\x1b[K\n");
|
|
2748
2749
|
});
|
|
2750
|
+
process.stdout.write("\x1b[u");
|
|
2749
2751
|
}
|
|
2750
|
-
console.log(""); console.log("");
|
|
2751
2752
|
renderModeMenu();
|
|
2752
2753
|
process.stdin.setRawMode(true);
|
|
2753
2754
|
process.stdin.resume();
|
|
@@ -2755,14 +2756,16 @@ async function main() {
|
|
|
2755
2756
|
function onKey(key) {
|
|
2756
2757
|
if (key === "\x1b[A") { modeSel = 0; renderModeMenu(); return; }
|
|
2757
2758
|
if (key === "\x1b[B") { modeSel = 1; renderModeMenu(); return; }
|
|
2758
|
-
if (key === "1") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve("chat"); return; }
|
|
2759
|
-
if (key === "2") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve("agent"); return; }
|
|
2759
|
+
if (key === "1") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); process.stdout.write("\n\n"); resolve("chat"); return; }
|
|
2760
|
+
if (key === "2") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); process.stdout.write("\n\n"); resolve("agent"); return; }
|
|
2760
2761
|
if (key === "\r" || key === "\n") {
|
|
2761
2762
|
process.stdin.removeListener("data", onKey);
|
|
2762
2763
|
process.stdin.setRawMode(false);
|
|
2764
|
+
process.stdout.write("\n\n");
|
|
2763
2765
|
resolve(modeOptions[modeSel].mode);
|
|
2764
2766
|
return;
|
|
2765
2767
|
}
|
|
2768
|
+
if (key === "\x03") { process.exit(0); }
|
|
2766
2769
|
}
|
|
2767
2770
|
process.stdin.on("data", onKey);
|
|
2768
2771
|
});
|