@solidactions/cli 3.21.0 → 3.22.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.
Files changed (44) hide show
  1. package/README.md +3 -3
  2. package/dist/command-manifest.json +1 -1
  3. package/dist/commands/connection-list.js +1 -1
  4. package/dist/commands/crew-env-delete.js +2 -2
  5. package/dist/commands/crew-env-list.js +2 -2
  6. package/dist/commands/crew-env-push.js +5 -2
  7. package/dist/commands/crew-env-set.js +2 -2
  8. package/dist/commands/deploy.js +41 -26
  9. package/dist/commands/doc-pull.js +432 -88
  10. package/dist/commands/doc-push.js +54 -3
  11. package/dist/commands/doc-upload.js +5 -2
  12. package/dist/commands/env-delete.js +12 -5
  13. package/dist/commands/env-list.js +12 -7
  14. package/dist/commands/env-map.js +7 -5
  15. package/dist/commands/env-pull.js +5 -6
  16. package/dist/commands/env-push.js +10 -6
  17. package/dist/commands/env-reset.js +12 -8
  18. package/dist/commands/env-set.js +15 -11
  19. package/dist/commands/login.js +8 -7
  20. package/dist/commands/oauth-action-list.js +2 -2
  21. package/dist/commands/oauth-action-platforms.js +2 -2
  22. package/dist/commands/oauth-action-search.js +2 -2
  23. package/dist/commands/oauth-action-view.js +2 -2
  24. package/dist/commands/project-create.js +1 -1
  25. package/dist/commands/project-list.js +2 -2
  26. package/dist/commands/project-logs.js +7 -3
  27. package/dist/commands/project-view.js +26 -9
  28. package/dist/commands/pull.js +4 -2
  29. package/dist/commands/run-list.js +24 -3
  30. package/dist/commands/run-start.js +12 -9
  31. package/dist/commands/run-view.js +2 -2
  32. package/dist/commands/schedule-delete.js +5 -10
  33. package/dist/commands/schedule-list.js +5 -10
  34. package/dist/commands/schedule-set.js +39 -44
  35. package/dist/commands/schedule-state.js +12 -16
  36. package/dist/commands/state.js +3 -3
  37. package/dist/commands/webhook-list.js +12 -4
  38. package/dist/commands/webhook-secret.js +12 -4
  39. package/dist/commands/workflow-view.js +3 -3
  40. package/dist/commands/workspaces.js +53 -2
  41. package/dist/utils/api.js +35 -2
  42. package/dist/utils/crew.js +6 -1
  43. package/dist/utils/project-ref.js +91 -0
  44. package/package.json +2 -2
package/README.md CHANGED
@@ -499,8 +499,8 @@ Manage docs in SA-Docs (the app's built-in documentation vault). `push` is drift
499
499
 
500
500
  | Command | Key Flags | Description |
501
501
  |---------|-----------|-------------|
502
- | `doc pull <folder> [dest]` | `-y`, `--overwrite`, `--json` | Download a Docs folder tree (markdown + media) to `dest` (defaults to `./<last-segment>/`); writes a `.solidactions-docs.json` revision manifest (including a `body_sha256` content hash per file) used by `push`'s drift guard. Falls back to fetching a single doc if `folder` is a doc path, not a folder |
503
- | `doc push <path>` | `--on-conflict`, `--type`, `--folder`, `--replace`, `--dry-run`, `--force`, `--json` | Upload a directory of docs (walked recursively) or one file: `<title>.md` becomes a markdown doc, `<title>.html` a visual doc, `<title>.canvas.json` or `<title>.canvas` a canvas. Each file must be at most 1 MiB. Manifest-tracked files (from a prior `pull`) are written with a `base_revision` guard and reported separately as written/drifted/unchanged; files whose content hash still matches the last pull are skipped as unchanged (no write, no revision bump). Tracked media files whose bytes changed are replaced the same way, under the same guard; a tracked media file missing locally is left alone — `push` never deletes. An untracked binary in the tree is warned about, never uploaded (use `doc upload`). `--force` skips the drift guard (unchanged files are still skipped). `--dry-run` previews without writing. Untracked files are created under the manifest's `folder_path` when `<dir>` came from a `doc pull` (pass `--folder` to override); an untracked file whose title already exists in the target folder is skipped per `--on-conflict` (default `skip`, reported as `duplicate_title`) |
502
+ | `doc pull <folder> [dest]` | `-y`, `--overwrite`, `--json` | Download a Docs folder tree (markdown + media) to `dest` (defaults to `./<last-segment>/`); visual docs arrive as `<title>.html`, canvases as `<title>.canvas.json`, other docs as `<title>.md`. Writes a `.solidactions-docs.json` revision manifest (including a `body_sha256` content hash per file) used by `push`'s drift guard. Falls back to fetching a single doc if `folder` is a doc path, not a folder |
503
+ | `doc push <path>` | `--on-conflict`, `--type`, `--folder`, `--replace`, `--dry-run`, `--force`, `--json` | Upload a directory of docs (walked recursively) or one file: `<title>.md` becomes a markdown doc, `<title>.html` a visual doc, `<title>.canvas.json` or `<title>.canvas` a canvas. Each file must be at most 1 MiB. Manifest-tracked files (from a prior `pull`) are written with a `base_revision` guard and reported separately as written/drifted/unchanged; files whose content hash still matches the last pull are skipped as unchanged (no write, no revision bump). Tracked media files whose bytes changed are replaced the same way, under the same guard; a tracked media file missing locally is left alone — `push` never deletes. An untracked binary in the tree is warned about, never uploaded (use `doc upload`). `--force` skips the drift guard (unchanged files are still skipped). `--dry-run` previews without writing. Untracked files are created under the manifest's `folder_path` when `<dir>` came from a `doc pull` (pass `--folder` to override); docs the push creates are recorded in the directory's manifest (a directory push with no manifest starts one with the pushed folder), so pushing again updates them — unless `--folder` points outside the manifest's folder, in which case nothing is recorded and the push says so; an untracked file whose title already exists in the target folder is skipped per `--on-conflict` (default `skip`, reported as `duplicate_title`) |
504
504
  | `doc upload <files...>` | `--folder`, `--title`, `--replace <doc-id-or-path>` | Upload one or more media files to SA-Docs (requires a token with the "docs" ability); `--title` only valid for a single file. `--replace` swaps the bytes behind an existing media doc instead of creating a new one — see below |
505
505
 
506
506
  `doc upload <file> --replace <doc-id-or-path>` swaps the bytes behind an existing media doc, keeping its id, title, and folder, so embeds and references keep resolving — the old image stays in the doc's version history. Single file only; cannot be combined with `--title` or `--folder`. A purely numeric argument is a doc id; anything else is a docs path (`marketing/hero.png`), resolved against the doc's **title** — which `doc pull` may have sanitized, so for path-based work on a pulled folder prefer `doc push` instead:
@@ -512,7 +512,7 @@ solidactions doc upload logo-v2.png --replace marketing/logo.png
512
512
 
513
513
  `doc push <file> --replace <doc-id>` replaces the body of an existing doc by its numeric id. It first reads the doc and refuses unless the kinds match: an `.html` file replaces only a visual doc, a `.canvas.json` / `.canvas` file only a canvas, and a `.md` file any doc that is not visual, canvas or media. There is no drift guard (you named the doc). It takes one file and cannot be combined with `--folder`, `--type` or `--on-conflict`. Like `doc upload --replace`, it does not update a pulled directory's manifest.
514
514
 
515
- **Visual docs and canvases do not round-trip yet.** `doc pull` still writes every non-media doc as `<title>.md`, so a pulled visual doc arrives as `.md` holding HTML. And docs that `doc push` creates are not added to the manifest, so pushing the same directory again skips them (the push says how to update one: `--on-conflict overwrite`, or `--replace <id>`).
515
+ **Visual docs and canvases round-trip through `doc pull` and `doc push`.** `doc pull` writes visual docs as `<title>.html` and canvases as `<title>.canvas.json`; every other non-media doc stays `<title>.md`. `doc push` records the docs it creates in the directory's manifest (when they land in the directory's tracked folder), so pushing the same directory again updates them by id instead of skipping them — a second push of an unchanged file sends nothing. When a pulled doc's local path changes (e.g. `page.md` becomes `page.html`), an unmodified old file is removed after the new one is written; if the old file was edited, the pull refuses before any write even with `--overwrite` — push the edited file first or move it aside and pull again. If the renamed doc's download fails, the pull refuses when another doc would take its old name or any filesystem alias of its old file, or when the old file holds unpublished edits (pull again once the download succeeds). Two planned writes involving a rename also refuse when their target names refer to the same file or physical path, including absent targets under aliased directories. A rename whose new name already holds an untracked local file (or one tracked without a recorded hash) refuses unless `--overwrite`; a file that already holds exactly the pulled bytes is simply adopted. These checks apply even when the old file is gone (or is no longer a regular file): there is then nothing to remove, and a failed download keeps the doc tracked under its old name. A symbolic link at a rename target also makes the pull refuse even with `--overwrite`. Filename allocation compares names case-insensitively, so `Page` and `page` receive distinct names (`Page.md` and `page-2.md`); an unchanged tracked doc keeps its exact filename, including a prior collision suffix. A legacy tracked pair differing only by case that already shares one file refuses before any write. Alias checks follow dangling links to their prospective targets.
516
516
 
517
517
  **`doc pull` propagates deletions, within limits.** A file is removed locally only when its doc was deleted on the server *and* the file's bytes still match what the last pull gave it (the manifest's `body_sha256`) — anything you've edited locally is kept, with a warning that it's now untracked (re-create a markdown doc with `doc push`, a media doc with `doc upload`). Deletions only propagate when the destination's existing manifest `folder_path` matches the folder you're pulling (so pulling a different folder into a directory holding an old manifest deletes nothing), and never on the single-doc pull path; a single-doc pull (`doc pull <folder>/<doc>`) records the doc's folder as the manifest's `folder_path` and, in a directory that already tracks that folder, adds or updates just that one entry; when propagation is skipped for either reason, `pull` says so. Nothing outside the destination directory is removed: every candidate path is resolved physically (so a symlinked subdirectory cannot lead the delete outside), and a file the same pull just wrote is never deleted, even if a case-only rename makes it look orphaned on a case-insensitive filesystem.
518
518
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "cli_name": "solidactions",
4
- "cli_version": "3.21.0",
4
+ "cli_version": "3.22.0",
5
5
  "global_options": [
6
6
  {
7
7
  "flags": "-V, --version",
@@ -48,7 +48,7 @@ async function connectionList() {
48
48
  }
49
49
  catch (error) {
50
50
  if (error.response?.status === 401) {
51
- console.error(chalk_1.default.red(`Authentication failed against ${config.host}. Run "solidactions login --global" to re-configure.`));
51
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
52
52
  }
53
53
  else if (error.response) {
54
54
  console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
@@ -33,13 +33,13 @@ async function crewEnvDelete(crewArg, key, options = {}) {
33
33
  catch (error) {
34
34
  if (error.response) {
35
35
  if (error.response.status === 401) {
36
- console.error(chalk_1.default.red('Authentication failed. Run "solidactions login --global" to re-configure.'));
36
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
37
37
  }
38
38
  else if (error.response.status === 404) {
39
39
  console.error(chalk_1.default.red(error.response.data?.message || `Variable "${key}" not found for crew "${crew.name}".`));
40
40
  }
41
41
  else {
42
- console.error(chalk_1.default.red(`Failed: ${error.response.status}`), error.response.data);
42
+ console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
43
43
  }
44
44
  }
45
45
  else {
@@ -73,13 +73,13 @@ async function crewEnvList(crewArg, options = {}) {
73
73
  catch (error) {
74
74
  if (error.response) {
75
75
  if (error.response.status === 401) {
76
- console.error(chalk_1.default.red('Authentication failed. Run "solidactions login --global" to re-configure.'));
76
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
77
77
  }
78
78
  else if (error.response.status === 404) {
79
79
  console.error(chalk_1.default.red(error.response.data?.message || `Crew "${crewArg}" not found.`));
80
80
  }
81
81
  else {
82
- console.error(chalk_1.default.red(`Failed: ${error.response.status}`), error.response.data);
82
+ console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
83
83
  }
84
84
  }
85
85
  else {
@@ -72,7 +72,7 @@ async function crewEnvPush(crewArg, filePath = '.env', options = {}) {
72
72
  }
73
73
  catch (error) {
74
74
  if (error.response?.status === 401) {
75
- console.error(chalk_1.default.red('Authentication failed. Run "solidactions login --global" to re-configure.'));
75
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
76
76
  }
77
77
  else if (error.response?.status === 404) {
78
78
  console.error(chalk_1.default.red(error.response.data?.message || `Crew "${crewArg}" not found.`));
@@ -148,7 +148,10 @@ async function crewEnvPush(crewArg, filePath = '.env', options = {}) {
148
148
  await axios_1.default.put(`${config.host}/api/v1/crews/${crew.id}/variables/${entry.key}`, entry.body, { headers: (0, api_1.getApiHeaders)(config, 'application/json') });
149
149
  }
150
150
  catch (error) {
151
- if (error.response?.status === 422) {
151
+ if (error.response?.status === 401) {
152
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
153
+ }
154
+ else if (error.response?.status === 422) {
152
155
  console.error(chalk_1.default.red(`Failed to push "${entry.key}":`), (0, api_1.formatValidationError)(error.response.data));
153
156
  }
154
157
  else {
@@ -58,7 +58,7 @@ async function crewEnvSet(crewArg, key, value, options = {}) {
58
58
  catch (error) {
59
59
  if (error.response) {
60
60
  if (error.response.status === 401) {
61
- console.error(chalk_1.default.red('Authentication failed. Run "solidactions login --global" to re-configure.'));
61
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
62
62
  }
63
63
  else if (error.response.status === 404) {
64
64
  console.error(chalk_1.default.red(error.response.data?.message || `Crew "${crewArg}" not found.`));
@@ -67,7 +67,7 @@ async function crewEnvSet(crewArg, key, value, options = {}) {
67
67
  console.error(chalk_1.default.red((0, api_1.formatValidationError)(error.response.data)));
68
68
  }
69
69
  else {
70
- console.error(chalk_1.default.red(`Failed: ${error.response.status}`), error.response.data);
70
+ console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
71
71
  }
72
72
  }
73
73
  else {
@@ -16,7 +16,6 @@ exports.pushYamlDeclarations = pushYamlDeclarations;
16
16
  exports.shouldPrintWorkspaceMismatch = shouldPrintWorkspaceMismatch;
17
17
  exports.isPlanLimitReachedError = isPlanLimitReachedError;
18
18
  exports.handlePlanLimitReached = handlePlanLimitReached;
19
- exports.getProjectBySlugOrCanonical = getProjectBySlugOrCanonical;
20
19
  exports.deploy = deploy;
21
20
  exports.shouldPrintWebhookSecretNotice = shouldPrintWebhookSecretNotice;
22
21
  const fs_1 = __importDefault(require("fs"));
@@ -30,6 +29,7 @@ const env_1 = require("../utils/env");
30
29
  const api_1 = require("../utils/api");
31
30
  const deploy_ignore_1 = require("../utils/deploy-ignore");
32
31
  const slug_1 = require("../utils/slug");
32
+ const project_ref_1 = require("../utils/project-ref");
33
33
  const skills_1 = require("../utils/skills");
34
34
  const tar_archive_1 = require("../utils/tar-archive");
35
35
  const source_provenance_1 = require("../utils/source-provenance");
@@ -373,25 +373,13 @@ async function handlePlanLimitReached(config, projectName, error, productionExis
373
373
  return await createEnvironmentProject(config, projectName, 'production');
374
374
  }
375
375
  catch (prodError) {
376
- console.error(chalk_1.default.red('Failed to create project:'), prodError.response?.data?.message || prodError.message);
377
- process.exit(1);
378
- }
379
- }
380
- /**
381
- * GET a project by the name as typed, then — on a 404 only — by its canonical slug when
382
- * that differs (cli#102). The server stores `Issue970-QX` as `issue970-qx`; without the
383
- * retry a redeploy 404s, tries to create, and collides with the slug that already exists.
384
- * The typed spelling goes first so a legacy slug the slugifier would rewrite still resolves.
385
- */
386
- async function getProjectBySlugOrCanonical(config, typed, canonical) {
387
- try {
388
- return await axios_1.default.get(`${config.host}/api/v1/projects/${typed}`, { headers: (0, api_1.getApiHeaders)(config) });
389
- }
390
- catch (error) {
391
- if (error.response?.status !== 404 || canonical === '' || canonical === typed) {
392
- throw error;
376
+ if (prodError.response?.status === 401) {
377
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
393
378
  }
394
- return axios_1.default.get(`${config.host}/api/v1/projects/${canonical}`, { headers: (0, api_1.getApiHeaders)(config) });
379
+ else {
380
+ console.error(chalk_1.default.red('Failed to create project:'), prodError.response?.data?.message || prodError.message);
381
+ }
382
+ process.exit(1);
395
383
  }
396
384
  }
397
385
  async function deploy(projectName, sourcePath, options = {}) {
@@ -431,7 +419,7 @@ async function deploy(projectName, sourcePath, options = {}) {
431
419
  let productionExists = null; // null = unknown (error path)
432
420
  let productionSlug = null;
433
421
  try {
434
- const prodResponse = await getProjectBySlugOrCanonical(config, projectName, (0, slug_1.slugifyName)(projectName) === '' ? '' : (0, slug_1.buildProjectSlug)(projectName, 'production'));
422
+ const prodResponse = await (0, project_ref_1.getProjectBySlugOrCanonical)(config, projectName, (0, slug_1.slugifyName)(projectName) === '' ? '' : (0, slug_1.buildProjectSlug)(projectName, 'production'));
435
423
  productionExists = true;
436
424
  productionSlug = prodResponse.data.slug || prodResponse.data.name;
437
425
  }
@@ -441,8 +429,14 @@ async function deploy(projectName, sourcePath, options = {}) {
441
429
  // Project doesn't exist yet — this is the normal first-deploy path.
442
430
  // Do NOT print a warning here; the deploy proceeds to create/deploy successfully.
443
431
  }
432
+ else if (error.response?.status === 401) {
433
+ // The key is rejected before the deploy even starts: name the host
434
+ // that refused it like every other command's 401.
435
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
436
+ process.exit(1);
437
+ }
444
438
  else {
445
- // 5xx, network error, auth failure, etc. — fail conservatively rather
439
+ // 5xx, network error, etc. — fail conservatively rather
446
440
  // than treating the project as non-existent and potentially creating it.
447
441
  console.error(chalk_1.default.red('Failed to check project existence:'), error.response?.data?.message || error.message);
448
442
  process.exit(1);
@@ -508,7 +502,7 @@ async function deploy(projectName, sourcePath, options = {}) {
508
502
  const lookupSlug = environment === 'production'
509
503
  ? projectName
510
504
  : `${projectName}-${environment}`;
511
- const checkResponse = await getProjectBySlugOrCanonical(config, lookupSlug, (0, slug_1.slugifyName)(projectName) === '' ? '' : (0, slug_1.buildProjectSlug)(projectName, environment));
505
+ const checkResponse = await (0, project_ref_1.getProjectBySlugOrCanonical)(config, lookupSlug, (0, slug_1.slugifyName)(projectName) === '' ? '' : (0, slug_1.buildProjectSlug)(projectName, environment));
512
506
  projectSlug = checkResponse.data.slug || checkResponse.data.name;
513
507
  }
514
508
  }
@@ -541,12 +535,20 @@ async function deploy(projectName, sourcePath, options = {}) {
541
535
  envLabel = '';
542
536
  console.log(chalk_1.default.blue(`Deploying to project "${projectName}" (production) instead.`));
543
537
  }
538
+ else if (createError.response?.status === 401) {
539
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
540
+ process.exit(1);
541
+ }
544
542
  else {
545
543
  console.error(chalk_1.default.red('Failed to create project:'), createError.response?.data?.message || createError.message);
546
544
  process.exit(1);
547
545
  }
548
546
  }
549
547
  }
548
+ else if (error.response?.status === 401) {
549
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
550
+ process.exit(1);
551
+ }
550
552
  else {
551
553
  console.error(chalk_1.default.red('Failed to check project:'), error.response?.data?.message || error.message);
552
554
  process.exit(1);
@@ -562,7 +564,12 @@ async function deploy(projectName, sourcePath, options = {}) {
562
564
  await pushYamlDeclarations(config, projectSlug, yamlConfig);
563
565
  }
564
566
  catch (error) {
565
- console.error(chalk_1.default.red(`Config sync FAILED: ${error.response?.data?.message || error.message}`));
567
+ if (error.response?.status === 401) {
568
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
569
+ }
570
+ else {
571
+ console.error(chalk_1.default.red(`Config sync FAILED: ${error.response?.data?.message || error.message}`));
572
+ }
566
573
  process.exit(1);
567
574
  }
568
575
  console.log(chalk_1.default.green(`✓ Config synced for ${projectSlug}${envLabel}`));
@@ -684,7 +691,12 @@ async function deploy(projectName, sourcePath, options = {}) {
684
691
  await pushYamlDeclarations(config, projectSlug, yamlConfig);
685
692
  }
686
693
  catch (error) {
687
- console.error(chalk_1.default.red(`Config sync FAILED: ${error.response?.data?.message || error.message}`));
694
+ if (error.response?.status === 401) {
695
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
696
+ }
697
+ else {
698
+ console.error(chalk_1.default.red(`Config sync FAILED: ${error.response?.data?.message || error.message}`));
699
+ }
688
700
  cleanupArchive();
689
701
  process.exit(1);
690
702
  }
@@ -692,7 +704,7 @@ async function deploy(projectName, sourcePath, options = {}) {
692
704
  if (yamlConfig && shouldPrintWebhookSecretNotice(yamlConfig.workflows ?? [])) {
693
705
  const envFlag = environment !== 'dev' ? ` -e ${environment}` : '';
694
706
  console.log('');
695
- console.log(chalk_1.default.blue(`ℹ Webhook secret: run \`solidactions webhook secret ${projectName}${envFlag}\` to retrieve the generated secret.`));
707
+ console.log(chalk_1.default.blue(`ℹ Webhook secret: run \`solidactions webhook secret ${(0, slug_1.slugifyName)(projectName) || projectName}${envFlag}\` to retrieve the generated secret.`));
696
708
  console.log(chalk_1.default.gray(` Set the same value in your sender (e.g. Telegram setWebhook secret_token).`));
697
709
  }
698
710
  if (options.paused) {
@@ -737,8 +749,11 @@ async function deploy(projectName, sourcePath, options = {}) {
737
749
  if (error.response.status === 404) {
738
750
  console.error("Project not found.");
739
751
  }
752
+ else if (error.response.status === 401) {
753
+ console.error(chalk_1.default.red((0, api_1.authFailedLine)(config.host)));
754
+ }
740
755
  else {
741
- console.error(error.response.status, JSON.stringify(error.response.data, null, 2));
756
+ console.error(chalk_1.default.red((0, api_1.formatApiFailure)(error.response.status, error.response.data)));
742
757
  }
743
758
  }
744
759
  else {