oh-skillhub 0.1.18 → 0.1.19

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 +27 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-skillhub",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "OpenHarmony Skills installer for Codex, Claude Code, and OpenCode.",
5
5
  "type": "commonjs",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -558,8 +558,7 @@ function runRawTuiSelection(input, output, choices, agent = "codex") {
558
558
  const selected = new Set([cursor]);
559
559
  const wasRaw = input.isRaw;
560
560
 
561
- readline.emitKeypressEvents(input);
562
- input.setRawMode(true);
561
+ prepareRawInput(input);
563
562
 
564
563
  function render() {
565
564
  output.write("\x1b[2J\x1b[H");
@@ -568,7 +567,7 @@ function runRawTuiSelection(input, output, choices, agent = "codex") {
568
567
 
569
568
  function cleanup() {
570
569
  input.removeListener("keypress", onKeypress);
571
- input.setRawMode(Boolean(wasRaw));
570
+ releaseRawInput(input, wasRaw);
572
571
  output.write("\x1b[?25h");
573
572
  }
574
573
 
@@ -612,8 +611,7 @@ function runRawAgentSelection(input, output) {
612
611
  const selected = new Set([0]);
613
612
  const wasRaw = input.isRaw;
614
613
 
615
- readline.emitKeypressEvents(input);
616
- input.setRawMode(true);
614
+ prepareRawInput(input);
617
615
 
618
616
  function render() {
619
617
  output.write("\x1b[2J\x1b[H");
@@ -622,7 +620,7 @@ function runRawAgentSelection(input, output) {
622
620
 
623
621
  function cleanup() {
624
622
  input.removeListener("keypress", onKeypress);
625
- input.setRawMode(Boolean(wasRaw));
623
+ releaseRawInput(input, wasRaw);
626
624
  output.write("\x1b[?25h");
627
625
  }
628
626
 
@@ -665,8 +663,7 @@ function runRawActionSelection(input, output) {
665
663
  let selected = 0;
666
664
  const wasRaw = input.isRaw;
667
665
 
668
- readline.emitKeypressEvents(input);
669
- input.setRawMode(true);
666
+ prepareRawInput(input);
670
667
 
671
668
  function render() {
672
669
  output.write("\x1b[2J\x1b[H");
@@ -675,7 +672,7 @@ function runRawActionSelection(input, output) {
675
672
 
676
673
  function cleanup() {
677
674
  input.removeListener("keypress", onKeypress);
678
- input.setRawMode(Boolean(wasRaw));
675
+ releaseRawInput(input, wasRaw);
679
676
  output.write("\x1b[?25h");
680
677
  }
681
678
 
@@ -735,6 +732,23 @@ function renderRawActionMenu(cursor, selected = cursor) {
735
732
  return `${lines.join("\n")}\n`;
736
733
  }
737
734
 
735
+ function prepareRawInput(input) {
736
+ if (typeof input.on === "function" && typeof input.listenerCount === "function") {
737
+ readline.emitKeypressEvents(input);
738
+ }
739
+ input.setRawMode(true);
740
+ if (typeof input.resume === "function") {
741
+ input.resume();
742
+ }
743
+ }
744
+
745
+ function releaseRawInput(input, wasRaw) {
746
+ input.setRawMode(Boolean(wasRaw));
747
+ if (!wasRaw && typeof input.pause === "function") {
748
+ input.pause();
749
+ }
750
+ }
751
+
738
752
  function renderRawAgentMenu(cursor, selected = new Set([cursor])) {
739
753
  const width = 76;
740
754
  const line = `+${"-".repeat(width - 2)}+`;
@@ -796,8 +810,7 @@ function runRawCleanSelection(input, output, skills) {
796
810
  const selected = new Set([cursor]);
797
811
  const wasRaw = input.isRaw;
798
812
 
799
- readline.emitKeypressEvents(input);
800
- input.setRawMode(true);
813
+ prepareRawInput(input);
801
814
 
802
815
  function render() {
803
816
  output.write("\x1b[2J\x1b[H");
@@ -806,7 +819,7 @@ function runRawCleanSelection(input, output, skills) {
806
819
 
807
820
  function cleanup() {
808
821
  input.removeListener("keypress", onKeypress);
809
- input.setRawMode(Boolean(wasRaw));
822
+ releaseRawInput(input, wasRaw);
810
823
  output.write("\x1b[?25h");
811
824
  }
812
825
 
@@ -1156,6 +1169,8 @@ module.exports = {
1156
1169
  renderRawAgentMenu,
1157
1170
  renderRawCleanSelectionMenu,
1158
1171
  parseSelection,
1172
+ prepareRawInput,
1173
+ releaseRawInput,
1159
1174
  renderRawTuiMenu,
1160
1175
  renderTuiMenu,
1161
1176
  withSpinner,