@lead-routing/cli 0.1.6 → 0.1.7

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/index.js +30 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -893,9 +893,9 @@ async function seedAdminUser(localDir, localPort, adminEmail, adminPassword) {
893
893
  const safeEmail = adminEmail.replace(/'/g, "''");
894
894
  const safeWebhookSecret = webhookSecret.replace(/'/g, "''");
895
895
  const sql = `
896
- -- Create initial organisation if none exists
897
- INSERT INTO organizations (id, "webhookSecret", "createdAt", "updatedAt")
898
- SELECT gen_random_uuid(), '${safeWebhookSecret}', NOW(), NOW()
896
+ -- Create initial organisation if none exists (self-hosted defaults: PAID plan, unlimited seats/quota)
897
+ INSERT INTO organizations (id, "webhookSecret", plan, "seatsPurchased", "routingQuota", "isActive", "createdAt", "updatedAt")
898
+ SELECT gen_random_uuid(), '${safeWebhookSecret}', 'PAID', 9999, 999999, true, NOW(), NOW()
899
899
  WHERE NOT EXISTS (SELECT 1 FROM organizations);
900
900
 
901
901
  -- Create admin AppUser under the first org (idempotent)
@@ -1496,7 +1496,7 @@ async function runInit(options = {}) {
1496
1496
  log9.step("Step 1/9 Checking local prerequisites");
1497
1497
  await checkPrerequisites();
1498
1498
  log9.step("Step 2/9 SSH connection");
1499
- const sshCfg = await collectSshConfig({
1499
+ let sshCfg = await collectSshConfig({
1500
1500
  sshPort: options.sshPort,
1501
1501
  sshUser: options.sshUser,
1502
1502
  sshKey: options.sshKey,
@@ -1507,9 +1507,31 @@ async function runInit(options = {}) {
1507
1507
  await ssh.connect(sshCfg);
1508
1508
  log9.success(`Connected to ${sshCfg.host}`);
1509
1509
  } catch (err) {
1510
- log9.error(`SSH connection failed: ${String(err)}`);
1511
- log9.info("Fix your SSH credentials and re-run `lead-routing init`.");
1512
- process.exit(1);
1510
+ if (sshCfg.privateKeyPath && !sshCfg.password) {
1511
+ log9.warn(`Key auth failed \u2014 the server rejected the SSH key`);
1512
+ log9.info("Falling back to password auth\u2026");
1513
+ const pw = await promptPassword({
1514
+ message: `SSH password for ${sshCfg.username}@${sshCfg.host}`,
1515
+ validate: (v) => !v ? "Required" : void 0
1516
+ });
1517
+ if (isCancel4(pw)) {
1518
+ cancel3("Setup cancelled.");
1519
+ process.exit(0);
1520
+ }
1521
+ sshCfg = { ...sshCfg, privateKeyPath: void 0, password: pw };
1522
+ try {
1523
+ await ssh.connect(sshCfg);
1524
+ log9.success(`Connected to ${sshCfg.host}`);
1525
+ } catch (err2) {
1526
+ log9.error(`SSH connection failed: ${String(err2)}`);
1527
+ log9.info("Fix your SSH credentials and re-run `lead-routing init`.");
1528
+ process.exit(1);
1529
+ }
1530
+ } else {
1531
+ log9.error(`SSH connection failed: ${String(err)}`);
1532
+ log9.info("Fix your SSH credentials and re-run `lead-routing init`.");
1533
+ process.exit(1);
1534
+ }
1513
1535
  }
1514
1536
  }
1515
1537
  log9.step("Step 3/9 Configuration");
@@ -1976,7 +1998,7 @@ async function runSfdcDeploy() {
1976
1998
 
1977
1999
  // src/index.ts
1978
2000
  var program = new Command();
1979
- program.name("lead-routing").description("Self-hosted Lead Routing \u2014 scaffold, deploy, and manage your installation").version("0.1.0");
2001
+ program.name("lead-routing").description("Self-hosted Lead Routing \u2014 scaffold, deploy, and manage your installation").version("0.1.7");
1980
2002
  program.command("init").description("Interactive setup wizard \u2014 configure and deploy the full Lead Routing stack").option("--dry-run", "Generate config files without connecting or deploying").option("--resume", "Skip to health check using existing lead-routing.json (post-timeout recovery)").option("--sandbox", "Use Salesforce sandbox (test.salesforce.com) instead of production").option("--ssh-port <port>", "SSH port (default: 22)", parseInt).option("--ssh-user <user>", "SSH username (default: root)").option("--ssh-key <path>", "Path to SSH private key (overrides auto-detection)").option("--remote-dir <path>", "Remote install directory (default: ~/lead-routing)").option("--external-db <url>", "Use external PostgreSQL URL instead of managed Docker container").option("--external-redis <url>", "Use external Redis URL instead of managed Docker container").action((opts) => runInit({
1981
2003
  dryRun: opts.dryRun,
1982
2004
  resume: opts.resume,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lead-routing/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Self-hosted deployment CLI for Lead Routing",
5
5
  "homepage": "https://github.com/lead-routing/lead-routing",
6
6
  "keywords": ["salesforce", "lead-routing", "self-hosted", "deployment", "cli"],