@sequenceholdings/studio-cli 0.9.3 → 0.9.6
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 +74 -10
- package/dist/access/custom-role-hosts.js +0 -6
- package/dist/agents/source.js +4 -4
- package/dist/app/agent-refs.js +1 -1
- package/dist/app/manifest.d.ts +1 -1
- package/dist/app/manifest.js +1 -1
- package/dist/argv.js +2 -2
- package/dist/artifact/delegate.js +6 -1
- package/dist/command-contract.d.ts +1 -1
- package/dist/command-contract.js +1 -1
- package/dist/command-help.d.ts +4 -5
- package/dist/command-help.js +7 -36
- package/dist/functions/manifest.d.ts +4 -0
- package/dist/main.js +2 -2
- package/dist/orm/delegate.js +1 -0
- package/dist/orm/discover-operations.d.ts +19 -0
- package/dist/orm/discover-operations.js +60 -0
- package/dist/orm/discover-schema.d.ts +5 -0
- package/dist/orm/discover-schema.js +5 -1
- package/dist/orm/discover.js +12 -38
- package/dist/orm/execute.js +6 -1
- package/dist/pipeline/clone-deploy.js +2 -2
- package/dist/pipeline/commands.d.ts +1 -0
- package/dist/pipeline/commands.js +15 -11
- package/dist/pipeline/help.d.ts +2 -0
- package/dist/pipeline/help.js +45 -0
- package/dist/pipeline/lifecycle.js +5 -6
- package/dist/pipeline/retirement.js +8 -3
- package/dist/pipeline/stage-secrets.d.ts +2 -2
- package/dist/pipeline/stage-secrets.js +1 -1
- package/dist/process/agent-loader.d.ts +1 -2
- package/dist/process/agent-loader.js +1 -2
- package/dist/process/build.js +3 -3
- package/dist/process/commands.js +2 -3
- package/dist/process/discover.js +1 -1
- package/dist/process/lint.js +5 -7
- package/dist/process/plan-diff.js +1 -1
- package/dist/process/safety-baseline.d.ts +1 -1
- package/dist/process/safety-baseline.js +5 -5
- package/dist/repos/commands.d.ts +1 -0
- package/dist/secrets/commands.js +2 -19
- package/package.json +9 -9
package/dist/orm/discover.js
CHANGED
|
@@ -8,15 +8,14 @@
|
|
|
8
8
|
* `describe` joins the active version's compiled schema with its active
|
|
9
9
|
* persisted-operation set.
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { getJson } from '../atlas-client.js';
|
|
12
12
|
import { printCliError } from '../cli-errors.js';
|
|
13
13
|
import { validateCommandInput } from '../command-input.js';
|
|
14
14
|
import { buildContext, clientOptions } from '../functions/commands.js';
|
|
15
15
|
import { table } from '../text-table.js';
|
|
16
|
-
import { namespaceListSchema,
|
|
16
|
+
import { namespaceListSchema, parseResponse, schemaViewSchema, } from './discover-schema.js';
|
|
17
17
|
import { variablesLabel } from './execute.js';
|
|
18
|
-
|
|
19
|
-
const OPERATIONS_PAGE_SIZE = 500;
|
|
18
|
+
import { getNamespaceJson, listAllOperations } from './discover-operations.js';
|
|
20
19
|
const DESCRIPTION_WIDTH = 60;
|
|
21
20
|
function pageFlag({ args, key, min }) {
|
|
22
21
|
const raw = args.flags[key];
|
|
@@ -89,37 +88,6 @@ export async function ormNamespacesCommand(args) {
|
|
|
89
88
|
return 1;
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
|
-
async function getNamespaceJson({ options, namespace, path }) {
|
|
93
|
-
try {
|
|
94
|
-
return await getJson({ ...options, path });
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
// Missing and unreadable are deliberately indistinguishable on the server.
|
|
98
|
-
if (error instanceof AtlasApiError && error.status === 404) {
|
|
99
|
-
throw new Error(`Namespace '${namespace}' was not found, has no applied version, or you cannot read it. ` +
|
|
100
|
-
'List the namespaces you can read: seq-studio orm namespaces');
|
|
101
|
-
}
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async function listAllOperations({ options, namespace }) {
|
|
106
|
-
const operations = [];
|
|
107
|
-
for (;;) {
|
|
108
|
-
const query = new URLSearchParams({ limit: String(OPERATIONS_PAGE_SIZE), offset: String(operations.length) });
|
|
109
|
-
const page = parseResponse({
|
|
110
|
-
schema: operationsPageSchema,
|
|
111
|
-
body: await getNamespaceJson({
|
|
112
|
-
options,
|
|
113
|
-
namespace,
|
|
114
|
-
path: `/api/orm/namespaces/${encodeURIComponent(namespace)}/operations?${query.toString()}`,
|
|
115
|
-
}),
|
|
116
|
-
what: 'operations',
|
|
117
|
-
});
|
|
118
|
-
operations.push(...page.operations);
|
|
119
|
-
if (page.operations.length === 0 || operations.length >= page.total)
|
|
120
|
-
return operations;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
91
|
function findRelation({ schema, name }) {
|
|
124
92
|
const found = schema.tables.find((relation) => relation.table === name);
|
|
125
93
|
if (found)
|
|
@@ -248,14 +216,19 @@ export async function ormDescribeCommand(args) {
|
|
|
248
216
|
}
|
|
249
217
|
const options = clientOptions(await buildContext(args));
|
|
250
218
|
const encoded = encodeURIComponent(namespace);
|
|
251
|
-
const [schemaBody,
|
|
219
|
+
const [schemaBody, listing] = await Promise.all([
|
|
252
220
|
getNamespaceJson({ options, namespace: namespace, path: `/api/orm/namespaces/${encoded}/schema` }),
|
|
253
221
|
listAllOperations({ options, namespace: namespace }),
|
|
254
222
|
]);
|
|
255
223
|
const schema = parseResponse({ schema: schemaViewSchema, body: schemaBody, what: 'schema' });
|
|
224
|
+
if (schema.namespace !== namespace ||
|
|
225
|
+
(listing.schema_version_id != null && listing.schema_version_id !== schema.version_id)) {
|
|
226
|
+
throw new Error(`The active schema or operation set changed while reading '${namespace}'. Retry orm describe ${namespace}.`);
|
|
227
|
+
}
|
|
228
|
+
const { operations, ...identity } = listing;
|
|
256
229
|
if (onlyOperations) {
|
|
257
230
|
if (args.flags.json === true) {
|
|
258
|
-
console.log(JSON.stringify({ namespace: schema.namespace, version_id: schema.version_id, operations }, null, 2));
|
|
231
|
+
console.log(JSON.stringify({ namespace: schema.namespace, version_id: schema.version_id, ...identity, operations }, null, 2));
|
|
259
232
|
}
|
|
260
233
|
else {
|
|
261
234
|
console.log(`${schema.namespace} ${formatLabel(schema.definition_format)} version ${schema.version_id}`);
|
|
@@ -268,7 +241,7 @@ export async function ormDescribeCommand(args) {
|
|
|
268
241
|
// The generated GraphQL SDL is large and restates the tables; leave it out.
|
|
269
242
|
const { sdl: _sdl, ...described } = schema;
|
|
270
243
|
if (args.flags.json === true)
|
|
271
|
-
console.log(JSON.stringify({ ...described, operations }, null, 2));
|
|
244
|
+
console.log(JSON.stringify({ ...described, ...identity, operations }, null, 2));
|
|
272
245
|
else {
|
|
273
246
|
printNamespace({ schema, operations });
|
|
274
247
|
console.error(`Describe a table: seq-studio orm describe ${schema.namespace} <table>`);
|
|
@@ -289,6 +262,7 @@ export async function ormDescribeCommand(args) {
|
|
|
289
262
|
namespace: schema.namespace,
|
|
290
263
|
definition_format: schema.definition_format,
|
|
291
264
|
version_id: schema.version_id,
|
|
265
|
+
...identity,
|
|
292
266
|
kind: found.kind,
|
|
293
267
|
[found.kind]: found.relation,
|
|
294
268
|
enums: schema.enums.filter((declared) => found.relation.columns.some((column) => column.enum_name === declared.name)),
|
package/dist/orm/execute.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { readFile, stat } from 'node:fs/promises';
|
|
13
13
|
import { resolve } from 'node:path';
|
|
14
|
+
import { text } from 'node:stream/consumers';
|
|
14
15
|
import { getJsonOr404, postJsonResponse } from '../atlas-client.js';
|
|
15
16
|
import { printCliError } from '../cli-errors.js';
|
|
16
17
|
import { validateCommandInput } from '../command-input.js';
|
|
@@ -104,7 +105,11 @@ async function readVariablesFile(args) {
|
|
|
104
105
|
return {};
|
|
105
106
|
let parsed;
|
|
106
107
|
try {
|
|
107
|
-
|
|
108
|
+
// Reopening a nonblocking stdin pipe with readFile can fail with EAGAIN.
|
|
109
|
+
const contents = file === '-' || file === '/dev/stdin'
|
|
110
|
+
? await text(process.stdin)
|
|
111
|
+
: await readFile(resolve(file), 'utf8');
|
|
112
|
+
parsed = JSON.parse(contents);
|
|
108
113
|
}
|
|
109
114
|
catch (error) {
|
|
110
115
|
throw new Error(`Could not read JSON variables from ${file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* materializes source from the target environment's git service, so a laptop
|
|
5
5
|
* directory cannot be the deploy source by itself.
|
|
6
6
|
*
|
|
7
|
-
* Clone publish is limited to targets that do not require approval
|
|
8
|
-
*
|
|
7
|
+
* Clone publish is limited to targets that do not require approval;
|
|
8
|
+
* approval-gated targets keep deploying commits that already live in that
|
|
9
9
|
* environment's git service.
|
|
10
10
|
*/
|
|
11
11
|
import { spawn } from 'node:child_process';
|
|
@@ -19,6 +19,7 @@ export declare const ORM_CONTRACTS_FILENAME = "orm-contracts.json";
|
|
|
19
19
|
* itself absent (installable) or did one of its dependencies fail to load?
|
|
20
20
|
*/
|
|
21
21
|
export declare function isPipelineSpecMissing(message: string): boolean;
|
|
22
|
+
export declare function pipelineSpecLoadErrorMessage(message: string): string;
|
|
22
23
|
export declare function pipelineInitCommand(args: ParsedArgs): Promise<number>;
|
|
23
24
|
interface ValidateReportFinding {
|
|
24
25
|
readonly severity: 'error' | 'warning';
|
|
@@ -38,14 +38,17 @@ ${PIPELINE_DISCOVERY_USAGE}
|
|
|
38
38
|
supplies ORM synced-table contracts for serving satisfies pins. Exits 1 on
|
|
39
39
|
any error-severity finding. Also validates optional pipeline.yml native
|
|
40
40
|
workflow dependencies and manual stage membership.
|
|
41
|
+
From the pipeline tooling/app directory, install both CLI and spec:
|
|
42
|
+
pnpm add --save-dev @sequenceholdings/studio-cli @sequenceholdings/pipeline-spec
|
|
43
|
+
pnpm exec seq-studio pipeline validate .
|
|
41
44
|
|
|
42
45
|
seq-studio pipeline repin-orm [dir] -e <env> [--target <id>] [--dry-run]
|
|
43
46
|
fetch active ORM synced-table contracts, verify serving compatibility,
|
|
44
47
|
then update orm-contracts.json and every matching satisfies.content_hash;
|
|
45
48
|
target is inferred when the environment exposes exactly one
|
|
46
49
|
|
|
47
|
-
seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--json]
|
|
48
|
-
preview whole
|
|
50
|
+
seq-studio pipeline retire --repo <release-unit> -e <env> [--stages <slugs>] [--target <id>] [--json]
|
|
51
|
+
preview retirement of the whole pipeline or selected omitted stages; retain data and history
|
|
49
52
|
approve the exact inventory with --plan-hash <hash> --yes
|
|
50
53
|
inspect with --retirement-id <id>; resume a stopped operation with
|
|
51
54
|
--retirement-id <id> --resume --yes (never creates a replacement plan)
|
|
@@ -155,6 +158,15 @@ export function isPipelineSpecMissing(message) {
|
|
|
155
158
|
const specifier = message.match(/Cannot find (?:package|module) '([^']+)'/)?.[1];
|
|
156
159
|
return specifier === '@sequenceholdings/pipeline-spec' || (specifier?.startsWith('@sequenceholdings/pipeline-spec/') ?? false);
|
|
157
160
|
}
|
|
161
|
+
export function pipelineSpecLoadErrorMessage(message) {
|
|
162
|
+
if (isPipelineSpecMissing(message)) {
|
|
163
|
+
return ('seq-studio pipeline needs the @sequenceholdings/pipeline-spec package. From your pipeline tooling/app directory, install both packages and run the local CLI:\n' +
|
|
164
|
+
' pnpm add --save-dev @sequenceholdings/studio-cli @sequenceholdings/pipeline-spec\n' +
|
|
165
|
+
' pnpm exec seq-studio pipeline validate .');
|
|
166
|
+
}
|
|
167
|
+
return ('@sequenceholdings/pipeline-spec is installed but a dependency failed to load. Reinstall dependencies, then retry.\n' +
|
|
168
|
+
` ${message}`);
|
|
169
|
+
}
|
|
158
170
|
async function importPipelineSpec() {
|
|
159
171
|
try {
|
|
160
172
|
return await import('@sequenceholdings/pipeline-spec');
|
|
@@ -162,15 +174,7 @@ async function importPipelineSpec() {
|
|
|
162
174
|
catch (err) {
|
|
163
175
|
if (err.code === 'ERR_MODULE_NOT_FOUND') {
|
|
164
176
|
const message = err instanceof Error ? err.message : String(err);
|
|
165
|
-
|
|
166
|
-
console.error('seq-studio pipeline needs the @sequenceholdings/pipeline-spec package. Add it to your app, then run the app\'s CLI:\n' +
|
|
167
|
-
' pnpm add -D @sequenceholdings/pipeline-spec\n' +
|
|
168
|
-
' pnpm exec seq-studio pipeline …');
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
console.error('@sequenceholdings/pipeline-spec is installed but a dependency failed to load. Reinstall dependencies, then retry.\n' +
|
|
172
|
-
` ${message}`);
|
|
173
|
-
}
|
|
177
|
+
console.error(pipelineSpecLoadErrorMessage(message));
|
|
174
178
|
return null;
|
|
175
179
|
}
|
|
176
180
|
throw err;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Offline help: keep this module free of authentication and runtime SDK imports. */
|
|
2
|
+
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 For local validation, run from the pipeline tooling/app directory:\n pnpm add --save-dev @sequenceholdings/studio-cli @sequenceholdings/pipeline-spec\n pnpm exec seq-studio pipeline validate .\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 Source identity must be adopted and belong to the destination tenant.\n Registered OpCo source origins are not supported yet. The target verifies\n and snapshots source before planning; no target repository is created.\n Reviewed pipeline.config.yml source_paths can select runtime files and\n directories, retaining pipeline metadata, release identity and size limits.\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 seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--stages <slugs>] [--json]\n preview the whole pipeline, or comma-separated stages omitted from its\n latest published source collection. Approve the same scope with\n --plan-hash <hash> --yes. Deletes supported execution resources and archives\n stages; retains data and history. Live synced-table configurations block.\n Inspect with --retirement-id <id>; resume a stopped failure with\n --retirement-id <id> --resume --yes (omit --stages; the scope is immutable).\n Requires a human pipeline administrator and staff destructive-operation access.\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";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Offline help: keep this module free of authentication and runtime SDK imports. */
|
|
2
|
+
export const PIPELINE_HELP = `usage:
|
|
3
|
+
seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]
|
|
4
|
+
list pipeline repository rollups (not assets)
|
|
5
|
+
seq-studio pipeline assets -e <env> [--repo <namespace>/<slug>] [--json]
|
|
6
|
+
list asset declarations, including assets that may not be deployed
|
|
7
|
+
seq-studio pipeline search <query> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--limit N] [--offset N] [--json]
|
|
8
|
+
seq-studio pipeline describe <asset-id> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--json]
|
|
9
|
+
seq-studio pipeline schema|sample <asset-id> -e <env> [--target <id>] [--limit N] [--json]
|
|
10
|
+
seq-studio pipeline query <asset-id> --sql <read-only-sql> -e <env> [--target <id>] [--limit N] [--json]
|
|
11
|
+
seq-studio pipeline init|validate|plan|deploy|status|migrate|adopt|unbind|run-now|promote|rollback ...
|
|
12
|
+
For local validation, run from the pipeline tooling/app directory:
|
|
13
|
+
pnpm add --save-dev @sequenceholdings/studio-cli @sequenceholdings/pipeline-spec
|
|
14
|
+
pnpm exec seq-studio pipeline validate .
|
|
15
|
+
seq-studio pipeline plan|deploy --repo <namespace>/<slug> --ref <sha|branch>
|
|
16
|
+
[--root <directory>] [--source-env <first-party-env>] -e <env> [--target <id>]
|
|
17
|
+
For an existing target release unit, source-env selects a separately
|
|
18
|
+
authenticated canonical repository from banksouth, staging, or production.
|
|
19
|
+
Source identity must be adopted and belong to the destination tenant.
|
|
20
|
+
Registered OpCo source origins are not supported yet. The target verifies
|
|
21
|
+
and snapshots source before planning; no target repository is created.
|
|
22
|
+
Reviewed pipeline.config.yml source_paths can select runtime files and
|
|
23
|
+
directories, retaining pipeline metadata, release identity and size limits.
|
|
24
|
+
Not compatible with --dir, existing IDs, or coordinated migrations.
|
|
25
|
+
Rollback uses retained snapshots; historical source commits can be re-planned
|
|
26
|
+
explicitly with deploy --ref <sha> --source-env <env>.
|
|
27
|
+
seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]
|
|
28
|
+
poll an existing durable plan without enqueueing or attaching credentials
|
|
29
|
+
seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--stages <slugs>] [--json]
|
|
30
|
+
preview the whole pipeline, or comma-separated stages omitted from its
|
|
31
|
+
latest published source collection. Approve the same scope with
|
|
32
|
+
--plan-hash <hash> --yes. Deletes supported execution resources and archives
|
|
33
|
+
stages; retains data and history. Live synced-table configurations block.
|
|
34
|
+
Inspect with --retirement-id <id>; resume a stopped failure with
|
|
35
|
+
--retirement-id <id> --resume --yes (omit --stages; the scope is immutable).
|
|
36
|
+
Requires a human pipeline administrator and staff destructive-operation access.
|
|
37
|
+
Lifecycle --json results use stdout; progress uses stderr. Deploy --run-now
|
|
38
|
+
executes producers in the managed worker; local polling may disconnect.
|
|
39
|
+
|
|
40
|
+
Discovery requires staff access. Use list for pipeline repositories, assets
|
|
41
|
+
for declared assets, and search/describe for active deployment metadata;
|
|
42
|
+
use schema to verify physical columns. -e chooses the environment and
|
|
43
|
+
--target chooses a logical target when the environment has more than one.
|
|
44
|
+
Help is available offline.
|
|
45
|
+
`;
|
|
@@ -623,7 +623,7 @@ async function pollDeployment({ baseUrl, token, deploymentId, environment, timeo
|
|
|
623
623
|
* on the target, attach (as the caller) the managed secret named by convention
|
|
624
624
|
* and plan once more — `functions deploy`'s manifest reconcile, for pipelines.
|
|
625
625
|
* A failed plan still registers its stages, so this also covers new stages.
|
|
626
|
-
* `--no-provision` (CI) skips attaching and fails
|
|
626
|
+
* `--no-provision` (CI) skips attaching and fails on the first plan.
|
|
627
627
|
*/
|
|
628
628
|
async function planAttachingCredentials({ request, provision, }) {
|
|
629
629
|
let response;
|
|
@@ -892,11 +892,10 @@ export async function pipelineUnbindCommand(args) {
|
|
|
892
892
|
* ambiguous bare slug fails with the candidate repos rather than guessing.
|
|
893
893
|
*
|
|
894
894
|
* The `slug` query param is an EXACT server-side filter (contracts.ts
|
|
895
|
-
* `listStagesQuerySchema`)
|
|
896
|
-
* `updated_at DESC`, so scanning only the first page
|
|
897
|
-
*
|
|
898
|
-
*
|
|
899
|
-
* bare-slug lookup as unique (SEQ-2447 review). Filtering server-side by the
|
|
895
|
+
* `listStagesQuerySchema`). The list route's default sort is
|
|
896
|
+
* `updated_at DESC`, so scanning only the first page would silently miss a
|
|
897
|
+
* matching stage buried on a later page, and a same-slug duplicate there would
|
|
898
|
+
* falsely read as unique (SEQ-2447 review). Filtering server-side by the
|
|
900
899
|
* exact slug means every match is guaranteed to fit on one page regardless
|
|
901
900
|
* of how many other stages exist.
|
|
902
901
|
*/
|
|
@@ -11,22 +11,27 @@ export async function pipelineRetireCommand(args) {
|
|
|
11
11
|
const repo = string('repo');
|
|
12
12
|
const planHash = string('plan-hash');
|
|
13
13
|
const retirementId = string('retirement-id');
|
|
14
|
+
const stageSelection = string('stages');
|
|
15
|
+
const stageSlugs = stageSelection === undefined ? undefined : stageSelection.split(',').map(s => s.trim()).sort();
|
|
16
|
+
if (stageSlugs && (retirementId || stageSlugs.some(s => !s) || new Set(stageSlugs).size !== stageSlugs.length)) {
|
|
17
|
+
throw new Error('--stages must be a nonempty, unique comma-separated list; omit it when reading or resuming the original retirement ID');
|
|
18
|
+
}
|
|
14
19
|
const resume = args.flags.resume === true;
|
|
15
20
|
const confirmed = args.flags.yes === true;
|
|
16
21
|
if (!repo || ((planHash || resume) && !confirmed) || (resume && !retirementId) || (confirmed && !planHash && !resume)) {
|
|
17
|
-
console.error('usage: seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--plan-hash <hash> --yes | --retirement-id <id> [--resume --yes]] [--json]');
|
|
22
|
+
console.error('usage: seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--stages <slug,slug>] [--plan-hash <hash> --yes | --retirement-id <id> [--resume --yes]] [--json]');
|
|
18
23
|
return 1;
|
|
19
24
|
}
|
|
20
25
|
const { env, token } = await envAndToken(args, { human: true });
|
|
21
26
|
const target = await resolvePipelineTarget({ args, env, token });
|
|
22
|
-
const result = await postJson({ baseUrl: env.url, token, path: '/api/data-pipelines/pipelines/retire', body: { repo, environment: target.id, ...(planHash ? { planHash } : {}), ...(retirementId ? { retirementId } : {}), resume } });
|
|
27
|
+
const result = await postJson({ baseUrl: env.url, token, path: '/api/data-pipelines/pipelines/retire', body: { repo, environment: target.id, ...(stageSlugs ? { stageSlugs } : {}), ...(planHash ? { planHash } : {}), ...(retirementId ? { retirementId } : {}), resume } });
|
|
23
28
|
if (args.flags.json)
|
|
24
29
|
console.log(JSON.stringify(result, null, 2));
|
|
25
30
|
else if (result.plan) {
|
|
26
31
|
console.log(`Retire ${repo} in ${target.id}: ${result.plan.inventory.stageRows.length} stages. Data and history retained.`);
|
|
27
32
|
for (const r of result.plan.inventory.resources)
|
|
28
33
|
console.log(` ${['job', 'dlt_pipeline', 'synced_table'].includes(r.kind) ? 'Verify/remove execution resource' : 'Retain data object'}: ${r.kind} ${r.nativeId} (${r.resourceKey})`);
|
|
29
|
-
console.log(`Review the inventory, then approve with --plan-hash ${result.plan.planHash} --yes. Native preflight can still block unsafe deletion.`);
|
|
34
|
+
console.log(`Review the inventory, then approve with ${stageSlugs ? `--stages ${stageSlugs.join(',')} ` : ''}--plan-hash ${result.plan.planHash} --yes. Native preflight can still block unsafe deletion.`);
|
|
30
35
|
}
|
|
31
36
|
else
|
|
32
37
|
console.log(`Retirement ${result.retirementId}: ${result.status}${result.statusDetail ? ` — ${result.statusDetail}` : ''}\nCheck with --retirement-id ${result.retirementId}. Resume a stopped failure with --retirement-id ${result.retirementId} --resume --yes.`);
|
|
@@ -22,12 +22,12 @@ export interface AttachableSecret {
|
|
|
22
22
|
export interface MissingStageCredential {
|
|
23
23
|
stage: StageRef;
|
|
24
24
|
symbolic: string;
|
|
25
|
-
/** Convention name (`
|
|
25
|
+
/** Convention name (`vendor_oauth` → `VENDOR_OAUTH`), from the stage detail. */
|
|
26
26
|
managedSecretName: string;
|
|
27
27
|
/** The target's secret org (what the legacy lookup reads), when it has one. */
|
|
28
28
|
secretOrgId: string | null;
|
|
29
29
|
}
|
|
30
|
-
/** The credential name a secret binds to when none is given: `
|
|
30
|
+
/** The credential name a secret binds to when none is given: `VENDOR_OAUTH` → `vendor_oauth`. */
|
|
31
31
|
export declare function symbolicForSecretName(name: string): string;
|
|
32
32
|
export declare function resolveStage({ client, slug, repo, }: {
|
|
33
33
|
client: ClientOptions;
|
|
@@ -12,7 +12,7 @@ import { deleteJson, getJson, postJson } from '../atlas-client.js';
|
|
|
12
12
|
*/
|
|
13
13
|
const LOG = '[seq-studio]';
|
|
14
14
|
const EDIT_ACCESS = new Set(['editor', 'admin', 'owner']);
|
|
15
|
-
/** The credential name a secret binds to when none is given: `
|
|
15
|
+
/** The credential name a secret binds to when none is given: `VENDOR_OAUTH` → `vendor_oauth`. */
|
|
16
16
|
export function symbolicForSecretName(name) {
|
|
17
17
|
return name.toLowerCase();
|
|
18
18
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Online agent loader for lint's "agent output schema matches
|
|
3
3
|
* outgoing_edges" check. Hits `GET /api/agents/agents/:id` on the
|
|
4
|
-
* resolved env
|
|
5
|
-
* required an Atlas tsx runtime).
|
|
4
|
+
* resolved env.
|
|
6
5
|
*
|
|
7
6
|
* Outcomes are distinguished so lint can react proportionally: a
|
|
8
7
|
* definitive 404 returns 'not-found' (hard error — a misspelled or
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Online agent loader for lint's "agent output schema matches
|
|
3
3
|
* outgoing_edges" check. Hits `GET /api/agents/agents/:id` on the
|
|
4
|
-
* resolved env
|
|
5
|
-
* required an Atlas tsx runtime).
|
|
4
|
+
* resolved env.
|
|
6
5
|
*
|
|
7
6
|
* Outcomes are distinguished so lint can react proportionally: a
|
|
8
7
|
* definitive 404 returns 'not-found' (hard error — a misspelled or
|
package/dist/process/build.js
CHANGED
|
@@ -285,7 +285,7 @@ function serializeNodeMetadata(node) {
|
|
|
285
285
|
}
|
|
286
286
|
// First-class comment-chain opt-in — packed alongside artifact_refs (NOT
|
|
287
287
|
// inside the author `metadata` bag), so it serializes as its own node
|
|
288
|
-
// field that
|
|
288
|
+
// field that consumers read at `node.metadata.comments`.
|
|
289
289
|
if (human.comments)
|
|
290
290
|
meta.comments = human.comments;
|
|
291
291
|
serializeMapperSlot(meta, 'input_mapper', human.input);
|
|
@@ -355,8 +355,8 @@ function serializeNodeMetadata(node) {
|
|
|
355
355
|
// directive. It must live at TOP-LEVEL `input_mapper_source` — the same
|
|
356
356
|
// slot every other node kind uses — so the orchestrator's runInputMapper
|
|
357
357
|
// executes it and the runner reads the directive from its payload input.
|
|
358
|
-
// (
|
|
359
|
-
// re-run + epoch invalidation
|
|
358
|
+
// (Nested under `parallel` it would go unread, disabling selective
|
|
359
|
+
// re-run + epoch invalidation.)
|
|
360
360
|
serializeMapperSlot(meta, 'input_mapper', parallel.input);
|
|
361
361
|
if (parallel.bindings)
|
|
362
362
|
meta.bindings = parallel.bindings;
|
package/dist/process/commands.js
CHANGED
|
@@ -1144,9 +1144,8 @@ export async function doctorCommand(args) {
|
|
|
1144
1144
|
lines.push(`writer gate: WARN — could not probe: ${err instanceof Error ? err.message : String(err)}`);
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
// Git-service discovery: empty current env often means the repos live on
|
|
1148
|
-
// another deployment
|
|
1149
|
-
// staging). Hint when staging has repos and the current env does not.
|
|
1147
|
+
// Git-service discovery: an empty current env often means the repos live on
|
|
1148
|
+
// another deployment. Hint when staging has repos and the current env does not.
|
|
1150
1149
|
try {
|
|
1151
1150
|
const current = await getJson({
|
|
1152
1151
|
baseUrl: env.url,
|
package/dist/process/discover.js
CHANGED
|
@@ -72,7 +72,7 @@ export async function loadProcessDefinitions(explicitRoot) {
|
|
|
72
72
|
const entries = await readdir(root);
|
|
73
73
|
const found = [];
|
|
74
74
|
const seenIds = new Set();
|
|
75
|
-
// Group dirs
|
|
75
|
+
// Group dirs have no `process.ts` of their own but
|
|
76
76
|
// contain `<group>/<id>/process.ts`. Discovery is one level deep, so they're
|
|
77
77
|
// silently skipped from this root — warn so a dev doesn't believe they
|
|
78
78
|
// linted/applied everything (run from inside the group dir, or set
|
package/dist/process/lint.js
CHANGED
|
@@ -350,9 +350,8 @@ async function lintNodeContract(processId, node, errors, warnings, loadAgentSche
|
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
/**
|
|
353
|
-
* A node whose config declares `routeRules` (content-conditional routing
|
|
354
|
-
*
|
|
355
|
-
* outgoing edge. This is the only place the hole can be closed: the native fn
|
|
353
|
+
* A node whose config declares `routeRules` (content-conditional routing)
|
|
354
|
+
* must declare EVERY rule's `edge_id` as an outgoing edge. This is the only place the hole can be closed: the native fn
|
|
356
355
|
* can't see the graph from its execution context, and the engine's edge router
|
|
357
356
|
* AUTO-TAKES a sole outgoing edge while silently discarding the returned
|
|
358
357
|
* edge_id — so a rule targeting a forgotten edge would route every submission
|
|
@@ -367,10 +366,9 @@ function lintRouteRulesEdges(processId, node, errors) {
|
|
|
367
366
|
if (!Array.isArray(rules) || rules.length === 0)
|
|
368
367
|
return;
|
|
369
368
|
const edgeIds = new Set(node.outgoing_edges.map((e) => e.id));
|
|
370
|
-
//
|
|
371
|
-
//
|
|
372
|
-
//
|
|
373
|
-
// submission at runtime (InvalidEdgeIdError). Catch it at lint time.
|
|
369
|
+
// A routeRules fn returns 'ok' when no rule matches, so a routeRules node
|
|
370
|
+
// without an ok edge would pass the per-rule check below and then fail the
|
|
371
|
+
// FIRST non-matching submission at runtime (InvalidEdgeIdError). Catch it at lint time.
|
|
374
372
|
if (!edgeIds.has('ok')) {
|
|
375
373
|
errors.push({
|
|
376
374
|
process_id: processId,
|
|
@@ -221,7 +221,7 @@ const BEHAVIORAL_METADATA_FIELDS = {
|
|
|
221
221
|
'advance_allowed_mapper_source',
|
|
222
222
|
'advance_allowed_mapper_expr',
|
|
223
223
|
// dueDate fn computes the task's due instant at parking — a change alters
|
|
224
|
-
// run behavior
|
|
224
|
+
// run behavior, so it must diff as behavioral.
|
|
225
225
|
'due_date_source',
|
|
226
226
|
'due_date_expr',
|
|
227
227
|
'email_notification',
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* RECURSIVELY finding each `process.ts` under both bases (`atlas/processes`
|
|
12
12
|
* and repo-root `processes/`, skipping node_modules/hidden dirs) and taking
|
|
13
13
|
* `dirname(dirname(file))` as its apply root — so arbitrarily nested layouts
|
|
14
|
-
* (
|
|
14
|
+
* (`<group>/<pkg>/<id>/process.ts`) are covered.
|
|
15
15
|
* Repo-root packages' `@sequenceholdings/lattice` import resolves through the
|
|
16
16
|
* repo-root node_modules (the workspace SDK is a root devDependency), so they
|
|
17
17
|
* load through the same tsx lane.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* RECURSIVELY finding each `process.ts` under both bases (`atlas/processes`
|
|
12
12
|
* and repo-root `processes/`, skipping node_modules/hidden dirs) and taking
|
|
13
13
|
* `dirname(dirname(file))` as its apply root — so arbitrarily nested layouts
|
|
14
|
-
* (
|
|
14
|
+
* (`<group>/<pkg>/<id>/process.ts`) are covered.
|
|
15
15
|
* Repo-root packages' `@sequenceholdings/lattice` import resolves through the
|
|
16
16
|
* repo-root node_modules (the workspace SDK is a root devDependency), so they
|
|
17
17
|
* load through the same tsx lane.
|
|
@@ -84,10 +84,10 @@ async function fileExists(path) {
|
|
|
84
84
|
* directory whose IMMEDIATE child owns it (`dirname(dirname(file))` — the
|
|
85
85
|
* `<root>/<id>/process.ts` registration unit loadProcessDefinitions loads one
|
|
86
86
|
* level deep). Unique + sorted. Arbitrarily nested layouts (e.g.
|
|
87
|
-
* `atlas/processes
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
87
|
+
* `atlas/processes/<group>/<pkg>/<id>/process.ts`) resolve to their own root,
|
|
88
|
+
* and a dir can be an id dir under one root while parenting deeper roots
|
|
89
|
+
* without overlapping loads, because each root loads only its immediate
|
|
90
|
+
* children.
|
|
91
91
|
*/
|
|
92
92
|
async function discoverApplyRoots({ repoRoot }) {
|
|
93
93
|
const roots = new Set();
|
package/dist/repos/commands.d.ts
CHANGED
package/dist/secrets/commands.js
CHANGED
|
@@ -46,18 +46,6 @@ function parseCommaList(value) {
|
|
|
46
46
|
function orgFlag(args) {
|
|
47
47
|
return typeof args.flags.org === 'string' ? args.flags.org.trim().toLowerCase() : undefined;
|
|
48
48
|
}
|
|
49
|
-
/** First-party Sequence Atlas envs — their Lakebase registry is org=sequence. */
|
|
50
|
-
const SEQUENCE_OWNED_ENVS = new Set(['local', 'staging', 'production']);
|
|
51
|
-
/** Refuse --org that would write a tenant row into the wrong deployment registry. */
|
|
52
|
-
function orgDeploymentError(org, envName) {
|
|
53
|
-
if (SEQUENCE_OWNED_ENVS.has(envName) && org !== 'sequence') {
|
|
54
|
-
return `--org ${org} must be used with -e ${org} (${envName} only holds the sequence secret registry)`;
|
|
55
|
-
}
|
|
56
|
-
if (!SEQUENCE_OWNED_ENVS.has(envName) && org === 'sequence') {
|
|
57
|
-
return `--org sequence is not valid on -e ${envName} (that deployment does not own the Sequence registry)`;
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
49
|
/** Drop one trailing LF or CRLF so Windows-authored --from-file values match Unix. */
|
|
62
50
|
export function stripOneTrailingNewline(value) {
|
|
63
51
|
return value.replace(/\r?\n$/, '');
|
|
@@ -173,13 +161,8 @@ export async function secretsCreateCommand(args) {
|
|
|
173
161
|
console.error(`${LOG} --type must be key-value or single`);
|
|
174
162
|
return 1;
|
|
175
163
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (mismatch) {
|
|
179
|
-
console.error(`${LOG} ${mismatch}`);
|
|
180
|
-
return 1;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
164
|
+
// Atlas owns registry identity and validates orgId against deploymentOwnerSlug.
|
|
165
|
+
// CLI aliases (especially local tenant profiles) do not identify that owner.
|
|
183
166
|
const secret = await postJson({
|
|
184
167
|
...clientOptions(ctx),
|
|
185
168
|
path: '/api/managed-secrets',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
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": {
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"tsx": "^4.20.3",
|
|
45
45
|
"yaml": "^2.8.4",
|
|
46
46
|
"zod": "^4.1.13",
|
|
47
|
+
"@sequenceholdings/artifact-studio": "0.11.6",
|
|
47
48
|
"@sequenceholdings/agent-spec": "0.1.5",
|
|
48
|
-
"@sequenceholdings/artifact-studio": "0.11.3",
|
|
49
49
|
"@sequenceholdings/lattice": "0.1.8",
|
|
50
|
-
"@sequenceholdings/managed-functions": "0.5.
|
|
51
|
-
"@sequenceholdings/storage": "0.1.
|
|
52
|
-
"@sequenceholdings/platform": "0.1.
|
|
50
|
+
"@sequenceholdings/managed-functions": "0.5.5",
|
|
51
|
+
"@sequenceholdings/storage": "0.1.5",
|
|
52
|
+
"@sequenceholdings/platform": "0.1.2"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@sequenceholdings/
|
|
56
|
-
"@sequenceholdings/
|
|
55
|
+
"@sequenceholdings/pipeline-spec": "0.3.3",
|
|
56
|
+
"@sequenceholdings/orm": "2.8.3"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@sequenceholdings/orm": {
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@types/semver": "^7.8.0",
|
|
70
70
|
"typescript": "^5.6.0",
|
|
71
71
|
"vitest": "^4.1.11",
|
|
72
|
-
"@sequenceholdings/pipeline-spec": "0.3.
|
|
73
|
-
"@sequenceholdings/orm": "2.8.
|
|
72
|
+
"@sequenceholdings/pipeline-spec": "0.3.3",
|
|
73
|
+
"@sequenceholdings/orm": "2.8.3"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=20"
|