@sequenceholdings/studio-cli 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +390 -54
  2. package/dist/access/commands.d.ts +1 -1
  3. package/dist/access/commands.js +102 -55
  4. package/dist/access/custom-role-hosts.d.ts +3 -0
  5. package/dist/access/custom-role-hosts.js +88 -0
  6. package/dist/access/group-rosters.d.ts +6 -0
  7. package/dist/access/group-rosters.js +33 -0
  8. package/dist/access/host-contract.d.ts +55 -0
  9. package/dist/access/host-contract.js +33 -0
  10. package/dist/access/hosts.d.ts +4 -0
  11. package/dist/access/hosts.js +60 -0
  12. package/dist/access/principal.d.ts +16 -0
  13. package/dist/access/principal.js +36 -0
  14. package/dist/access/roles.d.ts +18 -0
  15. package/dist/access/roles.js +89 -0
  16. package/dist/access/tier-hosts.d.ts +12 -0
  17. package/dist/access/tier-hosts.js +206 -0
  18. package/dist/agents/commands.d.ts +1 -1
  19. package/dist/agents/commands.js +76 -16
  20. package/dist/agents/scaffold.js +8 -3
  21. package/dist/app/commands.d.ts +3 -1
  22. package/dist/app/commands.js +88 -12
  23. package/dist/app/manifest.d.ts +2 -2
  24. package/dist/app/official-source.d.ts +4 -2
  25. package/dist/app/official-source.js +6 -4
  26. package/dist/app/readme.js +2 -2
  27. package/dist/app/validate.d.ts +16 -0
  28. package/dist/app/validate.js +40 -0
  29. package/dist/app/workspace-model.js +4 -0
  30. package/dist/app/workspace-scaffold.js +5 -3
  31. package/dist/app/workspace.d.ts +2 -0
  32. package/dist/app/workspace.js +1 -1
  33. package/dist/artifact/delegate.js +26 -3
  34. package/dist/artifact/sandbox.js +2 -1
  35. package/dist/atlas-client.d.ts +17 -8
  36. package/dist/atlas-client.js +146 -62
  37. package/dist/bin.js +10 -1
  38. package/dist/cli-errors.js +12 -3
  39. package/dist/command-contract.d.ts +14 -2
  40. package/dist/command-contract.js +4 -2
  41. package/dist/command-help.d.ts +9 -7
  42. package/dist/command-help.js +56 -12
  43. package/dist/env-flags.d.ts +7 -0
  44. package/dist/env-flags.js +23 -0
  45. package/dist/functions/commands.d.ts +4 -0
  46. package/dist/functions/commands.js +127 -11
  47. package/dist/functions/manifest.d.ts +5 -0
  48. package/dist/functions/manifest.js +44 -23
  49. package/dist/functions/service-account-guidance.d.ts +21 -0
  50. package/dist/functions/service-account-guidance.js +62 -0
  51. package/dist/functions/workspace.d.ts +11 -0
  52. package/dist/functions/workspace.js +52 -0
  53. package/dist/main.d.ts +2 -1
  54. package/dist/main.js +17 -3
  55. package/dist/orm/delegate.d.ts +1 -0
  56. package/dist/orm/delegate.js +65 -12
  57. package/dist/orm/discover-schema.d.ts +26 -0
  58. package/dist/orm/discover-schema.js +5 -0
  59. package/dist/orm/execute.js +11 -5
  60. package/dist/orm/failures.d.ts +32 -0
  61. package/dist/orm/failures.js +75 -0
  62. package/dist/orm/operation-show.d.ts +2 -0
  63. package/dist/orm/operation-show.js +35 -0
  64. package/dist/orm/read.js +3 -3
  65. package/dist/orm/version-guard.d.ts +3 -0
  66. package/dist/orm/version-guard.js +63 -0
  67. package/dist/pipeline/commands.js +4 -1
  68. package/dist/principals/commands.d.ts +3 -0
  69. package/dist/principals/commands.js +124 -0
  70. package/dist/process/runs.d.ts +4 -3
  71. package/dist/process/runs.js +52 -10
  72. package/dist/release-age.d.ts +1 -1
  73. package/dist/release-age.js +1 -0
  74. package/dist/repos/commands.d.ts +44 -0
  75. package/dist/repos/commands.js +55 -15
  76. package/dist/repos/init-repo.d.ts +45 -0
  77. package/dist/repos/init-repo.js +257 -0
  78. package/dist/sandbox-unpushed-warning.d.ts +23 -0
  79. package/dist/sandbox-unpushed-warning.js +86 -0
  80. package/dist/service-accounts/commands.js +15 -3
  81. package/dist/templates/commands.d.ts +14 -2
  82. package/dist/templates/commands.js +70 -16
  83. package/dist/templates/process/pnpm-workspace.yaml +1 -0
  84. package/dist/transient-503.d.ts +4 -0
  85. package/dist/transient-503.js +25 -0
  86. package/package.json +14 -10
  87. package/templates/process/pnpm-workspace.yaml +1 -0
@@ -1,70 +1,105 @@
1
+ import { authenticatedRequestUrl } from "@sequenceholdings/artifact-studio/deployment-validation";
2
+ import { createPlatformTransport, createOperatorPlatformClient, } from "@sequenceholdings/platform/server";
1
3
  /**
2
4
  * Minimal authenticated HTTP client for Atlas. Same retry-on-503 contract
3
5
  * as `shared/services/artifact-studio/src/api.ts` so behavior is
4
6
  * consistent across both Sequence CLIs. Token + baseUrl are passed in by
5
7
  * the caller — this file knows nothing about token files or config TOMLs.
6
8
  */
7
- import { authenticatedRequestUrl } from '@sequenceholdings/artifact-studio/deployment-validation';
8
- import { validationDetail } from './validation-detail.js';
9
- import { PREVIEW_DOMAIN } from './preview.js';
10
- import { sandboxBearerFor } from './sandbox-auth.js';
9
+ import { validationDetail } from "./validation-detail.js";
10
+ import { PREVIEW_DOMAIN } from "./preview.js";
11
+ import { sandboxBearerFor } from "./sandbox-auth.js";
12
+ import { errorCode, isTransient503 } from "./transient-503.js";
11
13
  const MAX_503_RETRIES = 5;
12
14
  const DEFAULT_RETRY_AFTER_SECONDS = 2;
13
- const LOG_PREFIX = '[seq-studio]';
14
- const CF_ACCESS_DOMAIN = 'seqholdings.com';
15
+ const LOG_PREFIX = "[seq-studio]";
16
+ const CF_ACCESS_DOMAIN = "seqholdings.com";
15
17
  export class AtlasApiError extends Error {
16
18
  status;
17
19
  path;
18
20
  statusText;
19
21
  body;
20
- name = 'AtlasApiError';
22
+ name = "AtlasApiError";
21
23
  retryAfterSeconds = null;
22
- constructor(status, message, path, statusText = '', body = null) {
24
+ constructor(status, message, path, statusText = "", body = null) {
23
25
  super(message);
24
26
  this.status = status;
25
27
  this.path = path;
26
28
  this.statusText = statusText;
27
29
  this.body = body;
28
30
  }
31
+ /** The structured `error.code` (or top-level `code`) Atlas sent, if any. */
32
+ get code() {
33
+ return errorCode(this.body);
34
+ }
29
35
  }
30
- async function fetchWith503Retry(input, init) {
36
+ async function fetchWith503Retry(send) {
31
37
  let attempt = 0;
32
38
  for (;;) {
33
- const response = await fetch(input, init);
39
+ const response = await send();
34
40
  if (response.status !== 503 || attempt >= MAX_503_RETRIES)
35
41
  return response;
36
- const retryAfter = Number(response.headers.get('Retry-After')) || DEFAULT_RETRY_AFTER_SECONDS;
42
+ const body = parseErrorBody(await response.clone().text(), response.headers.get("content-type") ?? "");
43
+ if (!isTransient503(body))
44
+ return response;
45
+ const retryAfter = Number(response.headers.get("Retry-After")) ||
46
+ DEFAULT_RETRY_AFTER_SECONDS;
37
47
  attempt += 1;
38
48
  console.warn(`${LOG_PREFIX} backend warming up (503); retrying in ${retryAfter}s (attempt ${attempt}/${MAX_503_RETRIES})`);
39
49
  await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
40
50
  }
41
51
  }
42
- async function authenticatedFetch({ baseUrl, init = {}, path, token, retry503 = true, }) {
43
- const url = authenticatedRequestUrl({ baseUrl, path });
44
- // Sandbox tokens rotate between requests, so a long command re-reads the file
45
- // for every call instead of reusing the token it resolved at startup.
46
- const bearer = (await sandboxBearerFor(baseUrl)) ?? token;
47
- const send = retry503 ? fetchWith503Retry : fetch;
48
- return send(url, {
49
- ...init,
50
- redirect: 'manual',
51
- headers: {
52
+ async function authenticatedFetch({ baseUrl, init = {}, path, token, retry503 = true, timeoutMs, }) {
53
+ authenticatedRequestUrl({ baseUrl, path });
54
+ const transport = createPlatformTransport({
55
+ baseUrl,
56
+ timeoutMs,
57
+ auth: {
58
+ kind: "operator",
59
+ bearer: async () => (await sandboxBearerFor(baseUrl)) ?? token,
60
+ },
61
+ edgeHeaders: () => ({
52
62
  ...previewAccessHeaders(baseUrl),
53
63
  ...cfAccessHeaders(baseUrl),
54
- ...init.headers,
55
- Authorization: `Bearer ${bearer}`,
56
- },
64
+ }),
57
65
  });
66
+ const send = async () => {
67
+ const method = (init.method ?? "GET").toUpperCase();
68
+ if (!["GET", "POST", "PUT", "PATCH", "DELETE"].includes(method))
69
+ throw new Error("Unsupported CLI HTTP method");
70
+ const result = await transport.requestRaw({
71
+ path,
72
+ method: method,
73
+ headers: init.headers,
74
+ body: typeof init.body === "string" ? JSON.parse(init.body) : undefined,
75
+ signal: init.signal,
76
+ });
77
+ return new Response([204, 205, 304].includes(result.status) ? null : result.text, {
78
+ status: result.status,
79
+ statusText: result.statusText,
80
+ headers: result.headers,
81
+ });
82
+ };
83
+ // Existing pre-execution warmup receipts are replay-safe. All other responses, including uncertain mutations, are single-attempt.
84
+ return retry503 ? fetchWith503Retry(send) : send();
58
85
  }
59
86
  /** Bounded single attempt for commands whose uncertain result must be reconciled by the caller. */
60
87
  export async function requestJsonOnce({ baseUrl, token, path, method, body, }) {
61
- const response = await authenticatedFetch({ baseUrl, token, path, retry503: false,
62
- init: { method, signal: AbortSignal.timeout(30_000),
63
- headers: body === undefined ? {} : { 'Content-Type': 'application/json' },
64
- ...(body === undefined ? {} : { body: JSON.stringify(body) }) } });
88
+ const response = await authenticatedFetch({
89
+ baseUrl,
90
+ token,
91
+ path,
92
+ retry503: false,
93
+ init: {
94
+ method,
95
+ signal: AbortSignal.timeout(30_000),
96
+ headers: body === undefined ? {} : { "Content-Type": "application/json" },
97
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
98
+ },
99
+ });
65
100
  const reader = response.body?.getReader();
66
101
  if (!reader)
67
- throw new Error('Missing response body');
102
+ throw new Error("Missing response body");
68
103
  const chunks = [];
69
104
  let size = 0;
70
105
  try {
@@ -74,7 +109,7 @@ export async function requestJsonOnce({ baseUrl, token, path, method, body, }) {
74
109
  break;
75
110
  size += item.value.byteLength;
76
111
  if (size > 8_388_608)
77
- throw new Error('Response exceeds 8 MiB');
112
+ throw new Error("Response exceeds 8 MiB");
78
113
  chunks.push(item.value);
79
114
  }
80
115
  }
@@ -82,11 +117,14 @@ export async function requestJsonOnce({ baseUrl, token, path, method, body, }) {
82
117
  void reader.cancel().catch(() => { });
83
118
  reader.releaseLock();
84
119
  }
85
- const raw = Buffer.concat(chunks).toString('utf8');
86
- const parsed = parseErrorBody(raw, response.headers.get('content-type') ?? '');
120
+ const raw = Buffer.concat(chunks).toString("utf8");
121
+ const parsed = parseErrorBody(raw, response.headers.get("content-type") ?? "");
87
122
  if (!response.ok) {
88
123
  const error = new AtlasApiError(response.status, messageFromBody(parsed, response.status, response.statusText), path, response.statusText, parsed);
89
- error.retryAfterSeconds = response.status === 429 ? parseRetryAfter(response.headers.get('Retry-After')) : null;
124
+ error.retryAfterSeconds =
125
+ response.status === 429
126
+ ? parseRetryAfter(response.headers.get("Retry-After"))
127
+ : null;
90
128
  throw error;
91
129
  }
92
130
  return parsed;
@@ -102,11 +140,11 @@ function previewAccessHeaders(baseUrl) {
102
140
  return {};
103
141
  try {
104
142
  const parsed = new URL(baseUrl);
105
- if (parsed.protocol !== 'https:')
143
+ if (parsed.protocol !== "https:")
106
144
  return {};
107
145
  if (!parsed.hostname.toLowerCase().endsWith(`.${PREVIEW_DOMAIN}`))
108
146
  return {};
109
- return { 'x-preview-access': secret };
147
+ return { "x-preview-access": secret };
110
148
  }
111
149
  catch {
112
150
  return {};
@@ -128,12 +166,16 @@ function cfAccessHeaders(baseUrl) {
128
166
  return {};
129
167
  try {
130
168
  const parsed = new URL(baseUrl);
131
- if (parsed.protocol !== 'https:')
169
+ if (parsed.protocol !== "https:")
132
170
  return {};
133
171
  const hostname = parsed.hostname.toLowerCase();
134
- if (hostname !== CF_ACCESS_DOMAIN && !hostname.endsWith(`.${CF_ACCESS_DOMAIN}`))
172
+ if (hostname !== CF_ACCESS_DOMAIN &&
173
+ !hostname.endsWith(`.${CF_ACCESS_DOMAIN}`))
135
174
  return {};
136
- return { 'CF-Access-Client-Id': clientId, 'CF-Access-Client-Secret': clientSecret };
175
+ return {
176
+ "CF-Access-Client-Id": clientId,
177
+ "CF-Access-Client-Secret": clientSecret,
178
+ };
137
179
  }
138
180
  catch {
139
181
  return {};
@@ -150,34 +192,39 @@ function violationLines(violations) {
150
192
  return [];
151
193
  const lines = [];
152
194
  for (const v of violations) {
153
- if (v && typeof v === 'object' && typeof v.message === 'string') {
195
+ if (v &&
196
+ typeof v === "object" &&
197
+ typeof v.message === "string") {
154
198
  lines.push(` - ${v.message}`);
155
199
  }
156
200
  }
157
201
  return lines;
158
202
  }
159
203
  function messageFromBody(body, status, statusText) {
160
- if (body && typeof body === 'object') {
204
+ if (body && typeof body === "object") {
161
205
  const record = body;
162
206
  const violations = violationLines(record.violations);
163
- const withViolations = (headline) => violations.length > 0 ? [headline, ...violations].join('\n') : headline;
207
+ const withViolations = (headline) => violations.length > 0 ? [headline, ...violations].join("\n") : headline;
164
208
  const fields = validationDetail(record.errors);
165
209
  if (fields)
166
210
  return withViolations(fields);
167
- if (typeof record.detail === 'string' && record.detail.length > 0) {
211
+ if (typeof record.detail === "string" && record.detail.length > 0) {
168
212
  return withViolations(record.detail);
169
213
  }
170
- if (typeof record.error === 'string' && record.error.length > 0) {
214
+ if (typeof record.error === "string" && record.error.length > 0) {
171
215
  return withViolations(record.error);
172
216
  }
173
- if (record.error && typeof record.error === 'object' && 'message' in record.error && typeof record.error.message === 'string') {
217
+ if (record.error &&
218
+ typeof record.error === "object" &&
219
+ "message" in record.error &&
220
+ typeof record.error.message === "string") {
174
221
  return withViolations(record.error.message);
175
222
  }
176
- if (typeof record.message === 'string' && record.message.length > 0) {
223
+ if (typeof record.message === "string" && record.message.length > 0) {
177
224
  return withViolations(record.message);
178
225
  }
179
226
  }
180
- if (typeof body === 'string' && body.trim().length > 0) {
227
+ if (typeof body === "string" && body.trim().length > 0) {
181
228
  const trimmed = body.trim();
182
229
  return trimmed.length > 500 ? `${trimmed.slice(0, 500)}…` : trimmed;
183
230
  }
@@ -188,7 +235,7 @@ function messageFromBody(body, status, statusText) {
188
235
  function parseErrorBody(rawText, contentType) {
189
236
  if (rawText.length === 0)
190
237
  return null;
191
- const looksLikeJson = contentType.toLowerCase().includes('json') || /^\s*[{[]/.test(rawText);
238
+ const looksLikeJson = contentType.toLowerCase().includes("json") || /^\s*[{[]/.test(rawText);
192
239
  if (!looksLikeJson)
193
240
  return rawText;
194
241
  try {
@@ -199,7 +246,7 @@ function parseErrorBody(rawText, contentType) {
199
246
  }
200
247
  }
201
248
  async function responseError(response, path) {
202
- const contentType = response.headers.get('content-type') ?? '';
249
+ const contentType = response.headers.get("content-type") ?? "";
203
250
  const rawText = await response.text();
204
251
  const body = parseErrorBody(rawText, contentType);
205
252
  const message = messageFromBody(body, response.status, response.statusText);
@@ -225,8 +272,13 @@ export async function postJson({ baseUrl, token, path, body, sourceAuthorization
225
272
  token,
226
273
  path,
227
274
  init: {
228
- method: 'POST',
229
- headers: { 'Content-Type': 'application/json', ...(sourceAuthorization ? { 'x-sequence-source-authorization': sourceAuthorization } : {}) },
275
+ method: "POST",
276
+ headers: {
277
+ "Content-Type": "application/json",
278
+ ...(sourceAuthorization
279
+ ? { "x-sequence-source-authorization": sourceAuthorization }
280
+ : {}),
281
+ },
230
282
  body: body === undefined ? undefined : JSON.stringify(body),
231
283
  },
232
284
  });
@@ -239,21 +291,22 @@ export async function postJson({ baseUrl, token, path, body, sourceAuthorization
239
291
  * necessarily JSON and whose non-2xx status may belong to the downstream
240
292
  * application. The caller decides how to render and interpret the status.
241
293
  */
242
- export async function postJsonResponse({ baseUrl, token, path, body, headers = {}, }) {
294
+ export async function postJsonResponse({ baseUrl, token, path, body, headers = {}, timeoutMs, }) {
243
295
  const response = await authenticatedFetch({
244
296
  baseUrl,
245
297
  token,
246
298
  path,
299
+ timeoutMs,
247
300
  init: {
248
- method: 'POST',
249
- headers: { 'Content-Type': 'application/json', ...headers },
301
+ method: "POST",
302
+ headers: { "Content-Type": "application/json", ...headers },
250
303
  body: body === undefined ? undefined : JSON.stringify(body),
251
304
  },
252
305
  });
253
306
  return {
254
307
  status: response.status,
255
- contentType: response.headers.get('content-type') ?? '',
256
- invocationId: response.headers.get('x-invocation-id'),
308
+ contentType: response.headers.get("content-type") ?? "",
309
+ invocationId: response.headers.get("x-invocation-id"),
257
310
  body: await response.text(),
258
311
  };
259
312
  }
@@ -263,8 +316,8 @@ export async function putJson({ baseUrl, token, path, body, }) {
263
316
  token,
264
317
  path,
265
318
  init: {
266
- method: 'PUT',
267
- headers: { 'Content-Type': 'application/json' },
319
+ method: "PUT",
320
+ headers: { "Content-Type": "application/json" },
268
321
  body: body === undefined ? undefined : JSON.stringify(body),
269
322
  },
270
323
  });
@@ -278,8 +331,8 @@ export async function patchJson({ baseUrl, token, path, body, }) {
278
331
  token,
279
332
  path,
280
333
  init: {
281
- method: 'PATCH',
282
- headers: { 'Content-Type': 'application/json' },
334
+ method: "PATCH",
335
+ headers: { "Content-Type": "application/json" },
283
336
  body: body === undefined ? undefined : JSON.stringify(body),
284
337
  },
285
338
  });
@@ -293,8 +346,8 @@ export async function deleteJson({ baseUrl, token, path, body, }) {
293
346
  token,
294
347
  path,
295
348
  init: {
296
- method: 'DELETE',
297
- headers: { 'Content-Type': 'application/json' },
349
+ method: "DELETE",
350
+ headers: { "Content-Type": "application/json" },
298
351
  body: body === undefined ? undefined : JSON.stringify(body),
299
352
  },
300
353
  });
@@ -302,14 +355,45 @@ export async function deleteJson({ baseUrl, token, path, body, }) {
302
355
  throw await responseError(response, path);
303
356
  return response.json();
304
357
  }
358
+ /**
359
+ * JSON POST/DELETE for mutations that answer either a JSON body or 204 No
360
+ * Content (git-service principals, for example). Resolves `undefined` for 204.
361
+ */
362
+ export async function sendJsonOrNoContent({ baseUrl, token, path, method, body, }) {
363
+ const response = await authenticatedFetch({
364
+ baseUrl,
365
+ token,
366
+ path,
367
+ init: {
368
+ method,
369
+ headers: { 'Content-Type': 'application/json' },
370
+ body: body === undefined ? undefined : JSON.stringify(body),
371
+ },
372
+ });
373
+ if (!response.ok)
374
+ throw await responseError(response, path);
375
+ return response.status === 204 ? undefined : response.json();
376
+ }
305
377
  /** DELETE for endpoints that return 204 with an empty body (deleteJson would choke on it). */
306
378
  export async function deleteNoContent({ baseUrl, token, path, }) {
307
379
  const response = await authenticatedFetch({
308
380
  baseUrl,
309
381
  token,
310
382
  path,
311
- init: { method: 'DELETE' },
383
+ init: { method: "DELETE" },
312
384
  });
313
385
  if (!response.ok)
314
386
  throw await responseError(response, path);
315
387
  }
388
+ /** Shared platform transport owns origin, redirect, deadline and response bounds. CLI supplies only its current session and trusted edge credentials. */
389
+ export function operatorPlatformClient({ baseUrl, token, }) {
390
+ authenticatedRequestUrl({ baseUrl, path: "/api/auth/cli-config" });
391
+ return createOperatorPlatformClient({
392
+ baseUrl,
393
+ bearer: async () => (await sandboxBearerFor(baseUrl)) ?? token,
394
+ edgeHeaders: () => ({
395
+ ...previewAccessHeaders(baseUrl),
396
+ ...cfAccessHeaders(baseUrl),
397
+ }),
398
+ });
399
+ }
package/dist/bin.js CHANGED
@@ -15,6 +15,7 @@ const doctorOffline = argv[0] === 'doctor' && (() => {
15
15
  const value = parseArgs(argv.slice(1)).flags.offline;
16
16
  return value === true || value === 'true';
17
17
  })();
18
+ const isOfflineCommand = argv[0] === 'validate' || doctorOffline;
18
19
  run(argv)
19
20
  .catch((error) => {
20
21
  console.error(error instanceof Error ? error.message : error);
@@ -23,10 +24,18 @@ run(argv)
23
24
  // The update notice runs after the command so it never delays real output,
24
25
  // and it is best-effort (never throws, never changes the exit code).
25
26
  .then(async (code) => {
26
- if (!isHelpOrDiscovery && !doctorOffline && !(argv[0] === 'auth' && argv[1] === 'git-credential')) {
27
+ const isGitCredential = argv[0] === 'auth' && argv[1] === 'git-credential';
28
+ if (!isHelpOrDiscovery && !isOfflineCommand && !isGitCredential) {
27
29
  const { maybeNotifyUpdate } = await import('./update-check.js');
28
30
  await maybeNotifyUpdate();
29
31
  }
32
+ // Sandbox token mode only: a stderr reminder when the cwd's checkout holds
33
+ // work that is not pushed. Never during a git push's own credential call.
34
+ if (!isGitCredential) {
35
+ await import('./sandbox-unpushed-warning.js')
36
+ .then(({ warnUnpushedSandboxWork }) => warnUnpushedSandboxWork())
37
+ .catch(() => undefined);
38
+ }
30
39
  // Forced exit discards queued stdout/stderr when callers pipe large JSON
31
40
  // responses. Let Node drain pending writes before exiting with this status.
32
41
  process.exitCode = code;
@@ -1,3 +1,4 @@
1
+ import { PlatformError } from '@sequenceholdings/platform';
1
2
  import { AtlasApiError } from './atlas-client.js';
2
3
  export const LOG = '[seq-studio]';
3
4
  /** Map common apply failure reasons to clearer copy (original reason is preserved). */
@@ -34,6 +35,12 @@ export function clarifyApplyFailureReason(reason) {
34
35
  }
35
36
  return reason;
36
37
  }
38
+ function nextStepFor503(error) {
39
+ if (error.code === 'storage_configuration') {
40
+ return 'Next step: this Atlas has no storage bucket configured. For a local Atlas, restart it with `make dev-all` from `atlas/` (it provisions dev storage); for a deployed environment, ask its operator to configure storage.';
41
+ }
42
+ return 'Next step: wait a few seconds and retry (backend may still be warming up).';
43
+ }
37
44
  function nextStepForAtlasError(error) {
38
45
  const msg = error.message.toLowerCase();
39
46
  if (error.status === 401) {
@@ -53,9 +60,8 @@ function nextStepForAtlasError(error) {
53
60
  return 'Next step: reduce the request size and retry; pipeline query accepts up to 10,000 SQL characters.';
54
61
  return 'Next step: run `seq-studio functions build` and reduce bundle size or dependencies.';
55
62
  }
56
- if (error.status === 503) {
57
- return 'Next step: wait a few seconds and retry (backend may still be warming up).';
58
- }
63
+ if (error.status === 503)
64
+ return nextStepFor503(error);
59
65
  if (error.status === 524 || msg.includes('timeout') || msg.includes('timed out')) {
60
66
  if (error.path.startsWith('/api/data-pipelines/'))
61
67
  return 'Next step: retry the read; if it persists, confirm the environment and backend availability.';
@@ -64,6 +70,9 @@ function nextStepForAtlasError(error) {
64
70
  return null;
65
71
  }
66
72
  export function formatCliError(error) {
73
+ // Shared domain clients retain the CLI's existing status/path guidance.
74
+ if (error instanceof PlatformError)
75
+ return formatCliError(new AtlasApiError(error.status, error.message, error.path ?? '', '', { code: error.code }));
67
76
  if (error instanceof AtlasApiError) {
68
77
  const lines = [`${LOG} ${error.status}${error.statusText ? ` ${error.statusText}` : ''}: ${error.message}`];
69
78
  if (error.path)
@@ -1,7 +1,7 @@
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 or use a published template";
4
+ readonly description: "Scaffold an app workspace or use a published template; --repo scaffolds into a git-service repo";
5
5
  readonly lifecycle: "preview";
6
6
  readonly access: "mixed";
7
7
  readonly subcommands: readonly [];
@@ -11,6 +11,12 @@ export declare const COMMAND_CONTRACT: readonly [{
11
11
  readonly lifecycle: "preview";
12
12
  readonly access: "offline";
13
13
  readonly subcommands: readonly [];
14
+ }, {
15
+ readonly name: "validate";
16
+ readonly description: "Validate an app manifest, graph, paths, and members offline";
17
+ readonly lifecycle: "preview";
18
+ readonly access: "offline";
19
+ readonly subcommands: readonly [];
14
20
  }, {
15
21
  readonly name: "deploy";
16
22
  readonly description: "Deploy an app workspace";
@@ -127,10 +133,16 @@ export declare const COMMAND_CONTRACT: readonly [{
127
133
  readonly subcommands: readonly ["init", "validate", "apply", "list", "show", "mkdir", "upload", "import", "uploads", "reconcile", "download", "access", "trash", "restore", "purge", "operations", "abort", "delete"];
128
134
  }, {
129
135
  readonly name: "access";
130
- readonly description: "Manage runtime resource access";
136
+ readonly description: "Manage resource access on every primitive";
131
137
  readonly lifecycle: "preview";
132
138
  readonly access: "authenticated";
133
139
  readonly subcommands: readonly ["definitions", "list", "grant", "revoke", "resolve"];
140
+ }, {
141
+ readonly name: "principals";
142
+ readonly description: "Find users, groups, and service accounts to grant";
143
+ readonly lifecycle: "preview";
144
+ readonly access: "authenticated";
145
+ readonly subcommands: readonly ["search", "users", "groups"];
134
146
  }, {
135
147
  readonly name: "service-accounts";
136
148
  readonly description: "Manage runtime service accounts";
@@ -1,7 +1,8 @@
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 or use a published template', lifecycle: 'preview', access: 'mixed', subcommands: [] },
3
+ { name: 'init', description: 'Scaffold an app workspace or use a published template; --repo scaffolds into a git-service repo', lifecycle: 'preview', access: 'mixed', subcommands: [] },
4
4
  { name: 'add', description: 'Add a primitive to an app workspace', lifecycle: 'preview', access: 'offline', subcommands: [] },
5
+ { name: 'validate', description: 'Validate an app manifest, graph, paths, and members offline', lifecycle: 'preview', access: 'offline', subcommands: [] },
5
6
  { name: 'deploy', description: 'Deploy an app workspace', lifecycle: 'preview', access: 'authenticated', subcommands: [] },
6
7
  { name: 'process', description: 'Build and operate Lattice processes', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'lint', 'plan', 'apply', 'test', 'simulate', 'bundle', 'promote', 'pull', 'runs', 'safety-baseline'] },
7
8
  { name: 'artifact', description: 'Build and operate Artifact Studio apps', lifecycle: 'stable', access: 'mixed', subcommands: ['init', 'whoami', 'link', 'env', 'status', 'list', 'show', 'validate', 'build', 'plan', 'deploy', 'dev', 'promote', 'pull', 'rollback'] },
@@ -21,7 +22,8 @@ export const COMMAND_CONTRACT = [
21
22
  { name: 'version', description: 'Print the installed CLI version', lifecycle: 'stable', access: 'offline', subcommands: [] },
22
23
  { name: 'help', description: 'Show command help', lifecycle: 'stable', access: 'offline', subcommands: [] },
23
24
  { name: 'storage', description: 'Manage Workspaces V2 file storage', lifecycle: 'preview', access: 'authenticated', subcommands: ['init', 'validate', 'apply', 'list', 'show', 'mkdir', 'upload', 'import', 'uploads', 'reconcile', 'download', 'access', 'trash', 'restore', 'purge', 'operations', 'abort', 'delete'] },
24
- { name: 'access', description: 'Manage runtime resource access', lifecycle: 'preview', access: 'authenticated', subcommands: ['definitions', 'list', 'grant', 'revoke', 'resolve'] },
25
+ { name: 'access', description: 'Manage resource access on every primitive', lifecycle: 'preview', access: 'authenticated', subcommands: ['definitions', 'list', 'grant', 'revoke', 'resolve'] },
26
+ { name: 'principals', description: 'Find users, groups, and service accounts to grant', lifecycle: 'preview', access: 'authenticated', subcommands: ['search', 'users', 'groups'] },
25
27
  { name: 'service-accounts', description: 'Manage runtime service accounts', lifecycle: 'preview', access: 'authenticated', subcommands: ['list', 'show', 'create'] },
26
28
  { name: 'capabilities', description: 'Print the supported CLI command surface', lifecycle: 'blocked', access: 'offline', subcommands: [] },
27
29
  ];
@@ -1,13 +1,15 @@
1
1
  /** Help text reachable before command implementations, auth, optional SDKs, or Atlas clients load. */
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 <namespace> <operation> -e <env> [--variables-file <file>] [--var <name>=<value>]...\n seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>\n seq-studio orm namespaces -e <env> [--limit N] [--offset N] [--json]\n seq-studio orm describe <namespace> [<table> | --operations] -e <env> [--json]\n seq-studio orm read <namespace> <table> -e <env> [--where <column>=<op>.<value>]... [--select <cols>] [--order <col>[.desc]] [--limit N] [--offset N] [--json|--jsonl]\n seq-studio orm sql <namespace> --query <sql> | --file <path> -e <env> [--param <name>[:<type>]=<value>]... | [--params <json-object>] [--json|--jsonl]\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 namespaces lists what you can read; describe shows its tables and operations.\n Run seq-studio orm describe --help for the output.\n execute <namespace> <operation> runs the deployed version's persisted operation by\n name, with no checkout. Run seq-studio orm execute --help for both forms.\n read and sql query a v2 namespace as you through its built-in read-only SQL.\n sql must name tables as <namespace>.<table> (FROM lending.loans, not FROM loans).\n Run seq-studio orm read --help for the filter grammar, parameters, and output formats.\n";
2
+ /** `--repo` on every init command; shared so the commands describe it identically. */
3
+ export declare const INIT_INTO_REPO_HELP = " Init into a repo: --repo <ns>/<name> on an init command creates that platform\n git-service repo if missing (same name rules as repos create), then clones it\n into <dir> and scaffolds there, or, when <dir> is inside a Git checkout, sets\n it as that checkout's origin (a different existing origin is refused). It\n needs -e <env>, or an agent sandbox. Nothing is committed or pushed; the\n command prints the git add, commit, and push to run.\n";
4
+ export declare const ORM_HELP = "usage:\n seq-studio orm init <dir> [--repo <ns>/<name>]\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> [--timeout <duration>] [--no-wait]\n seq-studio orm execute <namespace> <operation> -e <env> [--variables-file <file>] [--var <name>=<value>]...\n seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>\n seq-studio orm namespaces -e <env> [--limit N] [--offset N] [--json]\n seq-studio orm describe <namespace> [<table> | --operations] -e <env> [--json]\n seq-studio orm operation show <namespace> <name> -e <env> [--json]\n seq-studio orm read <namespace> <table> -e <env> [--where <column>=<op>.<value>]... [--select <cols>] [--order <col>[.desc]] [--limit N] [--offset N] [--json|--jsonl]\n seq-studio orm sql <namespace> --query <sql> | --file <path> -e <env> [--param <name>[:<type>]=<value>]... | [--params <json-object>] [--json|--jsonl]\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 Schema commands require the ORM loaded by seq-studio to satisfy the v2\n namespace's package.json @sequenceholdings/orm range before compiling.\n apply waits until the new version is live and serving (default up to 20m), then\n prints \"live:\"; --no-wait returns once the apply is queued.\n namespaces lists what you can read; describe shows its tables and operations.\n Run seq-studio orm describe --help for the output.\n execute <namespace> <operation> runs the deployed version's persisted operation by\n name, with no checkout. Run seq-studio orm execute --help for both forms.\n read and sql query a v2 namespace as you through its built-in read-only SQL.\n sql must name tables as <namespace>.<table> (FROM lending.loans, not FROM loans).\n Run seq-studio orm read --help for the filter grammar, parameters, and output formats.\n\n Init into a repo: --repo <ns>/<name> on an init command creates that platform\n git-service repo if missing (same name rules as repos create), then clones it\n into <dir> and scaffolds there, or, when <dir> is inside a Git checkout, sets\n it as that checkout's origin (a different existing origin is refused). It\n needs -e <env>, or an agent sandbox. Nothing is committed or pushed; the\n command prints the git add, commit, and push to run.\n";
3
5
  /** Artifact commands in sandbox token mode; shared by the offline and delegate usage. */
4
6
  export declare const ARTIFACT_SANDBOX_HELP = " In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), build, plan\n and deploy take --repo: push the app to a Git Service repository and deploy\n from it. Atlas builds Next.js applications; static applications are bundled\n from the repository and must declare no package.json dependencies or\n optionalDependencies, because the sandbox cannot reach a package registry.\n dev, login, logout, --git-url, --source-env, --pr and --env-url are\n unavailable there, and -e is ignored.\n";
5
- 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\n In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), build, plan\n and deploy take --repo: push the app to a Git Service repository and deploy\n from it. Atlas builds Next.js applications; static applications are bundled\n from the repository and must declare no package.json dependencies or\n optionalDependencies, because the sandbox cannot reach a package registry.\n dev, login, logout, --git-url, --source-env, --pr and --env-url are\n unavailable there, and -e is ignored.\n";
6
- 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|deploy --repo <namespace>/<slug> --ref <sha|branch>\n [--root <directory>] [--source-env <first-party-env>] -e <env> [--target <id>]\n For an existing target release unit, source-env selects a separately\n authenticated canonical repository from banksouth, staging, or production.\n Source identity must be adopted and belong to the destination tenant.\n Registered OpCo source origins are not supported yet. The target verifies\n and snapshots source before planning; no target repository is created.\n Not compatible with --dir, existing IDs, or coordinated migrations.\n Rollback uses retained snapshots; historical source commits can be re-planned\n explicitly with deploy --ref <sha> --source-env <env>.\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";
7
- 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 shell + initial secret declarations; no deploy\n seq-studio functions deploy -e <env> [-m msg] preflight, upload, then show version and lifecycle progress\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";
8
- 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 identity <ns>/<name> -e <env> [--write --dir .] show/install the server-issued identity receipt\n --adopt --write --yes admin-only legacy binding; commit the receipt via PR\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|close|comment|comments|review|reviews|checks> [args]\n 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";
9
- export declare const PROCESS_RUNS_USAGE = "usage:\n seq-studio process runs start <process-id> -e <env> [--version <v>] [--run-id <id>]\n [--metadata-file <file.json>] [--title <text>] [--entity <type>:<id>] [--json]\n seq-studio process runs list -e <env> [--process <id>] [--status <status>]\n [--entity-type <type>] [--entity-id <id>] [--archived] [--limit 1..500] [--json]\n seq-studio process runs show <run-id> -e <env> [--wait [--timeout <seconds>]] [--json]\n seq-studio process runs cancel <run-id> -e <env> [--json]\n\n Runs start and are read as you: start needs invoker on the process, show and\n list return only runs you can view, and cancel needs invoker on the process.\n --version pins a published process version; omitted, the active version runs.\n --run-id makes start idempotent: repeating it for the same process returns the\n existing run instead of starting another. --metadata-file is a JSON object\n stored on the run.\n list returns the newest runs first, up to --limit (default 50, max 500); the run\n API has no cursor, so narrow with filters to reach older runs.\n --status: pending, running, completed, failed, cancelled, timed_out.\n show --wait polls until the run finishes (default timeout 600s); the run keeps\n going if the wait times out.\n";
10
- export declare const ORM_DISCOVER_HELP = "usage:\n seq-studio orm namespaces -e <env> [--limit N] [--offset N] [--json]\n seq-studio orm describe <namespace> [<table> | --operations] -e <env> [--json]\n\n Find the ORM data you can read, then query it with orm read or orm sql.\n namespaces lists only namespaces you can read, ordered by name: format (v2 or\n v1), table and persisted-operation counts. It pages with --limit (default 50)\n and --offset; the total and the next page go to stderr.\n describe <namespace> lists its tables and views and the persisted operations\n it serves, with what each requires and the variables it declares (name: type,\n ! when required). --operations prints only the operations, ready for\n orm execute <namespace> <operation>. describe <namespace> <table> lists the\n table's columns (types, nullability, keys), enum values, links, actions, and\n the persisted operations that write it. Column names are the ones orm read and\n orm sql accept.\n A namespace you cannot read reports not found, the same as a missing one.\n --json prints the full description (describe omits the generated GraphQL SDL).\n In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), -e is not needed.\n";
7
+ export declare const ARTIFACT_HELP = "usage:\n seq-studio artifact init <dir> [--template react-vite|nextjs] [--repo <namespace>/<name>]\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\n Init into a repo: --repo <ns>/<name> on an init command creates that platform\n git-service repo if missing (same name rules as repos create), then clones it\n into <dir> and scaffolds there, or, when <dir> is inside a Git checkout, sets\n it as that checkout's origin (a different existing origin is refused). It\n needs -e <env>, or an agent sandbox. Nothing is committed or pushed; the\n command prints the git add, commit, and push to run.\n\n In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), build, plan\n and deploy take --repo: push the app to a Git Service repository and deploy\n from it. Atlas builds Next.js applications; static applications are bundled\n from the repository and must declare no package.json dependencies or\n optionalDependencies, because the sandbox cannot reach a package registry.\n dev, login, logout, --git-url, --source-env, --pr and --env-url are\n unavailable there, and -e is ignored.\n";
8
+ 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|deploy --repo <namespace>/<slug> --ref <sha|branch>\n [--root <directory>] [--source-env <first-party-env>] -e <env> [--target <id>]\n For an existing target release unit, source-env selects a separately\n authenticated canonical repository from banksouth, staging, or production.\n Source identity must be adopted and belong to the destination tenant.\n Registered OpCo source origins are not supported yet. The target verifies\n and snapshots source before planning; no target repository is created.\n Reviewed pipeline.config.yml source_paths can select runtime files and\n directories, retaining pipeline metadata, release identity and size limits.\n Not compatible with --dir, existing IDs, or coordinated migrations.\n Rollback uses retained snapshots; historical source commits can be re-planned\n explicitly with deploy --ref <sha> --source-env <env>.\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";
9
+ export declare const FUNCTIONS_USAGE = "usage:\n seq-studio functions init <dir> [--repo <ns>/<name>] scaffold manifest, TypeScript handler, and docs pointers;\n --repo scaffolds into a git-service repo (see Init into a repo)\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 shell + initial secret declarations; no deploy\n seq-studio functions deploy -e <env> [-m msg] preflight, upload, then show version and lifecycle progress\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 [--json] [--version id|name] reader-gated release provenance\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 Local deploys record repository-wide gitDirty, including unignored files\n outside --dir. Check git status at the repository root before deploying.\n\n Workspace dependencies are compiled from packages declared in a containing\n sequence.app.yml, within the source repository. Only the selected function is\n deployed: no sibling primitives or Application registration. Shared Node packages\n can set package.json seqStudio.source to a root source entry for clean builds.\n Package build scripts are not run. Local secret paths remain relative to --dir.\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\n Init into a repo: --repo <ns>/<name> on an init command creates that platform\n git-service repo if missing (same name rules as repos create), then clones it\n into <dir> and scaffolds there, or, when <dir> is inside a Git checkout, sets\n it as that checkout's origin (a different existing origin is refused). It\n needs -e <env>, or an agent sandbox. Nothing is committed or pushed; the\n command prints the git add, commit, and push to run.\n";
10
+ 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 identity <ns>/<name> -e <env> [--write --dir .] show/install the server-issued identity receipt\n --adopt --write --yes admin-only legacy binding; commit the receipt via PR\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. The init\n commands take --repo <ns>/<name> to create,\n clone, and scaffold in one step\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|close|comment|comments|review|reviews|checks> [args]\n 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";
11
+ export declare const PROCESS_RUNS_USAGE = "usage:\n seq-studio process runs start <process-id> -e <env> [--version <v>] [--run-id <id>]\n [--metadata-file <file.json>] [--title <text>] [--entity <type>:<id>] [--json]\n seq-studio process runs retry <run-id> -e <env> [--run-id <new-id>] [--json]\n seq-studio process runs list -e <env> [--process <id>] [--status <status>]\n [--entity-type <type>] [--entity-id <id>] [--archived] [--limit 1..500] [--json]\n seq-studio process runs show <run-id> -e <env> [--wait [--timeout <seconds>]] [--json]\n seq-studio process runs cancel <run-id> -e <env> [--json]\n\n Runs start and are read as you: start and retry need invoker on the process,\n show and list return only runs you can view, and cancel needs invoker on the\n process.\n start prints the new run's id. Omit --run-id for a fresh id on every start.\n --run-id names exactly one run: repeating it for the same process returns that\n run, whatever its status, instead of starting another. To run a failed run\n again, retry it rather than inventing a new id.\n --version pins a published process version; omitted, the active version runs.\n --metadata-file is a JSON object stored on the run.\n retry (CLI 0.9.0+) starts a new run of a failed, cancelled or timed_out run's\n process version with the same metadata, entity and title, linked to the\n original in its lineage, and prints the new id. Other statuses are refused.\n Like start, a retry waits queued while the process is at its concurrent-run\n limit.\n --run-id on retry names the new run, so repeating the retry returns it.\n list returns the newest runs first, up to --limit (default 50, max 500); the run\n API has no cursor, so narrow with filters to reach older runs.\n --status: pending, running, completed, failed, cancelled, timed_out.\n show --wait polls until the run finishes (default timeout 600s); the run keeps\n going if the wait times out.\n";
12
+ export declare const ORM_DISCOVER_HELP = "usage:\n seq-studio orm namespaces -e <env> [--limit N] [--offset N] [--json]\n seq-studio orm describe <namespace> [<table> | --operations] -e <env> [--json]\n seq-studio orm operation show <namespace> <name> -e <env> [--json]\n\n Find the ORM data you can read, then query it with orm read or orm sql.\n namespaces lists only namespaces you can read, ordered by name: format (v2 or\n v1), table and persisted-operation counts. It pages with --limit (default 50)\n and --offset; the total and the next page go to stderr.\n describe <namespace> lists its tables and views and the persisted operations\n it serves, with what each requires and the variables it declares (name: type,\n ! when required). --operations prints only the operations, ready for\n orm execute <namespace> <operation>. describe <namespace> <table> lists the\n table's columns (types, nullability, keys), enum values, links, actions, and\n the persisted operations that write it. Column names are the ones orm read and\n orm sql accept.\n A namespace you cannot read reports not found, the same as a missing one.\n --json prints the full description (describe omits the generated GraphQL SDL).\n operation show prints one active persisted operation's registered GraphQL\n document; --json includes its hash, declared variables, and requirements.\n Missing and unreadable operations both report not found.\n In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), -e is not needed.\n";
11
13
  export declare const ORM_EXECUTE_HELP = "usage:\n seq-studio orm execute <namespace> <operation> -e <env> [--variables-file <file>] [--var <name>=<value>]...\n seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>\n\n Run one persisted operation as you. The server applies the operation's\n required capability or role and the namespace's row policies.\n By name: execute <namespace> <operation> looks the operation up in the\n namespace's deployed version and runs it. No checkout is needed, so it runs\n what is deployed even when a local clone is behind. List what you can run:\n seq-studio orm describe <namespace> --operations\n From a checkout: execute <operation> [dir] runs the operation as hashed in the\n namespace directory's operations.manifest.json (default dir: .). If the\n deployed version hashes it differently, execute prints both hashes and the\n by-name command instead of a bare 404.\n The form is chosen by the second argument: an existing directory means a\n checkout; otherwise it is <namespace> <operation>.\n --variables-file takes a JSON object. --var <name>=<value> (repeatable, by\n name only) sets one variable and wins over the file: numbers and booleans\n parse by the declared type, lists, filter inputs and jsonb take JSON, and other\n types take the text as is. Use the file for null.\n Output is the JSON response: {\"data\": ...}.\n In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), -e is not needed.\n";
12
14
  export declare function staticHelp({ namespace, sub }: {
13
15
  namespace: string;