@drawpro/mcp 0.1.0 → 0.1.1
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/server.js +41 -13
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -337,23 +337,51 @@ function forgetKey(email) {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
// ../client/src/prompt.ts
|
|
340
|
-
var import_node_readline = require("node:readline");
|
|
341
|
-
var CLEAR_LINE = "\x1B[2K\x1B[200D";
|
|
342
340
|
function askHidden(question) {
|
|
343
341
|
return new Promise((resolve) => {
|
|
344
|
-
const
|
|
342
|
+
const input = process.stdin;
|
|
345
343
|
process.stdout.write(question);
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
344
|
+
if (!input.isTTY) {
|
|
345
|
+
let buffered = "";
|
|
346
|
+
input.setEncoding("utf8");
|
|
347
|
+
input.on("data", (chunk) => {
|
|
348
|
+
buffered += chunk;
|
|
349
|
+
});
|
|
350
|
+
input.on("end", () => resolve(buffered.split("\n")[0].trim()));
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const wasRaw = input.isRaw;
|
|
354
|
+
input.setRawMode(true);
|
|
355
|
+
input.resume();
|
|
356
|
+
input.setEncoding("utf8");
|
|
357
|
+
let value = "";
|
|
358
|
+
const finish = (result) => {
|
|
359
|
+
input.removeListener("data", onData);
|
|
360
|
+
input.setRawMode(wasRaw);
|
|
361
|
+
input.pause();
|
|
354
362
|
process.stdout.write("\n");
|
|
355
|
-
|
|
356
|
-
|
|
363
|
+
if (result === null) {
|
|
364
|
+
process.exit(130);
|
|
365
|
+
}
|
|
366
|
+
resolve(result);
|
|
367
|
+
};
|
|
368
|
+
const onData = (chunk) => {
|
|
369
|
+
for (const ch of chunk) {
|
|
370
|
+
if (ch === "\r" || ch === "\n") return finish(value);
|
|
371
|
+
if (ch === "") return finish(null);
|
|
372
|
+
if (ch === "\x7F" || ch === "\b") {
|
|
373
|
+
if (value.length > 0) {
|
|
374
|
+
value = value.slice(0, -1);
|
|
375
|
+
process.stdout.write("\b \b");
|
|
376
|
+
}
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
if (ch < " ") continue;
|
|
380
|
+
value += ch;
|
|
381
|
+
process.stdout.write("*");
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
input.on("data", onData);
|
|
357
385
|
});
|
|
358
386
|
}
|
|
359
387
|
|