oh-skillhub 0.1.13 → 0.1.14
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/package.json +1 -1
- package/src/cli.js +24 -12
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -576,6 +576,7 @@ function runRawTuiSelection(input, output, choices, agent = "codex") {
|
|
|
576
576
|
function runRawAgentSelection(input, output) {
|
|
577
577
|
return new Promise((resolve, reject) => {
|
|
578
578
|
let cursor = 0;
|
|
579
|
+
let selected = 0;
|
|
579
580
|
const wasRaw = input.isRaw;
|
|
580
581
|
|
|
581
582
|
readline.emitKeypressEvents(input);
|
|
@@ -583,7 +584,7 @@ function runRawAgentSelection(input, output) {
|
|
|
583
584
|
|
|
584
585
|
function render() {
|
|
585
586
|
output.write("\x1b[2J\x1b[H");
|
|
586
|
-
output.write(renderRawAgentMenu(cursor));
|
|
587
|
+
output.write(renderRawAgentMenu(cursor, selected));
|
|
587
588
|
}
|
|
588
589
|
|
|
589
590
|
function cleanup() {
|
|
@@ -608,9 +609,14 @@ function runRawAgentSelection(input, output) {
|
|
|
608
609
|
render();
|
|
609
610
|
return;
|
|
610
611
|
}
|
|
611
|
-
if (key &&
|
|
612
|
+
if (key && key.name === "space") {
|
|
613
|
+
selected = cursor;
|
|
614
|
+
render();
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
if (key && key.name === "return") {
|
|
612
618
|
cleanup();
|
|
613
|
-
resolve(AGENT_CHOICES[
|
|
619
|
+
resolve(AGENT_CHOICES[selected].agent);
|
|
614
620
|
}
|
|
615
621
|
}
|
|
616
622
|
|
|
@@ -623,6 +629,7 @@ function runRawAgentSelection(input, output) {
|
|
|
623
629
|
function runRawActionSelection(input, output) {
|
|
624
630
|
return new Promise((resolve, reject) => {
|
|
625
631
|
let cursor = 0;
|
|
632
|
+
let selected = 0;
|
|
626
633
|
const wasRaw = input.isRaw;
|
|
627
634
|
|
|
628
635
|
readline.emitKeypressEvents(input);
|
|
@@ -630,7 +637,7 @@ function runRawActionSelection(input, output) {
|
|
|
630
637
|
|
|
631
638
|
function render() {
|
|
632
639
|
output.write("\x1b[2J\x1b[H");
|
|
633
|
-
output.write(renderRawActionMenu(cursor));
|
|
640
|
+
output.write(renderRawActionMenu(cursor, selected));
|
|
634
641
|
}
|
|
635
642
|
|
|
636
643
|
function cleanup() {
|
|
@@ -655,9 +662,14 @@ function runRawActionSelection(input, output) {
|
|
|
655
662
|
render();
|
|
656
663
|
return;
|
|
657
664
|
}
|
|
658
|
-
if (key &&
|
|
665
|
+
if (key && key.name === "space") {
|
|
666
|
+
selected = cursor;
|
|
667
|
+
render();
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
if (key && key.name === "return") {
|
|
659
671
|
cleanup();
|
|
660
|
-
resolve(ACTION_CHOICES[
|
|
672
|
+
resolve(ACTION_CHOICES[selected].action);
|
|
661
673
|
}
|
|
662
674
|
}
|
|
663
675
|
|
|
@@ -667,7 +679,7 @@ function runRawActionSelection(input, output) {
|
|
|
667
679
|
});
|
|
668
680
|
}
|
|
669
681
|
|
|
670
|
-
function renderRawActionMenu(cursor) {
|
|
682
|
+
function renderRawActionMenu(cursor, selected = cursor) {
|
|
671
683
|
const width = 76;
|
|
672
684
|
const line = `+${"-".repeat(width - 2)}+`;
|
|
673
685
|
const lines = [
|
|
@@ -677,20 +689,20 @@ function renderRawActionMenu(cursor) {
|
|
|
677
689
|
line,
|
|
678
690
|
"",
|
|
679
691
|
colorize("Choose action", ANSI.bold),
|
|
680
|
-
colorize(" Up/Down or j/k: move Space
|
|
692
|
+
colorize(" Up/Down or j/k: move Space: select Enter: confirm Ctrl+C: cancel", ANSI.dim),
|
|
681
693
|
"",
|
|
682
694
|
];
|
|
683
695
|
ACTION_CHOICES.forEach((choice, index) => {
|
|
684
696
|
const pointer = index === cursor ? ">" : " ";
|
|
685
697
|
const highlighted = index === cursor;
|
|
686
|
-
const row = `${pointer} ${rawCheckbox(
|
|
698
|
+
const row = `${pointer} ${rawCheckbox(index === selected, highlighted)} ${choice.label.padEnd(22, " ")} ${choice.hint}`;
|
|
687
699
|
lines.push(index === cursor ? colorize(row, ANSI.reverse, ANSI.bold) : row);
|
|
688
700
|
});
|
|
689
701
|
lines.push("");
|
|
690
702
|
return `${lines.join("\n")}\n`;
|
|
691
703
|
}
|
|
692
704
|
|
|
693
|
-
function renderRawAgentMenu(cursor) {
|
|
705
|
+
function renderRawAgentMenu(cursor, selected = cursor) {
|
|
694
706
|
const width = 76;
|
|
695
707
|
const line = `+${"-".repeat(width - 2)}+`;
|
|
696
708
|
const lines = [
|
|
@@ -700,13 +712,13 @@ function renderRawAgentMenu(cursor) {
|
|
|
700
712
|
line,
|
|
701
713
|
"",
|
|
702
714
|
colorize("Choose install target", ANSI.bold),
|
|
703
|
-
colorize(" Up/Down or j/k: move Space
|
|
715
|
+
colorize(" Up/Down or j/k: move Space: select Enter: confirm Ctrl+C: cancel", ANSI.dim),
|
|
704
716
|
"",
|
|
705
717
|
];
|
|
706
718
|
AGENT_CHOICES.forEach((choice, index) => {
|
|
707
719
|
const pointer = index === cursor ? ">" : " ";
|
|
708
720
|
const highlighted = index === cursor;
|
|
709
|
-
const row = `${pointer} ${rawCheckbox(
|
|
721
|
+
const row = `${pointer} ${rawCheckbox(index === selected, highlighted)} ${choice.label.padEnd(10, " ")} ${choice.hint}`;
|
|
710
722
|
lines.push(index === cursor ? colorize(row, ANSI.reverse, ANSI.bold) : row);
|
|
711
723
|
});
|
|
712
724
|
lines.push("");
|