@sequenceholdings/studio-cli 0.3.0 → 0.4.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 +506 -32
- package/dist/agents/commands.d.ts +1 -1
- package/dist/agents/commands.js +5 -0
- package/dist/agents/scaffold.js +5 -7
- package/dist/agents/voice-authoring.d.ts +5 -0
- package/dist/agents/voice-authoring.js +75 -0
- package/dist/agents/voice-publication.d.ts +5 -0
- package/dist/agents/voice-publication.js +63 -0
- package/dist/agents/voice-shared.d.ts +20 -0
- package/dist/agents/voice-shared.js +112 -0
- package/dist/agents/voice.d.ts +3 -0
- package/dist/agents/voice.js +57 -0
- package/dist/app/adapters.d.ts +6 -0
- package/dist/app/adapters.js +17 -2
- package/dist/app/agent-refs.d.ts +16 -0
- package/dist/app/agent-refs.js +36 -0
- package/dist/app/application-registration.d.ts +45 -8
- package/dist/app/application-registration.js +112 -22
- package/dist/app/commands.js +19 -2
- package/dist/app/deploy.d.ts +3 -0
- package/dist/app/deploy.js +18 -4
- package/dist/app/env-bindings.d.ts +21 -0
- package/dist/app/env-bindings.js +184 -0
- package/dist/app/manifest-validation.d.ts +8 -0
- package/dist/app/manifest-validation.js +97 -5
- package/dist/app/manifest.d.ts +45 -9
- package/dist/app/manifest.js +27 -1
- package/dist/app/primitive-scaffold.d.ts +4 -1
- package/dist/app/primitive-scaffold.js +4 -4
- package/dist/app/readme.js +11 -0
- package/dist/app/scaffold-files.js +1 -1
- package/dist/app/scaffold.d.ts +6 -4
- package/dist/app/scaffold.js +7 -4
- package/dist/app/workspace-scaffold.js +12 -7
- package/dist/argv.d.ts +7 -0
- package/dist/argv.js +56 -0
- package/dist/artifact/delegate.js +8 -4
- package/dist/atlas-client.d.ts +6 -0
- package/dist/atlas-client.js +39 -2
- package/dist/auth.d.ts +32 -0
- package/dist/auth.js +170 -33
- package/dist/bin.js +23 -4
- package/dist/command-contract.d.ts +137 -0
- package/dist/command-contract.js +43 -0
- package/dist/command-help.d.ts +8 -0
- package/dist/command-help.js +71 -0
- package/dist/functions/commands.d.ts +1 -1
- package/dist/functions/commands.js +19 -3
- package/dist/functions/deploy-preflight.d.ts +21 -0
- package/dist/functions/deploy-preflight.js +58 -0
- package/dist/functions/egress-postgres.d.ts +7 -0
- package/dist/functions/egress-postgres.js +36 -0
- package/dist/functions/manifest.d.ts +8 -0
- package/dist/functions/manifest.js +9 -0
- package/dist/functions/source-selection.js +4 -1
- package/dist/main.js +58 -20
- package/dist/orm/delegate.d.ts +16 -0
- package/dist/orm/delegate.js +140 -7
- package/dist/pipeline/clone-deploy.d.ts +37 -0
- package/dist/pipeline/clone-deploy.js +125 -0
- package/dist/pipeline/codegen.js +6 -2
- package/dist/pipeline/commands.js +21 -5
- package/dist/pipeline/lifecycle.d.ts +1 -0
- package/dist/pipeline/lifecycle.js +95 -44
- package/dist/pipeline/repin-orm.js +6 -2
- package/dist/pipeline/stage-secrets.js +1 -1
- package/dist/process/build.js +17 -0
- package/dist/process/codegen.js +16 -0
- package/dist/process/commands.d.ts +15 -7
- package/dist/process/commands.js +291 -99
- package/dist/process/lint.js +35 -0
- package/dist/process/plan-diff.js +9 -0
- package/dist/process/simulate.js +8 -0
- package/dist/release-age.d.ts +12 -0
- package/dist/release-age.js +24 -0
- package/dist/repos/commands.d.ts +1 -1
- package/dist/repos/commands.js +36 -7
- package/dist/scaffold-guidance.d.ts +4 -0
- package/dist/scaffold-guidance.js +15 -0
- package/dist/storage/commands.js +23 -1
- package/dist/storage/gcs-download.d.ts +13 -0
- package/dist/storage/gcs-download.js +41 -0
- package/dist/storage/import-cycle.d.ts +41 -0
- package/dist/storage/import-cycle.js +123 -0
- package/dist/storage/import-files.d.ts +30 -0
- package/dist/storage/import-files.js +133 -0
- package/dist/storage/import-gcloud.d.ts +12 -0
- package/dist/storage/import-gcloud.js +54 -0
- package/dist/storage/import-identity.d.ts +12 -0
- package/dist/storage/import-identity.js +15 -0
- package/dist/storage/import-plan.d.ts +120 -0
- package/dist/storage/import-plan.js +189 -0
- package/dist/storage/import-preflight.d.ts +36 -0
- package/dist/storage/import-preflight.js +62 -0
- package/dist/storage/import-progress-map.d.ts +5 -0
- package/dist/storage/import-progress-map.js +22 -0
- package/dist/storage/import-recover.d.ts +97 -0
- package/dist/storage/import-recover.js +186 -0
- package/dist/storage/import-run.d.ts +14 -0
- package/dist/storage/import-run.js +140 -0
- package/dist/templates/guidance/AGENTS.md +10 -0
- package/dist/templates/guidance/CLAUDE.md +1 -0
- package/dist/templates/process/package.json +2 -2
- package/dist/templates/process/pnpm-workspace.yaml +7 -4
- package/dist/validation-detail.d.ts +2 -0
- package/dist/validation-detail.js +20 -0
- package/package.json +10 -10
- package/templates/guidance/AGENTS.md +10 -0
- package/templates/guidance/CLAUDE.md +1 -0
- package/templates/process/package.json +2 -2
- package/templates/process/pnpm-workspace.yaml +7 -4
|
@@ -6,6 +6,7 @@ import { getAccessToken, NotLoggedInError } from '../auth.js';
|
|
|
6
6
|
import { AtlasApiError, getJson, postJson } from '../atlas-client.js';
|
|
7
7
|
import { resolveEnvWithDiscovery } from '../config.js';
|
|
8
8
|
import { parseDurationMs } from '@sequenceholdings/lattice';
|
|
9
|
+
import { assertCloneDeployAllowed, publishCloneForDeploy } from './clone-deploy.js';
|
|
9
10
|
import { printReconcileResult, reconcileStageCredentials } from './stage-secrets.js';
|
|
10
11
|
const LOG = '[seq-studio]';
|
|
11
12
|
function rootOption(root) {
|
|
@@ -58,7 +59,7 @@ export async function envAndToken(args) {
|
|
|
58
59
|
const env = await resolveEnvWithDiscovery({ requested });
|
|
59
60
|
let token;
|
|
60
61
|
try {
|
|
61
|
-
token = await getAccessToken();
|
|
62
|
+
token = await getAccessToken({ env: env.name, targetUrl: env.url });
|
|
62
63
|
}
|
|
63
64
|
catch (error) {
|
|
64
65
|
if (error instanceof NotLoggedInError)
|
|
@@ -122,6 +123,7 @@ export async function resolvePipelineTarget({ args, env, token, }) {
|
|
|
122
123
|
export async function pipelinePlanCommand(args) {
|
|
123
124
|
const repo = flagString(args.flags, 'repo');
|
|
124
125
|
const ref = flagString(args.flags, 'ref');
|
|
126
|
+
const planRequestId = flagString(args.flags, 'plan-request-id');
|
|
125
127
|
const root = flagString(args.flags, 'root');
|
|
126
128
|
const migrationId = flagString(args.flags, 'migration');
|
|
127
129
|
const inPlace = flagOn(args.flags, 'in-place');
|
|
@@ -129,35 +131,39 @@ export async function pipelinePlanCommand(args) {
|
|
|
129
131
|
console.error(`${LOG} --in-place requires --migration; choose the mode when planning`);
|
|
130
132
|
return 1;
|
|
131
133
|
}
|
|
132
|
-
if (
|
|
133
|
-
console.error(
|
|
134
|
+
if (planRequestId && ['repo', 'ref', 'root', 'target', 'migration', 'in-place', 'no-provision'].some((flag) => args.flags[flag] !== undefined)) {
|
|
135
|
+
console.error(`${LOG} --plan-request-id reads an existing plan; do not combine it with planning options`);
|
|
134
136
|
return 1;
|
|
135
137
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
let target;
|
|
139
|
-
try {
|
|
140
|
-
target = await resolvePipelineTarget({ args, env, token });
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
console.error(`${LOG} plan failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
138
|
+
if (!planRequestId && (!repo || !ref)) {
|
|
139
|
+
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]');
|
|
144
140
|
return 1;
|
|
145
141
|
}
|
|
142
|
+
const { env, token } = await envAndToken(args);
|
|
143
|
+
const json = args.flags.json === true || args.flags.json === 'true';
|
|
146
144
|
let response;
|
|
147
145
|
try {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
baseUrl: env.url,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
146
|
+
if (planRequestId) {
|
|
147
|
+
response = completedPlanResponse(await waitForPlanRequest({
|
|
148
|
+
baseUrl: env.url, token, planRequestId,
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// Required source arguments were checked before authentication.
|
|
153
|
+
if (!repo || !ref)
|
|
154
|
+
return 1;
|
|
155
|
+
const target = await resolvePipelineTarget({ args, env, token });
|
|
156
|
+
response = await planAttachingCredentials({
|
|
157
|
+
request: {
|
|
158
|
+
baseUrl: env.url, token, repo, ref,
|
|
159
|
+
...rootOption(root),
|
|
160
|
+
environment: target.id,
|
|
161
|
+
...(migrationId ? { migrationId } : {}),
|
|
162
|
+
...(inPlace ? { executionMode: 'in_place' } : {}),
|
|
163
|
+
},
|
|
164
|
+
provision: !flagOn(args.flags, 'no-provision'),
|
|
165
|
+
});
|
|
166
|
+
}
|
|
161
167
|
}
|
|
162
168
|
catch (error) {
|
|
163
169
|
console.error(`${LOG} plan failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -170,6 +176,9 @@ export async function pipelinePlanCommand(args) {
|
|
|
170
176
|
console.log(response.text);
|
|
171
177
|
printFindingsTable(response.plan.findings);
|
|
172
178
|
}
|
|
179
|
+
return planResultExitCode({ response, inPlace, migrationId });
|
|
180
|
+
}
|
|
181
|
+
function planResultExitCode({ response, inPlace, migrationId, }) {
|
|
173
182
|
if (inPlace && response.plan.migrationExecutionMode !== 'in_place') {
|
|
174
183
|
console.error(`${LOG} server did not confirm in-place mode; do not start this plan`);
|
|
175
184
|
return 1;
|
|
@@ -185,6 +194,7 @@ export async function pipelineDeployCommand(args) {
|
|
|
185
194
|
}
|
|
186
195
|
const repo = flagString(args.flags, 'repo');
|
|
187
196
|
const ref = flagString(args.flags, 'ref');
|
|
197
|
+
const dir = flagString(args.flags, 'dir');
|
|
188
198
|
const root = flagString(args.flags, 'root');
|
|
189
199
|
const deploymentId = flagString(args.flags, 'deployment-id');
|
|
190
200
|
const approvedBy = flagString(args.flags, 'approved-by');
|
|
@@ -225,13 +235,36 @@ export async function pipelineDeployCommand(args) {
|
|
|
225
235
|
});
|
|
226
236
|
}
|
|
227
237
|
else {
|
|
228
|
-
if (
|
|
229
|
-
console.error(
|
|
238
|
+
if (dir && ref) {
|
|
239
|
+
console.error(`${LOG} pass either --dir or --ref, not both`);
|
|
240
|
+
return 1;
|
|
241
|
+
}
|
|
242
|
+
let sourceRef = ref;
|
|
243
|
+
if (dir) {
|
|
244
|
+
if (!repo) {
|
|
245
|
+
console.error('usage: seq-studio pipeline deploy --dir <checkout> --repo <namespace>/<slug> -e <env>');
|
|
246
|
+
return 1;
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
assertCloneDeployAllowed(target);
|
|
250
|
+
const published = await publishCloneForDeploy({ dir, repo, baseUrl: env.url, token });
|
|
251
|
+
sourceRef = published.sha;
|
|
252
|
+
console.error(`${LOG} published ${repo}@${published.sha.slice(0, 12)} ` +
|
|
253
|
+
`(${published.branch}${published.created ? ', created repo' : ''}) on ${env.name}`);
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
console.error(`${LOG} deploy failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
257
|
+
return 1;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (!repo || !sourceRef) {
|
|
261
|
+
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' +
|
|
262
|
+
' seq-studio pipeline deploy --dir <checkout> --repo <namespace>/<slug> -e <env>');
|
|
230
263
|
return 1;
|
|
231
264
|
}
|
|
232
265
|
// Plan then deploy the first planning deployment.
|
|
233
266
|
const plan = await planAttachingCredentials({
|
|
234
|
-
request: { baseUrl: env.url, token, repo, ref, environment: target.id, ...rootOption(root) },
|
|
267
|
+
request: { baseUrl: env.url, token, repo, ref: sourceRef, environment: target.id, ...rootOption(root) },
|
|
235
268
|
provision: !flagOn(args.flags, 'no-provision'),
|
|
236
269
|
});
|
|
237
270
|
if (plan.plan.hasDestructive && allowDestructiveResourceKeys.length === 0) {
|
|
@@ -273,8 +306,10 @@ export async function pipelineDeployCommand(args) {
|
|
|
273
306
|
}
|
|
274
307
|
throw error;
|
|
275
308
|
}
|
|
276
|
-
console.
|
|
277
|
-
if (args.flags
|
|
309
|
+
console.error(`${LOG} enqueued deploy ${enqueue.deploymentId} (trigger=${enqueue.triggerRunId ?? 'n/a'})`);
|
|
310
|
+
if (flagOn(args.flags, 'no-wait')) {
|
|
311
|
+
if (flagOn(args.flags, 'json'))
|
|
312
|
+
console.log(JSON.stringify(enqueue, null, 2));
|
|
278
313
|
return 0;
|
|
279
314
|
}
|
|
280
315
|
return pollDeployment({
|
|
@@ -283,6 +318,7 @@ export async function pipelineDeployCommand(args) {
|
|
|
283
318
|
deploymentId: enqueue.deploymentId,
|
|
284
319
|
environment: env.name,
|
|
285
320
|
timeoutMs: waitTimeoutMs,
|
|
321
|
+
json: flagOn(args.flags, 'json'),
|
|
286
322
|
});
|
|
287
323
|
}
|
|
288
324
|
export async function pipelineStatusCommand(args) {
|
|
@@ -359,9 +395,12 @@ export async function pipelinePromoteCommand(args) {
|
|
|
359
395
|
}
|
|
360
396
|
throw error;
|
|
361
397
|
}
|
|
362
|
-
console.
|
|
363
|
-
if (args.flags
|
|
398
|
+
console.error(`${LOG} enqueued promote plan ${enqueue.planRequestId} (trigger=${enqueue.triggerRunId ?? 'n/a'})`);
|
|
399
|
+
if (flagOn(args.flags, 'no-wait')) {
|
|
400
|
+
if (flagOn(args.flags, 'json'))
|
|
401
|
+
console.log(JSON.stringify(enqueue, null, 2));
|
|
364
402
|
return 0;
|
|
403
|
+
}
|
|
365
404
|
const plan = await waitForPlanRequest({
|
|
366
405
|
baseUrl: env.url,
|
|
367
406
|
token,
|
|
@@ -378,6 +417,7 @@ export async function pipelinePromoteCommand(args) {
|
|
|
378
417
|
deploymentId,
|
|
379
418
|
environment: env.name,
|
|
380
419
|
timeoutMs: waitTimeoutMs,
|
|
420
|
+
json: flagOn(args.flags, 'json'),
|
|
381
421
|
});
|
|
382
422
|
}
|
|
383
423
|
export async function pipelineRunNowCommand(args) {
|
|
@@ -473,15 +513,19 @@ export async function pipelineRollbackCommand(args) {
|
|
|
473
513
|
}
|
|
474
514
|
throw error;
|
|
475
515
|
}
|
|
476
|
-
console.
|
|
477
|
-
if (args.flags
|
|
516
|
+
console.error(`${LOG} enqueued rollback ${enqueue.deploymentId}`);
|
|
517
|
+
if (flagOn(args.flags, 'no-wait')) {
|
|
518
|
+
if (flagOn(args.flags, 'json'))
|
|
519
|
+
console.log(JSON.stringify(enqueue, null, 2));
|
|
478
520
|
return 0;
|
|
521
|
+
}
|
|
479
522
|
return pollDeployment({
|
|
480
523
|
baseUrl: env.url,
|
|
481
524
|
token,
|
|
482
525
|
deploymentId: enqueue.deploymentId,
|
|
483
526
|
environment: env.name,
|
|
484
527
|
timeoutMs: waitTimeoutMs,
|
|
528
|
+
json: flagOn(args.flags, 'json'),
|
|
485
529
|
});
|
|
486
530
|
}
|
|
487
531
|
function printFindingsTable(findings) {
|
|
@@ -497,7 +541,7 @@ function printFindingsTable(findings) {
|
|
|
497
541
|
console.log(`${LOG} ${klass.padEnd(12)} ${f.resourceKey.padEnd(32)} ${f.message}`);
|
|
498
542
|
}
|
|
499
543
|
}
|
|
500
|
-
async function pollDeployment({ baseUrl, token, deploymentId, environment, timeoutMs, }) {
|
|
544
|
+
async function pollDeployment({ baseUrl, token, deploymentId, environment, timeoutMs, json, }) {
|
|
501
545
|
const started = Date.now();
|
|
502
546
|
let lastLoggedLabel = null;
|
|
503
547
|
let lastLogAt = started;
|
|
@@ -509,10 +553,12 @@ async function pollDeployment({ baseUrl, token, deploymentId, environment, timeo
|
|
|
509
553
|
});
|
|
510
554
|
const elapsedMs = Date.now() - started;
|
|
511
555
|
if (TERMINAL.has(detail.status)) {
|
|
556
|
+
if (json)
|
|
557
|
+
console.log(JSON.stringify(detail, null, 2));
|
|
512
558
|
const elapsed = formatElapsed(elapsedMs);
|
|
513
559
|
const progressSuffix = deploymentProgressSuffix(detail);
|
|
514
560
|
if (detail.status === 'active') {
|
|
515
|
-
console.
|
|
561
|
+
console.error(`${LOG} deployment ${deploymentId} succeeded (${elapsed})${progressSuffix}`);
|
|
516
562
|
return 0;
|
|
517
563
|
}
|
|
518
564
|
const detailText = detail.statusDetail ? `: ${detail.statusDetail}` : '';
|
|
@@ -522,12 +568,12 @@ async function pollDeployment({ baseUrl, token, deploymentId, environment, timeo
|
|
|
522
568
|
const progressSuffix = deploymentProgressSuffix(detail);
|
|
523
569
|
const statusLabel = deploymentStatusLabel(detail);
|
|
524
570
|
if (statusLabel !== lastLoggedLabel) {
|
|
525
|
-
console.
|
|
571
|
+
console.error(`${LOG} deployment ${deploymentId}: ${statusLabel} (${formatElapsed(elapsedMs)})${progressSuffix}`);
|
|
526
572
|
lastLoggedLabel = statusLabel;
|
|
527
573
|
lastLogAt = Date.now();
|
|
528
574
|
}
|
|
529
575
|
else if (Date.now() - lastLogAt >= HEARTBEAT_INTERVAL_MS) {
|
|
530
|
-
console.
|
|
576
|
+
console.error(`${LOG} deployment ${deploymentId}: still ${statusLabel} (${formatElapsed(elapsedMs)})${progressSuffix}`);
|
|
531
577
|
lastLogAt = Date.now();
|
|
532
578
|
}
|
|
533
579
|
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
@@ -556,13 +602,13 @@ async function planAttachingCredentials({ request, provision, }) {
|
|
|
556
602
|
throw error;
|
|
557
603
|
if (!(await attachUnattachedCredentials({ request, stageIds: error.stageIds })))
|
|
558
604
|
throw error;
|
|
559
|
-
console.
|
|
605
|
+
console.error(`${LOG} re-planning with the attached secrets`);
|
|
560
606
|
return enqueueAndWaitForPlan(request);
|
|
561
607
|
}
|
|
562
608
|
// A new stage can also plan the legacy way (a same-named secret exists) with
|
|
563
609
|
// nothing attached, and its get_credential would then fail at runtime.
|
|
564
610
|
if (provision && (await attachUnattachedCredentials({ request, stageIds: response.stageIds }))) {
|
|
565
|
-
console.
|
|
611
|
+
console.error(`${LOG} re-planning with the attached secrets`);
|
|
566
612
|
return enqueueAndWaitForPlan(request);
|
|
567
613
|
}
|
|
568
614
|
return response;
|
|
@@ -615,16 +661,20 @@ async function enqueueAndWaitForPlan({ baseUrl, token, repo, ref, root, environm
|
|
|
615
661
|
path: '/api/data-pipelines/pipelines/plan',
|
|
616
662
|
body: { repo, ref, environment, ...rootOption(root), ...(migrationId ? { migration_id: migrationId } : {}), ...(executionMode ? { execution_mode: executionMode } : {}) },
|
|
617
663
|
});
|
|
618
|
-
console.
|
|
664
|
+
console.error(`${LOG} enqueued plan ${enqueue.planRequestId} (trigger=${enqueue.triggerRunId ?? 'n/a'})`);
|
|
619
665
|
const detail = await waitForPlanRequest({
|
|
620
666
|
baseUrl,
|
|
621
667
|
token,
|
|
622
668
|
planRequestId: enqueue.planRequestId,
|
|
623
669
|
});
|
|
670
|
+
return completedPlanResponse(detail);
|
|
671
|
+
}
|
|
672
|
+
function completedPlanResponse(detail) {
|
|
624
673
|
if (!detail.plan || !detail.text) {
|
|
625
674
|
throw new Error(`plan request ${detail.planRequestId} succeeded without a plan result`);
|
|
626
675
|
}
|
|
627
676
|
return {
|
|
677
|
+
planRequestId: detail.planRequestId,
|
|
628
678
|
plan: detail.plan,
|
|
629
679
|
deploymentIds: detail.deploymentIds,
|
|
630
680
|
stageIds: detail.stageIds,
|
|
@@ -640,7 +690,7 @@ async function waitForPlanRequest({ baseUrl, token, planRequestId, }) {
|
|
|
640
690
|
const detail = await getJson({
|
|
641
691
|
baseUrl,
|
|
642
692
|
token,
|
|
643
|
-
path: `/api/data-pipelines/plan-requests/${planRequestId}`,
|
|
693
|
+
path: `/api/data-pipelines/plan-requests/${encodeURIComponent(planRequestId)}`,
|
|
644
694
|
});
|
|
645
695
|
const elapsed = Date.now() - started;
|
|
646
696
|
const statusLabel = detail.statusDetail
|
|
@@ -653,18 +703,19 @@ async function waitForPlanRequest({ baseUrl, token, planRequestId, }) {
|
|
|
653
703
|
if (detail.status === 'succeeded')
|
|
654
704
|
return detail;
|
|
655
705
|
if (statusLabel !== lastStatus) {
|
|
656
|
-
console.
|
|
706
|
+
console.error(`${LOG} plan ${detail.planRequestId}: ${statusLabel} (${formatElapsed(elapsed)})`);
|
|
657
707
|
lastStatus = statusLabel;
|
|
658
708
|
lastLoggedAt = Date.now();
|
|
659
709
|
}
|
|
660
710
|
else if (Date.now() - lastLoggedAt >= HEARTBEAT_INTERVAL_MS) {
|
|
661
|
-
console.
|
|
711
|
+
console.error(`${LOG} plan ${detail.planRequestId}: still ${statusLabel} (${formatElapsed(elapsed)})`);
|
|
662
712
|
lastLoggedAt = Date.now();
|
|
663
713
|
}
|
|
664
714
|
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
665
715
|
}
|
|
666
716
|
throw new Error(`timed out waiting for plan request ${planRequestId} ` +
|
|
667
|
-
`(${formatElapsed(Date.now() - started)})`
|
|
717
|
+
`(${formatElapsed(Date.now() - started)}). Local polling stopped without cancelling the remote plan. ` +
|
|
718
|
+
`Read it again with: seq-studio pipeline plan --plan-request-id ${planRequestId} -e <environment> --json`);
|
|
668
719
|
}
|
|
669
720
|
export async function pipelineAdoptCommand(args) {
|
|
670
721
|
const stage = flagString(args.flags, 'stage');
|
|
@@ -162,8 +162,12 @@ export async function pipelineRepinOrmCommand(args) {
|
|
|
162
162
|
}
|
|
163
163
|
const writes = [];
|
|
164
164
|
for (const stage of pinnedStages) {
|
|
165
|
-
const file = pipeline.files.find((candidate) =>
|
|
166
|
-
|
|
165
|
+
const file = pipeline.files.find((candidate) => {
|
|
166
|
+
const basename = candidate.split('/').at(-1);
|
|
167
|
+
return basename === `${stage.stage}.stage.yml` || basename === `${stage.stage}.stage.yaml`;
|
|
168
|
+
});
|
|
169
|
+
if (!file)
|
|
170
|
+
throw new Error(`could not find the source file for stage '${stage.stage}'`);
|
|
167
171
|
const current = await readFile(join(dir, file), 'utf8');
|
|
168
172
|
const nextHash = nextHashes.get(stage.stage);
|
|
169
173
|
if (!nextHash)
|
|
@@ -160,7 +160,7 @@ function unresolvedReason({ credential, named, matches, }) {
|
|
|
160
160
|
}
|
|
161
161
|
export function printReconcileResult({ result, deployTarget }) {
|
|
162
162
|
for (const { stage, symbolic, managedSecretName } of result.attached) {
|
|
163
|
-
console.
|
|
163
|
+
console.error(`${LOG} attached ${managedSecretName} to ${stage.slug} (${symbolic}) for ${deployTarget}`);
|
|
164
164
|
}
|
|
165
165
|
for (const { stage, symbolic, managedSecretName, reason } of result.unresolved) {
|
|
166
166
|
console.error(`${LOG} ${stage.slug}: credential ${symbolic} has nothing attached for ${deployTarget} — ${reason}. ` +
|
package/dist/process/build.js
CHANGED
|
@@ -387,6 +387,23 @@ function serializeNodeMetadata(node) {
|
|
|
387
387
|
serializeMapperSlot(meta, 'output_mapper', mf.output);
|
|
388
388
|
return meta;
|
|
389
389
|
}
|
|
390
|
+
case 'managed_server': {
|
|
391
|
+
const server = node;
|
|
392
|
+
const meta = {
|
|
393
|
+
server_id: server.server,
|
|
394
|
+
path: server.path,
|
|
395
|
+
};
|
|
396
|
+
if (server.limits)
|
|
397
|
+
meta.limits = server.limits;
|
|
398
|
+
if (server.bindings)
|
|
399
|
+
meta.bindings = server.bindings;
|
|
400
|
+
if (server.run_as?.service_account) {
|
|
401
|
+
meta.run_as = { service_account: server.run_as.service_account };
|
|
402
|
+
}
|
|
403
|
+
serializeMapperSlot(meta, 'input_mapper', server.input);
|
|
404
|
+
serializeMapperSlot(meta, 'output_mapper', server.output);
|
|
405
|
+
return meta;
|
|
406
|
+
}
|
|
390
407
|
default:
|
|
391
408
|
return {};
|
|
392
409
|
}
|
package/dist/process/codegen.js
CHANGED
|
@@ -226,6 +226,22 @@ function emitNode(node, ctx) {
|
|
|
226
226
|
];
|
|
227
227
|
return call('defineManagedFunctionNode', fields);
|
|
228
228
|
}
|
|
229
|
+
case 'managed_server': {
|
|
230
|
+
ctx.used.add('defineManagedServerNode');
|
|
231
|
+
const fields = [
|
|
232
|
+
...head,
|
|
233
|
+
` server: ${lit(String(m.server_id))},`,
|
|
234
|
+
` path: ${lit(String(m.path))},`,
|
|
235
|
+
m.limits !== undefined ? ` limits: ${pretty(m.limits, 1)},` : null,
|
|
236
|
+
runAsField(m.run_as),
|
|
237
|
+
bindings(m.bindings),
|
|
238
|
+
middleware(m.middleware, ctx),
|
|
239
|
+
mapper('input', m.input_mapper_source, m.input_mapper_expr, ctx),
|
|
240
|
+
mapper('output', undefined, m.output_mapper_expr, ctx),
|
|
241
|
+
tail,
|
|
242
|
+
];
|
|
243
|
+
return call('defineManagedServerNode', fields);
|
|
244
|
+
}
|
|
229
245
|
default:
|
|
230
246
|
throw new Error(`codegen: unsupported node kind "${node.kind}" (node "${node.id}")`);
|
|
231
247
|
}
|
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
* happens through `atlas-client.ts` and `getAccessToken()`; commands
|
|
5
5
|
* themselves do not know about the token file or config TOML.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** All string values for flags supplied more than once; `flags` keeps the last value. */
|
|
11
|
-
repeatedFlags?: Record<string, string[]>;
|
|
12
|
-
}
|
|
13
|
-
export declare function parseArgs(rest: string[]): ParsedArgs;
|
|
7
|
+
import { type ParsedArgs } from '../argv.js';
|
|
8
|
+
export { parseArgs } from '../argv.js';
|
|
9
|
+
export type { ParsedArgs } from '../argv.js';
|
|
14
10
|
export type ProcessSourceSpec = {
|
|
15
11
|
kind: 'local';
|
|
16
12
|
} | {
|
|
@@ -65,4 +61,16 @@ export declare function pullCommand(args: ParsedArgs): Promise<number>;
|
|
|
65
61
|
export declare function promoteCommand(args: ParsedArgs): Promise<number>;
|
|
66
62
|
export declare function bundleCommand(args: ParsedArgs): Promise<number>;
|
|
67
63
|
export declare function simulateCommand(args: ParsedArgs): Promise<number>;
|
|
64
|
+
interface RuntimePackageDiagnostic {
|
|
65
|
+
status: 'resolved' | 'unavailable';
|
|
66
|
+
version?: string;
|
|
67
|
+
path?: string;
|
|
68
|
+
packagePath?: string;
|
|
69
|
+
entrypointExists?: boolean;
|
|
70
|
+
configuredOverride?: string;
|
|
71
|
+
overrideExists?: boolean;
|
|
72
|
+
detail?: string;
|
|
73
|
+
}
|
|
74
|
+
/** Resolve this source module's owning package metadata without following its `exports` entry. */
|
|
75
|
+
export declare function runtimePackageMetadataDiagnostic(name: string, modulePath: string): Promise<RuntimePackageDiagnostic>;
|
|
68
76
|
export declare function doctorCommand(args: ParsedArgs): Promise<number>;
|