@sequenceholdings/studio-cli 0.5.1 → 0.5.3

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 (54) hide show
  1. package/README.md +103 -38
  2. package/dist/agents/apply-chunks.d.ts +5 -1
  3. package/dist/agents/apply-chunks.js +4 -4
  4. package/dist/agents/commands.d.ts +10 -1
  5. package/dist/agents/commands.js +19 -2
  6. package/dist/app/adapters.d.ts +2 -2
  7. package/dist/app/adapters.js +18 -15
  8. package/dist/app/commands.d.ts +1 -1
  9. package/dist/app/commands.js +58 -20
  10. package/dist/app/deploy.d.ts +2 -0
  11. package/dist/app/deploy.js +25 -13
  12. package/dist/app/kinds.d.ts +6 -0
  13. package/dist/app/kinds.js +6 -0
  14. package/dist/app/manifest.js +1 -1
  15. package/dist/app/official-source.d.ts +10 -0
  16. package/dist/app/official-source.js +23 -0
  17. package/dist/app/prepare.d.ts +27 -0
  18. package/dist/app/prepare.js +58 -0
  19. package/dist/app/primitive-ids.d.ts +6 -0
  20. package/dist/app/primitive-ids.js +16 -0
  21. package/dist/app/primitive-scaffold.d.ts +0 -4
  22. package/dist/app/primitive-scaffold.js +7 -18
  23. package/dist/app/readme.js +17 -14
  24. package/dist/app/repository-index.d.ts +19 -0
  25. package/dist/app/repository-index.js +86 -0
  26. package/dist/app/scaffold.d.ts +12 -1
  27. package/dist/app/scaffold.js +31 -18
  28. package/dist/app/workspace-compile.d.ts +9 -0
  29. package/dist/app/workspace-compile.js +13 -1
  30. package/dist/app/workspace-scaffold.js +5 -1
  31. package/dist/auth.d.ts +17 -0
  32. package/dist/auth.js +29 -0
  33. package/dist/config.d.ts +16 -0
  34. package/dist/config.js +38 -5
  35. package/dist/env-registry.d.ts +8 -0
  36. package/dist/env-registry.js +9 -1
  37. package/dist/envs/commands.js +14 -1
  38. package/dist/functions/manifest.d.ts +4 -1
  39. package/dist/functions/manifest.js +8 -2
  40. package/dist/main.js +6 -1
  41. package/dist/orm/delegate.js +5 -2
  42. package/dist/pipeline/clone-deploy.d.ts +1 -1
  43. package/dist/pipeline/clone-deploy.js +3 -2
  44. package/dist/pipeline/commands.js +3 -2
  45. package/dist/process/commands.d.ts +6 -3
  46. package/dist/process/commands.js +26 -10
  47. package/dist/repos/commands.js +1 -1
  48. package/dist/repos/pulls.d.ts +19 -1
  49. package/dist/repos/pulls.js +15 -2
  50. package/dist/templates/process/example-process/process.ts +20 -24
  51. package/dist/templates/process/package.json +1 -1
  52. package/package.json +8 -7
  53. package/templates/process/example-process/process.ts +20 -24
  54. package/templates/process/package.json +1 -1
package/README.md CHANGED
@@ -54,7 +54,7 @@ inspect `truncated` and pagination metadata where present.
54
54
  # In a process or artifact repo (devDependency, using pnpm — see below):
55
55
  pnpm add -D @sequenceholdings/studio-cli @sequenceholdings/lattice
56
56
 
57
- # Or globally:
57
+ # Or globally (ORM commands need the in-repo install; see "ORM commands"):
58
58
  pnpm add -g @sequenceholdings/studio-cli
59
59
  ```
60
60
 
@@ -142,6 +142,11 @@ seq-studio login --env <name> # sign in to it
142
142
  seq-studio envs list # show configured environments (name, URL, source)
143
143
  ```
144
144
 
145
+ The reserved names `staging`, `production` and `banksouth` are for deployments
146
+ that sign in through the shared Sequence login: `envs add` saves one of them to
147
+ `~/.config/lattice/config.toml` only after the deployment confirms that login,
148
+ and `seq-studio login` signs you in.
149
+
145
150
  You can also add or override environments yourself in
146
151
  `~/.config/lattice/config.toml`.
147
152
  Authenticated requests accept only HTTPS origins at `seqholdings.com` or its
@@ -182,13 +187,16 @@ locations, dependencies, and deployment selection.
182
187
 
183
188
  | Command | What it does |
184
189
  |---------|--------------|
185
- | `seq-studio init <dir> --with <kinds>` | Scaffold a version 3 app, root pnpm workspace, shared package, README, and selected primitives |
190
+ | `seq-studio init <dir> [--with <kinds>] [--skip-install]` | Scaffold a version 3 app, root pnpm workspace, shared package, README, and selected primitives; by default creates ORM, function, process, and artifact primitives, installs dependencies, and authors the first ORM migration |
186
191
  | `seq-studio add <kind> <name> [--depends-on <ids>] [--template <t>]` | Add any primitive, including additional ORM namespaces and UIs |
187
192
  | `seq-studio add package <name>` | Add a shared TypeScript package to the manifest and pnpm workspace |
188
193
  | `seq-studio deploy -e <env> [--yes] [--only id1,id2] [--dry-run]` | Validate and deploy the selected app graph, including prerequisites |
189
194
 
190
195
  `init` accepts `orm`, `workspace`, `function`, `agent`, `process`, `pipeline`, and `artifact` as
191
- a comma-separated `--with` list or boolean flags (`--agent --process`). The first
196
+ a comma-separated `--with` list or boolean flags (`--agent --process`). With no
197
+ kind flags it scaffolds `orm,function,process,artifact`, the kinds repository
198
+ CI/CD creates and deploys on merge. `--skip-install` skips the install and
199
+ migration step (offline). The first
192
200
  function defaults to `hello` (`--function-name` changes it). Agent, process, and
193
201
  pipeline folders use the app name. Pipelines default to transformation stages;
194
202
  `--pipeline-type ingestion|transformation|serving` selects another template.
@@ -200,12 +208,13 @@ dependencies; run `pnpm install` inside its directory. App deploys send its
200
208
  directory (for example `artifacts/admin`) so Atlas builds it from the app repository.
201
209
 
202
210
  ```bash
203
- seq-studio init loan-tools --with orm,function,agent,process,artifact
211
+ seq-studio init loan-tools
204
212
  cd loan-tools
205
- pnpm install
206
- seq-studio orm generate orm/loan_tools
207
- seq-studio orm diff orm/loan_tools
208
- # Review and commit the generated migrations before deployment.
213
+ # Init installs dependencies and authors the first migration; review and commit
214
+ # pnpm-lock.yaml and orm/loan_tools/migrations/ before opening the PR.
215
+ # In a git-service repo, push a branch and open a PR: checks run automatically
216
+ # and merging main creates and deploys the declared supported primitives.
217
+ # Outside one, deploy directly:
209
218
  seq-studio login -e <env>
210
219
  seq-studio deploy -e <env> --dry-run
211
220
  seq-studio deploy -e <env> --yes
@@ -225,7 +234,9 @@ seq-studio deploy -e <env> --only approvals-process --yes
225
234
 
226
235
  Creating a platform git-service repo without `--git-backend` (`seq-studio repos
227
236
  create`, or the Repositories UI) seeds it with a Sequence app README on either
228
- backend; only an explicit `--git-backend walgit` starts empty. A fresh clone with that seed README is a valid `init .` target. Init
237
+ backend; only an explicit `--git-backend walgit` starts empty. A fresh clone with that seed README is a valid `init .` target. Inside an
238
+ existing repository, `init <subdir>` also declares the app in
239
+ `.seq/repository.yml` so repository CI picks it up. Init
229
240
  preserves its git remote and existing ignores, replaces the seed README, and
230
241
  refuses ordinary non-empty repositories. The initial UI stays at `artifact/`;
231
242
  additional UIs live under `artifacts/<name>/`.
@@ -243,8 +254,9 @@ packages, preserves the seven-day dependency age gate, and explicitly controls
243
254
  build scripts. Generated nested install configuration is consolidated at the
244
255
  root. CI should use `pnpm install --frozen-lockfile`.
245
256
 
246
- Every new app includes `packages/shared`, named `@<app-id>/shared`, with ordinary
247
- `workspace:*` dependencies from its JavaScript primitives. Export common types,
257
+ Every new app includes `packages/shared`, named `@<app-id>/shared`. Artifacts and
258
+ processes receive ordinary `workspace:*` dependencies; functions do not, because
259
+ their deployed bundles cannot resolve workspace links. Export common types,
248
260
  validation, and helpers from `src/index.ts`. Additional packages are registered
249
261
  with `seq-studio add package <name>`; add them to consumers with:
250
262
 
@@ -349,11 +361,11 @@ to a workspace resolves that workspace by name in the selected environment. A
349
361
  workspace UUID in source must be one that exists there; an ID from another
350
362
  environment fails the deployment. `uses` needs schema version 2 or later.
351
363
 
352
- Before the first ORM deployment, and after changing its schema, run
364
+ After changing an ORM schema, run
353
365
  `seq-studio orm generate <namespace-path>` followed by
354
366
  `seq-studio orm diff <namespace-path>`. Review and commit the generated migration
355
- ledger. Init creates the namespace source; it does not create this reviewed
356
- baseline automatically. A namespace without migrations fails deployment
367
+ ledger. `init` authors the baseline for its initial namespace (unless
368
+ `--skip-install`); namespaces added later still need this workflow. A namespace without migrations fails deployment
357
369
  preflight with instructions to run `orm diff`.
358
370
 
359
371
  Before any deployment, versions 2 and 3 validate and compile the selected sources.
@@ -364,9 +376,11 @@ checks do not deploy resources. Official artifact deployments require the full a
364
376
  checkout to be clean on `main`, including shared packages and the app manifest;
365
377
  local deployments retain the local development path.
366
378
 
367
- Pipeline entries require `repo: pipelines/<name>` or `repo: apps/<name>` and `ref`;
368
- they may specify `target`. For `apps/<name>` repositories, `path` is both the local
369
- authoring directory and the contained pipeline root in the remote monorepo. A
379
+ Pipeline entries require `repo: <namespace>/<name>` and `ref`; they may specify
380
+ `target`. The repo is a dedicated Pipeline repo (`pipelines/<name>`), an app
381
+ monorepo (`apps/<name>`), or your own namespace's repo. For any repo outside
382
+ `pipelines`, `path` is both the local authoring directory and the contained
383
+ pipeline root in the remote repository. A
370
384
  dedicated `pipelines/<name>` repository retains its historical repository-root
371
385
  package. Commit and push pipeline source before deploying. The
372
386
  app reuses the existing pipeline release workflow and waits for completion.
@@ -509,7 +523,8 @@ and inherits only other collaborator roles.
509
523
  principal, so it has nothing to use and appears only in collaborator roles:
510
524
  `viewer` sees its runs, `operator` runs its stages, `editor` deploys it.
511
525
  - A pipeline member is its release unit, the same id deploy registers:
512
- `pipelines/<name>`, or `apps/<name>@<path>` for one of an app's pipelines.
526
+ `pipelines/<name>`, or `<namespace>/<name>@<path>` for one of an app's
527
+ pipelines (in `apps` or your own namespace).
513
528
  - Secrets the app's functions and pipelines read are listed under a top-level
514
529
  `secrets:` block by their name in each environment. Deploy doesn't create or
515
530
  set them — use `seq-studio secrets` — it bundles them so a collaborator role
@@ -538,7 +553,7 @@ and inherits only other collaborator roles.
538
553
  namespace, a process, an agent, an artifact or a pipeline — is included
539
554
  without deploying it under a top-level `existing:` block, by the name Atlas
540
555
  knows it by: a function's slug, a namespace, a process id, an agent id, an
541
- artifact's slug, or a pipeline's release unit (`pipelines/<name>`).
556
+ artifact's slug, or a pipeline's release unit (`<namespace>/<name>[@<path>]`).
542
557
  Roles, collaborator roles and `uses` reach it like any member.
543
558
 
544
559
  ```yaml
@@ -572,7 +587,7 @@ bundle; it never implicitly deletes agents.
572
587
  | `seq-studio agents validate [--dir <dir>] [--target <APP_ENV>] [--only <id1,id2>]` | Compile and validate locally, without API access |
573
588
  | `seq-studio agents plan [--dir <dir>] [--only <id1,id2>]` | Offline compile/hash plan |
574
589
  | `seq-studio agents plan [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>]` | Diff creates, updates, and unchanged definitions against an environment |
575
- | `seq-studio agents apply [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>] [--yes]` | Apply creates and updates after showing the plan |
590
+ | `seq-studio agents apply [--dir <dir>] -e <env> [--target <APP_ENV>] [--only <id1,id2>] [--yes]` | Sequence-staff code-managed deploy: applies creates and updates after showing the plan |
576
591
  | `seq-studio agents list -e <env>` | List visible runtime agents |
577
592
  | `seq-studio agents show <id> -e <env>` | Show one runtime agent |
578
593
 
@@ -580,6 +595,21 @@ For `validate`, `plan`, and `apply`, `--only` accepts a comma-separated list of
580
595
  agent IDs after deployment-environment selection; every requested ID must be
581
596
  selected.
582
597
 
598
+ **Access is managed in Atlas, not in code.** `seq-studio deploy` deploys an
599
+ app's agents config-only, as you, with the same rules as an Agent Builder save:
600
+
601
+ - A new agent needs **Can create** on Agent Builder; you become its owner and
602
+ it starts unshared.
603
+ - An existing agent needs **editor** on it.
604
+ - The skills, MCP servers, Managed Functions and subagents it attaches must be
605
+ ones you may use, the same checks Agent Builder runs.
606
+ - The deploy never changes who can use the agent. Grant access in Agent Builder
607
+ or through the API. A definition that sets `permissions`, `isPublic` or
608
+ `publicOutputs` is refused.
609
+
610
+ `seq-studio agents apply` is the Sequence-staff path for Sequence's own
611
+ code-managed agents, whose definitions own their access as well.
612
+
583
613
  An optional `deploy-manifest.json` targets definitions by deployment identity:
584
614
 
585
615
  ```json
@@ -595,7 +625,7 @@ An optional `deploy-manifest.json` targets definitions by deployment identity:
595
625
  }
596
626
  ```
597
627
 
598
- Standalone workflow:
628
+ Sequence-managed standalone workflow (Sequence staff):
599
629
 
600
630
  ```bash
601
631
  pnpm dlx @sequenceholdings/studio-cli agents init support-agent
@@ -749,26 +779,27 @@ compiled to canonical SQL before registration.
749
779
  | `seq-studio orm migrate-from-yaml <dir>` | Convert a legacy YAML namespace to TypeScript authoring while preserving its committed migrations. |
750
780
  | `seq-studio orm import [dir] --spec <file>` | Plan a batched copy from an existing Postgres relation (a synced warehouse table) into an owned ORM table. Writes a SQL script; it does not connect or apply row policies. |
751
781
 
752
- Install the CLI and ORM package together:
782
+ Run ORM commands with the CLI installed in the package that owns the
783
+ namespace. A new namespace package lists both `@sequenceholdings/studio-cli` and
784
+ `@sequenceholdings/orm`, so after `pnpm install` everything runs through
785
+ `pnpm exec`. Start one with a one-off CLI:
753
786
 
754
787
  ```bash
755
- pnpm add -g @sequenceholdings/studio-cli@0.1.36 @sequenceholdings/orm@2.1.0
756
- ```
757
-
758
- The everyday loop is:
759
-
760
- ```bash
761
- seq-studio orm init lending
788
+ pnpm dlx --package @sequenceholdings/studio-cli --package @sequenceholdings/orm \
789
+ seq-studio orm init lending
762
790
  cd lending
763
791
  pnpm install
764
792
 
765
793
  # Edit sequence.config.ts, schema/*.ts, and graphql/**/*.ts.
766
- seq-studio orm generate .
767
- seq-studio orm plan . -e local
768
- seq-studio orm apply . -e local
769
- seq-studio orm validate .
794
+ pnpm exec seq-studio orm generate .
795
+ pnpm exec seq-studio orm plan . -e local
796
+ pnpm exec seq-studio orm apply . -e local
797
+ pnpm exec seq-studio orm validate .
770
798
  ```
771
799
 
800
+ A globally installed CLI can't run ORM commands under pnpm 11: pnpm 11 isolates
801
+ global packages, and `drizzle-kit` imports `drizzle-orm` without declaring it.
802
+
772
803
  `apply --dry-run` rehearses a migration against a disposable branch copy of
773
804
  the target environment's data. `apply --no-create` is the CI guard that refuses
774
805
  to provision a missing namespace. Destructive DDL requires explicit
@@ -832,7 +863,7 @@ datasets before adopting this path for latency-sensitive reads.
832
863
  | `seq-studio process lint [--dir <path>] [--offline]` | Static checks (graph, return contracts, agent schema, timeouts, and JSONata syntax); `--offline` skips live agent-schema lookup |
833
864
  | `seq-studio process plan [--dir <path>] -e <env>` | Build bundle, diff against currently-active version |
834
865
  | `seq-studio process apply [--dir <path>] -e <env> [--only <id1,id2>]` | Build → register bundle → promote each process. `--only` promotes just the named process ids (the bundle still contains the whole root — registration is inert) |
835
- | `seq-studio process apply --repo processes/<name> [--ref <r>] -e <env> [--only <id1,id2>]` | Same as above, but materializes the source from a platform git-service repo. Pinned commit SHA is injected as bundle provenance. Uses your `seq-studio login` (or the target realm's M2M JSON source path for CI) |
866
+ | `seq-studio process apply --repo <namespace>/<name> [--ref <r>] -e <env> [--only <id1,id2>]` | Same as above, but materializes the source from a platform git-service repo in `processes`, `apps`, or your own namespace. Pinned commit SHA is injected as bundle provenance. Uses your `seq-studio login` (or the target realm's M2M JSON source path for CI) |
836
867
  | `seq-studio process test [--dir <path>] -e <env> [--offline]` | CI wrapper: lint + plan, non-zero exit on errors or BREAKING diffs; see the offline limitation below |
837
868
  | `seq-studio process simulate <id> [--dir <path>]` | Isolated child-process walk with stubbed runners and hardened JSONata data-flow mapper evaluation (offline) |
838
869
  | `seq-studio process bundle build [--dir <path>] [-o file.json]` | Build a bundle locally |
@@ -967,6 +998,30 @@ same repo share Git review and commit provenance, but keep separate manifests,
967
998
  versions, runtime resources, secrets, and permissions. `--path` accepts only a
968
999
  canonical relative directory inside a remote repo; use `--dir` for local source.
969
1000
 
1001
+ ### Scoped group-member directory reads
1002
+
1003
+ A function may opt in to resolving selected members of existing Atlas groups:
1004
+
1005
+ ```yaml
1006
+ capabilities:
1007
+ directory:
1008
+ groups: ["<existing-group-id>"]
1009
+ ```
1010
+
1011
+ Use `createFunctionDirectoryClient` from
1012
+ `@sequenceholdings/managed-functions` to resolve selected group row IDs or
1013
+ exact canonical subjects (1–50 per request). This is a caller-delegated
1014
+ read capability, not a group grant or global user search; service/system
1015
+ invocations do not receive it. Current function access, declared group reach,
1016
+ caller visibility, and active tenant membership are checked at read time.
1017
+
1018
+ Requires CLI 0.5.2+, SDK 0.4.1+, and a deployment advertising
1019
+ `directory_members` in `seq-studio functions limits --json -e <env>`.
1020
+ Deploy preflight rejects unsupported deployments or stale tooling. Release
1021
+ the supporting Atlas build and packages before adding the declaration to a
1022
+ consumer; declaring it does not create groups, grant access, or bypass action
1023
+ permissions. See the SDK README for client usage and security boundaries.
1024
+
970
1025
  ### Deploying to local Atlas
971
1026
 
972
1027
  Start local Atlas, then use the same deployment workflow:
@@ -1187,6 +1242,13 @@ scope check. Keep the handler's accepted operation names explicit. The caller
1187
1242
  must still satisfy namespace runtime access, operation requirements, and row
1188
1243
  policies; declaring a table does not grant access to every row.
1189
1244
 
1245
+ Queries joining a built-in platform user (for example, an `author` relationship)
1246
+ also require the exact logical table name `platformUsers` in that namespace's
1247
+ `tables` list. Use `tables: [entries, platformUsers]` for an entries query that
1248
+ reads its author. Do not substitute a physical directory table name. This is
1249
+ an explicit read scope only; namespace access, operation requirements and row
1250
+ policies still apply. Ordinary namespace table names remain lowercase identifiers.
1251
+
1190
1252
  A function that reaches a namespace must attach a top-level `service_account`
1191
1253
  provided by its administrator. Caller-mode execution remains on behalf of the
1192
1254
  invoking user; attaching the account does not select service mode.
@@ -1660,8 +1722,9 @@ check-runs and cannot satisfy required merge gates. The legacy `require` and
1660
1722
  > for your environment with your administrator.
1661
1723
 
1662
1724
  `seq-studio pipeline <sub>` authors and validates Data Pipelines **stage
1663
- specs** — the typed contracts (`<name>.stage.yml`) in either a dedicated
1664
- Pipeline repo (`pipelines/<domain>`) or an app monorepo (`apps/<app>`).
1725
+ specs** — the typed contracts (`<name>.stage.yml`) in a dedicated Pipeline
1726
+ repo (`pipelines/<domain>`), an app monorepo (`apps/<app>`), or a repo in your
1727
+ own namespace (`<namespace>/<repo>`).
1665
1728
  Validation logic lives in
1666
1729
  `@sequenceholdings/pipeline-spec` (an optional peer, like `@sequenceholdings/orm`);
1667
1730
  install it alongside the CLI for local spec authoring and validation. The
@@ -1692,11 +1755,13 @@ first listed stage directory; without config it keeps using the package root.
1692
1755
  | `seq-studio pipeline codegen tables [--from <authoring.ts>] [--dir <dir>] [--dry-run] [--force]` | Generate one ingestion stage spec per table from a `PerTableIngestionAuthoring` TypeScript module. `--from` defaults to `authoring.tables.ts`; `--dir` defaults to the current package root and writes into its first configured stage directory (or the root without config). `--dry-run` lists output files without writing; existing files are preserved unless `--force` is supplied |
1693
1756
  | `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 |
1694
1757
  | `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 |
1695
- | `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 |
1696
- | `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] [--json]` | 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. |
1758
+ | `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`, `apps`, or your own namespace. 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 |
1759
+ | `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] [--json]` | Plan then enqueue deploy; Trigger runs `bundle validate` then `bundle deploy` against reviewed bytes. `<namespace>` is `pipelines`, `apps`, or your own namespace. 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. |
1697
1760
 
1698
1761
  `--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.
1699
1762
 
1763
+ Creating a release unit requires both **Can create** on Pipelines and Git Service **Writer** on the named repository. Once the release unit exists, further changes require its Pipeline `editor` tier.
1764
+
1700
1765
  `seq-studio pipeline deploy --dir <checkout> --repo <namespace>/<slug> -e <env>` publishes a clean local checkout into that environment's git service, then deploys the published commit through the same path. It is available on targets that do not require approval (`dev`, `staging`). BankSouth and production still deploy a commit that already exists in that environment's git service. Log in with `seq-studio login -e <env>` before publishing; the same user authenticates API and Git requests. Do not pass `--ref` with `--dir`. When the repository is created by this command, `main` is set to the published commit so a later clone without `--ref` resolves; an existing repository's default branch is left unchanged.
1701
1766
  | `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 |
1702
1767
  | `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. |
@@ -6,8 +6,12 @@ export interface ApplySummary {
6
6
  unchanged: number;
7
7
  }
8
8
  /** Each chunk is hashed over its own definitions — the apply route validates the body it received. */
9
- export declare function applyInChunks({ context, definitions, source, }: {
9
+ export declare function applyInChunks({ context, definitions, source, path, chunkSize, }: {
10
10
  context: CommandContext;
11
11
  definitions: AgentDefinition[];
12
12
  source: string;
13
+ /** The apply route: code-managed or config-only. */
14
+ path: string;
15
+ /** Definitions per request. */
16
+ chunkSize?: number;
13
17
  }): Promise<ApplySummary>;
@@ -5,10 +5,10 @@ const LOG = '[seq-studio]';
5
5
  // Chunked to stay inside the HTTP client's timeout; each agent commits independently anyway.
6
6
  const APPLY_CHUNK_SIZE = 20;
7
7
  /** Each chunk is hashed over its own definitions — the apply route validates the body it received. */
8
- export async function applyInChunks({ context, definitions, source, }) {
8
+ export async function applyInChunks({ context, definitions, source, path, chunkSize = APPLY_CHUNK_SIZE, }) {
9
9
  const chunks = [];
10
- for (let i = 0; i < definitions.length; i += APPLY_CHUNK_SIZE) {
11
- chunks.push(definitions.slice(i, i + APPLY_CHUNK_SIZE));
10
+ for (let i = 0; i < definitions.length; i += chunkSize) {
11
+ chunks.push(definitions.slice(i, i + chunkSize));
12
12
  }
13
13
  const total = { created: 0, updated: 0, unchanged: 0 };
14
14
  let applied = 0;
@@ -16,7 +16,7 @@ export async function applyInChunks({ context, definitions, source, }) {
16
16
  try {
17
17
  const result = await postJson({
18
18
  ...clientOptions(context),
19
- path: '/api/agents/deploy/apply',
19
+ path,
20
20
  body: {
21
21
  definitions: chunk,
22
22
  bundleHash: hashAgentBundle({ definitions: chunk }),
@@ -1,9 +1,18 @@
1
1
  import type { ParsedArgs } from '../process/commands.js';
2
2
  import { agentsInitCommand } from './scaffold.js';
3
3
  export { agentsInitCommand };
4
+ /**
5
+ * How a deploy treats an agent's access. `managed` is Sequence's code-managed
6
+ * path: the definition owns access, and only Sequence staff may use it.
7
+ * `config` deploys configuration only, as the caller, with the tiers Agent
8
+ * Builder uses; access stays whatever the UI or API set.
9
+ */
10
+ export type AgentDeployMode = 'managed' | 'config';
4
11
  export declare function agentsValidateCommand(args: ParsedArgs): Promise<number>;
5
12
  export declare function agentsPlanCommand(args: ParsedArgs): Promise<number>;
6
- export declare function agentsApplyCommand(args: ParsedArgs): Promise<number>;
13
+ export declare function agentsApplyCommand(args: ParsedArgs, { mode }?: {
14
+ mode?: AgentDeployMode;
15
+ }): Promise<number>;
7
16
  export declare function agentsListCommand(args: ParsedArgs): Promise<number>;
8
17
  export declare function agentsShowCommand(args: ParsedArgs): Promise<number>;
9
18
  export declare const AGENTS_USAGE = "usage:\n seq-studio agents init <dir> scaffold a typed agent\n seq-studio agents validate [--dir d] [--target app] [--only ids] offline compile + validation\n seq-studio agents plan [--dir d] [-e <env>] [--only ids] offline bundle plan or live diff\n seq-studio agents apply [--dir d] -e <env> [--only ids] [--yes] apply creates/updates; never deletes\n seq-studio agents list -e <env> list visible agents\n seq-studio agents show <id> -e <env> show one agent\n seq-studio agents voice help internal Voice authoring/publication\n\n Source: local --dir (default .), --repo agents/<name>, or --git-url <url>.\n Use --ref for remote sources. --target selects the deployment APP_ENV when it\n differs from the CLI environment alias (notably OpCo registrations). --only\n accepts a comma-separated list of agent IDs after environment selection.\n";
@@ -1,5 +1,6 @@
1
1
  import { getJson, postJson } from '../atlas-client.js';
2
2
  import { readConfig } from '../config.js';
3
+ import { wantsHelp } from '../command-input.js';
3
4
  import { applyInChunks } from './apply-chunks.js';
4
5
  import { confirmYes } from '../prompt.js';
5
6
  import { buildContext, clientOptions, flagBool, printError, requestedEnvironment, } from '../functions/commands.js';
@@ -7,6 +8,10 @@ import { compileAgentSource as compileSource, materializeAgentSource as material
7
8
  import { agentsInitCommand } from './scaffold.js';
8
9
  export { agentsInitCommand };
9
10
  const LOG = '[seq-studio]';
11
+ const DEPLOY_ROUTES = {
12
+ managed: { plan: '/api/agents/deploy/plan', apply: '/api/agents/deploy/apply' },
13
+ config: { plan: '/api/agents/deploy/config/plan', apply: '/api/agents/deploy/config/apply' },
14
+ };
10
15
  function requestedAgentIds(args) {
11
16
  const only = args.flags.only;
12
17
  if (only === undefined)
@@ -127,7 +132,8 @@ export async function agentsPlanCommand(args) {
127
132
  await source.cleanup();
128
133
  }
129
134
  }
130
- export async function agentsApplyCommand(args) {
135
+ export async function agentsApplyCommand(args, { mode = 'managed' } = {}) {
136
+ const routes = DEPLOY_ROUTES[mode];
131
137
  const { source, context } = await materialize({
132
138
  args,
133
139
  requireEnvironment: true,
@@ -138,7 +144,7 @@ export async function agentsApplyCommand(args) {
138
144
  const bundle = await deploymentBundle({ args, source, context });
139
145
  const plan = await postJson({
140
146
  ...clientOptions(context),
141
- path: '/api/agents/deploy/plan',
147
+ path: routes.plan,
142
148
  body: {
143
149
  definitions: bundle.definitions,
144
150
  bundleHash: bundle.hash,
@@ -150,6 +156,7 @@ export async function agentsApplyCommand(args) {
150
156
  `${LOG} apply ${bundle.definitions.length} agent definitions to ${context.env.name}`,
151
157
  `${LOG} bundle ${bundle.hash}`,
152
158
  `${LOG} no agents will be deleted`,
159
+ ...(mode === 'config' ? [`${LOG} access is managed in the UI or API; this deploy leaves it unchanged`] : []),
153
160
  ];
154
161
  if (!(await confirmYes({ preview, confirmed: flagBool(args.flags, 'yes') }))) {
155
162
  return 1;
@@ -158,6 +165,10 @@ export async function agentsApplyCommand(args) {
158
165
  context,
159
166
  definitions: bundle.definitions,
160
167
  source: source.provenance.gitCommit ?? 'local',
168
+ path: routes.apply,
169
+ // The server checks a config deploy as one bundle (agents it creates may
170
+ // name each other), so it must arrive whole, as plan saw it.
171
+ ...(mode === 'config' ? { chunkSize: Math.max(bundle.definitions.length, 1) } : {}),
161
172
  });
162
173
  console.log(`${LOG} applied: ${summary.created} created, ${summary.updated} updated, ${summary.unchanged} unchanged`);
163
174
  return 0;
@@ -207,6 +218,12 @@ export const AGENTS_USAGE = `usage:
207
218
  `;
208
219
  export async function runAgentsCommand(sub, args) {
209
220
  try {
221
+ // `agents <sub> --help` prints help instead of running the subcommand.
222
+ // Voice has its own help.
223
+ if (sub !== 'voice' && wantsHelp({ args })) {
224
+ console.log(AGENTS_USAGE);
225
+ return 0;
226
+ }
210
227
  switch (sub) {
211
228
  case 'voice': {
212
229
  const { runVoiceCommand } = await import('./voice.js');
@@ -2,8 +2,8 @@ import type { DeployPrimitiveArgs, PrimitiveDeployers } from './deploy.js';
2
2
  import type { PrimitiveEntry } from './manifest.js';
3
3
  /**
4
4
  * The pipeline's release unit — its id in Atlas, the same one deploy
5
- * registers: `pipelines/<name>`, or `apps/<name>@<path>` for one of an app's
6
- * pipelines.
5
+ * registers: `pipelines/<name>`, or `<namespace>/<name>@<path>` for one of an
6
+ * app's pipelines.
7
7
  */
8
8
  export declare function pipelineReleaseUnit(entry: PrimitiveEntry): string | undefined;
9
9
  /**
@@ -4,8 +4,8 @@ import { readFile, stat } from 'node:fs/promises';
4
4
  import { join } from 'node:path';
5
5
  import { load as loadYaml } from 'js-yaml';
6
6
  import { z } from 'zod';
7
- import { assertActiveDeployProvenance } from '@sequenceholdings/artifact-studio/active-deploy-policy';
8
- import { localGitMetadata, resolveArtifactSource } from '@sequenceholdings/artifact-studio/source-resolver';
7
+ import { resolveArtifactSource } from '@sequenceholdings/artifact-studio/source-resolver';
8
+ import { checkOfficialArtifactSource } from './official-source.js';
9
9
  const functionIdentitySchema = z.object({ function: z.object({ id: z.string() }) });
10
10
  const artifactIdentitySchema = z.object({ artifact: z.object({ project_id: z.string() }) });
11
11
  function selectedFlags({ entry }) {
@@ -55,18 +55,23 @@ async function validatePrimitiveIdentity({ entry, path }) {
55
55
  function requirePipelineSource({ entry }) {
56
56
  if (!entry.repo || !entry.ref) {
57
57
  throw new Error(`Pipeline "${entry.id}" requires repo and ref in sequence.app.yml. ` +
58
- 'Push its source to a pipelines/<name> or apps/<name> repository and pin that repository/ref; ' +
58
+ 'Push its source to a git-service repository (pipelines/<name>, apps/<name>, or your own namespace) and pin that repository/ref; ' +
59
59
  'pipeline deployment reads committed source from the platform git service.');
60
60
  }
61
61
  return { repo: entry.repo, ref: entry.ref };
62
62
  }
63
+ /**
64
+ * A `pipelines/*` repo is a dedicated Pipeline repo, deployed from its root.
65
+ * Any other repo (`apps/*` or a builder's own namespace) is the app's
66
+ * repository, holding this pipeline at its manifest path.
67
+ */
63
68
  function pipelineRoot(entry) {
64
- return entry.repo?.startsWith('apps/') ? entry.path : undefined;
69
+ return entry.repo && !entry.repo.startsWith('pipelines/') ? entry.path : undefined;
65
70
  }
66
71
  /**
67
72
  * The pipeline's release unit — its id in Atlas, the same one deploy
68
- * registers: `pipelines/<name>`, or `apps/<name>@<path>` for one of an app's
69
- * pipelines.
73
+ * registers: `pipelines/<name>`, or `<namespace>/<name>@<path>` for one of an
74
+ * app's pipelines.
70
75
  */
71
76
  export function pipelineReleaseUnit(entry) {
72
77
  if (!entry.repo)
@@ -80,8 +85,8 @@ async function validatePipelineSource(args) {
80
85
  const { buildContext, clientOptions } = await import('../functions/commands.js');
81
86
  const context = await buildContext({ positional: [], flags: { env: args.env } });
82
87
  const [namespace, name] = repo.split('/');
83
- if ((namespace !== 'pipelines' && namespace !== 'apps') || !name || repo.split('/').length !== 2) {
84
- throw new Error(`Pipeline "${args.entry.id}" requires a pipelines/<name> or apps/<name> repository.`);
88
+ if (!namespace || !name || repo.split('/').length !== 2) {
89
+ throw new Error(`Pipeline "${args.entry.id}" requires a <namespace>/<name> repository.`);
85
90
  }
86
91
  const source = await resolveArtifactSource({ kind: 'git-service', namespace, name, ref }, { ...clientOptions(context), ...(context.authMode ? { authMode: context.authMode } : {}) });
87
92
  try {
@@ -151,12 +156,8 @@ export async function validateAppPrimitive(args) {
151
156
  break;
152
157
  }
153
158
  case 'artifact': {
154
- if (env !== 'local') {
155
- assertActiveDeployProvenance({
156
- ...localGitMetadata(path),
157
- environment: env,
158
- });
159
- }
159
+ if (env !== 'local')
160
+ checkOfficialArtifactSource({ dir: path, env, dryRun: args.dryRun });
160
161
  const { runArtifactCommand } = await import('../artifact/delegate.js');
161
162
  code = await runArtifactCommand('validate', [path]);
162
163
  break;
@@ -181,9 +182,11 @@ export async function createDefaultDeployers() {
181
182
  return functionsDeployCommand({ positional: [], flags: { dir: path, env, ...(yes ? { yes: true } : {}) } });
182
183
  },
183
184
  async agent(args) {
185
+ // An app's agents deploy their configuration only; access is managed in
186
+ // the UI or API, never overwritten from code.
184
187
  return agentsApplyCommand({ positional: [], flags: {
185
188
  dir: args.path, env: args.env, ...selectedFlags(args), ...(args.yes ? { yes: true } : {}),
186
- } });
189
+ } }, { mode: 'config' });
187
190
  },
188
191
  async process(args) {
189
192
  return applyCommand({ positional: [], flags: { dir: args.path, env: args.env, ...selectedFlags(args) } });
@@ -7,7 +7,7 @@
7
7
  import type { ParsedArgs } from '../process/commands.js';
8
8
  export declare const APP_INIT_USAGE: string;
9
9
  export declare const APP_ADD_USAGE: string;
10
- export declare const APP_DEPLOY_USAGE = "usage:\n seq-studio deploy -e <env> [options]\n\n Deploy the app declared in sequence.app.yml. Versions 2 and 3 use\n depends_on prerequisites; deploy.order optionally orders ready primitives.\n Runs each kind's existing command:\n orm \u2192 seq-studio orm apply <path> -e <env>\n function \u2192 seq-studio functions deploy --dir <path> -e <env> [--yes]\n agent \u2192 seq-studio agents apply --dir <path> -e <env> [--yes]\n process \u2192 seq-studio process apply --dir <path> -e <env>\n pipeline \u2192 seq-studio pipeline deploy --repo <repo> --ref <ref> -e <env>\n artifact \u2192 seq-studio artifact deploy <path> -e <env>\n\n Options:\n -e, --env <name> target environment (required)\n --dir <path> app root (default: cwd; must contain sequence.app.yml)\n --only <id1,id2> deploy these ids and their prerequisites (v2)\n --yes non-interactive (forwarded to primitive commands)\n --dry-run validate/compile selected sources without deploying (v2)\n --approved-by <sub> recorded caller approval for protected pipeline targets\n --wait-timeout <d> pipeline polling timeout, e.g. 10m or 2h\n\n Examples:\n seq-studio deploy -e staging --yes\n seq-studio deploy -e local --only get-pokemon --yes\n seq-studio deploy --dir ./pokedex -e staging --dry-run\n\n Run from the app root (directory with sequence.app.yml), or pass --dir.\n Version 1 manifests keep their existing ordering and exact --only behavior.\n Pipelines require repo and ref in their manifest entry.\n ORM namespaces require generated code and a reviewed migration ledger:\n seq-studio orm generate <path> && seq-studio orm diff <path>\n Commit generated migrations before the first deployment and schema changes.\n Pipeline preflight reads the remote source and pins its commit; dry-run\n therefore needs network/auth for pipelines. Version 1 dry-run only lists.\n Version 2 writes the result to .sequence/deployments/<environment>.json.\n";
10
+ export declare const APP_DEPLOY_USAGE = "usage:\n seq-studio deploy -e <env> [options]\n\n Deploy the app declared in sequence.app.yml. Versions 2 and 3 use\n depends_on prerequisites; deploy.order optionally orders ready primitives.\n Runs each kind's existing command:\n orm \u2192 seq-studio orm apply <path> -e <env>\n function \u2192 seq-studio functions deploy --dir <path> -e <env> [--yes]\n agent \u2192 seq-studio agents apply --dir <path> -e <env> [--yes], config-only (access stays in Atlas)\n process \u2192 seq-studio process apply --dir <path> -e <env>\n pipeline \u2192 seq-studio pipeline deploy --repo <repo> --ref <ref> -e <env>\n artifact \u2192 seq-studio artifact deploy <path> -e <env>\n\n Options:\n -e, --env <name> target environment (required)\n --dir <path> app root (default: cwd; must contain sequence.app.yml)\n --only <id1,id2> deploy these ids and their prerequisites (v2)\n --yes non-interactive (forwarded to primitive commands)\n --dry-run validate/compile selected sources without deploying (v2)\n --approved-by <sub> recorded caller approval for protected pipeline targets\n --wait-timeout <d> pipeline polling timeout, e.g. 10m or 2h\n\n Examples:\n seq-studio deploy -e staging --yes\n seq-studio deploy -e local --only get-pokemon --yes\n seq-studio deploy --dir ./pokedex -e staging --dry-run\n\n Run from the app root (directory with sequence.app.yml), or pass --dir.\n Version 1 manifests keep their existing ordering and exact --only behavior.\n Pipelines require repo and ref in their manifest entry.\n ORM namespaces require generated code and a reviewed migration ledger:\n seq-studio orm generate <path> && seq-studio orm diff <path>\n Commit generated migrations before the first deployment and schema changes.\n Pipeline preflight reads the remote source and pins its commit; dry-run\n therefore needs network/auth for pipelines. Version 1 dry-run only lists.\n A dry-run never opens a browser login: without a session it skips the\n workspace-binding check and says so. It warns, rather than fails, when the\n artifact source is not committed and clean on main.\n Version 2 writes the result to .sequence/deployments/<environment>.json.\n";
11
11
  export declare function runAppInitCommand(args: ParsedArgs): Promise<number>;
12
12
  export declare function runAppAddCommand({ kindArg, args, }: {
13
13
  kindArg: string | undefined;