@sequenceholdings/studio-cli 0.4.7 → 0.5.2

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 (73) hide show
  1. package/README.md +162 -84
  2. package/dist/agents/commands.js +7 -0
  3. package/dist/app/adapters.d.ts +2 -2
  4. package/dist/app/adapters.js +15 -14
  5. package/dist/app/commands.d.ts +1 -1
  6. package/dist/app/commands.js +77 -14
  7. package/dist/app/deploy.d.ts +2 -0
  8. package/dist/app/deploy.js +25 -13
  9. package/dist/app/kinds.d.ts +6 -0
  10. package/dist/app/kinds.js +6 -0
  11. package/dist/app/manifest.js +1 -1
  12. package/dist/app/official-source.d.ts +10 -0
  13. package/dist/app/official-source.js +23 -0
  14. package/dist/app/prepare.d.ts +27 -0
  15. package/dist/app/prepare.js +58 -0
  16. package/dist/app/primitive-ids.d.ts +6 -0
  17. package/dist/app/primitive-ids.js +16 -0
  18. package/dist/app/primitive-scaffold.d.ts +0 -4
  19. package/dist/app/primitive-scaffold.js +7 -18
  20. package/dist/app/readme.js +23 -16
  21. package/dist/app/repository-index.d.ts +19 -0
  22. package/dist/app/repository-index.js +86 -0
  23. package/dist/app/scaffold.d.ts +12 -1
  24. package/dist/app/scaffold.js +32 -19
  25. package/dist/app/workspace-compile.d.ts +9 -0
  26. package/dist/app/workspace-compile.js +13 -1
  27. package/dist/app/workspace-scaffold.js +5 -1
  28. package/dist/artifact/delegate.js +4 -4
  29. package/dist/auth-cmds/commands.d.ts +1 -13
  30. package/dist/auth-cmds/commands.js +11 -246
  31. package/dist/auth.d.ts +17 -0
  32. package/dist/auth.js +29 -0
  33. package/dist/bin.js +1 -1
  34. package/dist/command-contract.d.ts +11 -5
  35. package/dist/command-contract.js +4 -3
  36. package/dist/command-help.d.ts +2 -2
  37. package/dist/command-help.js +14 -16
  38. package/dist/config.d.ts +16 -0
  39. package/dist/config.js +38 -5
  40. package/dist/env-registry.d.ts +8 -0
  41. package/dist/env-registry.js +9 -1
  42. package/dist/envs/commands.js +14 -1
  43. package/dist/functions/manifest.d.ts +4 -1
  44. package/dist/functions/manifest.js +8 -2
  45. package/dist/main.d.ts +3 -2
  46. package/dist/main.js +12 -6
  47. package/dist/orm/delegate.js +5 -2
  48. package/dist/pipeline/clone-deploy.d.ts +2 -3
  49. package/dist/pipeline/clone-deploy.js +9 -10
  50. package/dist/pipeline/commands.js +4 -3
  51. package/dist/pipeline/lifecycle.d.ts +3 -1
  52. package/dist/pipeline/lifecycle.js +12 -4
  53. package/dist/process/commands.d.ts +6 -3
  54. package/dist/process/commands.js +26 -10
  55. package/dist/repos/commands.d.ts +2 -11
  56. package/dist/repos/commands.js +71 -157
  57. package/dist/repos/git-clone.d.ts +1 -10
  58. package/dist/repos/git-clone.js +1 -49
  59. package/dist/repos/git-credential.d.ts +15 -0
  60. package/dist/repos/git-credential.js +91 -0
  61. package/dist/repos/pulls.d.ts +19 -1
  62. package/dist/repos/pulls.js +15 -2
  63. package/dist/templates/catalog.d.ts +69 -0
  64. package/dist/templates/catalog.js +68 -0
  65. package/dist/templates/commands.d.ts +29 -0
  66. package/dist/templates/commands.js +443 -0
  67. package/dist/templates/process/example-process/process.ts +2 -0
  68. package/dist/templates/process/package.json +1 -1
  69. package/package.json +13 -11
  70. package/templates/process/example-process/process.ts +2 -0
  71. package/templates/process/package.json +1 -1
  72. package/dist/pat-hints.d.ts +0 -15
  73. package/dist/pat-hints.js +0 -28
package/dist/auth.js CHANGED
@@ -70,6 +70,18 @@ const TRUSTED_LOOPBACK_AUTH0_AUDIENCES = new Set([
70
70
  AUTH0_AUDIENCE,
71
71
  SEQUENCE_STAGING_AUTH0_AUDIENCE,
72
72
  ]);
73
+ /**
74
+ * Reserved names for first-party deployments on the shared Sequence login
75
+ * (every built-in name except `local`). `envs add` saves them to config.toml
76
+ * after confirming the deployment really uses that login.
77
+ */
78
+ export function isSharedLoginDeploymentName(envName) {
79
+ return envName !== 'local' && SEQUENCE_BUILTIN_ENVS.has(envName);
80
+ }
81
+ /** Whether a deployment's advertised Auth0 client is the shared Sequence login. */
82
+ export function usesSharedSequenceLogin({ clientId, audience }) {
83
+ return clientId === AUTH0_CLIENT_ID && audience === AUTH0_AUDIENCE;
84
+ }
73
85
  export function isSequenceAuthEnvName(envName) {
74
86
  return (envName === SEQUENCE_REALM ||
75
87
  SEQUENCE_BUILTIN_ENVS.has(envName) ||
@@ -406,10 +418,27 @@ export class NotLoggedInError extends Error {
406
418
  export class UnsafeAuthTargetError extends Error {
407
419
  }
408
420
  const AUTO_LOGIN_TIMEOUT_MS = 120_000;
421
+ let autoLoginSuppressed = 0;
409
422
  function autoLoginEnabled() {
423
+ if (autoLoginSuppressed > 0)
424
+ return false;
410
425
  const value = process.env.SEQAPI_AUTO_LOGIN?.trim().toLowerCase() ?? '1';
411
426
  return !['0', 'false', 'no', 'off'].includes(value);
412
427
  }
428
+ /**
429
+ * Run `fn` without opening a browser login: a missing or expired session
430
+ * raises `NotLoggedInError` instead. For commands such as `deploy --dry-run`
431
+ * that must never sign anyone in as a side effect.
432
+ */
433
+ export async function withoutAutoLogin(fn) {
434
+ autoLoginSuppressed += 1;
435
+ try {
436
+ return await fn();
437
+ }
438
+ finally {
439
+ autoLoginSuppressed -= 1;
440
+ }
441
+ }
413
442
  function autoLoginTimeoutMs() {
414
443
  const raw = process.env.SEQAPI_AUTO_LOGIN_TIMEOUT?.trim();
415
444
  if (!raw)
package/dist/bin.js CHANGED
@@ -23,7 +23,7 @@ run(argv)
23
23
  // The update notice runs after the command so it never delays real output,
24
24
  // and it is best-effort (never throws, never changes the exit code).
25
25
  .then(async (code) => {
26
- if (!isHelpOrDiscovery && !doctorOffline) {
26
+ if (!isHelpOrDiscovery && !doctorOffline && !(argv[0] === 'auth' && argv[1] === 'git-credential')) {
27
27
  const { maybeNotifyUpdate } = await import('./update-check.js');
28
28
  await maybeNotifyUpdate();
29
29
  }
@@ -1,9 +1,9 @@
1
1
  /** Machine-readable summary of the CLI surface, kept independent of command implementations. */
2
2
  export declare const COMMAND_CONTRACT: readonly [{
3
3
  readonly name: "init";
4
- readonly description: "Scaffold an app workspace";
4
+ readonly description: "Scaffold an app workspace or use a published template";
5
5
  readonly lifecycle: "internal";
6
- readonly access: "offline";
6
+ readonly access: "mixed";
7
7
  readonly subcommands: readonly [];
8
8
  }, {
9
9
  readonly name: "add";
@@ -53,6 +53,12 @@ export declare const COMMAND_CONTRACT: readonly [{
53
53
  readonly lifecycle: "stable";
54
54
  readonly access: "mixed";
55
55
  readonly subcommands: readonly ["list", "namespaces", "show", "create", "clone", "pull", "pulls", "delete", "ci"];
56
+ }, {
57
+ readonly name: "templates";
58
+ readonly description: "Publish, synchronize, and list repository templates";
59
+ readonly lifecycle: "internal";
60
+ readonly access: "mixed";
61
+ readonly subcommands: readonly ["publish", "sync", "list"];
56
62
  }, {
57
63
  readonly name: "pipeline";
58
64
  readonly description: "Discover and operate Data Pipelines";
@@ -61,10 +67,10 @@ export declare const COMMAND_CONTRACT: readonly [{
61
67
  readonly subcommands: readonly ["list", "assets", "search", "describe", "schema", "sample", "query", "init", "validate", "plan", "deploy", "status", "migrate", "adopt", "unbind", "run-now", "promote", "rollback"];
62
68
  }, {
63
69
  readonly name: "auth";
64
- readonly description: "Manage Git Service personal access tokens";
70
+ readonly description: "Manage Git authentication";
65
71
  readonly lifecycle: "stable";
66
72
  readonly access: "authenticated";
67
- readonly subcommands: readonly ["whoami", "pat"];
73
+ readonly subcommands: readonly ["whoami", "git-credential", "pat"];
68
74
  }, {
69
75
  readonly name: "orm";
70
76
  readonly description: "Author and operate ORM namespaces";
@@ -76,7 +82,7 @@ export declare const COMMAND_CONTRACT: readonly [{
76
82
  readonly description: "Manage CLI environments";
77
83
  readonly lifecycle: "stable";
78
84
  readonly access: "mixed";
79
- readonly subcommands: readonly ["add", "list", "refresh"];
85
+ readonly subcommands: readonly ["add", "list"];
80
86
  }, {
81
87
  readonly name: "login";
82
88
  readonly description: "Authenticate with Sequence";
@@ -1,6 +1,6 @@
1
1
  /** Machine-readable summary of the CLI surface, kept independent of command implementations. */
2
2
  export const COMMAND_CONTRACT = [
3
- { name: 'init', description: 'Scaffold an app workspace', lifecycle: 'internal', access: 'offline', subcommands: [] },
3
+ { name: 'init', description: 'Scaffold an app workspace or use a published template', lifecycle: 'internal', access: 'mixed', subcommands: [] },
4
4
  { name: 'add', description: 'Add a primitive to an app workspace', lifecycle: 'internal', access: 'offline', subcommands: [] },
5
5
  { name: 'deploy', description: 'Deploy an app workspace', lifecycle: 'internal', access: 'authenticated', subcommands: [] },
6
6
  { name: 'process', description: 'Build and operate Lattice processes', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'lint', 'plan', 'apply', 'test', 'simulate', 'bundle', 'promote', 'pull', 'safety-baseline'] },
@@ -9,10 +9,11 @@ export const COMMAND_CONTRACT = [
9
9
  { name: 'agents', description: 'Validate and deploy typed agent definitions', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'validate', 'plan', 'apply', 'list', 'show'] },
10
10
  { name: 'secrets', description: 'Manage organization-owned secrets', lifecycle: 'stable', access: 'authenticated', subcommands: ['create', 'set', 'list', 'attach', 'detach', 'apply'] },
11
11
  { name: 'repos', description: 'Manage repositories and native CI; ci init is offline', lifecycle: 'stable', access: 'mixed', subcommands: ['list', 'namespaces', 'show', 'create', 'clone', 'pull', 'pulls', 'delete', 'ci'] },
12
+ { name: 'templates', description: 'Publish, synchronize, and list repository templates', lifecycle: 'internal', access: 'mixed', subcommands: ['publish', 'sync', 'list'] },
12
13
  { name: 'pipeline', description: 'Discover and operate Data Pipelines', lifecycle: 'preview', access: 'staff', subcommands: ['list', 'assets', 'search', 'describe', 'schema', 'sample', 'query', 'init', 'validate', 'plan', 'deploy', 'status', 'migrate', 'adopt', 'unbind', 'run-now', 'promote', 'rollback'] },
13
- { name: 'auth', description: 'Manage Git Service personal access tokens', lifecycle: 'stable', access: 'authenticated', subcommands: ['whoami', 'pat'] },
14
+ { name: 'auth', description: 'Manage Git authentication', lifecycle: 'stable', access: 'authenticated', subcommands: ['whoami', 'git-credential', 'pat'] },
14
15
  { name: 'orm', description: 'Author and operate ORM namespaces', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'generate', 'validate', 'plan', 'apply', 'execute', 'diff', 'migrate-from-yaml', 'import'] },
15
- { name: 'envs', description: 'Manage CLI environments', lifecycle: 'stable', access: 'mixed', subcommands: ['add', 'list', 'refresh'] },
16
+ { name: 'envs', description: 'Manage CLI environments', lifecycle: 'stable', access: 'mixed', subcommands: ['add', 'list'] },
16
17
  { name: 'login', description: 'Authenticate with Sequence', lifecycle: 'stable', access: 'public', subcommands: [] },
17
18
  { name: 'logout', description: 'Remove cached user tokens', lifecycle: 'stable', access: 'public', subcommands: [] },
18
19
  { name: 'doctor', description: 'Diagnose CLI configuration and access', lifecycle: 'stable', access: 'mixed', subcommands: [] },
@@ -2,8 +2,8 @@
2
2
  export declare const ORM_HELP = "usage:\n seq-studio orm init <dir>\n seq-studio orm generate [dir] [--migration-export] [--check]\n seq-studio orm validate [dir]\n seq-studio orm plan [dir] -e <env>\n seq-studio orm apply [dir] -e <env>\n seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>\n seq-studio orm diff [dir] [--check] [--allow-destructive] [--rebase]\n seq-studio orm migrate-from-yaml <dir>\n seq-studio orm import [dir] --spec <file> | --table <table> --from <schema.table> --map <target=source,...>\n\n -e/--env is required for commands that contact Atlas. Use seq-studio envs list\n to discover environments and seq-studio login to authenticate.\n";
3
3
  export declare const ARTIFACT_HELP = "usage:\n seq-studio artifact init <dir> [--template react-vite|nextjs]\n seq-studio artifact whoami -e <env>\n seq-studio artifact link [dir] -e <env> [--project <id>]\n seq-studio artifact env list|use <env>\n seq-studio artifact status [-e <env>]\n seq-studio artifact list -e <env> [--json]\n seq-studio artifact show <slug-or-id> -e <env> [--json]\n seq-studio artifact validate [dir]\n seq-studio artifact build|plan|deploy [dir | --repo <namespace>/<name> | --git-url <url>] [--ref <ref>] -e <env>\n seq-studio artifact dev [dir] -e <env> [--once] [--key <name>] [--link <package-dir>] [--port <port>]\n seq-studio artifact pull <project-id> -e <env> --out <dir>\n seq-studio artifact promote|rollback <deployment-id> -e <env>\n\n Help is available offline. Authenticate with seq-studio login. Build and deploy\n sources may be local, a platform git-service repo, or a public HTTPS Git URL;\n deployments target a named environment with -e. Local, preview, and official\n deployment workflows have different source and approval rules; see the public\n CLI README.\n";
4
4
  export declare const PIPELINE_HELP = "usage:\n seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]\n list pipeline repository rollups (not assets)\n seq-studio pipeline assets -e <env> [--repo <namespace>/<slug>] [--json]\n list asset declarations, including assets that may not be deployed\n seq-studio pipeline search <query> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--limit N] [--offset N] [--json]\n seq-studio pipeline describe <asset-id> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--json]\n seq-studio pipeline schema|sample <asset-id> -e <env> [--target <id>] [--limit N] [--json]\n seq-studio pipeline query <asset-id> --sql <read-only-sql> -e <env> [--target <id>] [--limit N] [--json]\n seq-studio pipeline init|validate|plan|deploy|status|migrate|adopt|unbind|run-now|promote|rollback ...\n seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]\n poll an existing durable plan without enqueueing or attaching credentials\n Lifecycle --json results use stdout; progress uses stderr. Deploy --run-now\n executes producers in the managed worker; local polling may disconnect.\n\n Discovery requires staff access. Use list for pipeline repositories, assets\n for declared assets, and search/describe for active deployment metadata;\n use schema to verify physical columns. -e chooses the environment and\n --target chooses a logical target when the environment has more than one.\n Help is available offline.\n";
5
- export declare const FUNCTIONS_USAGE = "usage:\n seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers\n seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)\n seq-studio functions register -e <env> [--dir d] register a function shell without deploying\n seq-studio functions deploy -e <env> [-m msg] preflight deployed capabilities, then upload and deploy\n seq-studio functions list -e <env> [--match-local] functions visible on the environment\n seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)\n seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy\n [--fn slug] also show effective runtime limits (requires -e)\n seq-studio functions dev [--dir path] [--port 8080] local HTTP server with cache context\n seq-studio functions invoke -e <env> [--data JSON | --data @file | --stdin]\n invoke a function and print its response\n seq-studio functions logs -e <env> [--limit N] [--since t] function logs (reader-gated)\n seq-studio functions promote <version> -e <env> make a version live\n seq-studio functions rollback [<version>] -e <env> redeploy a prior version\n seq-studio functions delete -e <env> [--yes] archive function + tear down its runtime\n (version history is retained)\n\n Flags: -e/--env <env|preview:<slug>> (required for network commands; see: seq-studio envs list) \u00B7 --fn <slug> \u00B7 --dir <path>\n --path <repo-subdirectory> (remote build/deploy only) select one function in a multi-function repo\n --from-env-file <path> (default: .env) source file for secret values\n --no-wait \u00B7 --yes\n --no-provision (deploy) update-only: error instead of registering a new\n shell, writing secret values, or attaching secrets (CI sweep)\n\n Local Atlas builds and runs deployed functions on this computer, including teardown.\n \"functions dev\" runs a standalone handler without Atlas registration.\n\n Configure per-function CPU and concurrency in managed-function.yml under limits.\n Run \"functions limits\" for valid settings; redeploy to apply manifest changes.\n Invocation rates are shared across Atlas replicas; 429 includes Retry-After.\n If the shared rate limiter is unavailable, invocation fails closed with 503.\n\n Source for build/deploy: a local --dir (default .), a platform git-service\n repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --path selects\n a function directory within a remote repo; omit it for the existing root-manifest\n layout. --ref selects a branch/tag/commit (default: the repo's default branch).\n Remote sources record the pinned commit as provenance (never dirty) and NEVER\n read a repo-committed .env for secret values \u2014 provision secrets server-side\n or pass a local --from-env-file (resolved against your cwd).\n\n Interactive --repo builds clone over smart-HTTP and require a repo:read git\n PAT in ATLAS_GIT_PAT (`seq-studio auth pat create --scopes repo:read`, or\n Atlas \u2192 Settings \u2192 Tokens). Headless M2M builds use JSON materialize and\n accept only platform-managed --repo sources. Interactive builds also need\n --env + seq-studio login to resolve the repo and deploy.\n";
6
- export declare const REPOS_USAGE = "usage:\n seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment\n seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces\n seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)\n seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]\n create a repo seeded with a README; --git-backend\n walgit creates it empty (for pushing existing\n history); needs namespace write\n seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]\n seq-studio repos clone --url <https://\u2026/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]\n seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]\n smart-HTTP when ATLAS_GIT_PAT is set;\n otherwise JSON materialize (<ns>/<name>)\n seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n materialize the tree at a ref (JSON API)\n seq-studio repos pulls <list|show|create|diff|merge> [args] review requests (see pulls --help)\n seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)\n seq-studio repos ci init [--dir <repository>] create a native pipeline using platform defaults\n seq-studio repos ci show <ns>/<name> -e <env> --pr <number> [--json] inspect the server CI plan and runs\n seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview pipeline discovery or legacy checks\n seq-studio repos ci require <ns>/<name> --check <name> -e <env> disabled legacy control\n seq-studio repos ci import <ns>/<name> -e <env> [--ref r] disabled legacy control\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n\n clone prefers real git clone (PAT via askpass \u2014 never written into the remote\n URL). --transport auto (default) uses Git when ATLAS_GIT_PAT is set and JSON\n materialization otherwise; --transport git requires a repo:read PAT; --transport\n json ignores ATLAS_GIT_PAT and uses the signed-in Atlas identity (<ns>/<name>\n only; no .git directory). Authentication failures explain this retry path.\n JSON materialization requires repo read access and prints how to create a PAT.\n PAT without Auth0 login: use --id from Repositories \u2192 Clone\n (or --url with the environment's canonical HTTPS origin).\n --ref accepts a branch, tag, or commit SHA (SHA \u2192 full clone, then checkout).\n Branch and tag clones are shallow (--depth 1). Pass --full for history.\n --output selects the clone directory (--out remains an alias).\n\n Authenticate JSON API calls with: seq-studio login\n Authenticate git clone/push with: ATLAS_GIT_PAT (from Atlas Settings \u2192 Tokens)\n";
5
+ export declare const FUNCTIONS_USAGE = "usage:\n seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers\n seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)\n seq-studio functions register -e <env> [--dir d] register a function shell without deploying\n seq-studio functions deploy -e <env> [-m msg] preflight deployed capabilities, then upload and deploy\n seq-studio functions list -e <env> [--match-local] functions visible on the environment\n seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)\n seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy\n [--fn slug] also show effective runtime limits (requires -e)\n seq-studio functions dev [--dir path] [--port 8080] local HTTP server with cache context\n seq-studio functions invoke -e <env> [--data JSON | --data @file | --stdin]\n invoke a function and print its response\n seq-studio functions logs -e <env> [--limit N] [--since t] function logs (reader-gated)\n seq-studio functions promote <version> -e <env> make a version live\n seq-studio functions rollback [<version>] -e <env> redeploy a prior version\n seq-studio functions delete -e <env> [--yes] archive function + tear down its runtime\n (version history is retained)\n\n Flags: -e/--env <env|preview:<slug>> (required for network commands; see: seq-studio envs list) \u00B7 --fn <slug> \u00B7 --dir <path>\n --path <repo-subdirectory> (remote build/deploy only) select one function in a multi-function repo\n --from-env-file <path> (default: .env) source file for secret values\n --no-wait \u00B7 --yes\n --no-provision (deploy) update-only: error instead of registering a new\n shell, writing secret values, or attaching secrets (CI sweep)\n\n Local Atlas builds and runs deployed functions on this computer, including teardown.\n \"functions dev\" runs a standalone handler without Atlas registration.\n\n Configure per-function CPU and concurrency in managed-function.yml under limits.\n Run \"functions limits\" for valid settings; redeploy to apply manifest changes.\n Invocation rates are shared across Atlas replicas; 429 includes Retry-After.\n If the shared rate limiter is unavailable, invocation fails closed with 503.\n\n Source for build/deploy: a local --dir (default .), a platform git-service\n repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --path selects\n a function directory within a remote repo; omit it for the existing root-manifest\n layout. --ref selects a branch/tag/commit (default: the repo's default branch).\n Remote sources record the pinned commit as provenance (never dirty) and NEVER\n read a repo-committed .env for secret values \u2014 provision secrets server-side\n or pass a local --from-env-file (resolved against your cwd).\n\n Interactive --repo builds clone over smart-HTTP using your seq-studio login\n and repository read access. No PAT is needed. Headless M2M builds use JSON\n materialize and accept only platform-managed --repo sources. Use --env to\n select the same environment for source and deployment.\n";
6
+ export declare const REPOS_USAGE = "usage:\n seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment\n seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces\n seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)\n seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]\n create a repo seeded with a README; --git-backend\n walgit creates it empty (for pushing existing\n history); needs namespace write\n seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]\n seq-studio repos clone --url <https://\u2026/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]\n seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]\n real Git clone using seq-studio login;\n configures login for subsequent git pull/push\n seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n materialize the tree at a ref (JSON API)\n seq-studio repos pulls <list|show|create|diff|merge> [args] review requests (see pulls --help)\n seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)\n seq-studio repos ci init [--dir <repository>] create a native pipeline using platform defaults\n seq-studio repos ci show <ns>/<name> -e <env> --pr <number> [--json] inspect the server CI plan and runs\n seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview pipeline discovery or legacy checks\n seq-studio repos ci require <ns>/<name> --check <name> -e <env> disabled legacy control\n seq-studio repos ci import <ns>/<name> -e <env> [--ref r] disabled legacy control\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n\n clone uses your login token (never written into the remote URL or Git config).\n A repository-local credential helper reads your current login for git pull/push.\n After expiry, run seq-studio login --env <env> again.\n --transport auto (default) and git both create a real Git checkout.\n Personal access tokens are retired; ATLAS_GIT_PAT is ignored.\n --transport json downloads files without .git; requires\n <ns>/<name>. repos pull also provides this files-only workflow.\n --ref accepts a branch, tag, or commit SHA (SHA \u2192 full clone, then checkout).\n Branch and tag clones are shallow (--depth 1). Pass --full for history.\n --output selects the clone directory (--out remains an alias).\n\n Authenticate JSON API calls with: seq-studio login\n Authenticate git clone/push with: seq-studio login --env <env>\n";
7
7
  export declare function staticHelp({ namespace, sub }: {
8
8
  namespace: string;
9
9
  sub?: string;
@@ -95,11 +95,10 @@ export const FUNCTIONS_USAGE = `usage:
95
95
  read a repo-committed .env for secret values — provision secrets server-side
96
96
  or pass a local --from-env-file (resolved against your cwd).
97
97
 
98
- Interactive --repo builds clone over smart-HTTP and require a repo:read git
99
- PAT in ATLAS_GIT_PAT (\`seq-studio auth pat create --scopes repo:read\`, or
100
- Atlas → Settings → Tokens). Headless M2M builds use JSON materialize and
101
- accept only platform-managed --repo sources. Interactive builds also need
102
- --env + seq-studio login to resolve the repo and deploy.
98
+ Interactive --repo builds clone over smart-HTTP using your seq-studio login
99
+ and repository read access. No PAT is needed. Headless M2M builds use JSON
100
+ materialize and accept only platform-managed --repo sources. Use --env to
101
+ select the same environment for source and deployment.
103
102
  `;
104
103
  export const REPOS_USAGE = `usage:
105
104
  seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment
@@ -112,8 +111,8 @@ export const REPOS_USAGE = `usage:
112
111
  seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]
113
112
  seq-studio repos clone --url <https://…/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]
114
113
  seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]
115
- smart-HTTP when ATLAS_GIT_PAT is set;
116
- otherwise JSON materialize (<ns>/<name>)
114
+ real Git clone using seq-studio login;
115
+ configures login for subsequent git pull/push
117
116
  seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]
118
117
  materialize the tree at a ref (JSON API)
119
118
  seq-studio repos pulls <list|show|create|diff|merge> [args] review requests (see pulls --help)
@@ -126,20 +125,19 @@ export const REPOS_USAGE = `usage:
126
125
 
127
126
  Flags: -e/--env <env> (required; see: seq-studio envs list)
128
127
 
129
- clone prefers real git clone (PAT via askpass — never written into the remote
130
- URL). --transport auto (default) uses Git when ATLAS_GIT_PAT is set and JSON
131
- materialization otherwise; --transport git requires a repo:read PAT; --transport
132
- json ignores ATLAS_GIT_PAT and uses the signed-in Atlas identity (<ns>/<name>
133
- only; no .git directory). Authentication failures explain this retry path.
134
- JSON materialization requires repo read access and prints how to create a PAT.
135
- PAT without Auth0 login: use --id from Repositories → Clone
136
- (or --url with the environment's canonical HTTPS origin).
128
+ clone uses your login token (never written into the remote URL or Git config).
129
+ A repository-local credential helper reads your current login for git pull/push.
130
+ After expiry, run seq-studio login --env <env> again.
131
+ --transport auto (default) and git both create a real Git checkout.
132
+ Personal access tokens are retired; ATLAS_GIT_PAT is ignored.
133
+ --transport json downloads files without .git; requires
134
+ <ns>/<name>. repos pull also provides this files-only workflow.
137
135
  --ref accepts a branch, tag, or commit SHA (SHA → full clone, then checkout).
138
136
  Branch and tag clones are shallow (--depth 1). Pass --full for history.
139
137
  --output selects the clone directory (--out remains an alias).
140
138
 
141
139
  Authenticate JSON API calls with: seq-studio login
142
- Authenticate git clone/push with: ATLAS_GIT_PAT (from Atlas Settings → Tokens)
140
+ Authenticate git clone/push with: seq-studio login --env <env>
143
141
  `;
144
142
  export function staticHelp({ namespace, sub }) {
145
143
  if (namespace === 'artifact')
package/dist/config.d.ts CHANGED
@@ -55,6 +55,22 @@ export declare function resolveEnv({ config, requested, }: {
55
55
  config: LatticeConfig;
56
56
  requested?: string;
57
57
  }): ResolvedEnv;
58
+ /**
59
+ * Save a first-party deployment under its reserved name (`staging`,
60
+ * `production`, `banksouth`) in config.toml. Those names sign in through the
61
+ * shared Sequence login, so the deployment must advertise exactly that login
62
+ * at its public `/api/auth/cli-config`; anything else is refused. The entry is
63
+ * appended, leaving the rest of the file as written.
64
+ */
65
+ export declare function addSharedLoginEnvironment({ name, baseUrl: rawBaseUrl, fetchImpl, }: {
66
+ name: string;
67
+ baseUrl: string;
68
+ fetchImpl?: typeof fetch;
69
+ }): Promise<{
70
+ name: string;
71
+ baseUrl: string;
72
+ changed: boolean;
73
+ }>;
58
74
  /** Resolve `--env <name>` against the config on disk. */
59
75
  export declare function resolveConfiguredEnv({ requested, }: {
60
76
  requested?: string;
package/dist/config.js CHANGED
@@ -5,8 +5,9 @@ import { homedir } from 'node:os';
5
5
  import { basename, dirname, join } from 'node:path';
6
6
  import { promisify } from 'node:util';
7
7
  import { parse as parseToml, stringify as stringifyToml } from 'smol-toml';
8
- import { isSequenceAuthEnvName } from './auth.js';
9
- import { readRegisteredEnvironmentUrls } from './env-registry.js';
8
+ import { validateDeploymentBaseUrl } from '@sequenceholdings/artifact-studio/deployment-validation';
9
+ import { isSequenceAuthEnvName, isSharedLoginDeploymentName, usesSharedSequenceLogin } from './auth.js';
10
+ import { fetchDeploymentLogin, readRegisteredEnvironmentUrls } from './env-registry.js';
10
11
  import { resolvePreviewFromSlug } from './preview.js';
11
12
  /**
12
13
  * `--env preview:<branch-or-slug>` targets a per-PR Vercel preview deployment
@@ -194,9 +195,7 @@ export function resolveEnv({ config, requested, }) {
194
195
  const env = config.envs[name];
195
196
  if (!env) {
196
197
  const known = Object.keys(config.envs).join(', ');
197
- // Reserved names use the shared Sequence login, so `envs add` rejects
198
- // them; point those at config.toml instead.
199
- const addHint = isSequenceAuthEnvName(name)
198
+ const addHint = isSequenceAuthEnvName(name) && !isSharedLoginDeploymentName(name)
200
199
  ? `add an [env.${name}] entry to ${configPath()}`
201
200
  : `register the deployment with: seq-studio envs add ${name} <url>`;
202
201
  throw new Error(`Unknown env "${name}". Known envs: ${known}. ` +
@@ -204,6 +203,40 @@ export function resolveEnv({ config, requested, }) {
204
203
  }
205
204
  return { name, url: env.url };
206
205
  }
206
+ /**
207
+ * Save a first-party deployment under its reserved name (`staging`,
208
+ * `production`, `banksouth`) in config.toml. Those names sign in through the
209
+ * shared Sequence login, so the deployment must advertise exactly that login
210
+ * at its public `/api/auth/cli-config`; anything else is refused. The entry is
211
+ * appended, leaving the rest of the file as written.
212
+ */
213
+ export async function addSharedLoginEnvironment({ name, baseUrl: rawBaseUrl, fetchImpl = fetch, }) {
214
+ if (!isSharedLoginDeploymentName(name)) {
215
+ throw new Error(`'${name}' is not a reserved first-party deployment name.`);
216
+ }
217
+ const baseUrl = validateDeploymentBaseUrl(rawBaseUrl).replace(/\/$/, '');
218
+ if (!baseUrl.startsWith('https://')) {
219
+ throw new Error(`'${name}' must be an HTTPS deployment under *.seqholdings.com, not ${baseUrl}.`);
220
+ }
221
+ const login = await fetchDeploymentLogin({ baseUrl, fetchImpl });
222
+ if (!usesSharedSequenceLogin(login)) {
223
+ throw new Error(`'${name}' is reserved for a deployment on the shared Sequence login, and ${baseUrl} uses its own ` +
224
+ `login. Register it under another name: seq-studio envs add <name> ${baseUrl}`);
225
+ }
226
+ const path = configPath();
227
+ const existing = existsSync(path) ? await readFile(path, 'utf8') : '';
228
+ const current = parseToml(existing).env?.[name]?.url;
229
+ if (current === baseUrl)
230
+ return { name, baseUrl, changed: false };
231
+ if (current !== undefined) {
232
+ throw new Error(`[env.${name}] in ${path} already points at ${current}; edit it there to change it.`);
233
+ }
234
+ await mkdir(dirname(path), { recursive: true });
235
+ const separator = existing === '' || existing.endsWith('\n\n') ? '' : existing.endsWith('\n') ? '\n' : '\n\n';
236
+ const table = `[env.${name}]\nurl = ${stringifyToml({ url: baseUrl }).trim().replace(/^url = /, '')}\n`;
237
+ await writeFile(path, existing + separator + table, { encoding: 'utf8', mode: 0o600 });
238
+ return { name, baseUrl, changed: true };
239
+ }
207
240
  /** Resolve `--env <name>` against the config on disk. */
208
241
  export async function resolveConfiguredEnv({ requested, }) {
209
242
  return resolveEnv({ config: await readConfig(), requested });
@@ -12,6 +12,14 @@ interface RegistrationResult {
12
12
  realm: DiscoveredRealm;
13
13
  }
14
14
  export declare function seqapiConfigPath(): string;
15
+ /**
16
+ * Read a deployment's public CLI login config (`/api/auth/cli-config`) without
17
+ * judging its audience; callers decide which login they will trust.
18
+ */
19
+ export declare function fetchDeploymentLogin({ baseUrl, fetchImpl, }: {
20
+ baseUrl: string;
21
+ fetchImpl?: typeof fetch;
22
+ }): Promise<DiscoveredRealm>;
15
23
  export declare function readRegisteredEnvironmentUrls({ configFile, }?: {
16
24
  configFile?: string;
17
25
  }): Promise<Record<string, {
@@ -30,6 +30,14 @@ function validateEnvironmentName(input) {
30
30
  return name;
31
31
  }
32
32
  async function discoverRealm({ baseUrl, fetchImpl, }) {
33
+ const login = await fetchDeploymentLogin({ baseUrl, fetchImpl });
34
+ return { ...login, audience: validateDeploymentAudience({ audience: login.audience, baseUrl }) };
35
+ }
36
+ /**
37
+ * Read a deployment's public CLI login config (`/api/auth/cli-config`) without
38
+ * judging its audience; callers decide which login they will trust.
39
+ */
40
+ export async function fetchDeploymentLogin({ baseUrl, fetchImpl = fetch, }) {
33
41
  const url = `${baseUrl}${DISCOVERY_PATH}`;
34
42
  let response;
35
43
  try {
@@ -78,7 +86,7 @@ async function discoverRealm({ baseUrl, fetchImpl, }) {
78
86
  return {
79
87
  domain: validateAuth0Domain(domain),
80
88
  clientId,
81
- audience: validateDeploymentAudience({ audience, baseUrl }),
89
+ audience,
82
90
  organization: optionalString(Reflect.get(auth0, 'organization')),
83
91
  m2mClientId: optionalString(Reflect.get(auth0, 'm2mClientId')),
84
92
  };
@@ -1,4 +1,5 @@
1
- import { readConfig, configPath, manualEnvConfigHint } from '../config.js';
1
+ import { addSharedLoginEnvironment, readConfig, configPath, manualEnvConfigHint } from '../config.js';
2
+ import { isSharedLoginDeploymentName } from '../auth.js';
2
3
  import { readRegisteredEnvironmentUrls, registerEnvironment, } from '../env-registry.js';
3
4
  const ENVS_USAGE = `usage:
4
5
  seq-studio envs list show the configured environments
@@ -9,6 +10,11 @@ const ENVS_USAGE = `usage:
9
10
  deployment with "envs add"; it reads the deployment's public sign-in
10
11
  settings, then "seq-studio login --env <name>" signs you in to it.
11
12
 
13
+ The reserved names staging, production and banksouth are for deployments
14
+ on the shared Sequence login. "envs add" saves one of them to config.toml
15
+ only after the deployment's sign-in settings confirm that login; then
16
+ "seq-studio login" signs you in.
17
+
12
18
  Local worktrees are discovered from their .wt.env files. Entries in
13
19
  ${configPath()} are also honored.
14
20
  `;
@@ -37,6 +43,13 @@ async function addCommand(rest) {
37
43
  return 1;
38
44
  }
39
45
  try {
46
+ if (isSharedLoginDeploymentName(name.toLowerCase())) {
47
+ const added = await addSharedLoginEnvironment({ name: name.toLowerCase(), baseUrl });
48
+ console.log(`${added.changed ? 'Added' : 'Already configured:'} environment '${added.name}' -> ${added.baseUrl} ` +
49
+ `(shared Sequence login, saved in ${configPath()})`);
50
+ console.log('Next: seq-studio login');
51
+ return 0;
52
+ }
40
53
  const registration = await registerEnvironment({ name, baseUrl });
41
54
  const verb = registration.replacing ? 'Updated' : 'Registered';
42
55
  console.log(`${verb} environment '${registration.name}' -> ${registration.baseUrl}`);
@@ -136,6 +136,9 @@ export declare const managedFunctionManifestSchema: z.ZodObject<{
136
136
  processes: z.ZodOptional<z.ZodObject<{
137
137
  read: z.ZodArray<z.ZodString>;
138
138
  }, z.core.$strict>>;
139
+ directory: z.ZodOptional<z.ZodObject<{
140
+ groups: z.ZodArray<z.ZodString>;
141
+ }, z.core.$strict>>;
139
142
  roles: z.ZodOptional<z.ZodObject<{
140
143
  definitions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
141
144
  description: z.ZodOptional<z.ZodString>;
@@ -156,7 +159,7 @@ export declare const managedFunctionManifestSchema: z.ZodObject<{
156
159
  }, z.core.$strip>>;
157
160
  }, z.core.$strip>>>;
158
161
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
159
- tables: z.ZodDefault<z.ZodArray<z.ZodString>>;
162
+ tables: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"platformUsers">, z.ZodString]>>>;
160
163
  actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
161
164
  operations: z.ZodDefault<z.ZodArray<z.ZodString>>;
162
165
  query: z.ZodDefault<z.ZodBoolean>;
@@ -1,6 +1,6 @@
1
1
  import { storageScopesSchema, readStorageScopes } from '@sequenceholdings/storage';
2
2
  import { postgresEgressError } from './egress-postgres.js';
3
- import { cacheManifestSchema, managedFunctionWorkloadLimitsSchema } from '@sequenceholdings/managed-functions/config';
3
+ import { cacheManifestSchema, directoryScopesSchema, managedFunctionWorkloadLimitsSchema } from '@sequenceholdings/managed-functions/config';
4
4
  import { functionProcessReadScopesSchema } from '@sequenceholdings/managed-functions/config';
5
5
  import { isIP } from 'node:net';
6
6
  import { z } from 'zod';
@@ -692,6 +692,7 @@ export const managedFunctionManifestSchema = z.object({
692
692
  capabilities: z.object({
693
693
  storage: storageScopesSchema.optional(),
694
694
  processes: functionProcessReadScopesSchema.optional(),
695
+ directory: directoryScopesSchema.optional(),
695
696
  roles: customRolesBlockSchema.optional(),
696
697
  uses: capabilityPinsSchema,
697
698
  gates: capabilityGatesSchema,
@@ -710,7 +711,12 @@ export const managedFunctionManifestSchema = z.object({
710
711
  */
711
712
  data: z
712
713
  .record(z.string().regex(/^[a-z][a-z0-9_]{0,40}$/, 'capabilities.data keys are ORM namespace names'), z.object({
713
- tables: z.array(z.string().regex(/^[a-z_][a-z0-9_]*$/, 'table names')).max(64).default([]),
714
+ // ORM emits this exact logical key for toPlatformUser joins; it is
715
+ // not a physical SQL table name or a general camelCase exception.
716
+ tables: z.array(z.union([
717
+ z.literal('platformUsers'),
718
+ z.string().regex(/^[a-z_][a-z0-9_]*$/, 'table names'),
719
+ ])).max(64).default([]),
714
720
  actions: z.array(z.string().regex(/^[a-z_][a-z0-9_]*$/, 'action names')).max(64).default([]),
715
721
  /**
716
722
  * ORM v2 persisted operations (GraphQL mutations/actions by name)
package/dist/main.d.ts CHANGED
@@ -11,11 +11,12 @@
11
11
  * seq-studio agents <sub> manage typed agent definitions
12
12
  * seq-studio secrets <sub> manage org-owned Managed Secrets
13
13
  * seq-studio repos <sub> manage platform git-service repos
14
+ * seq-studio templates <sub> publish and synchronize Git-backed templates
14
15
  * seq-studio pipeline <sub> discover, query, author and operate Data Pipelines
15
- * seq-studio auth <sub> manage git-service PATs
16
+ * seq-studio auth <sub> manage Git authentication
16
17
  * seq-studio service-accounts <sub> provision runtime identities
17
18
  * seq-studio access <sub> manage runtime resource access
18
- * seq-studio envs <sub> add/list/refresh environments
19
+ * seq-studio envs <sub> add/list environments
19
20
  * seq-studio login authenticate interactively with Auth0
20
21
  * seq-studio logout remove cached user tokens
21
22
  * seq-studio doctor check token + env + writer gate
package/dist/main.js CHANGED
@@ -11,11 +11,12 @@
11
11
  * seq-studio agents <sub> manage typed agent definitions
12
12
  * seq-studio secrets <sub> manage org-owned Managed Secrets
13
13
  * seq-studio repos <sub> manage platform git-service repos
14
+ * seq-studio templates <sub> publish and synchronize Git-backed templates
14
15
  * seq-studio pipeline <sub> discover, query, author and operate Data Pipelines
15
- * seq-studio auth <sub> manage git-service PATs
16
+ * seq-studio auth <sub> manage Git authentication
16
17
  * seq-studio service-accounts <sub> provision runtime identities
17
18
  * seq-studio access <sub> manage runtime resource access
18
- * seq-studio envs <sub> add/list/refresh environments
19
+ * seq-studio envs <sub> add/list environments
19
20
  * seq-studio login authenticate interactively with Auth0
20
21
  * seq-studio logout remove cached user tokens
21
22
  * seq-studio doctor check token + env + writer gate
@@ -27,7 +28,7 @@ import { staticHelp } from './command-help.js';
27
28
  // Lazy-load artifact delegate: published @sequenceholdings/artifact-studio/cli
28
29
  // still auto-runs runCli() at module load; importing it here breaks doctor/process.
29
30
  const TOP_LEVEL_USAGE = `usage:
30
- seq-studio init <dir> --with <kinds> [internal] scaffold an app monorepo (sequence.app.yml)
31
+ seq-studio init <dir> [options] scaffold an app or use a published template
31
32
  seq-studio add <kind> <name> [internal] add a primitive to the current app monorepo
32
33
  seq-studio deploy -e <env> [internal] deploy primitives from sequence.app.yml
33
34
  seq-studio process <sub> [args] lint | plan | apply | test | simulate | bundle | init
@@ -37,12 +38,13 @@ const TOP_LEVEL_USAGE = `usage:
37
38
  seq-studio agents <sub> [args] init | validate | plan | apply | list | show | voice (internal)
38
39
  seq-studio secrets <sub> [args] create | set | list | attach | detach | apply
39
40
  seq-studio repos <sub> [args] list | namespaces | show | create | clone | pull | pulls | delete | ci
41
+ seq-studio templates <sub> [args] publish | sync | list
40
42
  seq-studio pipeline <sub> [args] list | assets | search | describe | schema | sample | query | init | validate | repin-orm | codegen | plan | adopt | unbind | deploy | status | migrate | promote | rollback | run-now
41
- seq-studio auth <sub> [args] whoami | pat create | pat list | pat revoke
43
+ seq-studio auth <sub> [args] whoami | git-credential
42
44
  seq-studio orm <sub> [args] init | generate | validate | plan | apply | execute | diff | migrate-from-yaml | import
43
45
  seq-studio service-accounts <sub> list | show | create (requires provisioning authority)
44
46
  seq-studio access <sub> definitions | list | grant | revoke | resolve
45
- seq-studio envs <sub> add | list | refresh environments
47
+ seq-studio envs <sub> add | list environments
46
48
  seq-studio login [--env <name>] authenticate in the browser
47
49
  seq-studio logout [--env <name>] remove one realm's cached user tokens
48
50
  seq-studio doctor [-e <env>] [--json] [--offline] diagnose config, auth, toolchain, and writer gate
@@ -60,7 +62,7 @@ const PROCESS_USAGE = `usage:
60
62
  seq-studio process lint [--dir <path>] [--offline]
61
63
  seq-studio process plan [--dir <path>] [-e <env>]
62
64
  seq-studio process apply [--dir <path>] [-e <env>] [--only <id1,id2,...>] [--platform-managed]
63
- seq-studio process apply --repo processes/<name> [--ref <r>] -e <env> [--only <id1,id2,...>] [--platform-managed]
65
+ seq-studio process apply --repo <namespace>/<name> [--ref <r>] -e <env> [--only <id1,id2,...>] [--platform-managed]
64
66
  seq-studio process promote <processId> --version <v> [-e <env>]
65
67
  seq-studio process pull <processId> [--version <v>] [-e <env>] [--out <dir>] [--no-children]
66
68
  seq-studio process test [-e <env>] [--offline]
@@ -136,6 +138,10 @@ export async function run(argv = process.argv.slice(2)) {
136
138
  const { runReposCommand } = await import('./repos/commands.js');
137
139
  return runReposCommand(sub, parseArgs(rest));
138
140
  }
141
+ case 'templates': {
142
+ const { runTemplatesCommand } = await import('./templates/commands.js');
143
+ return runTemplatesCommand(sub, parseArgs(rest));
144
+ }
139
145
  case 'service-accounts': {
140
146
  const { runServiceAccountsCommand } = await import('./service-accounts/commands.js');
141
147
  return runServiceAccountsCommand(sub, parseArgs(rest));
@@ -172,11 +172,14 @@ async function loadOrmCli() {
172
172
  throw err;
173
173
  const message = err instanceof Error ? err.message : String(err);
174
174
  if (isOrmPackageMissing(message)) {
175
- console.error('seq-studio orm needs the @sequenceholdings/orm package. Install it alongside the CLI:\n' +
176
- ' npm install @sequenceholdings/orm');
175
+ console.error('seq-studio orm needs the @sequenceholdings/orm package. Add it to your app, then run the app\'s CLI:\n' +
176
+ ' pnpm add -D @sequenceholdings/orm\n' +
177
+ ' pnpm exec seq-studio orm …');
177
178
  }
178
179
  else {
179
180
  console.error('@sequenceholdings/orm is installed but a dependency failed to load. Reinstall dependencies, then retry.\n' +
181
+ 'A CLI installed globally with pnpm 11 cannot load drizzle-kit, which imports drizzle-orm without declaring it; ' +
182
+ 'run the app\'s own CLI instead (`pnpm exec seq-studio orm …`).\n' +
180
183
  ` ${message}`);
181
184
  }
182
185
  return null;
@@ -4,7 +4,7 @@ export interface CloneDeployTarget {
4
4
  }
5
5
  export declare function assertCloneDeployAllowed(target: CloneDeployTarget): void;
6
6
  export declare function parseCloneDeployRepo(repo: string): {
7
- namespace: 'pipelines' | 'apps';
7
+ namespace: string;
8
8
  name: string;
9
9
  };
10
10
  export declare function readCloneHead(dir: string): Promise<{
@@ -28,10 +28,9 @@ export interface PublishedClone {
28
28
  * Ensure `<repo>` exists on the target environment and contains this
29
29
  * checkout's HEAD. Returns the SHA the caller should pass as `--ref`.
30
30
  */
31
- export declare function publishCloneForDeploy({ dir, repo, baseUrl, token, pat, }: {
31
+ export declare function publishCloneForDeploy({ dir, repo, baseUrl, token, }: {
32
32
  dir: string;
33
33
  repo: string;
34
34
  baseUrl: string;
35
35
  token: string;
36
- pat?: string;
37
36
  }): Promise<PublishedClone>;
@@ -12,7 +12,7 @@ import { spawn } from 'node:child_process';
12
12
  import { execFile } from 'node:child_process';
13
13
  import { promisify } from 'node:util';
14
14
  import { postJson } from '../atlas-client.js';
15
- import { gitServiceCloneUrl, resolveGitPatFromEnv, withGitAskpass, } from '@sequenceholdings/artifact-studio/git-clone';
15
+ import { gitServiceCloneUrl, withGitAskpass, } from '@sequenceholdings/artifact-studio/git-clone';
16
16
  import { resolveRepo } from '@sequenceholdings/artifact-studio/git-service-client';
17
17
  const execFileAsync = promisify(execFile);
18
18
  export function assertCloneDeployAllowed(target) {
@@ -21,11 +21,12 @@ export function assertCloneDeployAllowed(target) {
21
21
  throw new Error(`pipeline deploy from a local clone is only supported on targets that do not require approval (got '${target.id}'). ` +
22
22
  'Push the commit to that environment\'s git service, then deploy with --repo and --ref.');
23
23
  }
24
- const RELEASE_REPO = /^(pipelines|apps)\/([a-z][a-z0-9-]*)$/;
24
+ /** `<namespace>/<repo>`; the server decides which namespaces may hold pipelines. */
25
+ const RELEASE_REPO = /^([a-z][a-z0-9-]*)\/([a-z][a-z0-9-]*)$/;
25
26
  export function parseCloneDeployRepo(repo) {
26
27
  const match = RELEASE_REPO.exec(repo);
27
28
  if (!match) {
28
- throw new Error(`--repo must be pipelines/<name> or apps/<name> (got '${repo}')`);
29
+ throw new Error(`--repo must be <namespace>/<name>, such as pipelines/<name> or your app's namespace (got '${repo}')`);
29
30
  }
30
31
  return { namespace: match[1], name: match[2] };
31
32
  }
@@ -88,21 +89,19 @@ function spawnGit({ args, cwd, env, }) {
88
89
  * Ensure `<repo>` exists on the target environment and contains this
89
90
  * checkout's HEAD. Returns the SHA the caller should pass as `--ref`.
90
91
  */
91
- export async function publishCloneForDeploy({ dir, repo, baseUrl, token, pat = resolveGitPatFromEnv(), }) {
92
- if (!pat) {
93
- throw new Error('Deploying a local clone requires a git PAT. Set ATLAS_GIT_PAT to a token with repo:write ' +
94
- '(create one in Atlas → Settings → Tokens, or `seq-studio auth pat create`).');
95
- }
92
+ export async function publishCloneForDeploy({ dir, repo, baseUrl, token, }) {
93
+ if (!token)
94
+ throw new Error('Publishing requires a user login. Run seq-studio login for this environment, then retry.');
96
95
  const { namespace, name } = parseCloneDeployRepo(repo);
97
96
  const head = await readCloneHead(dir);
98
97
  const destination = await ensureReleaseRepo({ baseUrl, token, namespace, name });
99
98
  const cloneUrl = gitServiceCloneUrl(baseUrl, destination.id);
100
- await pushCloneHead({ dir, cloneUrl, sha: head.sha, branch: head.branch, pat });
99
+ await pushCloneHead({ dir, cloneUrl, sha: head.sha, branch: head.branch, pat: token });
101
100
  // A new walgit repo's default branch is main, but the ref does not exist until
102
101
  // something is pushed to it. Publishing only the checkout branch leaves
103
102
  // `repos clone` (no --ref) unable to resolve main.
104
103
  if (destination.created && head.branch !== 'main') {
105
- await pushCloneHead({ dir, cloneUrl, sha: head.sha, branch: 'main', pat });
104
+ await pushCloneHead({ dir, cloneUrl, sha: head.sha, branch: 'main', pat: token });
106
105
  }
107
106
  return { ...head, repoId: destination.id, created: destination.created };
108
107
  }