@hailer/mcp 1.0.22 → 1.0.23
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/dist/commands/setup.js +18 -17
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -128,50 +128,51 @@ async function prompt(rl, question, defaultValue) {
|
|
|
128
128
|
/**
|
|
129
129
|
* Prompt for password (hidden input)
|
|
130
130
|
*/
|
|
131
|
-
async function promptPassword(
|
|
131
|
+
async function promptPassword(question) {
|
|
132
132
|
return new Promise((resolve) => {
|
|
133
133
|
const stdin = process.stdin;
|
|
134
134
|
const stdout = process.stdout;
|
|
135
135
|
stdout.write(`${question}: `);
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
// Enable raw mode to capture keystrokes
|
|
136
|
+
// Pause stdin first to clear any buffered input
|
|
137
|
+
stdin.pause();
|
|
138
|
+
// Enable raw mode to capture keystrokes without echo
|
|
139
139
|
if (stdin.isTTY) {
|
|
140
140
|
stdin.setRawMode(true);
|
|
141
141
|
}
|
|
142
142
|
stdin.resume();
|
|
143
|
+
stdin.setEncoding('utf8');
|
|
143
144
|
let password = '';
|
|
144
|
-
const onData = (
|
|
145
|
-
|
|
146
|
-
switch (c) {
|
|
145
|
+
const onData = (key) => {
|
|
146
|
+
switch (key) {
|
|
147
147
|
case '\n':
|
|
148
148
|
case '\r':
|
|
149
149
|
case '\u0004': // Ctrl+D
|
|
150
150
|
// Restore terminal state
|
|
151
|
-
if (stdin.isTTY) {
|
|
152
|
-
stdin.setRawMode(wasRaw || false);
|
|
153
|
-
}
|
|
154
151
|
stdin.removeListener('data', onData);
|
|
152
|
+
stdin.setRawMode(false);
|
|
153
|
+
stdin.pause();
|
|
155
154
|
stdout.write('\n');
|
|
156
155
|
resolve(password);
|
|
157
156
|
break;
|
|
158
157
|
case '\u0003': // Ctrl+C
|
|
159
158
|
// Restore terminal state and exit
|
|
160
|
-
|
|
161
|
-
stdin.setRawMode(wasRaw || false);
|
|
162
|
-
}
|
|
159
|
+
stdin.setRawMode(false);
|
|
163
160
|
stdout.write('\n');
|
|
164
161
|
process.exit(1);
|
|
165
162
|
break;
|
|
166
163
|
case '\u007F': // Backspace
|
|
164
|
+
case '\b': // Backspace (alternative)
|
|
167
165
|
if (password.length > 0) {
|
|
168
166
|
password = password.slice(0, -1);
|
|
169
|
-
stdout.write('\b \b'); // Erase last
|
|
167
|
+
stdout.write('\b \b'); // Erase last asterisk
|
|
170
168
|
}
|
|
171
169
|
break;
|
|
172
170
|
default:
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
// Only add printable characters
|
|
172
|
+
if (key.length === 1 && key.charCodeAt(0) >= 32) {
|
|
173
|
+
password += key;
|
|
174
|
+
stdout.write('*');
|
|
175
|
+
}
|
|
175
176
|
break;
|
|
176
177
|
}
|
|
177
178
|
};
|
|
@@ -260,7 +261,7 @@ async function runSetup() {
|
|
|
260
261
|
}
|
|
261
262
|
// Close readline temporarily for password input
|
|
262
263
|
rl.close();
|
|
263
|
-
const password = await promptPassword(
|
|
264
|
+
const password = await promptPassword('Hailer password');
|
|
264
265
|
if (!password) {
|
|
265
266
|
error('Password is required');
|
|
266
267
|
process.exit(1);
|