@sequenceholdings/studio-cli 0.2.1 → 0.2.2
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 +229 -26
- package/dist/app/adapters.js +27 -5
- package/dist/app/application-registration.d.ts +92 -0
- package/dist/app/application-registration.js +145 -0
- package/dist/app/deploy.d.ts +8 -0
- package/dist/app/deploy.js +40 -8
- package/dist/app/manifest-validation.d.ts +20 -1
- package/dist/app/manifest-validation.js +130 -6
- package/dist/app/manifest.d.ts +96 -2
- package/dist/app/manifest.js +99 -3
- package/dist/app/primitive-scaffold.js +11 -1
- package/dist/app/readme.js +2 -0
- package/dist/app/scaffold.js +3 -2
- package/dist/app/workspace-scaffold.js +3 -3
- package/dist/artifact/delegate.js +8 -4
- package/dist/cli-errors.js +4 -0
- package/dist/functions/commands.js +2 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +2 -2
- package/dist/pipeline/commands.js +11 -0
- package/dist/pipeline/discovery.d.ts +8 -0
- package/dist/pipeline/discovery.js +249 -0
- package/dist/pipeline/lifecycle.js +35 -10
- package/dist/repos/commands.d.ts +1 -1
- package/dist/repos/commands.js +10 -7
- package/package.json +2 -2
|
@@ -8,6 +8,19 @@ import { resolveEnvWithDiscovery } from '../config.js';
|
|
|
8
8
|
import { parseDurationMs } from '@sequenceholdings/lattice';
|
|
9
9
|
import { printReconcileResult, reconcileStageCredentials } from './stage-secrets.js';
|
|
10
10
|
const LOG = '[seq-studio]';
|
|
11
|
+
function rootOption(root) {
|
|
12
|
+
return root ? { root } : {};
|
|
13
|
+
}
|
|
14
|
+
function releaseUnitRepo({ repo, root }) {
|
|
15
|
+
if (!root)
|
|
16
|
+
return repo;
|
|
17
|
+
if (!repo)
|
|
18
|
+
throw new Error('--root requires --repo');
|
|
19
|
+
if (!/^(?!.*(?:^|\/)\.{1,2}(?:\/|$))[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*$/.test(root)) {
|
|
20
|
+
throw new Error('--root must be a contained relative directory');
|
|
21
|
+
}
|
|
22
|
+
return `${repo}@${root}`;
|
|
23
|
+
}
|
|
11
24
|
const TERMINAL = new Set(['active', 'failed', 'retired']);
|
|
12
25
|
const POLL_INTERVAL_MS = 2000;
|
|
13
26
|
const HEARTBEAT_INTERVAL_MS = 20_000;
|
|
@@ -109,6 +122,7 @@ export async function resolvePipelineTarget({ args, env, token, }) {
|
|
|
109
122
|
export async function pipelinePlanCommand(args) {
|
|
110
123
|
const repo = flagString(args.flags, 'repo');
|
|
111
124
|
const ref = flagString(args.flags, 'ref');
|
|
125
|
+
const root = flagString(args.flags, 'root');
|
|
112
126
|
const migrationId = flagString(args.flags, 'migration');
|
|
113
127
|
const inPlace = flagOn(args.flags, 'in-place');
|
|
114
128
|
if (inPlace && !migrationId) {
|
|
@@ -116,7 +130,7 @@ export async function pipelinePlanCommand(args) {
|
|
|
116
130
|
return 1;
|
|
117
131
|
}
|
|
118
132
|
if (!repo || !ref) {
|
|
119
|
-
console.error('usage: seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha|branch> -e <env> [--migration <id> [--in-place]] [--json]');
|
|
133
|
+
console.error('usage: seq-studio pipeline plan --repo <namespace>/<slug> --ref <sha|branch> [--root <directory>] -e <env> [--migration <id> [--in-place]] [--json]');
|
|
120
134
|
return 1;
|
|
121
135
|
}
|
|
122
136
|
const { env, token } = await envAndToken(args);
|
|
@@ -137,6 +151,7 @@ export async function pipelinePlanCommand(args) {
|
|
|
137
151
|
token,
|
|
138
152
|
repo,
|
|
139
153
|
ref,
|
|
154
|
+
...rootOption(root),
|
|
140
155
|
environment: target.id,
|
|
141
156
|
...(migrationId ? { migrationId } : {}),
|
|
142
157
|
...(inPlace ? { executionMode: 'in_place' } : {}),
|
|
@@ -170,6 +185,7 @@ export async function pipelineDeployCommand(args) {
|
|
|
170
185
|
}
|
|
171
186
|
const repo = flagString(args.flags, 'repo');
|
|
172
187
|
const ref = flagString(args.flags, 'ref');
|
|
188
|
+
const root = flagString(args.flags, 'root');
|
|
173
189
|
const deploymentId = flagString(args.flags, 'deployment-id');
|
|
174
190
|
const approvedBy = flagString(args.flags, 'approved-by');
|
|
175
191
|
const runNow = flagOn(args.flags, 'run-now');
|
|
@@ -210,12 +226,12 @@ export async function pipelineDeployCommand(args) {
|
|
|
210
226
|
}
|
|
211
227
|
else {
|
|
212
228
|
if (!repo || !ref) {
|
|
213
|
-
console.error('usage: seq-studio pipeline deploy --repo <namespace>/<slug> --ref <sha|branch> -e <env> [--target <id>] [--approved-by <sub>] [--allow-destructive <resource-key> ...] [--run-now] [--wait-timeout <duration>] [--no-wait]');
|
|
229
|
+
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]');
|
|
214
230
|
return 1;
|
|
215
231
|
}
|
|
216
232
|
// Plan then deploy the first planning deployment.
|
|
217
233
|
const plan = await planAttachingCredentials({
|
|
218
|
-
request: { baseUrl: env.url, token, repo, ref, environment: target.id },
|
|
234
|
+
request: { baseUrl: env.url, token, repo, ref, environment: target.id, ...rootOption(root) },
|
|
219
235
|
provision: !flagOn(args.flags, 'no-provision'),
|
|
220
236
|
});
|
|
221
237
|
if (plan.plan.hasDestructive && allowDestructiveResourceKeys.length === 0) {
|
|
@@ -562,9 +578,12 @@ async function attachUnattachedCredentials({ request, stageIds, }) {
|
|
|
562
578
|
try {
|
|
563
579
|
const client = { baseUrl: request.baseUrl, token: request.token };
|
|
564
580
|
const { secrets } = await getJson({ ...client, path: '/api/managed-secrets' });
|
|
581
|
+
const repo = releaseUnitRepo({ repo: request.repo, root: request.root });
|
|
582
|
+
if (!repo)
|
|
583
|
+
throw new Error('pipeline credential reconciliation requires a repository');
|
|
565
584
|
const result = await reconcileStageCredentials({
|
|
566
585
|
client,
|
|
567
|
-
repo
|
|
586
|
+
repo,
|
|
568
587
|
stageIds,
|
|
569
588
|
deployTarget: request.environment,
|
|
570
589
|
secrets,
|
|
@@ -589,12 +608,12 @@ class PlanRequestFailedError extends Error {
|
|
|
589
608
|
this.stageIds = stageIds;
|
|
590
609
|
}
|
|
591
610
|
}
|
|
592
|
-
async function enqueueAndWaitForPlan({ baseUrl, token, repo, ref, environment, migrationId, executionMode, }) {
|
|
611
|
+
async function enqueueAndWaitForPlan({ baseUrl, token, repo, ref, root, environment, migrationId, executionMode, }) {
|
|
593
612
|
const enqueue = await postJson({
|
|
594
613
|
baseUrl,
|
|
595
614
|
token,
|
|
596
615
|
path: '/api/data-pipelines/pipelines/plan',
|
|
597
|
-
body: { repo, ref, environment, ...(migrationId ? { migration_id: migrationId } : {}), ...(executionMode ? { execution_mode: executionMode } : {}) },
|
|
616
|
+
body: { repo, ref, environment, ...rootOption(root), ...(migrationId ? { migration_id: migrationId } : {}), ...(executionMode ? { execution_mode: executionMode } : {}) },
|
|
598
617
|
});
|
|
599
618
|
console.log(`${LOG} enqueued plan ${enqueue.planRequestId} (trigger=${enqueue.triggerRunId ?? 'n/a'})`);
|
|
600
619
|
const detail = await waitForPlanRequest({
|
|
@@ -653,7 +672,7 @@ export async function pipelineAdoptCommand(args) {
|
|
|
653
672
|
const nativeId = flagString(args.flags, 'native-id');
|
|
654
673
|
const approvedBy = flagString(args.flags, 'approved-by');
|
|
655
674
|
if (!stage || !ref || !nativeId || !approvedBy) {
|
|
656
|
-
console.error('usage: seq-studio pipeline adopt --stage <slug> --ref <sha|branch> -e <env> ' +
|
|
675
|
+
console.error('usage: seq-studio pipeline adopt --stage <slug> --ref <sha|branch> [--root <directory>] -e <env> ' +
|
|
657
676
|
'--native-id <id> --approved-by <you> [--resource-key <key>] [--kind job|dlt_pipeline] ' +
|
|
658
677
|
'[--old-source-removal-pr <url>] [--repo <namespace>/<slug>] [--json]');
|
|
659
678
|
return 1;
|
|
@@ -668,7 +687,10 @@ export async function pipelineAdoptCommand(args) {
|
|
|
668
687
|
console.error(`${LOG} adopt failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
669
688
|
return 1;
|
|
670
689
|
}
|
|
671
|
-
const repo =
|
|
690
|
+
const repo = releaseUnitRepo({
|
|
691
|
+
repo: flagString(args.flags, 'repo'),
|
|
692
|
+
root: flagString(args.flags, 'root'),
|
|
693
|
+
});
|
|
672
694
|
const resourceKey = flagString(args.flags, 'resource-key') ?? stage.replace(/-/g, '_');
|
|
673
695
|
const kind = flagString(args.flags, 'kind') ?? 'job';
|
|
674
696
|
if (kind !== 'job' && kind !== 'dlt_pipeline') {
|
|
@@ -718,7 +740,7 @@ export async function pipelineUnbindCommand(args) {
|
|
|
718
740
|
const ref = flagString(args.flags, 'ref');
|
|
719
741
|
const approvedBy = flagString(args.flags, 'approved-by');
|
|
720
742
|
if (!stage || !ref || !approvedBy) {
|
|
721
|
-
console.error('usage: seq-studio pipeline unbind --stage <slug> --ref <sha|branch> -e <env> ' +
|
|
743
|
+
console.error('usage: seq-studio pipeline unbind --stage <slug> --ref <sha|branch> [--root <directory>] -e <env> ' +
|
|
722
744
|
'--approved-by <you> [--resource-key <key>] [--repo <namespace>/<slug>] [--json]');
|
|
723
745
|
return 1;
|
|
724
746
|
}
|
|
@@ -732,7 +754,10 @@ export async function pipelineUnbindCommand(args) {
|
|
|
732
754
|
console.error(`${LOG} unbind failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
733
755
|
return 1;
|
|
734
756
|
}
|
|
735
|
-
const repo =
|
|
757
|
+
const repo = releaseUnitRepo({
|
|
758
|
+
repo: flagString(args.flags, 'repo'),
|
|
759
|
+
root: flagString(args.flags, 'root'),
|
|
760
|
+
});
|
|
736
761
|
const resourceKey = flagString(args.flags, 'resource-key');
|
|
737
762
|
const stageId = await resolveStageIdBySlug({
|
|
738
763
|
baseUrl: env.url,
|
package/dist/repos/commands.d.ts
CHANGED
|
@@ -106,6 +106,6 @@ export declare function reposCiRequireCommand(args: ParsedArgs): Promise<number>
|
|
|
106
106
|
export declare function reposCiImportCommand(args: ParsedArgs): Promise<number>;
|
|
107
107
|
export declare function reposCiCommand(args: ParsedArgs): Promise<number>;
|
|
108
108
|
export declare function reposDeleteCommand(args: ParsedArgs): Promise<number>;
|
|
109
|
-
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
|
|
109
|
+
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]\n seq-studio repos clone --url <https://\u2026/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]\n seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]\n smart-HTTP when ATLAS_GIT_PAT is set;\n otherwise JSON materialize (<ns>/<name>)\n seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n materialize the tree at a ref (JSON API)\n seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)\n seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview discovered CI checks\n seq-studio repos ci require <ns>/<name> --check <name> -e <env> reserved (refuses write until sandboxed runner)\n seq-studio repos ci import <ns>/<name> -e <env> [--ref r] reserved (refuses write until sandboxed runner)\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n\n clone prefers real git clone (PAT via askpass \u2014 never written into the remote\n URL). Without ATLAS_GIT_PAT, <ns>/<name> falls back to the JSON API and prints\n how to get a PAT (seq-studio or Atlas UI /settings/tokens).\n PAT without Auth0 login: use --id from Repositories \u2192 Clone\n (or --url with the environment's canonical HTTPS origin).\n --ref accepts a branch, tag, or commit SHA (SHA \u2192 full clone, then checkout).\n Branch and tag clones are shallow (--depth 1). Pass --full for history.\n --output selects the clone directory (--out remains an alias).\n\n Authenticate JSON API calls with: seq-studio login\n Authenticate git clone/push with: ATLAS_GIT_PAT (from Atlas Settings \u2192 Tokens)\n";
|
|
110
110
|
export declare function runReposCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|
|
111
111
|
export {};
|
package/dist/repos/commands.js
CHANGED
|
@@ -278,14 +278,16 @@ export async function reposShowCommand(args) {
|
|
|
278
278
|
}
|
|
279
279
|
return 0;
|
|
280
280
|
}
|
|
281
|
-
const GIT_BACKEND_KINDS = ['gcs_isomorphic', 'walgit'];
|
|
282
|
-
const GIT_BACKEND_KIND_SET = new Set(GIT_BACKEND_KINDS);
|
|
283
281
|
function parseGitBackendFlag(args) {
|
|
284
282
|
const gitBackend = stringFlag(args.flags, 'git-backend');
|
|
285
283
|
if (gitBackend === undefined)
|
|
286
284
|
return undefined;
|
|
287
|
-
if (
|
|
288
|
-
throw new Error(
|
|
285
|
+
if (gitBackend === 'gcs_isomorphic') {
|
|
286
|
+
throw new Error('--git-backend gcs_isomorphic is retired. Omit --git-backend for a repo seeded with a README, ' +
|
|
287
|
+
'or pass --git-backend walgit for an empty repo.');
|
|
288
|
+
}
|
|
289
|
+
if (gitBackend !== 'walgit') {
|
|
290
|
+
throw new Error(`--git-backend must be walgit (got "${gitBackend}").`);
|
|
289
291
|
}
|
|
290
292
|
return gitBackend;
|
|
291
293
|
}
|
|
@@ -795,9 +797,10 @@ export const REPOS_USAGE = `usage:
|
|
|
795
797
|
seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment
|
|
796
798
|
seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces
|
|
797
799
|
seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)
|
|
798
|
-
seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend
|
|
799
|
-
create a repo
|
|
800
|
-
walgit
|
|
800
|
+
seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]
|
|
801
|
+
create a repo seeded with a README; --git-backend
|
|
802
|
+
walgit creates it empty (for pushing existing
|
|
803
|
+
history); needs namespace write
|
|
801
804
|
seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full]
|
|
802
805
|
seq-studio repos clone --url <https://…/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]
|
|
803
806
|
seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Unified Sequence Studio CLI — `seq-studio init` / `add` / `deploy` (app monorepos), `seq-studio agents`, `seq-studio process` (Lattice), `seq-studio artifact`, `seq-studio functions` / `secrets`, `seq-studio repos`, and `seq-studio auth pat`. Includes Auth0 browser login shared with seqapi.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"tsx": "^4.20.3",
|
|
43
43
|
"zod": "^4.1.13",
|
|
44
44
|
"@sequenceholdings/agent-spec": "0.1.2",
|
|
45
|
-
"@sequenceholdings/artifact-studio": "0.3.
|
|
45
|
+
"@sequenceholdings/artifact-studio": "0.3.1",
|
|
46
46
|
"@sequenceholdings/lattice": "0.1.4",
|
|
47
47
|
"@sequenceholdings/managed-functions": "0.1.1",
|
|
48
48
|
"@sequenceholdings/storage": "0.1.0"
|