@kiyeonjeon21/ncli 0.1.7 → 0.1.8

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.
@@ -13,7 +13,7 @@ function prompt(question, mask = false) {
13
13
  });
14
14
  });
15
15
  }
16
- // Masked input
16
+ // Masked input — handles both typing and paste
17
17
  return new Promise((resolve) => {
18
18
  process.stderr.write(question);
19
19
  const stdin = process.stdin;
@@ -23,27 +23,30 @@ function prompt(question, mask = false) {
23
23
  stdin.resume();
24
24
  stdin.setEncoding("utf-8");
25
25
  let input = "";
26
- const onData = (ch) => {
27
- if (ch === "\r" || ch === "\n") {
28
- stdin.removeListener("data", onData);
29
- if (stdin.isTTY)
30
- stdin.setRawMode(wasRaw ?? false);
31
- stdin.pause();
32
- process.stderr.write("\n");
33
- resolve(input.trim());
34
- }
35
- else if (ch === "\x7f" || ch === "\b") {
36
- if (input.length > 0) {
37
- input = input.slice(0, -1);
38
- process.stderr.write("\b \b");
26
+ const onData = (data) => {
27
+ for (const ch of data) {
28
+ if (ch === "\r" || ch === "\n") {
29
+ stdin.removeListener("data", onData);
30
+ if (stdin.isTTY)
31
+ stdin.setRawMode(wasRaw ?? false);
32
+ stdin.pause();
33
+ process.stderr.write("\n");
34
+ resolve(input.trim());
35
+ return;
36
+ }
37
+ else if (ch === "\x7f" || ch === "\b") {
38
+ if (input.length > 0) {
39
+ input = input.slice(0, -1);
40
+ process.stderr.write("\b \b");
41
+ }
42
+ }
43
+ else if (ch === "\x03") {
44
+ process.exit(1);
45
+ }
46
+ else {
47
+ input += ch;
48
+ process.stderr.write("*");
39
49
  }
40
- }
41
- else if (ch === "\x03") {
42
- process.exit(1);
43
- }
44
- else {
45
- input += ch;
46
- process.stderr.write("*");
47
50
  }
48
51
  };
49
52
  stdin.on("data", onData);
@@ -76,7 +79,7 @@ export const initCommand = new Command("init")
76
79
  process.stderr.write(" Register an app at: https://developers.naver.com/apps/\n");
77
80
  process.stderr.write(" Select APIs: Search, DataLab, etc.\n");
78
81
  process.stderr.write(" Web service URL: http://localhost\n\n");
79
- const clientId = await prompt(" Client ID: ");
82
+ const clientId = await prompt(" Client ID: ", true);
80
83
  if (!clientId) {
81
84
  process.stderr.write(" Aborted — no Client ID provided.\n");
82
85
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiyeonjeon21/ncli",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Agent-native CLI for Naver Open APIs",
5
5
  "type": "module",
6
6
  "bin": {