oh-skillhub 0.1.19 → 0.1.20

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/package.json +1 -1
  2. package/src/cli.js +54 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-skillhub",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "OpenHarmony Skills installer for Codex, Claude Code, and OpenCode.",
5
5
  "type": "commonjs",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -555,14 +555,16 @@ async function runPromptSelection(input, output, choices, agent = "codex", exist
555
555
  function runRawTuiSelection(input, output, choices, agent = "codex") {
556
556
  return new Promise((resolve, reject) => {
557
557
  let cursor = 8;
558
- const selected = new Set([cursor]);
558
+ const selected = new Set();
559
+ let notice = "";
559
560
  const wasRaw = input.isRaw;
560
561
 
561
562
  prepareRawInput(input);
562
563
 
563
564
  function render() {
564
565
  output.write("\x1b[2J\x1b[H");
565
- output.write(renderRawTuiMenu(choices, cursor, selected, agent));
566
+ output.write(renderRawTuiMenu(choices, cursor, selected, agent, notice));
567
+ notice = "";
566
568
  }
567
569
 
568
570
  function cleanup() {
@@ -594,8 +596,13 @@ function runRawTuiSelection(input, output, choices, agent = "codex") {
594
596
  return;
595
597
  }
596
598
  if (key && key.name === "return") {
599
+ if (!selected.size) {
600
+ notice = "Select at least one group with Space.";
601
+ render();
602
+ return;
603
+ }
597
604
  cleanup();
598
- resolve(selected.size ? Array.from(selected).sort((a, b) => a - b) : [cursor]);
605
+ resolve(Array.from(selected).sort((a, b) => a - b));
599
606
  }
600
607
  }
601
608
 
@@ -608,14 +615,16 @@ function runRawTuiSelection(input, output, choices, agent = "codex") {
608
615
  function runRawAgentSelection(input, output) {
609
616
  return new Promise((resolve, reject) => {
610
617
  let cursor = 0;
611
- const selected = new Set([0]);
618
+ const selected = new Set();
619
+ let notice = "";
612
620
  const wasRaw = input.isRaw;
613
621
 
614
622
  prepareRawInput(input);
615
623
 
616
624
  function render() {
617
625
  output.write("\x1b[2J\x1b[H");
618
- output.write(renderRawAgentMenu(cursor, selected));
626
+ output.write(renderRawAgentMenu(cursor, selected, notice));
627
+ notice = "";
619
628
  }
620
629
 
621
630
  function cleanup() {
@@ -646,6 +655,11 @@ function runRawAgentSelection(input, output) {
646
655
  return;
647
656
  }
648
657
  if (key && key.name === "return") {
658
+ if (!normalizeAgentIndexes(selected).size) {
659
+ notice = "Select at least one target with Space.";
660
+ render();
661
+ return;
662
+ }
649
663
  cleanup();
650
664
  resolve(agentSelectionFromIndexes(selected, cursor));
651
665
  }
@@ -660,14 +674,16 @@ function runRawAgentSelection(input, output) {
660
674
  function runRawActionSelection(input, output) {
661
675
  return new Promise((resolve, reject) => {
662
676
  let cursor = 0;
663
- let selected = 0;
677
+ let selected = null;
678
+ let notice = "";
664
679
  const wasRaw = input.isRaw;
665
680
 
666
681
  prepareRawInput(input);
667
682
 
668
683
  function render() {
669
684
  output.write("\x1b[2J\x1b[H");
670
- output.write(renderRawActionMenu(cursor, selected));
685
+ output.write(renderRawActionMenu(cursor, selected, notice));
686
+ notice = "";
671
687
  }
672
688
 
673
689
  function cleanup() {
@@ -698,6 +714,11 @@ function runRawActionSelection(input, output) {
698
714
  return;
699
715
  }
700
716
  if (key && key.name === "return") {
717
+ if (selected === null) {
718
+ notice = "Select an action with Space.";
719
+ render();
720
+ return;
721
+ }
701
722
  cleanup();
702
723
  resolve(ACTION_CHOICES[selected].action);
703
724
  }
@@ -709,7 +730,7 @@ function runRawActionSelection(input, output) {
709
730
  });
710
731
  }
711
732
 
712
- function renderRawActionMenu(cursor, selected = cursor) {
733
+ function renderRawActionMenu(cursor, selected = null, notice = "") {
713
734
  const width = 76;
714
735
  const line = `+${"-".repeat(width - 2)}+`;
715
736
  const lines = [
@@ -728,6 +749,9 @@ function renderRawActionMenu(cursor, selected = cursor) {
728
749
  const row = `${pointer} ${rawCheckbox(index === selected, highlighted)} ${choice.label.padEnd(22, " ")} ${choice.hint}`;
729
750
  lines.push(index === cursor ? colorize(row, ANSI.reverse, ANSI.bold) : row);
730
751
  });
752
+ if (notice) {
753
+ lines.push("", colorize(notice, ANSI.cyan, ANSI.bold));
754
+ }
731
755
  lines.push("");
732
756
  return `${lines.join("\n")}\n`;
733
757
  }
@@ -749,7 +773,7 @@ function releaseRawInput(input, wasRaw) {
749
773
  }
750
774
  }
751
775
 
752
- function renderRawAgentMenu(cursor, selected = new Set([cursor])) {
776
+ function renderRawAgentMenu(cursor, selected = new Set(), notice = "") {
753
777
  const width = 76;
754
778
  const line = `+${"-".repeat(width - 2)}+`;
755
779
  const selectedIndexes = normalizeAgentIndexes(selected);
@@ -769,11 +793,14 @@ function renderRawAgentMenu(cursor, selected = new Set([cursor])) {
769
793
  const row = `${pointer} ${rawCheckbox(isAgentIndexSelected(selectedIndexes, index), highlighted)} ${choice.label.padEnd(10, " ")} ${choice.hint}`;
770
794
  lines.push(index === cursor ? colorize(row, ANSI.reverse, ANSI.bold) : row);
771
795
  });
796
+ if (notice) {
797
+ lines.push("", colorize(notice, ANSI.cyan, ANSI.bold));
798
+ }
772
799
  lines.push("");
773
800
  return `${lines.join("\n")}\n`;
774
801
  }
775
802
 
776
- function renderRawTuiMenu(choices, cursor, selected, agent = "codex") {
803
+ function renderRawTuiMenu(choices, cursor, selected, agent = "codex", notice = "") {
777
804
  const width = 76;
778
805
  const line = `+${"-".repeat(width - 2)}+`;
779
806
  const lines = [
@@ -800,6 +827,9 @@ function renderRawTuiMenu(choices, cursor, selected, agent = "codex") {
800
827
  lines.push(colorize(` - ${leaf}`, ANSI.dim));
801
828
  }
802
829
  });
830
+ if (notice) {
831
+ lines.push("", colorize(notice, ANSI.cyan, ANSI.bold));
832
+ }
803
833
  lines.push("");
804
834
  return `${lines.join("\n")}\n`;
805
835
  }
@@ -807,14 +837,16 @@ function renderRawTuiMenu(choices, cursor, selected, agent = "codex") {
807
837
  function runRawCleanSelection(input, output, skills) {
808
838
  return new Promise((resolve, reject) => {
809
839
  let cursor = 0;
810
- const selected = new Set([cursor]);
840
+ const selected = new Set();
841
+ let notice = "";
811
842
  const wasRaw = input.isRaw;
812
843
 
813
844
  prepareRawInput(input);
814
845
 
815
846
  function render() {
816
847
  output.write("\x1b[2J\x1b[H");
817
- output.write(renderRawCleanSelectionMenu(skills, cursor, selected));
848
+ output.write(renderRawCleanSelectionMenu(skills, cursor, selected, notice));
849
+ notice = "";
818
850
  }
819
851
 
820
852
  function cleanup() {
@@ -846,8 +878,13 @@ function runRawCleanSelection(input, output, skills) {
846
878
  return;
847
879
  }
848
880
  if (key && key.name === "return") {
881
+ if (!selected.size) {
882
+ notice = "Select at least one skill with Space.";
883
+ render();
884
+ return;
885
+ }
849
886
  cleanup();
850
- resolve(selected.size ? Array.from(selected).sort((a, b) => a - b) : [cursor]);
887
+ resolve(Array.from(selected).sort((a, b) => a - b));
851
888
  }
852
889
  }
853
890
 
@@ -857,7 +894,7 @@ function runRawCleanSelection(input, output, skills) {
857
894
  });
858
895
  }
859
896
 
860
- function renderRawCleanSelectionMenu(skills, cursor, selected) {
897
+ function renderRawCleanSelectionMenu(skills, cursor, selected, notice = "") {
861
898
  const width = 92;
862
899
  const line = `+${"-".repeat(width - 2)}+`;
863
900
  const lines = [
@@ -878,6 +915,9 @@ function renderRawCleanSelectionMenu(skills, cursor, selected) {
878
915
  const row = `${pointer} ${checkbox} ${skill.name.padEnd(36, " ")} ${skill.status.padEnd(9, " ")} ${group}`;
879
916
  lines.push(highlighted ? colorize(row, ANSI.reverse, ANSI.bold) : row);
880
917
  });
918
+ if (notice) {
919
+ lines.push("", colorize(notice, ANSI.cyan, ANSI.bold));
920
+ }
881
921
  lines.push("");
882
922
  return `${lines.join("\n")}\n`;
883
923
  }