@hailer/mcp 1.0.26 → 1.0.27
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/cli.js +43 -32
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -51,53 +51,64 @@ const CLAUDE_CONFIG_FILE = path.join(CLAUDE_CONFIG_DIR, 'claude_desktop_config.j
|
|
|
51
51
|
* Prompt user for input
|
|
52
52
|
*/
|
|
53
53
|
function prompt(question, isPassword = false) {
|
|
54
|
-
const rl = readline.createInterface({
|
|
55
|
-
input: process.stdin,
|
|
56
|
-
output: process.stdout,
|
|
57
|
-
});
|
|
58
54
|
return new Promise((resolve) => {
|
|
59
55
|
if (isPassword) {
|
|
60
|
-
// For password,
|
|
56
|
+
// For password input, use raw mode to hide characters
|
|
61
57
|
process.stdout.write(question);
|
|
62
58
|
let password = '';
|
|
63
59
|
const stdin = process.stdin;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
stdin.
|
|
60
|
+
if (!stdin.isTTY) {
|
|
61
|
+
// Not a TTY, fall back to simple readline (won't hide password)
|
|
62
|
+
const rl = readline.createInterface({ input: stdin, output: process.stdout });
|
|
63
|
+
rl.question('', (answer) => {
|
|
64
|
+
rl.close();
|
|
65
|
+
resolve(answer.trim());
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
67
68
|
}
|
|
69
|
+
stdin.setRawMode(true);
|
|
68
70
|
stdin.resume();
|
|
69
71
|
stdin.setEncoding('utf8');
|
|
70
|
-
const onData = (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
stdin.setRawMode(
|
|
72
|
+
const onData = (key) => {
|
|
73
|
+
// Handle each character
|
|
74
|
+
for (const char of key) {
|
|
75
|
+
const code = char.charCodeAt(0);
|
|
76
|
+
if (code === 13 || code === 10) {
|
|
77
|
+
// Enter - done
|
|
78
|
+
stdin.setRawMode(false);
|
|
79
|
+
stdin.pause();
|
|
80
|
+
stdin.removeListener('data', onData);
|
|
81
|
+
process.stdout.write('\n');
|
|
82
|
+
resolve(password);
|
|
83
|
+
return;
|
|
77
84
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
else if (code === 3) {
|
|
86
|
+
// Ctrl+C - exit
|
|
87
|
+
stdin.setRawMode(false);
|
|
88
|
+
process.stdout.write('\n');
|
|
89
|
+
process.exit(0);
|
|
90
|
+
}
|
|
91
|
+
else if (code === 127 || code === 8) {
|
|
92
|
+
// Backspace
|
|
93
|
+
if (password.length > 0) {
|
|
94
|
+
password = password.slice(0, -1);
|
|
95
|
+
process.stdout.write('\b \b');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else if (code >= 32) {
|
|
99
|
+
// Printable character
|
|
100
|
+
password += char;
|
|
101
|
+
process.stdout.write('*');
|
|
91
102
|
}
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
password += char;
|
|
95
|
-
process.stdout.write('*');
|
|
96
103
|
}
|
|
97
104
|
};
|
|
98
105
|
stdin.on('data', onData);
|
|
99
106
|
}
|
|
100
107
|
else {
|
|
108
|
+
const rl = readline.createInterface({
|
|
109
|
+
input: process.stdin,
|
|
110
|
+
output: process.stdout,
|
|
111
|
+
});
|
|
101
112
|
rl.question(question, (answer) => {
|
|
102
113
|
rl.close();
|
|
103
114
|
resolve(answer.trim());
|