@sequenceholdings/studio-cli 0.9.9 → 0.9.12

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 (44) hide show
  1. package/README.md +159 -24
  2. package/dist/artifact/delegate.js +8 -4
  3. package/dist/atlas-client.js +6 -57
  4. package/dist/auth.d.ts +0 -1
  5. package/dist/auth.js +9 -1
  6. package/dist/bin.js +7 -2
  7. package/dist/cli-attribution.d.ts +3 -0
  8. package/dist/cli-attribution.js +24 -0
  9. package/dist/command-contract.d.ts +8 -2
  10. package/dist/command-contract.js +3 -2
  11. package/dist/command-help.d.ts +5 -3
  12. package/dist/command-help.js +37 -4
  13. package/dist/command-telemetry.d.ts +11 -0
  14. package/dist/command-telemetry.js +97 -0
  15. package/dist/edge-auth-headers.d.ts +1 -0
  16. package/dist/edge-auth-headers.js +40 -0
  17. package/dist/functions/commands.js +1 -1
  18. package/dist/functions/manifest.js +2 -1
  19. package/dist/main.d.ts +2 -0
  20. package/dist/main.js +50 -3
  21. package/dist/orm/apply-source.d.ts +53 -0
  22. package/dist/orm/apply-source.js +86 -0
  23. package/dist/orm/delegate.js +27 -41
  24. package/dist/orm/deployment-policy.d.ts +2 -0
  25. package/dist/orm/deployment-policy.js +49 -0
  26. package/dist/orm/help.d.ts +1 -0
  27. package/dist/orm/help.js +44 -0
  28. package/dist/orm/history.d.ts +23 -0
  29. package/dist/orm/history.js +58 -0
  30. package/dist/orm/read.d.ts +1 -1
  31. package/dist/orm/read.js +4 -2
  32. package/dist/pipeline/commands.js +2 -1
  33. package/dist/pipeline/templates.js +5 -2
  34. package/dist/principals/commands.d.ts +1 -1
  35. package/dist/principals/commands.js +50 -2
  36. package/dist/process/build.js +6 -0
  37. package/dist/process/codegen.js +2 -0
  38. package/dist/process/commands.js +5 -2
  39. package/dist/process/plan-diff.js +4 -0
  40. package/dist/repos/git-credential.d.ts +8 -1
  41. package/dist/repos/git-credential.js +50 -4
  42. package/dist/templates/guidance/AGENTS.md +5 -0
  43. package/package.json +8 -8
  44. package/templates/guidance/AGENTS.md +5 -0
package/README.md CHANGED
@@ -41,6 +41,13 @@ verifies and copies the selected release into a new or empty directory.
41
41
  `--json` for automation. It reports this CLI's command groups and does not imply
42
42
  that the underlying platform HTTP routes are public contracts.
43
43
 
44
+ Authenticated commands send a best-effort completion event to the Atlas
45
+ environment they use, recording command name, outcome, duration, and CLI version
46
+ without arguments or error messages. Command telemetry is on by default. Use
47
+ `seq-studio telemetry disable|enable|status` to control it, or set
48
+ `SEQ_STUDIO_TELEMETRY=off` for one process. This setting affects command events;
49
+ Atlas still records authenticated API activity for version adoption.
50
+
44
51
  ### Piped output
45
52
 
46
53
  Commands with `--json` (or `--jsonl`) write only their structured result to
@@ -911,6 +918,10 @@ compiled to canonical SQL before registration.
911
918
  | `seq-studio orm plan [dir] -e <env>` | Compare the compiled namespace with registry state without applying database changes. |
912
919
  | `seq-studio orm diff [dir] [--check]` | Author the next committed migration, or verify the migration/snapshot chain offline for CI. |
913
920
  | `seq-studio orm apply [dir] -e <env> [--timeout <duration>] [--no-wait]` | Author a migration if needed, register/apply the namespace, activate its operation set, publish its declared capabilities, and refresh generated outputs. Waits until the new version is live (prints `live:`; default up to 20m); `--no-wait` returns once queued. |
921
+ | `seq-studio orm history <namespace> -e <env> [--limit N] [--json]` | List every change to the namespace's live schema and operations, newest first, with the actor and the Git Service source. `apply` from a clone of the target environment's Git Service (or `--repo`) sends its commit and package path; Atlas checks it and records `verified`, `ci` or `reported`. Recording never refuses an apply. |
922
+ | `seq-studio orm deployment-policy <namespace> -e <env> [--json]` | Inspect whether a namespace permits manual deployment or requires its enrolled repository's verified CI deployment. |
923
+ | `seq-studio orm deployment-policy <namespace> -e <env> --mode ci --repo <ns>/<name> --branch <branch> --target <target-key>` | Explicitly enroll an existing namespace. Requires namespace Admin, repository Admin, and an automatic branch policy already bound to this exact namespace. |
924
+ | `seq-studio orm deployment-policy <namespace> -e <env> --mode manual` | Restore direct, permission-checked deployment; requires namespace Admin. |
914
925
  | `seq-studio orm execute <namespace> <operation> -e <env> [--variables-file <file>] [--var <name>=<value>]...` | Execute the deployed version's persisted operation by name, as the signed-in caller. Needs no checkout. |
915
926
  | `seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>` | Execute an operation from the checkout's manifest through the installed ORM package, with variables from a JSON object file, as the signed-in caller. |
916
927
  | `seq-studio orm namespaces -e <env> [--limit N] [--offset N] [--json]` | List the namespaces you can read. |
@@ -946,6 +957,17 @@ pnpm exec seq-studio orm apply . -e local
946
957
  pnpm exec seq-studio orm validate .
947
958
  ```
948
959
 
960
+ Existing namespaces remain in manual mode until explicitly enrolled. Automatic
961
+ repository bindings alone do not enable CI-only enforcement. CI-managed namespaces
962
+ reject direct registration, schema apply, and operations-only activation on Atlas,
963
+ including old CLIs and applies queued before enrollment. CI must match the enrolled
964
+ repository, branch, target, authorizer, current deployment intent, and verified build
965
+ output. Removing a repository policy does not silently restore manual mode; an
966
+ administrator must explicitly change the namespace policy. Local generate, validate,
967
+ and plan remain available. Runtime reads and writes keep their existing permissions.
968
+ Deploy this support to Atlas and every ORM apply worker before enrolling namespaces,
969
+ so applies queued before enrollment also run the policy check.
970
+
949
971
  Global ORM commands require a CLI release that declares `drizzle-orm` directly.
950
972
  Older releases can fail during module loading because `drizzle-kit` imports
951
973
  `drizzle-orm` without declaring it. Update the global CLI if you see that error.
@@ -1082,6 +1104,8 @@ seq-studio orm sql lending -e <env> \
1082
1104
  parameter type; the listed `--param` types remain unchanged.
1083
1105
  - `sql` must reference every table as `<namespace>.<table>` (`FROM lending.loans`, not
1084
1106
  `FROM loans`); unqualified names and queries without a table (`SELECT 1`) are rejected.
1107
+ Double-quote mixed-case column names, for example `SELECT "loanNumber" FROM lending.loans`;
1108
+ unquoted SQL identifiers are folded to lowercase.
1085
1109
  The grammar is read-only `SELECT` with joins, CTEs, `UNION`, aggregates, and comparison
1086
1110
  operators; it has no `LIKE` or `IN`. When the server rejects a statement it says only
1087
1111
  "SQL query is invalid or unsupported", so the CLI adds a hint with these rules.
@@ -1381,11 +1405,13 @@ version's final status determines whether the command succeeds or fails. If
1381
1405
  lifecycle status is unavailable, the command continues to report version status.
1382
1406
  Use `functions logs` for sanitized readiness connection diagnostics.
1383
1407
 
1384
- Set `runtime: nodejs24` in `managed-function.yml` to use Node.js 24 on a hosted
1385
- deployment. Node.js 20 (`nodejs20`) remains the default when `runtime` is omitted.
1386
- These are the supported manifest values; other runtimes are rejected. Keep
1387
- `package.json`'s `engines.node` compatible with the selected runtime, for example
1388
- `"24.x"` for Node.js 24. Local development uses the installed Node version.
1408
+ `runtime` in `managed-function.yml` selects the hosted Node.js version:
1409
+ `nodejs24` (the default when `runtime` is omitted) or `nodejs20`. Other runtimes
1410
+ are rejected. Node.js 20 is end of life upstream, so keep it only for a function
1411
+ not yet verified on Node.js 24. Each deployed version keeps the runtime it was
1412
+ deployed with, so promote and rollback never change it; a new deploy uses the
1413
+ manifest's value. Keep `package.json`'s `engines.node` compatible with the
1414
+ selected runtime, for example `"24.x"` for Node.js 24. Local development uses the installed Node version.
1389
1415
 
1390
1416
  A normal function repo keeps `managed-function.yml` at its root and omits
1391
1417
  `--path`. A repo may also contain related, independently deployed functions:
@@ -1459,6 +1485,18 @@ the supporting Atlas build and packages before adding the declaration to a
1459
1485
  consumer; declaring it does not create groups, grant access, or bypass action
1460
1486
  permissions. See the SDK README for client usage and security boundaries.
1461
1487
 
1488
+ ### Selecting a deployed function without its source
1489
+
1490
+ To delete a deployed function when its source directory is unavailable, select
1491
+ it by slug instead of reading a local manifest:
1492
+
1493
+ ```bash
1494
+ seq-studio functions delete -e staging --fn my-function --yes
1495
+ ```
1496
+
1497
+ `--fn <slug>` also selects a function for `promote` and `rollback`; without it,
1498
+ these commands use the manifest in the current directory (or `--dir`).
1499
+
1462
1500
  ### Deploying to local Atlas
1463
1501
 
1464
1502
  Start local Atlas, then use the same deployment workflow:
@@ -1787,7 +1825,7 @@ successfully. Help does not initialize files, authenticate, or deploy.
1787
1825
  | `seq-studio artifact plan [dir] -e <env>` | `plan [dir] --env <env>` |
1788
1826
  | `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) |
1789
1827
  | `seq-studio artifact deploy --repo <ns>/<name> --ref <branch> --preview [--key <key>] -e <env>` | Builds any branch, tag, or commit as a preview and prints its link; see "Previews" below. Works for React/HTML and Next.js (`--key` is React/HTML only), and from an agent sandbox |
1790
- | `seq-studio artifact dev [dir] -e <env> [--link <pkgDir>[,<pkgDir>]] [--port <port>] [--local-secrets <bindings.json>] [--bundler turbopack\|webpack]` | React/HTML: rebuild preview on changes. Next.js: local development server and owner-only Atlas tunnel; `--port` selects its loopback port, `--bundler` its bundler (default Turbopack). |
1828
+ | `seq-studio artifact dev [dir] -e <env> [--link <pkgDir>[,<pkgDir>]] [--port <port>] [--secret-source local|hosted|none] [--local-secrets <bindings.json>] [--bundler turbopack\|webpack]` | React/HTML: rebuild preview on changes. Next.js: local development server and owner-only Atlas tunnel; `--port` selects its loopback port, `--bundler` its bundler (default Turbopack). |
1791
1829
  | `seq-studio artifact pull <project-id> -e <env> [--out <dir>]` | `pull <project-id> --env <env> [--out <dir>]` |
1792
1830
  | `seq-studio artifact list -e <env> [--json]` | `list --env <env>` — projects visible on the environment (slug, id, active version, visibility); `--json` emits the response object |
1793
1831
  | `seq-studio artifact show <slug-or-id> -e <env> [--json]` | `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; `--json` emits the response object |
@@ -2355,7 +2393,8 @@ targets: []
2355
2393
  ```
2356
2394
 
2357
2395
  Atlas discovers the file on the pull request's head or base and runs checks on
2358
- PR creation and updates to its head or base. Repository CI and deployment jobs
2396
+ PR creation and updates to its head. A base change is re-verified at merge, and
2397
+ only a delta reaching control files or target inputs queues a recheck. Repository CI and deployment jobs
2359
2398
  use Buildkite, including for local destinations. Next.js resources may explicitly
2360
2399
  select Modal for compilation. Each run uses the platform
2361
2400
  image defaults; no image digest or manual branch-policy setup is
@@ -2510,6 +2549,13 @@ root, stage identities, deployment admission or rollback provenance.
2510
2549
 
2511
2550
  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.
2512
2551
 
2552
+ Changing or explicitly resuming a paused native job schedule is a non-overridable
2553
+ schedule-drift blocker. Converting the job to manual-only (no compiled `schedule`,
2554
+ `continuous`, or `trigger`) is an ordinary update: the plan still shows the cron
2555
+ and timezone being removed. The job and its native ID remain; removing its
2556
+ schedule does not cancel an already-running execution. After deployment, verify
2557
+ the native job has no schedule before treating scheduled ingestion as retired.
2558
+
2513
2559
  For an existing pipeline release unit in the target, use
2514
2560
  `--source-env <first-party-env>` with `pipeline plan` or repository-based
2515
2561
  `pipeline deploy` to read canonical source from another environment. `-e` still
@@ -2776,9 +2822,10 @@ unsupported dependencies are reported explicitly. This report is advisory;
2776
2822
  ordinary deployment behavior remains unchanged.
2777
2823
 
2778
2824
  Commit a versioned `migrations/<id>.yml` manifest, then add `--migration <id>` to
2779
- `pipeline plan` to prepare its execution plan. The manifest declares participating pipeline repositories,
2780
- column additions/type changes, stages that rebuild their complete writer scopes,
2781
- and acceptance checks. Every participant ref resolves to an immutable commit.
2825
+ `pipeline plan` to prepare its execution plan. The manifest declares
2826
+ participating pipeline repositories, column additions, type changes, nullable
2827
+ relaxations, stages that rebuild their complete writer scopes, and acceptance
2828
+ checks. Every participant ref resolves to an immutable commit.
2782
2829
  The assessment validates all proposed shared writers together.
2783
2830
 
2784
2831
  For example, after changing both writers' Spark code and output declarations to
@@ -2866,7 +2913,8 @@ schedules. After publication, it retains reservations and backups for forward
2866
2913
  recovery; it does not promise automatic rollback. Resume first reconciles the
2867
2914
  recorded native operations so a lost response does not duplicate completed work.
2868
2915
 
2869
- V1 supports managed batch Spark writers, declared column additions/type changes,
2916
+ V1 supports managed batch Spark writers, declared column additions/type changes
2917
+ and explicit `relax_column_nullability` transitions for non-key columns,
2870
2918
  Snapshot copies, supported SQL views and ORM v2 exports. Primary-key changes,
2871
2919
  stateful DLT/CDF migrations, unknown dependencies and unmodeled resources block
2872
2920
  planning. Spark packages must use the migration runtime bindings and remain
@@ -2884,6 +2932,9 @@ checks does not prove that the authored Spark code uses the supplied
2884
2932
  `input_*` and `output_*` table parameters: producers that construct table names
2885
2933
  themselves must be adapted and tested before migration. Declare every history
2886
2934
  dependency explicitly; migration planning does not infer reads from Python code.
2935
+ Nullable relaxations retain the same physical type, require a full writer rebuild,
2936
+ and cannot remove physical Delta or Lakebase `NOT NULL` constraints. Those
2937
+ constraints need a separately supported transition before this migration can run.
2887
2938
  Column declarations must preserve physical precision, for example
2888
2939
  `decimal(18,2)` rather than the generic `numeric` alias. ORM-bound serving
2889
2940
  projections can retain that declaration while the ORM consumes it as numeric.
@@ -3058,10 +3109,31 @@ the normal local Atlas authorization and lifecycle, with a dedicated development
3058
3109
  GCS bucket. The standalone `functions dev` harness does not mint storage delegation.
3059
3110
 
3060
3111
 
3061
- ### Local Next.js server secrets
3112
+ ### Next.js server secrets in `artifact dev`
3113
+
3114
+ `artifact dev` always runs your Next.js server on your machine, with a scrubbed
3115
+ environment: no Atlas, cloud, or Doppler credentials reach it. `-e` selects the
3116
+ control plane (sessions, permissions, the preview tunnel), not where the code
3117
+ runs. Hosted servers come only from `artifact deploy --preview` or an official
3118
+ deploy, which mount secrets themselves.
3119
+
3120
+ Choose where declared `server.secrets` values come from with `--secret-source`:
3121
+
3122
+ | `--secret-source` | Default when | Reads | Authority |
3123
+ | --- | --- | --- | --- |
3124
+ | `local` | `-e local` (a loopback Atlas) | The local Atlas's personal store | Project write, editor on each local secret |
3125
+ | `hosted` | never (explicit only) | The selected hosted Atlas, at the manifest's exact pinned `version` | Project write, editor on each secret, a staging deployment |
3126
+ | `none` | any hosted `-e` | Nothing; `artifact dev` lists the declared names it skipped | None |
3127
+
3128
+ Only declared `server.secrets` entries are injected, and only into the Next
3129
+ server process. They never become `NEXT_PUBLIC_*` or build variables, and they are
3130
+ never written to session metadata, runtime files, or logs. Your server code must
3131
+ keep them out of responses. Values are read once when `artifact dev` starts.
3132
+
3133
+ #### Local store (`-e local`)
3062
3134
 
3063
3135
  With local Atlas running on a personal `dev-*` Lakebase branch, create a managed
3064
- secret and set its value through the local Secrets store:
3136
+ secret and set its value in the local Secrets store:
3065
3137
 
3066
3138
  ```sh
3067
3139
  seq-studio secrets create PROVIDER_KEY -e local
@@ -3069,7 +3141,6 @@ seq-studio secrets set PROVIDER_KEY --from-file /private/path/provider-key -e lo
3069
3141
  seq-studio artifact dev ./web -e local
3070
3142
  ```
3071
3143
 
3072
- Only declared `server.secrets` entries are injected into the Next server child.
3073
3144
  A `secret_name` declaration defaults to that registry name; a `secret_id`
3074
3145
  declaration defaults locally to the declared environment name. Local development
3075
3146
  uses the local default value, independently of the hosted ID/version pin.
@@ -3084,17 +3155,48 @@ To use a different local name, pass `--local-secrets ./local-secret-bindings.jso
3084
3155
  { "APP_PROVIDER_KEY": "MY_DEV_PROVIDER_KEY" }
3085
3156
  ```
3086
3157
 
3087
- The file contains names only. The developer needs project write access, an owned
3088
- active session, and managed-secret editor (or higher) permission. Use-only secret
3089
- permission cannot export values. Only single-value secrets stored in this Atlas
3090
- workspace are accepted; hosted values and values from another checkout are
3091
- rejected, even when their metadata came from a database clone. Hosted Atlas
3092
- sessions never export secrets to the local CLI. The flag requires a loopback
3093
- Atlas URL, including local environments discovered on another port.
3158
+ The file contains names only. Use-only secret permission cannot export values.
3159
+ Only single-value secrets stored in this Atlas workspace are accepted; hosted
3160
+ values and values from another checkout are rejected, even when their metadata
3161
+ came from a database clone. The local source requires a loopback Atlas URL,
3162
+ including local environments discovered on another port.
3094
3163
 
3095
- Values are passed explicitly to the Next child, never to public build variables,
3096
- logs, or persisted runtime/session metadata. Restart `artifact dev` after rotation
3097
- or a local binding change. App server code must keep secrets out of responses.
3164
+ #### Hosted source (a staging environment)
3165
+
3166
+ To test against a hosted integration, such as a provider's UAT credential, read
3167
+ the same secret versions a hosted preview would mount, without copying values:
3168
+
3169
+ ```sh
3170
+ seq-studio envs list # find your staging environment's name
3171
+ seq-studio login -e <staging-env>
3172
+ seq-studio artifact dev ./web -e <staging-env> --secret-source hosted
3173
+ ```
3174
+
3175
+ The hosted Atlas checks, on every start: your project write access and active
3176
+ session; managed-secret **editor** (or higher) on each declared secret, the same
3177
+ authority `deploy --preview` needs to attach it; that each secret is a
3178
+ single-value secret in this deployment's registry; and that the pinned `version`
3179
+ is recorded and enabled. Use-only (`user`) permission lets a hosted runtime
3180
+ consume a secret but never exports it to your machine. Hosted values are available only from
3181
+ staging deployments, and `--secret-source hosted` always needs an explicit `-e`,
3182
+ so a default environment never supplies a production credential. Use dedicated
3183
+ staging test secrets. Each release is audited with secret names, IDs, and
3184
+ versions, never values. `--local-secrets` does not apply: hosted values follow
3185
+ `server.secrets` exactly.
3186
+
3187
+ #### Rotation and restarts
3188
+
3189
+ Values are read once, when `artifact dev` starts. Automatic Next.js restarts
3190
+ (dependency changes, crashes) reuse them.
3191
+
3192
+ - **Local:** after `secrets set`, stop and restart `artifact dev`.
3193
+ - **Hosted:** bindings are pinned. Set the new value, update `version` in
3194
+ `artifact.bundle.yml` (`artifact dev` stops and asks you to restart), and
3195
+ start it again. A disabled or destroyed pinned version fails at start with the
3196
+ secret's name and version.
3197
+ - Revoking the session in Atlas, or losing project write access, stops
3198
+ `artifact dev`. Removing secret permission takes effect at the next start: a
3199
+ running server keeps the values it received until it stops.
3098
3200
 
3099
3201
 
3100
3202
  ## Composed applications (0.4.0)
@@ -3191,6 +3293,9 @@ seq-studio principals search <query> -e <env> [--types user,group,service-accoun
3191
3293
  seq-studio principals users search <query> -e <env>
3192
3294
  seq-studio principals groups list -e <env> [--search <query>] [--limit <n>] [--page <n>]
3193
3295
  seq-studio principals groups show <group-id> -e <env> [--limit <n>] [--offset <n>]
3296
+ seq-studio principals groups create "Brokerage Team" -e <env> [--description <text>] [--request-id <uuid>]
3297
+ seq-studio principals groups members add <group-id> -e <env> --principal-id '<user-sub>' [--principal-id '<user-sub>' ...]
3298
+ seq-studio principals groups members remove <group-id> -e <env> --principal-id '<user-sub>'
3194
3299
  ```
3195
3300
 
3196
3301
  Results are JSON, and each principal carries
@@ -3203,6 +3308,17 @@ members (50 per page) and reports a group you can't see as not found. An agent s
3203
3308
  token sees exactly its caller's view. Requires CLI 0.8.0+ and an Atlas release with
3204
3309
  the caller mode of `/api/authz/principals/search`.
3205
3310
 
3311
+ `groups create` creates a local group and makes the caller its admin. It prints a
3312
+ request UUID to stderr before sending; if the result is uncertain, repeat the
3313
+ same command with `--request-id` to get the same group, not a duplicate.
3314
+ `members add` accepts up to 50 distinct authenticated user subjects from
3315
+ `principals users search`. It leaves existing roles unchanged and rejects
3316
+ disabled or out-of-tenant users. `members remove` accepts one subject and
3317
+ revokes that membership; the last group admin cannot be removed. Both commands
3318
+ require permission to administer a CLI-created group in your tenant. A member
3319
+ may also remove themself. JSON receipts
3320
+ show created versus existing groups and newly added versus existing members.
3321
+
3206
3322
  **Capabilities are code, roles are data.** A resource's source declares the
3207
3323
  capabilities its code checks; the roles that bundle them are created and edited
3208
3324
  in Atlas:
@@ -3379,3 +3495,22 @@ OpCo environments, staging and production can share a Databricks workspace while
3379
3495
  remaining separate catalog/binding identities. Sync refuses foreign-workspace and
3380
3496
  foreign-environment destination bindings. It does not switch profiles or make local
3381
3497
  Atlas mirror another tenant automatically.
3498
+
3499
+ ### API usage and version attribution
3500
+
3501
+ Native authenticated Atlas requests send `x-sequence-client: seq-studio` and
3502
+ `x-sequence-client-version` with this installed CLI package's version. Atlas can
3503
+ record a daily active-version observation for the verified principal. This
3504
+ contains the deployment, UTC day, principal ID/kind, and version; it does not
3505
+ include email, command arguments, request bodies, or URLs. Machine credentials
3506
+ and delegated agent sessions are separate from human users. These are API
3507
+ activity observations, **not command counts**.
3508
+
3509
+ Coverage includes the native Atlas client, its operator SDK adapter, and
3510
+ pipeline assets/contracts fetches to authenticated configured Atlas origins.
3511
+ Delegated Artifact Studio and ORM CLI transports, Git subprocess traffic,
3512
+ third-party storage transfers, login/discovery, and offline commands are not
3513
+ instrumented by this change. The Artifact Studio deployment `cliVersion` field
3514
+ continues to identify that SDK, not seq-studio. Versions released before this
3515
+ instrumentation cannot be identified retroactively. A claimed client/version
3516
+ is descriptive telemetry, never proof of which software made a request.
@@ -28,7 +28,7 @@ const ARTIFACT_USAGE = `usage:
28
28
  seq-studio artifact build [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] [--source-env <env>] [--out file.json]
29
29
  seq-studio artifact plan [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] [--source-env <env>] -e <env>
30
30
  seq-studio artifact deploy [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] [--source-env <env>] -e <env> [--skip-unchanged] [--no-create] [--project <id>]
31
- seq-studio artifact dev [dir] -e <env> [--once] [--key default] [--link <pkgDir>[,<pkgDir>]] [--port <port>] [--local-secrets <bindings.json>] [--bundler turbopack|webpack]
31
+ seq-studio artifact dev [dir] -e <env> [--once] [--key default] [--link <pkgDir>[,<pkgDir>]] [--port <port>] [--secret-source local|hosted|none] [--local-secrets <bindings.json>] [--bundler turbopack|webpack]
32
32
  seq-studio artifact pull <project-id> -e <env> --out <dir>
33
33
  seq-studio artifact promote <deployment-id> -e <env>
34
34
  seq-studio artifact rollback <deployment-id> -e <env>
@@ -66,9 +66,13 @@ const ARTIFACT_USAGE = `usage:
66
66
  with a Git Service origin on the selected source environment also works.
67
67
  Use pnpm build for a local production-build check. --once is static-only;
68
68
  --port selects the local Next loopback port.
69
- Local Next sessions inject declared server secrets from local Atlas's private
70
- store. --local-secrets maps environment names to local secret names (JSON,
71
- never values). Restart artifact dev after changing a local secret.
69
+ dev always runs Next on this machine; --secret-source picks where declared
70
+ server.secrets come from. local (default for -e local): local Atlas's private
71
+ store. hosted: the selected hosted Atlas at the pinned versions; needs an
72
+ explicit -e, managed-secret editor on each secret, and a staging deployment.
73
+ none (default for hosted environments): inject nothing. --local-secrets maps
74
+ environment names to local secret names (JSON, never values; local only).
75
+ Values are read once: restart artifact dev after changing a value or pin.
72
76
  dev uses Turbopack unless the Next config has a custom webpack function and no turbopack config; opt out
73
77
  with --bundler webpack or ARTIFACT_NEXT_DEV_BUNDLER=webpack.
74
78
  Deploy validates the selected targets.<environment>.url and declared storage
@@ -7,13 +7,13 @@ import { createPlatformTransport, createOperatorPlatformClient, } from "@sequenc
7
7
  * the caller — this file knows nothing about token files or config TOMLs.
8
8
  */
9
9
  import { validationDetail } from "./validation-detail.js";
10
- import { PREVIEW_DOMAIN } from "./preview.js";
10
+ import { edgeAuthHeaders } from "./edge-auth-headers.js";
11
11
  import { sandboxBearerFor } from "./sandbox-auth.js";
12
12
  import { errorCode, isTransient503 } from "./transient-503.js";
13
+ import { fetchWithCliAttribution } from "./cli-attribution.js";
13
14
  const MAX_503_RETRIES = 5;
14
15
  const DEFAULT_RETRY_AFTER_SECONDS = 2;
15
16
  const LOG_PREFIX = "[seq-studio]";
16
- const CF_ACCESS_DOMAIN = "seqholdings.com";
17
17
  export class AtlasApiError extends Error {
18
18
  status;
19
19
  path;
@@ -52,16 +52,14 @@ async function fetchWith503Retry(send) {
52
52
  async function authenticatedFetch({ baseUrl, init = {}, path, token, retry503 = true, timeoutMs, }) {
53
53
  authenticatedRequestUrl({ baseUrl, path });
54
54
  const transport = createPlatformTransport({
55
+ fetchImpl: fetchWithCliAttribution,
55
56
  baseUrl,
56
57
  timeoutMs,
57
58
  auth: {
58
59
  kind: "operator",
59
60
  bearer: async () => (await sandboxBearerFor(baseUrl)) ?? token,
60
61
  },
61
- edgeHeaders: () => ({
62
- ...previewAccessHeaders(baseUrl),
63
- ...cfAccessHeaders(baseUrl),
64
- }),
62
+ edgeHeaders: () => edgeAuthHeaders(baseUrl),
65
63
  });
66
64
  const send = async () => {
67
65
  const method = (init.method ?? "GET").toUpperCase();
@@ -134,53 +132,6 @@ function parseRetryAfter(value) {
134
132
  return null;
135
133
  return Number(value);
136
134
  }
137
- function previewAccessHeaders(baseUrl) {
138
- const secret = process.env.PREVIEW_ACCESS_HEADER?.trim();
139
- if (!secret)
140
- return {};
141
- try {
142
- const parsed = new URL(baseUrl);
143
- if (parsed.protocol !== "https:")
144
- return {};
145
- if (!parsed.hostname.toLowerCase().endsWith(`.${PREVIEW_DOMAIN}`))
146
- return {};
147
- return { "x-preview-access": secret };
148
- }
149
- catch {
150
- return {};
151
- }
152
- }
153
- /**
154
- * Cloudflare Access fronts *.seqholdings.com and only bypasses the company
155
- * network, so a CI runner is turned away at the edge with an HTML "Access
156
- * Restricted" page before Atlas ever sees the bearer token. A service token
157
- * gets through the edge; the bearer still authenticates at the app.
158
- *
159
- * Scoped to seqholdings.com so the token is never sent to localhost, a tenant
160
- * domain, or any other host the CLI can be pointed at.
161
- */
162
- function cfAccessHeaders(baseUrl) {
163
- const clientId = process.env.CF_ACCESS_CLIENT_ID?.trim();
164
- const clientSecret = process.env.CF_ACCESS_CLIENT_SECRET?.trim();
165
- if (!clientId || !clientSecret)
166
- return {};
167
- try {
168
- const parsed = new URL(baseUrl);
169
- if (parsed.protocol !== "https:")
170
- return {};
171
- const hostname = parsed.hostname.toLowerCase();
172
- if (hostname !== CF_ACCESS_DOMAIN &&
173
- !hostname.endsWith(`.${CF_ACCESS_DOMAIN}`))
174
- return {};
175
- return {
176
- "CF-Access-Client-Id": clientId,
177
- "CF-Access-Client-Secret": clientSecret,
178
- };
179
- }
180
- catch {
181
- return {};
182
- }
183
- }
184
135
  /**
185
136
  * Structured `violations[]` from the Lattice contract routes (authoring
186
137
  * policy, static graph limits, …). The server already bounds the array; the
@@ -389,11 +340,9 @@ export async function deleteNoContent({ baseUrl, token, path, }) {
389
340
  export function operatorPlatformClient({ baseUrl, token, }) {
390
341
  authenticatedRequestUrl({ baseUrl, path: "/api/auth/cli-config" });
391
342
  return createOperatorPlatformClient({
343
+ fetchImpl: fetchWithCliAttribution,
392
344
  baseUrl,
393
345
  bearer: async () => (await sandboxBearerFor(baseUrl)) ?? token,
394
- edgeHeaders: () => ({
395
- ...previewAccessHeaders(baseUrl),
396
- ...cfAccessHeaders(baseUrl),
397
- }),
346
+ edgeHeaders: () => edgeAuthHeaders(baseUrl),
398
347
  });
399
348
  }
package/dist/auth.d.ts CHANGED
@@ -127,7 +127,6 @@ export interface ResolvedAccessToken {
127
127
  token: string;
128
128
  }
129
129
  export declare function getAccessTokenWithMode(options?: {
130
- /** Disable browser PKCE fallback for probe-only and other non-interactive callers. */
131
130
  allowInteractiveLogin?: boolean;
132
131
  env?: string;
133
132
  targetUrl?: string;
package/dist/auth.js CHANGED
@@ -485,7 +485,7 @@ async function sandboxAccessToken(targetUrl) {
485
485
  }
486
486
  return { authMode: 'sandbox', token: await readSandboxToken(sandbox) };
487
487
  }
488
- export async function getAccessTokenWithMode(options) {
488
+ async function resolveAccessTokenWithMode(options) {
489
489
  // Sandbox token mode replaces every other source, before any realm lookup.
490
490
  const sandbox = await sandboxAccessToken(options?.targetUrl);
491
491
  if (sandbox)
@@ -532,6 +532,14 @@ export async function getAccessTokenWithMode(options) {
532
532
  }),
533
533
  };
534
534
  }
535
+ export async function getAccessTokenWithMode(options) {
536
+ const resolved = await resolveAccessTokenWithMode(options);
537
+ if (options?.targetUrl) {
538
+ const { recordAuthenticatedCliTarget } = await import('./command-telemetry.js');
539
+ recordAuthenticatedCliTarget(options.targetUrl, resolved.token);
540
+ }
541
+ return resolved;
542
+ }
535
543
  export async function getAccessToken(options) {
536
544
  return (await getAccessTokenWithMode(options)).token;
537
545
  }
package/dist/bin.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { run } from './main.js';
2
+ import { commandTelemetryName, run } from './main.js';
3
3
  import { parseArgs } from './argv.js';
4
+ import { beginCommandTelemetry, finishCommandTelemetry } from './command-telemetry.js';
4
5
  // A consumer may close stdout while a remote operation continues. Stop local
5
6
  // output quietly; never cancel or retry the remote operation.
6
7
  process.stdout.on('error', (error) => {
@@ -10,20 +11,24 @@ process.stdout.on('error', (error) => {
10
11
  throw error;
11
12
  });
12
13
  const argv = process.argv.slice(2);
13
- const isHelpOrDiscovery = argv.includes('--help') || argv.includes('-h') || argv[0] === 'help' || argv[0] === 'capabilities';
14
+ const isHelpOrDiscovery = argv.includes('--help') || argv.includes('-h') || argv[0] === 'help' || argv[0] === 'capabilities' || argv[0] === 'telemetry';
14
15
  const doctorOffline = argv[0] === 'doctor' && (() => {
15
16
  const value = parseArgs(argv.slice(1)).flags.offline;
16
17
  return value === true || value === 'true';
17
18
  })();
18
19
  const isOfflineCommand = argv[0] === 'validate' || doctorOffline;
20
+ const startedAt = beginCommandTelemetry();
21
+ let commandError;
19
22
  run(argv)
20
23
  .catch((error) => {
24
+ commandError = error;
21
25
  console.error(error instanceof Error ? error.message : error);
22
26
  return 1;
23
27
  })
24
28
  // The update notice runs after the command so it never delays real output,
25
29
  // and it is best-effort (never throws, never changes the exit code).
26
30
  .then(async (code) => {
31
+ await finishCommandTelemetry({ command: commandTelemetryName(argv), startedAt, exitCode: code, error: commandError }).catch(() => undefined);
27
32
  const isGitCredential = argv[0] === 'auth' && argv[1] === 'git-credential';
28
33
  if (!isHelpOrDiscovery && !isOfflineCommand && !isGitCredential) {
29
34
  const { maybeNotifyUpdate } = await import('./update-check.js');
@@ -0,0 +1,3 @@
1
+ export declare function cliAttributionHeaders(): Record<string, string>;
2
+ /** Inject only at the CLI-owned transport, after its origin/auth/redirect checks. */
3
+ export declare const fetchWithCliAttribution: typeof fetch;
@@ -0,0 +1,24 @@
1
+ import { currentVersion } from './update-check.js';
2
+ // Read this installed package, never the delegated Artifact Studio SDK version.
3
+ const version = currentVersion();
4
+ export function cliAttributionHeaders() {
5
+ return { 'x-sequence-client': 'seq-studio', 'x-sequence-client-version': version };
6
+ }
7
+ /** Inject only at the CLI-owned transport, after its origin/auth/redirect checks. */
8
+ export const fetchWithCliAttribution = (input, init) => {
9
+ const source = init?.headers ?? (input instanceof Request ? input.headers : undefined);
10
+ const identity = cliAttributionHeaders();
11
+ if (source && !(source instanceof Headers) && !Array.isArray(source)) {
12
+ // Keep the plain-object shape used by existing CLI transports and callers.
13
+ const headers = { ...source };
14
+ for (const name of Object.keys(headers)) {
15
+ if (name.toLowerCase() in identity)
16
+ delete headers[name];
17
+ }
18
+ return globalThis.fetch(input, { ...init, headers: { ...headers, ...identity } });
19
+ }
20
+ const headers = new Headers(source);
21
+ for (const [name, value] of Object.entries(identity))
22
+ headers.set(name, value);
23
+ return globalThis.fetch(input, { ...init, headers });
24
+ };
@@ -88,7 +88,7 @@ export declare const COMMAND_CONTRACT: readonly [{
88
88
  readonly description: "Author and operate ORM namespaces";
89
89
  readonly lifecycle: "preview";
90
90
  readonly access: "mixed";
91
- readonly subcommands: readonly ["init", "generate", "validate", "plan", "apply", "execute", "namespaces", "describe", "read", "sql", "diff", "migrate-from-yaml", "import"];
91
+ readonly subcommands: readonly ["init", "generate", "validate", "plan", "apply", "history", "deployment-policy", "execute", "namespaces", "describe", "read", "sql", "diff", "migrate-from-yaml", "import"];
92
92
  }, {
93
93
  readonly name: "envs";
94
94
  readonly description: "Manage CLI environments";
@@ -113,6 +113,12 @@ export declare const COMMAND_CONTRACT: readonly [{
113
113
  readonly lifecycle: "stable";
114
114
  readonly access: "mixed";
115
115
  readonly subcommands: readonly [];
116
+ }, {
117
+ readonly name: "telemetry";
118
+ readonly description: "Control authenticated command telemetry";
119
+ readonly lifecycle: "preview";
120
+ readonly access: "offline";
121
+ readonly subcommands: readonly ["enable", "disable", "status"];
116
122
  }, {
117
123
  readonly name: "version";
118
124
  readonly description: "Print the installed CLI version";
@@ -139,7 +145,7 @@ export declare const COMMAND_CONTRACT: readonly [{
139
145
  readonly subcommands: readonly ["definitions", "list", "grant", "revoke", "resolve"];
140
146
  }, {
141
147
  readonly name: "principals";
142
- readonly description: "Find users, groups, and service accounts to grant";
148
+ readonly description: "Find principals and manage local groups";
143
149
  readonly lifecycle: "preview";
144
150
  readonly access: "authenticated";
145
151
  readonly subcommands: readonly ["search", "users", "groups"];
@@ -14,16 +14,17 @@ export const COMMAND_CONTRACT = [
14
14
  { name: 'pipeline', description: 'Discover and operate Data Pipelines', lifecycle: 'preview', access: 'staff', subcommands: ['list', 'assets', 'search', 'describe', 'schema', 'sample', 'query', 'init', 'validate', 'plan', 'deploy', 'status', 'migrate', 'adopt', 'unbind', 'retire', 'run-now', 'promote', 'rollback'] },
15
15
  { name: 'feedback', description: 'Submit agent feedback', lifecycle: 'preview', access: 'authenticated', subcommands: ['submit'] },
16
16
  { name: 'auth', description: 'Manage Git authentication', lifecycle: 'stable', access: 'authenticated', subcommands: ['whoami', 'git-credential', 'pat'] },
17
- { name: 'orm', description: 'Author and operate ORM namespaces', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'generate', 'validate', 'plan', 'apply', 'execute', 'namespaces', 'describe', 'read', 'sql', 'diff', 'migrate-from-yaml', 'import'] },
17
+ { name: 'orm', description: 'Author and operate ORM namespaces', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'generate', 'validate', 'plan', 'apply', 'history', 'deployment-policy', 'execute', 'namespaces', 'describe', 'read', 'sql', 'diff', 'migrate-from-yaml', 'import'] },
18
18
  { name: 'envs', description: 'Manage CLI environments', lifecycle: 'stable', access: 'mixed', subcommands: ['add', 'list'] },
19
19
  { name: 'login', description: 'Authenticate with Sequence', lifecycle: 'stable', access: 'public', subcommands: [] },
20
20
  { name: 'logout', description: 'Remove cached user tokens', lifecycle: 'stable', access: 'public', subcommands: [] },
21
21
  { name: 'doctor', description: 'Diagnose CLI configuration and access', lifecycle: 'stable', access: 'mixed', subcommands: [] },
22
+ { name: 'telemetry', description: 'Control authenticated command telemetry', lifecycle: 'preview', access: 'offline', subcommands: ['enable', 'disable', 'status'] },
22
23
  { name: 'version', description: 'Print the installed CLI version', lifecycle: 'stable', access: 'offline', subcommands: [] },
23
24
  { name: 'help', description: 'Show command help', lifecycle: 'stable', access: 'offline', subcommands: [] },
24
25
  { name: 'storage', description: 'Manage Workspaces V2 file storage', lifecycle: 'preview', access: 'authenticated', subcommands: ['init', 'validate', 'apply', 'list', 'show', 'mkdir', 'upload', 'import', 'uploads', 'reconcile', 'download', 'access', 'trash', 'restore', 'purge', 'operations', 'abort', 'delete'] },
25
26
  { name: 'access', description: 'Manage resource access on every primitive', lifecycle: 'preview', access: 'authenticated', subcommands: ['definitions', 'list', 'grant', 'revoke', 'resolve'] },
26
- { name: 'principals', description: 'Find users, groups, and service accounts to grant', lifecycle: 'preview', access: 'authenticated', subcommands: ['search', 'users', 'groups'] },
27
+ { name: 'principals', description: 'Find principals and manage local groups', lifecycle: 'preview', access: 'authenticated', subcommands: ['search', 'users', 'groups'] },
27
28
  { name: 'service-accounts', description: 'Manage runtime service accounts', lifecycle: 'preview', access: 'authenticated', subcommands: ['list', 'show', 'create'] },
28
29
  { name: 'capabilities', description: 'Print the supported CLI command surface', lifecycle: 'blocked', access: 'offline', subcommands: [] },
29
30
  ];