@sequenceholdings/studio-cli 0.9.20 → 0.9.22

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 (65) hide show
  1. package/README.md +159 -12
  2. package/dist/app/commands.js +37 -7
  3. package/dist/app/deploy.js +2 -0
  4. package/dist/app/lockfile-preflight.d.ts +31 -0
  5. package/dist/app/lockfile-preflight.js +47 -0
  6. package/dist/app/repository-index.d.ts +5 -1
  7. package/dist/app/repository-index.js +9 -3
  8. package/dist/app/scaffold.d.ts +3 -1
  9. package/dist/app/scaffold.js +5 -3
  10. package/dist/auth.d.ts +13 -9
  11. package/dist/auth.js +98 -20
  12. package/dist/cli-errors.js +6 -1
  13. package/dist/command-contract.d.ts +13 -1
  14. package/dist/command-contract.js +3 -1
  15. package/dist/command-help.d.ts +1 -1
  16. package/dist/command-help.js +8 -1
  17. package/dist/config.d.ts +14 -0
  18. package/dist/config.js +29 -3
  19. package/dist/docs/commands.d.ts +16 -0
  20. package/dist/docs/commands.js +168 -0
  21. package/dist/docs/help.d.ts +2 -0
  22. package/dist/docs/help.js +12 -0
  23. package/dist/envs/commands.js +10 -2
  24. package/dist/host-token.d.ts +19 -4
  25. package/dist/host-token.js +50 -10
  26. package/dist/main.d.ts +1 -0
  27. package/dist/main.js +20 -2
  28. package/dist/orm/discover-operations.d.ts +1 -1
  29. package/dist/orm/discover-operations.js +3 -3
  30. package/dist/orm/discover-schema.d.ts +0 -5
  31. package/dist/orm/discover-schema.js +0 -3
  32. package/dist/pipeline/commands.d.ts +0 -7
  33. package/dist/pipeline/commands.js +16 -67
  34. package/dist/pipeline/discovery.d.ts +1 -1
  35. package/dist/pipeline/discovery.js +6 -6
  36. package/dist/process/build.d.ts +2 -5
  37. package/dist/process/build.js +4 -49
  38. package/dist/repos/commands.d.ts +11 -1
  39. package/dist/repos/commands.js +78 -11
  40. package/dist/repos/git-credential.d.ts +12 -5
  41. package/dist/repos/git-credential.js +63 -36
  42. package/dist/repos/github-connect-command.d.ts +35 -0
  43. package/dist/repos/github-connect-command.js +250 -0
  44. package/dist/repos/github-init-command.d.ts +16 -0
  45. package/dist/repos/github-init-command.js +116 -0
  46. package/dist/repos/github-init.d.ts +146 -0
  47. package/dist/repos/github-init.js +355 -0
  48. package/dist/repos/init-github.d.ts +50 -0
  49. package/dist/repos/init-github.js +181 -0
  50. package/dist/repos/pulls.d.ts +5 -1
  51. package/dist/repos/pulls.js +31 -9
  52. package/dist/scaffold-guidance.d.ts +10 -2
  53. package/dist/scaffold-guidance.js +27 -2
  54. package/dist/templates/github/pr-type.mjs +285 -0
  55. package/dist/templates/github/pr-types.json +40 -0
  56. package/dist/templates/guidance/AGENTS.md +15 -8
  57. package/package.json +7 -7
  58. package/release-summary.json +3 -1
  59. package/templates/github/pr-type.mjs +285 -0
  60. package/templates/github/pr-types.json +40 -0
  61. package/templates/guidance/AGENTS.md +15 -8
  62. package/dist/pipeline/active-orm-contracts.d.ts +0 -16
  63. package/dist/pipeline/active-orm-contracts.js +0 -36
  64. package/dist/pipeline/repin-orm.d.ts +0 -2
  65. package/dist/pipeline/repin-orm.js +0 -207
@@ -0,0 +1,12 @@
1
+ /** Kept free of network imports so offline `--help` stays cheap. */
2
+ export const DOCS_HELP = `usage:
3
+ seq-studio docs search <query> -e <env> [--limit N] [--json]
4
+ seq-studio docs read <slug> -e <env> [--json]
5
+ seq-studio docs list -e <env> [--json]
6
+
7
+ Read the Sequence developer documentation published by an environment. The docs
8
+ match the platform version that environment runs, so prefer them over memory or
9
+ copied snippets. Search first, then read the matching page in full before
10
+ running unfamiliar commands. Use \`index\` as the slug for the homepage.
11
+ \`seq-studio envs list\` prints the available environments.
12
+ `;
@@ -1,4 +1,4 @@
1
- import { addSharedLoginEnvironment, readConfig, configPath, manualEnvConfigHint } from '../config.js';
1
+ import { addLocalEnvironment, addSharedLoginEnvironment, readConfig, configPath, manualEnvConfigHint } from '../config.js';
2
2
  import { isSharedLoginDeploymentName } from '../auth.js';
3
3
  import { readRegisteredEnvironmentUrls, registerEnvironment, } from '../env-registry.js';
4
4
  import { describeSandboxTarget, SANDBOX_ENV_NAME, sandboxTarget, sandboxUsageFooter, } from '../sandbox-auth.js';
@@ -16,7 +16,9 @@ const ENVS_USAGE = `usage:
16
16
  only after the deployment's sign-in settings confirm that login; then
17
17
  "seq-studio login" signs you in.
18
18
 
19
- Local worktrees are discovered from their .wt.env files. Entries in
19
+ Local worktrees are discovered from their .wt.env files. For another Atlas
20
+ on a local port (a devbox's Atlas forwarded to this machine), run
21
+ "envs add local:<name> http://localhost:<port>". Entries in
20
22
  ${configPath()} are also honored.
21
23
  `;
22
24
  export async function runEnvsCommand(sub, rest) {
@@ -69,6 +71,12 @@ async function addCommand(rest) {
69
71
  return 1;
70
72
  }
71
73
  try {
74
+ if (name.toLowerCase().startsWith('local:')) {
75
+ const added = await addLocalEnvironment({ name: name.toLowerCase(), baseUrl });
76
+ console.log(`${added.changed ? 'Added' : 'Already configured:'} environment '${added.name}' -> ${added.baseUrl} (saved in ${configPath()})`);
77
+ console.log(`Next: seq-studio login --env ${added.name} (sign-in settings are read from the running Atlas)`);
78
+ return 0;
79
+ }
72
80
  if (isSharedLoginDeploymentName(name.toLowerCase())) {
73
81
  const added = await addSharedLoginEnvironment({ name: name.toLowerCase(), baseUrl });
74
82
  console.log(`${added.changed ? 'Added' : 'Already configured:'} environment '${added.name}' -> ${added.baseUrl} ` +
@@ -10,10 +10,14 @@
10
10
  * SEQ_DEVBOX_TOKEN_DIR/localhost the box's own Atlas, on any loopback origin
11
11
  *
12
12
  * A request to an origin whose host has a live file uses it, unless the user
13
- * has a live login of their own for that deployment, which wins (auth.ts);
14
- * every other origin resolves exactly as before. Unlike sandbox token
15
- * mode this pins nothing: `-e` still picks the deployment, and a deployment
16
- * with no file falls through to the usual login.
13
+ * has a live cached login of their own for that deployment, which wins
14
+ * (auth.ts). On a devbox, a hosted deployment with neither is refused
15
+ * (DevboxOwnerTokenMissingError) rather than sent the shared M2M identity or
16
+ * a browser login; the box's own loopback Atlas keeps the M2M fallback, and
17
+ * SEQAPI_AUTH_MODE=m2m still selects the machine identity explicitly. Outside
18
+ * a devbox nothing here applies. Unlike sandbox token mode this pins nothing:
19
+ * `-e` still picks the deployment. The same contract as seqapi's
20
+ * `devbox_host_token.py`.
17
21
  *
18
22
  * The file is read again for each request, so a rotation mid-command is picked
19
23
  * up. A token whose `exp` is past (or within a minute of it) is ignored rather
@@ -22,6 +26,10 @@
22
26
  export declare const DEVBOX_TOKEN_DIR_ENV = "SEQ_DEVBOX_TOKEN_DIR";
23
27
  /** The file name a token for `url` lives under, or null for an origin that never has one. */
24
28
  export declare function devboxTokenHost(url: string): string | null;
29
+ /** Whether `url` addresses the box's own Atlas rather than a hosted deployment. */
30
+ export declare function isLoopbackUrl(url: string): boolean;
31
+ /** Where the token for `url` would live on this devbox, or null outside a devbox or for an origin that never has one. */
32
+ export declare function devboxTokenFile(url: string, env?: NodeJS.ProcessEnv): string | null;
25
33
  /** The JWT's `exp`, read without verifying it: the server verifies, this only avoids sending a dead token. */
26
34
  export declare function jwtExpiry(token: string): number | null;
27
35
  /**
@@ -54,3 +62,10 @@ export declare function devboxAwareBearer(url: string, token: string, { env, now
54
62
  env?: NodeJS.ProcessEnv;
55
63
  now?: number;
56
64
  }): Promise<string>;
65
+ /**
66
+ * Next-step copy for a 401 from the last authenticated request when this box
67
+ * has a token file for that host, or null otherwise. Names the host and the
68
+ * file, because "run seq-studio login" alone hides that the box, not the
69
+ * user, sent the token, and a box cannot complete a browser login.
70
+ */
71
+ export declare function devboxUnauthorizedHint(): string | null;
@@ -10,15 +10,20 @@
10
10
  * SEQ_DEVBOX_TOKEN_DIR/localhost the box's own Atlas, on any loopback origin
11
11
  *
12
12
  * A request to an origin whose host has a live file uses it, unless the user
13
- * has a live login of their own for that deployment, which wins (auth.ts);
14
- * every other origin resolves exactly as before. Unlike sandbox token
15
- * mode this pins nothing: `-e` still picks the deployment, and a deployment
16
- * with no file falls through to the usual login.
13
+ * has a live cached login of their own for that deployment, which wins
14
+ * (auth.ts). On a devbox, a hosted deployment with neither is refused
15
+ * (DevboxOwnerTokenMissingError) rather than sent the shared M2M identity or
16
+ * a browser login; the box's own loopback Atlas keeps the M2M fallback, and
17
+ * SEQAPI_AUTH_MODE=m2m still selects the machine identity explicitly. Outside
18
+ * a devbox nothing here applies. Unlike sandbox token mode this pins nothing:
19
+ * `-e` still picks the deployment. The same contract as seqapi's
20
+ * `devbox_host_token.py`.
17
21
  *
18
22
  * The file is read again for each request, so a rotation mid-command is picked
19
23
  * up. A token whose `exp` is past (or within a minute of it) is ignored rather
20
24
  * than sent: the login cache, if any, is the better answer then.
21
25
  */
26
+ import { existsSync } from 'node:fs';
22
27
  import { readFile } from 'node:fs/promises';
23
28
  import { join } from 'node:path';
24
29
  export const DEVBOX_TOKEN_DIR_ENV = 'SEQ_DEVBOX_TOKEN_DIR';
@@ -46,6 +51,21 @@ export function devboxTokenHost(url) {
46
51
  const host = parsed.host.toLowerCase();
47
52
  return HOST.test(host) ? host : null;
48
53
  }
54
+ /** Whether `url` addresses the box's own Atlas rather than a hosted deployment. */
55
+ export function isLoopbackUrl(url) {
56
+ try {
57
+ return LOOPBACK_HOSTNAMES.has(new URL(url).hostname.toLowerCase());
58
+ }
59
+ catch {
60
+ return false;
61
+ }
62
+ }
63
+ /** Where the token for `url` would live on this devbox, or null outside a devbox or for an origin that never has one. */
64
+ export function devboxTokenFile(url, env = process.env) {
65
+ const dir = env[DEVBOX_TOKEN_DIR_ENV]?.trim();
66
+ const host = dir ? devboxTokenHost(url) : null;
67
+ return dir && host ? join(dir, host) : null;
68
+ }
49
69
  /** The JWT's `exp`, read without verifying it: the server verifies, this only avoids sending a dead token. */
50
70
  export function jwtExpiry(token) {
51
71
  const payload = token.split('.')[1];
@@ -70,15 +90,12 @@ export function jwtExpiry(token) {
70
90
  export async function devboxHostToken(url, { env = process.env, now = Date.now() } = {}) {
71
91
  if (env.SEQAPI_AUTH_MODE?.trim().toLowerCase() === 'm2m')
72
92
  return null;
73
- const dir = env[DEVBOX_TOKEN_DIR_ENV]?.trim();
74
- if (!dir)
75
- return null;
76
- const host = devboxTokenHost(url);
77
- if (!host)
93
+ const file = devboxTokenFile(url, env);
94
+ if (!file)
78
95
  return null;
79
96
  let token;
80
97
  try {
81
- token = (await readFile(join(dir, host), 'utf8')).trim();
98
+ token = (await readFile(file, 'utf8')).trim();
82
99
  }
83
100
  catch {
84
101
  return null;
@@ -116,6 +133,13 @@ export function isDevboxFileToken(token) {
116
133
  * token, so a long command does not die when that login expires.
117
134
  */
118
135
  export async function devboxAwareBearer(url, token, { env = process.env, now = Date.now() } = {}) {
136
+ const bearer = await selectDevboxAwareBearer({ url, token, env, now });
137
+ const host = devboxTokenHost(url);
138
+ const file = devboxTokenFile(url, env);
139
+ lastDevboxRequest = host && file ? { host, file, sentFileToken: bearer !== token || isDevboxFileToken(bearer) } : null;
140
+ return bearer;
141
+ }
142
+ async function selectDevboxAwareBearer({ url, token, env, now, }) {
119
143
  if (token && !isDevboxFileToken(token)) {
120
144
  const exp = jwtExpiry(token);
121
145
  if (exp === null || exp * 1000 > now + EXPIRY_MARGIN_SECONDS * 1000)
@@ -123,3 +147,19 @@ export async function devboxAwareBearer(url, token, { env = process.env, now = D
123
147
  }
124
148
  return (await devboxHostToken(url, { env, now })) ?? token;
125
149
  }
150
+ let lastDevboxRequest = null;
151
+ /**
152
+ * Next-step copy for a 401 from the last authenticated request when this box
153
+ * has a token file for that host, or null otherwise. Names the host and the
154
+ * file, because "run seq-studio login" alone hides that the box, not the
155
+ * user, sent the token, and a box cannot complete a browser login.
156
+ */
157
+ export function devboxUnauthorizedHint() {
158
+ if (!lastDevboxRequest || !existsSync(lastDevboxRequest.file))
159
+ return null;
160
+ const { host, file, sentFileToken } = lastDevboxRequest;
161
+ return sentFileToken
162
+ ? `This devbox's owner token for ${host} (${file}) was not accepted there. ` +
163
+ 'The control plane rewrites that file about every 10 minutes: retry after the next refresh, and if it is still refused, tell the user which deployment and continue.'
164
+ : `Atlas at ${host} rejected your own login; the box's owner token in ${file} is used only once that login expires.`;
165
+ }
package/dist/main.d.ts CHANGED
@@ -14,6 +14,7 @@
14
14
  * seq-studio templates <sub> publish and synchronize Git-backed templates
15
15
  * seq-studio pipeline <sub> discover, query, author and operate Data Pipelines
16
16
  * seq-studio auth <sub> manage Git authentication
17
+ * seq-studio docs <sub> search and read the environment's developer docs
17
18
  * seq-studio feedback submit submit agent feedback
18
19
  * seq-studio service-accounts <sub> provision runtime identities
19
20
  * seq-studio access <sub> manage resource access on every primitive
package/dist/main.js CHANGED
@@ -14,6 +14,7 @@
14
14
  * seq-studio templates <sub> publish and synchronize Git-backed templates
15
15
  * seq-studio pipeline <sub> discover, query, author and operate Data Pipelines
16
16
  * seq-studio auth <sub> manage Git authentication
17
+ * seq-studio docs <sub> search and read the environment's developer docs
17
18
  * seq-studio feedback submit submit agent feedback
18
19
  * seq-studio service-accounts <sub> provision runtime identities
19
20
  * seq-studio access <sub> manage resource access on every primitive
@@ -43,10 +44,12 @@ const TOP_LEVEL_USAGE = `usage:
43
44
  seq-studio storage <sub> [args] init | validate | apply | list | show | mkdir | upload | download | access | trash | restore | purge | operations | abort | delete
44
45
  seq-studio agents <sub> [args] init | validate | bundle | plan | apply | list | show | voice (internal)
45
46
  seq-studio secrets <sub> [args] create | set | list | attach | detach | apply
47
+ seq-studio repo init [--check] set up a GitHub checkout: workflows, Renovate, agent skill, branch rules
46
48
  seq-studio repos <sub> [args] list | namespaces | show | identity | create | clone | pull | pulls | delete | ci
47
49
  seq-studio templates <sub> [args] publish | sync | list
48
50
  seq-studio pipeline <sub> [args] list | assets | search | describe | schema | sample | query | init | validate | repin-orm | codegen | plan | adopt | unbind | retire | deploy | status | migrate | promote | rollback | run-now
49
51
  seq-studio auth <sub> [args] whoami | git-credential
52
+ seq-studio docs <sub> -e <env> search <query> | read <slug> | list (read before guessing commands)
50
53
  seq-studio feedback submit --file report.json [-e <env>] [--json]
51
54
  seq-studio orm <sub> [args] init | generate | validate | plan | apply | deployment-policy | execute | read | sql | diff | migrate-from-yaml | import
52
55
  seq-studio service-accounts <sub> list | show | create (requires provisioning authority)
@@ -73,7 +76,7 @@ const TOP_LEVEL_USAGE = `usage:
73
76
  \`seq-studio envs add <name> <url>\`; custom entries live in ~/.config/lattice/config.toml.
74
77
  If this CLI cannot complete a documented step, read that environment's docs
75
78
  before trying another tool. \`seq-studio envs list\` prints each environment URL.
76
- Docs: <url>/docs. Feedback guide: <url>/docs/raw/seq-studio/feedback.md.
79
+ Docs: seq-studio docs search <query> -e <env>, or <url>/docs. Feedback guide: <url>/docs/raw/seq-studio/feedback.md.
77
80
  `;
78
81
  const PROCESS_USAGE = `usage:
79
82
  seq-studio process init <dir>
@@ -103,13 +106,14 @@ const SUBCOMMANDS = {
103
106
  storage: new Set(['init', 'validate', 'apply', 'list', 'show', 'mkdir', 'upload', 'import', 'uploads', 'reconcile', 'download', 'access', 'trash', 'restore', 'purge', 'operations', 'abort', 'delete']),
104
107
  agents: new Set(['init', 'validate', 'bundle', 'plan', 'apply', 'list', 'show', 'voice']),
105
108
  secrets: new Set(['create', 'set', 'list', 'attach', 'detach', 'apply', 'versions', 'set-default', 'pin']),
106
- repos: new Set(['list', 'namespaces', 'show', 'identity', 'create', 'clone', 'pull', 'pulls', 'delete', 'ci']),
109
+ repos: new Set(['list', 'namespaces', 'show', 'identity', 'create', 'clone', 'attach-login', 'pull', 'pulls', 'delete', 'ci']),
107
110
  templates: new Set(['publish', 'sync', 'list']),
108
111
  'service-accounts': new Set(['list', 'show', 'create']),
109
112
  access: new Set(['definitions', 'resolve', 'list', 'grant', 'revoke', 'roles']),
110
113
  principals: new Set(['search', 'users', 'groups']),
111
114
  auth: new Set(['whoami', 'git-credential', 'pat']),
112
115
  feedback: new Set(['submit']),
116
+ docs: new Set(['search', 'read', 'list']),
113
117
  orm: new Set(['init', 'generate', 'validate', 'plan', 'apply', 'history', 'deployment-policy', 'execute', 'namespaces', 'describe', 'read', 'sql', 'diff', 'migrate-from-yaml', 'import']),
114
118
  pipeline: new Set(['list', 'assets', 'search', 'describe', 'schema', 'sample', 'query', 'init', 'validate', 'repin-orm', 'codegen', 'adopt', 'unbind', 'retire', 'plan', 'deploy', 'status', 'migrate', 'promote', 'rollback', 'run-now']),
115
119
  envs: new Set(['add', 'list']),
@@ -229,6 +233,18 @@ async function dispatch(argv) {
229
233
  const { runSecretsCommand } = await import('./secrets/commands.js');
230
234
  return runSecretsCommand(sub, parseArgs(rest));
231
235
  }
236
+ case 'repo': {
237
+ if (sub === 'connect' || sub === 'disconnect' || sub === 'status' || sub === 'bind') {
238
+ const { runRepoConnectCommand } = await import('./repos/github-connect-command.js');
239
+ return runRepoConnectCommand(sub, parseArgs(rest));
240
+ }
241
+ if (sub !== 'init') {
242
+ console.error('usage: seq-studio repo init|connect|bind|disconnect|status (see seq-studio repo <command> --help)');
243
+ return 2;
244
+ }
245
+ const { runRepoInitCommand } = await import('./repos/github-init-command.js');
246
+ return runRepoInitCommand(parseArgs(rest));
247
+ }
232
248
  case 'repos': {
233
249
  const { runReposCommand } = await import('./repos/commands.js');
234
250
  return runReposCommand(sub, parseArgs(rest));
@@ -251,6 +267,8 @@ async function dispatch(argv) {
251
267
  }
252
268
  case 'feedback':
253
269
  return (await import('./feedback/commands.js')).runFeedbackCommand(sub, parseArgs(rest));
270
+ case 'docs':
271
+ return (await import('./docs/commands.js')).runDocsCommand(sub, parseArgs(rest));
254
272
  case 'auth': {
255
273
  const { runAuthCommand } = await import('./auth-cmds/commands.js');
256
274
  return runAuthCommand(sub, parseArgs(rest));
@@ -7,7 +7,7 @@ export declare function getNamespaceJson({ options, namespace, path }: {
7
7
  namespace: string;
8
8
  path: string;
9
9
  }): Promise<unknown>;
10
- export type OperationListing = Pick<OperationsPage, 'operation_set_id' | 'schema_version_id' | 'ops_hash'> & {
10
+ export type OperationListing = Pick<OperationsPage, 'operation_set_id' | 'schema_version_id'> & {
11
11
  operations: Operation[];
12
12
  };
13
13
  export declare function listAllOperations({ options, namespace }: {
@@ -35,14 +35,14 @@ export async function listAllOperations({ options, namespace }) {
35
35
  }
36
36
  if (first) {
37
37
  if (page.operation_set_id !== first.operation_set_id || page.schema_version_id !== first.schema_version_id ||
38
- page.ops_hash !== first.ops_hash || page.total !== first.total) {
38
+ page.total !== first.total) {
39
39
  throw new Error(`The active operation set changed while reading '${namespace}'. Retry orm describe ${namespace}.`);
40
40
  }
41
41
  }
42
42
  else
43
43
  first = page;
44
44
  if (page.operation_set_id === null && (page.operations.length !== 0 || page.total !== 0 ||
45
- page.schema_version_id != null || page.ops_hash != null)) {
45
+ page.schema_version_id != null)) {
46
46
  throw new Error(`Invalid empty active operation set for '${namespace}'. Retry orm describe ${namespace}.`);
47
47
  }
48
48
  if (page.operations.length === 0 && operations.length < page.total) {
@@ -54,7 +54,7 @@ export async function listAllOperations({ options, namespace }) {
54
54
  }
55
55
  if (operations.length === page.total) {
56
56
  return { operations, operation_set_id: first.operation_set_id,
57
- schema_version_id: first.schema_version_id, ops_hash: first.ops_hash };
57
+ schema_version_id: first.schema_version_id };
58
58
  }
59
59
  }
60
60
  }
@@ -166,7 +166,6 @@ declare const variableSchema: z.ZodObject<{
166
166
  }, z.core.$loose>;
167
167
  declare const operationSchema: z.ZodObject<{
168
168
  name: z.ZodString;
169
- op_hash: z.ZodString;
170
169
  kind: z.ZodString;
171
170
  requires: z.ZodNullable<z.ZodObject<{
172
171
  capability: z.ZodOptional<z.ZodString>;
@@ -194,7 +193,6 @@ declare const operationSchema: z.ZodObject<{
194
193
  export declare const operationsPageSchema: z.ZodObject<{
195
194
  operations: z.ZodArray<z.ZodObject<{
196
195
  name: z.ZodString;
197
- op_hash: z.ZodString;
198
196
  kind: z.ZodString;
199
197
  requires: z.ZodNullable<z.ZodObject<{
200
198
  capability: z.ZodOptional<z.ZodString>;
@@ -223,13 +221,11 @@ export declare const operationsPageSchema: z.ZodObject<{
223
221
  namespace: z.ZodOptional<z.ZodString>;
224
222
  operation_set_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
225
223
  schema_version_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
226
- ops_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
227
224
  offset: z.ZodOptional<z.ZodNumber>;
228
225
  }, z.core.$loose>;
229
226
  /** `GET /api/orm/namespaces/<ns>/operations/<name>`: one operation of the active set. */
230
227
  export declare const operationDetailSchema: z.ZodObject<{
231
228
  name: z.ZodString;
232
- op_hash: z.ZodString;
233
229
  kind: z.ZodString;
234
230
  requires: z.ZodNullable<z.ZodObject<{
235
231
  capability: z.ZodOptional<z.ZodString>;
@@ -253,7 +249,6 @@ export declare const operationDetailSchema: z.ZodObject<{
253
249
  /** The reader-gated active operation detail also includes its registered document. */
254
250
  export declare const operationInspectionSchema: z.ZodObject<{
255
251
  name: z.ZodString;
256
- op_hash: z.ZodString;
257
252
  kind: z.ZodString;
258
253
  requires: z.ZodNullable<z.ZodObject<{
259
254
  capability: z.ZodOptional<z.ZodString>;
@@ -82,7 +82,6 @@ const variableSchema = z.looseObject({
82
82
  });
83
83
  const operationSchema = z.looseObject({
84
84
  name: z.string(),
85
- op_hash: z.string(),
86
85
  kind: z.string(),
87
86
  requires: requiresSchema,
88
87
  mutation_roots: z.array(z.looseObject({ table: z.string(), op: z.string() })).default([]),
@@ -95,13 +94,11 @@ export const operationsPageSchema = z.looseObject({
95
94
  namespace: z.string().optional(),
96
95
  operation_set_id: z.string().nullable().optional(),
97
96
  schema_version_id: z.string().nullable().optional(),
98
- ops_hash: z.string().nullable().optional(),
99
97
  offset: z.number().int().nonnegative().optional(),
100
98
  });
101
99
  /** `GET /api/orm/namespaces/<ns>/operations/<name>`: one operation of the active set. */
102
100
  export const operationDetailSchema = z.looseObject({
103
101
  name: z.string(),
104
- op_hash: z.string(),
105
102
  kind: z.string(),
106
103
  requires: requiresSchema,
107
104
  variables: z.array(variableSchema),
@@ -12,8 +12,6 @@
12
12
  * the CLI without the package get a clear install hint instead of a crash.
13
13
  */
14
14
  import type { ParsedArgs } from '../process/commands.js';
15
- /** Conventional ORM contract catalog filename beside stage specs (CI auto-loads this). */
16
- export declare const ORM_CONTRACTS_FILENAME = "orm-contracts.json";
17
15
  /**
18
16
  * Same classification as the orm delegate: is the pipeline-spec package
19
17
  * itself absent (installable) or did one of its dependencies fail to load?
@@ -56,11 +54,6 @@ export declare function buildExternalAssetsRequest({ source, knownOrigins, token
56
54
  export declare function configuredEnvOrigins(envs: Readonly<Record<string, {
57
55
  url: string;
58
56
  }>>): string[];
59
- /** Resolve ORM contracts from --orm-contracts or conventional orm-contracts.json. */
60
- export declare function resolveOrmContractsPath({ dir, flag, }: {
61
- dir: string;
62
- flag: unknown;
63
- }): string | undefined;
64
57
  export declare function pipelineValidateCommand(args: ParsedArgs): Promise<number>;
65
58
  export declare function runPipelineCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
66
59
  export {};
@@ -23,31 +23,23 @@ import { writeScaffoldGuidance } from '../scaffold-guidance.js';
23
23
  import { PIPELINE_DISCOVERY_USAGE, runPipelineDiscoveryCommand } from './discovery.js';
24
24
  import { renderEntrypointStub, renderStageTemplate, STAGE_TYPES, } from './templates.js';
25
25
  const LOG = '[seq-studio]';
26
- /** Conventional ORM contract catalog filename beside stage specs (CI auto-loads this). */
27
- export const ORM_CONTRACTS_FILENAME = 'orm-contracts.json';
28
26
  const PIPELINE_USAGE = `usage:
29
27
  ${PIPELINE_DISCOVERY_USAGE}
30
28
  seq-studio pipeline init --type ingestion|transformation|serving <name> [--dir <dir>]
31
29
  scaffold <name>.stage.yml in the first configured stage directory (or
32
30
  package root without config) + package-root-relative src/ entrypoint stub
33
31
 
34
- seq-studio pipeline validate [dir] [--assets <file|url>] [--orm-contracts <file|url>] [--json]
32
+ seq-studio pipeline validate [dir] [--assets <file|url>] [--json]
35
33
  run the offline spec gate: envelope + body validation, schema_ref
36
34
  resolution, and repo-level graph validation (references, single-writer,
37
35
  cycles, column subsets). --assets supplies a registry asset export for
38
- cross-Pipeline references; --orm-contracts (or orm-contracts.json in dir)
39
- supplies ORM synced-table contracts for serving satisfies pins. Exits 1 on
40
- any error-severity finding. Also validates optional pipeline.yml native
36
+ cross-Pipeline references. external-assets.json is a package-local default.
37
+ Exits 1 on any error-severity finding. Also validates optional pipeline.yml native
41
38
  workflow dependencies and manual stage membership.
42
39
  From the pipeline tooling/app directory, install both CLI and spec:
43
40
  pnpm add --save-dev @sequenceholdings/studio-cli @sequenceholdings/pipeline-spec
44
41
  pnpm exec seq-studio pipeline validate .
45
42
 
46
- seq-studio pipeline repin-orm [dir] -e <env> [--target <id>] [--dry-run]
47
- fetch active ORM synced-table contracts, verify serving compatibility,
48
- then update orm-contracts.json and every matching satisfies.content_hash;
49
- target is inferred when the environment exposes exactly one
50
-
51
43
  seq-studio pipeline retire --repo <release-unit> -e <env> [--stages <slugs>] [--target <id>] [--json]
52
44
  preview retirement of the whole pipeline or selected omitted stages; retain data and history
53
45
  approve the exact inventory with --plan-hash <hash> --yes
@@ -317,34 +309,6 @@ async function loadExternalAssets(spec, source) {
317
309
  }
318
310
  return spec.externalAssetsExportSchema.parse(JSON.parse(raw));
319
311
  }
320
- async function loadOrmContracts(spec, source) {
321
- let raw;
322
- if (/^https?:\/\//.test(source)) {
323
- const config = await readConfig();
324
- const token = await tryGetAccessToken();
325
- const request = buildExternalAssetsRequest({
326
- source,
327
- knownOrigins: configuredEnvOrigins(config.envs),
328
- token,
329
- });
330
- const response = await fetch(request.url, request.init);
331
- if (!response.ok) {
332
- throw new Error(`fetching ORM contracts catalog failed: ${response.status} ${response.statusText}`);
333
- }
334
- raw = await response.text();
335
- }
336
- else {
337
- raw = await readFile(resolve(source), 'utf8');
338
- }
339
- return spec.ormContractCatalogSchema.parse(JSON.parse(raw));
340
- }
341
- /** Resolve ORM contracts from --orm-contracts or conventional orm-contracts.json. */
342
- export function resolveOrmContractsPath({ dir, flag, }) {
343
- if (typeof flag === 'string')
344
- return flag;
345
- const conventional = join(dir, ORM_CONTRACTS_FILENAME);
346
- return existsSync(conventional) ? conventional : undefined;
347
- }
348
312
  function printHumanReport(report) {
349
313
  for (const finding of report.findings) {
350
314
  const prefix = finding.severity === 'error' ? 'error' : 'warning';
@@ -373,6 +337,12 @@ export async function pipelineValidateCommand(args) {
373
337
  }
374
338
  return report.ok ? 0 : 1;
375
339
  };
340
+ if ('orm-contracts' in args.flags || 'scoped-orm-contracts' in args.flags) {
341
+ return emit({ ok: false, dir: dirArg, stages: [], findings: [{ severity: 'error',
342
+ code: 'unsupported_orm_contract_option',
343
+ message: 'Pipeline validation is independent of ORM contracts. Remove --orm-contracts and --scoped-orm-contracts.',
344
+ }] });
345
+ }
376
346
  let pipeline;
377
347
  try {
378
348
  pipeline = await spec.loadSpecDirectory(dir);
@@ -400,9 +370,13 @@ export async function pipelineValidateCommand(args) {
400
370
  throw error;
401
371
  }
402
372
  let externalAssets;
403
- if (typeof args.flags.assets === 'string') {
373
+ const conventionalAssetsPath = join(dir, 'external-assets.json');
374
+ const assetsPath = typeof args.flags.assets === 'string'
375
+ ? args.flags.assets
376
+ : existsSync(conventionalAssetsPath) ? conventionalAssetsPath : undefined;
377
+ if (assetsPath) {
404
378
  try {
405
- externalAssets = await loadExternalAssets(spec, args.flags.assets);
379
+ externalAssets = await loadExternalAssets(spec, assetsPath);
406
380
  }
407
381
  catch (error) {
408
382
  return emit({
@@ -419,28 +393,7 @@ export async function pipelineValidateCommand(args) {
419
393
  });
420
394
  }
421
395
  }
422
- let ormContracts;
423
- const ormContractsPath = resolveOrmContractsPath({ dir, flag: args.flags['orm-contracts'] });
424
- if (ormContractsPath) {
425
- try {
426
- ormContracts = await loadOrmContracts(spec, ormContractsPath);
427
- }
428
- catch (error) {
429
- return emit({
430
- ok: false,
431
- dir: dirArg,
432
- stages: pipeline.stages.map((stage) => stage.stage),
433
- findings: [
434
- {
435
- severity: 'error',
436
- code: 'orm_contracts_unreadable',
437
- message: error instanceof Error ? error.message : String(error),
438
- },
439
- ],
440
- });
441
- }
442
- }
443
- const result = spec.validateSpecGraph(pipeline.stages, externalAssets, ormContracts !== undefined ? { ormContracts } : undefined);
396
+ const result = spec.validateReleaseContracts(pipeline.stages, externalAssets);
444
397
  return emit({
445
398
  ok: result.ok,
446
399
  dir: dirArg,
@@ -468,10 +421,6 @@ export async function runPipelineCommand(sub, args) {
468
421
  return pipelineInitCommand(args);
469
422
  case 'validate':
470
423
  return pipelineValidateCommand(args);
471
- case 'repin-orm': {
472
- const { pipelineRepinOrmCommand } = await import('./repin-orm.js');
473
- return pipelineRepinOrmCommand(args);
474
- }
475
424
  case 'codegen': {
476
425
  const codegenSub = args.positional[0];
477
426
  if (codegenSub === 'tables') {
@@ -1,6 +1,6 @@
1
1
  import type { ParsedArgs } from '../process/commands.js';
2
2
  type DiscoveryCommand = 'list' | 'assets' | 'search' | 'describe' | 'schema' | 'sample' | 'query';
3
- export declare const PIPELINE_DISCOVERY_USAGE = " seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]\n list pipeline repositories (default 50 per page), health and descriptions\n\n seq-studio pipeline assets -e <env> [--repo <namespace>/<name>] [--json]\n discover exact asset IDs from the latest declared specs; --repo filters\n both assets and the SDK export. Declarations may not be deployed yet.\n\n seq-studio pipeline search <query> -e <env> [--target <id>] [--repo <namespace>/<name>]\n [--limit 1..100] [--offset N] [--json]\n search active asset/column names and descriptions without contacting Databricks\n Case-insensitive literal text (1..200 characters); default 20 assets per page.\n\n seq-studio pipeline describe <asset> -e <env> [--target <id>] [--repo <namespace>/<name>] [--json]\n read active deployed descriptions and declared columns without contacting Databricks\n Includes deployment/source provenance; physical schema is not verified.\n\n seq-studio pipeline schema <asset> -e <env> [--target <id>] [--json]\n read observed columns, types and available descriptions from the active deployment\n\n seq-studio pipeline sample <asset> -e <env> [--target <id>] [--limit 1..100] [--json]\n preview rows (default 25); output reports deployment and truncation\n\n seq-studio pipeline query <asset> --sql <sql> -e <env> [--target <id>] [--limit 1..1000] [--json]\n run read-only SQL against the virtual relation asset (default limit 1000)\n Example: --sql 'SELECT * FROM asset LIMIT 5'. Cross-asset joins are unsupported.\n\n Discovery requires staff access. Search, then describe a relevant asset; use\n schema to verify physical columns, then sample and query values before authoring.\n Metadata reflects active deployments, not unactivated edits. Descriptions do not prove keys\n or relationships. Use --json for the full response, including deployment context.\n -e selects the connection; --target selects its logical deployment target when needed.\n";
3
+ export declare const PIPELINE_DISCOVERY_USAGE = " seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]\n list pipeline repositories (default 50 per page), health and descriptions\n\n seq-studio pipeline assets -e <env> [--repo <namespace>/<name>] [--json]\n discover exact asset IDs from the latest declared specs; --repo filters\n both assets and the SDK export. Declarations may not be deployed yet.\n\n seq-studio pipeline search <query> -e <env> [--target <id>] [--repo <namespace>/<name>]\n [--limit 1..100] [--offset N] [--json]\n search active asset/column names and descriptions without contacting Databricks\n Case-insensitive literal text (1..200 characters); default 20 assets per page.\n\n seq-studio pipeline describe <asset> -e <env> [--target <id>] [--repo <namespace>/<name>] [--json]\n read active deployed descriptions and declared columns without contacting Databricks\n Includes deployment/source provenance; physical schema is not verified.\n\n seq-studio pipeline schema <asset> -e <env> [--target <id>] [--repo <namespace>/<name>] [--json]\n read observed columns, types and available descriptions from the active deployment\n\n seq-studio pipeline sample <asset> -e <env> [--target <id>] [--repo <namespace>/<name>] [--limit 1..100] [--json]\n preview rows (default 25); output reports deployment and truncation\n\n seq-studio pipeline query <asset> --sql <sql> -e <env> [--target <id>] [--repo <namespace>/<name>] [--limit 1..1000] [--json]\n run read-only SQL against the virtual relation asset (default limit 1000)\n Example: --sql 'SELECT * FROM asset LIMIT 5'. Cross-asset joins are unsupported.\n\n Discovery requires staff access. Search, then describe a relevant asset; use\n schema to verify physical columns, then sample and query values before authoring.\n Metadata reflects active deployments, not unactivated edits. Descriptions do not prove keys\n or relationships. Use --json for the full response, including deployment context.\n -e selects the connection; --target selects its logical deployment target when needed.\n";
4
4
  export declare function runPipelineDiscoveryCommand({ sub, args }: {
5
5
  sub: DiscoveryCommand;
6
6
  args: ParsedArgs;
@@ -21,13 +21,13 @@ export const PIPELINE_DISCOVERY_USAGE = ` seq-studio pipeline list -e <env> [--
21
21
  read active deployed descriptions and declared columns without contacting Databricks
22
22
  Includes deployment/source provenance; physical schema is not verified.
23
23
 
24
- seq-studio pipeline schema <asset> -e <env> [--target <id>] [--json]
24
+ seq-studio pipeline schema <asset> -e <env> [--target <id>] [--repo <namespace>/<name>] [--json]
25
25
  read observed columns, types and available descriptions from the active deployment
26
26
 
27
- seq-studio pipeline sample <asset> -e <env> [--target <id>] [--limit 1..100] [--json]
27
+ seq-studio pipeline sample <asset> -e <env> [--target <id>] [--repo <namespace>/<name>] [--limit 1..100] [--json]
28
28
  preview rows (default 25); output reports deployment and truncation
29
29
 
30
- seq-studio pipeline query <asset> --sql <sql> -e <env> [--target <id>] [--limit 1..1000] [--json]
30
+ seq-studio pipeline query <asset> --sql <sql> -e <env> [--target <id>] [--repo <namespace>/<name>] [--limit 1..1000] [--json]
31
31
  run read-only SQL against the virtual relation asset (default limit 1000)
32
32
  Example: --sql 'SELECT * FROM asset LIMIT 5'. Cross-asset joins are unsupported.
33
33
 
@@ -68,9 +68,9 @@ function validateDiscoveryArguments({ sub, args }) {
68
68
  const readsAsset = sub === 'describe' || sub === 'schema' || sub === 'sample' || sub === 'query';
69
69
  const readsPositional = readsAsset || sub === 'search';
70
70
  const options = {
71
- list: ['limit', 'offset'], assets: ['repo'], schema: ['target'],
71
+ list: ['limit', 'offset'], assets: ['repo'], schema: ['target', 'repo'],
72
72
  search: ['target', 'repo', 'limit', 'offset'], describe: ['target', 'repo'],
73
- sample: ['target', 'limit'], query: ['target', 'limit', 'sql'],
73
+ sample: ['target', 'repo', 'limit'], query: ['target', 'repo', 'limit', 'sql'],
74
74
  };
75
75
  const allowed = new Set(['e', 'env', 'json', ...options[sub]]);
76
76
  for (const flag of Object.keys(args.flags)) {
@@ -220,7 +220,7 @@ export async function runPipelineDiscoveryCommand({ sub, args }) {
220
220
  const target = await resolvePipelineTarget({ args, env, token });
221
221
  const result = await postJson({
222
222
  ...client, path: '/api/data-pipelines/assets/query',
223
- body: { assetId: args.positional[0], environment: target.id, mode: sub, ...(options.sql !== undefined ? { sql: options.sql } : {}), ...(options.limit !== undefined ? { limit: options.limit } : {}) },
223
+ body: { assetId: args.positional[0], environment: target.id, mode: sub, ...(options.repo !== undefined ? { repo: options.repo } : {}), ...(options.sql !== undefined ? { sql: options.sql } : {}), ...(options.limit !== undefined ? { limit: options.limit } : {}) },
224
224
  });
225
225
  if (options.json)
226
226
  console.log(JSON.stringify(result, null, 2));
@@ -1,9 +1,6 @@
1
- import { type LatticeBundle, type LatticeBundleSummary } from '@sequenceholdings/lattice/bundle';
1
+ import { type ResolveProcessPin, type LatticeBundle, type LatticeBundleSummary } from '@sequenceholdings/lattice/bundle';
2
2
  import type { LoadedProcess } from './discover.js';
3
- export type ResolveProcessPin = (processId: string, version?: string) => Promise<{
4
- version: string;
5
- bundleHash: string;
6
- } | null>;
3
+ export type { ResolveProcessPin };
7
4
  export interface BuildBundleOptions {
8
5
  resolveProcessPin?: ResolveProcessPin;
9
6
  /** Override git provenance instead of reading from the local working tree. */