@sequenceholdings/studio-cli 0.4.7 → 0.5.1

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.
@@ -1,228 +1,12 @@
1
- /**
2
- * `seq-studio auth <sub>` — PAT management for the platform git service.
3
- *
4
- * Issues / lists / revokes Personal Access Tokens via Auth0 bearer auth.
5
- * Users authenticate with `seq-studio login`; the Atlas UI at
6
- * `/settings/tokens` remains an alternative.
7
- *
8
- * The raw token is printed exactly once on create; use it as the Basic-auth
9
- * password for `git clone` / `git push` (username is ignored).
10
- */
11
1
  import { validateCommandInput, wantsHelp } from '../command-input.js';
12
- import { deleteNoContent, getJson, postJson } from '../atlas-client.js';
2
+ import { getJson } from '../atlas-client.js';
13
3
  import { printCliError } from '../cli-errors.js';
14
- import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
15
- import { buildContext, clientOptions, flagBool, LOG, } from '../functions/commands.js';
16
- import { readConfig } from '../config.js';
17
- import { confirmYes } from '../prompt.js';
18
- import { storeGitCredentials } from '../repos/git-clone.js';
19
- import { formatPatSetupHint, settingsTokensUrl } from '../pat-hints.js';
20
- /**
21
- * Tokens-page URLs rendered from the configured environments (config.toml +
22
- * registered deployments). With none configured, print a generic pointer
23
- * instead of a hardcoded list of internal hosts.
24
- */
25
- async function settingsTokensLines() {
26
- const config = await readConfig().catch(() => null);
27
- const remote = Object.entries(config?.envs ?? {}).filter(([name]) => name !== 'local');
28
- if (remote.length === 0) {
29
- return ['Tokens page: <your Atlas deployment URL>/settings/tokens'];
30
- }
31
- return remote.map(([name, { url }]) => `${name}: ${settingsTokensUrl(url)}`);
32
- }
33
- const PAT_SCOPES = ['repo:read', 'repo:write', 'repo:admin'];
34
- function stringFlag(flags, key) {
35
- const value = flags[key];
36
- if (value === undefined)
37
- return undefined;
38
- if (typeof value !== 'string')
39
- throw new Error(`--${key} requires a value.`);
40
- return value;
41
- }
4
+ import { buildContext, clientOptions } from '../functions/commands.js';
42
5
  export const AUTH_USAGE = `usage:
43
- seq-studio auth whoami -e <env> [--json] server-verified identity and target (no tokens)
44
- seq-studio auth pat create --name <n> -e <env> [--scopes repo:read,repo:write]
45
- [--expires 1d|7d|30d|90d|1y|never] [--store-credentials]
46
- seq-studio auth pat list -e <env>
47
- seq-studio auth pat revoke <id> -e <env> [--yes]
48
-
49
- Issue a personal access token for git clone / git push against the platform
50
- git service.
51
-
52
- Authenticate with \`seq-studio login\`, then run \`auth pat create -e <env>\`.
53
- Alternatively, open Atlas → Settings → Tokens:
54
- https://<atlas-host>/settings/tokens
55
- Sign in, create a token (repo:read / repo:write), copy once, then:
56
- export ATLAS_GIT_PAT=<token>
57
- repo:write covers push and PR open; merging a PR requires an FGA Merge
58
- (or Admin) grant on the repository, not a PAT scope.
59
-
60
- On create the raw token is printed ONCE — store it; Atlas cannot re-show it.
61
- Git Basic auth: any username (e.g. git), PAT as the password.
62
-
63
- Flags: -e/--env <env> (required; see: seq-studio envs list)
6
+ seq-studio auth whoami -e <env> [--json]
7
+ seq-studio auth git-credential --env <env> --url <clone-url> <get|store|erase>
8
+ Git authentication uses seq-studio login. repos clone installs the helper.
64
9
  `;
65
- async function authContext(args) {
66
- if (args.flags.env === true || args.flags.e === true) {
67
- throw new Error('-e/--env requires a value — see: seq-studio envs list.');
68
- }
69
- try {
70
- return await buildContext(args);
71
- }
72
- catch (err) {
73
- const message = err instanceof Error ? err.message : String(err);
74
- // Missing `-e` is actionable on its own — don't bury it under login/PAT
75
- // setup advice (that wrap is for real auth/token failures).
76
- if (message === REQUIRE_EXPLICIT_ENV_MESSAGE)
77
- throw err;
78
- // buildContext failed before we know the env URL; offer CLI login and
79
- // render the tokens-page URLs from the environments visible to this
80
- // identity (third-party / OpCo developers only see their own hosts).
81
- const tokenUrls = await settingsTokensLines();
82
- throw new Error(`${message}\n` +
83
- ` Run \`seq-studio login\`, then retry \`auth pat create\`.\n` +
84
- ` Or mint a PAT in the Atlas UI (Settings → Tokens), then:\n` +
85
- ` export ATLAS_GIT_PAT=<token>\n` +
86
- tokenUrls.map((line) => ` ${line}`).join('\n'));
87
- }
88
- }
89
- export function parsePatScopes(raw) {
90
- if (raw === undefined || raw.trim() === '')
91
- return ['repo:read'];
92
- const parts = raw.split(',').map((s) => s.trim()).filter(Boolean);
93
- if (parts.length === 0) {
94
- throw new Error('--scopes requires at least one of: repo:read, repo:write, repo:admin');
95
- }
96
- const out = [];
97
- for (const part of parts) {
98
- if (!PAT_SCOPES.includes(part)) {
99
- throw new Error(`unknown scope "${part}" — expected repo:read, repo:write, or repo:admin`);
100
- }
101
- // Deduplicate while preserving order.
102
- if (!out.includes(part))
103
- out.push(part);
104
- }
105
- return out;
106
- }
107
- /**
108
- * Map UI-style duration choices to an absolute ISO-8601 expiresAt, or undefined
109
- * for never. Matches Settings Tokens dialog choices.
110
- */
111
- export function resolveExpiresAt(choice) {
112
- if (choice === undefined || choice === 'never')
113
- return undefined;
114
- const now = Date.now();
115
- const day = 24 * 60 * 60 * 1000;
116
- const map = {
117
- '1d': 1 * day,
118
- '7d': 7 * day,
119
- '30d': 30 * day,
120
- '90d': 90 * day,
121
- '1y': 365 * day,
122
- };
123
- const delta = map[choice];
124
- if (delta === undefined) {
125
- throw new Error(`--expires must be one of: 1d, 7d, 30d, 90d, 1y, never (got "${choice}")`);
126
- }
127
- return new Date(now + delta).toISOString();
128
- }
129
- export async function authPatCreateCommand(args) {
130
- const name = stringFlag(args.flags, 'name');
131
- if (!name) {
132
- console.error('usage: seq-studio auth pat create --name <n> -e <env> [--scopes ...]');
133
- return 1;
134
- }
135
- if (name.length < 3) {
136
- throw new Error('--name must be at least 3 characters (e.g. laptop-cli)');
137
- }
138
- const scopes = parsePatScopes(stringFlag(args.flags, 'scopes'));
139
- const expiresAt = resolveExpiresAt(stringFlag(args.flags, 'expires') ?? '30d');
140
- const ctx = await authContext(args);
141
- const issued = await postJson({
142
- ...clientOptions(ctx),
143
- path: '/api/git-service/pats',
144
- body: {
145
- name,
146
- scopes,
147
- ...(expiresAt ? { expiresAt } : {}),
148
- },
149
- });
150
- console.log(`${LOG} issued PAT on ${ctx.env.name}:`);
151
- console.log(` id: ${issued.id}`);
152
- console.log(` name: ${issued.name}`);
153
- console.log(` prefix: ${issued.tokenPrefix}`);
154
- console.log(` scopes: ${issued.scopes.join(', ')}`);
155
- console.log(` expires:${issued.expiresAt ? ` ${issued.expiresAt}` : ' never'}`);
156
- console.log('');
157
- console.log(' ── copy this token now; it will not be shown again ──');
158
- console.log(` ${issued.token}`);
159
- console.log(' ────────────────────────────────────────────────────');
160
- console.log('');
161
- console.log(' Git Basic auth: any username (e.g. git), this token as the password.');
162
- console.log(` UI: ${settingsTokensUrl(ctx.env.url)}`);
163
- console.log(` Clone with: ATLAS_GIT_PAT=<token> seq-studio repos clone <ns>/<name> -e ${ctx.env.name}`);
164
- if (flagBool(args.flags, 'store-credentials')) {
165
- // Store against the env origin so any repo under /api/git-service/repos/*
166
- // can reuse the helper entry. Path is the git-service API prefix.
167
- const credentialUrl = `${ctx.env.url.replace(/\/$/, '')}/api/git-service/repos/`;
168
- try {
169
- await storeGitCredentials({ cloneUrl: credentialUrl, pat: issued.token });
170
- console.log(`${LOG} stored credentials via git credential approve for ${ctx.env.url}`);
171
- }
172
- catch (err) {
173
- console.error(`${LOG} --store-credentials failed: ${err instanceof Error ? err.message : String(err)}`);
174
- console.error(`${LOG} token was still issued — copy it from above and store manually.`);
175
- // Exit 0: the PAT exists; a non-zero exit would encourage retries that mint duplicates.
176
- return 0;
177
- }
178
- }
179
- return 0;
180
- }
181
- export async function authPatListCommand(args) {
182
- const ctx = await authContext(args);
183
- const data = await getJson({
184
- ...clientOptions(ctx),
185
- path: '/api/git-service/pats',
186
- });
187
- if (data.items.length === 0) {
188
- console.log(`${LOG} no PATs on ${ctx.env.name}.`);
189
- for (const line of formatPatSetupHint({ envUrl: ctx.env.url, envName: ctx.env.name })) {
190
- console.log(line);
191
- }
192
- return 0;
193
- }
194
- console.log(`${LOG} ${data.items.length} PAT${data.items.length === 1 ? '' : 's'} on ${ctx.env.name}:`);
195
- const width = Math.max(...data.items.map((p) => p.name.length));
196
- for (const pat of data.items) {
197
- const expires = pat.expiresAt ? pat.expiresAt.slice(0, 10) : 'never';
198
- const lastUsed = pat.lastUsedAt ? pat.lastUsedAt.slice(0, 10) : 'never';
199
- console.log(` ${pat.name.padEnd(width)} ${pat.tokenPrefix}… ${pat.scopes.join(',')} expires=${expires} lastUsed=${lastUsed} id=${pat.id}`);
200
- }
201
- return 0;
202
- }
203
- export async function authPatRevokeCommand(args) {
204
- const id = args.positional[0];
205
- if (!id) {
206
- console.error('usage: seq-studio auth pat revoke <id> -e <env> [--yes]');
207
- return 1;
208
- }
209
- const ctx = await authContext(args);
210
- const ok = await confirmYes({
211
- preview: [
212
- `${LOG} about to REVOKE PAT ${id} on ${ctx.env.name}.`,
213
- `${LOG} any git clone/push using it will start failing immediately.`,
214
- ],
215
- confirmed: flagBool(args.flags, 'yes'),
216
- });
217
- if (!ok)
218
- return 1;
219
- await deleteNoContent({
220
- ...clientOptions(ctx),
221
- path: `/api/git-service/pats/${encodeURIComponent(id)}`,
222
- });
223
- console.log(`${LOG} revoked PAT ${id} on ${ctx.env.name}`);
224
- return 0;
225
- }
226
10
  export async function runAuthCommand(sub, args) {
227
11
  try {
228
12
  if (wantsHelp({ sub, args })) {
@@ -230,6 +14,10 @@ export async function runAuthCommand(sub, args) {
230
14
  return 0;
231
15
  }
232
16
  switch (sub) {
17
+ case 'git-credential': {
18
+ const { gitCredentialCommand } = await import('../repos/git-credential.js');
19
+ return await gitCredentialCommand(args);
20
+ }
233
21
  case 'whoami': {
234
22
  validateCommandInput({ args, flags: {}, positional: 0 });
235
23
  const ctx = await buildContext(args);
@@ -240,31 +28,8 @@ export async function runAuthCommand(sub, args) {
240
28
  }, null, 2));
241
29
  return 0;
242
30
  }
243
- case 'pat': {
244
- const action = args.positional[0];
245
- const nested = {
246
- positional: args.positional.slice(1),
247
- flags: args.flags,
248
- };
249
- switch (action) {
250
- case 'create':
251
- return await authPatCreateCommand(nested);
252
- case 'list':
253
- return await authPatListCommand(nested);
254
- case 'revoke':
255
- return await authPatRevokeCommand(nested);
256
- case 'help':
257
- case '--help':
258
- case '-h':
259
- case undefined:
260
- console.log(AUTH_USAGE);
261
- return action ? 0 : 1;
262
- default:
263
- console.error(`unknown auth pat command: ${action}`);
264
- console.error(AUTH_USAGE);
265
- return 1;
266
- }
267
- }
31
+ case 'pat':
32
+ throw new Error('Personal access tokens are retired. Run seq-studio login --env <environment>, then repos clone to configure Git.');
268
33
  case 'help':
269
34
  case '--help':
270
35
  case '-h':
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/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
@@ -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));
@@ -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) {
@@ -88,21 +88,19 @@ function spawnGit({ args, cwd, env, }) {
88
88
  * Ensure `<repo>` exists on the target environment and contains this
89
89
  * checkout's HEAD. Returns the SHA the caller should pass as `--ref`.
90
90
  */
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
- }
91
+ export async function publishCloneForDeploy({ dir, repo, baseUrl, token, }) {
92
+ if (!token)
93
+ throw new Error('Publishing requires a user login. Run seq-studio login for this environment, then retry.');
96
94
  const { namespace, name } = parseCloneDeployRepo(repo);
97
95
  const head = await readCloneHead(dir);
98
96
  const destination = await ensureReleaseRepo({ baseUrl, token, namespace, name });
99
97
  const cloneUrl = gitServiceCloneUrl(baseUrl, destination.id);
100
- await pushCloneHead({ dir, cloneUrl, sha: head.sha, branch: head.branch, pat });
98
+ await pushCloneHead({ dir, cloneUrl, sha: head.sha, branch: head.branch, pat: token });
101
99
  // A new walgit repo's default branch is main, but the ref does not exist until
102
100
  // something is pushed to it. Publishing only the checkout branch leaves
103
101
  // `repos clone` (no --ref) unable to resolve main.
104
102
  if (destination.created && head.branch !== 'main') {
105
- await pushCloneHead({ dir, cloneUrl, sha: head.sha, branch: 'main', pat });
103
+ await pushCloneHead({ dir, cloneUrl, sha: head.sha, branch: 'main', pat: token });
106
104
  }
107
105
  return { ...head, repoId: destination.id, created: destination.created };
108
106
  }
@@ -70,7 +70,7 @@ ${PIPELINE_DISCOVERY_USAGE}
70
70
  publish a clean local checkout into that environment's git service, then
71
71
  deploy the published commit. Only targets that do not require approval
72
72
  (dev, staging). BankSouth and production still deploy a commit that
73
- already exists in that environment's git service. Requires ATLAS_GIT_PAT.
73
+ already exists in that environment's git service. Uses your seq-studio login (human session required).
74
74
  plan (attaching missing credentials as for plan) then enqueue Trigger deploy (DAB bundle validate hard-gates before
75
75
  bundle deploy). Default is plant-only: jobs/pipelines are created, not
76
76
  run. Pass --run-now to run in-unit producer roots after bundle deploy.
@@ -61,7 +61,9 @@ export interface PipelineTarget {
61
61
  label: string;
62
62
  requiresApproval: boolean;
63
63
  }
64
- export declare function envAndToken(args: ParsedArgs): Promise<{
64
+ export declare function envAndToken(args: ParsedArgs, options?: {
65
+ human?: boolean;
66
+ }): Promise<{
65
67
  env: ResolvedEnv;
66
68
  token: string;
67
69
  }>;