blun-king-cli 5.1.2 → 5.1.4
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 +27 -44
- package/package.json +1 -1
package/blun-cli.js
CHANGED
|
@@ -2614,41 +2614,30 @@ async function main() {
|
|
|
2614
2614
|
{ label: "Choose another folder", action: "choose" }
|
|
2615
2615
|
];
|
|
2616
2616
|
var trustSel = 0;
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
function renderTrustMenu() {
|
|
2621
|
-
// Use VT100 cursor save/restore for Windows compatibility
|
|
2622
|
-
process.stdout.write("\x1b[s"); // save cursor
|
|
2617
|
+
var trustResult = await new Promise(function(resolve) {
|
|
2618
|
+
function render() {
|
|
2619
|
+
process.stdout.write("\x1b[3A\r");
|
|
2623
2620
|
trustOptions.forEach(function(opt, i) {
|
|
2624
|
-
var prefix = i === trustSel ?
|
|
2625
|
-
var color = i === trustSel ?
|
|
2626
|
-
process.stdout.write(prefix + color + (i + 1) + ". " + opt.label +
|
|
2621
|
+
var prefix = i === trustSel ? "\x1b[32m\x1b[1m \u276F " : " ";
|
|
2622
|
+
var color = i === trustSel ? "\x1b[97m\x1b[1m" : "\x1b[90m";
|
|
2623
|
+
process.stdout.write("\x1b[2K" + prefix + color + (i + 1) + ". " + opt.label + "\x1b[0m\n");
|
|
2627
2624
|
});
|
|
2628
|
-
process.stdout.write("\x1b[u"); // restore cursor
|
|
2629
2625
|
}
|
|
2630
|
-
|
|
2631
|
-
|
|
2626
|
+
console.log(""); console.log(""); console.log("");
|
|
2627
|
+
render();
|
|
2632
2628
|
process.stdin.setRawMode(true);
|
|
2633
2629
|
process.stdin.resume();
|
|
2634
2630
|
process.stdin.setEncoding("utf8");
|
|
2635
2631
|
function onKey(key) {
|
|
2636
|
-
if (key === "\x1b[A") { trustSel = Math.max(0, trustSel - 1);
|
|
2637
|
-
if (key === "\x1b[B") { trustSel = Math.min(2, trustSel + 1);
|
|
2638
|
-
if (key === "1") { trustSel =
|
|
2639
|
-
if (key === "
|
|
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; }
|
|
2641
|
-
if (key === "\r" || key === "\n") {
|
|
2642
|
-
process.stdin.removeListener("data", onKey);
|
|
2643
|
-
process.stdin.setRawMode(false);
|
|
2644
|
-
process.stdout.write("\n\n\n");
|
|
2645
|
-
resolve(trustOptions[trustSel].action);
|
|
2646
|
-
return;
|
|
2647
|
-
}
|
|
2632
|
+
if (key === "\x1b[A") { trustSel = Math.max(0, trustSel - 1); render(); return; }
|
|
2633
|
+
if (key === "\x1b[B") { trustSel = Math.min(2, trustSel + 1); render(); return; }
|
|
2634
|
+
if (key === "1" || key === "2" || key === "3") { trustSel = parseInt(key) - 1; process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve(trustOptions[trustSel]); return; }
|
|
2635
|
+
if (key === "\r" || key === "\n") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve(trustOptions[trustSel]); return; }
|
|
2648
2636
|
if (key === "\x03") { process.exit(0); }
|
|
2649
2637
|
}
|
|
2650
2638
|
process.stdin.on("data", onKey);
|
|
2651
2639
|
});
|
|
2640
|
+
var trustChoice = trustResult.action;
|
|
2652
2641
|
|
|
2653
2642
|
if (trustChoice === "always") {
|
|
2654
2643
|
trustedDirs.push(process.cwd());
|
|
@@ -2735,36 +2724,30 @@ async function main() {
|
|
|
2735
2724
|
console.log(C.brightWhite + C.bold + " How do you want to work?" + C.reset);
|
|
2736
2725
|
console.log("");
|
|
2737
2726
|
var modeOptions = [
|
|
2738
|
-
{ label: "Chat
|
|
2739
|
-
{ label: "Agent
|
|
2727
|
+
{ label: "Chat \u2014 talk back and forth", mode: "chat" },
|
|
2728
|
+
{ label: "Agent \u2014 give a goal, I do the rest autonomously", mode: "agent" }
|
|
2740
2729
|
];
|
|
2741
2730
|
var modeSel = 0;
|
|
2742
2731
|
var modeChoice = await new Promise(function(resolve) {
|
|
2743
|
-
function
|
|
2744
|
-
process.stdout.write("\x1b[
|
|
2732
|
+
function render() {
|
|
2733
|
+
process.stdout.write("\x1b[2A\r");
|
|
2745
2734
|
modeOptions.forEach(function(opt, i) {
|
|
2746
|
-
var prefix = i === modeSel ?
|
|
2747
|
-
var color = i === modeSel ?
|
|
2748
|
-
process.stdout.write(prefix + color + (i + 1) + ". " + opt.label +
|
|
2735
|
+
var prefix = i === modeSel ? "\x1b[32m\x1b[1m \u276F " : " ";
|
|
2736
|
+
var color = i === modeSel ? "\x1b[97m\x1b[1m" : "\x1b[90m";
|
|
2737
|
+
process.stdout.write("\x1b[2K" + prefix + color + (i + 1) + ". " + opt.label + "\x1b[0m\n");
|
|
2749
2738
|
});
|
|
2750
|
-
process.stdout.write("\x1b[u");
|
|
2751
2739
|
}
|
|
2752
|
-
|
|
2740
|
+
console.log(""); console.log("");
|
|
2741
|
+
render();
|
|
2753
2742
|
process.stdin.setRawMode(true);
|
|
2754
2743
|
process.stdin.resume();
|
|
2755
2744
|
process.stdin.setEncoding("utf8");
|
|
2756
2745
|
function onKey(key) {
|
|
2757
|
-
if (key === "\x1b[A") { modeSel = 0;
|
|
2758
|
-
if (key === "\x1b[B") { modeSel = 1;
|
|
2759
|
-
if (key === "1") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false);
|
|
2760
|
-
if (key === "2") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false);
|
|
2761
|
-
if (key === "\r" || key === "\n") {
|
|
2762
|
-
process.stdin.removeListener("data", onKey);
|
|
2763
|
-
process.stdin.setRawMode(false);
|
|
2764
|
-
process.stdout.write("\n\n");
|
|
2765
|
-
resolve(modeOptions[modeSel].mode);
|
|
2766
|
-
return;
|
|
2767
|
-
}
|
|
2746
|
+
if (key === "\x1b[A") { modeSel = 0; render(); return; }
|
|
2747
|
+
if (key === "\x1b[B") { modeSel = 1; render(); return; }
|
|
2748
|
+
if (key === "1") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve("chat"); return; }
|
|
2749
|
+
if (key === "2") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve("agent"); return; }
|
|
2750
|
+
if (key === "\r" || key === "\n") { process.stdin.removeListener("data", onKey); process.stdin.setRawMode(false); resolve(modeOptions[modeSel].mode); return; }
|
|
2768
2751
|
if (key === "\x03") { process.exit(0); }
|
|
2769
2752
|
}
|
|
2770
2753
|
process.stdin.on("data", onKey);
|