@greennx/sales-mcp 1.3.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.
- package/dist/scripts/cli.js +22 -19
- package/package.json +1 -1
package/dist/scripts/cli.js
CHANGED
|
@@ -14,14 +14,15 @@ var BUNDLE_SRC = join(DIST_DIR, "bundle.cjs");
|
|
|
14
14
|
var IS_WIN = platform() === "win32";
|
|
15
15
|
var IS_MAC = platform() === "darwin";
|
|
16
16
|
var CLAUDE_CMD = IS_WIN ? "claude.cmd" : "claude";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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();
|
|
25
26
|
}
|
|
26
27
|
function expandTilde(p) {
|
|
27
28
|
if (p === "~") return homedir();
|
|
@@ -70,11 +71,11 @@ function printHelp() {
|
|
|
70
71
|
|
|
71
72
|
${bold("EXAMPLES")}
|
|
72
73
|
|
|
73
|
-
${dim("# Configure all detected tools
|
|
74
|
-
${cyan(`npx @greenn/sales-mcp setup
|
|
74
|
+
${dim("# Configure all detected tools (token will be prompted)")}
|
|
75
|
+
${cyan(`npx @greenn/sales-mcp setup`)}
|
|
75
76
|
|
|
76
77
|
${dim("# Use a custom directory for HTML backups")}
|
|
77
|
-
${cyan(`npx @greenn/sales-mcp setup
|
|
78
|
+
${cyan(`npx @greenn/sales-mcp setup`)} ${cyan("--history-path")} ~/backups/greenn
|
|
78
79
|
|
|
79
80
|
${dim("# Update server to the latest version")}
|
|
80
81
|
${cyan("npx @greenn/sales-mcp update")}
|
|
@@ -95,13 +96,10 @@ function printSetupHelp() {
|
|
|
95
96
|
|
|
96
97
|
${bold("USAGE")}
|
|
97
98
|
|
|
98
|
-
${cyan("sales-mcp setup")}
|
|
99
|
+
${cyan("sales-mcp setup")} [options]
|
|
99
100
|
|
|
100
101
|
${bold("OPTIONS")}
|
|
101
102
|
|
|
102
|
-
${cyan("--token")} ${yellow("<token>")} ${bold("Required.")} Your Greenn API token.
|
|
103
|
-
Obtain it at ${dim("adm.greennsales.com.br")} \u2192 Integrations & Tokens.
|
|
104
|
-
|
|
105
103
|
${cyan("--history-path")} ${yellow("<path>")} Directory where HTML backups are saved before
|
|
106
104
|
each page update. Created automatically if missing.
|
|
107
105
|
${dim(`Default: ${DEFAULT_HISTORY_PATH}`)}
|
|
@@ -110,8 +108,8 @@ function printSetupHelp() {
|
|
|
110
108
|
|
|
111
109
|
${bold("EXAMPLES")}
|
|
112
110
|
|
|
113
|
-
${cyan("npx @greenn/sales-mcp setup
|
|
114
|
-
${cyan("npx @greenn/sales-mcp setup
|
|
111
|
+
${cyan("npx @greenn/sales-mcp setup")}
|
|
112
|
+
${cyan("npx @greenn/sales-mcp setup")} ${cyan("--history-path")} ~/backups/greenn
|
|
115
113
|
`);
|
|
116
114
|
}
|
|
117
115
|
function resolveConfigPath(tool) {
|
|
@@ -257,7 +255,7 @@ if (command === "setup") {
|
|
|
257
255
|
if (!token) {
|
|
258
256
|
console.log(`
|
|
259
257
|
${dim("Tip: paste your token here to avoid shell escaping issues with special characters.")}`);
|
|
260
|
-
token = await
|
|
258
|
+
token = await prompt(` ${bold("Greenn token:")} `);
|
|
261
259
|
}
|
|
262
260
|
if (!token) {
|
|
263
261
|
console.error(`
|
|
@@ -271,7 +269,12 @@ if (command === "setup") {
|
|
|
271
269
|
`);
|
|
272
270
|
process.exit(1);
|
|
273
271
|
}
|
|
274
|
-
|
|
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();
|
|
275
278
|
const serverDest = join(DEFAULT_INSTALL_DIR, "server.cjs");
|
|
276
279
|
mkdirSync(DEFAULT_INSTALL_DIR, { recursive: true });
|
|
277
280
|
mkdirSync(historyPath, { recursive: true });
|