@greennx/sales-mcp 1.2.0 → 1.4.0

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.
Files changed (2) hide show
  1. package/dist/scripts/cli.js +30 -14
  2. package/package.json +1 -1
@@ -7,12 +7,23 @@ import { mkdirSync, copyFileSync, existsSync, readFileSync, writeFileSync } from
7
7
  import { join, dirname } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { homedir, platform } from "node:os";
10
+ import { createInterface } from "node:readline";
10
11
  var here = dirname(fileURLToPath(import.meta.url));
11
12
  var DIST_DIR = join(here, "..");
12
13
  var BUNDLE_SRC = join(DIST_DIR, "bundle.cjs");
13
14
  var IS_WIN = platform() === "win32";
14
15
  var IS_MAC = platform() === "darwin";
15
16
  var CLAUDE_CMD = IS_WIN ? "claude.cmd" : "claude";
17
+ var _rl = createInterface({ input: process.stdin, output: process.stdout, terminal: TTY });
18
+ var _lines = _rl[Symbol.asyncIterator]();
19
+ async function prompt(question) {
20
+ process.stdout.write(question);
21
+ const result = await _lines.next();
22
+ return result.done ? "" : result.value.trim();
23
+ }
24
+ function closeRL() {
25
+ _rl.close();
26
+ }
16
27
  function expandTilde(p) {
17
28
  if (p === "~") return homedir();
18
29
  if (p.startsWith("~/") || p.startsWith("~\\")) return join(homedir(), p.slice(2));
@@ -60,11 +71,11 @@ function printHelp() {
60
71
 
61
72
  ${bold("EXAMPLES")}
62
73
 
63
- ${dim("# Configure all detected tools with your Greenn token")}
64
- ${cyan(`npx @greenn/sales-mcp setup --token`)} <your-token>
74
+ ${dim("# Configure all detected tools (token will be prompted)")}
75
+ ${cyan(`npx @greenn/sales-mcp setup`)}
65
76
 
66
77
  ${dim("# Use a custom directory for HTML backups")}
67
- ${cyan(`npx @greenn/sales-mcp setup --token`)} <your-token> ${cyan("--history-path")} ~/backups/greenn
78
+ ${cyan(`npx @greenn/sales-mcp setup`)} ${cyan("--history-path")} ~/backups/greenn
68
79
 
69
80
  ${dim("# Update server to the latest version")}
70
81
  ${cyan("npx @greenn/sales-mcp update")}
@@ -85,13 +96,10 @@ function printSetupHelp() {
85
96
 
86
97
  ${bold("USAGE")}
87
98
 
88
- ${cyan("sales-mcp setup")} --token <token> [options]
99
+ ${cyan("sales-mcp setup")} [options]
89
100
 
90
101
  ${bold("OPTIONS")}
91
102
 
92
- ${cyan("--token")} ${yellow("<token>")} ${bold("Required.")} Your Greenn API token.
93
- Obtain it at ${dim("adm.greennsales.com.br")} \u2192 Integrations & Tokens.
94
-
95
103
  ${cyan("--history-path")} ${yellow("<path>")} Directory where HTML backups are saved before
96
104
  each page update. Created automatically if missing.
97
105
  ${dim(`Default: ${DEFAULT_HISTORY_PATH}`)}
@@ -100,8 +108,8 @@ function printSetupHelp() {
100
108
 
101
109
  ${bold("EXAMPLES")}
102
110
 
103
- ${cyan("npx @greenn/sales-mcp setup --token")} sk-abc123
104
- ${cyan("npx @greenn/sales-mcp setup --token")} sk-abc123 ${cyan("--history-path")} ~/backups/greenn
111
+ ${cyan("npx @greenn/sales-mcp setup")}
112
+ ${cyan("npx @greenn/sales-mcp setup")} ${cyan("--history-path")} ~/backups/greenn
105
113
  `);
106
114
  }
107
115
  function resolveConfigPath(tool) {
@@ -243,12 +251,15 @@ if (command === "setup") {
243
251
  },
244
252
  strict: false
245
253
  });
246
- const token = values["token"];
254
+ let token = values["token"];
255
+ if (!token) {
256
+ console.log(`
257
+ ${dim("Tip: paste your token here to avoid shell escaping issues with special characters.")}`);
258
+ token = await prompt(` ${bold("Greenn token:")} `);
259
+ }
247
260
  if (!token) {
248
261
  console.error(`
249
- ${red("error")} --token is required
250
- `);
251
- console.error(` Run ${cyan('"sales-mcp setup --help"')} for more information.
262
+ ${red("error")} token is required
252
263
  `);
253
264
  process.exit(1);
254
265
  }
@@ -258,7 +269,12 @@ if (command === "setup") {
258
269
  `);
259
270
  process.exit(1);
260
271
  }
261
- const historyPath = expandTilde(values["history-path"] ?? DEFAULT_HISTORY_PATH);
272
+ let historyPath = expandTilde(values["history-path"] ?? "");
273
+ if (!historyPath) {
274
+ const answer = await prompt(` ${bold("Backup directory")} ${dim(`(Enter for default: ${DEFAULT_HISTORY_PATH}):`)} `);
275
+ historyPath = answer ? expandTilde(answer) : DEFAULT_HISTORY_PATH;
276
+ }
277
+ closeRL();
262
278
  const serverDest = join(DEFAULT_INSTALL_DIR, "server.cjs");
263
279
  mkdirSync(DEFAULT_INSTALL_DIR, { recursive: true });
264
280
  mkdirSync(historyPath, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greennx/sales-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "MCP server for AI-generated landing pages on the Greenn Sales platform",
5
5
  "type": "module",
6
6
  "bin": {