@lead-routing/cli 0.6.4 → 0.6.6
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/index.js +19 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ import { Command } from "commander";
|
|
|
5
5
|
|
|
6
6
|
// src/commands/init.ts
|
|
7
7
|
import { promises as dns } from "dns";
|
|
8
|
-
import { readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
8
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3 } from "fs";
|
|
9
9
|
import { exec } from "child_process";
|
|
10
|
-
import { platform } from "os";
|
|
10
|
+
import { platform, homedir as homedir3 } from "os";
|
|
11
11
|
import { join as join5 } from "path";
|
|
12
12
|
import { intro, outro, note as note3, log as log7, confirm, cancel as cancel3, isCancel as isCancel3, password as promptPassword, select, text as text3 } from "@clack/prompts";
|
|
13
13
|
import chalk2 from "chalk";
|
|
@@ -1405,24 +1405,26 @@ Files created: docker-compose.yml, Caddyfile, .env.web, .env.engine, lead-routin
|
|
|
1405
1405
|
The managed package is already installed \u2014 just click "Connect Salesforce" to authorize.`,
|
|
1406
1406
|
"Next: Connect Salesforce"
|
|
1407
1407
|
);
|
|
1408
|
-
let webhookSecret = "";
|
|
1409
1408
|
try {
|
|
1409
|
+
let webhookSecret = "";
|
|
1410
1410
|
const envEngineContent = readFileSync4(join5(dir, ".env.engine"), "utf-8");
|
|
1411
|
-
const match = envEngineContent.match(/^WEBHOOK_SECRET=(.+)$/m);
|
|
1411
|
+
const match = envEngineContent.match(/^(?:ENGINE_)?WEBHOOK_SECRET=(.+)$/m);
|
|
1412
1412
|
if (match) webhookSecret = match[1].trim();
|
|
1413
|
+
if (webhookSecret) {
|
|
1414
|
+
const mcpDir = join5(homedir3(), ".lead-routing");
|
|
1415
|
+
mkdirSync3(mcpDir, { recursive: true });
|
|
1416
|
+
writeFileSync4(
|
|
1417
|
+
join5(mcpDir, "mcp.json"),
|
|
1418
|
+
JSON.stringify({ appUrl: cfg.appUrl, engineUrl: cfg.engineUrl, webhookSecret }, null, 2),
|
|
1419
|
+
"utf-8"
|
|
1420
|
+
);
|
|
1421
|
+
note3(
|
|
1422
|
+
"Connect Lead Routing to Claude Code with one command:\n\n" + chalk2.cyan("claude mcp add lead-routing -- npx -y @lead-routing/mcp"),
|
|
1423
|
+
"Claude Code MCP"
|
|
1424
|
+
);
|
|
1425
|
+
}
|
|
1413
1426
|
} catch {
|
|
1414
1427
|
}
|
|
1415
|
-
if (webhookSecret) {
|
|
1416
|
-
const mcpCmd = `claude mcp add lead-routing \\
|
|
1417
|
-
-e APP_URL=${cfg.appUrl} \\
|
|
1418
|
-
-e ENGINE_URL=${cfg.engineUrl} \\
|
|
1419
|
-
-e WEBHOOK_SECRET=${webhookSecret} \\
|
|
1420
|
-
-- npx -y @lead-routing/mcp`;
|
|
1421
|
-
note3(
|
|
1422
|
-
"Paste this command in your terminal to connect Lead Routing to Claude Code:\n\n" + chalk2.cyan(mcpCmd),
|
|
1423
|
-
"Claude Code MCP"
|
|
1424
|
-
);
|
|
1425
|
-
}
|
|
1426
1428
|
outro(
|
|
1427
1429
|
chalk2.green("\u2714 You're live!") + `
|
|
1428
1430
|
|
|
@@ -2470,7 +2472,7 @@ import {
|
|
|
2470
2472
|
confirm as confirm5
|
|
2471
2473
|
} from "@clack/prompts";
|
|
2472
2474
|
import { execa as execa4 } from "execa";
|
|
2473
|
-
import { mkdirSync as
|
|
2475
|
+
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync8, readFileSync as readFileSync8, existsSync as existsSync7 } from "fs";
|
|
2474
2476
|
import { join as join10 } from "path";
|
|
2475
2477
|
function getDevDir() {
|
|
2476
2478
|
return join10(process.cwd(), "lead-routing-dev");
|
|
@@ -2742,7 +2744,7 @@ async function runDev(opts = {}) {
|
|
|
2742
2744
|
sfdcLoginUrl: "https://login.salesforce.com",
|
|
2743
2745
|
engineTunnelUrl: tunnelUrl?.trim() ?? ""
|
|
2744
2746
|
};
|
|
2745
|
-
|
|
2747
|
+
mkdirSync4(devDir, { recursive: true });
|
|
2746
2748
|
const dbUrl = `postgresql://leadrouting:${cfg.dbPassword}@postgres:5432/leadrouting`;
|
|
2747
2749
|
const redisUrl = `redis://:${cfg.redisPassword}@redis:6379`;
|
|
2748
2750
|
const publicEngineUrl = cfg.engineTunnelUrl || "http://localhost:3001";
|