@lead-routing/cli 0.6.3 → 0.6.5
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 +24 -4
- 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,6 +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
|
+
try {
|
|
1409
|
+
let webhookSecret = "";
|
|
1410
|
+
const envEngineContent = readFileSync4(join5(dir, ".env.engine"), "utf-8");
|
|
1411
|
+
const match = envEngineContent.match(/^WEBHOOK_SECRET=(.+)$/m);
|
|
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
|
+
}
|
|
1426
|
+
} catch {
|
|
1427
|
+
}
|
|
1408
1428
|
outro(
|
|
1409
1429
|
chalk2.green("\u2714 You're live!") + `
|
|
1410
1430
|
|
|
@@ -2452,7 +2472,7 @@ import {
|
|
|
2452
2472
|
confirm as confirm5
|
|
2453
2473
|
} from "@clack/prompts";
|
|
2454
2474
|
import { execa as execa4 } from "execa";
|
|
2455
|
-
import { mkdirSync as
|
|
2475
|
+
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync8, readFileSync as readFileSync8, existsSync as existsSync7 } from "fs";
|
|
2456
2476
|
import { join as join10 } from "path";
|
|
2457
2477
|
function getDevDir() {
|
|
2458
2478
|
return join10(process.cwd(), "lead-routing-dev");
|
|
@@ -2724,7 +2744,7 @@ async function runDev(opts = {}) {
|
|
|
2724
2744
|
sfdcLoginUrl: "https://login.salesforce.com",
|
|
2725
2745
|
engineTunnelUrl: tunnelUrl?.trim() ?? ""
|
|
2726
2746
|
};
|
|
2727
|
-
|
|
2747
|
+
mkdirSync4(devDir, { recursive: true });
|
|
2728
2748
|
const dbUrl = `postgresql://leadrouting:${cfg.dbPassword}@postgres:5432/leadrouting`;
|
|
2729
2749
|
const redisUrl = `redis://:${cfg.redisPassword}@redis:6379`;
|
|
2730
2750
|
const publicEngineUrl = cfg.engineTunnelUrl || "http://localhost:3001";
|