@sequenceholdings/studio-cli 0.5.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -6
- package/dist/artifact/delegate.js +20 -12
- package/dist/atlas-client.d.ts +2 -1
- package/dist/atlas-client.js +2 -2
- package/dist/command-help.d.ts +2 -2
- package/dist/command-help.js +10 -1
- package/dist/functions/commands.js +36 -0
- package/dist/pipeline/commands.js +20 -5
- package/dist/pipeline/lifecycle.js +37 -6
- package/dist/pipeline/source.d.ts +21 -0
- package/dist/pipeline/source.js +76 -0
- package/dist/repos/commands.js +5 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1090,6 +1090,12 @@ functions cannot opt in retroactively. The default remains mutable. See the
|
|
|
1090
1090
|
`functions deploy` picks the next `vN` after the highest numbered version of
|
|
1091
1091
|
that function. Versions named by repository CI, such as `ci-abc`, do not reset
|
|
1092
1092
|
the sequence. A function with no numbered versions starts at `v1`.
|
|
1093
|
+
While waiting for a building version, deploy, promote, and rollback print the
|
|
1094
|
+
current lifecycle stage when Atlas confirms it belongs to that version. A failed
|
|
1095
|
+
stage with recovery still running is labeled as recovery in progress; only the
|
|
1096
|
+
version's final status determines whether the command succeeds or fails. If
|
|
1097
|
+
lifecycle status is unavailable, the command continues to report version status.
|
|
1098
|
+
Use `functions logs` for sanitized readiness connection diagnostics.
|
|
1093
1099
|
|
|
1094
1100
|
Set `runtime: nodejs24` in `managed-function.yml` to use Node.js 24 on a hosted
|
|
1095
1101
|
deployment. Node.js 20 (`nodejs20`) remains the default when `runtime` is omitted.
|
|
@@ -1647,14 +1653,38 @@ writes the completed operation/deployment receipt, not a JavaScript bundle.
|
|
|
1647
1653
|
Ctrl+C stops waiting but does not cancel the remote build. Next.js does not
|
|
1648
1654
|
support `artifact dev --once`; use the hosted build command instead.
|
|
1649
1655
|
|
|
1650
|
-
Official releases fetch and verify source from
|
|
1651
|
-
|
|
1656
|
+
Official releases fetch and verify source from Git Service. By default the source
|
|
1657
|
+
and target environment are the same. Push the reviewed clean `main` revision
|
|
1658
|
+
(or `staging` when deploying to staging) before deploying:
|
|
1652
1659
|
|
|
1653
1660
|
```bash
|
|
1654
1661
|
seq-studio artifact plan --repo <namespace>/<repository> --ref main --env <environment>
|
|
1655
1662
|
seq-studio artifact deploy --repo <namespace>/<repository> --ref main --env <environment>
|
|
1656
1663
|
```
|
|
1657
1664
|
|
|
1665
|
+
To keep one canonical repository while deploying to a different environment,
|
|
1666
|
+
select the source with `--source-env`. This requires a CLI and target Atlas version
|
|
1667
|
+
with verified cross-environment build support; older targets reject the request.
|
|
1668
|
+
The source must be an environment recognized by the target's trusted registry.
|
|
1669
|
+
Log in to both environments using accounts with source repository read access
|
|
1670
|
+
and target project deployment access:
|
|
1671
|
+
|
|
1672
|
+
```bash
|
|
1673
|
+
seq-studio login -e production
|
|
1674
|
+
seq-studio login -e staging
|
|
1675
|
+
seq-studio artifact deploy --repo apps/customer-portal --source-env production \
|
|
1676
|
+
--ref staging --path web --env staging --no-create
|
|
1677
|
+
```
|
|
1678
|
+
|
|
1679
|
+
`--source-env` applies to Next.js `build`, `plan`, and `deploy`. It also accepts a
|
|
1680
|
+
clean local checkout whose Git Service origin matches the source environment.
|
|
1681
|
+
The target independently reads the immutable commit through the source's
|
|
1682
|
+
permissions checks and verifies the allowed release branch before building.
|
|
1683
|
+
The deployment records the source environment, repository, commit and directory.
|
|
1684
|
+
The source login is transient: it is never stored with the deployment or passed
|
|
1685
|
+
to build processes. Target bindings, workspace IDs and runtime permissions still
|
|
1686
|
+
belong to `--env`; selecting a source does not copy resources between environments.
|
|
1687
|
+
|
|
1658
1688
|
The Next.js `plan` command validates local source/toolchain inputs and prints the
|
|
1659
1689
|
proposed build; it does not currently perform a remote policy diff. Atlas checks
|
|
1660
1690
|
permissions, bindings and policy when the build is submitted. A local image or
|
|
@@ -1946,16 +1976,55 @@ first listed stage directory; without config it keeps using the package root.
|
|
|
1946
1976
|
| `seq-studio pipeline query <assetId> --sql <sql> -e <env> [--target <id>] [--limit <rows>] [--json]` | Run a read-only query against the virtual relation `asset`; default and maximum 1,000 result rows |
|
|
1947
1977
|
| `seq-studio pipeline init --type ingestion\|transformation\|serving <name> [--dir <dir>]` | Scaffold `<name>.stage.yml` in the first configured stage directory (or package root without config), plus a package-root-relative `src/` Databricks-notebook entrypoint stub (begins with `# Databricks notebook source`; serving stages are declarative — no stub). Refuses to overwrite an existing spec |
|
|
1948
1978
|
| `seq-studio pipeline codegen tables [--from <authoring.ts>] [--dir <dir>] [--dry-run] [--force]` | Generate one ingestion stage spec per table from a `PerTableIngestionAuthoring` TypeScript module. `--from` defaults to `authoring.tables.ts`; `--dir` defaults to the current package root and writes into its first configured stage directory (or the root without config). `--dry-run` lists output files without writing; existing files are preserved unless `--force` is supplied |
|
|
1949
|
-
| `seq-studio pipeline validate [dir] [--assets <file\|url>] [--orm-contracts <file\|url>] [--json]` | Run the full offline spec gate: envelope + body validation, `schema_ref` resolution,
|
|
1979
|
+
| `seq-studio pipeline validate [dir] [--assets <file\|url>] [--orm-contracts <file\|url>] [--json]` | Run the full offline spec gate: envelope + body validation, `schema_ref` resolution, repo-level graph validation, and optional `pipeline.yml` native workflow validation (DAG dependencies and manual stage membership). Auto-loads `orm-contracts.json` from the pipeline dir when present. Exit 0/1 |
|
|
1950
1980
|
| `seq-studio pipeline repin-orm [dir] -e <env> [--target <id>] [--dry-run]` | Resolve the environment's pipeline target (or use `--target` when ambiguous), fetch its active ORM v2 contracts, verify those serving projections remain compatible, then update `orm-contracts.json` and their `satisfies.content_hash` pins. Refuses to write when compatibility fails |
|
|
1951
|
-
| `seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha\|branch> [--root <directory>] -e <env> [--target <id>] [--json]` | Enqueue and poll a durable Pipeline plan (materialize → SDK/`validateSpecGraph` → compile → live-diff → provision findings). `<namespace>` is `pipelines`, `apps`, or your own namespace. Fails closed listing **every** missing target binding (alert channels, workspace, Databricks `source.credential`) plus Data Sync edge-worker machine/operation/`credEnvFamilies` mismatches before registry writes. Does **not** run Databricks `bundle validate` (that is a Trigger deploy-path hard gate). Exit 1 on destructive findings (CI-safe). `--json` emits the completed stable plan envelope |
|
|
1952
|
-
| `seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha\|branch> [--root <directory>] -e <env> [--target <id>] [--approved-by <sub>] [--allow-destructive <resource-key> ...] [--run-now] [--wait-timeout <duration>] [--no-wait] [--json]` | Plan then enqueue deploy; Trigger runs `bundle validate` then `bundle deploy` against reviewed bytes. `<namespace>` is `pipelines`, `apps`, or your own namespace. Default is plant-only (jobs are created, not run). `--run-now` runs in-unit producer roots after bundle deploy; serving refresh provisioning completes before producer trigger.after tasks can run. If a producer fails, the terminal status includes the remote Databricks task/event error when available. `--allow-destructive` is repeatable and must exactly name every deletion/recreation finding in the immutable plan; only authenticated `@seqholdings.com` users may authorize it; permission, ownership, schedule-drift, and provisioning blockers cannot be overridden. Polls to terminal unless `--no-wait`. Targets that require approval need `--approved-by` naming the authenticated caller. |
|
|
1981
|
+
| `seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha\|branch> [--source-env <env>] [--root <directory>] -e <env> [--target <id>] [--json]` | Enqueue and poll a durable Pipeline plan (materialize → SDK/`validateSpecGraph` → compile → live-diff → provision findings). `<namespace>` is `pipelines`, `apps`, or your own namespace. Fails closed listing **every** missing target binding (alert channels, workspace, Databricks `source.credential`) plus Data Sync edge-worker machine/operation/`credEnvFamilies` mismatches before registry writes. Does **not** run Databricks `bundle validate` (that is a Trigger deploy-path hard gate). Exit 1 on destructive findings (CI-safe). `--json` emits the completed stable plan envelope |
|
|
1982
|
+
| `seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha\|branch> [--source-env <env>] [--root <directory>] -e <env> [--target <id>] [--approved-by <sub>] [--allow-destructive <resource-key> ...] [--run-now] [--wait-timeout <duration>] [--no-wait] [--json]` | Plan then enqueue deploy; Trigger runs `bundle validate` then `bundle deploy` against reviewed bytes. `<namespace>` is `pipelines`, `apps`, or your own namespace. Default is plant-only (jobs are created, not run). `--run-now` runs in-unit producer roots after bundle deploy; serving refresh provisioning completes before producer trigger.after tasks can run. If a producer fails, the terminal status includes the remote Databricks task/event error when available. `--allow-destructive` is repeatable and must exactly name every deletion/recreation finding in the immutable plan; only authenticated `@seqholdings.com` users may authorize it; permission, ownership, schedule-drift, and provisioning blockers cannot be overridden. Polls to terminal unless `--no-wait`. Targets that require approval need `--approved-by` naming the authenticated caller. |
|
|
1953
1983
|
|
|
1954
1984
|
`--root` selects a contained Pipeline package inside the repository. The directory becomes the package and Databricks bundle root, so its `*.stage.yml`, `src/`, manifests, contracts, schemas, and extra resources keep their normal root-relative layout. Each repository/root pair is an independent release unit; sibling pipelines and unrelated app files are not included in its bundle. Omitting `--root` preserves the historical whole-repository release unit.
|
|
1955
1985
|
|
|
1956
1986
|
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.
|
|
1957
1987
|
|
|
1958
|
-
|
|
1988
|
+
For an existing pipeline release unit in the target, use
|
|
1989
|
+
`--source-env <first-party-env>` with `pipeline plan` or repository-based
|
|
1990
|
+
`pipeline deploy` to read canonical source from another environment. `-e` still
|
|
1991
|
+
selects the deployment environment, and `--target` selects its pipeline target.
|
|
1992
|
+
The CLI authenticates the two environments separately; source credentials are
|
|
1993
|
+
sent only with planning requests and are never stored in a plan or worker task.
|
|
1994
|
+
The target independently verifies source access and the selected ref, and retains
|
|
1995
|
+
an immutable source snapshot. The CLI refuses a completed plan without matching
|
|
1996
|
+
source repository, environment, release unit, and commit provenance, including
|
|
1997
|
+
responses from older target APIs that ignore source options. Failed source plans
|
|
1998
|
+
do not automatically attach stage credentials because their source is unverified;
|
|
1999
|
+
resolve missing bindings on the intended target stage explicitly and re-plan.
|
|
2000
|
+
Successful verified source plans retain normal credential reconciliation, and any
|
|
2001
|
+
re-plan must verify its source again. This increment supports only the server-owned
|
|
2002
|
+
first-party source origins (`banksouth`, `staging`, and `production`). Registered
|
|
2003
|
+
OpCo source environments are not supported yet. A local CLI environment entry or
|
|
2004
|
+
the target's own `APP_ORIGIN` does not establish trust for a remote source; the
|
|
2005
|
+
server never accepts a caller-selected source URL.
|
|
2006
|
+
First-time creation retains the existing target repository Writer requirement;
|
|
2007
|
+
creating a new release unit solely from a remote repository is not supported yet.
|
|
2008
|
+
|
|
2009
|
+
```bash
|
|
2010
|
+
seq-studio pipeline plan --repo apps/example --root pipelines/feed --ref staging --source-env banksouth -e staging --json
|
|
2011
|
+
seq-studio pipeline deploy --repo apps/example --root pipelines/feed --ref <reviewed-commit> --source-env banksouth -e staging
|
|
2012
|
+
```
|
|
2013
|
+
|
|
2014
|
+
This does not create a repository in the target or change pipeline permissions,
|
|
2015
|
+
resource ownership, bindings, target approvals, or destructive-change gates.
|
|
2016
|
+
Do not combine `--source-env` with `--dir`, existing plan/deployment IDs, or
|
|
2017
|
+
coordinated migrations. Existing IDs already identify their immutable source;
|
|
2018
|
+
execute and poll them using target authentication only. A rollback to a deployment
|
|
2019
|
+
that retained a source snapshot reuses that snapshot without source credentials.
|
|
2020
|
+
Older deployments may still depend on their original repository. To deploy a
|
|
2021
|
+
historical canonical commit when that repository is unavailable, create a fresh
|
|
2022
|
+
source-qualified plan with `deploy --ref <sha> --source-env <env>` and review its
|
|
2023
|
+
current findings; this is not an exact replay of the old plan. Promotion of
|
|
2024
|
+
snapshot-backed versions to another target is not supported yet; use the same
|
|
2025
|
+
explicit source-qualified planning workflow instead.
|
|
2026
|
+
|
|
2027
|
+
`seq-studio pipeline deploy --dir <checkout> --repo <namespace>/<slug> -e <env>` publishes a clean local checkout into that environment's git service, then deploys the published commit through the same path. It is available on targets that do not require approval (`dev`, `staging`). Targets that require approval use an existing repository commit; use `--source-env` when that repository is in another trusted environment. Log in with `seq-studio login -e <env>` before publishing; the same user authenticates API and Git requests. Do not pass `--ref` with `--dir`. When the repository is created by this command, `main` is set to the published commit so a later clone without `--ref` resolves; an existing repository's default branch is left unchanged.
|
|
1959
2028
|
| `seq-studio pipeline status --deployment-id <id> -e <env> [--json]` | Fetch the current remote deployment status without changing it. Use this public command to continue monitoring after local polling stops |
|
|
1960
2029
|
| `seq-studio pipeline adopt --stage <slug> --ref <sha\|branch> [--root <directory>] -e <env> [--target <id>] --native-id <id> --approved-by <you> [--resource-key <key>] [--kind job\|dlt_pipeline] [--old-source-removal-pr <url>] [--repo <namespace>/<slug>]` | Bind a live Databricks job/pipeline into the stage without recreation (`bundle deployment bind` on Trigger). Always requires `--approved-by` naming the caller. When the key is still in the monorepo DAB, pass `--old-source-removal-pr` and follow the returned cutover checklist: unbind the old bundle state without deleting the remote, then remove its DAB declaration and add the target-specific adopted-resource entry in the same PR before redeploying. |
|
|
1961
2030
|
| `seq-studio pipeline unbind --stage <slug> --ref <sha\|branch> [--root <directory>] -e <env> [--target <id>] --approved-by <you> [--resource-key <key>] [--repo <namespace>/<slug>]` | Release an adopted binding on Trigger; the remote object stays live (never deleted) |
|
|
@@ -18,9 +18,9 @@ import { PREVIEW_DOMAIN, PREVIEW_PROJECT, resolvePreviewByPr } from '../preview.
|
|
|
18
18
|
const ARTIFACT_USAGE = `usage:
|
|
19
19
|
seq-studio artifact init <dir> [--template react-vite|nextjs]
|
|
20
20
|
seq-studio artifact validate [dir]
|
|
21
|
-
seq-studio artifact build [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] [--out file.json]
|
|
22
|
-
seq-studio artifact plan [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] -e <env>
|
|
23
|
-
seq-studio artifact deploy [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] -e <env> [--skip-unchanged] [--no-create] [--project <id>]
|
|
21
|
+
seq-studio artifact build [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] [--source-env <env>] [--out file.json]
|
|
22
|
+
seq-studio artifact plan [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] [--source-env <env>] -e <env>
|
|
23
|
+
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>]
|
|
24
24
|
seq-studio artifact dev [dir] -e <env> [--once] [--key default] [--link <pkgDir>[,<pkgDir>]] [--port <port>]
|
|
25
25
|
seq-studio artifact pull <project-id> -e <env> --out <dir>
|
|
26
26
|
seq-studio artifact promote <deployment-id> -e <env>
|
|
@@ -44,14 +44,18 @@ const ARTIFACT_USAGE = `usage:
|
|
|
44
44
|
Interactive --repo builds clone over smart-HTTP using your seq-studio login
|
|
45
45
|
and repository read access. No PAT is needed. Headless M2M builds use JSON
|
|
46
46
|
materialize and accept only platform-managed --repo sources. Use --env to
|
|
47
|
-
select the
|
|
47
|
+
select the target environment. Next.js build/plan/deploy accept --source-env
|
|
48
|
+
to read a Git Service repository from a separately authenticated environment.
|
|
49
|
+
Log in to both environments; source read and target deploy permissions apply.
|
|
50
|
+
The target must support verified cross-environment builds. Source credentials
|
|
51
|
+
are used only to fetch source, never passed to the build or stored with it.
|
|
48
52
|
|
|
49
53
|
Next.js applications require Node.js 24 and application-local dependencies
|
|
50
54
|
(pnpm install). dev runs Next locally with native Fast Refresh through an
|
|
51
55
|
owner-only Atlas tunnel; no GCP access is required. build -e <env> requests a
|
|
52
56
|
hosted preview. Official deploys use a reviewed Git Service revision:
|
|
53
57
|
deploy --repo <namespace>/<name> --ref main -e <env>. A clean local checkout
|
|
54
|
-
with a Git Service origin on the
|
|
58
|
+
with a Git Service origin on the selected source environment also works.
|
|
55
59
|
Use pnpm build for a local production-build check. --once is static-only;
|
|
56
60
|
--port selects the local Next loopback port.
|
|
57
61
|
Deploy rejects source that still points at another environment's API origin
|
|
@@ -155,13 +159,17 @@ export async function runArtifactCommand(sub, rest) {
|
|
|
155
159
|
const targetUrl = resolved?.url ??
|
|
156
160
|
process.env['ARTIFACT_STUDIO_BASE_URL']?.trim() ??
|
|
157
161
|
(authEnvName ? routingConfig.envs[authEnvName]?.url : undefined);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
162
|
+
if (targetUrl)
|
|
163
|
+
process.env['ARTIFACT_STUDIO_BASE_URL'] = targetUrl;
|
|
164
|
+
setTokenProvider(async ({ allowInteractiveLogin, sourceEnvironment }) => {
|
|
165
|
+
const source = sourceEnvironment
|
|
166
|
+
? await resolveConfiguredEnv({ requested: sourceEnvironment })
|
|
167
|
+
: undefined;
|
|
168
|
+
const selected = { env: source?.name ?? authEnvName, targetUrl: source?.url ?? targetUrl };
|
|
169
|
+
return artifactCredential(allowInteractiveLogin
|
|
170
|
+
? await getAccessTokenWithMode(selected)
|
|
171
|
+
: await tryGetAccessTokenWithMode({ failClosedForM2m: true, ...selected }));
|
|
172
|
+
});
|
|
165
173
|
return runArtifactStudio([sub, ...argvForCli]);
|
|
166
174
|
}
|
|
167
175
|
/**
|
package/dist/atlas-client.d.ts
CHANGED
|
@@ -34,9 +34,10 @@ export declare function getJson<T>({ baseUrl, token, path, }: ClientOptions & {
|
|
|
34
34
|
export declare function getJsonOr404<T>({ baseUrl, token, path, }: ClientOptions & {
|
|
35
35
|
path: string;
|
|
36
36
|
}): Promise<T | null>;
|
|
37
|
-
export declare function postJson<T>({ baseUrl, token, path, body, }: ClientOptions & {
|
|
37
|
+
export declare function postJson<T>({ baseUrl, token, path, body, sourceAuthorization, }: ClientOptions & {
|
|
38
38
|
path: string;
|
|
39
39
|
body?: unknown;
|
|
40
|
+
sourceAuthorization?: string;
|
|
40
41
|
}): Promise<T>;
|
|
41
42
|
/**
|
|
42
43
|
* JSON POST for passthrough endpoints whose successful response is not
|
package/dist/atlas-client.js
CHANGED
|
@@ -210,14 +210,14 @@ export async function getJsonOr404({ baseUrl, token, path, }) {
|
|
|
210
210
|
throw await responseError(response, path);
|
|
211
211
|
return response.json();
|
|
212
212
|
}
|
|
213
|
-
export async function postJson({ baseUrl, token, path, body, }) {
|
|
213
|
+
export async function postJson({ baseUrl, token, path, body, sourceAuthorization, }) {
|
|
214
214
|
const response = await authenticatedFetch({
|
|
215
215
|
baseUrl,
|
|
216
216
|
token,
|
|
217
217
|
path,
|
|
218
218
|
init: {
|
|
219
219
|
method: 'POST',
|
|
220
|
-
headers: { 'Content-Type': 'application/json' },
|
|
220
|
+
headers: { 'Content-Type': 'application/json', ...(sourceAuthorization ? { 'x-sequence-source-authorization': sourceAuthorization } : {}) },
|
|
221
221
|
body: body === undefined ? undefined : JSON.stringify(body),
|
|
222
222
|
},
|
|
223
223
|
});
|
package/dist/command-help.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Help text reachable before command implementations, auth, optional SDKs, or Atlas clients load. */
|
|
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 read <namespace> <table> -e <env> [--where <column>=<op>.<value>]... [--select <cols>] [--order <col>[.desc]] [--limit N] [--offset N] [--json|--jsonl]\n seq-studio orm sql <namespace> --query <sql> | --file <path> -e <env> [--param <name>[:<type>]=<value>]... | [--params <json-object>] [--json|--jsonl]\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 read and sql query a v2 namespace as you through its built-in read-only SQL.\n sql must name tables as <namespace>.<table> (FROM lending.loans, not FROM loans).\n Run seq-studio orm read --help for the filter grammar, parameters, and output formats.\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
|
-
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
|
|
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|deploy --repo <namespace>/<slug> --ref <sha|branch>\n [--root <directory>] [--source-env <first-party-env>] -e <env> [--target <id>]\n For an existing target release unit, source-env selects a separately\n authenticated canonical repository from banksouth, staging, or production.\n Registered OpCo source origins are not supported yet. The target verifies\n and snapshots source before planning; no target repository is created.\n Not compatible with --dir, existing IDs, or coordinated migrations.\n Rollback uses retained snapshots; historical source commits can be re-planned\n explicitly with deploy --ref <sha> --source-env <env>.\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, upload, then show version and lifecycle progress\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 using your seq-studio login\n and repository read access. No PAT is needed. Headless M2M builds use JSON\n materialize and accept only platform-managed --repo sources. Use --env to\n select the same environment for source and deployment.\n";
|
|
6
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 real Git clone using seq-studio login;\n configures login for subsequent git pull/push\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|close|comment|comments|review|reviews|checks> [args]\n 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 uses your login token (never written into the remote URL or Git config).\n A repository-local credential helper reads your current login for git pull/push.\n After expiry, run seq-studio login --env <env> again.\n --transport auto (default) and git both create a real Git checkout.\n Personal access tokens are retired; ATLAS_GIT_PAT is ignored.\n --transport json downloads files without .git; requires\n <ns>/<name>. repos pull also provides this files-only workflow.\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: seq-studio login --env <env>\n";
|
|
7
7
|
export declare const PROCESS_RUNS_USAGE = "usage:\n seq-studio process runs start <process-id> -e <env> [--version <v>] [--run-id <id>]\n [--metadata-file <file.json>] [--title <text>] [--entity <type>:<id>] [--json]\n seq-studio process runs list -e <env> [--process <id>] [--status <status>]\n [--entity-type <type>] [--entity-id <id>] [--archived] [--limit 1..500] [--json]\n seq-studio process runs show <run-id> -e <env> [--wait [--timeout <seconds>]] [--json]\n seq-studio process runs cancel <run-id> -e <env> [--json]\n\n Runs start and are read as you: start needs invoker on the process, show and\n list return only runs you can view, and cancel needs invoker on the process.\n --version pins a published process version; omitted, the active version runs.\n --run-id makes start idempotent: repeating it for the same process returns the\n existing run instead of starting another. --metadata-file is a JSON object\n stored on the run.\n list returns the newest runs first, up to --limit (default 50, max 500); the run\n API has no cursor, so narrow with filters to reach older runs.\n --status: pending, running, completed, failed, cancelled, timed_out.\n show --wait polls until the run finishes (default timeout 600s); the run keeps\n going if the wait times out.\n";
|
|
8
8
|
export declare function staticHelp({ namespace, sub }: {
|
package/dist/command-help.js
CHANGED
|
@@ -48,6 +48,15 @@ export const PIPELINE_HELP = `usage:
|
|
|
48
48
|
seq-studio pipeline schema|sample <asset-id> -e <env> [--target <id>] [--limit N] [--json]
|
|
49
49
|
seq-studio pipeline query <asset-id> --sql <read-only-sql> -e <env> [--target <id>] [--limit N] [--json]
|
|
50
50
|
seq-studio pipeline init|validate|plan|deploy|status|migrate|adopt|unbind|run-now|promote|rollback ...
|
|
51
|
+
seq-studio pipeline plan|deploy --repo <namespace>/<slug> --ref <sha|branch>
|
|
52
|
+
[--root <directory>] [--source-env <first-party-env>] -e <env> [--target <id>]
|
|
53
|
+
For an existing target release unit, source-env selects a separately
|
|
54
|
+
authenticated canonical repository from banksouth, staging, or production.
|
|
55
|
+
Registered OpCo source origins are not supported yet. The target verifies
|
|
56
|
+
and snapshots source before planning; no target repository is created.
|
|
57
|
+
Not compatible with --dir, existing IDs, or coordinated migrations.
|
|
58
|
+
Rollback uses retained snapshots; historical source commits can be re-planned
|
|
59
|
+
explicitly with deploy --ref <sha> --source-env <env>.
|
|
51
60
|
seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]
|
|
52
61
|
poll an existing durable plan without enqueueing or attaching credentials
|
|
53
62
|
Lifecycle --json results use stdout; progress uses stderr. Deploy --run-now
|
|
@@ -63,7 +72,7 @@ export const FUNCTIONS_USAGE = `usage:
|
|
|
63
72
|
seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers
|
|
64
73
|
seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)
|
|
65
74
|
seq-studio functions register -e <env> [--dir d] register a function shell without deploying
|
|
66
|
-
seq-studio functions deploy -e <env> [-m msg] preflight
|
|
75
|
+
seq-studio functions deploy -e <env> [-m msg] preflight, upload, then show version and lifecycle progress
|
|
67
76
|
seq-studio functions list -e <env> [--match-local] functions visible on the environment
|
|
68
77
|
seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)
|
|
69
78
|
seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy
|
|
@@ -30,6 +30,24 @@ const execFileAsync = promisify(execFile);
|
|
|
30
30
|
export const LOG = '[seq-studio]';
|
|
31
31
|
const POLL_INTERVAL_MS = 5_000;
|
|
32
32
|
const POLL_TIMEOUT_MS = 20 * 60 * 1000;
|
|
33
|
+
const DEPLOY_PROGRESS_STAGES = new Set([
|
|
34
|
+
'prepare', 'build', 'identity', 'subnet', 'cache', 'secrets',
|
|
35
|
+
'publish', 'egress', 'readiness', 'activate', 'revoke',
|
|
36
|
+
]);
|
|
37
|
+
/** Only print known lifecycle fields for the version this poller is waiting on. */
|
|
38
|
+
function lifecycleProgress(lifecycle, versionId) {
|
|
39
|
+
if (lifecycle.desiredVersionId !== versionId || lifecycle.operation?.kind !== 'deploy')
|
|
40
|
+
return null;
|
|
41
|
+
const stage = lifecycle.stage;
|
|
42
|
+
if (!stage || !DEPLOY_PROGRESS_STAGES.has(stage))
|
|
43
|
+
return null;
|
|
44
|
+
const recovery = lifecycle.status === 'failed'
|
|
45
|
+
? lifecycle.operation.status === 'queued' || lifecycle.operation.status === 'running'
|
|
46
|
+
? ' — recovery in progress'
|
|
47
|
+
: ' — recovery stopped'
|
|
48
|
+
: '';
|
|
49
|
+
return `${LOG} lifecycle stage: ${stage}${recovery}`;
|
|
50
|
+
}
|
|
33
51
|
export function flagBool(flags, ...keys) {
|
|
34
52
|
return keys.some((key) => flags[key] === true || flags[key] === 'true');
|
|
35
53
|
}
|
|
@@ -794,6 +812,7 @@ async function deployFromResolvedSource({ args, spec, ctx: earlyCtx, source, })
|
|
|
794
812
|
export async function pollVersion({ ctx, functionId, versionId, egressNote = false, immutableRelease = false, }) {
|
|
795
813
|
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
796
814
|
let lastStatus = '';
|
|
815
|
+
let lastProgress = '';
|
|
797
816
|
for (;;) {
|
|
798
817
|
const { version } = await getJson({
|
|
799
818
|
...clientOptions(ctx),
|
|
@@ -803,6 +822,23 @@ export async function pollVersion({ ctx, functionId, versionId, egressNote = fal
|
|
|
803
822
|
lastStatus = version.status;
|
|
804
823
|
console.log(`${LOG} status: ${version.status}`);
|
|
805
824
|
}
|
|
825
|
+
if (version.status === 'building') {
|
|
826
|
+
try {
|
|
827
|
+
const lifecycle = await getJson({
|
|
828
|
+
...clientOptions(ctx),
|
|
829
|
+
path: `/api/managed-functions/${functionId}/lifecycle`,
|
|
830
|
+
});
|
|
831
|
+
const progress = lifecycleProgress(lifecycle, versionId);
|
|
832
|
+
if (progress && progress !== lastProgress) {
|
|
833
|
+
lastProgress = progress;
|
|
834
|
+
console.log(progress);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
catch {
|
|
838
|
+
// Lifecycle status may be unavailable to this caller or older Atlas.
|
|
839
|
+
// The version endpoint remains authoritative for deploy completion.
|
|
840
|
+
}
|
|
841
|
+
}
|
|
806
842
|
if (version.status === 'deployed') {
|
|
807
843
|
if (immutableRelease) {
|
|
808
844
|
const detail = await getFunctionDetail(ctx, functionId);
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* The SDK is lazy-imported like `@sequenceholdings/orm` so public installs of
|
|
12
12
|
* the CLI without the package get a clear install hint instead of a crash.
|
|
13
13
|
*/
|
|
14
|
+
import { pipelineSourceError } from './source.js';
|
|
14
15
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
15
16
|
import { existsSync } from 'node:fs';
|
|
16
17
|
import { join, resolve } from 'node:path';
|
|
@@ -35,7 +36,8 @@ ${PIPELINE_DISCOVERY_USAGE}
|
|
|
35
36
|
cycles, column subsets). --assets supplies a registry asset export for
|
|
36
37
|
cross-Pipeline references; --orm-contracts (or orm-contracts.json in dir)
|
|
37
38
|
supplies ORM synced-table contracts for serving satisfies pins. Exits 1 on
|
|
38
|
-
any error-severity finding.
|
|
39
|
+
any error-severity finding. Also validates optional pipeline.yml native
|
|
40
|
+
workflow dependencies and manual stage membership.
|
|
39
41
|
|
|
40
42
|
seq-studio pipeline repin-orm [dir] -e <env> [--target <id>] [--dry-run]
|
|
41
43
|
fetch active ORM synced-table contracts, verify serving compatibility,
|
|
@@ -52,7 +54,11 @@ ${PIPELINE_DISCOVERY_USAGE}
|
|
|
52
54
|
emit one <stage>.stage.yml per table from a typed PerTableIngestionAuthoring
|
|
53
55
|
module (default export, authoring, or silverlakeAuthoring export name)
|
|
54
56
|
|
|
55
|
-
seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha|branch> -e <env> [--target <id>] [--migration <id> [--in-place]] [--no-provision] [--json]
|
|
57
|
+
seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha|branch> [--source-env <env>] -e <env> [--target <id>] [--migration <id> [--in-place]] [--no-provision] [--json]
|
|
58
|
+
For an existing target release unit, --source-env reads a repository
|
|
59
|
+
from a separately authenticated registered
|
|
60
|
+
environment; -e still selects the target. The target verifies and snapshots
|
|
61
|
+
source bytes before queuing. Not available with --dir or migrations.
|
|
56
62
|
enqueue a durable plan, poll progress, then print the completed
|
|
57
63
|
materialize + SDK/graph + compile + live-diff + provision findings
|
|
58
64
|
(no Databricks CLI / DAB validate on Atlas); exit 1 on destructive findings
|
|
@@ -68,15 +74,16 @@ ${PIPELINE_DISCOVERY_USAGE}
|
|
|
68
74
|
credentials. Use the request id printed when planning started.
|
|
69
75
|
JSON results use stdout; enqueue/polling progress uses stderr.
|
|
70
76
|
|
|
71
|
-
seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha|branch> -e <env>
|
|
77
|
+
seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha|branch> [--source-env <env>] -e <env>
|
|
72
78
|
[--target <id>] [--approved-by <sub>]
|
|
73
79
|
[--allow-destructive <resource-key> ...]
|
|
74
80
|
[--run-now] [--wait-timeout <duration>] [--no-wait] [--no-provision] [--json]
|
|
75
81
|
seq-studio pipeline deploy --dir <checkout> --repo <namespace>/<slug> -e <env>
|
|
76
82
|
publish a clean local checkout into that environment's git service, then
|
|
77
83
|
deploy the published commit. Only targets that do not require approval
|
|
78
|
-
(dev, staging).
|
|
79
|
-
|
|
84
|
+
(dev, staging). Targets that require approval use an existing repository
|
|
85
|
+
commit; --source-env selects another trusted source environment.
|
|
86
|
+
Local publishing uses your seq-studio login (human session required).
|
|
80
87
|
plan (attaching missing credentials as for plan) then enqueue Trigger deploy (DAB bundle validate hard-gates before
|
|
81
88
|
bundle deploy). Default is plant-only: jobs/pipelines are created, not
|
|
82
89
|
run. Pass --run-now to run in-unit producer roots after bundle deploy.
|
|
@@ -361,6 +368,9 @@ export async function pipelineValidateCommand(args) {
|
|
|
361
368
|
let pipeline;
|
|
362
369
|
try {
|
|
363
370
|
pipeline = await spec.loadSpecDirectory(dir);
|
|
371
|
+
const workflow = await spec.loadPipelineWorkflow({ directory: dir });
|
|
372
|
+
if (workflow)
|
|
373
|
+
spec.validateWorkflowStages(workflow, pipeline.stages);
|
|
364
374
|
}
|
|
365
375
|
catch (error) {
|
|
366
376
|
if (error instanceof spec.SpecDefinitionError) {
|
|
@@ -431,6 +441,11 @@ export async function pipelineValidateCommand(args) {
|
|
|
431
441
|
});
|
|
432
442
|
}
|
|
433
443
|
export async function runPipelineCommand(sub, args) {
|
|
444
|
+
const sourceError = pipelineSourceError(sub ?? '', args.flags);
|
|
445
|
+
if (sourceError) {
|
|
446
|
+
console.error(`${LOG} ${sourceError}`);
|
|
447
|
+
return 1;
|
|
448
|
+
}
|
|
434
449
|
switch (sub) {
|
|
435
450
|
case 'list':
|
|
436
451
|
case 'assets':
|
|
@@ -8,6 +8,7 @@ import { resolveConfiguredEnv } from '../config.js';
|
|
|
8
8
|
import { parseDurationMs } from '@sequenceholdings/lattice';
|
|
9
9
|
import { assertCloneDeployAllowed, publishCloneForDeploy } from './clone-deploy.js';
|
|
10
10
|
import { printReconcileResult, reconcileStageCredentials } from './stage-secrets.js';
|
|
11
|
+
import { assertPipelineSourcePlan, pipelineSourceError, resolvePipelineSource } from './source.js';
|
|
11
12
|
const LOG = '[seq-studio]';
|
|
12
13
|
function rootOption(root) {
|
|
13
14
|
return root ? { root } : {};
|
|
@@ -129,6 +130,11 @@ export async function resolvePipelineTarget({ args, env, token, }) {
|
|
|
129
130
|
'Pass --target <id> explicitly.');
|
|
130
131
|
}
|
|
131
132
|
export async function pipelinePlanCommand(args) {
|
|
133
|
+
const sourceError = pipelineSourceError('plan', args.flags);
|
|
134
|
+
if (sourceError) {
|
|
135
|
+
console.error(`${LOG} ${sourceError}`);
|
|
136
|
+
return 1;
|
|
137
|
+
}
|
|
132
138
|
const repo = flagString(args.flags, 'repo');
|
|
133
139
|
const ref = flagString(args.flags, 'ref');
|
|
134
140
|
const planRequestId = flagString(args.flags, 'plan-request-id');
|
|
@@ -144,7 +150,7 @@ export async function pipelinePlanCommand(args) {
|
|
|
144
150
|
return 1;
|
|
145
151
|
}
|
|
146
152
|
if (!planRequestId && (!repo || !ref)) {
|
|
147
|
-
console.error('usage: seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha|branch> [--root <directory>] -e <env> [--migration <id> [--in-place]] [--json]\n seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]');
|
|
153
|
+
console.error('usage: seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha|branch> [--source-env <env>] [--root <directory>] -e <env> [--migration <id> [--in-place]] [--json]\n seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]');
|
|
148
154
|
return 1;
|
|
149
155
|
}
|
|
150
156
|
const { env, token } = await envAndToken(args);
|
|
@@ -164,6 +170,7 @@ export async function pipelinePlanCommand(args) {
|
|
|
164
170
|
response = await planAttachingCredentials({
|
|
165
171
|
request: {
|
|
166
172
|
baseUrl: env.url, token, repo, ref,
|
|
173
|
+
...await resolvePipelineSource({ sourceEnvironment: flagString(args.flags, 'source-env'), repo }),
|
|
167
174
|
...rootOption(root),
|
|
168
175
|
environment: target.id,
|
|
169
176
|
...(migrationId ? { migrationId } : {}),
|
|
@@ -196,6 +203,11 @@ function planResultExitCode({ response, inPlace, migrationId, }) {
|
|
|
196
203
|
return response.plan.hasDestructive || response.plan.migrationAssessment?.contracts.findings.some((finding) => finding.severity === 'error') ? 1 : 0;
|
|
197
204
|
}
|
|
198
205
|
export async function pipelineDeployCommand(args) {
|
|
206
|
+
const sourceError = pipelineSourceError('deploy', args.flags);
|
|
207
|
+
if (sourceError) {
|
|
208
|
+
console.error(`${LOG} ${sourceError}`);
|
|
209
|
+
return 1;
|
|
210
|
+
}
|
|
199
211
|
if (args.flags.migration !== undefined || args.flags['in-place'] !== undefined) {
|
|
200
212
|
console.error(`${LOG} --migration and --in-place belong to pipeline plan; a migration cannot be applied as an ordinary deployment`);
|
|
201
213
|
return 1;
|
|
@@ -266,13 +278,15 @@ export async function pipelineDeployCommand(args) {
|
|
|
266
278
|
}
|
|
267
279
|
}
|
|
268
280
|
if (!repo || !sourceRef) {
|
|
269
|
-
console.error('usage: seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha|branch> [--root <directory>] -e <env> [--target <id>] [--approved-by <sub>] [--allow-destructive <resource-key> ...] [--run-now] [--wait-timeout <duration>] [--no-wait]\n' +
|
|
281
|
+
console.error('usage: seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha|branch> [--source-env <env>] [--root <directory>] -e <env> [--target <id>] [--approved-by <sub>] [--allow-destructive <resource-key> ...] [--run-now] [--wait-timeout <duration>] [--no-wait]\n' +
|
|
270
282
|
' seq-studio pipeline deploy --dir <checkout> --repo <namespace>/<slug> -e <env>');
|
|
271
283
|
return 1;
|
|
272
284
|
}
|
|
273
285
|
// Plan then deploy the first planning deployment.
|
|
274
286
|
const plan = await planAttachingCredentials({
|
|
275
|
-
request: { baseUrl: env.url, token, repo, ref: sourceRef, environment: target.id, ...rootOption(root)
|
|
287
|
+
request: { baseUrl: env.url, token, repo, ref: sourceRef, environment: target.id, ...rootOption(root),
|
|
288
|
+
...await resolvePipelineSource({ sourceEnvironment: flagString(args.flags, 'source-env'), repo }),
|
|
289
|
+
},
|
|
276
290
|
provision: !flagOn(args.flags, 'no-provision'),
|
|
277
291
|
});
|
|
278
292
|
if (plan.plan.hasDestructive && allowDestructiveResourceKeys.length === 0) {
|
|
@@ -360,6 +374,11 @@ export async function pipelineStatusCommand(args) {
|
|
|
360
374
|
}
|
|
361
375
|
}
|
|
362
376
|
export async function pipelinePromoteCommand(args) {
|
|
377
|
+
const sourceError = pipelineSourceError('promote', args.flags);
|
|
378
|
+
if (sourceError) {
|
|
379
|
+
console.error(`${LOG} ${sourceError}`);
|
|
380
|
+
return 1;
|
|
381
|
+
}
|
|
363
382
|
const stage = flagString(args.flags, 'stage');
|
|
364
383
|
const version = flagString(args.flags, 'version');
|
|
365
384
|
const repo = flagString(args.flags, 'repo');
|
|
@@ -480,6 +499,11 @@ export async function pipelineRunNowCommand(args) {
|
|
|
480
499
|
return 0;
|
|
481
500
|
}
|
|
482
501
|
export async function pipelineRollbackCommand(args) {
|
|
502
|
+
const sourceError = pipelineSourceError('rollback', args.flags);
|
|
503
|
+
if (sourceError) {
|
|
504
|
+
console.error(`${LOG} ${sourceError}`);
|
|
505
|
+
return 1;
|
|
506
|
+
}
|
|
483
507
|
const stage = flagString(args.flags, 'stage');
|
|
484
508
|
const repo = flagString(args.flags, 'repo');
|
|
485
509
|
const approvedBy = flagString(args.flags, 'approved-by');
|
|
@@ -606,7 +630,9 @@ async function planAttachingCredentials({ request, provision, }) {
|
|
|
606
630
|
response = await enqueueAndWaitForPlan(request);
|
|
607
631
|
}
|
|
608
632
|
catch (error) {
|
|
609
|
-
|
|
633
|
+
// Failed plans expose stage IDs without a source receipt. A legacy target may
|
|
634
|
+
// have ignored --source-env, so those IDs cannot authorize secret attachment.
|
|
635
|
+
if (request.sourceEnvironment || !provision || !(error instanceof PlanRequestFailedError))
|
|
610
636
|
throw error;
|
|
611
637
|
if (!(await attachUnattachedCredentials({ request, stageIds: error.stageIds })))
|
|
612
638
|
throw error;
|
|
@@ -662,12 +688,13 @@ class PlanRequestFailedError extends Error {
|
|
|
662
688
|
this.stageIds = stageIds;
|
|
663
689
|
}
|
|
664
690
|
}
|
|
665
|
-
async function enqueueAndWaitForPlan({ baseUrl, token, repo, ref, root, environment, migrationId, executionMode, }) {
|
|
691
|
+
async function enqueueAndWaitForPlan({ baseUrl, token, repo, ref, root, environment, migrationId, executionMode, sourceEnvironment, sourceRepositoryId, sourceAuthorization, }) {
|
|
666
692
|
const enqueue = await postJson({
|
|
667
693
|
baseUrl,
|
|
668
694
|
token,
|
|
669
695
|
path: '/api/data-pipelines/pipelines/plan',
|
|
670
|
-
|
|
696
|
+
...(sourceAuthorization ? { sourceAuthorization } : {}),
|
|
697
|
+
body: { repo, ref, environment, ...(sourceEnvironment ? { sourceEnvironment, sourceRepositoryId } : {}), ...rootOption(root), ...(migrationId ? { migration_id: migrationId } : {}), ...(executionMode ? { execution_mode: executionMode } : {}) },
|
|
671
698
|
});
|
|
672
699
|
console.error(`${LOG} enqueued plan ${enqueue.planRequestId} (trigger=${enqueue.triggerRunId ?? 'n/a'})`);
|
|
673
700
|
const detail = await waitForPlanRequest({
|
|
@@ -675,6 +702,10 @@ async function enqueueAndWaitForPlan({ baseUrl, token, repo, ref, root, environm
|
|
|
675
702
|
token,
|
|
676
703
|
planRequestId: enqueue.planRequestId,
|
|
677
704
|
});
|
|
705
|
+
assertPipelineSourcePlan({
|
|
706
|
+
plan: detail.plan,
|
|
707
|
+
request: { repo, ref, root, environment, sourceEnvironment, sourceRepositoryId },
|
|
708
|
+
});
|
|
678
709
|
return completedPlanResponse(detail);
|
|
679
710
|
}
|
|
680
711
|
function completedPlanResponse(detail) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Request-local only: never serialize sourceAuthorization into plan or deployment JSON. */
|
|
2
|
+
export interface PipelineSource {
|
|
3
|
+
sourceEnvironment?: string;
|
|
4
|
+
sourceRepositoryId?: string;
|
|
5
|
+
sourceAuthorization?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function pipelineSourceError(verb: string, flags: Record<string, string | true>): string | null;
|
|
8
|
+
export declare function resolvePipelineSource({ sourceEnvironment, repo }: {
|
|
9
|
+
sourceEnvironment?: string;
|
|
10
|
+
repo: string;
|
|
11
|
+
}): Promise<PipelineSource>;
|
|
12
|
+
/** Older target APIs can silently strip source fields. Never use their local plan. */
|
|
13
|
+
export declare function assertPipelineSourcePlan({ plan, request }: {
|
|
14
|
+
plan: unknown;
|
|
15
|
+
request: PipelineSource & {
|
|
16
|
+
repo: string;
|
|
17
|
+
root?: string;
|
|
18
|
+
ref: string;
|
|
19
|
+
environment: string;
|
|
20
|
+
};
|
|
21
|
+
}): void;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { resolveRepo } from '@sequenceholdings/artifact-studio/git-service-client';
|
|
3
|
+
import { getAccessToken } from '../auth.js';
|
|
4
|
+
import { resolveConfiguredEnv } from '../config.js';
|
|
5
|
+
export function pipelineSourceError(verb, flags) {
|
|
6
|
+
const source = flags['source-env'];
|
|
7
|
+
if (source === undefined)
|
|
8
|
+
return null;
|
|
9
|
+
if (typeof source !== 'string' || !source.trim())
|
|
10
|
+
return '--source-env requires a supported first-party environment name';
|
|
11
|
+
if (verb !== 'plan' && verb !== 'deploy') {
|
|
12
|
+
return '--source-env is supported only for a new plan or deploy; rollback uses retained source. To re-plan a historical source commit, use deploy --ref <sha> --source-env <env>';
|
|
13
|
+
}
|
|
14
|
+
if (['dir', 'deployment-id', 'plan-request-id', 'migration', 'in-place'].some((flag) => flags[flag] !== undefined)) {
|
|
15
|
+
return '--source-env cannot be combined with --dir, existing plan/deployment IDs, or coordinated migrations';
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
export async function resolvePipelineSource({ sourceEnvironment, repo }) {
|
|
20
|
+
if (!sourceEnvironment)
|
|
21
|
+
return {};
|
|
22
|
+
const match = /^([a-z][a-z0-9-]*)\/([a-z][a-z0-9-]*)(?:@(.+))?$/.exec(repo);
|
|
23
|
+
if (!match)
|
|
24
|
+
throw new Error('--repo must be <namespace>/<name>[@<root>] for --source-env');
|
|
25
|
+
const root = match[3]?.replaceAll('\\', '/');
|
|
26
|
+
if (root && root !== '.' && !root.split('/').every(part => /^[A-Za-z0-9._-]+$/.test(part) && part !== '.' && part !== '..')) {
|
|
27
|
+
throw new Error('--repo root must be a contained relative directory');
|
|
28
|
+
}
|
|
29
|
+
const source = await resolveConfiguredEnv({ requested: sourceEnvironment });
|
|
30
|
+
const token = await getAccessToken({ env: source.name, targetUrl: source.url });
|
|
31
|
+
const repository = await resolveRepo({ baseUrl: source.url, token, namespace: match[1], name: match[2] });
|
|
32
|
+
// The target independently checks its trusted origin registry and source read access,
|
|
33
|
+
// resolves the supplied ref, and stores verified bytes before queuing work.
|
|
34
|
+
return { sourceEnvironment: source.name, sourceRepositoryId: repository.id, sourceAuthorization: `Bearer ${token}` };
|
|
35
|
+
}
|
|
36
|
+
const sourcePlanSchema = z.object({
|
|
37
|
+
repo: z.string(),
|
|
38
|
+
ref: z.string(),
|
|
39
|
+
commit: z.string().regex(/^[a-f0-9]{40}$/),
|
|
40
|
+
environment: z.string(),
|
|
41
|
+
sourceSnapshot: z.object({
|
|
42
|
+
version: z.literal(1),
|
|
43
|
+
repo: z.string(),
|
|
44
|
+
sourceEnvironment: z.string(),
|
|
45
|
+
sourceRepositoryId: z.string(),
|
|
46
|
+
commit: z.string().regex(/^[a-f0-9]{40}$/),
|
|
47
|
+
digest: z.string().regex(/^[a-f0-9]{64}$/),
|
|
48
|
+
bytes: z.number().int().positive(),
|
|
49
|
+
fileCount: z.number().int().nonnegative(),
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
/** Older target APIs can silently strip source fields. Never use their local plan. */
|
|
53
|
+
export function assertPipelineSourcePlan({ plan, request }) {
|
|
54
|
+
if (!request.sourceEnvironment)
|
|
55
|
+
return;
|
|
56
|
+
const parsed = sourcePlanSchema.safeParse(plan);
|
|
57
|
+
const [baseRepo, embeddedRoot] = request.repo.split('@');
|
|
58
|
+
const root = (embeddedRoot ?? request.root)?.replaceAll('\\', '/');
|
|
59
|
+
const repo = root && root !== '.' ? `${baseRepo}@${root}` : baseRepo;
|
|
60
|
+
if (parsed.success) {
|
|
61
|
+
const receipt = parsed.data.sourceSnapshot;
|
|
62
|
+
if (receipt.sourceEnvironment === request.sourceEnvironment
|
|
63
|
+
&& receipt.sourceRepositoryId === request.sourceRepositoryId
|
|
64
|
+
&& receipt.repo === repo
|
|
65
|
+
&& parsed.data.repo === repo
|
|
66
|
+
&& parsed.data.environment === request.environment
|
|
67
|
+
&& parsed.data.ref === request.ref
|
|
68
|
+
&& receipt.commit === parsed.data.commit
|
|
69
|
+
&& (!/^[a-f0-9]{40}$/i.test(request.ref) || receipt.commit === request.ref.toLowerCase())) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
throw new Error('The target returned no matching source snapshot for the requested pipeline source. ' +
|
|
74
|
+
'Refusing credential attachment or deployment. Verify the target supports --source-env ' +
|
|
75
|
+
'and retry planning after its API and source workers are fully rolled out.');
|
|
76
|
+
}
|
package/dist/repos/commands.js
CHANGED
|
@@ -27,6 +27,7 @@ import { confirmYes } from '../prompt.js';
|
|
|
27
27
|
import { buildContext, clientOptions, flagBool, LOG, } from '../functions/commands.js';
|
|
28
28
|
import { looksLikeCommitSha, runGitClone, } from './git-clone.js';
|
|
29
29
|
import { configureGitLogin } from './git-credential.js';
|
|
30
|
+
import { isSandboxTokenMode } from '../sandbox-auth.js';
|
|
30
31
|
const PAGE_SIZE = 200;
|
|
31
32
|
// ---------------------------------------------------------------------------
|
|
32
33
|
// Helpers
|
|
@@ -415,7 +416,10 @@ export async function reposCloneCommand(args, deps = {}) {
|
|
|
415
416
|
console.log(`${LOG} cloned ${positional ?? targetUrl} → ${destDir}` +
|
|
416
417
|
(ref ? ` (ref ${ref})` : '') +
|
|
417
418
|
` via smart-HTTP${depth != null ? ` (depth ${depth})` : ''}`);
|
|
418
|
-
console.log(
|
|
419
|
+
console.log(isSandboxTokenMode()
|
|
420
|
+
// The sandbox's token file is rewritten before every tool call; there is no login.
|
|
421
|
+
? `${LOG} git pull/push now use this agent sandbox's Atlas credential, which renews on every tool call.`
|
|
422
|
+
: `${LOG} git pull/push now use your seq-studio login. After expiry: seq-studio login --env ${env.name}`);
|
|
419
423
|
return 0;
|
|
420
424
|
}
|
|
421
425
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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 whoami`. Includes Auth0 browser login shared with seqapi.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"zod": "^4.1.13",
|
|
44
44
|
"yaml": "^2.8.4",
|
|
45
45
|
"@sequenceholdings/agent-spec": "0.1.4",
|
|
46
|
-
"@sequenceholdings/artifact-studio": "0.
|
|
46
|
+
"@sequenceholdings/artifact-studio": "0.9.0",
|
|
47
47
|
"@sequenceholdings/lattice": "0.1.6",
|
|
48
48
|
"@sequenceholdings/managed-functions": "0.4.2",
|
|
49
49
|
"@sequenceholdings/storage": "0.1.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@sequenceholdings/
|
|
53
|
-
"@sequenceholdings/
|
|
52
|
+
"@sequenceholdings/pipeline-spec": "0.2.6",
|
|
53
|
+
"@sequenceholdings/orm": "2.6.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {
|
|
56
56
|
"@sequenceholdings/orm": {
|