@sequenceholdings/studio-cli 0.1.31 → 0.2.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 (38) hide show
  1. package/README.md +335 -26
  2. package/dist/artifact/delegate.js +11 -2
  3. package/dist/atlas-client.d.ts +16 -0
  4. package/dist/atlas-client.js +26 -0
  5. package/dist/functions/bundle.js +4 -2
  6. package/dist/functions/commands.d.ts +12 -2
  7. package/dist/functions/commands.js +176 -14
  8. package/dist/functions/dev.d.ts +3 -0
  9. package/dist/functions/dev.js +97 -0
  10. package/dist/functions/egress-preview.d.ts +2 -1
  11. package/dist/functions/egress-preview.js +3 -2
  12. package/dist/functions/manifest.d.ts +18 -1
  13. package/dist/functions/manifest.js +19 -29
  14. package/dist/main.js +6 -1
  15. package/dist/pipeline/commands.js +16 -10
  16. package/dist/pipeline/lifecycle.d.ts +1 -0
  17. package/dist/pipeline/lifecycle.js +105 -28
  18. package/dist/pipeline/migrations.js +6 -1
  19. package/dist/pipeline/stage-secrets.d.ts +95 -0
  20. package/dist/pipeline/stage-secrets.js +166 -0
  21. package/dist/pipeline/templates.d.ts +1 -1
  22. package/dist/pipeline/templates.js +37 -3
  23. package/dist/process/build.js +1 -0
  24. package/dist/process/codegen.js +1 -0
  25. package/dist/process/lint.js +12 -7
  26. package/dist/process/plan-diff.js +1 -0
  27. package/dist/process/safety-baseline.d.ts +3 -3
  28. package/dist/process/safety-baseline.js +4 -5
  29. package/dist/process/simulate.js +7 -2
  30. package/dist/repos/commands.d.ts +11 -1
  31. package/dist/repos/commands.js +37 -11
  32. package/dist/secrets/commands.d.ts +1 -1
  33. package/dist/secrets/commands.js +73 -3
  34. package/dist/storage/commands.d.ts +2 -0
  35. package/dist/storage/commands.js +215 -0
  36. package/dist/templates/process/pnpm-workspace.yaml +3 -0
  37. package/package.json +7 -5
  38. package/templates/process/pnpm-workspace.yaml +3 -0
package/README.md CHANGED
@@ -376,7 +376,7 @@ compiled to canonical SQL before registration.
376
376
  Install the CLI and ORM package together:
377
377
 
378
378
  ```bash
379
- pnpm add -g @sequenceholdings/studio-cli@0.1.27 @sequenceholdings/orm@2.0.0
379
+ pnpm add -g @sequenceholdings/studio-cli@0.1.36 @sequenceholdings/orm@2.1.0
380
380
  ```
381
381
 
382
382
  The everyday loop is:
@@ -441,13 +441,14 @@ and returns an ISO-8601 string.
441
441
  | parallel `fan_out` | Context snapshot | — | Branch-item array |
442
442
  | parallel `join` | Context snapshot | `$branches` | Node output |
443
443
  | subprocess `output` | Context snapshot | `$child` | Node output |
444
+ | managed-function `output` | Context snapshot | `$response` | Node output |
444
445
  | node or supervisor retry predicate | `{ name, message }` | — | `true` to retry |
445
446
 
446
447
  `process lint` parse-checks all of these slots. `process simulate` evaluates
447
448
  the data-flow slots used by its topology walk (`input`, `fan_out`, `join`, and
448
449
  subprocess `output`). It intentionally keeps runners stubbed and therefore
449
- does not send email or execute due-date, ACL, artifact-reference, or retry
450
- behavior.
450
+ does not evaluate managed-function output mappers, send email, or execute
451
+ due-date, ACL, artifact-reference, or retry behavior.
451
452
 
452
453
  ### Remote source for `apply`
453
454
 
@@ -502,10 +503,13 @@ seq-studio process lint --dir my-processes --offline # finds both processes
502
503
  | Command | What it does |
503
504
  |---------|--------------|
504
505
  | `seq-studio functions init <dir>` | Scaffold one standalone TypeScript managed function |
506
+ | `seq-studio functions dev [--dir <dir>] [--port <port>]` | Run a local HTTP server with Managed Function cache context |
505
507
  | `seq-studio functions build [--dir <dir>]` | Validate a local manifest, bundle, lockfile, and size |
506
508
  | `seq-studio functions deploy --dir <dir> -e <env>` | Preview secrets and deploy a local function |
507
509
  | `seq-studio functions build --repo managed-functions/<name> [--path <dir>] -e <env>` | Materialize and validate a function from the platform Git Service |
508
510
  | `seq-studio functions deploy --repo managed-functions/<name> [--path <dir>] -e <env>` | Materialize and deploy a function from the platform Git Service |
511
+ | `seq-studio functions limits [-e <env>] [--json] [--fn <slug>]` | Inspect fleet, runtime, cache, and bundle defaults/caps; optionally inspect one function's effective runtime limits |
512
+ | `seq-studio functions invoke --fn <slug> -e <env> [--data <json> \| --data @<file> \| --stdin]` | Invoke a deployed function and print its response body |
509
513
 
510
514
  A normal function repo keeps `managed-function.yml` at its root and omits
511
515
  `--path`. A repo may also contain related, independently deployed functions:
@@ -538,20 +542,135 @@ same repo share Git review and commit provenance, but keep separate manifests,
538
542
  versions, runtime resources, secrets, and permissions. `--path` accepts only a
539
543
  canonical relative directory inside a remote repo; use `--dir` for local source.
540
544
 
545
+ ### Deploying to local Atlas
546
+
547
+ Start local Atlas, then use the same deployment workflow:
548
+
549
+ ```bash
550
+ seq-studio functions deploy --dir ./my-function -e local
551
+ seq-studio functions invoke --dir ./my-function -e local --data '{"name":"Atlas"}'
552
+ seq-studio functions logs --dir ./my-function -e local
553
+ seq-studio functions delete --dir ./my-function -e local --yes
554
+ ```
555
+
556
+ For a worktree, replace `local` with its environment from `seq-studio envs list`
557
+ (for example `local:my-worktree`). Local Atlas builds the uploaded source and
558
+ runs Google's Functions Framework in a supervised local Node process. It needs
559
+ neither GCP provisioning credentials nor a Trigger/Temporal worker for these
560
+ functions. Registry access is still required to install dependencies.
561
+
562
+ Create, deploy, promote, rollback, invoke, and delete use the normal Atlas
563
+ permissions. Redeploy starts a new process before switching the active runtime;
564
+ a failed replacement keeps the previous runtime. Deletion stops the process,
565
+ releases its port, and removes the function's local source/build/runtime files.
566
+ Version and invocation history remain in the development database. Shared
567
+ managed secrets remain until you delete the secret itself.
568
+
569
+ Set development secret values through the usual secrets workflow. Values are
570
+ stored in private local files, never fetched from staging. The function receives
571
+ only its declared secret mounts and runtime configuration. Enabled caching uses
572
+ bounded process-local memory; it resets on redeploy or restart. Local function
573
+ logs are bounded and reset with Atlas. Cloud infrastructure metrics are unavailable.
574
+
575
+ Local functions belong to the checkout and development database that created
576
+ them. Atlas will reject deployment/invocation/deletion of a copied cloud function
577
+ or a function owned by another worktree. After Atlas restarts, pending operations
578
+ resume and active function processes restart on first invocation. Children exit
579
+ when their Atlas parent exits, including a parent crash.
580
+
581
+ The local process uses Atlas's Node installation. It does not emulate cloud IAM,
582
+ VPC egress enforcement, autoscaling, CPU limits, or memory provisioning. Functions
583
+ are trusted development code running as your OS user. Hosted Atlas continues to
584
+ use GCP. `MANAGED_FUNCTIONS_EXECUTION_BACKEND=gcp` explicitly retains the cloud
585
+ backend for a local development process.
586
+
587
+ `seq-studio functions dev` remains a standalone HTTP harness; use `deploy -e local`
588
+ to exercise the function through Atlas.
589
+
590
+ Invoke payloads can be inline JSON, a JSON file prefixed with `@`, or stdin:
591
+
592
+ ```bash
593
+ seq-studio functions invoke --fn my-function -e local --data '{"name":"Atlas"}'
594
+ seq-studio functions invoke --fn my-function -e local --data @request.json
595
+ cat request.json | seq-studio functions invoke --fn my-function -e local --stdin
596
+ ```
597
+
598
+ The function response body is written to stdout so it can be piped to another
599
+ command. HTTP status is written to stderr, along with an invocation ID when one
600
+ is available. JSON responses are pretty-printed; other response bodies are
601
+ preserved as text. A non-2xx function response exits nonzero after printing the
602
+ body.
603
+
541
604
  ### Scaling
542
605
 
606
+ ```bash
607
+ seq-studio functions limits # installed CLI's bundled policy; offline
608
+ seq-studio functions limits -e staging # policy enforced by the deployed server
609
+ seq-studio functions limits -e staging --fn get-loan --json
610
+ ```
611
+
612
+ The catalog shares its definitions with manifest validation and server enforcement;
613
+ it is not a separately maintained help table. Use `-e` for authoritative environment
614
+ policy when CLI/server versions differ. A failed server lookup is an error, never a
615
+ silent fallback to local defaults. `--fn` additionally reports stored runtime limits
616
+ for that function, not measured live GCP configuration. Cache entries describe
617
+ platform policy and defaults, not that function's selected cache configuration.
618
+ Changing defaults or deployment caps does not rewrite existing functions' stored
619
+ runtime settings; inspect those with `--fn` and redeploy to apply manifest changes.
620
+
621
+ Each environment supports at most **100 non-archived managed functions** across
622
+ all organizations. Registered functions count even before their first deploy;
623
+ versions do not consume additional slots. At capacity, creating a new function
624
+ fails. Delete an unused function to free a slot. Existing functions can still
625
+ be invoked, redeployed, promoted, and rolled back.
626
+
543
627
  Managed functions keep one warm instance by default. Set `min_instances: 0`
544
628
  in `managed-function.yml` to scale to zero, or raise the floor when first-request
545
629
  latency matters:
546
630
 
547
631
  ```yaml
548
632
  limits:
633
+ cpu: 1
634
+ concurrency: 16
549
635
  min_instances: 1
550
636
  max_instances: 3
551
637
  ```
552
638
 
553
639
  `min_instances` defaults to `1`, cannot exceed `max_instances`, and incurs
554
- Cloud Run idle-instance charges while warm.
640
+ Cloud Run idle-instance charges while warm. `max_instances` defaults to `3`
641
+ and must be between `2` and `10` so every function can autoscale horizontally.
642
+
643
+ CPU and concurrency are configurable per function in `managed-function.yml`:
644
+
645
+ - `cpu`: `auto` (default), `1`, or `2` vCPUs. `auto` leaves allocation to the
646
+ provider based on memory; it is not a measurement of a deployed function's CPU.
647
+ Explicit fractional CPUs are not supported. Our platform requires at least
648
+ 512 MiB (`memory_mb: 512`) when selecting two CPUs.
649
+ - `concurrency`: 1–80 simultaneous requests **per instance**, default 1. Values
650
+ above 1 require an explicit CPU setting because provider-selected fractional
651
+ CPUs cannot support concurrent requests.
652
+
653
+ The example permits up to 16 requests per instance, sharing that instance's CPU
654
+ and memory. Three instances therefore provide capacity for up to 48 simultaneous
655
+ requests, not 48 instances. CPU-bound JavaScript may not benefit from more CPUs
656
+ without worker threads; I/O-heavy functions are better candidates for concurrency.
657
+ Opting into concurrency requires handlers to keep request-specific state out of
658
+ mutable globals. Redeploy with `seq-studio functions deploy -e <env>` to apply
659
+ these settings; promote and rollback carry the selected version's settings.
660
+
661
+ `invoke_rate_per_minute` applies per function **across all Atlas replicas in the
662
+ environment**, using Atlas's shared Redis. All callers and invocation sources
663
+ share one fixed 60-second window, starting with the first attempt. Exceeding it
664
+ returns `429` with `Retry-After` (seconds until the window expires). Rejected
665
+ attempts do not extend the window. Redis unavailability returns `503` without
666
+ executing the function; there is no per-process fallback, including when invoking
667
+ through a local Atlas instance. The standalone `functions dev` handler server
668
+ does not pass through Atlas and does not enforce this gateway quota.
669
+ This is not a rolling-minute or durable spending quota: adjacent windows permit
670
+ boundary bursts, and Redis key loss (restart or eviction) resets the window.
671
+ It controls how many requests are admitted over time; concurrency controls how many
672
+ execute simultaneously within an instance. Increasing concurrency does not raise
673
+ the configured invocation rate limit.
555
674
 
556
675
  ### Invocation IP allowlist
557
676
 
@@ -648,16 +767,16 @@ The API requires Managed Functions Admin on that org.
648
767
 
649
768
  `seq-studio artifact <sub>` is the entry point for Artifact Studio. It runs
650
769
  the `@sequenceholdings/artifact-studio` library (its `./cli` `runCli` export),
651
- routed through `~/.config/lattice/config.toml` and the shared seqapi token.
770
+ routed through `~/.config/lattice/config.toml` and the shared platform login.
652
771
 
653
772
  | Command | Underlying `runCli` verb |
654
773
  |---------|--------------------------|
655
- | `seq-studio artifact init <dir>` | `init <dir>` |
774
+ | `seq-studio artifact init <dir> [--template react-vite\|nextjs]` | `init <dir>` — defaults to the existing React/Vite scaffold |
656
775
  | `seq-studio artifact link [dir] -e <env> [--project <id>]` | `link [dir] --env <env>` |
657
- | `seq-studio artifact build [dir]` | `build [dir]` |
776
+ | `seq-studio artifact build [dir] [-e <env>]` | React/HTML: local bundle. Next.js: asynchronous hosted preview build on Atlas; use `pnpm build` for local compilation. |
658
777
  | `seq-studio artifact plan [dir] -e <env>` | `plan [dir] --env <env>` |
659
778
  | `seq-studio artifact deploy [dir] -e <env> [--skip-unchanged] [--no-create] [--project <id>]` | `deploy [dir] --env <env>` — `--skip-unchanged` no-ops (before building) when the remote active deployment's `sourceHash` **and** CLI/atlas-ui peer versions already match; `--no-create` errors instead of creating a missing project; `--project <id>` targets a project directly when duplicate slugs make the lookup ambiguous (slug must still match the manifest) |
660
- | `seq-studio artifact dev [dir] -e <env>` | `dev [dir] --env <env>` |
779
+ | `seq-studio artifact dev [dir] -e <env> [--link <pkgDir>[,<pkgDir>]] [--port <port>]` | React/HTML: rebuild preview on changes. Next.js: local development server and owner-only Atlas tunnel; `--port` selects its loopback port. |
661
780
  | `seq-studio artifact pull <project-id> -e <env> [--out <dir>]` | `pull <project-id> --env <env> [--out <dir>]` |
662
781
  | `seq-studio artifact list -e <env>` | `list --env <env>` — projects visible on the environment (slug, id, active version, visibility) |
663
782
  | `seq-studio artifact show <slug-or-id> -e <env>` | `show <slug-or-id> --env <env>` — one project's detail incl. active deployment, git provenance, and (for newer deployments) the building `artifact-studio` / force-aliased `atlas-ui` versions |
@@ -670,7 +789,7 @@ routed through `~/.config/lattice/config.toml` and the shared seqapi token.
670
789
  directory's `.artifact-studio/config.json` — run them from the linked artifact
671
790
  folder (or run `seq-studio artifact link` first).
672
791
 
673
- **Active (official) deploys to deployed environments require `main` with a
792
+ **React/HTML active (official) deploys to deployed environments require `main` with a
674
793
  resolved git commit and a clean artifact source directory** for both Git
675
794
  Service (`--repo`) and local sources. When a local source is nested in a larger
676
795
  checkout, dirty files outside that source directory are ignored with a warning.
@@ -681,12 +800,12 @@ deployed environments
681
800
  (`seq-studio artifact dev` / preview channel); promotion applies the same
682
801
  provenance check.
683
802
 
684
- **CLI atlas-ui stamp (DES-254):** builds force-alias `@sequenceholdings/atlas-ui`
803
+ **React/HTML CLI atlas-ui stamp (DES-254):** builds force-alias `@sequenceholdings/atlas-ui`
685
804
  to the CLI's copy — not the artifact's declared semver. Deployments record
686
805
  `cliVersion` + `atlasUiVersion`. Contract:
687
806
  `@sequenceholdings/artifact-studio` → `VERSION-PIN.md`.
688
807
 
689
- Studio CLI 0.1.31 carries Artifact Studio 0.2.5 with Atlas UI 3.1.2 pinned
808
+ Studio CLI 0.1.36 carries Artifact Studio 0.2.7 with Atlas UI 3.3.0 pinned
690
809
  exactly. Ordinary builds use canonical, mode-aware `tokens.css`; new projects
691
810
  use matching editor dependencies. Before rebuilding an older artifact, migrate
692
811
  numbered black/white opacity utilities to semantic roles and check a preview in
@@ -694,10 +813,110 @@ light and dark mode. Legacy stylesheet entry points remain temporary aliases;
694
813
  they do not restore retired utilities. Existing deployed bundles change only
695
814
  when rebuilt and activated.
696
815
 
816
+ ### Next.js applications (prerelease, opt-in Preview)
817
+
818
+ This implementation is not generally enabled; use only a reviewed prerelease
819
+ provided for an explicitly enabled pilot. Package publication and environment
820
+ rollout are separate release gates.
821
+
822
+ Next.js support requires a CLI/SDK release containing the Next.js scaffold and
823
+ an environment whose platform team has enabled the runtime and completed its
824
+ gateway/build/hosting setup. It is not enabled merely by upgrading the CLI.
825
+ Application developers need Atlas access, Node 24, pnpm and Git; no GCP account,
826
+ provider credentials or cloud devbox is required. Existing React/HTML projects
827
+ keep their current runtime unless their authors explicitly migrate them.
828
+
829
+ ```bash
830
+ seq-studio artifact init example-next-app --template nextjs
831
+ cd example-next-app
832
+ pnpm install
833
+ seq-studio artifact validate
834
+ pnpm type-check
835
+ pnpm build
836
+ ```
837
+
838
+ The scaffold pins approved Next.js 16.3 and React 19 versions and uses schema-v2
839
+ `artifact.bundle.yml`. It owns its React/Next dependencies; the React/Vite
840
+ platform aliases do not apply. Commit the generated `pnpm-lock.yaml`. `pnpm dev`
841
+ provides a standalone loopback UI check; SDK access to Atlas requires the
842
+ authorized development session below.
843
+
844
+ ```bash
845
+ seq-studio envs list
846
+ seq-studio login --env <environment>
847
+ seq-studio artifact link --env <environment>
848
+ seq-studio artifact dev --env <environment>
849
+ ```
850
+
851
+ The CLI starts Next.js with the supported Webpack development server on loopback and connects an authenticated outbound tunnel
852
+ to Atlas. It prints the owner-only preview URL and opens it in an interactive
853
+ terminal. Source stays on your computer. Fast Refresh handles compatible UI
854
+ edits; Next.js also reloads server code and reports compiler errors. Ctrl+C
855
+ stops the child process and revokes the session. A disconnected laptop has no
856
+ live preview; use a hosted preview when someone else needs to review the app.
857
+
858
+ Development recovery behavior:
859
+
860
+ - Manifest/capability changes stop the session with a restart instruction so
861
+ Atlas can authorize the new policy.
862
+ - Package/lockfile changes restart Next.js. Install changed dependencies with
863
+ `pnpm install`; the CLI does not silently install them.
864
+ - `--link <package-directory>` (comma-separate several) rebuilds the linked package, refreshes its built
865
+ output and restarts Next.js. Native Fast Refresh remains active for application
866
+ edits; a package restart can reset state.
867
+ - Network reconnect obtains a fresh tunnel lease and does not replay requests.
868
+ Unexpected local process crashes receive up to three consecutive restart
869
+ attempts, then exit with an actionable error.
870
+
871
+ Configure explicit nonproduction resource bindings in Atlas before making SDK
872
+ calls. Missing or revoked bindings fail rather than selecting production.
873
+ Managed secrets stay in hosted runtimes: use mocks, your own test credentials
874
+ or an existing governed function locally, and a hosted preview for secret-backed
875
+ application code. Browser capabilities and server capabilities are separate
876
+ manifest declarations. Never put a secret in `build.public_env` or `NEXT_PUBLIC_*`.
877
+ Local execution runs as your OS user; Atlas does not sandbox your laptop's
878
+ filesystem or arbitrary outbound connections.
879
+
880
+ For an immutable hosted preview, commit the source and connect its Git Service
881
+ repository, then run:
882
+
883
+ ```bash
884
+ seq-studio artifact build --repo <namespace>/<repository> --ref <branch> --env <environment>
885
+ ```
886
+
887
+ `artifact build . --env <environment>` also accepts a committed local project
888
+ with repository provenance for a hosted preview. It is not an offline build.
889
+ The CLI waits for Atlas's operation and prints the deployment link. `--out`
890
+ writes the completed operation/deployment receipt, not a JavaScript bundle.
891
+ Ctrl+C stops waiting but does not cancel the remote build. Next.js does not
892
+ support `artifact dev --once`; use the hosted build command instead.
893
+
894
+ Official releases fetch and verify source from the Git Service in the target
895
+ Atlas environment. Push the reviewed clean `main` revision before deploying:
896
+
897
+ ```bash
898
+ seq-studio artifact plan --repo <namespace>/<repository> --ref main --env <environment>
899
+ seq-studio artifact deploy --repo <namespace>/<repository> --ref main --env <environment>
900
+ ```
901
+
902
+ The Next.js `plan` command validates local source/toolchain inputs and prints the
903
+ proposed build; it does not currently perform a remote policy diff. Atlas checks
904
+ permissions, bindings and policy when the build is submitted. A local image or
905
+ an arbitrary remote repository is not accepted as official release evidence.
906
+ `--skip-unchanged` does not apply static-bundle skip logic to Next.js builds.
907
+
908
+ Atlas builds the production server and browser assets, checks the candidate and
909
+ activates the deployment. Review hosted behavior and configuration in Artifact
910
+ Studio before release. The hosted application runs independently of your
911
+ computer. Framework support is App Router on the approved Node profile; custom
912
+ Next servers, Pages Router, Edge runtime and production WebSocket services are
913
+ outside this Preview workflow.
914
+
697
915
  ### Source for `build` / `plan` / `deploy`
698
916
 
699
- These three commands read their source tree from one of three places — the rest
700
- of the pipeline (build → upload) is identical regardless of origin:
917
+ These commands can inspect source from three locations. React/HTML builds use
918
+ the local build/upload pipeline; Next.js uses the hosted workflow above, with
919
+ Git Service verification required for an official release:
701
920
 
702
921
  | Flag | Source |
703
922
  |------|--------|
@@ -705,7 +924,7 @@ of the pipeline (build → upload) is identical regardless of origin:
705
924
  | `--repo <ns>/<name>` | a repo in the platform Git Service, e.g. `--repo artifacts/accounts` |
706
925
  | `--git-url <url>` | a public, credential-free HTTPS git URL (cloned to a temp dir) |
707
926
 
708
- `--ref <branch\|tag\|commit>` selects the revision for `build` and `plan`
927
+ For React/HTML, `--ref <branch\|tag\|commit>` selects the revision for `build` and `plan`
709
928
  (default: the repo's default branch). Active deploys to deployed environments
710
929
  require `main`; local active deploys scope dirty-file checks to the source
711
930
  directory and warn about unrelated changes elsewhere in the checkout.
@@ -737,7 +956,7 @@ These three look similar but fetch different things:
737
956
  |---------|--------------|
738
957
  | `seq-studio artifact pull <project-id>` | Active **deployment** source files for an Artifact Studio project (built bundle inputs), keyed by project UUID — **not** git history |
739
958
  | `seq-studio repos clone <ns>/<name>` | Repo source tree. With `ATLAS_GIT_PAT`, a real `git clone` via smart-HTTP; otherwise JSON-API materialize (no `.git` dir) |
740
- | `seq-studio artifact deploy --repo <ns>/<name>` | Build + deploy an artifact whose source lives in the platform git service (materializes, builds, uploads) |
959
+ | `seq-studio artifact deploy --repo <ns>/<name>` | Build and deploy repository source; React/HTML builds locally, while Next.js uses Atlas's verified hosted build. |
741
960
 
742
961
  ## Auth (git-service PATs)
743
962
 
@@ -789,7 +1008,7 @@ JSON API — the same repos `--repo <ns>/<name>` sources build from.
789
1008
  | `seq-studio repos namespaces [create <slug>] -e <env>` | list namespaces, or create one (creator becomes owner) |
790
1009
  | `seq-studio repos show <ns>/<name> -e <env>` | detail: id, branches, clone URL; artifact project id when slug matches |
791
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) |
792
- | `seq-studio repos clone <ns>/<name> \| --url <clone-url> \| --id <uuid> -e <env> [--ref <r>] [--out <dir>] [--force]` | smart-HTTP `git clone` when `ATLAS_GIT_PAT` is set (`--url`/`--id` need no seqapi); otherwise JSON materialize + PAT hint |
1011
+ | `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`. |
793
1012
  | `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` |
794
1013
  | `seq-studio repos delete <ns>/<name> -e <env> [--yes]` | delete a repo — interactive confirm unless `--yes` |
795
1014
  | `seq-studio repos ci show <ns>/<name> -e <env> [--ref <r>]` | preview CI checks discovered from the ref |
@@ -823,8 +1042,9 @@ check names in Settings or with `repos ci require`/`repos ci import`.
823
1042
  ## Pipeline commands
824
1043
 
825
1044
  `seq-studio pipeline <sub>` authors and validates Data Pipelines **stage
826
- specs** — the typed contracts (`<name>.stage.yml`) a Pipeline repo
827
- (`pipelines/<domain>`) is made of. Validation logic lives in
1045
+ specs** — the typed contracts (`<name>.stage.yml`) in either a dedicated
1046
+ Pipeline repo (`pipelines/<domain>`) or an app monorepo (`apps/<app>`).
1047
+ Validation logic lives in
828
1048
  `@sequenceholdings/pipeline-spec` (an optional peer, like `@sequenceholdings/orm`);
829
1049
  install it alongside the CLI to use this family.
830
1050
 
@@ -833,14 +1053,14 @@ install it alongside the CLI to use this family.
833
1053
  | `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 |
834
1054
  | `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 |
835
1055
  | `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 |
836
- | `seq-studio pipeline plan --repo pipelines/<slug> --ref <sha\|branch> -e <env> [--target <id>] [--json]` | Enqueue and poll a durable Pipeline plan (materialize → SDK/`validateSpecGraph` → compile → live-diff → provision findings). 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 |
837
- | `seq-studio pipeline deploy --repo pipelines/<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. 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. |
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. |
838
1058
  | `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 |
839
- | `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 pipelines/<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. |
840
- | `seq-studio pipeline unbind --stage <slug> --ref <sha\|branch> -e <env> [--target <id>] --approved-by <you> [--resource-key <key>] [--repo pipelines/<slug>]` | Release an adopted binding on Trigger; the remote object stays live (never deleted) |
841
- | `seq-studio pipeline run-now --stage <slug> -e <env> [--target <id>] [--repo pipelines/<slug>] [--json]` | Run the stage's active job or DLT pipeline immediately and print its Databricks run URL |
842
- | `seq-studio pipeline promote --stage <slug> --version <v> -e <env> [--target <id>] [--repo pipelines/<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 |
843
- | `seq-studio pipeline rollback --stage <slug> -e <env> [--target <id>] [--repo pipelines/<slug>] [--approved-by <you>] [--wait-timeout <duration>] [--no-wait]` | Redeploy the previously retired deployment's version. Targets that require approval need `--approved-by`. |
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) |
1061
+ | `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
+ | `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
+ | `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`. |
844
1064
 
845
1065
  `-e/--env` selects the Atlas connection. `--target` selects the logical
846
1066
  pipeline target advertised by that endpoint. It is optional when the alias
@@ -891,11 +1111,30 @@ checks:
891
1111
  - { kind: orm_operation, namespace: finance, operation: VerifyAccounts }
892
1112
  ```
893
1113
 
894
- The old and new types come from deployed and proposed output declarations.
1114
+ The proposed output declarations define the desired types. Planning also checks
1115
+ the actual stored types against the deployed declarations.
895
1116
  Business calculations stay in Spark; the migration specifies coordination and
896
1117
  acceptance criteria. `VerifyAccounts` must be a persisted read operation in the
897
1118
  pinned ORM export. Each changed shared writer must participate.
898
1119
 
1120
+ If an earlier output declaration was inaccurate, explicitly record the observed
1121
+ Delta type under `baseline`, for example:
1122
+
1123
+ ```yaml
1124
+ baseline:
1125
+ - stage: gold
1126
+ output: gold.accounts
1127
+ columns:
1128
+ balance: decimal(18,2)
1129
+ ```
1130
+
1131
+ This allows that specific existing-column discrepancy only; the observation must
1132
+ match the native table, and unlisted drift still fails. The desired type still
1133
+ comes from the proposed output schema. A type already matching the desired type
1134
+ needs no schema conversion. Declared rebuilds and acceptance checks still run.
1135
+ This does not waive a mismatch in a Lakebase serving table or authorize dropping
1136
+ an undeclared column. Include each affected shared writer's baseline correction.
1137
+
899
1138
  For an ORM participant, update the namespace source, run `orm diff`, then
900
1139
  `orm generate --migration-export`, and commit the generated files with the
901
1140
  source. Run `orm generate --migration-export --check` in CI to catch stale
@@ -947,6 +1186,17 @@ already access. These commands remain Sequence-staff-only; their supporting
947
1186
  HTTP endpoints are internal. Untrusted authors require a separately verified
948
1187
  execution-identity boundary before this restriction can be lifted.
949
1188
 
1189
+ Candidate rebuilds currently require `write_pattern: overwrite`,
1190
+ `on_type_violation: fail`, and no quarantine destination. Planning checks these
1191
+ settings before compiling and persisting deployment bundles. Passing these
1192
+ checks does not prove that the authored Spark code uses the supplied
1193
+ `input_*` and `output_*` table parameters: producers that construct table names
1194
+ themselves must be adapted and tested before migration. Declare every history
1195
+ dependency explicitly; migration planning does not infer reads from Python code.
1196
+ Column declarations must preserve physical precision, for example
1197
+ `decimal(18,2)` rather than the generic `numeric` alias. ORM-bound serving
1198
+ projections can retain that declaration while the ORM consumes it as numeric.
1199
+
950
1200
  ### Managed Pipelines asset identity
951
1201
 
952
1202
  For native Polars transformations, use `engine: polars` and a regular Python
@@ -958,6 +1208,19 @@ requirements with the JSON-string `config.python_dependencies`; the default
958
1208
  installs `polars==1.34.0` and `deltalake==1.2.1`. `config.driver_memory_gb` is rejected because
959
1209
  this serverless Python task contract cannot honor it. See the
960
1210
  [pipeline spec Python argument contract](../pipeline-spec/README.md#native-polars-jobs).
1211
+ Set Polars-only `config.python_environment_version: '4'` to select environment 4;
1212
+ `'3'` is also accepted and remains the default when omitted. Changing the
1213
+ environment is an explicit deployment choice, independent of pip requirements.
1214
+
1215
+ Polars producers can declare source-scoped `write_scope` outputs and
1216
+ `trigger.refresh_serving` for an existing canonical serving stage, subject to the
1217
+ same disjoint ownership and target validation as Spark jobs. The entrypoint must
1218
+ enforce atomic source-scoped writes and finish publication verification before
1219
+ returning successfully. Serving refreshes run only after producer success.
1220
+ Manual triggers cannot include serving refreshes. See
1221
+ [shared gold writers](../pipeline-spec/README.md#shared-gold-writers) for the
1222
+ ownership and serving bootstrap requirements. Contract migration candidate and
1223
+ in-place execution remain limited to Spark-job producers.
961
1224
 
962
1225
  Compiled Databricks assets use stable, environment-qualified identities: display names are `{env}-MP-{type}-{stage}` (with `-trigger` for a scheduled DLT runner), DAB resource keys are `mp_{type}_{stage_snake_case}` (with `_trigger` for that runner), task keys are `{type}_{task}`, and bundles are `{env}-MP-pipelines-{domain}`. Compiled jobs and pipelines also carry `mp: "true"` and `mp_type: <type>` tags.
963
1226
 
@@ -1005,3 +1268,49 @@ contact your platform administrator.
1005
1268
  `config.toml`. The server does the work — register the bundle, promote the
1006
1269
  version, write the audit log — so the CLI runs from any checkout without
1007
1270
  server-side wiring on the developer's machine.
1271
+
1272
+
1273
+ ### Managed Function caching
1274
+
1275
+ Opt in with `cache: { enabled: true }` in `managed-function.yml` for a dedicated Valkey instance and a third handler argument, `context.cache`. Defaults: `custom-pico`, zero replicas, 30-second TTL. Explicit CRUD supports `get`, `set`, `setIfAbsent`, and `delete`; `getOrCompute` bypasses unavailable caching. Always authorize before cache access, scope keys to the result's audience, and handle invalidation after writes. Only Sequence members may change capacity above the baseline; previously approved capacity can be retained.
1276
+
1277
+ `seq-studio functions dev --dir ./my-function --port 8080` compiles the project's TypeScript and starts a local HTTP server with the same context. Enabled caching without an explicit Valkey configuration uses bounded per-process TTL/LRU memory, only in this local harness. It never allocates cloud resources. See the Managed Functions SDK README for contracts, failure semantics, and optional private Valkey development connections.
1278
+ ## Blob storage / Workspaces V2
1279
+
1280
+ The initial storage package and CLI additions are pending publication and public
1281
+ contract review. With a CLI build containing this feature, use the normal Atlas
1282
+ environment and credentials:
1283
+
1284
+ ```bash
1285
+ seq-studio storage init application-documents
1286
+ seq-studio storage validate workspace.yml
1287
+ seq-studio storage apply workspace.yml -e local
1288
+ seq-studio storage upload ./report.pdf --workspace <id> --path reports/report.pdf -e local
1289
+ seq-studio storage list --workspace <id> -e local
1290
+ seq-studio storage download --workspace <id> --node <file-id> --out ./copy.pdf -e local
1291
+ ```
1292
+
1293
+ Workspace YAML declares `workspace.name` and optional `workspace.description`.
1294
+ Folders are real resources, created by upload paths or `storage mkdir`. Resource
1295
+ permissions remain separate from provisioning. `storage access` reads sharing or
1296
+ applies an access JSON file with `expectedRevision`, `restricted` and `grants`.
1297
+ All Sequence organization members have Admin access to every workspace and its
1298
+ folders and files, including restricted folders. Tenant administrators may
1299
+ provision workspaces but need a workspace or folder grant to access existing
1300
+ resources they do not own.
1301
+
1302
+ Uploads stream directly to GCS and print the upload ID for recovery. Repeat with
1303
+ `--resume <upload-id>` and the same source file. `--replace <file-id> --revision <n>`
1304
+ replaces content with optimistic concurrency; it preserves prior immutable versions.
1305
+ Ctrl-C stops transfer without throwing away the resumable session. `storage abort`
1306
+ explicitly cancels it. Do not log session URLs or signed downloads.
1307
+
1308
+ `storage trash` and `restore` are reversible. `purge --yes` and workspace
1309
+ `delete --yes` return durable Temporal receipts; inspect `storage operations` and
1310
+ use `--retry <operation-id>` after correcting a failed cleanup. Each destructive
1311
+ command requires the expected resource revision. Run `storage help` for arguments.
1312
+
1313
+ For local full-stack integration, use `artifact dev`, `functions deploy`, `orm apply`
1314
+ and `storage apply` against the same `-e local` (or `local:<worktree>`). Storage uses
1315
+ the normal local Atlas authorization and lifecycle, with a dedicated development
1316
+ GCS bucket. The standalone `functions dev` harness does not mint storage delegation.
@@ -17,12 +17,12 @@ import { fetchCatalog, readCachedCatalog } from '../env-catalog.js';
17
17
  import { normalizeShortEnvFlag, readEnvFromArgv } from '../env-flags.js';
18
18
  import { PREVIEW_DOMAIN, PREVIEW_PROJECT, resolvePreviewByPr } from '../preview.js';
19
19
  const ARTIFACT_USAGE = `usage:
20
- seq-studio artifact init <dir>
20
+ seq-studio artifact init <dir> [--template react-vite|nextjs]
21
21
  seq-studio artifact validate [dir]
22
22
  seq-studio artifact build [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--out file.json]
23
23
  seq-studio artifact plan [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] -e <env>
24
24
  seq-studio artifact deploy [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] -e <env> [--skip-unchanged] [--no-create] [--project <id>]
25
- seq-studio artifact dev [dir] -e <env> [--once] [--key default]
25
+ seq-studio artifact dev [dir] -e <env> [--once] [--key default] [--link <pkgDir>[,<pkgDir>]] [--port <port>]
26
26
  seq-studio artifact pull <project-id> -e <env> --out <dir>
27
27
  seq-studio artifact promote <deployment-id> -e <env>
28
28
  seq-studio artifact rollback <deployment-id> -e <env>
@@ -44,6 +44,15 @@ const ARTIFACT_USAGE = `usage:
44
44
  Headless M2M builds use JSON materialize and accept only platform-managed
45
45
  --repo sources.
46
46
 
47
+ Next.js applications require Node.js 24 and application-local dependencies
48
+ (pnpm install). dev runs Next locally with native Fast Refresh through an
49
+ owner-only Atlas tunnel; no GCP access is required. build -e <env> requests a
50
+ hosted preview. Official deploys use a reviewed Git Service revision:
51
+ deploy --repo <namespace>/<name> --ref main -e <env>. A clean local checkout
52
+ with a Git Service origin on the target Atlas environment also works.
53
+ Use pnpm build for a local production-build check. --once is static-only;
54
+ --port selects the local Next loopback port.
55
+
47
56
  Per-PR preview environments (https://studio-atlas-git-<slug>.preview.seqholdings.com):
48
57
  -e preview:<branch-or-slug> compute the preview host from a branch name
49
58
  --pr <number> resolve the preview host from a PR (handles long slugs)
@@ -8,6 +8,12 @@ export interface ClientOptions {
8
8
  baseUrl: string;
9
9
  token: string;
10
10
  }
11
+ export interface AtlasResponse {
12
+ status: number;
13
+ contentType: string;
14
+ invocationId: string | null;
15
+ body: string;
16
+ }
11
17
  export declare class AtlasApiError extends Error {
12
18
  readonly status: number;
13
19
  readonly path: string;
@@ -26,6 +32,16 @@ export declare function postJson<T>({ baseUrl, token, path, body, }: ClientOptio
26
32
  path: string;
27
33
  body?: unknown;
28
34
  }): Promise<T>;
35
+ /**
36
+ * JSON POST for passthrough endpoints whose successful response is not
37
+ * necessarily JSON and whose non-2xx status may belong to the downstream
38
+ * application. The caller decides how to render and interpret the status.
39
+ */
40
+ export declare function postJsonResponse({ baseUrl, token, path, body, headers, }: ClientOptions & {
41
+ path: string;
42
+ body?: unknown;
43
+ headers?: Record<string, string>;
44
+ }): Promise<AtlasResponse>;
29
45
  export declare function putJson<T>({ baseUrl, token, path, body, }: ClientOptions & {
30
46
  path: string;
31
47
  body?: unknown;
@@ -120,6 +120,9 @@ function messageFromBody(body, status, statusText) {
120
120
  if (typeof record.error === 'string' && record.error.length > 0) {
121
121
  return withViolations(record.error);
122
122
  }
123
+ if (record.error && typeof record.error === 'object' && 'message' in record.error && typeof record.error.message === 'string') {
124
+ return withViolations(record.error.message);
125
+ }
123
126
  if (typeof record.message === 'string' && record.message.length > 0) {
124
127
  return withViolations(record.message);
125
128
  }
@@ -181,6 +184,29 @@ export async function postJson({ baseUrl, token, path, body, }) {
181
184
  throw await responseError(response, path);
182
185
  return response.json();
183
186
  }
187
+ /**
188
+ * JSON POST for passthrough endpoints whose successful response is not
189
+ * necessarily JSON and whose non-2xx status may belong to the downstream
190
+ * application. The caller decides how to render and interpret the status.
191
+ */
192
+ export async function postJsonResponse({ baseUrl, token, path, body, headers = {}, }) {
193
+ const response = await authenticatedFetch({
194
+ baseUrl,
195
+ token,
196
+ path,
197
+ init: {
198
+ method: 'POST',
199
+ headers: { 'Content-Type': 'application/json', ...headers },
200
+ body: body === undefined ? undefined : JSON.stringify(body),
201
+ },
202
+ });
203
+ return {
204
+ status: response.status,
205
+ contentType: response.headers.get('content-type') ?? '',
206
+ invocationId: response.headers.get('x-invocation-id'),
207
+ body: await response.text(),
208
+ };
209
+ }
184
210
  export async function putJson({ baseUrl, token, path, body, }) {
185
211
  const response = await authenticatedFetch({
186
212
  baseUrl,