@openher/cli 1.0.1 → 1.0.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.
Files changed (2) hide show
  1. package/cli.mjs +19 -2
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -73,16 +73,33 @@ function which(bin) {
73
73
  }
74
74
  }
75
75
 
76
+ // Single shared readline instance — prevents piped stdin races
77
+ let _rl = null;
78
+ function getRL() {
79
+ if (!_rl) {
80
+ _rl = createInterface({ input: process.stdin, output: process.stdout });
81
+ _rl.on("close", () => { _rl = null; });
82
+ }
83
+ return _rl;
84
+ }
85
+ function closeRL() {
86
+ if (_rl) { _rl.close(); _rl = null; }
87
+ }
88
+
76
89
  function ask(question) {
77
- const rl = createInterface({ input: process.stdin, output: process.stdout });
78
90
  return new Promise((resolve) => {
91
+ const rl = getRL();
92
+ if (!rl) { resolve(""); return; }
79
93
  rl.question(`${C.cyan}[openher]${C.reset} ${question}`, (answer) => {
80
- rl.close();
81
94
  resolve(answer.trim());
82
95
  });
83
96
  });
84
97
  }
85
98
 
99
+ // Keep event loop alive until we explicitly exit (prevents early exit with piped stdin)
100
+ const _keepAlive = setInterval(() => {}, 60000);
101
+ process.on("exit", () => { clearInterval(_keepAlive); closeRL(); });
102
+
86
103
  function askSecret(question) {
87
104
  // Non-TTY fallback: just use regular readline (shows input)
88
105
  if (!process.stdin.isTTY) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openher/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "One-click installer for OpenHer Persona Engine — AI Being plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "bin": {