@solidactions/cli 1.24.0 → 1.26.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/README.md CHANGED
@@ -109,7 +109,7 @@ Use `solidactions <command> --help` for full flag details on any command.
109
109
 
110
110
  | Command | Key Flags | Description |
111
111
  |---------|-----------|-------------|
112
- | `run start <project> <workflow>` | `-e`, `-i`, `-w` | Trigger a workflow run |
112
+ | `run start <project> <workflow>` | `-e`, `-i`, `--wait` | Trigger a workflow run |
113
113
  | `run list [project]` | `--json`, `--detailed`, `--status`, `--since`, `--workflow`, `--limit`, `--offset` | List and filter runs |
114
114
  | `run view <run-id>` | `--json`, `--timeline`, `--steps`, `--logs` | Inspect a run |
115
115
 
@@ -129,7 +129,7 @@ Use `solidactions <command> --help` for full flag details on any command.
129
129
 
130
130
  | Command | Key Flags | Description |
131
131
  |---------|-----------|-------------|
132
- | `schedule set <project> <cron>` | `-w`, `-i`, `-y` | Set cron schedule (warns if exists) |
132
+ | `schedule set <project> <cron>` | `--workflow`, `-i`, `-y` | Set cron schedule (warns if exists) |
133
133
  | `schedule list <project>` | | List schedules |
134
134
  | `schedule delete <project> <id>` | `-y` | Delete a schedule |
135
135
 
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SKILLS_TIP_LINES = void 0;
6
+ exports.PLAN_LIMIT_NON_INTERACTIVE_HINT = exports.SKILLS_TIP_LINES = void 0;
7
7
  exports.cacheBusterEntry = cacheBusterEntry;
8
8
  exports.shouldPrintWorkspaceMismatch = shouldPrintWorkspaceMismatch;
9
+ exports.isPlanLimitReachedError = isPlanLimitReachedError;
10
+ exports.handlePlanLimitReached = handlePlanLimitReached;
9
11
  exports.deploy = deploy;
10
12
  exports.shouldPrintWebhookSecretNotice = shouldPrintWebhookSecretNotice;
11
13
  const fs_1 = __importDefault(require("fs"));
@@ -16,6 +18,7 @@ const axios_1 = __importDefault(require("axios"));
16
18
  const form_data_1 = __importDefault(require("form-data"));
17
19
  const chalk_1 = __importDefault(require("chalk"));
18
20
  const js_yaml_1 = __importDefault(require("js-yaml"));
21
+ const prompts_1 = __importDefault(require("prompts"));
19
22
  const env_1 = require("../utils/env");
20
23
  const api_1 = require("../utils/api");
21
24
  const deploy_ignore_1 = require("../utils/deploy-ignore");
@@ -149,6 +152,84 @@ async function pushYamlDeclarations(config, projectSlug, yamlConfig) {
149
152
  function shouldPrintWorkspaceMismatch(environment, willCreate) {
150
153
  return environment !== 'production' && !willCreate;
151
154
  }
155
+ /**
156
+ * Printed (after the server's own message) when a free-plan tenant hits the
157
+ * dev/staging environment gate in a non-interactive context, or declines the
158
+ * interactive fallback prompt.
159
+ */
160
+ exports.PLAN_LIMIT_NON_INTERACTIVE_HINT = 'Hint: pass -e production, or upgrade your plan for dev/staging environments.';
161
+ /**
162
+ * True when `error` is the app's 422 response for a free-plan tenant hitting
163
+ * the multi-environment gate on project auto-create:
164
+ * `{ error: { code: 'plan_limit_reached', limit: 'multi_env', plan, max } }`.
165
+ */
166
+ function isPlanLimitReachedError(error) {
167
+ const data = error?.response?.data;
168
+ return error?.response?.status === 422
169
+ && data?.error?.code === 'plan_limit_reached'
170
+ && data?.error?.limit === 'multi_env';
171
+ }
172
+ /**
173
+ * POST /api/v1/projects to create a new environment-project record. Returns
174
+ * the resolved slug (server-echoed slug, falling back to the requested one).
175
+ * Throws the raw axios error on failure — callers decide how to handle it.
176
+ */
177
+ async function createEnvironmentProject(config, projectName, environment) {
178
+ const requestedSlug = (0, slug_1.buildProjectSlug)(projectName, environment);
179
+ const createResponse = await axios_1.default.post(`${config.host}/api/v1/projects`, {
180
+ name: projectName,
181
+ slug: requestedSlug,
182
+ environment: environment,
183
+ }, {
184
+ headers: (0, api_1.getApiHeaders)(config, 'application/json'),
185
+ });
186
+ const slug = createResponse.data.slug || requestedSlug;
187
+ if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
188
+ process.stderr.write(`[deploy-debug] requestedSlug=${requestedSlug} responseSlug=${createResponse.data.slug ?? '(missing)'} responseName=${createResponse.data.name ?? '(missing)'} resolvedSlug=${slug}\n`);
189
+ }
190
+ return slug;
191
+ }
192
+ /**
193
+ * Handles a 422 plan_limit_reached/multi_env error from the env-project
194
+ * auto-create call (billing v0.5: free-plan tenants only get production).
195
+ *
196
+ * Interactive TTYs are offered a y/N fallback to production; declining exits
197
+ * 1 with an upgrade hint. Non-interactive callers (CI, agents) never see a
198
+ * prompt — they get the same hint and exit 1 immediately, so the command
199
+ * never hangs waiting for input that will never arrive.
200
+ *
201
+ * On confirmed fallback, resolves (and creates if necessary) the production
202
+ * project and returns its slug. Every other path calls process.exit(1) and
203
+ * never returns.
204
+ */
205
+ async function handlePlanLimitReached(config, projectName, error, productionExists, productionSlug) {
206
+ const serverMessage = error.response?.data?.message || 'Your plan does not support additional environments.';
207
+ console.error(chalk_1.default.red(serverMessage));
208
+ if (!process.stdin.isTTY) {
209
+ console.error(chalk_1.default.yellow(exports.PLAN_LIMIT_NON_INTERACTIVE_HINT));
210
+ process.exit(1);
211
+ }
212
+ const response = await (0, prompts_1.default)({
213
+ type: 'confirm',
214
+ name: 'proceed',
215
+ message: 'Your plan has a single production environment — deploy to production instead?',
216
+ initial: false,
217
+ });
218
+ if (!response.proceed) {
219
+ console.error(chalk_1.default.yellow(exports.PLAN_LIMIT_NON_INTERACTIVE_HINT));
220
+ process.exit(1);
221
+ }
222
+ if (productionExists === true && productionSlug !== null) {
223
+ return productionSlug;
224
+ }
225
+ try {
226
+ return await createEnvironmentProject(config, projectName, 'production');
227
+ }
228
+ catch (prodError) {
229
+ console.error(chalk_1.default.red('Failed to create project:'), prodError.response?.data?.message || prodError.message);
230
+ process.exit(1);
231
+ }
232
+ }
152
233
  async function deploy(projectName, sourcePath, options = {}) {
153
234
  const config = await (0, api_1.requireConfigWithWorkspace)();
154
235
  let workspaceMismatchPrinted = false;
@@ -218,8 +299,10 @@ async function deploy(projectName, sourcePath, options = {}) {
218
299
  }
219
300
  // Apply default: if production already exists and the user didn't pass -e,
220
301
  // use 'dev' — this preserves existing behavior for mature projects.
221
- const environment = explicitEnv ?? 'dev';
222
- const envLabel = environment !== 'production' ? ` (${environment})` : '';
302
+ // `let`, not `const`: a free-plan 422 (plan_limit_reached/multi_env) on the
303
+ // env-project auto-create below can fall the deploy back to production.
304
+ let environment = explicitEnv ?? 'dev';
305
+ let envLabel = environment !== 'production' ? ` (${environment})` : '';
223
306
  console.log(chalk_1.default.blue(`Deploying to project "${projectName}"${envLabel}...`));
224
307
  console.log(chalk_1.default.gray(`Source: ${sourceDir}`));
225
308
  // Validate project structure before deploying
@@ -285,28 +368,23 @@ async function deploy(projectName, sourcePath, options = {}) {
285
368
  process.exit(1);
286
369
  }
287
370
  console.log(chalk_1.default.yellow(`Project "${projectName}"${envLabel} not found. Creating...`));
288
- const requestedSlug = (0, slug_1.buildProjectSlug)(projectName, environment);
289
371
  try {
290
- const createResponse = await axios_1.default.post(`${config.host}/api/v1/projects`, {
291
- name: projectName,
292
- slug: requestedSlug,
293
- environment: environment,
294
- }, {
295
- headers: (0, api_1.getApiHeaders)(config, 'application/json'),
296
- });
297
- // Fallback chain: prefer the server-echoed slug; if absent, use the slug we
298
- // *requested* in the POST body (server stored that value). Falling back to
299
- // `name` strips the env suffix and causes the polling GET to 404 with
300
- // "Project 'X' not found in your active workspace 'Y'.".
301
- projectSlug = createResponse.data.slug || requestedSlug;
302
- if (process.env.SOLIDACTIONS_DEPLOY_DEBUG === '1') {
303
- process.stderr.write(`[deploy-debug] requestedSlug=${requestedSlug} responseSlug=${createResponse.data.slug ?? '(missing)'} responseName=${createResponse.data.name ?? '(missing)'} resolvedSlug=${projectSlug}\n`);
304
- }
372
+ projectSlug = await createEnvironmentProject(config, projectName, environment);
305
373
  console.log(chalk_1.default.green(`Project "${projectName}"${envLabel} created.`));
306
374
  }
307
375
  catch (createError) {
308
- console.error(chalk_1.default.red('Failed to create project:'), createError.response?.data?.message || createError.message);
309
- process.exit(1);
376
+ if (isPlanLimitReachedError(createError)) {
377
+ // Free-plan tenant hit the multi_env gate. handlePlanLimitReached()
378
+ // exits(1) on every path except a confirmed fallback to production.
379
+ projectSlug = await handlePlanLimitReached(config, projectName, createError, productionExists, productionSlug);
380
+ environment = 'production';
381
+ envLabel = '';
382
+ console.log(chalk_1.default.blue(`Deploying to project "${projectName}" (production) instead.`));
383
+ }
384
+ else {
385
+ console.error(chalk_1.default.red('Failed to create project:'), createError.response?.data?.message || createError.message);
386
+ process.exit(1);
387
+ }
310
388
  }
311
389
  }
312
390
  else {
@@ -264,7 +264,11 @@ async function runDev(opts) {
264
264
  platformVars = await apiClient.fetchVarsAndConnections(opts.env);
265
265
  }
266
266
  catch (e) {
267
- err(`failed to fetch platform vars: ${e?.message ?? e}`);
267
+ let msg = `failed to fetch platform vars: ${e?.message ?? e}`;
268
+ if (e?.response?.status === 404 && opts.env !== 'production') {
269
+ msg += `\nThe '${opts.env}' environment project doesn't exist — staging/dev environments require a paid plan. On the free plan, use --env production.`;
270
+ }
271
+ err(msg);
268
272
  }
269
273
  }
270
274
  // 3. Build ctx.vars from platform vars. A declared mapping is only readable
@@ -23,7 +23,7 @@ async function oauthActionsList(platform, options) {
23
23
  return;
24
24
  }
25
25
  if (actions.length === 0) {
26
- console.log(`No actions found for "${platform}" — check the platform name and that a connection exists (\`solidactions env pull --update-oauth\` syncs connections).`);
26
+ console.log(`No actions found for platform "${platform}".`);
27
27
  return;
28
28
  }
29
29
  for (const a of actions) {
@@ -34,7 +34,10 @@ async function oauthActionsList(platform, options) {
34
34
  console.log(chalk_1.default.gray(`${actions.length} action(s) — use "solidactions oauth-actions search ${platform} <query>" to narrow, or "oauth-actions show ${platform} <action_id>" for detail.`));
35
35
  }
36
36
  catch (error) {
37
- if (error.response?.status === 401) {
37
+ if (error.response?.status === 404 && error.response.data?.code === 'platform_unknown') {
38
+ console.error(chalk_1.default.red(`Unknown platform "${platform}". Run \`solidactions oauth-actions platforms\` to see available platforms.`));
39
+ }
40
+ else if (error.response?.status === 401) {
38
41
  console.error(chalk_1.default.red('Authentication failed. Run "solidactions login <api-key>".'));
39
42
  }
40
43
  else if (error.response) {
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.oauthActionsPlatforms = oauthActionsPlatforms;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const api_1 = require("../utils/api");
10
+ async function oauthActionsPlatforms(options) {
11
+ const config = await (0, api_1.requireConfigWithWorkspace)();
12
+ try {
13
+ const response = await axios_1.default.get(`${config.host}/api/v1/oauth-actions/platforms`, {
14
+ headers: (0, api_1.getApiHeaders)(config),
15
+ });
16
+ const platforms = response.data.platforms || [];
17
+ if (options.json) {
18
+ process.stdout.write(JSON.stringify(platforms, null, 2) + '\n');
19
+ return;
20
+ }
21
+ if (platforms.length === 0) {
22
+ console.log('No platforms available.');
23
+ return;
24
+ }
25
+ for (const platform of platforms) {
26
+ console.log(platform);
27
+ }
28
+ }
29
+ catch (error) {
30
+ if (error.response?.status === 401) {
31
+ console.error(chalk_1.default.red('Authentication failed. Run "solidactions login <api-key>".'));
32
+ }
33
+ else if (error.response) {
34
+ console.error(chalk_1.default.red(`Failed: ${error.response.status}`), error.response.data);
35
+ }
36
+ else {
37
+ console.error(chalk_1.default.red('Connection failed:'), error.message);
38
+ }
39
+ process.exit(1);
40
+ }
41
+ }
@@ -27,7 +27,7 @@ async function oauthActionsSearch(platform, query, options) {
27
27
  return;
28
28
  }
29
29
  if (actions.length === 0) {
30
- console.log(`No actions found for "${platform}" — check the platform name and that a connection exists (\`solidactions env pull --update-oauth\` syncs connections).`);
30
+ console.log(`No actions found for platform "${platform}".`);
31
31
  return;
32
32
  }
33
33
  for (const a of actions) {
@@ -45,7 +45,10 @@ async function oauthActionsSearch(platform, query, options) {
45
45
  console.log(chalk_1.default.gray(`Run 'solidactions oauth-actions show ${platform} <action_id>' for full schema + paste-ready snippet.`));
46
46
  }
47
47
  catch (error) {
48
- if (error.response?.status === 401) {
48
+ if (error.response?.status === 404 && error.response.data?.code === 'platform_unknown') {
49
+ console.error(chalk_1.default.red(`Unknown platform "${platform}". Run \`solidactions oauth-actions platforms\` to see available platforms.`));
50
+ }
51
+ else if (error.response?.status === 401) {
49
52
  console.error(chalk_1.default.red('Authentication failed. Run "solidactions login <api-key>" to re-configure.'));
50
53
  }
51
54
  else if (error.response) {
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ const ai_examples_1 = require("./commands/ai-examples");
33
33
  const oauth_actions_search_1 = require("./commands/oauth-actions-search");
34
34
  const oauth_actions_list_1 = require("./commands/oauth-actions-list");
35
35
  const oauth_actions_show_1 = require("./commands/oauth-actions-show");
36
+ const oauth_actions_platforms_1 = require("./commands/oauth-actions-platforms");
36
37
  const workspaces_1 = require("./commands/workspaces");
37
38
  const skill_push_1 = require("./commands/skill-push");
38
39
  const skill_pull_1 = require("./commands/skill-pull");
@@ -138,7 +139,7 @@ program
138
139
  .description('Run a workflow locally using an in-memory mock server (no deploy needed)')
139
140
  .argument('<file>', 'Workflow file to run (e.g., src/simple-steps.ts)')
140
141
  .option('-i, --input <json>', 'JSON input for the workflow', '{}')
141
- .option('-e, --env <env>', 'Pull platform variables for this environment (e.g. dev, staging, production)')
142
+ .option('-e, --env <env>', 'Pull platform variables for this environment (e.g. production, staging, dev)')
142
143
  .action((file, options) => {
143
144
  // Unified in-process invoke path. With --env: fetch declared vars, build
144
145
  // ctx.vars, invoke locally. Without --env: NO platform fetch, ctx.vars is
@@ -210,7 +211,7 @@ runCmd
210
211
  .argument('<workflow>', 'Workflow name')
211
212
  .option('-e, --env <environment>', 'Environment (production/staging/dev)', 'dev')
212
213
  .option('-i, --input <json>', 'JSON input for the workflow')
213
- .option('-w, --wait', 'Wait for the workflow to complete')
214
+ .option('--wait', 'Wait for the workflow to complete')
214
215
  .action((projectName, workflow, options) => {
215
216
  (0, run_start_1.run)(projectName, workflow, options);
216
217
  });
@@ -423,6 +424,13 @@ oauthActionsCmd
423
424
  .action((platform, actionId, options) => {
424
425
  (0, oauth_actions_show_1.oauthActionsShow)(platform, actionId, options);
425
426
  });
427
+ oauthActionsCmd
428
+ .command('platforms')
429
+ .description('List available OAuth-backed platforms')
430
+ .option('--json', 'Emit raw JSON for AI/script consumption')
431
+ .action((options) => {
432
+ (0, oauth_actions_platforms_1.oauthActionsPlatforms)(options);
433
+ });
426
434
  // =============================================================================
427
435
  // ai <subcommand>
428
436
  // =============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidactions/cli",
3
- "version": "1.24.0",
3
+ "version": "1.26.0",
4
4
  "description": "SolidActions CLI - Deploy and manage workflow automation",
5
5
  "main": "dist/index.js",
6
6
  "bin": {