@ascendkit/cli 0.3.13 → 0.3.14

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/cli.js CHANGED
@@ -40,13 +40,14 @@ Services:
40
40
  survey Surveys, questions, distribution, analytics
41
41
  journey Lifecycle journeys, nodes, transitions
42
42
  email-identity Email domains, sender identities, and DNS
43
- env Environment variable settings
43
+ vars Environment variable settings
44
44
  webhook Webhook endpoints and testing
45
45
  campaign Email campaigns, scheduling, analytics
46
46
  import Import users from external auth providers
47
47
 
48
48
  Project Management:
49
- project Projects and environment selection
49
+ project Projects and project creation
50
+ env List environments for a project
50
51
  environment Active environment operations
51
52
  verify Check all services in the active environment
52
53
 
@@ -57,10 +58,9 @@ const HELP_SECTION = {
57
58
 
58
59
  Commands:
59
60
  auth show
60
- auth update [--providers <p1,p2,...>] [--email-verification <true|false>] [--waitlist <true|false>] [--password-reset <true|false>] [--session-duration <duration>]
61
+ auth update [--providers <p1,p2,...>] [--email-verification <true|false>] [--waitlist <true|false>] [--password-reset <true|false>] [--session-duration <duration>] [--allowed-domains <d1,d2,...>] [--block-personal-domains <true|false>]
61
62
  auth provider list
62
63
  auth provider set <p1,p2,...>
63
- auth oauth open <provider>
64
64
  auth oauth set <provider> --client-id <id> [--client-secret <secret> | --client-secret-stdin]
65
65
  auth oauth remove <provider>
66
66
  auth user list
@@ -167,12 +167,18 @@ Commands:
167
167
  environment show
168
168
  environment update [<env-id>] [--name <name>] [--description <desc>]
169
169
  environment promote [<env-id>] --target <tier>`,
170
+ vars: `Usage: ascendkit vars <command>
171
+
172
+ Commands:
173
+ vars list
174
+ vars set <key> <value>
175
+ vars remove <key>`,
170
176
  env: `Usage: ascendkit env <command>
171
177
 
172
178
  Commands:
173
- env list
174
- env set <key> <value>
175
- env remove <key>`,
179
+ env list [--project <project-id>]
180
+
181
+ Lists environments for a project. Uses the active project if --project is not specified.`,
176
182
  import: `Usage: ascendkit import <source> <action> [options]
177
183
 
178
184
  Sources:
@@ -201,8 +207,7 @@ only that phase (e.g. "import clerk run --users ..." imports only users, not set
201
207
  Commands:
202
208
  project list
203
209
  project create --name <name> [--description <description>] [--services <s1,s2,...>]
204
- project show <project-id>
205
- project env list <project-id>`,
210
+ project show <project-id>`,
206
211
  };
207
212
  function printSectionHelp(section) {
208
213
  if (!section)
@@ -295,10 +300,8 @@ function printAuthSettingsSummary(data) {
295
300
  console.log(`Session: ${data.sessionDuration}`);
296
301
  }
297
302
  const allowedDomains = Array.isArray(data.allowedDomains) ? data.allowedDomains : [];
298
- if (allowedDomains.length > 0)
299
- console.log(`Allowed domains: ${allowedDomains.join(", ")}`);
300
- if (data.blockPersonalDomains)
301
- console.log("Block personal domains: on");
303
+ console.log(`Allowed domains: ${allowedDomains.length > 0 ? allowedDomains.join(", ") : "none"}`);
304
+ console.log(`Block personal domains: ${data.blockPersonalDomains ? "on" : "off"}`);
302
305
  }
303
306
  function printTemplateSummary(data, opts) {
304
307
  console.log(`Template: ${data.name} (${data.id})`);
@@ -314,7 +317,7 @@ function printTemplateSummary(data, opts) {
314
317
  }
315
318
  if (Array.isArray(data.unconfiguredVariables) && data.unconfiguredVariables.length > 0) {
316
319
  console.log(`\n⚠ Unconfigured variables: ${data.unconfiguredVariables.join(", ")}`);
317
- console.log(` Set values with: ascendkit env set <key> <value>`);
320
+ console.log(` Set values with: ascendkit vars set <key> <value>`);
318
321
  }
319
322
  if (Array.isArray(data.relatedJourneys) && data.relatedJourneys.length > 0) {
320
323
  const refs = data.relatedJourneys.map((j) => `${j.name} (${j.id})`).join(", ");
@@ -641,7 +644,6 @@ async function run() {
641
644
  table(projects, [
642
645
  { key: "id", label: "ID" },
643
646
  { key: "name", label: "Name", width: 30 },
644
- { key: "enabledServices", label: "Services", width: 30 },
645
647
  ]);
646
648
  }
647
649
  else if (action === "show") {
@@ -651,9 +653,6 @@ async function run() {
651
653
  }
652
654
  printProjectSummary(await platform.showProject(args[2]));
653
655
  }
654
- else if (action === "env") {
655
- await runProjectEnvironment(args.slice(2));
656
- }
657
656
  else if (action === "create") {
658
657
  const flags = parseFlags(args.slice(2));
659
658
  if (!flags.name) {
@@ -682,7 +681,7 @@ async function run() {
682
681
  }
683
682
  }
684
683
  else {
685
- console.error('Usage: ascendkit project list|create|show|env');
684
+ console.error('Usage: ascendkit project list|create|show');
686
685
  return await exitCli(1);
687
686
  }
688
687
  return;
@@ -703,7 +702,10 @@ async function run() {
703
702
  await runEnvironment(action, args.slice(2));
704
703
  return;
705
704
  case "env":
706
- await runKeystore(action, args.slice(2));
705
+ await runEnv(action, args.slice(2));
706
+ return;
707
+ case "vars":
708
+ await runVars(action, args.slice(2));
707
709
  return;
708
710
  }
709
711
  // Service commands (need environment key)
@@ -904,26 +906,24 @@ async function runImport(client, source, rest) {
904
906
  function flagsFromLegacy(args) {
905
907
  return parseFlags(args);
906
908
  }
907
- async function runProjectEnvironment(rest) {
908
- const action = rest[0];
909
- const target = rest[1];
910
- switch (action) {
911
- case "list":
912
- if (!target) {
913
- console.error("Usage: ascendkit project env list <project-id>");
914
- return await exitCli(1);
915
- }
916
- table(await platform.listEnvironments(target), [
917
- { key: "id", label: "ID" },
918
- { key: "name", label: "Name", width: 20 },
919
- { key: "tier", label: "Tier" },
920
- { key: "publicKey", label: "Public Key" },
921
- ]);
922
- return;
923
- default:
924
- console.error("Usage: ascendkit project env list <project-id>");
925
- return await exitCli(1);
909
+ async function runEnv(action, rest) {
910
+ if (action !== "list") {
911
+ console.error("Usage: ascendkit env list [--project <project-id>]");
912
+ return await exitCli(1);
913
+ }
914
+ const flags = parseFlags(rest);
915
+ const projectId = flags.project || loadEnvContext()?.projectId;
916
+ if (!projectId) {
917
+ console.error("Provide --project <id> or run ascendkit set-env first.");
918
+ console.error(" List projects: ascendkit project list");
919
+ return await exitCli(1);
926
920
  }
921
+ table(await platform.listEnvironments(projectId), [
922
+ { key: "id", label: "ID" },
923
+ { key: "name", label: "Name", width: 20 },
924
+ { key: "tier", label: "Tier" },
925
+ { key: "publicKey", label: "Public Key" },
926
+ ]);
927
927
  }
928
928
  async function runEnvironment(action, rest) {
929
929
  const flags = parseFlags(rest);
@@ -1002,7 +1002,7 @@ async function runEnvironment(action, rest) {
1002
1002
  return await exitCli(1);
1003
1003
  }
1004
1004
  }
1005
- async function runKeystore(action, rest) {
1005
+ async function runVars(action, rest) {
1006
1006
  const ctx = loadEnvContext();
1007
1007
  if (!ctx) {
1008
1008
  console.error("No environment set. Run: ascendkit set-env <public-key>");
@@ -1018,7 +1018,7 @@ async function runKeystore(action, rest) {
1018
1018
  const key = rest[0];
1019
1019
  const value = rest[1];
1020
1020
  if (!key || value === undefined) {
1021
- console.error("Usage: ascendkit env set <key> <value>");
1021
+ console.error("Usage: ascendkit vars set <key> <value>");
1022
1022
  return await exitCli(1);
1023
1023
  }
1024
1024
  vars[key] = value;
@@ -1029,7 +1029,7 @@ async function runKeystore(action, rest) {
1029
1029
  case "remove": {
1030
1030
  const key = rest[0];
1031
1031
  if (!key) {
1032
- console.error("Usage: ascendkit env remove <key>");
1032
+ console.error("Usage: ascendkit vars remove <key>");
1033
1033
  return await exitCli(1);
1034
1034
  }
1035
1035
  if (!(key in vars)) {
@@ -1068,8 +1068,8 @@ async function runKeystore(action, rest) {
1068
1068
  return;
1069
1069
  }
1070
1070
  default:
1071
- console.error(`Unknown env command: ${action}`);
1072
- console.error("Usage: ascendkit env list|set|remove");
1071
+ console.error(`Unknown vars command: ${action}`);
1072
+ console.error("Usage: ascendkit vars list|set|remove");
1073
1073
  return await exitCli(1);
1074
1074
  }
1075
1075
  }
@@ -1105,7 +1105,9 @@ async function runAuth(client, action, rest) {
1105
1105
  }
1106
1106
  if (flags["block-personal-domains"] !== undefined)
1107
1107
  params.blockPersonalDomains = flags["block-personal-domains"] === "true";
1108
- printAuthSettingsSummary(await auth.updateSettings(client, params));
1108
+ const updated = await auth.updateSettings(client, params);
1109
+ console.log("Updated.\n");
1110
+ printAuthSettingsSummary(updated);
1109
1111
  break;
1110
1112
  }
1111
1113
  case "provider":
@@ -1128,8 +1130,8 @@ async function runAuth(client, action, rest) {
1128
1130
  }
1129
1131
  break;
1130
1132
  case "oauth": {
1131
- const oauthAction = rest[0] === "open" || rest[0] === "set" || rest[0] === "remove" ? rest[0] : "open";
1132
- const provider = oauthAction === "open" && rest[0] !== "open" ? rest[0] : rest[1];
1133
+ const oauthAction = rest[0];
1134
+ const provider = rest[1];
1133
1135
  if (oauthAction === "set") {
1134
1136
  if (!provider || !flags["client-id"]) {
1135
1137
  console.error("Usage: ascendkit auth oauth set <provider> --client-id <id> [--client-secret <secret> | --client-secret-stdin]");
@@ -1160,7 +1162,7 @@ async function runAuth(client, action, rest) {
1160
1162
  const appUrl = (variables.APP_URL ?? "").trim();
1161
1163
  if (!appUrl) {
1162
1164
  console.error("Set APP_URL for this environment first. AscendKit uses APP_URL to generate the redirect URI for custom OAuth credentials.");
1163
- console.error("Use: ascendkit env set APP_URL https://your-app.com");
1165
+ console.error("Use: ascendkit vars set APP_URL https://your-app.com");
1164
1166
  return await exitCli(1);
1165
1167
  }
1166
1168
  await auth.updateOAuthCredentials(client, provider, flags["client-id"], clientSecret);
@@ -1175,15 +1177,8 @@ async function runAuth(client, action, rest) {
1175
1177
  console.log(`Removed OAuth credentials for ${provider}.`);
1176
1178
  }
1177
1179
  else {
1178
- if (!provider) {
1179
- console.error("Usage: ascendkit auth oauth open <provider>");
1180
- return await exitCli(1);
1181
- }
1182
- const portalUrl = process.env.ASCENDKIT_PORTAL_URL ?? "http://localhost:3000";
1183
- const url = auth.getOAuthSetupUrl(portalUrl, provider, client.currentPublicKey ?? undefined);
1184
- console.log(`Opening browser to configure ${provider} OAuth credentials...`);
1185
- console.log(url);
1186
- openBrowser(url);
1180
+ console.error("Usage: ascendkit auth oauth set|remove <provider>");
1181
+ return await exitCli(1);
1187
1182
  }
1188
1183
  break;
1189
1184
  }
@@ -1560,7 +1555,7 @@ function runStatus() {
1560
1555
  }
1561
1556
  else {
1562
1557
  console.log(" No environment set. Run: ascendkit set-env <public-key>");
1563
- console.log(" List environments: ascendkit project env list <project-id>");
1558
+ console.log(" List environments: ascendkit env list --project <project-id>");
1564
1559
  }
1565
1560
  console.log();
1566
1561
  }
@@ -206,7 +206,7 @@ export function registerPlatformTools(server, client) {
206
206
  };
207
207
  }
208
208
  });
209
- server.tool("env_list", "List environment variable values for the active environment. Uses the shared .ascendkit environment context by default.", {
209
+ server.tool("vars_list", "List environment variable values for the active environment. Uses the shared .ascendkit environment context by default.", {
210
210
  projectId: z.string().optional().describe("Optional project ID override (defaults to active environment project)"),
211
211
  envId: z.string().optional().describe("Optional environment ID override (defaults to active environment)"),
212
212
  }, async (params) => {
@@ -235,7 +235,7 @@ export function registerPlatformTools(server, client) {
235
235
  return { content: [{ type: "text", text: message }], isError: true };
236
236
  }
237
237
  });
238
- server.tool("env_replace", "Replace the full environment variable map for the active environment. Pass the full key-value map.", {
238
+ server.tool("vars_replace", "Replace the full environment variable map for the active environment. Pass the full key-value map.", {
239
239
  projectId: z.string().optional().describe("Optional project ID override (defaults to active environment project)"),
240
240
  envId: z.string().optional().describe("Optional environment ID override (defaults to active environment)"),
241
241
  variables: z.record(z.string()).describe("Key-value map of environment variables"),
@@ -265,7 +265,7 @@ export function registerPlatformTools(server, client) {
265
265
  };
266
266
  }
267
267
  });
268
- server.tool("env_set", "Set a single environment variable for the active environment.", {
268
+ server.tool("vars_set", "Set a single environment variable for the active environment.", {
269
269
  projectId: z.string().optional().describe("Optional project ID override (defaults to active environment project)"),
270
270
  envId: z.string().optional().describe("Optional environment ID override (defaults to active environment)"),
271
271
  key: z.string().describe("Environment variable key"),
@@ -291,7 +291,7 @@ export function registerPlatformTools(server, client) {
291
291
  return { content: [{ type: "text", text: message }], isError: true };
292
292
  }
293
293
  });
294
- server.tool("env_remove", "Remove a single environment variable from the active environment.", {
294
+ server.tool("vars_remove", "Remove a single environment variable from the active environment.", {
295
295
  projectId: z.string().optional().describe("Optional project ID override (defaults to active environment project)"),
296
296
  envId: z.string().optional().describe("Optional environment ID override (defaults to active environment)"),
297
297
  key: z.string().describe("Environment variable key to remove"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascendkit/cli",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "AscendKit CLI and MCP server",
5
5
  "author": "ascendkit.dev",
6
6
  "license": "MIT",