@sequenceholdings/studio-cli 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -20
- package/dist/app/readme.js +6 -2
- package/dist/command-contract.d.ts +3 -3
- package/dist/command-contract.js +1 -1
- package/dist/command-help.d.ts +2 -0
- package/dist/command-help.js +91 -0
- package/dist/functions/commands.d.ts +0 -1
- package/dist/functions/commands.js +1 -47
- package/dist/functions/deploy-preflight.d.ts +1 -1
- package/dist/functions/deploy-preflight.js +2 -1
- package/dist/functions/manifest.d.ts +3 -0
- package/dist/functions/manifest.js +27 -17
- package/dist/main.js +1 -1
- package/dist/repos/ci-config.d.ts +5 -0
- package/dist/repos/ci-config.js +29 -0
- package/dist/repos/ci-init.d.ts +4 -0
- package/dist/repos/ci-init.js +35 -0
- package/dist/repos/ci-status.d.ts +9 -0
- package/dist/repos/ci-status.js +49 -0
- package/dist/repos/commands.d.ts +6 -10
- package/dist/repos/commands.js +113 -115
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -21,9 +21,11 @@ seq-studio doctor
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
> **Note:** all network commands require a Sequence platform account with the
|
|
24
|
-
> appropriate permissions. Without one,
|
|
24
|
+
> appropriate permissions. Without one, the offline commands
|
|
25
25
|
> (`init`, `lint`, `simulate`, `build`, `bundle inspect`, `agents init`,
|
|
26
26
|
> `agents validate`, offline `agents plan`, `pipeline init`, `pipeline validate`) work.
|
|
27
|
+
> Repo and function command help is also available without an account; for
|
|
28
|
+
> example, `seq-studio repos create --help` and `seq-studio functions invoke --help`.
|
|
27
29
|
> Sequence-internal contributors: see `INTERNAL.md` in the monorepo for
|
|
28
30
|
> rollout SOPs, preview environments, and publishing docs.
|
|
29
31
|
|
|
@@ -901,6 +903,9 @@ seq-studio process lint --dir my-processes --offline # finds both processes
|
|
|
901
903
|
|
|
902
904
|
## Managed Function commands
|
|
903
905
|
|
|
906
|
+
Add `--help` to a function command to read its usage offline, without an
|
|
907
|
+
environment, credentials, or `managed-function.yml`.
|
|
908
|
+
|
|
904
909
|
| Command | What it does |
|
|
905
910
|
|---------|--------------|
|
|
906
911
|
| `seq-studio functions init <dir>` | Scaffold one standalone TypeScript managed function |
|
|
@@ -1345,6 +1350,36 @@ manifest declarations. Never put a secret in `build.public_env` or `NEXT_PUBLIC_
|
|
|
1345
1350
|
Local execution runs as your OS user; Atlas does not sandbox your laptop's
|
|
1346
1351
|
filesystem or arbitrary outbound connections.
|
|
1347
1352
|
|
|
1353
|
+
Browser ORM admission controls are planned for Studio CLI 0.4.7 and Artifact
|
|
1354
|
+
Studio 0.6.7, together with matching platform support. Confirm package
|
|
1355
|
+
publication and environment rollout before using them; this remains part of
|
|
1356
|
+
the internal Next.js pilot. In a schema-v2 manifest, browser
|
|
1357
|
+
`capabilities.data.operations` optionally lists up to 256 exact
|
|
1358
|
+
`namespace/ops/Operation` references. Omission retains table-based admission;
|
|
1359
|
+
an explicit empty list denies all browser ORM operations. Browser `data.read`
|
|
1360
|
+
and `data.write` declarations still bound table and mutation reach.
|
|
1361
|
+
|
|
1362
|
+
Only registered persisted operations qualify; autogenerated `DatasetPreview_*`
|
|
1363
|
+
hashes remain excluded even when a registered operation has the same name.
|
|
1364
|
+
The allowlist selects names, retaining active and previous operation-set
|
|
1365
|
+
fallback. A security-tightened replacement query needs a fresh name with the
|
|
1366
|
+
old name removed from the allowlist, or the older retained hash may still run.
|
|
1367
|
+
|
|
1368
|
+
`capabilities.data.required_capabilities` optionally maps source namespace names
|
|
1369
|
+
to nonempty lists of artifact capability pins. Each pin must be declared in
|
|
1370
|
+
`capabilities.uses` or, for a local bare key, defined under
|
|
1371
|
+
`capabilities.roles.capabilities`. All listed pins are required; accepted forms
|
|
1372
|
+
are `<key>`, `org/<key>`, and `app/<application-id>/<key>`. Namespaces in either
|
|
1373
|
+
control must be reached by
|
|
1374
|
+
browser `data.read` or `data.write`. Keep source namespace names when preview
|
|
1375
|
+
bindings map them to other resources. Atlas checks these requirements against
|
|
1376
|
+
the authenticated user's current artifact claims before delegation, alongside
|
|
1377
|
+
the existing namespace grants and row/write policies. Manifest declarations
|
|
1378
|
+
do not grant access, and browser-provided claims cannot satisfy these checks.
|
|
1379
|
+
These controls apply to direct browser ORM calls. Server SDK, external ingress,
|
|
1380
|
+
and ORM work inside Managed Functions or general API calls retain their own
|
|
1381
|
+
permission contracts. The `createArtifactOrmExecutor` API is unchanged.
|
|
1382
|
+
|
|
1348
1383
|
For hosted applications, bind an existing managed secret by its name in the
|
|
1349
1384
|
target deployment's organization and pin the exact numeric version:
|
|
1350
1385
|
|
|
@@ -1501,6 +1536,9 @@ The raw token is printed **once** on create.
|
|
|
1501
1536
|
|
|
1502
1537
|
## Repos commands
|
|
1503
1538
|
|
|
1539
|
+
Add `--help` to a repo command to read its usage offline, without an
|
|
1540
|
+
environment or credentials.
|
|
1541
|
+
|
|
1504
1542
|
`repos create` creates the hosted repository; it does not configure Git in your
|
|
1505
1543
|
current folder. For a new local checkout, use `repos clone` with `ATLAS_GIT_PAT`
|
|
1506
1544
|
and `--full` to get `origin`, branch tracking, and complete history for your
|
|
@@ -1529,33 +1567,70 @@ JSON API — the same repos `--repo <ns>/<name>` sources build from.
|
|
|
1529
1567
|
| `seq-studio repos clone <ns>/<name> \| --url <clone-url> \| --id <uuid> -e <env> [--ref <r>] [--output <dir>] [--force] [--full] [--transport auto\|git\|json]` | 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`. |
|
|
1530
1568
|
| `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` |
|
|
1531
1569
|
| `seq-studio repos delete <ns>/<name> -e <env> [--yes]` | delete a repo — interactive confirm unless `--yes` |
|
|
1532
|
-
| `seq-studio repos ci
|
|
1533
|
-
| `seq-studio repos ci
|
|
1534
|
-
| `seq-studio repos ci
|
|
1570
|
+
| `seq-studio repos ci init [--dir <repository>]` | create `.seq/pipeline.yml` with native defaults; offline, preserves existing configuration |
|
|
1571
|
+
| `seq-studio repos ci show <ns>/<name> -e <env> --pr <number> [--json]` | inspect the server's discovered pipeline, exact plan and recent runs; JSON retains the complete status response |
|
|
1572
|
+
| `seq-studio repos ci show <ns>/<name> -e <env> [--ref <r>]` | preview pipeline discovery or legacy checks at a ref |
|
|
1573
|
+
| `seq-studio repos ci require <ns>/<name> --check <name> -e <env>` | disabled legacy required-check control; use native pipeline discovery |
|
|
1574
|
+
| `seq-studio repos ci import <ns>/<name> -e <env> [--ref <r>]` | disabled legacy required-check control; use native pipeline discovery |
|
|
1535
1575
|
|
|
1536
1576
|
`show` prints the smart-HTTP clone URL (`…/repos/<id>/git`). Basic auth:
|
|
1537
1577
|
any username, PAT as password. Prefer `repos clone` over hand-rolling the
|
|
1538
1578
|
tree API.
|
|
1539
1579
|
|
|
1540
|
-
|
|
1541
|
-
`
|
|
1542
|
-
|
|
1580
|
+
To enable native repository checks, run this from the checkout containing your
|
|
1581
|
+
`sequence.app.yml` or supported standalone resource manifest:
|
|
1582
|
+
|
|
1583
|
+
```bash
|
|
1584
|
+
seq-studio repos ci init
|
|
1585
|
+
git add .seq/pipeline.yml
|
|
1586
|
+
git commit -m "Enable repository CI"
|
|
1587
|
+
git push
|
|
1588
|
+
# Open a pull request using Atlas or seq-studio repos pulls create, then inspect it:
|
|
1589
|
+
seq-studio repos ci show artifacts/my-app -e staging --pr 4
|
|
1590
|
+
```
|
|
1543
1591
|
|
|
1544
|
-
|
|
1592
|
+
The generated file selects the platform's native lint, type-check, test and build
|
|
1593
|
+
defaults for the repository inventory:
|
|
1545
1594
|
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1595
|
+
```yaml
|
|
1596
|
+
schema_version: 2
|
|
1597
|
+
targets: []
|
|
1598
|
+
```
|
|
1550
1599
|
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1600
|
+
Atlas discovers the file on the pull request's head or base and runs checks on
|
|
1601
|
+
PR creation and updates to its head or base. Repository CI and deployment jobs
|
|
1602
|
+
use Buildkite, including for local destinations. Next.js resources may explicitly
|
|
1603
|
+
select Modal for compilation. Each run uses the platform
|
|
1604
|
+
image defaults; no image digest or manual branch-policy setup is
|
|
1605
|
+
needed from the repository author. This is a PR workflow; arbitrary GitHub
|
|
1606
|
+
Actions `on:` triggers and standalone push runs are not supported. Missing
|
|
1607
|
+
platform CI setup appears as unavailable with a reason; it is not a passing or
|
|
1608
|
+
absent pipeline. `ci show --pr` exits 1 for unavailable setup or planning errors.
|
|
1609
|
+
|
|
1610
|
+
Discovery does not change the repository's review or required-check policy.
|
|
1611
|
+
The file enables checks only. Deployment still requires separately authorized
|
|
1612
|
+
resource bindings and current native permissions. Platform administrators retain
|
|
1613
|
+
advanced branch policies for those bindings and approved execution overrides.
|
|
1614
|
+
An existing explicit policy takes precedence over automatic defaults.
|
|
1615
|
+
|
|
1616
|
+
Local development requires an explicitly configured public HTTPS tunnel to Atlas
|
|
1617
|
+
for Buildkite worker requests and signed completion webhooks. Keep the tunnel
|
|
1618
|
+
running; a missing runner or unreachable callback never falls back to laptop
|
|
1619
|
+
execution. Hosted environments use their own HTTPS server URL. Repository
|
|
1620
|
+
Settings → CI shows setup guidance and configured callback URLs; those checks
|
|
1621
|
+
do not prove a worker or webhook can reach the server.
|
|
1622
|
+
|
|
1623
|
+
`ci init` refuses to replace an existing `.seq/pipeline.yml` or create a second
|
|
1624
|
+
file beside legacy `.seq/ci.json`. Migrate a legacy JSON configuration and remove
|
|
1625
|
+
the old file in one commit. Both files together, invalid syntax and duplicate
|
|
1626
|
+
YAML keys fail planning. Empty native `targets` means use discovered inventory
|
|
1627
|
+
defaults; it does not disable required checks.
|
|
1628
|
+
|
|
1629
|
+
Without `--pr`, `ci show` previews the selected ref. For native schema version 2
|
|
1630
|
+
it reports discovery and points to the authoritative PR plan. Legacy `checks`
|
|
1631
|
+
declarations and package-script discovery remain preview-only: they post neutral
|
|
1632
|
+
check-runs and cannot satisfy required merge gates. The legacy `require` and
|
|
1633
|
+
`import` commands remain disabled.
|
|
1559
1634
|
|
|
1560
1635
|
## Pipeline commands
|
|
1561
1636
|
|
|
@@ -1954,6 +2029,17 @@ Compiled Databricks assets use stable, environment-qualified identities: display
|
|
|
1954
2029
|
|
|
1955
2030
|
Changing a DAB resource key is a delete-and-create operation. Treat these identities as the existing-resource contract when planning, adopting, unbinding, or inspecting a Managed Pipeline; Unity Catalog catalogs, volumes, tables, and synced tables are not renamed by this convention.
|
|
1956
2031
|
|
|
2032
|
+
To preserve an existing service-principal owner, a stage can opt into
|
|
2033
|
+
[`retained_resource_owners`](../pipeline-spec/README.md#retain-an-existing-native-resource-owner).
|
|
2034
|
+
Pin the exact target, compiled resource key, workspace, native ID and principal.
|
|
2035
|
+
Planning verifies the existing binding, sole direct owner and expected manager
|
|
2036
|
+
ACL; each deployment pass rechecks live ownership and applies only the checked
|
|
2037
|
+
in-place Databricks plan. This does not transfer ownership or authorize resource
|
|
2038
|
+
creation/replacement. Missing evidence and identity/permission drift remain
|
|
2039
|
+
non-overridable blockers. The supporting pipeline-spec and Atlas/worker releases
|
|
2040
|
+
must be installed first; older clients reject the new YAML field. Pipelines
|
|
2041
|
+
without these declarations keep their existing behavior.
|
|
2042
|
+
|
|
1957
2043
|
Deletion and recreation remain blocked by default. For an intentional,
|
|
1958
2044
|
reviewed migration, repeat `--allow-destructive <resource-key>` for every
|
|
1959
2045
|
eligible finding printed by the plan. Only authenticated `@seqholdings.com`
|
package/dist/app/readme.js
CHANGED
|
@@ -115,8 +115,12 @@ Its Next.js artifact uses Node.js 24 and a separate install root: run \`pnpm ins
|
|
|
115
115
|
inside \`artifact/\` and commit \`artifact/pnpm-lock.yaml\` as well. Keep its generated
|
|
116
116
|
\`lint\`, \`type-check\`, \`test\` and \`build\` scripts. Repository CI runs these checks
|
|
117
117
|
and an SSR/API smoke test on Buildkite before packaging the validated standalone
|
|
118
|
-
output for the managed runtime.
|
|
119
|
-
|
|
118
|
+
output for the managed runtime. Run \`seq-studio repos ci init\`, commit the generated
|
|
119
|
+
\`.seq/pipeline.yml\`, and open or update a pull request to run checks with the
|
|
120
|
+
platform's managed defaults. \`sequence.app.yml\` supplies the resource inventory;
|
|
121
|
+
the pipeline needs no image digest or manual branch policy. Inspect the plan with
|
|
122
|
+
\`seq-studio repos ci show <namespace>/<repo> -e <environment> --pr <number>\`.
|
|
123
|
+
Deployment still needs authorized resource bindings and native permissions.
|
|
120
124
|
Build-time values belong in \`build.public_env\` and must use \`NEXT_PUBLIC_*\` names.
|
|
121
125
|
Server secrets and resource credentials are attached only at runtime.
|
|
122
126
|
|
|
@@ -49,10 +49,10 @@ export declare const COMMAND_CONTRACT: readonly [{
|
|
|
49
49
|
readonly subcommands: readonly ["create", "set", "list", "attach", "detach", "apply"];
|
|
50
50
|
}, {
|
|
51
51
|
readonly name: "repos";
|
|
52
|
-
readonly description: "Manage
|
|
52
|
+
readonly description: "Manage repositories and native CI; ci init is offline";
|
|
53
53
|
readonly lifecycle: "stable";
|
|
54
|
-
readonly access: "
|
|
55
|
-
readonly subcommands: readonly ["list", "namespaces", "show", "create", "clone", "pull", "pulls", "delete"];
|
|
54
|
+
readonly access: "mixed";
|
|
55
|
+
readonly subcommands: readonly ["list", "namespaces", "show", "create", "clone", "pull", "pulls", "delete", "ci"];
|
|
56
56
|
}, {
|
|
57
57
|
readonly name: "pipeline";
|
|
58
58
|
readonly description: "Discover and operate Data Pipelines";
|
package/dist/command-contract.js
CHANGED
|
@@ -8,7 +8,7 @@ export const COMMAND_CONTRACT = [
|
|
|
8
8
|
{ name: 'functions', description: 'Build and operate Managed Functions', lifecycle: 'stable', access: 'authenticated', subcommands: ['init', 'build', 'deploy', 'list', 'show', 'limits', 'invoke', 'logs', 'promote', 'rollback', 'delete'] },
|
|
9
9
|
{ name: 'agents', description: 'Validate and deploy typed agent definitions', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'validate', 'plan', 'apply', 'list', 'show'] },
|
|
10
10
|
{ name: 'secrets', description: 'Manage organization-owned secrets', lifecycle: 'stable', access: 'authenticated', subcommands: ['create', 'set', 'list', 'attach', 'detach', 'apply'] },
|
|
11
|
-
{ name: 'repos', description: 'Manage
|
|
11
|
+
{ name: 'repos', description: 'Manage repositories and native CI; ci init is offline', lifecycle: 'stable', access: 'mixed', subcommands: ['list', 'namespaces', 'show', 'create', 'clone', 'pull', 'pulls', 'delete', 'ci'] },
|
|
12
12
|
{ 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', 'run-now', 'promote', 'rollback'] },
|
|
13
13
|
{ name: 'auth', description: 'Manage Git Service personal access tokens', lifecycle: 'stable', access: 'authenticated', subcommands: ['whoami', 'pat'] },
|
|
14
14
|
{ name: 'orm', description: 'Author and operate ORM namespaces', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'generate', 'validate', 'plan', 'apply', 'execute', 'diff', 'migrate-from-yaml', 'import'] },
|
package/dist/command-help.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export declare const ORM_HELP = "usage:\n seq-studio orm init <dir>\n seq-studio orm generate [dir] [--migration-export] [--check]\n seq-studio orm validate [dir]\n seq-studio orm plan [dir] -e <env>\n seq-studio orm apply [dir] -e <env>\n seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>\n seq-studio orm diff [dir] [--check] [--allow-destructive] [--rebase]\n seq-studio orm migrate-from-yaml <dir>\n seq-studio orm import [dir] --spec <file> | --table <table> --from <schema.table> --map <target=source,...>\n\n -e/--env is required for commands that contact Atlas. Use seq-studio envs list\n to discover environments and seq-studio login to authenticate.\n";
|
|
3
3
|
export declare const ARTIFACT_HELP = "usage:\n seq-studio artifact init <dir> [--template react-vite|nextjs]\n seq-studio artifact whoami -e <env>\n seq-studio artifact link [dir] -e <env> [--project <id>]\n seq-studio artifact env list|use <env>\n seq-studio artifact status [-e <env>]\n seq-studio artifact list -e <env> [--json]\n seq-studio artifact show <slug-or-id> -e <env> [--json]\n seq-studio artifact validate [dir]\n seq-studio artifact build|plan|deploy [dir | --repo <namespace>/<name> | --git-url <url>] [--ref <ref>] -e <env>\n seq-studio artifact dev [dir] -e <env> [--once] [--key <name>] [--link <package-dir>] [--port <port>]\n seq-studio artifact pull <project-id> -e <env> --out <dir>\n seq-studio artifact promote|rollback <deployment-id> -e <env>\n\n Help is available offline. Authenticate with seq-studio login. Build and deploy\n sources may be local, a platform git-service repo, or a public HTTPS Git URL;\n deployments target a named environment with -e. Local, preview, and official\n deployment workflows have different source and approval rules; see the public\n CLI README.\n";
|
|
4
4
|
export declare const PIPELINE_HELP = "usage:\n seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]\n list pipeline repository rollups (not assets)\n seq-studio pipeline assets -e <env> [--repo <namespace>/<slug>] [--json]\n list asset declarations, including assets that may not be deployed\n seq-studio pipeline search <query> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--limit N] [--offset N] [--json]\n seq-studio pipeline describe <asset-id> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--json]\n seq-studio pipeline schema|sample <asset-id> -e <env> [--target <id>] [--limit N] [--json]\n seq-studio pipeline query <asset-id> --sql <read-only-sql> -e <env> [--target <id>] [--limit N] [--json]\n seq-studio pipeline init|validate|plan|deploy|status|migrate|adopt|unbind|run-now|promote|rollback ...\n seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]\n poll an existing durable plan without enqueueing or attaching credentials\n Lifecycle --json results use stdout; progress uses stderr. Deploy --run-now\n executes producers in the managed worker; local polling may disconnect.\n\n Discovery requires staff access. Use list for pipeline repositories, assets\n for declared assets, and search/describe for active deployment metadata;\n use schema to verify physical columns. -e chooses the environment and\n --target chooses a logical target when the environment has more than one.\n Help is available offline.\n";
|
|
5
|
+
export declare const FUNCTIONS_USAGE = "usage:\n seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers\n seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)\n seq-studio functions register -e <env> [--dir d] register a function shell without deploying\n seq-studio functions deploy -e <env> [-m msg] preflight deployed capabilities, then upload and deploy\n seq-studio functions list -e <env> [--match-local] functions visible on the environment\n seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)\n seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy\n [--fn slug] also show effective runtime limits (requires -e)\n seq-studio functions dev [--dir path] [--port 8080] local HTTP server with cache context\n seq-studio functions invoke -e <env> [--data JSON | --data @file | --stdin]\n invoke a function and print its response\n seq-studio functions logs -e <env> [--limit N] [--since t] function logs (reader-gated)\n seq-studio functions promote <version> -e <env> make a version live\n seq-studio functions rollback [<version>] -e <env> redeploy a prior version\n seq-studio functions delete -e <env> [--yes] archive function + tear down its runtime\n (version history is retained)\n\n Flags: -e/--env <env|preview:<slug>> (required for network commands; see: seq-studio envs list) \u00B7 --fn <slug> \u00B7 --dir <path>\n --path <repo-subdirectory> (remote build/deploy only) select one function in a multi-function repo\n --from-env-file <path> (default: .env) source file for secret values\n --no-wait \u00B7 --yes\n --no-provision (deploy) update-only: error instead of registering a new\n shell, writing secret values, or attaching secrets (CI sweep)\n\n Local Atlas builds and runs deployed functions on this computer, including teardown.\n \"functions dev\" runs a standalone handler without Atlas registration.\n\n Configure per-function CPU and concurrency in managed-function.yml under limits.\n Run \"functions limits\" for valid settings; redeploy to apply manifest changes.\n Invocation rates are shared across Atlas replicas; 429 includes Retry-After.\n If the shared rate limiter is unavailable, invocation fails closed with 503.\n\n Source for build/deploy: a local --dir (default .), a platform git-service\n repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --path selects\n a function directory within a remote repo; omit it for the existing root-manifest\n layout. --ref selects a branch/tag/commit (default: the repo's default branch).\n Remote sources record the pinned commit as provenance (never dirty) and NEVER\n read a repo-committed .env for secret values \u2014 provision secrets server-side\n or pass a local --from-env-file (resolved against your cwd).\n\n Interactive --repo builds clone over smart-HTTP and require a repo:read git\n PAT in ATLAS_GIT_PAT (`seq-studio auth pat create --scopes repo:read`, or\n Atlas \u2192 Settings \u2192 Tokens). Headless M2M builds use JSON materialize and\n accept only platform-managed --repo sources. Interactive builds also need\n --env + seq-studio login to resolve the repo and deploy.\n";
|
|
6
|
+
export declare const REPOS_USAGE = "usage:\n seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment\n seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces\n seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)\n seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]\n create a repo seeded with a README; --git-backend\n walgit creates it empty (for pushing existing\n history); needs namespace write\n seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]\n seq-studio repos clone --url <https://\u2026/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]\n seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]\n smart-HTTP when ATLAS_GIT_PAT is set;\n otherwise JSON materialize (<ns>/<name>)\n seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n materialize the tree at a ref (JSON API)\n seq-studio repos pulls <list|show|create|diff|merge> [args] review requests (see pulls --help)\n seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)\n seq-studio repos ci init [--dir <repository>] create a native pipeline using platform defaults\n seq-studio repos ci show <ns>/<name> -e <env> --pr <number> [--json] inspect the server CI plan and runs\n seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview pipeline discovery or legacy checks\n seq-studio repos ci require <ns>/<name> --check <name> -e <env> disabled legacy control\n seq-studio repos ci import <ns>/<name> -e <env> [--ref r] disabled legacy control\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n\n clone prefers real git clone (PAT via askpass \u2014 never written into the remote\n URL). --transport auto (default) uses Git when ATLAS_GIT_PAT is set and JSON\n materialization otherwise; --transport git requires a repo:read PAT; --transport\n json ignores ATLAS_GIT_PAT and uses the signed-in Atlas identity (<ns>/<name>\n only; no .git directory). Authentication failures explain this retry path.\n JSON materialization requires repo read access and prints how to create a PAT.\n PAT without Auth0 login: use --id from Repositories \u2192 Clone\n (or --url with the environment's canonical HTTPS origin).\n --ref accepts a branch, tag, or commit SHA (SHA \u2192 full clone, then checkout).\n Branch and tag clones are shallow (--depth 1). Pass --full for history.\n --output selects the clone directory (--out remains an alias).\n\n Authenticate JSON API calls with: seq-studio login\n Authenticate git clone/push with: ATLAS_GIT_PAT (from Atlas Settings \u2192 Tokens)\n";
|
|
5
7
|
export declare function staticHelp({ namespace, sub }: {
|
|
6
8
|
namespace: string;
|
|
7
9
|
sub?: string;
|
package/dist/command-help.js
CHANGED
|
@@ -54,6 +54,93 @@ export const PIPELINE_HELP = `usage:
|
|
|
54
54
|
--target chooses a logical target when the environment has more than one.
|
|
55
55
|
Help is available offline.
|
|
56
56
|
`;
|
|
57
|
+
export const FUNCTIONS_USAGE = `usage:
|
|
58
|
+
seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers
|
|
59
|
+
seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)
|
|
60
|
+
seq-studio functions register -e <env> [--dir d] register a function shell without deploying
|
|
61
|
+
seq-studio functions deploy -e <env> [-m msg] preflight deployed capabilities, then upload and deploy
|
|
62
|
+
seq-studio functions list -e <env> [--match-local] functions visible on the environment
|
|
63
|
+
seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)
|
|
64
|
+
seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy
|
|
65
|
+
[--fn slug] also show effective runtime limits (requires -e)
|
|
66
|
+
seq-studio functions dev [--dir path] [--port 8080] local HTTP server with cache context
|
|
67
|
+
seq-studio functions invoke -e <env> [--data JSON | --data @file | --stdin]
|
|
68
|
+
invoke a function and print its response
|
|
69
|
+
seq-studio functions logs -e <env> [--limit N] [--since t] function logs (reader-gated)
|
|
70
|
+
seq-studio functions promote <version> -e <env> make a version live
|
|
71
|
+
seq-studio functions rollback [<version>] -e <env> redeploy a prior version
|
|
72
|
+
seq-studio functions delete -e <env> [--yes] archive function + tear down its runtime
|
|
73
|
+
(version history is retained)
|
|
74
|
+
|
|
75
|
+
Flags: -e/--env <env|preview:<slug>> (required for network commands; see: seq-studio envs list) · --fn <slug> · --dir <path>
|
|
76
|
+
--path <repo-subdirectory> (remote build/deploy only) select one function in a multi-function repo
|
|
77
|
+
--from-env-file <path> (default: .env) source file for secret values
|
|
78
|
+
--no-wait · --yes
|
|
79
|
+
--no-provision (deploy) update-only: error instead of registering a new
|
|
80
|
+
shell, writing secret values, or attaching secrets (CI sweep)
|
|
81
|
+
|
|
82
|
+
Local Atlas builds and runs deployed functions on this computer, including teardown.
|
|
83
|
+
"functions dev" runs a standalone handler without Atlas registration.
|
|
84
|
+
|
|
85
|
+
Configure per-function CPU and concurrency in managed-function.yml under limits.
|
|
86
|
+
Run "functions limits" for valid settings; redeploy to apply manifest changes.
|
|
87
|
+
Invocation rates are shared across Atlas replicas; 429 includes Retry-After.
|
|
88
|
+
If the shared rate limiter is unavailable, invocation fails closed with 503.
|
|
89
|
+
|
|
90
|
+
Source for build/deploy: a local --dir (default .), a platform git-service
|
|
91
|
+
repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --path selects
|
|
92
|
+
a function directory within a remote repo; omit it for the existing root-manifest
|
|
93
|
+
layout. --ref selects a branch/tag/commit (default: the repo's default branch).
|
|
94
|
+
Remote sources record the pinned commit as provenance (never dirty) and NEVER
|
|
95
|
+
read a repo-committed .env for secret values — provision secrets server-side
|
|
96
|
+
or pass a local --from-env-file (resolved against your cwd).
|
|
97
|
+
|
|
98
|
+
Interactive --repo builds clone over smart-HTTP and require a repo:read git
|
|
99
|
+
PAT in ATLAS_GIT_PAT (\`seq-studio auth pat create --scopes repo:read\`, or
|
|
100
|
+
Atlas → Settings → Tokens). Headless M2M builds use JSON materialize and
|
|
101
|
+
accept only platform-managed --repo sources. Interactive builds also need
|
|
102
|
+
--env + seq-studio login to resolve the repo and deploy.
|
|
103
|
+
`;
|
|
104
|
+
export const REPOS_USAGE = `usage:
|
|
105
|
+
seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment
|
|
106
|
+
seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces
|
|
107
|
+
seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)
|
|
108
|
+
seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]
|
|
109
|
+
create a repo seeded with a README; --git-backend
|
|
110
|
+
walgit creates it empty (for pushing existing
|
|
111
|
+
history); needs namespace write
|
|
112
|
+
seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]
|
|
113
|
+
seq-studio repos clone --url <https://…/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]
|
|
114
|
+
seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]
|
|
115
|
+
smart-HTTP when ATLAS_GIT_PAT is set;
|
|
116
|
+
otherwise JSON materialize (<ns>/<name>)
|
|
117
|
+
seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]
|
|
118
|
+
materialize the tree at a ref (JSON API)
|
|
119
|
+
seq-studio repos pulls <list|show|create|diff|merge> [args] review requests (see pulls --help)
|
|
120
|
+
seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)
|
|
121
|
+
seq-studio repos ci init [--dir <repository>] create a native pipeline using platform defaults
|
|
122
|
+
seq-studio repos ci show <ns>/<name> -e <env> --pr <number> [--json] inspect the server CI plan and runs
|
|
123
|
+
seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview pipeline discovery or legacy checks
|
|
124
|
+
seq-studio repos ci require <ns>/<name> --check <name> -e <env> disabled legacy control
|
|
125
|
+
seq-studio repos ci import <ns>/<name> -e <env> [--ref r] disabled legacy control
|
|
126
|
+
|
|
127
|
+
Flags: -e/--env <env> (required; see: seq-studio envs list)
|
|
128
|
+
|
|
129
|
+
clone prefers real git clone (PAT via askpass — never written into the remote
|
|
130
|
+
URL). --transport auto (default) uses Git when ATLAS_GIT_PAT is set and JSON
|
|
131
|
+
materialization otherwise; --transport git requires a repo:read PAT; --transport
|
|
132
|
+
json ignores ATLAS_GIT_PAT and uses the signed-in Atlas identity (<ns>/<name>
|
|
133
|
+
only; no .git directory). Authentication failures explain this retry path.
|
|
134
|
+
JSON materialization requires repo read access and prints how to create a PAT.
|
|
135
|
+
PAT without Auth0 login: use --id from Repositories → Clone
|
|
136
|
+
(or --url with the environment's canonical HTTPS origin).
|
|
137
|
+
--ref accepts a branch, tag, or commit SHA (SHA → full clone, then checkout).
|
|
138
|
+
Branch and tag clones are shallow (--depth 1). Pass --full for history.
|
|
139
|
+
--output selects the clone directory (--out remains an alias).
|
|
140
|
+
|
|
141
|
+
Authenticate JSON API calls with: seq-studio login
|
|
142
|
+
Authenticate git clone/push with: ATLAS_GIT_PAT (from Atlas Settings → Tokens)
|
|
143
|
+
`;
|
|
57
144
|
export function staticHelp({ namespace, sub }) {
|
|
58
145
|
if (namespace === 'artifact')
|
|
59
146
|
return ARTIFACT_HELP;
|
|
@@ -61,6 +148,10 @@ export function staticHelp({ namespace, sub }) {
|
|
|
61
148
|
return ORM_HELP;
|
|
62
149
|
if (namespace === 'pipeline')
|
|
63
150
|
return PIPELINE_HELP;
|
|
151
|
+
if (namespace === 'functions')
|
|
152
|
+
return FUNCTIONS_USAGE;
|
|
153
|
+
if (namespace === 'repos' && sub !== 'pulls' && sub !== 'ci')
|
|
154
|
+
return REPOS_USAGE;
|
|
64
155
|
if (namespace === 'doctor') {
|
|
65
156
|
return `usage: seq-studio doctor [-e <env>] [--json] [--offline]\n\nDiagnose config, auth, local service availability, CLI/SDK resolution, and deployment access. --offline reads local metadata without discovery or HTTP requests. Help is available offline.\n`;
|
|
66
157
|
}
|
|
@@ -93,5 +93,4 @@ export declare function functionsRollbackCommand(args: ParsedArgs): Promise<numb
|
|
|
93
93
|
/** Minimal dotenv parser — KEY=VALUE lines, quotes stripped, comments skipped. */
|
|
94
94
|
export declare function parseDotenv(content: string): Record<string, string>;
|
|
95
95
|
export declare function functionsDeleteCommand(args: ParsedArgs): Promise<number>;
|
|
96
|
-
export declare const FUNCTIONS_USAGE = "usage:\n seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers\n seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)\n seq-studio functions register -e <env> [--dir d] register a function shell without deploying\n seq-studio functions deploy -e <env> [-m msg] preflight deployed capabilities, then upload and deploy\n seq-studio functions list -e <env> [--match-local] functions visible on the environment\n seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)\n seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy\n [--fn slug] also show effective runtime limits (requires -e)\n seq-studio functions dev [--dir path] [--port 8080] local HTTP server with cache context\n seq-studio functions invoke -e <env> [--data JSON | --data @file | --stdin]\n invoke a function and print its response\n seq-studio functions logs -e <env> [--limit N] [--since t] function logs (reader-gated)\n seq-studio functions promote <version> -e <env> make a version live\n seq-studio functions rollback [<version>] -e <env> redeploy a prior version\n seq-studio functions delete -e <env> [--yes] archive function + tear down its runtime\n (version history is retained)\n\n Flags: -e/--env <env|preview:<slug>> (required for network commands; see: seq-studio envs list) \u00B7 --fn <slug> \u00B7 --dir <path>\n --path <repo-subdirectory> (remote build/deploy only) select one function in a multi-function repo\n --from-env-file <path> (default: .env) source file for secret values\n --no-wait \u00B7 --yes\n --no-provision (deploy) update-only: error instead of registering a new\n shell, writing secret values, or attaching secrets (CI sweep)\n\n Local Atlas builds and runs deployed functions on this computer, including teardown.\n \"functions dev\" runs a standalone handler without Atlas registration.\n\n Configure per-function CPU and concurrency in managed-function.yml under limits.\n Run \"functions limits\" for valid settings; redeploy to apply manifest changes.\n Invocation rates are shared across Atlas replicas; 429 includes Retry-After.\n If the shared rate limiter is unavailable, invocation fails closed with 503.\n\n Source for build/deploy: a local --dir (default .), a platform git-service\n repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --path selects\n a function directory within a remote repo; omit it for the existing root-manifest\n layout. --ref selects a branch/tag/commit (default: the repo's default branch).\n Remote sources record the pinned commit as provenance (never dirty) and NEVER\n read a repo-committed .env for secret values \u2014 provision secrets server-side\n or pass a local --from-env-file (resolved against your cwd).\n\n Interactive --repo builds clone over smart-HTTP and require a repo:read git\n PAT in ATLAS_GIT_PAT (`seq-studio auth pat create --scopes repo:read`, or\n Atlas \u2192 Settings \u2192 Tokens). Headless M2M builds use JSON materialize and\n accept only platform-managed --repo sources. Interactive builds also need\n --env + seq-studio login to resolve the repo and deploy.\n";
|
|
97
96
|
export declare function runFunctionsCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FUNCTIONS_USAGE } from '../command-help.js';
|
|
1
2
|
import { execFile } from 'node:child_process';
|
|
2
3
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
4
|
import { existsSync } from 'node:fs';
|
|
@@ -1165,53 +1166,6 @@ export async function functionsDeleteCommand(args) {
|
|
|
1165
1166
|
// ---------------------------------------------------------------------------
|
|
1166
1167
|
// dispatcher
|
|
1167
1168
|
// ---------------------------------------------------------------------------
|
|
1168
|
-
export const FUNCTIONS_USAGE = `usage:
|
|
1169
|
-
seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers
|
|
1170
|
-
seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)
|
|
1171
|
-
seq-studio functions register -e <env> [--dir d] register a function shell without deploying
|
|
1172
|
-
seq-studio functions deploy -e <env> [-m msg] preflight deployed capabilities, then upload and deploy
|
|
1173
|
-
seq-studio functions list -e <env> [--match-local] functions visible on the environment
|
|
1174
|
-
seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)
|
|
1175
|
-
seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy
|
|
1176
|
-
[--fn slug] also show effective runtime limits (requires -e)
|
|
1177
|
-
seq-studio functions dev [--dir path] [--port 8080] local HTTP server with cache context
|
|
1178
|
-
seq-studio functions invoke -e <env> [--data JSON | --data @file | --stdin]
|
|
1179
|
-
invoke a function and print its response
|
|
1180
|
-
seq-studio functions logs -e <env> [--limit N] [--since t] function logs (reader-gated)
|
|
1181
|
-
seq-studio functions promote <version> -e <env> make a version live
|
|
1182
|
-
seq-studio functions rollback [<version>] -e <env> redeploy a prior version
|
|
1183
|
-
seq-studio functions delete -e <env> [--yes] archive function + tear down its runtime
|
|
1184
|
-
(version history is retained)
|
|
1185
|
-
|
|
1186
|
-
Flags: -e/--env <env|preview:<slug>> (required for network commands; see: seq-studio envs list) · --fn <slug> · --dir <path>
|
|
1187
|
-
--path <repo-subdirectory> (remote build/deploy only) select one function in a multi-function repo
|
|
1188
|
-
--from-env-file <path> (default: .env) source file for secret values
|
|
1189
|
-
--no-wait · --yes
|
|
1190
|
-
--no-provision (deploy) update-only: error instead of registering a new
|
|
1191
|
-
shell, writing secret values, or attaching secrets (CI sweep)
|
|
1192
|
-
|
|
1193
|
-
Local Atlas builds and runs deployed functions on this computer, including teardown.
|
|
1194
|
-
"functions dev" runs a standalone handler without Atlas registration.
|
|
1195
|
-
|
|
1196
|
-
Configure per-function CPU and concurrency in managed-function.yml under limits.
|
|
1197
|
-
Run "functions limits" for valid settings; redeploy to apply manifest changes.
|
|
1198
|
-
Invocation rates are shared across Atlas replicas; 429 includes Retry-After.
|
|
1199
|
-
If the shared rate limiter is unavailable, invocation fails closed with 503.
|
|
1200
|
-
|
|
1201
|
-
Source for build/deploy: a local --dir (default .), a platform git-service
|
|
1202
|
-
repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --path selects
|
|
1203
|
-
a function directory within a remote repo; omit it for the existing root-manifest
|
|
1204
|
-
layout. --ref selects a branch/tag/commit (default: the repo's default branch).
|
|
1205
|
-
Remote sources record the pinned commit as provenance (never dirty) and NEVER
|
|
1206
|
-
read a repo-committed .env for secret values — provision secrets server-side
|
|
1207
|
-
or pass a local --from-env-file (resolved against your cwd).
|
|
1208
|
-
|
|
1209
|
-
Interactive --repo builds clone over smart-HTTP and require a repo:read git
|
|
1210
|
-
PAT in ATLAS_GIT_PAT (\`seq-studio auth pat create --scopes repo:read\`, or
|
|
1211
|
-
Atlas → Settings → Tokens). Headless M2M builds use JSON materialize and
|
|
1212
|
-
accept only platform-managed --repo sources. Interactive builds also need
|
|
1213
|
-
--env + seq-studio login to resolve the repo and deploy.
|
|
1214
|
-
`;
|
|
1215
1169
|
export async function runFunctionsCommand(sub, args) {
|
|
1216
1170
|
try {
|
|
1217
1171
|
switch (sub) {
|
|
@@ -12,7 +12,7 @@ export declare function preflightBeforeUpload({ client, rootDir, manifest, cliVe
|
|
|
12
12
|
manifest: PreflightManifest;
|
|
13
13
|
cliVersion: string;
|
|
14
14
|
}): Promise<PreflightIssue[]>;
|
|
15
|
-
/** Offline
|
|
15
|
+
/** Offline schema and tooling checks; deployment feature support is checked before upload. */
|
|
16
16
|
export declare function localSdkPreflight({ rootDir, manifest, cliVersion, }: {
|
|
17
17
|
rootDir: string;
|
|
18
18
|
manifest: PreflightManifest;
|
|
@@ -25,12 +25,13 @@ export async function preflightBeforeUpload({ client, rootDir, manifest, cliVers
|
|
|
25
25
|
sdkVersion: await declaredSdkVersion(rootDir),
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
/** Offline
|
|
28
|
+
/** Offline schema and tooling checks; deployment feature support is checked before upload. */
|
|
29
29
|
export async function localSdkPreflight({ rootDir, manifest, cliVersion, }) {
|
|
30
30
|
return preflightManagedFunction({
|
|
31
31
|
manifest,
|
|
32
32
|
limits: null,
|
|
33
33
|
capabilities: null,
|
|
34
|
+
checkDeployment: false,
|
|
34
35
|
cliVersion,
|
|
35
36
|
sdkVersion: await declaredSdkVersion(rootDir),
|
|
36
37
|
});
|
|
@@ -133,6 +133,9 @@ export declare const managedFunctionManifestSchema: z.ZodObject<{
|
|
|
133
133
|
editor: "editor";
|
|
134
134
|
admin: "admin";
|
|
135
135
|
}>>>;
|
|
136
|
+
processes: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
read: z.ZodArray<z.ZodString>;
|
|
138
|
+
}, z.core.$strict>>;
|
|
136
139
|
roles: z.ZodOptional<z.ZodObject<{
|
|
137
140
|
definitions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
138
141
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { storageScopesSchema, readStorageScopes } from '@sequenceholdings/storage';
|
|
2
2
|
import { postgresEgressError } from './egress-postgres.js';
|
|
3
3
|
import { cacheManifestSchema, managedFunctionWorkloadLimitsSchema } from '@sequenceholdings/managed-functions/config';
|
|
4
|
+
import { functionProcessReadScopesSchema } from '@sequenceholdings/managed-functions/config';
|
|
4
5
|
import { isIP } from 'node:net';
|
|
5
6
|
import { z } from 'zod';
|
|
6
7
|
import { ontologyContractSchema } from '@sequenceholdings/orm/canonical';
|
|
@@ -592,6 +593,23 @@ const invocationIpRangeSchema = z
|
|
|
592
593
|
});
|
|
593
594
|
}
|
|
594
595
|
});
|
|
596
|
+
function refineServiceAccountAttachment({ requiresServiceAccount, serviceAccount, ctx }) {
|
|
597
|
+
if (requiresServiceAccount && serviceAccount === undefined) {
|
|
598
|
+
ctx.addIssue({
|
|
599
|
+
code: 'custom',
|
|
600
|
+
message: 'Data, storage or process capabilities require a top-level service_account — the platform service ' +
|
|
601
|
+
'account this function acts as for service access (the deployer needs the actor role on it)',
|
|
602
|
+
path: ['service_account'],
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
if (!requiresServiceAccount && serviceAccount !== undefined) {
|
|
606
|
+
ctx.addIssue({
|
|
607
|
+
code: 'custom',
|
|
608
|
+
message: 'service_account requires capabilities.data or capabilities.storage or capabilities.processes',
|
|
609
|
+
path: ['service_account'],
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
}
|
|
595
613
|
export const managedFunctionManifestSchema = z.object({
|
|
596
614
|
ontology: ontologyContractSchema.optional(),
|
|
597
615
|
cache: cacheManifestSchema.optional(),
|
|
@@ -649,8 +667,8 @@ export const managedFunctionManifestSchema = z.object({
|
|
|
649
667
|
})
|
|
650
668
|
.default([]),
|
|
651
669
|
/**
|
|
652
|
-
* The platform service account available for explicit service-mode data or
|
|
653
|
-
* (slug or id). Required whenever data or
|
|
670
|
+
* The platform service account available for explicit service-mode data, storage or process access
|
|
671
|
+
* (slug or id). Required whenever data, storage or process capabilities are declared,
|
|
654
672
|
* rejected otherwise. Resolved and authorized server-side at activation —
|
|
655
673
|
* the deploy actor must hold `actor` on the account when the attachment
|
|
656
674
|
* changes. Mirrors atlas/src/server/services/managed-functions/manifest.ts.
|
|
@@ -673,6 +691,7 @@ export const managedFunctionManifestSchema = z.object({
|
|
|
673
691
|
*/
|
|
674
692
|
capabilities: z.object({
|
|
675
693
|
storage: storageScopesSchema.optional(),
|
|
694
|
+
processes: functionProcessReadScopesSchema.optional(),
|
|
676
695
|
roles: customRolesBlockSchema.optional(),
|
|
677
696
|
uses: capabilityPinsSchema,
|
|
678
697
|
gates: capabilityGatesSchema,
|
|
@@ -774,21 +793,12 @@ export const managedFunctionManifestSchema = z.object({
|
|
|
774
793
|
// action, operation, or raw query — the same rule the server's floor
|
|
775
794
|
// reconciliation uses (readManifestDataNamespaces).
|
|
776
795
|
const reachesData = Object.keys(readStorageScopes(manifest)).length > 0 || Object.values(manifest.capabilities.data).some((block) => block.tables.length > 0 || block.actions.length > 0 || block.operations.length > 0 || block.query);
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
if (!reachesData && manifest.service_account !== undefined) {
|
|
786
|
-
ctx.addIssue({
|
|
787
|
-
code: 'custom',
|
|
788
|
-
message: 'service_account requires capabilities.data or capabilities.storage',
|
|
789
|
-
path: ['service_account'],
|
|
790
|
-
});
|
|
791
|
-
}
|
|
796
|
+
const reachesProcesses = (manifest.capabilities.processes?.read.length ?? 0) > 0;
|
|
797
|
+
refineServiceAccountAttachment({
|
|
798
|
+
requiresServiceAccount: reachesData || reachesProcesses,
|
|
799
|
+
serviceAccount: manifest.service_account,
|
|
800
|
+
ctx,
|
|
801
|
+
});
|
|
792
802
|
});
|
|
793
803
|
export function manifestSecretNames(value) {
|
|
794
804
|
return value.secrets.flatMap((entry) => typeof entry === 'string'
|
package/dist/main.js
CHANGED
|
@@ -36,7 +36,7 @@ const TOP_LEVEL_USAGE = `usage:
|
|
|
36
36
|
seq-studio storage <sub> [args] init | validate | apply | list | show | mkdir | upload | download | access | trash | restore | purge | operations | abort | delete
|
|
37
37
|
seq-studio agents <sub> [args] init | validate | plan | apply | list | show | voice (internal)
|
|
38
38
|
seq-studio secrets <sub> [args] create | set | list | attach | detach | apply
|
|
39
|
-
seq-studio repos <sub> [args] list | namespaces | show | create | clone | pull | pulls | delete
|
|
39
|
+
seq-studio repos <sub> [args] list | namespaces | show | create | clone | pull | pulls | delete | ci
|
|
40
40
|
seq-studio pipeline <sub> [args] list | assets | search | describe | schema | sample | query | init | validate | repin-orm | codegen | plan | adopt | unbind | deploy | status | migrate | promote | rollback | run-now
|
|
41
41
|
seq-studio auth <sub> [args] whoami | pat create | pat list | pat revoke
|
|
42
42
|
seq-studio orm <sub> [args] init | generate | validate | plan | apply | execute | diff | migrate-from-yaml | import
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Keep the bounded data-only parser aligned with Atlas git-service/ci-config.ts.
|
|
2
|
+
import { JSON_SCHEMA, load } from 'js-yaml';
|
|
3
|
+
/** Data-only configuration: duplicate keys fail and aliases cannot expand without bound. */
|
|
4
|
+
export function parseCiConfigText({ text, path }) {
|
|
5
|
+
if (Buffer.byteLength(text, 'utf8') > 1024 * 1024)
|
|
6
|
+
throw new Error('CI configuration exceeds the 1 MiB limit');
|
|
7
|
+
const value = path.endsWith('.json') ? JSON.parse(text) : load(text, { schema: JSON_SCHEMA });
|
|
8
|
+
const seen = new Set();
|
|
9
|
+
const active = new Set();
|
|
10
|
+
let aliases = 0;
|
|
11
|
+
let nodes = 0;
|
|
12
|
+
const visit = (entry, depth) => {
|
|
13
|
+
if (++nodes > 10000 || depth > 64)
|
|
14
|
+
throw new Error('CI configuration exceeds the expanded node or depth limit');
|
|
15
|
+
if (entry === null || typeof entry !== 'object')
|
|
16
|
+
return;
|
|
17
|
+
if (active.has(entry))
|
|
18
|
+
throw new Error('Recursive YAML aliases are not supported in CI configuration');
|
|
19
|
+
if (seen.has(entry) && ++aliases > 100)
|
|
20
|
+
throw new Error('CI configuration exceeds the YAML alias limit');
|
|
21
|
+
seen.add(entry);
|
|
22
|
+
active.add(entry);
|
|
23
|
+
for (const child of Object.values(entry))
|
|
24
|
+
visit(child, depth + 1);
|
|
25
|
+
active.delete(entry);
|
|
26
|
+
};
|
|
27
|
+
visit(value, 0);
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { lstat, mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
const defaultPipeline = `# Native checks use platform-managed tools and the repository's resource manifests.
|
|
4
|
+
# Add target overrides here when a resource needs different commands or inputs.
|
|
5
|
+
schema_version: 2
|
|
6
|
+
targets: []
|
|
7
|
+
`;
|
|
8
|
+
/** Create the opt-in file without replacing authored configuration or following .seq symlinks. */
|
|
9
|
+
export async function initializeRepositoryPipeline({ directory }) {
|
|
10
|
+
const root = resolve(directory);
|
|
11
|
+
if (!(await lstat(root)).isDirectory())
|
|
12
|
+
throw new Error('CI initialization requires an existing repository directory');
|
|
13
|
+
const configurationDirectory = join(root, '.seq');
|
|
14
|
+
await mkdir(configurationDirectory, { recursive: true });
|
|
15
|
+
if (!(await lstat(configurationDirectory)).isDirectory())
|
|
16
|
+
throw new Error('CI initialization requires .seq to be a regular directory');
|
|
17
|
+
try {
|
|
18
|
+
await lstat(join(configurationDirectory, 'ci.json'));
|
|
19
|
+
throw new Error('Legacy .seq/ci.json already exists; migrate it to .seq/pipeline.yml instead of creating both files');
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT'))
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
const filename = join(configurationDirectory, 'pipeline.yml');
|
|
26
|
+
try {
|
|
27
|
+
await writeFile(filename, defaultPipeline, { flag: 'wx' });
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error instanceof Error && 'code' in error && error.code === 'EEXIST')
|
|
31
|
+
throw new Error('.seq/pipeline.yml already exists; edit the existing pipeline');
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
return filename;
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CommandContext } from '../functions/commands.js';
|
|
2
|
+
/** Read the authoritative server plan; the CLI never infers execution or deployment authority. */
|
|
3
|
+
export declare function showRepositoryPrCi({ ctx, repoId, repoPath, number, json }: {
|
|
4
|
+
ctx: CommandContext;
|
|
5
|
+
repoId: string;
|
|
6
|
+
repoPath: string;
|
|
7
|
+
number: number;
|
|
8
|
+
json: boolean;
|
|
9
|
+
}): Promise<number>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getJson } from '../atlas-client.js';
|
|
3
|
+
import { clientOptions } from '../functions/commands.js';
|
|
4
|
+
const actionSchema = z.object({ name: z.string(), phase: z.string(), cwd: z.string(), command: z.array(z.string()) });
|
|
5
|
+
const statusSchema = z.object({
|
|
6
|
+
discovery: z.object({ source: z.enum(['pipeline', 'policy', 'none']), state: z.enum(['ready', 'not-configured', 'unavailable']), message: z.string().optional() }).optional(),
|
|
7
|
+
planningIssue: z.object({ code: z.string(), message: z.string() }).nullable(),
|
|
8
|
+
plan: z.object({
|
|
9
|
+
planHash: z.string(), headSha: z.string(),
|
|
10
|
+
targets: z.array(z.object({ key: z.string(), kind: z.string(), root: z.string(), affected: z.boolean(), checks: z.array(actionSchema), build: actionSchema.nullable() })),
|
|
11
|
+
findings: z.array(z.object({ severity: z.string(), code: z.string(), message: z.string() })),
|
|
12
|
+
}).nullable(),
|
|
13
|
+
currentRunId: z.string().nullable(),
|
|
14
|
+
runs: z.array(z.object({ id: z.string(), state: z.string(), error: z.string().nullable().optional() })),
|
|
15
|
+
});
|
|
16
|
+
function printPlan({ plan }) {
|
|
17
|
+
console.log(` Head: ${plan.headSha}; plan: ${plan.planHash}`);
|
|
18
|
+
for (const target of plan.targets) {
|
|
19
|
+
console.log(` ${target.key} (${target.kind}, ${target.root}): ${target.affected ? 'affected' : 'unchanged'}`);
|
|
20
|
+
for (const action of [...target.checks, ...(target.build ? [target.build] : [])])
|
|
21
|
+
console.log(` ${action.phase}: ${JSON.stringify(action.command)} (cwd ${action.cwd})`);
|
|
22
|
+
}
|
|
23
|
+
for (const finding of plan.findings)
|
|
24
|
+
console.log(` ${finding.severity} ${finding.code}: ${finding.message}`);
|
|
25
|
+
}
|
|
26
|
+
/** Read the authoritative server plan; the CLI never infers execution or deployment authority. */
|
|
27
|
+
export async function showRepositoryPrCi({ ctx, repoId, repoPath, number, json }) {
|
|
28
|
+
const response = await getJson({ ...clientOptions(ctx), path: `/api/git-service/repos/${repoId}/pulls/${number}/ci` });
|
|
29
|
+
const status = statusSchema.parse(response);
|
|
30
|
+
const blocked = status.discovery?.state === 'unavailable' || status.planningIssue !== null || status.plan?.findings.some((finding) => finding.severity === 'error');
|
|
31
|
+
if (json) {
|
|
32
|
+
console.log(JSON.stringify(response, null, 2));
|
|
33
|
+
return blocked ? 1 : 0;
|
|
34
|
+
}
|
|
35
|
+
console.log(`CI for ${repoPath} pull request #${number} on ${ctx.env.name}:`);
|
|
36
|
+
if (status.discovery)
|
|
37
|
+
console.log(` Discovery: ${status.discovery.state} (${status.discovery.source})${status.discovery.message ? ` — ${status.discovery.message}` : ''}`);
|
|
38
|
+
if (status.planningIssue)
|
|
39
|
+
console.log(` ${status.planningIssue.code}: ${status.planningIssue.message}`);
|
|
40
|
+
if (status.plan) {
|
|
41
|
+
printPlan({ plan: status.plan });
|
|
42
|
+
}
|
|
43
|
+
else if (!status.planningIssue && status.discovery?.state !== 'unavailable') {
|
|
44
|
+
console.log(' No native plan yet. Commit .seq/pipeline.yml with your resource manifests and open or update a pull request.');
|
|
45
|
+
}
|
|
46
|
+
for (const run of status.runs.slice(0, 5))
|
|
47
|
+
console.log(` ${run.id === status.currentRunId ? 'Current' : 'Previous'} run ${run.id}: ${run.state}${run.error ? ` — ${run.error}` : ''}`);
|
|
48
|
+
return blocked ? 1 : 0;
|
|
49
|
+
}
|
package/dist/repos/commands.d.ts
CHANGED
|
@@ -67,35 +67,32 @@ type DiscoveredCliCheck = {
|
|
|
67
67
|
name: string;
|
|
68
68
|
script?: string;
|
|
69
69
|
command?: string[];
|
|
70
|
-
source: 'autodiscover' | 'ci.json';
|
|
70
|
+
source: 'autodiscover' | 'ci.json' | 'pipeline.yml';
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
73
73
|
* Pure discovery shared by `repos ci show` / `import`. Mirrors atlas
|
|
74
74
|
* `discoverCiChecks` / `parseCiJson` so CLI preview matches execution.
|
|
75
75
|
*/
|
|
76
|
-
export declare function discoverCliChecks({ ciJson, packageScripts, }: {
|
|
76
|
+
export declare function discoverCliChecks({ ciYaml, ciJson, packageScripts, }: {
|
|
77
|
+
ciYaml?: unknown;
|
|
77
78
|
ciJson?: unknown;
|
|
78
79
|
packageScripts?: Record<string, string>;
|
|
79
80
|
}): {
|
|
80
81
|
ok: true;
|
|
81
82
|
checks: DiscoveredCliCheck[];
|
|
83
|
+
native?: boolean;
|
|
82
84
|
} | {
|
|
83
85
|
ok: false;
|
|
84
86
|
error: string;
|
|
85
87
|
};
|
|
86
|
-
/**
|
|
87
|
-
* Load `.seq/ci.json` / `package.json` for CI preview.
|
|
88
|
-
*
|
|
89
|
-
* Matches the runner: only a true 404 means "file absent". Invalid JSON and
|
|
90
|
-
* non-404 API errors fail closed (no silent package.json fallback over a bad
|
|
91
|
-
* `.seq/ci.json`).
|
|
92
|
-
*/
|
|
88
|
+
/** Load YAML or legacy JSON; only a true 404 means configuration is absent. */
|
|
93
89
|
export declare function loadRemoteCiSources({ ctx, repoId, ref, }: {
|
|
94
90
|
ctx: CommandContext;
|
|
95
91
|
repoId: string;
|
|
96
92
|
ref: string;
|
|
97
93
|
}): Promise<{
|
|
98
94
|
ok: true;
|
|
95
|
+
ciYaml?: unknown;
|
|
99
96
|
ciJson?: unknown;
|
|
100
97
|
packageScripts?: Record<string, string>;
|
|
101
98
|
} | {
|
|
@@ -115,6 +112,5 @@ export declare function reposCiRequireCommand(args: ParsedArgs): Promise<number>
|
|
|
115
112
|
export declare function reposCiImportCommand(args: ParsedArgs): Promise<number>;
|
|
116
113
|
export declare function reposCiCommand(args: ParsedArgs): Promise<number>;
|
|
117
114
|
export declare function reposDeleteCommand(args: ParsedArgs): Promise<number>;
|
|
118
|
-
export declare const REPOS_USAGE = "usage:\n seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment\n seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces\n seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)\n seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]\n create a repo seeded with a README; --git-backend\n walgit creates it empty (for pushing existing\n history); needs namespace write\n seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]\n seq-studio repos clone --url <https://\u2026/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]\n seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]\n smart-HTTP when ATLAS_GIT_PAT is set;\n otherwise JSON materialize (<ns>/<name>)\n seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n materialize the tree at a ref (JSON API)\n seq-studio repos pulls <list|show|create|diff|merge> [args] review requests (see pulls --help)\n seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)\n seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview discovered CI checks\n seq-studio repos ci require <ns>/<name> --check <name> -e <env> reserved (refuses write until sandboxed runner)\n seq-studio repos ci import <ns>/<name> -e <env> [--ref r] reserved (refuses write until sandboxed runner)\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n\n clone prefers real git clone (PAT via askpass \u2014 never written into the remote\n URL). --transport auto (default) uses Git when ATLAS_GIT_PAT is set and JSON\n materialization otherwise; --transport git requires a repo:read PAT; --transport\n json ignores ATLAS_GIT_PAT and uses the signed-in Atlas identity (<ns>/<name>\n only; no .git directory). Authentication failures explain this retry path.\n JSON materialization requires repo read access and prints how to create a PAT.\n PAT without Auth0 login: use --id from Repositories \u2192 Clone\n (or --url with the environment's canonical HTTPS origin).\n --ref accepts a branch, tag, or commit SHA (SHA \u2192 full clone, then checkout).\n Branch and tag clones are shallow (--depth 1). Pass --full for history.\n --output selects the clone directory (--out remains an alias).\n\n Authenticate JSON API calls with: seq-studio login\n Authenticate git clone/push with: ATLAS_GIT_PAT (from Atlas Settings \u2192 Tokens)\n";
|
|
119
115
|
export declare function runReposCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|
|
120
116
|
export {};
|
package/dist/repos/commands.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REPOS_USAGE } from '../command-help.js';
|
|
1
2
|
/**
|
|
2
3
|
* `seq-studio repos <sub>` — basic management of platform git-service repos
|
|
3
4
|
* over the JSON API.
|
|
@@ -17,6 +18,9 @@ import { homedir } from 'node:os';
|
|
|
17
18
|
import { resolve, sep } from 'node:path';
|
|
18
19
|
import { materializeRepo, resolveCommitSha, resolveRepo, } from '@sequenceholdings/artifact-studio/git-service-client';
|
|
19
20
|
import { z } from 'zod';
|
|
21
|
+
import { parseCiConfigText } from './ci-config.js';
|
|
22
|
+
import { initializeRepositoryPipeline } from './ci-init.js';
|
|
23
|
+
import { showRepositoryPrCi } from './ci-status.js';
|
|
20
24
|
import { AtlasApiError, deleteNoContent, getJson, getJsonOr404, postJson, } from '../atlas-client.js';
|
|
21
25
|
import { printCliError } from '../cli-errors.js';
|
|
22
26
|
import { PREVIEW_DOMAIN } from '../preview.js';
|
|
@@ -546,7 +550,7 @@ function defaultOutFromCloneTarget({ url, id, }) {
|
|
|
546
550
|
}
|
|
547
551
|
/**
|
|
548
552
|
* Mirror of atlas `ci-discover` Zod contract so `repos ci show` fails closed
|
|
549
|
-
* on the same invalid `.seq/
|
|
553
|
+
* on the same invalid `.seq/pipeline.yml` / legacy JSON shapes the runner rejects (`ci/config`).
|
|
550
554
|
* Keep in sync with `atlas/src/server/services/git-service/ci-discover.ts`.
|
|
551
555
|
*/
|
|
552
556
|
const CiPhaseSchema = z.enum(['check', 'test']);
|
|
@@ -582,45 +586,55 @@ function defaultNameForPhase(phase, indexInPhase) {
|
|
|
582
586
|
return `ci/${phase}`;
|
|
583
587
|
return `ci/${phase}-${indexInPhase + 1}`;
|
|
584
588
|
}
|
|
589
|
+
function discoverConfiguredCliChecks({ configuration, source }) {
|
|
590
|
+
if (configuration !== null && typeof configuration === 'object' && Reflect.get(configuration, 'schema_version') === 2) {
|
|
591
|
+
return { ok: true, checks: [], native: true };
|
|
592
|
+
}
|
|
593
|
+
const parsed = CiJsonSchema.safeParse(configuration);
|
|
594
|
+
if (!parsed.success) {
|
|
595
|
+
const detail = parsed.error.issues
|
|
596
|
+
.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`)
|
|
597
|
+
.slice(0, 3)
|
|
598
|
+
.join('; ');
|
|
599
|
+
return { ok: false, error: `Invalid .seq/${source}: ${detail}` };
|
|
600
|
+
}
|
|
601
|
+
const phaseCounts = new Map();
|
|
602
|
+
const seenNames = new Set();
|
|
603
|
+
const checks = [];
|
|
604
|
+
for (const entry of parsed.data.checks) {
|
|
605
|
+
const indexInPhase = phaseCounts.get(entry.phase) ?? 0;
|
|
606
|
+
phaseCounts.set(entry.phase, indexInPhase + 1);
|
|
607
|
+
const name = entry.name ?? defaultNameForPhase(entry.phase, indexInPhase);
|
|
608
|
+
if (seenNames.has(name)) {
|
|
609
|
+
return {
|
|
610
|
+
ok: false,
|
|
611
|
+
error: `Invalid .seq/${source}: duplicate check name "${name}"`,
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
seenNames.add(name);
|
|
615
|
+
const check = {
|
|
616
|
+
name,
|
|
617
|
+
source,
|
|
618
|
+
};
|
|
619
|
+
if (entry.script != null)
|
|
620
|
+
check.script = entry.script;
|
|
621
|
+
if (entry.command != null)
|
|
622
|
+
check.command = entry.command;
|
|
623
|
+
checks.push(check);
|
|
624
|
+
}
|
|
625
|
+
return { ok: true, checks };
|
|
626
|
+
}
|
|
585
627
|
/**
|
|
586
628
|
* Pure discovery shared by `repos ci show` / `import`. Mirrors atlas
|
|
587
629
|
* `discoverCiChecks` / `parseCiJson` so CLI preview matches execution.
|
|
588
630
|
*/
|
|
589
|
-
export function discoverCliChecks({ ciJson, packageScripts, }) {
|
|
590
|
-
if (ciJson !== undefined)
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
.join('; ');
|
|
597
|
-
return { ok: false, error: `Invalid .seq/ci.json: ${detail}` };
|
|
598
|
-
}
|
|
599
|
-
const phaseCounts = new Map();
|
|
600
|
-
const seenNames = new Set();
|
|
601
|
-
const checks = [];
|
|
602
|
-
for (const entry of parsed.data.checks) {
|
|
603
|
-
const indexInPhase = phaseCounts.get(entry.phase) ?? 0;
|
|
604
|
-
phaseCounts.set(entry.phase, indexInPhase + 1);
|
|
605
|
-
const name = entry.name ?? defaultNameForPhase(entry.phase, indexInPhase);
|
|
606
|
-
if (seenNames.has(name)) {
|
|
607
|
-
return {
|
|
608
|
-
ok: false,
|
|
609
|
-
error: `Invalid .seq/ci.json: duplicate check name "${name}"`,
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
seenNames.add(name);
|
|
613
|
-
const check = {
|
|
614
|
-
name,
|
|
615
|
-
source: 'ci.json',
|
|
616
|
-
};
|
|
617
|
-
if (entry.script != null)
|
|
618
|
-
check.script = entry.script;
|
|
619
|
-
if (entry.command != null)
|
|
620
|
-
check.command = entry.command;
|
|
621
|
-
checks.push(check);
|
|
622
|
-
}
|
|
623
|
-
return { ok: true, checks };
|
|
631
|
+
export function discoverCliChecks({ ciYaml, ciJson, packageScripts, }) {
|
|
632
|
+
if (ciYaml !== undefined && ciJson !== undefined)
|
|
633
|
+
return { ok: false, error: 'Both .seq/pipeline.yml and .seq/ci.json exist; remove one to make CI configuration unambiguous' };
|
|
634
|
+
if (ciYaml !== undefined || ciJson !== undefined) {
|
|
635
|
+
const source = ciYaml !== undefined ? 'pipeline.yml' : 'ci.json';
|
|
636
|
+
const configuration = ciYaml !== undefined ? ciYaml : ciJson;
|
|
637
|
+
return discoverConfiguredCliChecks({ configuration, source });
|
|
624
638
|
}
|
|
625
639
|
const checks = [];
|
|
626
640
|
if (packageScripts) {
|
|
@@ -641,39 +655,36 @@ function decodeFileContent(file) {
|
|
|
641
655
|
? Buffer.from(file.content, 'base64').toString('utf8')
|
|
642
656
|
: file.content;
|
|
643
657
|
}
|
|
644
|
-
/**
|
|
645
|
-
* Load `.seq/ci.json` / `package.json` for CI preview.
|
|
646
|
-
*
|
|
647
|
-
* Matches the runner: only a true 404 means "file absent". Invalid JSON and
|
|
648
|
-
* non-404 API errors fail closed (no silent package.json fallback over a bad
|
|
649
|
-
* `.seq/ci.json`).
|
|
650
|
-
*/
|
|
658
|
+
/** Load YAML or legacy JSON; only a true 404 means configuration is absent. */
|
|
651
659
|
export async function loadRemoteCiSources({ ctx, repoId, ref, }) {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
catch {
|
|
663
|
-
return { ok: false, error: 'invalid .seq/ci.json: not valid JSON' };
|
|
664
|
-
}
|
|
660
|
+
const configurations = [];
|
|
661
|
+
for (const path of ['.seq/pipeline.yml', '.seq/ci.json']) {
|
|
662
|
+
try {
|
|
663
|
+
const file = await getJsonOr404({
|
|
664
|
+
...clientOptions(ctx),
|
|
665
|
+
path: `/api/git-service/repos/${repoId}/contents/${path}?ref=${encodeURIComponent(ref)}`,
|
|
666
|
+
});
|
|
667
|
+
if (file != null)
|
|
668
|
+
configurations.push({ path, text: decodeFileContent(file) });
|
|
665
669
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
+
catch (err) {
|
|
671
|
+
if (err instanceof AtlasApiError)
|
|
672
|
+
return { ok: false, error: `failed to fetch ${path}: ${err.message}` };
|
|
673
|
+
throw err;
|
|
670
674
|
}
|
|
671
|
-
throw err;
|
|
672
675
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
676
|
+
if (configurations.length > 1)
|
|
677
|
+
return { ok: false, error: 'Both .seq/pipeline.yml and .seq/ci.json exist; remove one to make CI configuration unambiguous' };
|
|
678
|
+
const configuration = configurations[0];
|
|
679
|
+
if (configuration) {
|
|
680
|
+
try {
|
|
681
|
+
const parsed = parseCiConfigText(configuration) ?? null;
|
|
682
|
+
return configuration.path.endsWith('.yml') ? { ok: true, ciYaml: parsed } : { ok: true, ciJson: parsed };
|
|
683
|
+
}
|
|
684
|
+
catch (error) {
|
|
685
|
+
const detail = configuration.path.endsWith('.json') ? 'not valid JSON' : error instanceof Error ? error.message : 'invalid YAML';
|
|
686
|
+
return { ok: false, error: `invalid ${configuration.path}: ${detail}` };
|
|
687
|
+
}
|
|
677
688
|
}
|
|
678
689
|
let packageScripts;
|
|
679
690
|
try {
|
|
@@ -690,11 +701,7 @@ export async function loadRemoteCiSources({ ctx, repoId, ref, }) {
|
|
|
690
701
|
return { ok: false, error: 'invalid package.json: not valid JSON' };
|
|
691
702
|
}
|
|
692
703
|
if (pkg.scripts && typeof pkg.scripts === 'object') {
|
|
693
|
-
packageScripts =
|
|
694
|
-
for (const [key, value] of Object.entries(pkg.scripts)) {
|
|
695
|
-
if (typeof value === 'string')
|
|
696
|
-
packageScripts[key] = value;
|
|
697
|
-
}
|
|
704
|
+
packageScripts = Object.fromEntries(Object.entries(pkg.scripts).filter((entry) => typeof entry[1] === 'string'));
|
|
698
705
|
}
|
|
699
706
|
}
|
|
700
707
|
}
|
|
@@ -712,8 +719,17 @@ export async function loadRemoteCiSources({ ctx, repoId, ref, }) {
|
|
|
712
719
|
*/
|
|
713
720
|
export async function reposCiShowCommand(args) {
|
|
714
721
|
const { namespace, name } = parseRepoPath(args.positional[0]);
|
|
722
|
+
const pr = stringFlag(args.flags, 'pr');
|
|
723
|
+
if (pr !== undefined && (!/^[1-9]\d*$/.test(pr) || !Number.isSafeInteger(Number(pr))))
|
|
724
|
+
throw new Error('--pr requires a positive pull request number');
|
|
725
|
+
if (pr !== undefined && args.flags.ref !== undefined)
|
|
726
|
+
throw new Error('Choose --pr for the authoritative PR plan or --ref for a configuration preview');
|
|
727
|
+
if (pr === undefined && flagBool(args.flags, 'json'))
|
|
728
|
+
throw new Error('--json requires --pr for the authoritative CI status');
|
|
715
729
|
const ctx = await reposContext(args);
|
|
716
730
|
const resolved = await resolveRepo({ ...clientOptions(ctx), namespace, name });
|
|
731
|
+
if (pr !== undefined)
|
|
732
|
+
return showRepositoryPrCi({ ctx, repoId: resolved.id, repoPath: `${namespace}/${name}`, number: Number(pr), json: flagBool(args.flags, 'json') });
|
|
717
733
|
const repo = await getJson({
|
|
718
734
|
...clientOptions(ctx),
|
|
719
735
|
path: `/api/git-service/repos/${resolved.id}`,
|
|
@@ -731,6 +747,11 @@ export async function reposCiShowCommand(args) {
|
|
|
731
747
|
return 1;
|
|
732
748
|
}
|
|
733
749
|
console.log(`${LOG} CI for ${namespace}/${name}@${ref} on ${ctx.env.name}:`);
|
|
750
|
+
if (discovered.native) {
|
|
751
|
+
console.log(' Native repository pipeline discovered; the server validates and plans it when a pull request is opened or updated.');
|
|
752
|
+
console.log(` Inspect the plan with: seq-studio repos ci show ${namespace}/${name} -e ${ctx.env.name} --pr <number>`);
|
|
753
|
+
return 0;
|
|
754
|
+
}
|
|
734
755
|
if (discovered.checks.length === 0) {
|
|
735
756
|
console.log(' (no checks discovered)');
|
|
736
757
|
return 0;
|
|
@@ -745,9 +766,9 @@ export async function reposCiShowCommand(args) {
|
|
|
745
766
|
}
|
|
746
767
|
return 0;
|
|
747
768
|
}
|
|
748
|
-
const REQUIRED_CHECKS_WRITE_DISABLED = `${LOG}
|
|
749
|
-
`
|
|
750
|
-
`Use \`seq-studio repos ci show
|
|
769
|
+
const REQUIRED_CHECKS_WRITE_DISABLED = `${LOG} these legacy requiredChecks controls are disabled; legacy discovery posts neutral check-runs. ` +
|
|
770
|
+
`Use \`seq-studio repos ci init\`, commit .seq/pipeline.yml, and open or update a pull request for native CI. ` +
|
|
771
|
+
`Use \`seq-studio repos ci show <repo> -e <env> --pr <number>\` to inspect its plan.`;
|
|
751
772
|
/** Add a check-run name to Settings `requiredChecks` (merge-blocking). */
|
|
752
773
|
export async function reposCiRequireCommand(args) {
|
|
753
774
|
const check = stringFlag(args.flags, 'check');
|
|
@@ -770,12 +791,21 @@ export async function reposCiImportCommand(args) {
|
|
|
770
791
|
return 1;
|
|
771
792
|
}
|
|
772
793
|
export async function reposCiCommand(args) {
|
|
773
|
-
const [
|
|
794
|
+
const [requestedAction] = args.positional;
|
|
795
|
+
const action = flagBool(args.flags, 'help') || flagBool(args.flags, 'h') ? 'help' : requestedAction;
|
|
774
796
|
const rest = {
|
|
775
797
|
...args,
|
|
776
798
|
positional: args.positional.slice(1),
|
|
777
799
|
};
|
|
778
800
|
switch (action) {
|
|
801
|
+
case 'init': {
|
|
802
|
+
if (rest.positional.length)
|
|
803
|
+
throw new Error('usage: seq-studio repos ci init [--dir <repository>]');
|
|
804
|
+
const filename = await initializeRepositoryPipeline({ directory: stringFlag(rest.flags, 'dir') ?? process.cwd() });
|
|
805
|
+
console.log(`${LOG} Created ${filename}`);
|
|
806
|
+
console.log('Commit and push this file with your resource manifests, then open or update a pull request. Atlas discovers the pipeline and uses platform-managed CI defaults.');
|
|
807
|
+
return 0;
|
|
808
|
+
}
|
|
779
809
|
case 'show':
|
|
780
810
|
return reposCiShowCommand(rest);
|
|
781
811
|
case 'require':
|
|
@@ -785,9 +815,15 @@ export async function reposCiCommand(args) {
|
|
|
785
815
|
case 'help':
|
|
786
816
|
case undefined:
|
|
787
817
|
console.log(`usage:
|
|
788
|
-
seq-studio repos ci
|
|
789
|
-
seq-studio repos ci
|
|
790
|
-
seq-studio repos ci
|
|
818
|
+
seq-studio repos ci init [--dir <repository>] create .seq/pipeline.yml; no login needed
|
|
819
|
+
seq-studio repos ci show <ns>/<name> -e <env> --pr <number> [--json] inspect the server CI plan and runs
|
|
820
|
+
seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview pipeline discovery or legacy checks
|
|
821
|
+
seq-studio repos ci require <ns>/<name> --check <name> -e <env> disabled legacy control; use native pipeline discovery
|
|
822
|
+
seq-studio repos ci import <ns>/<name> -e <env> [--ref r] disabled legacy control; use native pipeline discovery
|
|
823
|
+
|
|
824
|
+
Commit and push .seq/pipeline.yml with your native resource manifests, then
|
|
825
|
+
open or update a pull request. Atlas selects the managed executor and image.
|
|
826
|
+
Native checks do not require a branch policy or image digest in the repository.
|
|
791
827
|
`);
|
|
792
828
|
return action ? 0 : 1;
|
|
793
829
|
default:
|
|
@@ -819,44 +855,6 @@ export async function reposDeleteCommand(args) {
|
|
|
819
855
|
// ---------------------------------------------------------------------------
|
|
820
856
|
// Router
|
|
821
857
|
// ---------------------------------------------------------------------------
|
|
822
|
-
export const REPOS_USAGE = `usage:
|
|
823
|
-
seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment
|
|
824
|
-
seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces
|
|
825
|
-
seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)
|
|
826
|
-
seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]
|
|
827
|
-
create a repo seeded with a README; --git-backend
|
|
828
|
-
walgit creates it empty (for pushing existing
|
|
829
|
-
history); needs namespace write
|
|
830
|
-
seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]
|
|
831
|
-
seq-studio repos clone --url <https://…/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]
|
|
832
|
-
seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]
|
|
833
|
-
smart-HTTP when ATLAS_GIT_PAT is set;
|
|
834
|
-
otherwise JSON materialize (<ns>/<name>)
|
|
835
|
-
seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]
|
|
836
|
-
materialize the tree at a ref (JSON API)
|
|
837
|
-
seq-studio repos pulls <list|show|create|diff|merge> [args] review requests (see pulls --help)
|
|
838
|
-
seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)
|
|
839
|
-
seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview discovered CI checks
|
|
840
|
-
seq-studio repos ci require <ns>/<name> --check <name> -e <env> reserved (refuses write until sandboxed runner)
|
|
841
|
-
seq-studio repos ci import <ns>/<name> -e <env> [--ref r] reserved (refuses write until sandboxed runner)
|
|
842
|
-
|
|
843
|
-
Flags: -e/--env <env> (required; see: seq-studio envs list)
|
|
844
|
-
|
|
845
|
-
clone prefers real git clone (PAT via askpass — never written into the remote
|
|
846
|
-
URL). --transport auto (default) uses Git when ATLAS_GIT_PAT is set and JSON
|
|
847
|
-
materialization otherwise; --transport git requires a repo:read PAT; --transport
|
|
848
|
-
json ignores ATLAS_GIT_PAT and uses the signed-in Atlas identity (<ns>/<name>
|
|
849
|
-
only; no .git directory). Authentication failures explain this retry path.
|
|
850
|
-
JSON materialization requires repo read access and prints how to create a PAT.
|
|
851
|
-
PAT without Auth0 login: use --id from Repositories → Clone
|
|
852
|
-
(or --url with the environment's canonical HTTPS origin).
|
|
853
|
-
--ref accepts a branch, tag, or commit SHA (SHA → full clone, then checkout).
|
|
854
|
-
Branch and tag clones are shallow (--depth 1). Pass --full for history.
|
|
855
|
-
--output selects the clone directory (--out remains an alias).
|
|
856
|
-
|
|
857
|
-
Authenticate JSON API calls with: seq-studio login
|
|
858
|
-
Authenticate git clone/push with: ATLAS_GIT_PAT (from Atlas Settings → Tokens)
|
|
859
|
-
`;
|
|
860
858
|
export async function runReposCommand(sub, args) {
|
|
861
859
|
try {
|
|
862
860
|
switch (sub) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Unified Sequence Studio CLI — `seq-studio init` / `add` / `deploy` (app monorepos), `seq-studio agents`, `seq-studio process` (Lattice), `seq-studio artifact`, `seq-studio functions` / `secrets`, `seq-studio repos`, and `seq-studio auth pat`. Includes Auth0 browser login shared with seqapi.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"smol-toml": "^1.9.0",
|
|
42
42
|
"tsx": "^4.20.3",
|
|
43
43
|
"zod": "^4.1.13",
|
|
44
|
-
"@sequenceholdings/lattice": "0.1.5",
|
|
45
44
|
"@sequenceholdings/agent-spec": "0.1.3",
|
|
45
|
+
"@sequenceholdings/artifact-studio": "0.6.7",
|
|
46
|
+
"@sequenceholdings/managed-functions": "0.3.5",
|
|
46
47
|
"@sequenceholdings/storage": "0.1.1",
|
|
47
|
-
"@sequenceholdings/
|
|
48
|
-
"@sequenceholdings/managed-functions": "0.3.4"
|
|
48
|
+
"@sequenceholdings/lattice": "0.1.5"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@sequenceholdings/orm": "2.5.0",
|