@sequenceholdings/studio-cli 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -139,8 +139,8 @@ the artifact folder's `.artifact-studio/config.json` `defaultEnv` (set by
139
139
  ## App bundle commands
140
140
 
141
141
  A single `sequence.app.yml` defines the deployable contents of an app: ORM
142
- namespaces, managed functions, typed agents, Lattice processes, Data Pipelines,
143
- and Artifact Studio UIs. Shared packages are declared separately as build inputs.
142
+ namespaces, Workspaces V2 workspaces, managed functions, typed agents, Lattice
143
+ processes, Data Pipelines, and Artifact Studio UIs. Shared packages are declared separately as build inputs.
144
144
  Each primitive keeps its own runtime definition; the app manifest controls source
145
145
  locations, dependencies, and deployment selection.
146
146
 
@@ -155,7 +155,7 @@ locations, dependencies, and deployment selection.
155
155
  | `seq-studio add package <name>` | Add a shared TypeScript package to the manifest and pnpm workspace |
156
156
  | `seq-studio deploy -e <env> [--yes] [--only id1,id2] [--dry-run]` | Validate and deploy the selected app graph, including prerequisites |
157
157
 
158
- `init` accepts `orm`, `function`, `agent`, `process`, `pipeline`, and `artifact` as
158
+ `init` accepts `orm`, `workspace`, `function`, `agent`, `process`, `pipeline`, and `artifact` as
159
159
  a comma-separated `--with` list or boolean flags (`--agent --process`). The first
160
160
  function defaults to `hello` (`--function-name` changes it). Agent, process, and
161
161
  pipeline folders use the app name. Pipelines default to transformation stages;
@@ -185,9 +185,9 @@ pnpm install
185
185
  seq-studio deploy -e <env> --only approvals-process --yes
186
186
  ```
187
187
 
188
- Creating a default GCS-backed platform git-service repo (`seq-studio repos create`
189
- without `--git-backend walgit`, or the Repositories UI) seeds it with a Sequence
190
- app README. A fresh clone with that seed README is a valid `init .` target. Init
188
+ Creating a platform git-service repo without `--git-backend` (`seq-studio repos
189
+ create`, or the Repositories UI) seeds it with a Sequence app README on either
190
+ backend; only an explicit `--git-backend walgit` starts empty. A fresh clone with that seed README is a valid `init .` target. Init
191
191
  preserves its git remote and existing ignores, replaces the seed README, and
192
192
  refuses ordinary non-empty repositories. The initial UI stays at `artifact/`;
193
193
  additional UIs live under `artifacts/<name>/`.
@@ -266,6 +266,35 @@ transitive prerequisites; use app primitive IDs, not agent/process runtime IDs.
266
266
  Agent and process entries may set `only` to select definitions from their source
267
267
  folder. Agent and pipeline entries may set `target` to select a deployment identity.
268
268
 
269
+ A `workspace` primitive is a Workspaces V2 workspace. Its `path` holds the
270
+ `workspace.yml` that `seq-studio storage init` writes, and the entry's `name`
271
+ must match `workspace.name` in it. Deploy runs `seq-studio storage apply`, an
272
+ idempotent upsert by name, so it needs the same authority as applying the file
273
+ yourself. Workspaces are never part of Application roles: their access depends
274
+ on the folders and files in them and is managed in Workspaces V2.
275
+
276
+ ### Runtime dependencies (`uses`)
277
+
278
+ `depends_on` orders deploys. `uses` says what a primitive uses while it runs,
279
+ and draws the Application's **Dependencies** graph in Atlas. It never orders
280
+ deploys and grants nothing, so cycles are fine:
281
+
282
+ ```yaml
283
+ primitives:
284
+ - { id: loan-docs, kind: workspace, path: workspaces/loan-docs, name: loan-desk-docs }
285
+ - id: desk-api
286
+ kind: function
287
+ path: functions/desk-api
288
+ slug: loan-desk-api
289
+ uses:
290
+ - { primitive: loan-data, as: reads/writes } # `as` labels the edge
291
+ - { primitive: loan-docs, as: stores files }
292
+ ```
293
+
294
+ Every primitive appears in the graph, including agents, pipelines and
295
+ workspaces. A workspace that doesn't exist in the target environment is flagged
296
+ there. `uses` needs schema version 2 or later.
297
+
269
298
  Before the first ORM deployment, and after changing its schema, run
270
299
  `seq-studio orm generate <namespace-path>` followed by
271
300
  `seq-studio orm diff <namespace-path>`. Review and commit the generated migration
@@ -281,9 +310,11 @@ checks do not deploy resources. Official artifact deployments require the full a
281
310
  checkout to be clean on `main`, including shared packages and the app manifest;
282
311
  local deployments retain the local development path.
283
312
 
284
- Pipeline entries require `repo: pipelines/<name>` and `ref`; they may specify
285
- `target`; their `path` is the local authoring directory. Commit and push pipeline
286
- source to the declared platform git-service release unit before deploying. The
313
+ Pipeline entries require `repo: pipelines/<name>` or `repo: apps/<name>` and `ref`;
314
+ they may specify `target`. For `apps/<name>` repositories, `path` is both the local
315
+ authoring directory and the contained pipeline root in the remote monorepo. A
316
+ dedicated `pipelines/<name>` repository retains its historical repository-root
317
+ package. Commit and push pipeline source before deploying. The
287
318
  app reuses the existing pipeline release workflow and waits for completion.
288
319
  Use `--approved-by <caller-sub>` when the target requires recorded approval and
289
320
  `--wait-timeout 2h` to control polling. Pipeline deployment plants jobs; it does
@@ -299,6 +330,97 @@ selection, and plan-only dry run. Change `schema_version` to `2` to opt into the
299
330
  new dependency/preflight semantics, then declare shared packages and configure a
300
331
  root pnpm workspace if you want shared builds. Adding an agent, process, or pipeline to a version 1 app upgrades the manifest to version 2 and raises its minimum CLI version; it preserves existing package files and deployment-order preferences. Existing function/artifact/ORM additions retain version 1. There is no automatic migration of existing dependency files or lockfiles.
301
332
 
333
+ ### Application roles (schema version 3)
334
+
335
+ Version 3 is version 2 plus `roles`. Deploying it also registers the app with
336
+ Atlas as an **Application**, so granting someone one Application role gives them
337
+ everything the app needs: each member's end-user access plus the member roles
338
+ and capabilities you bundle. Grants are made in Atlas, never in the manifest.
339
+
340
+ ```yaml
341
+ schema_version: 3
342
+ # ...app, studio, primitives as in version 2...
343
+ roles:
344
+ definitions:
345
+ member:
346
+ description: Can use Loan Tools
347
+ includes:
348
+ - { primitive: admin-ui, role: end_user }
349
+ - { primitive: score-fn, role: invoker } # end_user also works
350
+ - { primitive: loans-orm, role: end_user }
351
+ reviewer:
352
+ inherits: [member]
353
+ includes:
354
+ - { primitive: admin-ui, role: approver }
355
+ - { primitive: loans-orm, capability: loan-read }
356
+ ```
357
+
358
+ - Includes can reach `artifact`, `function`, `orm`, and `process` primitives.
359
+ `role: end_user` is a member's end-user access; `invoker` is accepted on
360
+ functions and processes. Any other `role` is one of the member's registered
361
+ roles, and `capability` one of its capabilities. Including a member role or
362
+ capability also grants that member's end-user access.
363
+ - A `process` primitive offers only end-user access (starting runs), and a role
364
+ can include it only when it deploys exactly one process, `only: [<process-id>]`:
365
+
366
+ ```yaml
367
+ - { id: approval-flow, kind: process, path: processes/approval, only: [loan-approval] }
368
+ ```
369
+ - The Application registers after every primitive deploys; if one fails, it
370
+ is skipped. Registering requires capability admin on every member (owner,
371
+ for a process), checked on every deploy.
372
+ - Each role is created the first time a deploy sees it. After that Atlas owns
373
+ it: edit it in Atlas, and the deploy reports a changed definition here as
374
+ drift instead of applying it.
375
+ - Members are synced every deploy. Removing one removes every role's access
376
+ into it.
377
+ - A Next.js artifact is an ordinary `artifact` member. Its server calls ORM and
378
+ functions as the signed-in user unless it declares `service_account`, so a
379
+ role that includes it should also include `end_user` on every namespace and
380
+ `invoker` on every function its `server.capabilities` reach (the same holds
381
+ for any artifact's browser `capabilities`). The deploy prints an
382
+ `access_gap` warning for each one a role misses; it never adds them for you.
383
+
384
+ ### Collaborator roles (schema version 3)
385
+
386
+ `roles` bundle use. `collaborators` bundle the tiers that let people change
387
+ the members: one grant can make someone a writer on the UI, an editor on its
388
+ function, and a writer on its namespace. The two never mix: a collaborator role
389
+ includes only member tiers and inherits only other collaborator roles.
390
+
391
+ ```yaml
392
+ collaborators:
393
+ definitions:
394
+ reviewer:
395
+ description: Reads the code and data model
396
+ includes:
397
+ - { primitive: admin-ui, tier: reader }
398
+ - { primitive: loans-orm, tier: reader }
399
+ maintainer:
400
+ description: Ships changes to the desk, its API and its data model
401
+ inherits: [reviewer]
402
+ includes:
403
+ - { primitive: admin-ui, tier: writer }
404
+ - { primitive: score-fn, tier: editor }
405
+ - { primitive: loans-orm, tier: writer }
406
+ - { primitive: approval-flow, tier: editor }
407
+ ```
408
+
409
+ | Kind | Tiers a collaborator role can bundle |
410
+ |---|---|
411
+ | `artifact` | `reader`, `writer` |
412
+ | `function` | `reader`, `editor` |
413
+ | `orm` | `reader`, `writer` |
414
+ | `process` (exactly one, `only: [<process-id>]`) | `editor` |
415
+
416
+ - Never `admin` or `owner`: admin can share a member and bundle it into other
417
+ Applications, so it stays a direct grant. Workspaces are never bundled.
418
+ - Every tier includes use, so a maintainer can always use what they maintain.
419
+ - Consent is stricter than for runtime roles: bundling a member's tiers needs
420
+ **admin** on it (owner, for a process), checked on every deploy.
421
+ - Only the Application's admins create, edit and grant collaborator roles in
422
+ Atlas (runtime roles need only its capability admins and grant managers).
423
+
302
424
  ## Agent commands
303
425
 
304
426
  Typed agent repositories export one or more `defineAgent(...)` values from files
@@ -730,23 +852,46 @@ not members of these read adapters.
730
852
  ### ORM data access
731
853
 
732
854
  A function declares its ORM Data API reach in `capabilities.data`, grouped by
733
- namespace: `tables` it may read, v1 `actions` and ORM v2 persisted `operations`
734
- it may invoke, and whether raw read `query` is allowed. At invoke time the
735
- platform mints a short-lived data token scoped to exactly these refs — an
736
- operation is scoped as `<namespace>/ops/<OperationName>` (the GraphQL operation
737
- name from the namespace's `graphql/` documents, case-sensitive), and anything
738
- undeclared is denied by the Data API. A function that reaches any namespace
739
- must also attach a top-level `service_account`:
855
+ namespace. Reads and mutations use different scopes:
856
+
857
+ - `tables` lists namespace table and view names that persisted queries may
858
+ read. Cover every relation required by the compiled query, including linked
859
+ selections and policy dependencies. Use definition names such as
860
+ `my_profile`, not GraphQL field names such as `myProfile` or physical backing
861
+ table names.
862
+ - `operations` lists persisted **mutation** names, case-sensitive. Each mints
863
+ a `<namespace>/ops/<OperationName>` scope. Listing a query name here does not
864
+ authorize its reads.
865
+ - `actions` lists legacy v1 actions. `query` controls separate legacy raw SQL
866
+ access; leave it `false` for persisted GraphQL queries and mutations.
867
+
868
+ For example, if `GetMyProfile` reads only the `my_profile` view and
869
+ `UpdateMyProfile` is a persisted mutation, declare:
740
870
 
741
871
  ```yaml
742
- service_account: lucky-svc
872
+ service_account: directory-runtime
743
873
  capabilities:
744
874
  data:
745
- lucky:
746
- tables: [lucky_draws]
747
- operations: [RollLuckyNumber]
875
+ directory:
876
+ tables: [my_profile]
877
+ operations: [UpdateMyProfile]
878
+ query: false
748
879
  ```
749
880
 
881
+ `tables` grants relation-level read scope, not a named-query allowlist. Other
882
+ registered queries whose required relations fit that scope can pass the same
883
+ scope check. Keep the handler's accepted operation names explicit. The caller
884
+ must still satisfy namespace runtime access, operation requirements, and row
885
+ policies; declaring a table does not grant access to every row.
886
+
887
+ A function that reaches a namespace must attach a top-level `service_account`
888
+ provided by its administrator. Caller-mode execution remains on behalf of the
889
+ invoking user; attaching the account does not select service mode.
890
+
891
+ A successful direct `seq-studio orm execute` call does not test a function's
892
+ delegated scope. If the same read fails through the function with a 403, check
893
+ the deployed `tables` declaration before requesting broader user grants.
894
+
750
895
  ## Managed Secret commands
751
896
 
752
897
  | Command | What it does |
@@ -769,6 +914,10 @@ The API requires Managed Functions Admin on that org.
769
914
  the `@sequenceholdings/artifact-studio` library (its `./cli` `runCli` export),
770
915
  routed through `~/.config/lattice/config.toml` and the shared platform login.
771
916
 
917
+ Use `seq-studio artifact --help` or add `--help` / `-h` to any artifact command
918
+ (for example, `seq-studio artifact init --help`) to print usage and exit
919
+ successfully. Help does not initialize files, authenticate, or deploy.
920
+
772
921
  | Command | Underlying `runCli` verb |
773
922
  |---------|--------------------------|
774
923
  | `seq-studio artifact init <dir> [--template react-vite\|nextjs]` | `init <dir>` — defaults to the existing React/Vite scaffold |
@@ -1007,7 +1156,7 @@ JSON API — the same repos `--repo <ns>/<name>` sources build from.
1007
1156
  | `seq-studio repos list -e <env> [--namespace <slug>] [--mine]` | repos visible on the environment (permission-filtered) |
1008
1157
  | `seq-studio repos namespaces [create <slug>] -e <env>` | list namespaces, or create one (creator becomes owner) |
1009
1158
  | `seq-studio repos show <ns>/<name> -e <env>` | detail: id, branches, clone URL; artifact project id when slug matches |
1010
- | `seq-studio repos create <ns>/<name> -e <env> [--default-branch <b>] [--git-backend gcs_isomorphic\|walgit]` | create a repo (GCS default + seed README; `walgit` starts empty on `main`; needs namespace write) |
1159
+ | `seq-studio repos create <ns>/<name> -e <env> [--default-branch <b>] [--git-backend walgit]` | create a repo, seeded with a README on `main`. The server picks the backend (walgit wherever it is configured). `--git-backend walgit` creates it empty, for pushing existing history. Needs namespace write. |
1011
1160
  | `seq-studio repos clone <ns>/<name> \| --url <clone-url> \| --id <uuid> -e <env> [--ref <r>] [--output <dir>] [--force] [--full]` | smart-HTTP `git clone --depth 1` when `ATLAS_GIT_PAT` is set (`--full` fetches history; a commit SHA stays full). `--url`/`--id` need no seqapi. Otherwise JSON materialize + PAT hint. `--out` remains an alias for `--output`. |
1012
1161
  | `seq-studio repos pull <ns>/<name> -e <env> [--ref <r>] [--out <dir>] [--force]` | always materialize via JSON API (no `.git` dir); refuses a non-empty destination unless `--force` |
1013
1162
  | `seq-studio repos delete <ns>/<name> -e <env> [--yes]` | delete a repo — interactive confirm unless `--yes` |
@@ -1041,23 +1190,37 @@ check names in Settings or with `repos ci require`/`repos ci import`.
1041
1190
 
1042
1191
  ## Pipeline commands
1043
1192
 
1193
+ > **Availability:** Data Pipelines is Preview with staff access. These commands
1194
+ > do not establish a self-service workflow for other accounts; confirm support
1195
+ > for your environment with your administrator.
1196
+
1044
1197
  `seq-studio pipeline <sub>` authors and validates Data Pipelines **stage
1045
1198
  specs** — the typed contracts (`<name>.stage.yml`) in either a dedicated
1046
1199
  Pipeline repo (`pipelines/<domain>`) or an app monorepo (`apps/<app>`).
1047
1200
  Validation logic lives in
1048
1201
  `@sequenceholdings/pipeline-spec` (an optional peer, like `@sequenceholdings/orm`);
1049
- install it alongside the CLI to use this family.
1202
+ install it alongside the CLI for local spec authoring and validation. The
1203
+ discovery and data-reading commands below do not require the optional SDK.
1050
1204
 
1051
1205
  | Command | What it does |
1052
1206
  |---------|--------------|
1207
+ | `seq-studio pipeline list -e <env> [--limit <count>] [--offset <count>] [--json]` | List available pipelines and their source repositories; default 50 results, maximum 200, with the next offset shown when more exist |
1208
+ | `seq-studio pipeline search <text> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--limit <count>] [--offset <count>] [--json]` | Search deployed asset and column names/descriptions without contacting Databricks; default 20 assets, maximum 100 |
1209
+ | `seq-studio pipeline describe <assetId> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--json]` | Read an active deployment's table description, documented/declared columns, and source provenance without contacting Databricks |
1210
+ | `seq-studio pipeline assets -e <env> [--repo <namespace>/<slug>] [--json]` | Export assets from the latest registered declarations for contract inspection; an asset need not be deployed |
1211
+ | `seq-studio pipeline schema <assetId> -e <env> [--target <id>] [--json]` | Inspect the deployed asset's columns, types, nullability, and table/column descriptions when returned by the server |
1212
+ | `seq-studio pipeline sample <assetId> -e <env> [--target <id>] [--limit <rows>] [--json]` | Preview rows from the deployed asset; default 25, capped at 100 by the server |
1213
+ | `seq-studio pipeline query <assetId> --sql <sql> -e <env> [--target <id>] [--limit <rows>] [--json]` | Run a read-only query against the virtual relation `asset`; default and maximum 1,000 result rows |
1053
1214
  | `seq-studio pipeline init --type ingestion\|transformation\|serving <name> [--dir <dir>]` | Scaffold `<name>.stage.yml` (commented per-kind template) plus a `src/` Databricks-notebook entrypoint stub (begins with `# Databricks notebook source`; serving stages are declarative — no stub). Refuses to overwrite an existing spec |
1054
1215
  | `seq-studio pipeline validate [dir] [--assets <file\|url>] [--orm-contracts <file\|url>] [--json]` | Run the full offline spec gate: envelope + body validation, `schema_ref` resolution, and repo-level graph validation (reference resolution, single-writer, cycles, column subsets, serving projection checks). Auto-loads `orm-contracts.json` from the pipeline dir when present. Exit 0/1 |
1055
1216
  | `seq-studio pipeline repin-orm [dir] -e <env> [--target <id>] [--dry-run]` | Resolve the environment's pipeline target (or use `--target` when ambiguous), fetch its active ORM v2 contracts, verify those serving projections remain compatible, then update `orm-contracts.json` and their `satisfies.content_hash` pins. Refuses to write when compatibility fails |
1056
- | `seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha\|branch> -e <env> [--target <id>] [--json]` | Enqueue and poll a durable Pipeline plan (materialize → SDK/`validateSpecGraph` → compile → live-diff → provision findings). `<namespace>` is `pipelines` or `apps`. Fails closed listing **every** missing target binding (alert channels, workspace, Databricks `source.credential`) plus Data Sync edge-worker machine/operation/`credEnvFamilies` mismatches before registry writes. Does **not** run Databricks `bundle validate` (that is a Trigger deploy-path hard gate). Exit 1 on destructive findings (CI-safe). `--json` emits the completed stable plan envelope |
1057
- | `seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha\|branch> -e <env> [--target <id>] [--approved-by <sub>] [--allow-destructive <resource-key> ...] [--run-now] [--wait-timeout <duration>] [--no-wait]` | Plan then enqueue deploy; Trigger runs `bundle validate` then `bundle deploy` against reviewed bytes. `<namespace>` is `pipelines` or `apps`. Default is plant-only (jobs are created, not run). `--run-now` runs in-unit producer roots after bundle deploy; serving refresh provisioning completes before producer trigger.after tasks can run. If a producer fails, the terminal status includes the remote Databricks task/event error when available. `--allow-destructive` is repeatable and must exactly name every deletion/recreation finding in the immutable plan; only authenticated `@seqholdings.com` users may authorize it; permission, ownership, schedule-drift, and provisioning blockers cannot be overridden. Polls to terminal unless `--no-wait`. Targets that require approval need `--approved-by` naming the authenticated caller. |
1217
+ | `seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha\|branch> [--root <directory>] -e <env> [--target <id>] [--json]` | Enqueue and poll a durable Pipeline plan (materialize → SDK/`validateSpecGraph` → compile → live-diff → provision findings). `<namespace>` is `pipelines` or `apps`. Fails closed listing **every** missing target binding (alert channels, workspace, Databricks `source.credential`) plus Data Sync edge-worker machine/operation/`credEnvFamilies` mismatches before registry writes. Does **not** run Databricks `bundle validate` (that is a Trigger deploy-path hard gate). Exit 1 on destructive findings (CI-safe). `--json` emits the completed stable plan envelope |
1218
+ | `seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha\|branch> [--root <directory>] -e <env> [--target <id>] [--approved-by <sub>] [--allow-destructive <resource-key> ...] [--run-now] [--wait-timeout <duration>] [--no-wait]` | Plan then enqueue deploy; Trigger runs `bundle validate` then `bundle deploy` against reviewed bytes. `<namespace>` is `pipelines` or `apps`. Default is plant-only (jobs are created, not run). `--run-now` runs in-unit producer roots after bundle deploy; serving refresh provisioning completes before producer trigger.after tasks can run. If a producer fails, the terminal status includes the remote Databricks task/event error when available. `--allow-destructive` is repeatable and must exactly name every deletion/recreation finding in the immutable plan; only authenticated `@seqholdings.com` users may authorize it; permission, ownership, schedule-drift, and provisioning blockers cannot be overridden. Polls to terminal unless `--no-wait`. Targets that require approval need `--approved-by` naming the authenticated caller. |
1219
+
1220
+ `--root` selects a contained Pipeline package inside the repository. The directory becomes the package and Databricks bundle root, so its `*.stage.yml`, `src/`, manifests, contracts, schemas, and extra resources keep their normal root-relative layout. Each repository/root pair is an independent release unit; sibling pipelines and unrelated app files are not included in its bundle. Omitting `--root` preserves the historical whole-repository release unit.
1058
1221
  | `seq-studio pipeline status --deployment-id <id> -e <env> [--json]` | Fetch the current remote deployment status without changing it. Use this public command to continue monitoring after local polling stops |
1059
- | `seq-studio pipeline adopt --stage <slug> --ref <sha\|branch> -e <env> [--target <id>] --native-id <id> --approved-by <you> [--resource-key <key>] [--kind job\|dlt_pipeline] [--old-source-removal-pr <url>] [--repo <namespace>/<slug>]` | Bind a live Databricks job/pipeline into the stage without recreation (`bundle deployment bind` on Trigger). Always requires `--approved-by` naming the caller. When the key is still in the monorepo DAB, pass `--old-source-removal-pr` and follow the returned cutover checklist: unbind the old bundle state without deleting the remote, then remove its DAB declaration and add the target-specific adopted-resource entry in the same PR before redeploying. |
1060
- | `seq-studio pipeline unbind --stage <slug> --ref <sha\|branch> -e <env> [--target <id>] --approved-by <you> [--resource-key <key>] [--repo <namespace>/<slug>]` | Release an adopted binding on Trigger; the remote object stays live (never deleted) |
1222
+ | `seq-studio pipeline adopt --stage <slug> --ref <sha\|branch> [--root <directory>] -e <env> [--target <id>] --native-id <id> --approved-by <you> [--resource-key <key>] [--kind job\|dlt_pipeline] [--old-source-removal-pr <url>] [--repo <namespace>/<slug>]` | Bind a live Databricks job/pipeline into the stage without recreation (`bundle deployment bind` on Trigger). Always requires `--approved-by` naming the caller. When the key is still in the monorepo DAB, pass `--old-source-removal-pr` and follow the returned cutover checklist: unbind the old bundle state without deleting the remote, then remove its DAB declaration and add the target-specific adopted-resource entry in the same PR before redeploying. |
1223
+ | `seq-studio pipeline unbind --stage <slug> --ref <sha\|branch> [--root <directory>] -e <env> [--target <id>] --approved-by <you> [--resource-key <key>] [--repo <namespace>/<slug>]` | Release an adopted binding on Trigger; the remote object stays live (never deleted) |
1061
1224
  | `seq-studio pipeline run-now --stage <slug> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--json]` | Run the stage's active job or DLT pipeline immediately and print its Databricks run URL |
1062
1225
  | `seq-studio pipeline promote --stage <slug> --version <v> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--approved-by <you>] [--wait-timeout <duration>] [--no-wait]` | Promote a validated version to another target. Targets that require approval need `--approved-by`; `--repo` disambiguates a slug that exists in multiple Pipelines |
1063
1226
  | `seq-studio pipeline rollback --stage <slug> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--approved-by <you>] [--wait-timeout <duration>] [--no-wait]` | Redeploy the previously retired deployment's version. Targets that require approval need `--approved-by`. |
@@ -1066,6 +1229,46 @@ install it alongside the CLI to use this family.
1066
1229
  pipeline target advertised by that endpoint. It is optional when the alias
1067
1230
  matches a target id or when the endpoint has exactly one target.
1068
1231
 
1232
+ ### Discover inputs before authoring
1233
+
1234
+ For both people and agents, search deployed documentation to find likely inputs,
1235
+ then describe the relevant assets. Verify their physical schemas and values before
1236
+ authoring a transformation. Descriptions explain meaning; they do not establish
1237
+ uniqueness, relationships, or data quality.
1238
+
1239
+ ```bash
1240
+ # Fictional repository and asset; substitute IDs returned by discovery.
1241
+ seq-studio pipeline list -e <env>
1242
+ seq-studio pipeline search "source item" --repo pipelines/catalog -e <env>
1243
+ seq-studio pipeline describe catalog-ingest.items -e <env> --json
1244
+ seq-studio pipeline schema catalog-ingest.items -e <env>
1245
+ seq-studio pipeline sample catalog-ingest.items --limit 5 -e <env>
1246
+ seq-studio pipeline query catalog-ingest.items -e <env> \
1247
+ --sql 'SELECT status, COUNT(*) AS item_count FROM asset GROUP BY status'
1248
+ ```
1249
+
1250
+ `search` and `describe` read active durable deployment metadata without contacting
1251
+ a data engine. Merged YAML appears after its stage deployment becomes active.
1252
+ Both filter `--repo` on the server. Search pages results with `--limit`/`--offset`
1253
+ and returns up to five matching columns per asset plus `matchedColumnCount`;
1254
+ `describe` returns the full documented/declared column list.
1255
+
1256
+ Use `--json` for agents and scripts. Responses include the environment, deployment
1257
+ ID, source commit, repository, `source: "active_deployment"`, and
1258
+ `physicalSchemaVerified: false`. Optional `declaredType`/`declaredNullable` are
1259
+ contract declarations. Documented columns may be missing from physical data, and
1260
+ undocumented physical columns may be absent here. Use `schema` for live column
1261
+ verification, then `sample` and `query` for values. Schema reads annotate observed
1262
+ columns only; row queries do not infer descriptions for computed expressions.
1263
+
1264
+ `assets` exports the latest registered declarations, including undeployed assets.
1265
+ With `assets --repo`, the list, contract export, and total all match that repository.
1266
+
1267
+ `sample --limit` accepts an integer from 1 to 100; `query --limit` accepts 1 to
1268
+ 1,000. A row limit bounds returned results, not the amount of data an aggregate
1269
+ query scans. After inspection, author the stage and run
1270
+ `pipeline validate` before planning a deployment.
1271
+
1069
1272
  Unless `--no-wait` is set, `plan`, `deploy`, `promote`, and `rollback` report status or
1070
1273
  status-detail changes while waiting, then emit a 20-second progress heartbeat.
1071
1274
  Deploy, promote, and rollback wait up to 2 hours by default; pass
@@ -28,6 +28,12 @@ async function validatePrimitiveIdentity({ entry, path }) {
28
28
  actual = artifactIdentitySchema.parse(raw).artifact.project_id;
29
29
  expected = entry.project_id;
30
30
  }
31
+ else if (entry.kind === 'workspace' && entry.name) {
32
+ const { workspaceManifestSchema } = await import('@sequenceholdings/storage');
33
+ const raw = loadYaml(await readFile(join(path, 'workspace.yml'), 'utf8'));
34
+ actual = workspaceManifestSchema.parse(raw).workspace.name;
35
+ expected = entry.name;
36
+ }
31
37
  else if (entry.kind === 'orm' && entry.namespace) {
32
38
  if (existsSync(join(path, 'sequence.config.ts'))) {
33
39
  const { loadNamespaceFromDir } = await import('@sequenceholdings/orm/authoring');
@@ -49,19 +55,22 @@ async function validatePrimitiveIdentity({ entry, path }) {
49
55
  function requirePipelineSource({ entry }) {
50
56
  if (!entry.repo || !entry.ref) {
51
57
  throw new Error(`Pipeline "${entry.id}" requires repo and ref in sequence.app.yml. ` +
52
- 'Push its source to a pipelines/<name> repository and pin that repository/ref; ' +
58
+ 'Push its source to a pipelines/<name> or apps/<name> repository and pin that repository/ref; ' +
53
59
  'pipeline deployment reads committed source from the platform git service.');
54
60
  }
55
61
  return { repo: entry.repo, ref: entry.ref };
56
62
  }
63
+ function pipelineRoot(entry) {
64
+ return entry.repo?.startsWith('apps/') ? entry.path : undefined;
65
+ }
57
66
  /** Pin the source validated during preflight so a moving branch cannot swap it. */
58
67
  async function validatePipelineSource(args) {
59
68
  const { repo, ref } = requirePipelineSource(args);
60
69
  const { buildContext, clientOptions } = await import('../functions/commands.js');
61
70
  const context = await buildContext({ positional: [], flags: { env: args.env } });
62
71
  const [namespace, name] = repo.split('/');
63
- if (namespace !== 'pipelines' || !name || repo.split('/').length !== 2) {
64
- throw new Error(`Pipeline "${args.entry.id}" requires a pipelines/<name> repository.`);
72
+ if ((namespace !== 'pipelines' && namespace !== 'apps') || !name || repo.split('/').length !== 2) {
73
+ throw new Error(`Pipeline "${args.entry.id}" requires a pipelines/<name> or apps/<name> repository.`);
65
74
  }
66
75
  const source = await resolveArtifactSource({ kind: 'git-service', namespace, name, ref }, { ...clientOptions(context), ...(context.authMode ? { authMode: context.authMode } : {}) });
67
76
  try {
@@ -70,7 +79,8 @@ async function validatePipelineSource(args) {
70
79
  throw new Error(`Pipeline "${args.entry.id}" source did not resolve to a commit; retry with a full commit SHA.`);
71
80
  }
72
81
  const { pipelineValidateCommand } = await import('../pipeline/commands.js');
73
- const code = await pipelineValidateCommand({ positional: [source.dir], flags: {} });
82
+ const root = pipelineRoot(args.entry);
83
+ const code = await pipelineValidateCommand({ positional: [root ? join(source.dir, root) : source.dir], flags: {} });
74
84
  assertValidationSucceeded({ args, code });
75
85
  console.log(`[seq-studio] pinned pipeline ${args.entry.id}: ${repo}@${commit}`);
76
86
  return { ...args.entry, ref: commit };
@@ -124,6 +134,11 @@ export async function validateAppPrimitive(args) {
124
134
  code = await lintCommand({ positional: [], flags: { dir: path, offline: true, ...selectedFlags(args) } });
125
135
  break;
126
136
  }
137
+ case 'workspace': {
138
+ const { runStorageCommand } = await import('../storage/commands.js');
139
+ code = await runStorageCommand('validate', { positional: [join(path, 'workspace.yml')], flags: {} });
140
+ break;
141
+ }
127
142
  case 'artifact': {
128
143
  if (env !== 'local')
129
144
  assertActiveDeployProvenance(localGitMetadata(path));
@@ -161,10 +176,11 @@ export async function createDefaultDeployers() {
161
176
  async pipeline(args) {
162
177
  const { repo, ref } = requirePipelineSource(args);
163
178
  const { env, approvedBy, waitTimeout } = args;
179
+ const root = pipelineRoot(args.entry);
164
180
  return pipelineDeployCommand({ positional: [], flags: {
165
181
  // Validated above. Preserve the primitive's repo-only deployment
166
182
  // boundary and wait for terminal deployment status before dependents.
167
- repo, ref, env, ...selectedFlags(args),
183
+ repo, ref, ...(root ? { root } : {}), env, ...selectedFlags(args),
168
184
  ...(approvedBy ? { 'approved-by': approvedBy } : {}),
169
185
  ...(waitTimeout ? { 'wait-timeout': waitTimeout } : {}),
170
186
  } });
@@ -172,5 +188,11 @@ export async function createDefaultDeployers() {
172
188
  async artifact({ path, env }) {
173
189
  return runArtifactCommand('deploy', [path, '--env', env]);
174
190
  },
191
+ async workspace({ path, env }) {
192
+ // `storage apply` is an idempotent upsert by name: creates the workspace
193
+ // the first time, updates its description after.
194
+ const { runStorageCommand } = await import('../storage/commands.js');
195
+ return runStorageCommand('apply', { positional: [join(path, 'workspace.yml')], flags: { env } });
196
+ },
175
197
  };
176
198
  }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Registering a schema_version 3 app with Atlas as an Application, after its
3
+ * primitives deploy (`PUT /api/custom-roles/applications/<app.id>`).
4
+ *
5
+ * The YAML's `role: end_user | invoker` alias becomes the server's single
6
+ * `{ type: 'end_user' }` spelling here, so the API has one contract. Members
7
+ * are the artifact/function/ORM primitives and single-process entries,
8
+ * referenced by the stable names that resolve in every environment.
9
+ */
10
+ import { type ClientOptions } from '../atlas-client.js';
11
+ import { type AppManifest, type PrimitiveEntry } from './manifest.js';
12
+ type MemberKind = 'artifact' | 'function' | 'orm' | 'lattice';
13
+ export interface ApplicationDeployMember {
14
+ key: string;
15
+ kind: MemberKind;
16
+ ref: string;
17
+ }
18
+ export type ApplicationDeployInclude = {
19
+ type: 'end_user';
20
+ member: string;
21
+ } | {
22
+ type: 'role';
23
+ member: string;
24
+ key: string;
25
+ } | {
26
+ type: 'capability';
27
+ member: string;
28
+ key: string;
29
+ } | {
30
+ type: 'tier';
31
+ member: string;
32
+ tier: string;
33
+ };
34
+ type ApplicationDeployRole = {
35
+ description?: string;
36
+ inherits: string[];
37
+ includes: ApplicationDeployInclude[];
38
+ };
39
+ /** Every primitive, members or not — the nodes of the Dependencies graph. */
40
+ export interface ApplicationDeployComponent {
41
+ key: string;
42
+ kind: PrimitiveEntry['kind'];
43
+ /** The stable name Atlas can resolve: slug, project id, namespace, workspace name, or process id. */
44
+ ref?: string;
45
+ }
46
+ /** A runtime dependency (`uses`): `from` uses `to` while it runs. */
47
+ export interface ApplicationDeployEdge {
48
+ from: string;
49
+ to: string;
50
+ label?: string;
51
+ }
52
+ export interface ApplicationDeployBody {
53
+ title: string;
54
+ description?: string;
55
+ members: ApplicationDeployMember[];
56
+ components: ApplicationDeployComponent[];
57
+ edges: ApplicationDeployEdge[];
58
+ roles: Record<string, ApplicationDeployRole>;
59
+ /** Collaborator roles: member tiers only. */
60
+ collaborators: Record<string, ApplicationDeployRole>;
61
+ }
62
+ export interface ApplicationDeployWarning {
63
+ type: string;
64
+ role: string;
65
+ /** `collaborator` for a collaborator role; older servers send none. */
66
+ kind?: string;
67
+ detail: string;
68
+ }
69
+ export declare function buildApplicationDeployBody(manifest: AppManifest): ApplicationDeployBody;
70
+ export type ApplicationRegistration = {
71
+ status: 'registered';
72
+ created: boolean;
73
+ warnings: ApplicationDeployWarning[];
74
+ } | {
75
+ status: 'failed';
76
+ message: string;
77
+ };
78
+ export type RegisterApplication = (args: {
79
+ manifest: AppManifest;
80
+ env: string;
81
+ }) => Promise<ApplicationRegistration>;
82
+ export declare function putApplication({ client, manifest, }: {
83
+ client: ClientOptions;
84
+ manifest: AppManifest;
85
+ }): Promise<ApplicationRegistration>;
86
+ export declare function logApplicationRegistration({ appId, registration, }: {
87
+ appId: string;
88
+ registration: ApplicationRegistration;
89
+ }): void;
90
+ /** Default registrar: authenticate against `env` the same way the primitive deployers do. */
91
+ export declare const registerApplicationWithAtlas: RegisterApplication;
92
+ export {};