@sequenceholdings/studio-cli 0.9.23 → 0.9.26

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 (157) hide show
  1. package/README.md +166 -146
  2. package/dist/access/commands.js +3 -5
  3. package/dist/access/principal.js +2 -2
  4. package/dist/access/tier-hosts.js +2 -2
  5. package/dist/agents/commands.d.ts +1 -1
  6. package/dist/agents/commands.js +9 -9
  7. package/dist/agents/scaffold.js +3 -3
  8. package/dist/agents/voice.d.ts +1 -1
  9. package/dist/agents/voice.js +1 -1
  10. package/dist/app/commands.d.ts +2 -2
  11. package/dist/app/commands.js +31 -21
  12. package/dist/app/deploy.d.ts +1 -1
  13. package/dist/app/deploy.js +1 -1
  14. package/dist/app/manifest.d.ts +9 -9
  15. package/dist/app/manifest.js +1 -1
  16. package/dist/app/prepare.js +1 -1
  17. package/dist/app/primitive-scaffold.js +1 -1
  18. package/dist/app/readme.js +6 -6
  19. package/dist/app/scaffold.js +1 -1
  20. package/dist/app/validate.d.ts +1 -1
  21. package/dist/app/workspace-scaffold.js +1 -1
  22. package/dist/app-preview/commands.d.ts +7 -0
  23. package/dist/app-preview/commands.js +264 -0
  24. package/dist/app-preview/fingerprint.d.ts +20 -0
  25. package/dist/app-preview/fingerprint.js +32 -0
  26. package/dist/app-preview/install.d.ts +31 -0
  27. package/dist/app-preview/install.js +53 -0
  28. package/dist/app-preview/namespace-probe.d.ts +13 -0
  29. package/dist/app-preview/namespace-probe.js +50 -0
  30. package/dist/app-preview/plan.d.ts +28 -0
  31. package/dist/app-preview/plan.js +41 -0
  32. package/dist/app-preview/run.d.ts +32 -0
  33. package/dist/app-preview/run.js +48 -0
  34. package/dist/app-preview/runners.d.ts +73 -0
  35. package/dist/app-preview/runners.js +226 -0
  36. package/dist/app-preview/secrets.d.ts +48 -0
  37. package/dist/app-preview/secrets.js +104 -0
  38. package/dist/app-preview/target.d.ts +28 -0
  39. package/dist/app-preview/target.js +62 -0
  40. package/dist/artifact/delegate.d.ts +1 -12
  41. package/dist/artifact/delegate.js +43 -124
  42. package/dist/artifact/sandbox.js +1 -1
  43. package/dist/auth-cmds/commands.js +1 -2
  44. package/dist/auth.js +1 -3
  45. package/dist/bin.js +12 -2
  46. package/dist/cli-attribution.d.ts +4 -0
  47. package/dist/cli-attribution.js +25 -3
  48. package/dist/cli-errors.d.ts +9 -1
  49. package/dist/cli-errors.js +20 -9
  50. package/dist/command-contract.d.ts +7 -182
  51. package/dist/command-contract.js +9 -33
  52. package/dist/command-help.d.ts +6 -6
  53. package/dist/command-help.js +31 -27
  54. package/dist/command-telemetry.js +2 -2
  55. package/dist/config-dir.d.ts +8 -0
  56. package/dist/config-dir.js +35 -0
  57. package/dist/config.d.ts +6 -7
  58. package/dist/config.js +15 -15
  59. package/dist/docs/commands.js +9 -4
  60. package/dist/edge-auth-headers.js +1 -18
  61. package/dist/env-registry.d.ts +4 -0
  62. package/dist/env-registry.js +15 -6
  63. package/dist/envs/commands.d.ts +3 -0
  64. package/dist/envs/commands.js +11 -0
  65. package/dist/exit-codes.d.ts +16 -0
  66. package/dist/exit-codes.js +27 -0
  67. package/dist/functions/bundle.d.ts +1 -1
  68. package/dist/functions/commands.d.ts +15 -0
  69. package/dist/functions/commands.js +86 -29
  70. package/dist/functions/manifest.js +1 -1
  71. package/dist/functions/service-account-guidance.d.ts +1 -1
  72. package/dist/functions/service-account-guidance.js +2 -2
  73. package/dist/lifecycle/check.d.ts +13 -0
  74. package/dist/lifecycle/check.js +116 -0
  75. package/dist/lifecycle/commands.d.ts +14 -0
  76. package/dist/lifecycle/commands.js +121 -0
  77. package/dist/lifecycle/plan.d.ts +28 -0
  78. package/dist/lifecycle/plan.js +113 -0
  79. package/dist/lifecycle/rollback.d.ts +7 -0
  80. package/dist/lifecycle/rollback.js +89 -0
  81. package/dist/lifecycle/seq-ci-tools.d.ts +107 -0
  82. package/dist/lifecycle/seq-ci-tools.js +177 -0
  83. package/dist/lifecycle/upgrade.d.ts +3 -0
  84. package/dist/lifecycle/upgrade.js +38 -0
  85. package/dist/machine-output.d.ts +11 -2
  86. package/dist/machine-output.js +32 -10
  87. package/dist/main.d.ts +16 -6
  88. package/dist/main.js +187 -361
  89. package/dist/orgs.d.ts +45 -0
  90. package/dist/orgs.js +106 -0
  91. package/dist/orm/delegate.d.ts +1 -1
  92. package/dist/orm/delegate.js +32 -18
  93. package/dist/orm/deployment-policy.js +1 -2
  94. package/dist/orm/discover.js +6 -8
  95. package/dist/orm/execute.d.ts +1 -1
  96. package/dist/orm/execute.js +5 -6
  97. package/dist/orm/failures.js +2 -2
  98. package/dist/orm/help.d.ts +1 -1
  99. package/dist/orm/help.js +5 -5
  100. package/dist/orm/history.js +1 -2
  101. package/dist/orm/operation-show.js +1 -2
  102. package/dist/orm/version-guard.d.ts +7 -2
  103. package/dist/orm/version-guard.js +12 -7
  104. package/dist/pipeline/codegen.js +2 -2
  105. package/dist/pipeline/commands.js +9 -7
  106. package/dist/pipeline/discovery.d.ts +1 -1
  107. package/dist/pipeline/discovery.js +2 -3
  108. package/dist/pipeline/help.d.ts +1 -1
  109. package/dist/pipeline/help.js +1 -1
  110. package/dist/pipeline/lifecycle.js +1 -1
  111. package/dist/pipeline/stage-secrets.js +4 -4
  112. package/dist/pipeline/templates.js +2 -2
  113. package/dist/pnpm-auto-update.js +3 -3
  114. package/dist/principals/commands.d.ts +1 -1
  115. package/dist/principals/commands.js +13 -14
  116. package/dist/process/commands.js +4 -1
  117. package/dist/process/run-steps.d.ts +2 -2
  118. package/dist/process/runs.js +1 -2
  119. package/dist/registry/commands.d.ts +4 -0
  120. package/dist/registry/commands.js +281 -0
  121. package/dist/registry/help.d.ts +8 -0
  122. package/dist/registry/help.js +64 -0
  123. package/dist/registry/lifecycle-commands.d.ts +3 -0
  124. package/dist/registry/lifecycle-commands.js +67 -0
  125. package/dist/registry/lookup.d.ts +6 -0
  126. package/dist/registry/lookup.js +18 -0
  127. package/dist/registry/runners.d.ts +14 -0
  128. package/dist/registry/runners.js +206 -0
  129. package/dist/registry/spec.d.ts +45 -0
  130. package/dist/registry/spec.js +8 -0
  131. package/dist/repos/commands.d.ts +1 -4
  132. package/dist/repos/commands.js +3 -21
  133. package/dist/repos/github-connect-command.d.ts +10 -1
  134. package/dist/repos/github-connect-command.js +52 -11
  135. package/dist/repos/github-init.d.ts +9 -2
  136. package/dist/repos/github-init.js +18 -2
  137. package/dist/repos/init-repo.js +1 -2
  138. package/dist/run-pinned.d.ts +48 -0
  139. package/dist/run-pinned.js +127 -0
  140. package/dist/sdk-source.d.ts +64 -0
  141. package/dist/sdk-source.js +199 -0
  142. package/dist/secrets/commands.d.ts +1 -1
  143. package/dist/secrets/commands.js +29 -24
  144. package/dist/service-accounts/commands.d.ts +1 -1
  145. package/dist/service-accounts/commands.js +4 -5
  146. package/dist/staged-env.d.ts +14 -0
  147. package/dist/staged-env.js +73 -0
  148. package/dist/storage/commands.js +21 -22
  149. package/dist/templates/catalog.d.ts +5 -5
  150. package/dist/templates/catalog.js +1 -1
  151. package/dist/update-check.js +3 -3
  152. package/dist/version-support.d.ts +39 -0
  153. package/dist/version-support.js +71 -0
  154. package/package.json +11 -10
  155. package/release-summary.json +4 -1
  156. package/dist/preview.d.ts +0 -90
  157. package/dist/preview.js +0 -292
@@ -27,7 +27,7 @@ function resolveVersionTarget(versions, versionArg) {
27
27
  if (matches.length > 1) {
28
28
  return {
29
29
  error: `version "${versionArg}" is ambiguous (${matches.length} rows share v${wanted}). ` +
30
- `Pass the version row id from "seq-studio secrets versions": ${matches.map((v) => v.id).join(', ')}`,
30
+ `Pass the version row id from "seq-studio secret versions": ${matches.map((v) => v.id).join(', ')}`,
31
31
  };
32
32
  }
33
33
  return { target: matches[0] };
@@ -123,7 +123,7 @@ async function resolveFunctionBySlug({ ctx, slug, }) {
123
123
  });
124
124
  const fn = functions.find((row) => row.slug === slug);
125
125
  if (!fn) {
126
- throw new Error(`Managed function "${slug}" not found on ${ctx.env.name} (or you don't have access). Run \`seq-studio functions list -e ${ctx.env.name}\` to see what exists.`);
126
+ throw new Error(`Managed function "${slug}" not found on ${ctx.env.name} (or you don't have access). Run \`seq-studio function list -e ${ctx.env.name}\` to see what exists.`);
127
127
  }
128
128
  return fn;
129
129
  }
@@ -150,7 +150,7 @@ async function functionExistsBySlugEventually({ ctx, slug, attempts = 3, retryDe
150
150
  export async function secretsCreateCommand(args) {
151
151
  const name = args.positional[0];
152
152
  if (!name) {
153
- console.error('usage: seq-studio secrets create <NAME> -e <env> [--type key-value|single] [--org <slug>] [--description text]');
153
+ console.error('usage: seq-studio secret create <NAME> -e <env> [--type key-value|single] [--org <slug>] [--description text]');
154
154
  return 1;
155
155
  }
156
156
  const ctx = await buildContext(args);
@@ -182,7 +182,7 @@ export async function secretsCreateCommand(args) {
182
182
  export async function secretsSetCommand(args) {
183
183
  const name = args.positional[0];
184
184
  if (!name) {
185
- console.error('usage: seq-studio secrets set <NAME> -e <env> [--org <slug>] [--from-file <path>] [--from-json <path>]');
185
+ console.error('usage: seq-studio secret set <NAME> -e <env> [--org <slug>] [--from-file <path>] [--from-json <path>]');
186
186
  return 1;
187
187
  }
188
188
  const ctx = await buildContext(args);
@@ -357,8 +357,8 @@ export async function secretsAttachCommand(args) {
357
357
  return secretsAttachToStage(args, name);
358
358
  const fnSlug = typeof args.flags.fn === 'string' ? args.flags.fn : args.positional[1];
359
359
  if (!name || !fnSlug) {
360
- console.error('usage: seq-studio secrets attach <NAME> --fn <slug> -e <env> [--org <slug>] [--env-var NAME] [--map KEY=ENV,KEY=ENV]\n' +
361
- ' seq-studio secrets attach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--entry KEY | --fields field=KEY,field=KEY] [--repo <ns>/<name>] [--org <slug>]');
360
+ console.error('usage: seq-studio secret attach <NAME> --fn <slug> -e <env> [--org <slug>] [--env-var NAME] [--map KEY=ENV,KEY=ENV]\n' +
361
+ ' seq-studio secret attach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--entry KEY | --fields field=KEY,field=KEY] [--repo <ns>/<name>] [--org <slug>]');
362
362
  return 1;
363
363
  }
364
364
  const ctx = await buildContext(args);
@@ -414,8 +414,8 @@ export async function secretsDetachCommand(args) {
414
414
  return secretsDetachFromStage(args, name);
415
415
  const fnSlug = typeof args.flags.fn === 'string' ? args.flags.fn : args.positional[1];
416
416
  if (!name || !fnSlug) {
417
- console.error('usage: seq-studio secrets detach <NAME> --fn <slug> -e <env> [--org <slug>]\n' +
418
- ' seq-studio secrets detach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--repo <ns>/<name>]');
417
+ console.error('usage: seq-studio secret detach <NAME> --fn <slug> -e <env> [--org <slug>]\n' +
418
+ ' seq-studio secret detach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--repo <ns>/<name>]');
419
419
  return 1;
420
420
  }
421
421
  const ctx = await buildContext(args);
@@ -472,7 +472,7 @@ function resolveApplyKeys({ parsed, manifest, explicitKeys, applyAll, }) {
472
472
  export async function secretsApplyCommand(args) {
473
473
  const fromEnvFile = args.flags['from-env-file'];
474
474
  if (typeof fromEnvFile !== 'string') {
475
- console.error('usage: seq-studio secrets apply --from-env-file .env -e <env> [--yes]');
475
+ console.error('usage: seq-studio secret apply --from-env-file .env -e <env> [--yes]');
476
476
  return 1;
477
477
  }
478
478
  const dir = workDir(args);
@@ -652,7 +652,7 @@ async function attachedFunctionSlugs(ctx, secretId) {
652
652
  export async function secretsVersionsCommand(args) {
653
653
  const name = args.positional[0];
654
654
  if (!name) {
655
- console.error('usage: seq-studio secrets versions <NAME> -e <env> [--org <slug>]');
655
+ console.error('usage: seq-studio secret versions <NAME> -e <env> [--org <slug>]');
656
656
  return 1;
657
657
  }
658
658
  const ctx = await buildContext(args);
@@ -680,7 +680,7 @@ export async function secretsVersionsCommand(args) {
680
680
  export async function secretsSetDefaultCommand(args) {
681
681
  const name = args.positional[0];
682
682
  if (!name) {
683
- console.error('usage: seq-studio secrets set-default <NAME> [version] -e <env> [--org <slug>] [--yes]');
683
+ console.error('usage: seq-studio secret set-default <NAME> [version] -e <env> [--org <slug>] [--yes]');
684
684
  return 1;
685
685
  }
686
686
  const ctx = await buildContext(args);
@@ -746,7 +746,7 @@ export async function secretsPinCommand(args) {
746
746
  const name = args.positional[0];
747
747
  const fnSlug = typeof args.flags.fn === 'string' ? args.flags.fn : undefined;
748
748
  if (!name || !fnSlug) {
749
- console.error('usage: seq-studio secrets pin <NAME> --fn <slug> [version] [--unpin] -e <env> [--org <slug>] [--yes] [--no-redeploy]');
749
+ console.error('usage: seq-studio secret pin <NAME> --fn <slug> [version] [--unpin] -e <env> [--org <slug>] [--yes] [--no-redeploy]');
750
750
  return 1;
751
751
  }
752
752
  const ctx = await buildContext(args);
@@ -831,28 +831,28 @@ export async function secretsPinCommand(args) {
831
831
  // dispatcher
832
832
  // ---------------------------------------------------------------------------
833
833
  export const SECRETS_USAGE = `usage:
834
- seq-studio secrets create <NAME> -e <env> [--type key-value|single] [--org <slug>] [--description text]
834
+ seq-studio secret create <NAME> -e <env> [--type key-value|single] [--org <slug>] [--description text]
835
835
  register an org-owned secret
836
- seq-studio secrets set <NAME> -e <env> [--org <slug>] [--from-file <path>|--from-json <path>] [--merge]
836
+ seq-studio secret set <NAME> -e <env> [--org <slug>] [--from-file <path>|--from-json <path>] [--merge]
837
837
  set the shared default value (write-only)
838
- seq-studio secrets list -e <env> secrets you can see (never values)
839
- seq-studio secrets attach <NAME> --fn <slug> -e <env> [--org <slug>] [--map KEY=ENV,KEY=ENV]
838
+ seq-studio secret list -e <env> secrets you can see (never values)
839
+ seq-studio secret attach <NAME> --fn <slug> -e <env> [--org <slug>] [--map KEY=ENV,KEY=ENV]
840
840
  mount default on a function env var
841
- seq-studio secrets detach <NAME> --fn <slug> -e <env> [--org <slug>]
841
+ seq-studio secret detach <NAME> --fn <slug> -e <env> [--org <slug>]
842
842
  remove attachment
843
- seq-studio secrets attach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--entry KEY | --fields field=KEY,field=KEY]
843
+ seq-studio secret attach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--entry KEY | --fields field=KEY,field=KEY]
844
844
  attach to a pipeline stage's credential for one deploy target
845
- seq-studio secrets detach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>]
845
+ seq-studio secret detach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>]
846
846
  remove it (the stage's copy is deleted now)
847
- seq-studio secrets apply --from-env-file .env -e <env> push defaults + attach (keys default from manifest)
848
- seq-studio secrets versions <NAME> -e <env> [--org <slug>] value version history (never values)
849
- seq-studio secrets set-default <NAME> [version] -e <env> [--org <slug>]
847
+ seq-studio secret apply --from-env-file .env -e <env> push defaults + attach (keys default from manifest)
848
+ seq-studio secret versions <NAME> -e <env> [--org <slug>] value version history (never values)
849
+ seq-studio secret set-default <NAME> [version] -e <env> [--org <slug>]
850
850
  point the default at a prior version (editor)
851
- seq-studio secrets pin <NAME> --fn <slug> [version] -e <env> [--org <slug>]
851
+ seq-studio secret pin <NAME> --fn <slug> [version] -e <env> [--org <slug>]
852
852
  pin one function to a version (sticky; --unpin clears)
853
853
 
854
854
  Note: for the common deploy loop, secrets declared in managed-function.yml are
855
- reconciled automatically by \`seq-studio functions deploy\` using a local .env.
855
+ reconciled automatically by \`seq-studio function deploy\` using a local .env.
856
856
  Explicit function attachments require the same secret source and mapping in the active manifest.
857
857
  Use \`secrets\` commands for CI (no .env), bulk/multi-function ops, or write-only
858
858
  value changes without a redeploy.
@@ -875,6 +875,11 @@ export const SECRETS_USAGE = `usage:
875
875
  pin: [version|version-row-id] (defaults to the current default) · --unpin · --yes (redeploy) · --yes --no-redeploy
876
876
  `;
877
877
  export async function runSecretsCommand(sub, args) {
878
+ // `secret <verb> --help` is help, not a call missing its arguments.
879
+ if (sub && (args.flags.help === true || args.flags.h === true)) {
880
+ console.log(SECRETS_USAGE);
881
+ return 0;
882
+ }
878
883
  try {
879
884
  switch (sub) {
880
885
  case 'create':
@@ -1,3 +1,3 @@
1
1
  import type { ParsedArgs } from '../process/commands.js';
2
- export declare const SERVICE_ACCOUNTS_USAGE = "usage:\n seq-studio service-accounts list -e <env> [--json]\n seq-studio service-accounts show <account-id> -e <env> [--json]\n seq-studio service-accounts create <slug> --display-name <name> -e <env> [--description <text>] [--json]\n\n All results are JSON. Authenticate: seq-studio login --env <env>.\n Administrator provisioning: listing needs Service Accounts surface access;\n create needs its editor grant; show needs admin on that account.\n A normal builder should use the account ID/slug supplied by their administrator.\n Creation does not grant the account access to data or functions. Grant required\n runtime access with seq-studio access using principal user: service-account|<id>.\n The server checks creator, actor, and resource authority on every operation.\n No credential is issued or printed by these commands.\n";
2
+ export declare const SERVICE_ACCOUNTS_USAGE = "usage:\n seq-studio service-account list -e <env> [--json]\n seq-studio service-account show <account-id> -e <env> [--json]\n seq-studio service-account create <slug> --display-name <name> -e <env> [--description <text>] [--json]\n\n All results are JSON. Authenticate: seq-studio login --env <env>.\n Administrator provisioning: listing needs Service Accounts surface access;\n create needs its editor grant; show needs admin on that account.\n A normal builder should use the account ID/slug supplied by their administrator.\n Creation does not grant the account access to data or functions. Grant required\n runtime access with seq-studio access using principal user: service-account|<id>.\n The server checks creator, actor, and resource authority on every operation.\n No credential is issued or printed by these commands.\n";
3
3
  export declare function runServiceAccountsCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
@@ -3,9 +3,9 @@ import { printCliError } from '../cli-errors.js';
3
3
  import { requiredStringFlag, validateCommandInput, wantsHelp } from '../command-input.js';
4
4
  import { buildContext, clientOptions } from '../functions/commands.js';
5
5
  export const SERVICE_ACCOUNTS_USAGE = `usage:
6
- seq-studio service-accounts list -e <env> [--json]
7
- seq-studio service-accounts show <account-id> -e <env> [--json]
8
- seq-studio service-accounts create <slug> --display-name <name> -e <env> [--description <text>] [--json]
6
+ seq-studio service-account list -e <env> [--json]
7
+ seq-studio service-account show <account-id> -e <env> [--json]
8
+ seq-studio service-account create <slug> --display-name <name> -e <env> [--description <text>] [--json]
9
9
 
10
10
  All results are JSON. Authenticate: seq-studio login --env <env>.
11
11
  Administrator provisioning: listing needs Service Accounts surface access;
@@ -56,7 +56,6 @@ export async function runServiceAccountsCommand(sub, args) {
56
56
  return 0;
57
57
  }
58
58
  catch (error) {
59
- printCliError(error);
60
- return 1;
59
+ return printCliError(error);
61
60
  }
62
61
  }
@@ -0,0 +1,14 @@
1
+ /** `-e <org>/<stage>` and bare-stage resolution; see docs/platform/seq-studio-cli-1.0.md §3. */
2
+ import type { LatticeConfig, ResolvedEnv } from './config.js';
3
+ export declare function knownOrgs(config: LatticeConfig): string;
4
+ /**
5
+ * `<org>/<stage>`, and a bare `staging` / `prod` inside a repository.
6
+ *
7
+ * Never retargets an existing name: a bare stage takes its org meaning only
8
+ * where it has no configured meaning, and a configured `staging` that belongs
9
+ * to another org than the repository's is refused rather than silently used.
10
+ */
11
+ export declare function resolveStagedEnv({ config, name }: {
12
+ config: LatticeConfig;
13
+ name: string;
14
+ }): ResolvedEnv | null;
@@ -0,0 +1,73 @@
1
+ import { UsageError } from './exit-codes.js';
2
+ import { isStage, orgOfUrl } from './orgs.js';
3
+ /**
4
+ * The configured environment serving `url`, so an org/stage target signs in with
5
+ * the same realm and cached tokens as that environment's own name.
6
+ */
7
+ function stagedTarget({ config, label, url }) {
8
+ const origin = new URL(url).origin;
9
+ const match = Object.entries(config.envs).find(([, env]) => {
10
+ try {
11
+ return new URL(env.url).origin === origin;
12
+ }
13
+ catch {
14
+ return false;
15
+ }
16
+ });
17
+ if (!match) {
18
+ throw new UsageError(`${label} is ${origin}, which is not a configured environment yet. ` +
19
+ `Add it once: seq-studio login ${origin}`);
20
+ }
21
+ return { name: match[0], url: match[1].url };
22
+ }
23
+ export function knownOrgs(config) {
24
+ const names = Object.keys(config.orgs ?? {});
25
+ return names.length > 0 ? names.join(', ') : 'none yet';
26
+ }
27
+ /** How to teach the CLI an org's deployments, with the URL its deployments usually have. */
28
+ function loginHint({ org, stage }) {
29
+ const host = stage === 'staging' ? `staging.${org}.seqholdings.com` : `${org}.seqholdings.com`;
30
+ return `Log in to one of its deployments once, for example: seq-studio login https://${host}`;
31
+ }
32
+ /**
33
+ * `<org>/<stage>`, and a bare `staging` / `prod` inside a repository.
34
+ *
35
+ * Never retargets an existing name: a bare stage takes its org meaning only
36
+ * where it has no configured meaning, and a configured `staging` that belongs
37
+ * to another org than the repository's is refused rather than silently used.
38
+ */
39
+ export function resolveStagedEnv({ config, name }) {
40
+ const orgs = config.orgs ?? {};
41
+ const slash = name.indexOf('/');
42
+ if (slash > 0) {
43
+ const org = name.slice(0, slash);
44
+ const stage = name.slice(slash + 1);
45
+ if (!isStage(stage))
46
+ throw new UsageError(`Unknown stage "${stage}" in -e ${name}: use ${org}/staging or ${org}/prod.`);
47
+ const url = orgs[org]?.[stage];
48
+ if (!url) {
49
+ throw new UsageError(`No ${stage} deployment known for org "${org}" (known orgs: ${knownOrgs(config)}). ${loginHint({ org, stage })}`);
50
+ }
51
+ return stagedTarget({ config, label: name, url });
52
+ }
53
+ if (!isStage(name))
54
+ return null;
55
+ const configured = config.envs[name];
56
+ const repoOrg = config.repoOrg;
57
+ if (configured) {
58
+ const owner = orgOfUrl(orgs, configured.url);
59
+ if (repoOrg && owner && owner.org !== repoOrg) {
60
+ throw new UsageError(`-e ${name} is ambiguous in this ${repoOrg} repository: it has always meant ${owner.org}/${owner.stage} (${configured.url}). ` +
61
+ `Use -e ${owner.org}/${owner.stage} for that, or -e ${repoOrg}/${name} for this repository's org.`);
62
+ }
63
+ return null;
64
+ }
65
+ // Outside a repository a bare stage keeps its old behavior, including its old error.
66
+ if (!repoOrg)
67
+ return null;
68
+ const url = orgs[repoOrg]?.[name];
69
+ if (!url) {
70
+ throw new UsageError(`No ${name} deployment known for org "${repoOrg}" (from .seq/github.yml). ${loginHint({ org: repoOrg, stage: name })}`);
71
+ }
72
+ return stagedTarget({ config, label: `${repoOrg}/${name}`, url });
73
+ }
@@ -14,26 +14,26 @@ import { runStorageImport } from './import-run.js';
14
14
  import { REQUIRE_EXPLICIT_ENV_MESSAGE, explicitOrSandboxEnv } from '../env-flags.js';
15
15
  import { writeScaffoldGuidance } from '../scaffold-guidance.js';
16
16
  const usage = `usage:
17
- seq-studio storage init <workspace-name> [--out workspace.yml]
18
- seq-studio storage validate [workspace.yml]
19
- seq-studio storage apply [workspace.yml] -e <env>
20
- seq-studio storage list -e <env> [--workspace <id>] [--parent <id>] [--trash] [--cursor <cursor>]
21
- seq-studio storage show --workspace <id> [--node <id>] -e <env>
22
- seq-studio storage mkdir <name> --workspace <id> [--parent <id>] -e <env>
23
- seq-studio storage upload <file> --workspace <id> [--path <path>] [--parent <id>] [--replace <file-id> --revision <n>] [--resume <upload-id>] -e <env>
24
- seq-studio storage import <directory|gs://bucket/prefix> --workspace <id> [--path <prefix>] [--parent <id>] [--concurrency <n>] [--progress <file>] [--yes] -e <env>
25
- seq-studio storage uploads --workspace <id> -e <env>
26
- seq-studio storage reconcile --workspace <id> [--abort-incomplete] -e <env>
27
- seq-studio storage download --workspace <id> --node <id> --out <file> [--version <id>] -e <env>
28
- seq-studio storage trash|restore|purge --workspace <id> --node <id> --revision <n> [-e <env>] [--yes]
29
- seq-studio storage access --workspace <id> [--node <id>] [--file <access.json>] -e <env>
30
- seq-studio storage operations --workspace <id> [--retry <operation-id>] -e <env>
31
- seq-studio storage abort --workspace <id> --upload <id> -e <env>
32
- seq-studio storage source show|apply --workspace <id> [--target <id>] [--readers <principal-ids>] [--auto-sync true|false] -e <env>
33
- seq-studio storage sync --workspace <id> [--idempotency-key <key>] [--wait] -e <env>
34
- seq-studio storage sync status|retry|cancel <sync-id> --workspace <id> -e <env>
35
- seq-studio storage snapshots [list|show <snapshot-id>] --workspace <id> [--cursor <cursor>] -e <env>
36
- seq-studio storage delete --workspace <id> --revision <n> --yes -e <env>
17
+ seq-studio workspace init <workspace-name> [--out workspace.yml]
18
+ seq-studio workspace validate [workspace.yml]
19
+ seq-studio workspace apply [workspace.yml] -e <env>
20
+ seq-studio workspace list -e <env> [--workspace <id>] [--parent <id>] [--trash] [--cursor <cursor>]
21
+ seq-studio workspace show --workspace <id> [--node <id>] -e <env>
22
+ seq-studio workspace mkdir <name> --workspace <id> [--parent <id>] -e <env>
23
+ seq-studio workspace upload <file> --workspace <id> [--path <path>] [--parent <id>] [--replace <file-id> --revision <n>] [--resume <upload-id>] -e <env>
24
+ seq-studio workspace import <directory|gs://bucket/prefix> --workspace <id> [--path <prefix>] [--parent <id>] [--concurrency <n>] [--progress <file>] [--yes] -e <env>
25
+ seq-studio workspace uploads --workspace <id> -e <env>
26
+ seq-studio workspace reconcile --workspace <id> [--abort-incomplete] -e <env>
27
+ seq-studio workspace download --workspace <id> --node <id> --out <file> [--version <id>] -e <env>
28
+ seq-studio workspace trash|restore|purge --workspace <id> --node <id> --revision <n> [-e <env>] [--yes]
29
+ seq-studio workspace access --workspace <id> [--node <id>] [--file <access.json>] -e <env>
30
+ seq-studio workspace operations --workspace <id> [--retry <operation-id>] -e <env>
31
+ seq-studio workspace abort --workspace <id> --upload <id> -e <env>
32
+ seq-studio workspace source show|apply --workspace <id> [--target <id>] [--readers <principal-ids>] [--auto-sync true|false] -e <env>
33
+ seq-studio workspace sync --workspace <id> [--idempotency-key <key>] [--wait] -e <env>
34
+ seq-studio workspace sync status|retry|cancel <sync-id> --workspace <id> -e <env>
35
+ seq-studio workspace snapshots [list|show <snapshot-id>] --workspace <id> [--cursor <cursor>] -e <env>
36
+ seq-studio workspace delete --workspace <id> --revision <n> --yes -e <env>
37
37
 
38
38
  Workspaces are provisioned from YAML; paths create folders at upload time.
39
39
  Uploads print their session ID to stderr for retry. Resume uses the same original file.
@@ -309,7 +309,6 @@ export async function runStorageCommand(sub, args) {
309
309
  return 0;
310
310
  }
311
311
  catch (error) {
312
- printCliError(error);
313
- return 1;
312
+ return printCliError(error);
314
313
  }
315
314
  }
@@ -9,10 +9,10 @@ export declare const templateMetadataSchema: z.ZodObject<{
9
9
  description: z.ZodString;
10
10
  includes: z.ZodArray<z.ZodEnum<{
11
11
  function: "function";
12
- process: "process";
13
12
  artifact: "artifact";
14
- pipeline: "pipeline";
15
13
  orm: "orm";
14
+ pipeline: "pipeline";
15
+ process: "process";
16
16
  agent: "agent";
17
17
  workspace: "workspace";
18
18
  }>>;
@@ -24,17 +24,17 @@ export declare const templateReleaseSchema: z.ZodObject<{
24
24
  description: z.ZodString;
25
25
  includes: z.ZodArray<z.ZodEnum<{
26
26
  function: "function";
27
- process: "process";
28
27
  artifact: "artifact";
29
- pipeline: "pipeline";
30
28
  orm: "orm";
29
+ pipeline: "pipeline";
30
+ process: "process";
31
31
  agent: "agent";
32
32
  workspace: "workspace";
33
33
  }>>;
34
34
  source: z.ZodObject<{
35
35
  environment: z.ZodEnum<{
36
- banksouth: "banksouth";
37
36
  staging: "staging";
37
+ banksouth: "banksouth";
38
38
  }>;
39
39
  repo: z.ZodString;
40
40
  commit: z.ZodString;
@@ -28,7 +28,7 @@ export function validateTemplatePublishRoute(from, to) {
28
28
  if (from !== 'banksouth' && from !== 'staging') {
29
29
  throw new Error('publish requires --from banksouth or --from staging.');
30
30
  }
31
- if (to === 'local' || to.startsWith('local:') || to.startsWith('preview:')) {
31
+ if (to === 'local' || to.startsWith('local:')) {
32
32
  throw new Error('--to must be a deployed environment or all.');
33
33
  }
34
34
  if (from === 'staging' && to !== 'staging') {
@@ -1,8 +1,8 @@
1
+ import { cliConfigDir } from './config-dir.js';
1
2
  import { spawn } from 'node:child_process';
2
3
  import { createHash } from 'node:crypto';
3
4
  import { mkdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';
4
5
  import { readFileSync } from 'node:fs';
5
- import { homedir } from 'node:os';
6
6
  import { dirname, join } from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
8
  import { gt, valid } from 'semver';
@@ -10,7 +10,7 @@ import { gt, valid } from 'semver';
10
10
  * Update discovery: tell CLI users and agents when a newer version is on npm.
11
11
  *
12
12
  * Zero foreground network latency is the design constraint. The command path
13
- * reads the on-disk cache (~/.config/lattice/update-check.json) and prints;
13
+ * reads the on-disk cache (~/.config/seq-studio/update-check.json) and prints;
14
14
  * the registry poll and eligible global pnpm upgrade run in a detached process spawned
15
15
  * at most once per CHECK_INTERVAL_MS — including after failures, which
16
16
  * record their attempt time so a downed registry doesn't retry on every
@@ -41,7 +41,7 @@ export function updateCheckCachePath(installationFile = fileURLToPath(import.met
41
41
  // A project-pinned CLI must not consume the global installation's daily
42
42
  // check. pnpm versions live at distinct real paths, so hash the package path.
43
43
  const installation = createHash('sha256').update(dirname(installationFile)).digest('hex').slice(0, 16);
44
- return join(homedir(), '.config', 'lattice', `update-check-${installation}.json`);
44
+ return join(cliConfigDir(), `update-check-${installation}.json`);
45
45
  }
46
46
  /** Exclusive-create marker that makes "who spawns the refresh?" atomic. */
47
47
  export function updateCheckClaimPath() {
@@ -0,0 +1,39 @@
1
+ export declare const SUPPORTED_HEADER = "x-seq-studio-supported";
2
+ /** SemVer precedence: numeric prerelease identifiers compare as numbers (rc.10 > rc.2). */
3
+ export declare function compareVersions(a: string, b: string): number;
4
+ export interface SupportedRange {
5
+ min: string;
6
+ deprecatedBelow: string;
7
+ }
8
+ export declare function parseSupportedHeader(value: string | null): SupportedRange | null;
9
+ export declare class UnsupportedCliError extends Error {
10
+ name: string;
11
+ }
12
+ export type Support = {
13
+ kind: 'ok';
14
+ } | {
15
+ kind: 'deprecated';
16
+ range: SupportedRange;
17
+ } | {
18
+ kind: 'unsupported';
19
+ range: SupportedRange;
20
+ };
21
+ export declare function supportFor({ installed, range }: {
22
+ installed: string;
23
+ range: SupportedRange | null;
24
+ }): Support;
25
+ /**
26
+ * Apply an Atlas response's supported range: throw below the minimum, warn once
27
+ * below the deprecation floor. Responses without the header are left alone.
28
+ */
29
+ export declare function enforceSupportedVersion(response: Response, installed?: string): void;
30
+ /** A note when the running CLI is not the repository's pinned `<major>.<minor>`, else null. */
31
+ export declare function pinNote({ pin, installed }: {
32
+ pin: string | undefined;
33
+ installed?: string;
34
+ }): string | null;
35
+ /** One doctor line: the repository's pin against the running CLI. */
36
+ export declare function pinStatusLine({ pin, installed }: {
37
+ pin: string | undefined;
38
+ installed?: string;
39
+ }): string;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Which seq-studio a request may use (spec §5).
3
+ *
4
+ * Atlas sends `x-seq-studio-supported: min=<v>; deprecated-below=<v>` on API
5
+ * responses. Below `deprecated-below` the CLI warns once; below `min` it refuses,
6
+ * naming the upgrade. A repository pins `cli: <major>.<minor>` in
7
+ * `.seq/github.yml`; running another minor prints how to run the pinned one.
8
+ */
9
+ import { compare, valid } from 'semver';
10
+ import { currentVersion } from './update-check.js';
11
+ export const SUPPORTED_HEADER = 'x-seq-studio-supported';
12
+ const UPGRADE = 'pnpm add -g @sequenceholdings/studio-cli@latest';
13
+ /** SemVer precedence: numeric prerelease identifiers compare as numbers (rc.10 > rc.2). */
14
+ export function compareVersions(a, b) {
15
+ return compare(a, b);
16
+ }
17
+ const VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
18
+ export function parseSupportedHeader(value) {
19
+ if (!value)
20
+ return null;
21
+ const fields = new Map(value.split(';').map((part) => part.trim().split('=', 2)));
22
+ const min = fields.get('min');
23
+ const deprecatedBelow = fields.get('deprecated-below');
24
+ if (!min || !deprecatedBelow || !VERSION.test(min) || !VERSION.test(deprecatedBelow))
25
+ return null;
26
+ return { min, deprecatedBelow };
27
+ }
28
+ export class UnsupportedCliError extends Error {
29
+ name = 'UnsupportedCliError';
30
+ }
31
+ export function supportFor({ installed, range }) {
32
+ // A development build without a release version is never refused.
33
+ if (!range || !valid(installed))
34
+ return { kind: 'ok' };
35
+ if (compareVersions(installed, range.min) < 0)
36
+ return { kind: 'unsupported', range };
37
+ if (compareVersions(installed, range.deprecatedBelow) < 0)
38
+ return { kind: 'deprecated', range };
39
+ return { kind: 'ok' };
40
+ }
41
+ let warned = false;
42
+ /**
43
+ * Apply an Atlas response's supported range: throw below the minimum, warn once
44
+ * below the deprecation floor. Responses without the header are left alone.
45
+ */
46
+ export function enforceSupportedVersion(response, installed = currentVersion()) {
47
+ const support = supportFor({ installed, range: parseSupportedHeader(response.headers.get(SUPPORTED_HEADER)) });
48
+ if (support.kind === 'unsupported') {
49
+ throw new UnsupportedCliError(`seq-studio ${installed} is older than this Atlas supports (minimum ${support.range.min}). Upgrade: ${UPGRADE}`);
50
+ }
51
+ if (support.kind === 'deprecated' && !warned) {
52
+ warned = true;
53
+ console.error(`note: seq-studio ${installed} is deprecated on this Atlas; ${support.range.deprecatedBelow} or newer is supported. Upgrade: ${UPGRADE}`);
54
+ }
55
+ }
56
+ /** A note when the running CLI is not the repository's pinned `<major>.<minor>`, else null. */
57
+ export function pinNote({ pin, installed = currentVersion() }) {
58
+ if (!pin)
59
+ return null;
60
+ const running = installed.split('.').slice(0, 2).join('.');
61
+ if (running === pin)
62
+ return null;
63
+ return `note: this repository pins seq-studio ${pin}; this is ${installed}. ` +
64
+ `Run the pinned one with: pnpm dlx @sequenceholdings/studio-cli@${pin} <command> (or set SEQ_STUDIO_USE_PIN=1 to always), or move the pin: seq-studio upgrade`;
65
+ }
66
+ /** One doctor line: the repository's pin against the running CLI. */
67
+ export function pinStatusLine({ pin, installed = currentVersion() }) {
68
+ if (!pin)
69
+ return `cli pin: none (running ${installed}; seq-studio upgrade pins it)`;
70
+ return pinNote({ pin, installed }) ? `cli pin: MISMATCH — repository pins ${pin}, running ${installed}` : `cli pin: ok — ${pin} (running ${installed})`;
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequenceholdings/studio-cli",
3
- "version": "0.9.23",
3
+ "version": "0.9.26",
4
4
  "description": "Unified Sequence Studio CLI — `seq-studio init` / `add` / `deploy` (app monorepos), `seq-studio agents`, `seq-studio process` (Lattice), `seq-studio artifact`, `seq-studio functions` / `secrets`, `seq-studio repos`, and `seq-studio auth whoami`. Includes Auth0 browser login shared with seqapi.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -46,15 +46,15 @@
46
46
  "yaml": "^2.8.4",
47
47
  "zod": "4.6.6",
48
48
  "@sequenceholdings/agent-spec": "0.1.6",
49
- "@sequenceholdings/artifact-studio": "0.11.20",
50
- "@sequenceholdings/managed-functions": "0.5.14",
49
+ "@sequenceholdings/artifact-studio": "0.11.22",
51
50
  "@sequenceholdings/lattice": "0.1.9",
52
- "@sequenceholdings/storage": "0.1.8",
53
- "@sequenceholdings/platform": "0.1.5"
51
+ "@sequenceholdings/managed-functions": "0.5.15",
52
+ "@sequenceholdings/platform": "0.1.5",
53
+ "@sequenceholdings/storage": "0.1.8"
54
54
  },
55
55
  "peerDependencies": {
56
- "@sequenceholdings/pipeline-spec": "0.3.13",
57
- "@sequenceholdings/orm": "2.11.1"
56
+ "@sequenceholdings/orm": "2.12.0",
57
+ "@sequenceholdings/pipeline-spec": "0.3.14"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "@sequenceholdings/orm": {
@@ -70,8 +70,8 @@
70
70
  "@types/semver": "^7.8.0",
71
71
  "typescript": "^5.6.0",
72
72
  "vitest": "^4.1.12",
73
- "@sequenceholdings/orm": "2.11.1",
74
- "@sequenceholdings/pipeline-spec": "0.3.13"
73
+ "@sequenceholdings/pipeline-spec": "0.3.14",
74
+ "@sequenceholdings/orm": "2.12.0"
75
75
  },
76
76
  "engines": {
77
77
  "node": ">=20"
@@ -90,6 +90,7 @@
90
90
  "type-check": "tsc --noEmit",
91
91
  "test": "vitest run",
92
92
  "test:watch": "vitest",
93
- "test:git-login": "pnpm run build && node scripts/test-git-login.mjs"
93
+ "test:git-login": "pnpm run build && node scripts/test-git-login.mjs",
94
+ "compat-check": "node scripts/cli-compat-check.mjs"
94
95
  }
95
96
  }
@@ -6,5 +6,8 @@
6
6
  "0.9.20": "Lattice date forms now use DatePicker instead of the browser's native date popup.",
7
7
  "0.9.21": "New seq-studio docs search|read|list; repos clone adds agent docs guidance. Clones roll back on failure; new repos attach-login. Devbox sign-in no longer uses a shared identity. Browser login fails fast without a terminal. envs add accepts local:<name>. init and deploy flag lockfiles CI can't use.",
8
8
  "0.9.22": "New init --github <owner>/<name> --org <org> starts an app in its own new private GitHub repository. repos pulls create and edit take --type (bug, performance, enhancement, feature, chore); a Pull needs one to merge. repo init adds a required pr-type check.",
9
- "0.9.23": "ORM plans now accept retained table and column rename hints when previewing a fresh schema. Includes ORM 2.11.1 and updated dependent packages; incremental migrations retain rename-source validation."
9
+ "0.9.23": "ORM plans now accept retained table and column rename hints when previewing a fresh schema. Includes ORM 2.11.1 and updated dependent packages; incremental migrations retain rename-source validation.",
10
+ "0.9.24": "Artifact builds now use Atlas UI 4.0.0 and its DatePicker and DateRangePicker controls. Legacy public date field exports are removed.",
11
+ "0.9.25": "function deploy --adopt, on a local Atlas running on a personal development database branch, takes over a function that a database copy brought from another runtime, so it deploys and runs there under its own slug.",
12
+ "0.9.26": "Includes ORM 2.12.0: resolved tables can set rows: { keys: 'indexed' } so a policy or link filter that probes them by key reaches every source's index instead of rebuilding the view per probed row. Atlas checks that only the generated view reads its key relations."
10
13
  }