@hailer/mcp 1.0.26 → 1.0.28
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 +25 -42
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -47,57 +47,40 @@ const os = __importStar(require("os"));
|
|
|
47
47
|
const readline = __importStar(require("readline"));
|
|
48
48
|
const CLAUDE_CONFIG_DIR = path.join(os.homedir(), 'Library', 'Application Support', 'Claude');
|
|
49
49
|
const CLAUDE_CONFIG_FILE = path.join(CLAUDE_CONFIG_DIR, 'claude_desktop_config.json');
|
|
50
|
+
/**
|
|
51
|
+
* Muted output stream for password input
|
|
52
|
+
*/
|
|
53
|
+
class MutedStream {
|
|
54
|
+
writable = true;
|
|
55
|
+
muted = false;
|
|
56
|
+
write() { return true; }
|
|
57
|
+
end() { }
|
|
58
|
+
}
|
|
50
59
|
/**
|
|
51
60
|
* Prompt user for input
|
|
52
61
|
*/
|
|
53
62
|
function prompt(question, isPassword = false) {
|
|
54
|
-
const rl = readline.createInterface({
|
|
55
|
-
input: process.stdin,
|
|
56
|
-
output: process.stdout,
|
|
57
|
-
});
|
|
58
63
|
return new Promise((resolve) => {
|
|
59
64
|
if (isPassword) {
|
|
60
|
-
//
|
|
65
|
+
// Use muted stream to hide password - most reliable cross-terminal approach
|
|
66
|
+
const mutedOutput = new MutedStream();
|
|
67
|
+
const rl = readline.createInterface({
|
|
68
|
+
input: process.stdin,
|
|
69
|
+
output: mutedOutput,
|
|
70
|
+
terminal: true,
|
|
71
|
+
});
|
|
61
72
|
process.stdout.write(question);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
stdin.resume();
|
|
69
|
-
stdin.setEncoding('utf8');
|
|
70
|
-
const onData = (char) => {
|
|
71
|
-
const charCode = char.charCodeAt(0);
|
|
72
|
-
if (charCode === 13 || charCode === 10) {
|
|
73
|
-
// Enter
|
|
74
|
-
stdin.removeListener('data', onData);
|
|
75
|
-
if (stdin.isTTY) {
|
|
76
|
-
stdin.setRawMode(wasRaw ?? false);
|
|
77
|
-
}
|
|
78
|
-
process.stdout.write('\n');
|
|
79
|
-
rl.close();
|
|
80
|
-
resolve(password);
|
|
81
|
-
}
|
|
82
|
-
else if (charCode === 3) {
|
|
83
|
-
// Ctrl+C
|
|
84
|
-
process.exit();
|
|
85
|
-
}
|
|
86
|
-
else if (charCode === 127 || charCode === 8) {
|
|
87
|
-
// Backspace
|
|
88
|
-
if (password.length > 0) {
|
|
89
|
-
password = password.slice(0, -1);
|
|
90
|
-
process.stdout.write('\b \b');
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
password += char;
|
|
95
|
-
process.stdout.write('*');
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
stdin.on('data', onData);
|
|
73
|
+
rl.question('', (answer) => {
|
|
74
|
+
rl.close();
|
|
75
|
+
process.stdout.write('\n');
|
|
76
|
+
resolve(answer);
|
|
77
|
+
});
|
|
99
78
|
}
|
|
100
79
|
else {
|
|
80
|
+
const rl = readline.createInterface({
|
|
81
|
+
input: process.stdin,
|
|
82
|
+
output: process.stdout,
|
|
83
|
+
});
|
|
101
84
|
rl.question(question, (answer) => {
|
|
102
85
|
rl.close();
|
|
103
86
|
resolve(answer.trim());
|