@sequenceholdings/studio-cli 0.3.0 → 0.4.1
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 +465 -28
- 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 +31 -5
- package/dist/app/application-registration.js +58 -14
- 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.js +8 -0
- package/dist/app/manifest.d.ts +13 -9
- package/dist/app/manifest.js +1 -1
- package/dist/app/primitive-scaffold.d.ts +4 -1
- package/dist/app/primitive-scaffold.js +4 -4
- package/dist/app/readme.js +1 -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 +9 -9
- 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
package/dist/auth.js
CHANGED
|
@@ -8,6 +8,30 @@ import { withCrossProcessFileLock } from './file-lock.js';
|
|
|
8
8
|
function hasErrorCode(error, code) {
|
|
9
9
|
return error instanceof Error && Reflect.get(error, 'code') === code;
|
|
10
10
|
}
|
|
11
|
+
function errorCode(error) {
|
|
12
|
+
const code = error instanceof Error ? Reflect.get(error, 'code') : undefined;
|
|
13
|
+
return typeof code === 'string' ? code : undefined;
|
|
14
|
+
}
|
|
15
|
+
/** A token-cache failure is distinct from an absent or expired login. */
|
|
16
|
+
export class AuthTokenStoreError extends Error {
|
|
17
|
+
kind;
|
|
18
|
+
path;
|
|
19
|
+
name = 'AuthTokenStoreError';
|
|
20
|
+
constructor(message, kind, path, options) {
|
|
21
|
+
super(message, options);
|
|
22
|
+
this.kind = kind;
|
|
23
|
+
this.path = path;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function tokenStoreError(error, operation) {
|
|
27
|
+
const code = errorCode(error);
|
|
28
|
+
if (code !== 'EACCES' && code !== 'EPERM')
|
|
29
|
+
return undefined;
|
|
30
|
+
const path = seqapiTokenPath();
|
|
31
|
+
return new AuthTokenStoreError(`Cannot ${operation} the shared Sequence token cache at ${path}: ${code}. ` +
|
|
32
|
+
`This is a file-permission problem, not an expired login. Check ownership and permissions for ${seqapiTokenDir()}; ` +
|
|
33
|
+
'do not remove a lock file while another Sequence CLI is running.', 'permission', path, { cause: error });
|
|
34
|
+
}
|
|
11
35
|
/**
|
|
12
36
|
* seq-studio and seqapi share one token file and one Auth0 application:
|
|
13
37
|
* same tenant, client id, audience, and token shape. Either CLI can log in,
|
|
@@ -168,6 +192,8 @@ async function discoverLoopbackRealm({ envName, fetchImpl = fetch, targetUrl, })
|
|
|
168
192
|
};
|
|
169
193
|
}
|
|
170
194
|
async function maybeDiscoverLoopbackRealm({ envName, options, }) {
|
|
195
|
+
if (options.offline)
|
|
196
|
+
return undefined;
|
|
171
197
|
if (!envName || !isLoopbackEnvName(envName))
|
|
172
198
|
return undefined;
|
|
173
199
|
const targetUrl = loopbackTargetUrl({
|
|
@@ -261,18 +287,14 @@ function tokenStillValid(entry) {
|
|
|
261
287
|
return Boolean(entry?.accessToken && (entry.expiresAt ?? 0) > now + 60);
|
|
262
288
|
}
|
|
263
289
|
async function loadPersistedM2m(realmName) {
|
|
264
|
-
|
|
290
|
+
const file = await readTokenFile();
|
|
291
|
+
const entry = file?.m2m?.[realmName];
|
|
292
|
+
if (!entry?.access_token)
|
|
265
293
|
return null;
|
|
266
|
-
return
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return null;
|
|
271
|
-
return {
|
|
272
|
-
accessToken: entry.access_token,
|
|
273
|
-
expiresAt: entry.expires_at ?? 0,
|
|
274
|
-
};
|
|
275
|
-
});
|
|
294
|
+
return {
|
|
295
|
+
accessToken: entry.access_token,
|
|
296
|
+
expiresAt: entry.expires_at ?? 0,
|
|
297
|
+
};
|
|
276
298
|
}
|
|
277
299
|
async function persistM2m({ realmName, accessToken, expiresAt, }) {
|
|
278
300
|
await withTokenFileLock(async () => {
|
|
@@ -486,6 +508,8 @@ export async function tryGetAccessTokenWithMode(options) {
|
|
|
486
508
|
catch (err) {
|
|
487
509
|
if (err instanceof UnsafeAuthTargetError)
|
|
488
510
|
throw err;
|
|
511
|
+
if (err instanceof AuthTokenStoreError)
|
|
512
|
+
throw err;
|
|
489
513
|
if (options?.failClosedForM2m) {
|
|
490
514
|
// Do not replace an invalid tenant registration with the Sequence realm:
|
|
491
515
|
// that could hide a rejected discovery token host or inspect the wrong
|
|
@@ -500,6 +524,94 @@ export async function tryGetAccessTokenWithMode(options) {
|
|
|
500
524
|
export async function tryGetAccessToken(options) {
|
|
501
525
|
return (await tryGetAccessTokenWithMode(options))?.token ?? null;
|
|
502
526
|
}
|
|
527
|
+
/**
|
|
528
|
+
* Read-only, non-interactive authentication preflight. This never returns a
|
|
529
|
+
* credential, launches a browser, contacts Auth0, or writes the shared cache.
|
|
530
|
+
* Atomic rename means reading the cache without taking its write lock is safe;
|
|
531
|
+
* importantly, a read-only doctor still works when the cache directory cannot
|
|
532
|
+
* create the lock file.
|
|
533
|
+
*/
|
|
534
|
+
export async function inspectAuthPreflight(options) {
|
|
535
|
+
const authMode = authModePrefersM2m() ? 'm2m' : 'auto';
|
|
536
|
+
// Offline diagnostics intentionally avoid local Auth0 discovery. A local
|
|
537
|
+
// target's actual realm stays unverified until an online command resolves it.
|
|
538
|
+
const realm = await realmForEnv(options?.env, {
|
|
539
|
+
...(options?.offline ? { offline: true } : { targetUrl: options?.targetUrl }),
|
|
540
|
+
});
|
|
541
|
+
const realmVerified = !(options?.offline && options.env && isLoopbackEnvName(options.env));
|
|
542
|
+
const cachePath = seqapiTokenPath();
|
|
543
|
+
const credentialConfigured = Boolean(realm.m2mClientId && process.env[m2mSecretEnvName(realm)]?.trim());
|
|
544
|
+
let file;
|
|
545
|
+
try {
|
|
546
|
+
file = await readTokenFile();
|
|
547
|
+
}
|
|
548
|
+
catch (error) {
|
|
549
|
+
const status = error instanceof AuthTokenStoreError ? error.kind : 'io';
|
|
550
|
+
const tokenCache = status === 'permission'
|
|
551
|
+
? 'permission-denied'
|
|
552
|
+
: status === 'invalid'
|
|
553
|
+
? 'invalid-json'
|
|
554
|
+
: 'io-error';
|
|
555
|
+
return {
|
|
556
|
+
authMode,
|
|
557
|
+
realm: realm.name,
|
|
558
|
+
realmVerified,
|
|
559
|
+
tokenCachePath: cachePath,
|
|
560
|
+
tokenCache,
|
|
561
|
+
cachedUserToken: 'unavailable',
|
|
562
|
+
cachedM2mToken: 'unavailable',
|
|
563
|
+
m2mCredentialConfigured: credentialConfigured,
|
|
564
|
+
selectedCredential: 'unavailable',
|
|
565
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
if (!file) {
|
|
569
|
+
const selectedCredential = credentialConfigured ? 'm2m' : 'none';
|
|
570
|
+
return {
|
|
571
|
+
authMode,
|
|
572
|
+
realm: realm.name,
|
|
573
|
+
realmVerified,
|
|
574
|
+
tokenCachePath: cachePath,
|
|
575
|
+
tokenCache: 'missing',
|
|
576
|
+
cachedUserToken: 'missing',
|
|
577
|
+
cachedM2mToken: 'missing',
|
|
578
|
+
m2mCredentialConfigured: credentialConfigured,
|
|
579
|
+
selectedCredential,
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
const user = realm.name === SEQUENCE_REALM ? file : file.realms?.[realm.name];
|
|
583
|
+
const m2m = file.m2m?.[realm.name];
|
|
584
|
+
const userState = user?.access_token
|
|
585
|
+
? tokenStillValid({ accessToken: user.access_token, expiresAt: user.expires_at })
|
|
586
|
+
? 'valid'
|
|
587
|
+
: 'expired'
|
|
588
|
+
: 'missing';
|
|
589
|
+
const m2mState = m2m?.access_token
|
|
590
|
+
? tokenStillValid({ accessToken: m2m.access_token, expiresAt: m2m.expires_at })
|
|
591
|
+
? 'valid'
|
|
592
|
+
: 'expired'
|
|
593
|
+
: 'missing';
|
|
594
|
+
const selectedCredential = authMode === 'm2m'
|
|
595
|
+
? credentialConfigured
|
|
596
|
+
? 'm2m'
|
|
597
|
+
: 'none'
|
|
598
|
+
: userState === 'valid'
|
|
599
|
+
? 'user'
|
|
600
|
+
: credentialConfigured
|
|
601
|
+
? 'm2m'
|
|
602
|
+
: 'none';
|
|
603
|
+
return {
|
|
604
|
+
authMode,
|
|
605
|
+
realm: realm.name,
|
|
606
|
+
realmVerified,
|
|
607
|
+
tokenCachePath: cachePath,
|
|
608
|
+
tokenCache: 'readable',
|
|
609
|
+
cachedUserToken: userState,
|
|
610
|
+
cachedM2mToken: m2mState,
|
|
611
|
+
m2mCredentialConfigured: credentialConfigured,
|
|
612
|
+
selectedCredential,
|
|
613
|
+
};
|
|
614
|
+
}
|
|
503
615
|
/**
|
|
504
616
|
* Decode the `sub` claim from a JWT without verification. Verification is the
|
|
505
617
|
* server's job — this is only used to compare identities locally (e.g. to
|
|
@@ -572,13 +684,27 @@ export async function currentIdentitySubject(options = {}) {
|
|
|
572
684
|
}
|
|
573
685
|
async function readTokenFile() {
|
|
574
686
|
const path = seqapiTokenPath();
|
|
575
|
-
|
|
576
|
-
return null;
|
|
687
|
+
let text;
|
|
577
688
|
try {
|
|
578
|
-
|
|
689
|
+
text = await readFile(path, 'utf8');
|
|
579
690
|
}
|
|
580
|
-
catch {
|
|
581
|
-
|
|
691
|
+
catch (error) {
|
|
692
|
+
if (hasErrorCode(error, 'ENOENT'))
|
|
693
|
+
return null;
|
|
694
|
+
const permissionError = tokenStoreError(error, 'read');
|
|
695
|
+
if (permissionError)
|
|
696
|
+
throw permissionError;
|
|
697
|
+
throw new AuthTokenStoreError(`Could not read the shared Sequence token cache at ${path}: ${error instanceof Error ? error.message : String(error)}`, 'io', path, { cause: error });
|
|
698
|
+
}
|
|
699
|
+
try {
|
|
700
|
+
const parsed = JSON.parse(text);
|
|
701
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
702
|
+
throw new Error('expected a JSON object');
|
|
703
|
+
}
|
|
704
|
+
return parsed;
|
|
705
|
+
}
|
|
706
|
+
catch (error) {
|
|
707
|
+
throw new AuthTokenStoreError(`The shared Sequence token cache at ${path} is not valid JSON. Preserve a copy before repairing it; do not delete it while another Sequence CLI is running.`, 'invalid', path, { cause: error });
|
|
582
708
|
}
|
|
583
709
|
}
|
|
584
710
|
function stripPersistedRefreshTokens(file) {
|
|
@@ -598,26 +724,37 @@ function stripPersistedRefreshTokens(file) {
|
|
|
598
724
|
return changed;
|
|
599
725
|
}
|
|
600
726
|
export async function loadCachedUserTokens(realmName = SEQUENCE_REALM) {
|
|
601
|
-
|
|
727
|
+
const file = await readTokenFile();
|
|
728
|
+
if (!file)
|
|
602
729
|
return null;
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
730
|
+
const entry = realmName === SEQUENCE_REALM ? file : file.realms?.[realmName];
|
|
731
|
+
if (!entry?.access_token)
|
|
732
|
+
return null;
|
|
733
|
+
if (stripPersistedRefreshTokens(file)) {
|
|
734
|
+
await withTokenFileLock(async () => {
|
|
735
|
+
// Re-read under the inter-CLI lock before the atomic rewrite so another
|
|
736
|
+
// process's realm update is preserved.
|
|
737
|
+
const current = (await readTokenFile()) ?? {};
|
|
738
|
+
if (stripPersistedRefreshTokens(current))
|
|
739
|
+
await writeTokenFile(current);
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
return {
|
|
743
|
+
access_token: entry.access_token,
|
|
744
|
+
expires_at: entry.expires_at,
|
|
745
|
+
};
|
|
618
746
|
}
|
|
619
747
|
async function withTokenFileLock(operation) {
|
|
620
|
-
|
|
748
|
+
const path = seqapiTokenPath();
|
|
749
|
+
try {
|
|
750
|
+
return await withCrossProcessFileLock({ operation, path });
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
const permissionError = tokenStoreError(error, 'lock or update');
|
|
754
|
+
if (permissionError)
|
|
755
|
+
throw permissionError;
|
|
756
|
+
throw error;
|
|
757
|
+
}
|
|
621
758
|
}
|
|
622
759
|
async function writeTokenFile(tokens) {
|
|
623
760
|
const path = seqapiTokenPath();
|
package/dist/bin.js
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { run } from './main.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { parseArgs } from './argv.js';
|
|
4
|
+
// A consumer may close stdout while a remote operation continues. Stop local
|
|
5
|
+
// output quietly; never cancel or retry the remote operation.
|
|
6
|
+
process.stdout.on('error', (error) => {
|
|
7
|
+
if (error.code === 'EPIPE')
|
|
8
|
+
process.exit(0);
|
|
9
|
+
else
|
|
10
|
+
throw error;
|
|
11
|
+
});
|
|
12
|
+
const argv = process.argv.slice(2);
|
|
13
|
+
const isHelpOrDiscovery = argv.includes('--help') || argv.includes('-h') || argv[0] === 'help' || argv[0] === 'capabilities';
|
|
14
|
+
const doctorOffline = argv[0] === 'doctor' && (() => {
|
|
15
|
+
const value = parseArgs(argv.slice(1)).flags.offline;
|
|
16
|
+
return value === true || value === 'true';
|
|
17
|
+
})();
|
|
18
|
+
run(argv)
|
|
5
19
|
.catch((error) => {
|
|
6
20
|
console.error(error instanceof Error ? error.message : error);
|
|
7
21
|
return 1;
|
|
@@ -9,6 +23,11 @@ run()
|
|
|
9
23
|
// The update notice runs after the command so it never delays real output,
|
|
10
24
|
// and it is best-effort (never throws, never changes the exit code).
|
|
11
25
|
.then(async (code) => {
|
|
12
|
-
|
|
13
|
-
|
|
26
|
+
if (!isHelpOrDiscovery && !doctorOffline) {
|
|
27
|
+
const { maybeNotifyUpdate } = await import('./update-check.js');
|
|
28
|
+
await maybeNotifyUpdate();
|
|
29
|
+
}
|
|
30
|
+
// Forced exit discards queued stdout/stderr when callers pipe large JSON
|
|
31
|
+
// responses. Let Node drain pending writes before exiting with this status.
|
|
32
|
+
process.exitCode = code;
|
|
14
33
|
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/** Machine-readable summary of the CLI surface, kept independent of command implementations. */
|
|
2
|
+
export declare const COMMAND_CONTRACT: readonly [{
|
|
3
|
+
readonly name: "init";
|
|
4
|
+
readonly description: "Scaffold an app workspace";
|
|
5
|
+
readonly lifecycle: "internal";
|
|
6
|
+
readonly access: "offline";
|
|
7
|
+
readonly subcommands: readonly [];
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "add";
|
|
10
|
+
readonly description: "Add a primitive to an app workspace";
|
|
11
|
+
readonly lifecycle: "internal";
|
|
12
|
+
readonly access: "offline";
|
|
13
|
+
readonly subcommands: readonly [];
|
|
14
|
+
}, {
|
|
15
|
+
readonly name: "deploy";
|
|
16
|
+
readonly description: "Deploy an app workspace";
|
|
17
|
+
readonly lifecycle: "internal";
|
|
18
|
+
readonly access: "authenticated";
|
|
19
|
+
readonly subcommands: readonly [];
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "process";
|
|
22
|
+
readonly description: "Build and operate Lattice processes";
|
|
23
|
+
readonly lifecycle: "preview";
|
|
24
|
+
readonly access: "mixed";
|
|
25
|
+
readonly subcommands: readonly ["init", "lint", "plan", "apply", "test", "simulate", "bundle", "promote", "pull", "safety-baseline"];
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "artifact";
|
|
28
|
+
readonly description: "Build and operate Artifact Studio apps";
|
|
29
|
+
readonly lifecycle: "stable";
|
|
30
|
+
readonly access: "mixed";
|
|
31
|
+
readonly subcommands: readonly ["init", "whoami", "link", "env", "status", "list", "show", "validate", "build", "plan", "deploy", "dev", "promote", "pull", "rollback"];
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "functions";
|
|
34
|
+
readonly description: "Build and operate Managed Functions";
|
|
35
|
+
readonly lifecycle: "stable";
|
|
36
|
+
readonly access: "authenticated";
|
|
37
|
+
readonly subcommands: readonly ["init", "build", "deploy", "list", "show", "limits", "invoke", "logs", "promote", "rollback", "delete"];
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "agents";
|
|
40
|
+
readonly description: "Validate and deploy typed agent definitions";
|
|
41
|
+
readonly lifecycle: "preview";
|
|
42
|
+
readonly access: "mixed";
|
|
43
|
+
readonly subcommands: readonly ["init", "validate", "plan", "apply", "list", "show"];
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "secrets";
|
|
46
|
+
readonly description: "Manage organization-owned secrets";
|
|
47
|
+
readonly lifecycle: "stable";
|
|
48
|
+
readonly access: "authenticated";
|
|
49
|
+
readonly subcommands: readonly ["create", "set", "list", "attach", "detach", "apply"];
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "repos";
|
|
52
|
+
readonly description: "Manage platform Git Service repositories";
|
|
53
|
+
readonly lifecycle: "stable";
|
|
54
|
+
readonly access: "authenticated";
|
|
55
|
+
readonly subcommands: readonly ["list", "namespaces", "show", "create", "clone", "pull", "pulls", "delete"];
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "pipeline";
|
|
58
|
+
readonly description: "Discover and operate Data Pipelines";
|
|
59
|
+
readonly lifecycle: "preview";
|
|
60
|
+
readonly access: "staff";
|
|
61
|
+
readonly subcommands: readonly ["list", "assets", "search", "describe", "schema", "sample", "query", "init", "validate", "plan", "deploy", "status", "migrate", "adopt", "unbind", "run-now", "promote", "rollback"];
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "auth";
|
|
64
|
+
readonly description: "Manage Git Service personal access tokens";
|
|
65
|
+
readonly lifecycle: "stable";
|
|
66
|
+
readonly access: "authenticated";
|
|
67
|
+
readonly subcommands: readonly ["whoami", "pat"];
|
|
68
|
+
}, {
|
|
69
|
+
readonly name: "orm";
|
|
70
|
+
readonly description: "Author and operate ORM namespaces";
|
|
71
|
+
readonly lifecycle: "preview";
|
|
72
|
+
readonly access: "mixed";
|
|
73
|
+
readonly subcommands: readonly ["init", "generate", "validate", "plan", "apply", "execute", "diff", "migrate-from-yaml", "import"];
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "envs";
|
|
76
|
+
readonly description: "Manage CLI environments";
|
|
77
|
+
readonly lifecycle: "stable";
|
|
78
|
+
readonly access: "mixed";
|
|
79
|
+
readonly subcommands: readonly ["add", "list", "refresh"];
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "login";
|
|
82
|
+
readonly description: "Authenticate with Sequence";
|
|
83
|
+
readonly lifecycle: "stable";
|
|
84
|
+
readonly access: "public";
|
|
85
|
+
readonly subcommands: readonly [];
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "logout";
|
|
88
|
+
readonly description: "Remove cached user tokens";
|
|
89
|
+
readonly lifecycle: "stable";
|
|
90
|
+
readonly access: "public";
|
|
91
|
+
readonly subcommands: readonly [];
|
|
92
|
+
}, {
|
|
93
|
+
readonly name: "doctor";
|
|
94
|
+
readonly description: "Diagnose CLI configuration and access";
|
|
95
|
+
readonly lifecycle: "stable";
|
|
96
|
+
readonly access: "mixed";
|
|
97
|
+
readonly subcommands: readonly [];
|
|
98
|
+
}, {
|
|
99
|
+
readonly name: "version";
|
|
100
|
+
readonly description: "Print the installed CLI version";
|
|
101
|
+
readonly lifecycle: "stable";
|
|
102
|
+
readonly access: "offline";
|
|
103
|
+
readonly subcommands: readonly [];
|
|
104
|
+
}, {
|
|
105
|
+
readonly name: "help";
|
|
106
|
+
readonly description: "Show command help";
|
|
107
|
+
readonly lifecycle: "stable";
|
|
108
|
+
readonly access: "offline";
|
|
109
|
+
readonly subcommands: readonly [];
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "storage";
|
|
112
|
+
readonly description: "Manage platform storage";
|
|
113
|
+
readonly lifecycle: "blocked";
|
|
114
|
+
readonly access: "authenticated";
|
|
115
|
+
readonly subcommands: readonly ["init", "validate", "apply", "list", "show", "mkdir", "upload", "download", "access", "trash", "restore", "purge", "operations", "abort", "delete"];
|
|
116
|
+
}, {
|
|
117
|
+
readonly name: "access";
|
|
118
|
+
readonly description: "Manage runtime resource access";
|
|
119
|
+
readonly lifecycle: "preview";
|
|
120
|
+
readonly access: "authenticated";
|
|
121
|
+
readonly subcommands: readonly ["definitions", "list", "grant", "revoke", "resolve"];
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "service-accounts";
|
|
124
|
+
readonly description: "Manage runtime service accounts";
|
|
125
|
+
readonly lifecycle: "preview";
|
|
126
|
+
readonly access: "authenticated";
|
|
127
|
+
readonly subcommands: readonly ["list", "show", "create"];
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "capabilities";
|
|
130
|
+
readonly description: "Print the supported CLI command surface";
|
|
131
|
+
readonly lifecycle: "blocked";
|
|
132
|
+
readonly access: "offline";
|
|
133
|
+
readonly subcommands: readonly [];
|
|
134
|
+
}];
|
|
135
|
+
export declare function renderCapabilities({ json }?: {
|
|
136
|
+
json?: boolean;
|
|
137
|
+
}): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Machine-readable summary of the CLI surface, kept independent of command implementations. */
|
|
2
|
+
export const COMMAND_CONTRACT = [
|
|
3
|
+
{ name: 'init', description: 'Scaffold an app workspace', lifecycle: 'internal', access: 'offline', subcommands: [] },
|
|
4
|
+
{ name: 'add', description: 'Add a primitive to an app workspace', lifecycle: 'internal', access: 'offline', subcommands: [] },
|
|
5
|
+
{ name: 'deploy', description: 'Deploy an app workspace', lifecycle: 'internal', access: 'authenticated', subcommands: [] },
|
|
6
|
+
{ name: 'process', description: 'Build and operate Lattice processes', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'lint', 'plan', 'apply', 'test', 'simulate', 'bundle', 'promote', 'pull', 'safety-baseline'] },
|
|
7
|
+
{ name: 'artifact', description: 'Build and operate Artifact Studio apps', lifecycle: 'stable', access: 'mixed', subcommands: ['init', 'whoami', 'link', 'env', 'status', 'list', 'show', 'validate', 'build', 'plan', 'deploy', 'dev', 'promote', 'pull', 'rollback'] },
|
|
8
|
+
{ name: 'functions', description: 'Build and operate Managed Functions', lifecycle: 'stable', access: 'authenticated', subcommands: ['init', 'build', 'deploy', 'list', 'show', 'limits', 'invoke', 'logs', 'promote', 'rollback', 'delete'] },
|
|
9
|
+
{ name: 'agents', description: 'Validate and deploy typed agent definitions', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'validate', 'plan', 'apply', 'list', 'show'] },
|
|
10
|
+
{ name: 'secrets', description: 'Manage organization-owned secrets', lifecycle: 'stable', access: 'authenticated', subcommands: ['create', 'set', 'list', 'attach', 'detach', 'apply'] },
|
|
11
|
+
{ name: 'repos', description: 'Manage platform Git Service repositories', lifecycle: 'stable', access: 'authenticated', subcommands: ['list', 'namespaces', 'show', 'create', 'clone', 'pull', 'pulls', 'delete'] },
|
|
12
|
+
{ name: 'pipeline', description: 'Discover and operate Data Pipelines', lifecycle: 'preview', access: 'staff', subcommands: ['list', 'assets', 'search', 'describe', 'schema', 'sample', 'query', 'init', 'validate', 'plan', 'deploy', 'status', 'migrate', 'adopt', 'unbind', 'run-now', 'promote', 'rollback'] },
|
|
13
|
+
{ name: 'auth', description: 'Manage Git Service personal access tokens', lifecycle: 'stable', access: 'authenticated', subcommands: ['whoami', 'pat'] },
|
|
14
|
+
{ name: 'orm', description: 'Author and operate ORM namespaces', lifecycle: 'preview', access: 'mixed', subcommands: ['init', 'generate', 'validate', 'plan', 'apply', 'execute', 'diff', 'migrate-from-yaml', 'import'] },
|
|
15
|
+
{ name: 'envs', description: 'Manage CLI environments', lifecycle: 'stable', access: 'mixed', subcommands: ['add', 'list', 'refresh'] },
|
|
16
|
+
{ name: 'login', description: 'Authenticate with Sequence', lifecycle: 'stable', access: 'public', subcommands: [] },
|
|
17
|
+
{ name: 'logout', description: 'Remove cached user tokens', lifecycle: 'stable', access: 'public', subcommands: [] },
|
|
18
|
+
{ name: 'doctor', description: 'Diagnose CLI configuration and access', lifecycle: 'stable', access: 'mixed', subcommands: [] },
|
|
19
|
+
{ name: 'version', description: 'Print the installed CLI version', lifecycle: 'stable', access: 'offline', subcommands: [] },
|
|
20
|
+
{ name: 'help', description: 'Show command help', lifecycle: 'stable', access: 'offline', subcommands: [] },
|
|
21
|
+
{ name: 'storage', description: 'Manage platform storage', lifecycle: 'blocked', access: 'authenticated', subcommands: ['init', 'validate', 'apply', 'list', 'show', 'mkdir', 'upload', 'download', 'access', 'trash', 'restore', 'purge', 'operations', 'abort', 'delete'] },
|
|
22
|
+
{ name: 'access', description: 'Manage runtime resource access', lifecycle: 'preview', access: 'authenticated', subcommands: ['definitions', 'list', 'grant', 'revoke', 'resolve'] },
|
|
23
|
+
{ name: 'service-accounts', description: 'Manage runtime service accounts', lifecycle: 'preview', access: 'authenticated', subcommands: ['list', 'show', 'create'] },
|
|
24
|
+
{ name: 'capabilities', description: 'Print the supported CLI command surface', lifecycle: 'blocked', access: 'offline', subcommands: [] },
|
|
25
|
+
];
|
|
26
|
+
export function renderCapabilities({ json = false } = {}) {
|
|
27
|
+
const commands = COMMAND_CONTRACT.map(({ name, description, lifecycle, access, subcommands }) => ({
|
|
28
|
+
name,
|
|
29
|
+
description,
|
|
30
|
+
lifecycle,
|
|
31
|
+
access,
|
|
32
|
+
subcommands: [...subcommands],
|
|
33
|
+
}));
|
|
34
|
+
if (json)
|
|
35
|
+
return JSON.stringify({ version: 1, commands }, null, 2);
|
|
36
|
+
return [
|
|
37
|
+
'seq-studio capabilities (version 1)',
|
|
38
|
+
...commands.map(({ name, description, lifecycle, access, subcommands }) => ` ${name.padEnd(18)} ${lifecycle}/${access} ${description}${subcommands.length ? ` [${subcommands.join(', ')}]` : ''}`),
|
|
39
|
+
'',
|
|
40
|
+
'Lifecycle: stable, preview, internal, or blocked. Access: offline, public, mixed, authenticated, or staff.',
|
|
41
|
+
'Use `seq-studio <command> --help` for command usage. This summary does not promise an underlying HTTP API.',
|
|
42
|
+
].join('\n');
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Help text reachable before command implementations, auth, optional SDKs, or Atlas clients load. */
|
|
2
|
+
export declare const ORM_HELP = "usage:\n seq-studio orm init <dir>\n seq-studio orm generate [dir] [--migration-export] [--check]\n seq-studio orm validate [dir]\n seq-studio orm plan [dir] -e <env>\n seq-studio orm apply [dir] -e <env>\n seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>\n seq-studio orm diff [dir] [--check] [--allow-destructive] [--rebase]\n seq-studio orm migrate-from-yaml <dir>\n seq-studio orm import [dir] --spec <file> | --table <table> --from <schema.table> --map <target=source,...>\n\n -e/--env is required for commands that contact Atlas. Use seq-studio envs list\n to discover environments and seq-studio login to authenticate.\n";
|
|
3
|
+
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 function staticHelp({ namespace, sub }: {
|
|
6
|
+
namespace: string;
|
|
7
|
+
sub?: string;
|
|
8
|
+
}): string | undefined;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** Help text reachable before command implementations, auth, optional SDKs, or Atlas clients load. */
|
|
2
|
+
export const ORM_HELP = `usage:
|
|
3
|
+
seq-studio orm init <dir>
|
|
4
|
+
seq-studio orm generate [dir] [--migration-export] [--check]
|
|
5
|
+
seq-studio orm validate [dir]
|
|
6
|
+
seq-studio orm plan [dir] -e <env>
|
|
7
|
+
seq-studio orm apply [dir] -e <env>
|
|
8
|
+
seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>
|
|
9
|
+
seq-studio orm diff [dir] [--check] [--allow-destructive] [--rebase]
|
|
10
|
+
seq-studio orm migrate-from-yaml <dir>
|
|
11
|
+
seq-studio orm import [dir] --spec <file> | --table <table> --from <schema.table> --map <target=source,...>
|
|
12
|
+
|
|
13
|
+
-e/--env is required for commands that contact Atlas. Use seq-studio envs list
|
|
14
|
+
to discover environments and seq-studio login to authenticate.
|
|
15
|
+
`;
|
|
16
|
+
export const ARTIFACT_HELP = `usage:
|
|
17
|
+
seq-studio artifact init <dir> [--template react-vite|nextjs]
|
|
18
|
+
seq-studio artifact whoami -e <env>
|
|
19
|
+
seq-studio artifact link [dir] -e <env> [--project <id>]
|
|
20
|
+
seq-studio artifact env list|use <env>
|
|
21
|
+
seq-studio artifact status [-e <env>]
|
|
22
|
+
seq-studio artifact list -e <env> [--json]
|
|
23
|
+
seq-studio artifact show <slug-or-id> -e <env> [--json]
|
|
24
|
+
seq-studio artifact validate [dir]
|
|
25
|
+
seq-studio artifact build|plan|deploy [dir | --repo <namespace>/<name> | --git-url <url>] [--ref <ref>] -e <env>
|
|
26
|
+
seq-studio artifact dev [dir] -e <env> [--once] [--key <name>] [--link <package-dir>] [--port <port>]
|
|
27
|
+
seq-studio artifact pull <project-id> -e <env> --out <dir>
|
|
28
|
+
seq-studio artifact promote|rollback <deployment-id> -e <env>
|
|
29
|
+
|
|
30
|
+
Help is available offline. Authenticate with seq-studio login. Build and deploy
|
|
31
|
+
sources may be local, a platform git-service repo, or a public HTTPS Git URL;
|
|
32
|
+
deployments target a named environment with -e. Local, preview, and official
|
|
33
|
+
deployment workflows have different source and approval rules; see the public
|
|
34
|
+
CLI README.
|
|
35
|
+
`;
|
|
36
|
+
export const PIPELINE_HELP = `usage:
|
|
37
|
+
seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]
|
|
38
|
+
list pipeline repository rollups (not assets)
|
|
39
|
+
seq-studio pipeline assets -e <env> [--repo <namespace>/<slug>] [--json]
|
|
40
|
+
list asset declarations, including assets that may not be deployed
|
|
41
|
+
seq-studio pipeline search <query> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--limit N] [--offset N] [--json]
|
|
42
|
+
seq-studio pipeline describe <asset-id> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--json]
|
|
43
|
+
seq-studio pipeline schema|sample <asset-id> -e <env> [--target <id>] [--limit N] [--json]
|
|
44
|
+
seq-studio pipeline query <asset-id> --sql <read-only-sql> -e <env> [--target <id>] [--limit N] [--json]
|
|
45
|
+
seq-studio pipeline init|validate|plan|deploy|status|migrate|adopt|unbind|run-now|promote|rollback ...
|
|
46
|
+
seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]
|
|
47
|
+
poll an existing durable plan without enqueueing or attaching credentials
|
|
48
|
+
Lifecycle --json results use stdout; progress uses stderr. Deploy --run-now
|
|
49
|
+
executes producers in the managed worker; local polling may disconnect.
|
|
50
|
+
|
|
51
|
+
Discovery requires staff access. Use list for pipeline repositories, assets
|
|
52
|
+
for declared assets, and search/describe for active deployment metadata;
|
|
53
|
+
use schema to verify physical columns. -e chooses the environment and
|
|
54
|
+
--target chooses a logical target when the environment has more than one.
|
|
55
|
+
Help is available offline.
|
|
56
|
+
`;
|
|
57
|
+
export function staticHelp({ namespace, sub }) {
|
|
58
|
+
if (namespace === 'artifact')
|
|
59
|
+
return ARTIFACT_HELP;
|
|
60
|
+
if (namespace === 'orm')
|
|
61
|
+
return ORM_HELP;
|
|
62
|
+
if (namespace === 'pipeline')
|
|
63
|
+
return PIPELINE_HELP;
|
|
64
|
+
if (namespace === 'doctor') {
|
|
65
|
+
return `usage: seq-studio doctor [-e <env>] [--json] [--offline]\n\nDiagnose config, auth, local service availability, CLI/SDK resolution, and deployment access. --offline reads local metadata without discovery or HTTP requests. Help is available offline.\n`;
|
|
66
|
+
}
|
|
67
|
+
if (namespace === 'process' && (!sub || sub === 'help' || sub === '--help' || sub === '-h')) {
|
|
68
|
+
return `usage: seq-studio process <init|lint|plan|apply|promote|pull|test|simulate|bundle> [args]\n\nHelp is available offline.\n`;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
@@ -93,5 +93,5 @@ export declare function functionsRollbackCommand(args: ParsedArgs): Promise<numb
|
|
|
93
93
|
/** Minimal dotenv parser — KEY=VALUE lines, quotes stripped, comments skipped. */
|
|
94
94
|
export declare function parseDotenv(content: string): Record<string, string>;
|
|
95
95
|
export declare function functionsDeleteCommand(args: ParsedArgs): Promise<number>;
|
|
96
|
-
export declare const FUNCTIONS_USAGE = "usage:\n seq-studio functions init <dir> scaffold manifest
|
|
96
|
+
export declare const FUNCTIONS_USAGE = "usage:\n seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers\n seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)\n seq-studio functions register -e <env> [--dir d] register a function shell without deploying\n seq-studio functions deploy -e <env> [-m msg] preflight deployed capabilities, then upload and deploy\n seq-studio functions list -e <env> [--match-local] functions visible on the environment\n seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)\n seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy\n [--fn slug] also show effective runtime limits (requires -e)\n seq-studio functions dev [--dir path] [--port 8080] local HTTP server with cache context\n seq-studio functions invoke -e <env> [--data JSON | --data @file | --stdin]\n invoke a function and print its response\n seq-studio functions logs -e <env> [--limit N] [--since t] function logs (reader-gated)\n seq-studio functions promote <version> -e <env> make a version live\n seq-studio functions rollback [<version>] -e <env> redeploy a prior version\n seq-studio functions delete -e <env> [--yes] archive function + tear down its runtime\n (version history is retained)\n\n Flags: -e/--env <env|preview:<slug>> (required for network commands; see: seq-studio envs list) \u00B7 --fn <slug> \u00B7 --dir <path>\n --path <repo-subdirectory> (remote build/deploy only) select one function in a multi-function repo\n --from-env-file <path> (default: .env) source file for secret values\n --no-wait \u00B7 --yes\n --no-provision (deploy) update-only: error instead of registering a new\n shell, writing secret values, or attaching secrets (CI sweep)\n\n Local Atlas builds and runs deployed functions on this computer, including teardown.\n \"functions dev\" runs a standalone handler without Atlas registration.\n\n Configure per-function CPU and concurrency in managed-function.yml under limits.\n Run \"functions limits\" for valid settings; redeploy to apply manifest changes.\n Invocation rates are shared across Atlas replicas; 429 includes Retry-After.\n If the shared rate limiter is unavailable, invocation fails closed with 503.\n\n Source for build/deploy: a local --dir (default .), a platform git-service\n repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --path selects\n a function directory within a remote repo; omit it for the existing root-manifest\n layout. --ref selects a branch/tag/commit (default: the repo's default branch).\n Remote sources record the pinned commit as provenance (never dirty) and NEVER\n read a repo-committed .env for secret values \u2014 provision secrets server-side\n or pass a local --from-env-file (resolved against your cwd).\n\n Interactive --repo builds clone over smart-HTTP and require a repo:read git\n PAT in ATLAS_GIT_PAT (`seq-studio auth pat create --scopes repo:read`, or\n Atlas \u2192 Settings \u2192 Tokens). Headless M2M builds use JSON materialize and\n accept only platform-managed --repo sources. Interactive builds also need\n --env + seq-studio login to resolve the repo and deploy.\n";
|
|
97
97
|
export declare function runFunctionsCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|
|
@@ -11,8 +11,11 @@ import { getAccessTokenWithMode, tryGetAccessTokenWithMode } from '../auth.js';
|
|
|
11
11
|
import { resolveEnvWithDiscovery } from '../config.js';
|
|
12
12
|
import { AtlasApiError, deleteJson, getJson, postJson, postJsonResponse, } from '../atlas-client.js';
|
|
13
13
|
import { clarifyApplyFailureReason, printCliError } from '../cli-errors.js';
|
|
14
|
+
import { currentVersion } from '../update-check.js';
|
|
15
|
+
import { localSdkPreflight, preflightBeforeUpload, reportPreflight } from './deploy-preflight.js';
|
|
14
16
|
import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
|
|
15
17
|
import { confirmYes } from '../prompt.js';
|
|
18
|
+
import { writeScaffoldGuidance } from '../scaffold-guidance.js';
|
|
16
19
|
import { collectBundleFiles, isDirectory, validateLocalBundle, } from './bundle.js';
|
|
17
20
|
import { managedFunctionManifestSchema, MF_MANIFEST_FILENAME, manifestEgressHosts, manifestEgressIpRanges, manifestSecretNames, } from './manifest.js';
|
|
18
21
|
import { buildEgressPreviewLines, egressPropagationNote, formatEgressSummary, printFunctionEgressHosts, } from './egress-preview.js';
|
|
@@ -360,7 +363,9 @@ export async function functionsInitCommand(args) {
|
|
|
360
363
|
await writeFile(join(dir, 'package.json'), TEMPLATE_PACKAGE_JSON(id));
|
|
361
364
|
await writeFile(join(dir, '.gitignore'), TEMPLATE_GITIGNORE);
|
|
362
365
|
await writeFile(join(dir, '.npmrc'), TEMPLATE_NPMRC);
|
|
366
|
+
await writeScaffoldGuidance({ directory: dir });
|
|
363
367
|
console.log(`${LOG} scaffolded managed function "${id}" (TypeScript) in ${dir}`);
|
|
368
|
+
console.log(`${LOG} AGENTS.md points to your environment's live docs; CLAUDE.md imports it`);
|
|
364
369
|
console.log('');
|
|
365
370
|
console.log('Next steps (init is only needed when creating a function from scratch):');
|
|
366
371
|
console.log(` cd ${target}`);
|
|
@@ -412,6 +417,9 @@ async function buildFromResolvedSource({ spec, source, }) {
|
|
|
412
417
|
log(`${LOG} ${issue.level}: ${issue.message}`);
|
|
413
418
|
}
|
|
414
419
|
const errors = issues.filter((i) => i.level === 'error');
|
|
420
|
+
const sdkIssues = await localSdkPreflight({ rootDir: dir, manifest, cliVersion: currentVersion() });
|
|
421
|
+
if (reportPreflight(sdkIssues))
|
|
422
|
+
return 1;
|
|
415
423
|
if (errors.length > 0) {
|
|
416
424
|
console.error(`${LOG} build check failed (${errors.length} error${errors.length === 1 ? '' : 's'})`);
|
|
417
425
|
return 1;
|
|
@@ -510,6 +518,14 @@ async function deployFromResolvedSource({ args, spec, ctx: earlyCtx, source, })
|
|
|
510
518
|
// A --repo source authenticated before materialization; local / git-url
|
|
511
519
|
// sources authenticate only now, after local validation passed.
|
|
512
520
|
const ctx = earlyCtx ?? (await buildContext(args));
|
|
521
|
+
const capabilityIssues = await preflightBeforeUpload({
|
|
522
|
+
client: clientOptions(ctx),
|
|
523
|
+
rootDir: dir,
|
|
524
|
+
manifest,
|
|
525
|
+
cliVersion: currentVersion(),
|
|
526
|
+
});
|
|
527
|
+
if (reportPreflight(capabilityIssues))
|
|
528
|
+
return 1;
|
|
513
529
|
const slug = manifest.function.id;
|
|
514
530
|
const singleSecrets = manifest.secrets.filter((entry) => typeof entry === 'string');
|
|
515
531
|
const declaredSecretNames = manifestSecretNames(manifest);
|
|
@@ -1150,10 +1166,10 @@ export async function functionsDeleteCommand(args) {
|
|
|
1150
1166
|
// dispatcher
|
|
1151
1167
|
// ---------------------------------------------------------------------------
|
|
1152
1168
|
export const FUNCTIONS_USAGE = `usage:
|
|
1153
|
-
seq-studio functions init <dir> scaffold manifest
|
|
1154
|
-
seq-studio functions build [--dir d] local pre-flight (manifest, lockfile,
|
|
1169
|
+
seq-studio functions init <dir> scaffold manifest, TypeScript handler, and docs pointers
|
|
1170
|
+
seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)
|
|
1155
1171
|
seq-studio functions register -e <env> [--dir d] register a function shell without deploying
|
|
1156
|
-
seq-studio functions deploy -e <env> [-m msg]
|
|
1172
|
+
seq-studio functions deploy -e <env> [-m msg] preflight deployed capabilities, then upload and deploy
|
|
1157
1173
|
seq-studio functions list -e <env> [--match-local] functions visible on the environment
|
|
1158
1174
|
seq-studio functions show -e <env> [--fn slug] detail for one function (versions, secrets)
|
|
1159
1175
|
seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy
|