@sequenceholdings/studio-cli 0.2.1 → 0.3.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 (49) hide show
  1. package/README.md +333 -29
  2. package/dist/access/commands.d.ts +3 -0
  3. package/dist/access/commands.js +91 -0
  4. package/dist/app/adapters.js +27 -5
  5. package/dist/app/application-registration.d.ts +96 -0
  6. package/dist/app/application-registration.js +146 -0
  7. package/dist/app/deploy.d.ts +8 -0
  8. package/dist/app/deploy.js +42 -8
  9. package/dist/app/manifest-validation.d.ts +20 -1
  10. package/dist/app/manifest-validation.js +130 -6
  11. package/dist/app/manifest.d.ts +110 -2
  12. package/dist/app/manifest.js +109 -3
  13. package/dist/app/primitive-scaffold.js +11 -1
  14. package/dist/app/readme.js +2 -0
  15. package/dist/app/scaffold.js +3 -2
  16. package/dist/app/workspace-scaffold.js +3 -3
  17. package/dist/artifact/delegate.js +8 -4
  18. package/dist/auth-cmds/commands.d.ts +1 -1
  19. package/dist/auth-cmds/commands.js +16 -0
  20. package/dist/cli-errors.js +4 -0
  21. package/dist/command-input.d.ts +15 -0
  22. package/dist/command-input.js +33 -0
  23. package/dist/functions/commands.d.ts +2 -1
  24. package/dist/functions/commands.js +61 -30
  25. package/dist/functions/manifest.d.ts +7 -1
  26. package/dist/functions/manifest.js +40 -12
  27. package/dist/functions/secret-reconcile.d.ts +3 -3
  28. package/dist/functions/secret-reconcile.js +5 -7
  29. package/dist/main.d.ts +3 -1
  30. package/dist/main.js +19 -7
  31. package/dist/manifest-roles-notice.d.ts +33 -0
  32. package/dist/manifest-roles-notice.js +75 -0
  33. package/dist/orm/delegate.js +2 -0
  34. package/dist/pipeline/commands.js +11 -0
  35. package/dist/pipeline/discovery.d.ts +8 -0
  36. package/dist/pipeline/discovery.js +249 -0
  37. package/dist/pipeline/lifecycle.js +35 -10
  38. package/dist/pipeline/stage-secrets.d.ts +4 -1
  39. package/dist/pipeline/stage-secrets.js +6 -2
  40. package/dist/process/commands.js +4 -0
  41. package/dist/repos/commands.d.ts +10 -1
  42. package/dist/repos/commands.js +16 -8
  43. package/dist/repos/pulls.d.ts +3 -0
  44. package/dist/repos/pulls.js +131 -0
  45. package/dist/secrets/commands.d.ts +1 -1
  46. package/dist/secrets/commands.js +97 -16
  47. package/dist/service-accounts/commands.d.ts +3 -0
  48. package/dist/service-accounts/commands.js +50 -0
  49. package/package.json +5 -5
package/README.md CHANGED
@@ -139,14 +139,14 @@ 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
 
147
147
  > **Availability:** App orchestration remains an internal workflow. Standalone
148
148
  > primitives retain their documented public/Preview availability. This change
149
- > does not make function-to-ORM service-account access a public runtime contract.
149
+ > does not publish app orchestration. Standalone caller-mode Function-to-ORM execution is supported by the SDK helper described below; service-identity execution remains outside that helper.
150
150
 
151
151
  | Command | What it does |
152
152
  |---------|--------------|
@@ -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,95 @@ 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 Application registration: after its primitives
336
+ deploy, the app is registered with Atlas as an **Application**. Create its
337
+ roles in Atlas — Permissions → Applications → the app → **Edit roles**, or
338
+ `POST /api/custom-roles/applications/<id>/roles` — so granting someone one
339
+ Application role gives them everything the app needs: each member's end-user
340
+ access plus the member roles and capabilities the role bundles. Grants are made
341
+ in Atlas too, never in the manifest.
342
+
343
+ - A role's includes can reach `artifact`, `function`, `orm`, and `process`
344
+ primitives: a member's end-user access (`invoker` on functions and
345
+ processes), one of its registered roles, or one of its capabilities.
346
+ A member role or capability doesn't grant end-user access by itself — as on
347
+ the primitive, a role needs an explicit end-user include on each member its
348
+ holders should be able to open.
349
+ - A `process` primitive offers only end-user access (starting runs), and a role
350
+ can include it only when it deploys exactly one process, `only: [<process-id>]`:
351
+
352
+ ```yaml
353
+ - { id: approval-flow, kind: process, path: processes/approval, only: [loan-approval] }
354
+ ```
355
+ - The Application registers after every primitive deploys; if one fails, it
356
+ is skipped. Registering requires capability admin on every member (owner,
357
+ for a process), checked on every deploy.
358
+ - Members are synced every deploy. Removing one removes every role's access
359
+ into it.
360
+ - A Next.js artifact is an ordinary `artifact` member. Its server calls ORM and
361
+ functions as the signed-in user unless it declares `service_account`, so a
362
+ role that includes it should also include `end_user` on every namespace and
363
+ `invoker` on every function its `server.capabilities` reach (the same holds
364
+ for any artifact's browser `capabilities`). The deploy prints an
365
+ `access_gap` warning for each one a role misses; it never adds them for you.
366
+
367
+ #### Deprecated: role definitions in YAML
368
+
369
+ **Capabilities are code, roles are data.** Capabilities live in YAML because your code checks them; roles
370
+ are bundles of capabilities that admins create and change in Atlas.
371
+
372
+ `roles:` and `collaborators:` blocks in `sequence.app.yml` — like
373
+ `capabilities.roles.definitions` in `artifact.bundle.yml`,
374
+ `managed-function.yml`, and `namespace.yaml` — are **deprecated**. They are
375
+ still accepted as a one-time seed: a deploy creates any role Atlas doesn't have
376
+ yet and **never updates it after**; a changed definition is reported as drift,
377
+ not applied. `seq-studio` prints a notice when a manifest it deploys defines
378
+ roles. Don't add new ones — create roles in Atlas. Capabilities stay in YAML:
379
+ they're the contract your code checks.
380
+
381
+ The legacy seed format, for reading existing manifests:
382
+
383
+ ```yaml
384
+ roles:
385
+ definitions:
386
+ member:
387
+ includes:
388
+ - { primitive: admin-ui, role: end_user }
389
+ - { primitive: loans-orm, capability: loan-read }
390
+ collaborators:
391
+ definitions:
392
+ maintainer:
393
+ includes:
394
+ - { primitive: admin-ui, tier: writer }
395
+ ```
396
+
397
+ ### Collaborator roles (schema version 3)
398
+
399
+ Runtime roles bundle use. **Collaborator roles** bundle the tiers that let
400
+ people change the members: one grant can make someone a writer on the UI, an
401
+ editor on its function, and a writer on its namespace. Create them in Atlas
402
+ (the Application's **Collaborator access** tab, or `?kind=collaborator` on the
403
+ roles API) — a `collaborators:` block here is the deprecated seed described
404
+ above. The two kinds never mix: a collaborator role includes only member tiers
405
+ and inherits only other collaborator roles.
406
+
407
+ | Kind | Tiers a collaborator role can bundle |
408
+ |---|---|
409
+ | `artifact` | `reader`, `writer` |
410
+ | `function` | `reader`, `editor` |
411
+ | `orm` | `reader`, `writer` |
412
+ | `process` (exactly one, `only: [<process-id>]`) | `editor` |
413
+
414
+ - Never `admin` or `owner`: admin can share a member and bundle it into other
415
+ Applications, so it stays a direct grant. Workspaces are never bundled.
416
+ - Every tier includes use, so a maintainer can always use what they maintain.
417
+ - Consent is stricter than for runtime roles: bundling a member's tiers needs
418
+ **admin** on it (owner, for a process), checked on every deploy.
419
+ - Only the Application's admins create, edit and grant collaborator roles in
420
+ Atlas (runtime roles need only its capability admins and grant managers).
421
+
302
422
  ## Agent commands
303
423
 
304
424
  Typed agent repositories export one or more `defineAgent(...)` values from files
@@ -730,31 +850,86 @@ not members of these read adapters.
730
850
  ### ORM data access
731
851
 
732
852
  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`:
853
+ namespace. Reads and mutations use different scopes:
854
+
855
+ - `tables` lists namespace table and view names that persisted queries may
856
+ read. Cover every relation required by the compiled query, including linked
857
+ selections and policy dependencies. Use definition names such as
858
+ `my_profile`, not GraphQL field names such as `myProfile` or physical backing
859
+ table names.
860
+ - `operations` lists persisted **mutation** names, case-sensitive. Each mints
861
+ a `<namespace>/ops/<OperationName>` scope. Listing a query name here does not
862
+ authorize its reads.
863
+ - `actions` lists legacy v1 actions. `query` controls separate legacy raw SQL
864
+ access; leave it `false` for persisted GraphQL queries and mutations.
865
+
866
+ For example, if `GetMyProfile` reads only the `my_profile` view and
867
+ `UpdateMyProfile` is a persisted mutation, declare:
740
868
 
741
869
  ```yaml
742
- service_account: lucky-svc
870
+ service_account: directory-runtime
743
871
  capabilities:
744
872
  data:
745
- lucky:
746
- tables: [lucky_draws]
747
- operations: [RollLuckyNumber]
873
+ directory:
874
+ tables: [my_profile]
875
+ operations: [UpdateMyProfile]
876
+ query: false
748
877
  ```
749
878
 
879
+ `tables` grants relation-level read scope, not a named-query allowlist. Other
880
+ registered queries whose required relations fit that scope can pass the same
881
+ scope check. Keep the handler's accepted operation names explicit. The caller
882
+ must still satisfy namespace runtime access, operation requirements, and row
883
+ policies; declaring a table does not grant access to every row.
884
+
885
+ A function that reaches a namespace must attach a top-level `service_account`
886
+ provided by its administrator. Caller-mode execution remains on behalf of the
887
+ invoking user; attaching the account does not select service mode.
888
+
889
+ A successful direct `seq-studio orm execute` call does not test a function's
890
+ delegated scope. If the same read fails through the function with a 403, check
891
+ the deployed `tables` declaration before requesting broader user grants.
892
+
750
893
  ## Managed Secret commands
751
894
 
752
895
  | Command | What it does |
753
896
  |---------|--------------|
754
- | `seq-studio secrets create <NAME> -e <env> [--org <slug>]` | Register an org-owned secret (no value) |
755
- | `seq-studio secrets set <NAME> -e <env> [--org <slug>] [--from-file <path>]` | Set the shared default (write-only; file is not echoed) |
897
+ | `seq-studio secrets create <NAME> -e <env> [--type key-value\|single] [--org <slug>]` | Register an org-owned secret with an immutable type (CLI defaults to `single` for existing scripts) |
898
+ | `seq-studio secrets set <NAME> -e <env> [--org <slug>] [--from-file <path>\|--from-json <path>]` | Set one value or a complete key/value set (write-only; file is not echoed) |
756
899
  | `seq-studio secrets list -e <env>` | Secrets you can see (never values) |
757
900
 
901
+ For a grouped credential, create a key/value set and write its complete value from a JSON file:
902
+
903
+ ```bash
904
+ seq-studio secrets create CANDESCENT -e staging --type key-value
905
+ seq-studio secrets set CANDESCENT -e staging --from-json ../private/candescent-secrets.json
906
+ seq-studio functions deploy -e staging
907
+ ```
908
+
909
+ The function's `managed-function.yml` names the set and maps its entries into the environment variables the code reads:
910
+
911
+ ```yaml
912
+ secrets:
913
+ - secret: CANDESCENT
914
+ entries:
915
+ BASE_URL: CANDESCENT_BASE_URL
916
+ INSTITUTION_ID: CANDESCENT_INSTITUTION_ID
917
+ PRIVATE_KEY: CANDESCENT_PRIVATE_KEY
918
+ PUBLIC_KEY: CANDESCENT_PUBLIC_KEY
919
+ ```
920
+
921
+ For a single-value secret, `secrets: [API_KEY]` still supplies the secret named `API_KEY` as `process.env.API_KEY`. Deployment resolves manifest bindings automatically; no separate function attachment command is required.
922
+
923
+ If using `seq-studio secrets attach <NAME> --fn <slug>`, the function's active manifest must already declare that same secret source and exact environment variable mapping. An attachment cannot override a different manifest secret; update `managed-function.yml` and redeploy to change the source or mapping.
924
+
925
+ The JSON file contains an object of uppercase entry names and string values. Keep it outside git **and outside the function directory**, since function files are uploaded during deployment. A set is one version and one permission grant; changing any entry writes a new complete version. Redeploy functions tracking the default to apply it. Function code reads the mapped `process.env` names as before. Missing entries and undeclared environment variables fail deployment.
926
+
927
+ To change only selected entries without reading or re-entering the others, put the changes in a JSON file and run `seq-studio secrets set CANDESCENT -e staging --from-json ./changes.json --merge`. Use `null` for an entry to remove it. The CLI checks the active version before writing and asks you to retry if another edit won the race.
928
+
929
+ Pipeline stages can select one entry from a set for each symbolic credential: `seq-studio secrets attach CANDESCENT --stage my-stage -e staging --credential api_key --entry PRIVATE_KEY`. The selected entry is copied at plan/deploy into that stage's credential scope. Artifact Studio applications currently require a single-value secret.
930
+
931
+ Existing single-value secrets keep their type. To consolidate them, create a new set, provide or rotate the entry values, update each consumer's manifest mapping, redeploy, verify the consumer, then retire the old secrets. The CLI and UI cannot read back existing secret values, so an agent needs the values from an authorized source or must rotate them during consolidation.
932
+
758
933
  `--org` targets a managed-scope org other than the login tenant and selects
759
934
  the intended same-named secret for `set`, `attach`, `detach`, `versions`,
760
935
  `set-default`, and `pin`; it is required when the name exists in multiple
@@ -769,6 +944,10 @@ The API requires Managed Functions Admin on that org.
769
944
  the `@sequenceholdings/artifact-studio` library (its `./cli` `runCli` export),
770
945
  routed through `~/.config/lattice/config.toml` and the shared platform login.
771
946
 
947
+ Use `seq-studio artifact --help` or add `--help` / `-h` to any artifact command
948
+ (for example, `seq-studio artifact init --help`) to print usage and exit
949
+ successfully. Help does not initialize files, authenticate, or deploy.
950
+
772
951
  | Command | Underlying `runCli` verb |
773
952
  |---------|--------------------------|
774
953
  | `seq-studio artifact init <dir> [--template react-vite\|nextjs]` | `init <dir>` — defaults to the existing React/Vite scaffold |
@@ -1007,7 +1186,7 @@ JSON API — the same repos `--repo <ns>/<name>` sources build from.
1007
1186
  | `seq-studio repos list -e <env> [--namespace <slug>] [--mine]` | repos visible on the environment (permission-filtered) |
1008
1187
  | `seq-studio repos namespaces [create <slug>] -e <env>` | list namespaces, or create one (creator becomes owner) |
1009
1188
  | `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) |
1189
+ | `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
1190
  | `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
1191
  | `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
1192
  | `seq-studio repos delete <ns>/<name> -e <env> [--yes]` | delete a repo — interactive confirm unless `--yes` |
@@ -1041,23 +1220,37 @@ check names in Settings or with `repos ci require`/`repos ci import`.
1041
1220
 
1042
1221
  ## Pipeline commands
1043
1222
 
1223
+ > **Availability:** Data Pipelines is Preview with staff access. These commands
1224
+ > do not establish a self-service workflow for other accounts; confirm support
1225
+ > for your environment with your administrator.
1226
+
1044
1227
  `seq-studio pipeline <sub>` authors and validates Data Pipelines **stage
1045
1228
  specs** — the typed contracts (`<name>.stage.yml`) in either a dedicated
1046
1229
  Pipeline repo (`pipelines/<domain>`) or an app monorepo (`apps/<app>`).
1047
1230
  Validation logic lives in
1048
1231
  `@sequenceholdings/pipeline-spec` (an optional peer, like `@sequenceholdings/orm`);
1049
- install it alongside the CLI to use this family.
1232
+ install it alongside the CLI for local spec authoring and validation. The
1233
+ discovery and data-reading commands below do not require the optional SDK.
1050
1234
 
1051
1235
  | Command | What it does |
1052
1236
  |---------|--------------|
1237
+ | `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 |
1238
+ | `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 |
1239
+ | `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 |
1240
+ | `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 |
1241
+ | `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 |
1242
+ | `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 |
1243
+ | `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
1244
  | `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
1245
  | `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
1246
  | `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. |
1247
+ | `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 |
1248
+ | `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. |
1249
+
1250
+ `--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
1251
  | `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) |
1252
+ | `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. |
1253
+ | `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
1254
  | `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
1255
  | `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
1256
  | `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 +1259,46 @@ install it alongside the CLI to use this family.
1066
1259
  pipeline target advertised by that endpoint. It is optional when the alias
1067
1260
  matches a target id or when the endpoint has exactly one target.
1068
1261
 
1262
+ ### Discover inputs before authoring
1263
+
1264
+ For both people and agents, search deployed documentation to find likely inputs,
1265
+ then describe the relevant assets. Verify their physical schemas and values before
1266
+ authoring a transformation. Descriptions explain meaning; they do not establish
1267
+ uniqueness, relationships, or data quality.
1268
+
1269
+ ```bash
1270
+ # Fictional repository and asset; substitute IDs returned by discovery.
1271
+ seq-studio pipeline list -e <env>
1272
+ seq-studio pipeline search "source item" --repo pipelines/catalog -e <env>
1273
+ seq-studio pipeline describe catalog-ingest.items -e <env> --json
1274
+ seq-studio pipeline schema catalog-ingest.items -e <env>
1275
+ seq-studio pipeline sample catalog-ingest.items --limit 5 -e <env>
1276
+ seq-studio pipeline query catalog-ingest.items -e <env> \
1277
+ --sql 'SELECT status, COUNT(*) AS item_count FROM asset GROUP BY status'
1278
+ ```
1279
+
1280
+ `search` and `describe` read active durable deployment metadata without contacting
1281
+ a data engine. Merged YAML appears after its stage deployment becomes active.
1282
+ Both filter `--repo` on the server. Search pages results with `--limit`/`--offset`
1283
+ and returns up to five matching columns per asset plus `matchedColumnCount`;
1284
+ `describe` returns the full documented/declared column list.
1285
+
1286
+ Use `--json` for agents and scripts. Responses include the environment, deployment
1287
+ ID, source commit, repository, `source: "active_deployment"`, and
1288
+ `physicalSchemaVerified: false`. Optional `declaredType`/`declaredNullable` are
1289
+ contract declarations. Documented columns may be missing from physical data, and
1290
+ undocumented physical columns may be absent here. Use `schema` for live column
1291
+ verification, then `sample` and `query` for values. Schema reads annotate observed
1292
+ columns only; row queries do not infer descriptions for computed expressions.
1293
+
1294
+ `assets` exports the latest registered declarations, including undeployed assets.
1295
+ With `assets --repo`, the list, contract export, and total all match that repository.
1296
+
1297
+ `sample --limit` accepts an integer from 1 to 100; `query --limit` accepts 1 to
1298
+ 1,000. A row limit bounds returned results, not the amount of data an aggregate
1299
+ query scans. After inspection, author the stage and run
1300
+ `pipeline validate` before planning a deployment.
1301
+
1069
1302
  Unless `--no-wait` is set, `plan`, `deploy`, `promote`, and `rollback` report status or
1070
1303
  status-detail changes while waiting, then emit a 20-second progress heartbeat.
1071
1304
  Deploy, promote, and rollback wait up to 2 hours by default; pass
@@ -1314,3 +1547,74 @@ For local full-stack integration, use `artifact dev`, `functions deploy`, `orm a
1314
1547
  and `storage apply` against the same `-e local` (or `local:<worktree>`). Storage uses
1315
1548
  the normal local Atlas authorization and lifecycle, with a dedicated development
1316
1549
  GCS bucket. The standalone `functions dev` harness does not mint storage delegation.
1550
+
1551
+
1552
+ ## Composed applications (0.3.0)
1553
+
1554
+ The public builder path combines standalone Artifacts, ORM namespaces, and Managed
1555
+ Functions in a platform repository. Use the environment's `/docs/getting-started/builder-handoff`
1556
+ and `/docs/examples/persisted-application` for the full source example and grant order.
1557
+ The matching package set is Artifact Studio 0.4.0, ORM 2.1.1, and Managed Functions
1558
+ 0.2.0. Confirm registry publication before a clean installation; local builds of
1559
+ unreleased packages do not prove a public-registry workflow.
1560
+
1561
+ - `createArtifactOrmExecutor({namespace, manifest})` from the Artifact SDK root
1562
+ uses the host-authenticated bridge. Declare only the exact namespace API write
1563
+ scope, even for persisted queries. No browser token extraction is required.
1564
+ - `createFunctionOrmExecutor({request, baseUrl, namespace, manifest})` from
1565
+ `@sequenceholdings/managed-functions/orm` uses invocation-scoped human caller
1566
+ authority. Construct it inside the handler, supply the trusted configured
1567
+ environment origin, and declare a service-account binding and data scopes.
1568
+ It does not choose service mode or authenticate arbitrary public HTTP ingress.
1569
+ - The shared execution dependency contains no ORM authoring/compiler dependencies.
1570
+ Keep namespace generation in the development package, outside the Function runtime.
1571
+
1572
+ ### Verify identity and provision bindings
1573
+
1574
+ ```bash
1575
+ seq-studio auth whoami -e <env> --json
1576
+ seq-studio service-accounts list -e <env>
1577
+ seq-studio service-accounts create task-runtime --display-name "Task runtime" -e <env>
1578
+ seq-studio service-accounts show <account-id> -e <env>
1579
+ ```
1580
+
1581
+ `whoami` reports the server-verified subject/email and environment, never credentials.
1582
+ Account creation requires existing administrator authority and issues no credentials.
1583
+ Provide the account ID/slug and act-as permission to the deployer. All new commands
1584
+ require an explicit environment; help is offline, including `doctor --help`.
1585
+
1586
+ ### Runtime access
1587
+
1588
+ ```bash
1589
+ seq-studio access definitions orm <namespace> -e <env>
1590
+ seq-studio access resolve orm <namespace> -e <env>
1591
+ seq-studio access list orm <namespace> --floor -e <env>
1592
+ seq-studio access grant orm <namespace> --floor --principal-type user --principal-id <subject> -e <env>
1593
+ seq-studio access grant orm <namespace> --key <role> --principal-type user --principal-id <subject> -e <env>
1594
+ seq-studio access revoke orm <namespace> --key <role> --principal-type user --principal-id <subject> -e <env>
1595
+ ```
1596
+
1597
+ Resource types are `artifact`, `function`, and `orm`; their IDs are project UUID,
1598
+ Function UUID, and namespace name respectively. The runtime floor means `end_user`
1599
+ for Artifact/ORM and `invoker` for Function. `list` defaults to direct role/capability
1600
+ grants; `resolve` evaluates only the signed-in caller. Grant/revoke require existing
1601
+ grant-management authority. Roles and pins do not assign users; `capabilities.uses`
1602
+ must declare every capability consumed. Fresh previews do not register new role keys;
1603
+ activate a release before granting them. Authoring/collaborator permissions remain separate.
1604
+
1605
+ ### Repository Pulls
1606
+
1607
+ ```bash
1608
+ seq-studio repos pulls create <namespace/name> --head <branch> --base main --title "Build task app" --body-file review.md -e <env>
1609
+ seq-studio repos pulls list <namespace/name> --state open -e <env>
1610
+ seq-studio repos pulls show <namespace/name> <number> -e <env>
1611
+ seq-studio repos pulls diff <namespace/name> <number> -e <env>
1612
+ seq-studio repos pulls merge <namespace/name> <number> --method squash -e <env>
1613
+ ```
1614
+
1615
+ All results are JSON (`--json` is accepted). Listing returns one page and `nextCursor`;
1616
+ use `--cursor` to continue. Diff accepts `--max-files` (maximum 500) and reports truncation.
1617
+ Merge requires merge/admin authority, confirmation (or approved automation's `--yes`),
1618
+ and the existing server review/check policy. It merges the current branch head; a
1619
+ displayed SHA is not a head-lock or policy bypass. Complete reviews before merging.
1620
+ `repos pull` remains the singular source-snapshot command.
@@ -0,0 +1,3 @@
1
+ import type { ParsedArgs } from '../process/commands.js';
2
+ export declare const ACCESS_USAGE = "usage:\n seq-studio access definitions <artifact|function|orm> <resource-id> -e <env>\n seq-studio access resolve <artifact|function|orm> <resource-id> -e <env>\n seq-studio access list <artifact|function|orm> <resource-id> -e <env> [--floor | --key <key>]\n seq-studio access grant <artifact|function|orm> <resource-id> -e <env>\n (--floor | --key <key>) --principal-type <user|group|organization> --principal-id <id>\n seq-studio access revoke <artifact|function|orm> <resource-id> -e <env>\n (--floor | --key <key>) --principal-type <user|group|organization> --principal-id <id>\n\n All results are JSON (--json is also accepted). Authenticate: seq-studio login --env <env>.\n Resource IDs are artifact project IDs, function IDs, or ORM namespace names.\n definitions lists declared roles/capabilities; resolve shows the CALLER's effective claims.\n list defaults to direct role/capability grants; --floor lists runtime entry access.\n --floor is end_user for artifacts/ORM and invoker for functions. A custom key can\n be granted with --key; it must be declared and grantable on that resource.\n User IDs are authenticated subjects (auth whoami); groups use directory IDs;\n organizations use tenant slugs. Service accounts use --principal-type user\n --principal-id 'service-account|<account-id>'. Never pass an email in place of an ID.\n Grant/list/revoke require existing grant-manager authority on the resource.\n Service-account grants also require authority to act as that account.\n These commands manage runtime access; deployment/collaborator permissions remain separate.\n";
3
+ export declare function runAccessCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
@@ -0,0 +1,91 @@
1
+ import { deleteJson, getJson, postJson } from '../atlas-client.js';
2
+ import { printCliError } from '../cli-errors.js';
3
+ import { requiredStringFlag, validateCommandInput, wantsHelp } from '../command-input.js';
4
+ import { buildContext, clientOptions } from '../functions/commands.js';
5
+ export const ACCESS_USAGE = `usage:
6
+ seq-studio access definitions <artifact|function|orm> <resource-id> -e <env>
7
+ seq-studio access resolve <artifact|function|orm> <resource-id> -e <env>
8
+ seq-studio access list <artifact|function|orm> <resource-id> -e <env> [--floor | --key <key>]
9
+ seq-studio access grant <artifact|function|orm> <resource-id> -e <env>
10
+ (--floor | --key <key>) --principal-type <user|group|organization> --principal-id <id>
11
+ seq-studio access revoke <artifact|function|orm> <resource-id> -e <env>
12
+ (--floor | --key <key>) --principal-type <user|group|organization> --principal-id <id>
13
+
14
+ All results are JSON (--json is also accepted). Authenticate: seq-studio login --env <env>.
15
+ Resource IDs are artifact project IDs, function IDs, or ORM namespace names.
16
+ definitions lists declared roles/capabilities; resolve shows the CALLER's effective claims.
17
+ list defaults to direct role/capability grants; --floor lists runtime entry access.
18
+ --floor is end_user for artifacts/ORM and invoker for functions. A custom key can
19
+ be granted with --key; it must be declared and grantable on that resource.
20
+ User IDs are authenticated subjects (auth whoami); groups use directory IDs;
21
+ organizations use tenant slugs. Service accounts use --principal-type user
22
+ --principal-id 'service-account|<account-id>'. Never pass an email in place of an ID.
23
+ Grant/list/revoke require existing grant-manager authority on the resource.
24
+ Service-account grants also require authority to act as that account.
25
+ These commands manage runtime access; deployment/collaborator permissions remain separate.
26
+ `;
27
+ function parsePrincipal(args) {
28
+ const type = requiredStringFlag({ args, key: 'principal-type' });
29
+ const id = requiredStringFlag({ args, key: 'principal-id' });
30
+ if (!['user', 'group', 'organization'].includes(type)) {
31
+ throw new Error('--principal-type must be user, group, or organization.');
32
+ }
33
+ if (type === 'user' && (/[#*\s]/.test(id) || (!id.includes('|') && !id.endsWith('@clients')))) {
34
+ throw new Error('User principal IDs must be authenticated subjects, not emails or display names. Use auth whoami; service accounts use service-account|<id>.');
35
+ }
36
+ return { type, id };
37
+ }
38
+ function parseGrantSelection({ args, mutation }) {
39
+ const floor = args.flags.floor === true;
40
+ const key = args.flags.key;
41
+ if ((floor && key !== undefined) || (mutation && !floor && key === undefined)) {
42
+ throw new Error('Choose exactly one of --floor or --key <key>.');
43
+ }
44
+ return { floor, key };
45
+ }
46
+ function parseAccessTarget({ sub, args }) {
47
+ if (!['definitions', 'resolve', 'list', 'grant', 'revoke'].includes(sub)) {
48
+ throw new Error(`Unknown access command: ${sub}. See: seq-studio access --help`);
49
+ }
50
+ const mutation = sub === 'grant' || sub === 'revoke';
51
+ const flags = {};
52
+ if (sub === 'list' || mutation)
53
+ Object.assign(flags, { floor: 'boolean', key: 'string' });
54
+ if (mutation)
55
+ Object.assign(flags, { 'principal-type': 'string', 'principal-id': 'string' });
56
+ validateCommandInput({ args, flags, positional: 2 });
57
+ const [hostType, hostId] = args.positional;
58
+ if (!hostType || !['artifact', 'function', 'orm'].includes(hostType)) {
59
+ throw new Error('Resource type must be artifact, function, or orm.');
60
+ }
61
+ if (!hostId?.trim())
62
+ throw new Error('A resource ID is required.');
63
+ const { floor, key } = parseGrantSelection({ args, mutation });
64
+ const principal = mutation ? parsePrincipal(args) : undefined;
65
+ const suffix = sub === 'definitions' || sub === 'resolve' ? sub : floor ? 'end-users' : 'grants';
66
+ const query = sub === 'list' && typeof key === 'string' ? `?key=${encodeURIComponent(key)}` : '';
67
+ return {
68
+ path: `/api/custom-roles/${hostType}/${encodeURIComponent(hostId)}/${suffix}${query}`,
69
+ body: principal ? (floor ? { principal } : { key, principal }) : undefined,
70
+ };
71
+ }
72
+ export async function runAccessCommand(sub, args) {
73
+ if (!sub || wantsHelp({ sub, args })) {
74
+ console.log(ACCESS_USAGE);
75
+ return sub ? 0 : 1;
76
+ }
77
+ try {
78
+ const { path, body } = parseAccessTarget({ sub, args });
79
+ const ctx = await buildContext(args);
80
+ const request = { ...clientOptions(ctx), path };
81
+ const result = sub === 'grant' ? await postJson({ ...request, body })
82
+ : sub === 'revoke' ? await deleteJson({ ...request, body })
83
+ : await getJson(request);
84
+ console.log(JSON.stringify(result, null, 2));
85
+ return 0;
86
+ }
87
+ catch (error) {
88
+ printCliError(error);
89
+ return 1;
90
+ }
91
+ }