@sequenceholdings/studio-cli 0.1.9
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 +258 -0
- package/dist/artifact/delegate.d.ts +25 -0
- package/dist/artifact/delegate.js +263 -0
- package/dist/atlas-client.d.ts +44 -0
- package/dist/atlas-client.js +173 -0
- package/dist/auth-cmds/commands.d.ts +15 -0
- package/dist/auth-cmds/commands.js +249 -0
- package/dist/auth.d.ts +26 -0
- package/dist/auth.js +171 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +8 -0
- package/dist/cli-errors.d.ts +5 -0
- package/dist/cli-errors.js +78 -0
- package/dist/config.d.ts +44 -0
- package/dist/config.js +103 -0
- package/dist/env-flags.d.ts +8 -0
- package/dist/env-flags.js +47 -0
- package/dist/functions/bundle.d.ts +30 -0
- package/dist/functions/bundle.js +137 -0
- package/dist/functions/commands.d.ts +86 -0
- package/dist/functions/commands.js +999 -0
- package/dist/functions/egress-preview.d.ts +32 -0
- package/dist/functions/egress-preview.js +54 -0
- package/dist/functions/lockfile-origin.d.ts +16 -0
- package/dist/functions/lockfile-origin.js +45 -0
- package/dist/functions/manifest.d.ts +89 -0
- package/dist/functions/manifest.js +586 -0
- package/dist/functions/secret-reconcile.d.ts +79 -0
- package/dist/functions/secret-reconcile.js +86 -0
- package/dist/main.d.ts +14 -0
- package/dist/main.js +129 -0
- package/dist/orm/delegate.d.ts +8 -0
- package/dist/orm/delegate.js +61 -0
- package/dist/pat-hints.d.ts +17 -0
- package/dist/pat-hints.js +28 -0
- package/dist/preview.d.ts +89 -0
- package/dist/preview.js +291 -0
- package/dist/process/agent-loader.d.ts +24 -0
- package/dist/process/agent-loader.js +57 -0
- package/dist/process/build.d.ts +14 -0
- package/dist/process/build.js +368 -0
- package/dist/process/codegen.d.ts +18 -0
- package/dist/process/codegen.js +270 -0
- package/dist/process/commands.d.ts +47 -0
- package/dist/process/commands.js +786 -0
- package/dist/process/discover.d.ts +32 -0
- package/dist/process/discover.js +131 -0
- package/dist/process/lint.d.ts +39 -0
- package/dist/process/lint.js +485 -0
- package/dist/process/local-bundle.d.ts +17 -0
- package/dist/process/local-bundle.js +65 -0
- package/dist/process/plan-diff.d.ts +82 -0
- package/dist/process/plan-diff.js +333 -0
- package/dist/process/resolve-process-pin.d.ts +11 -0
- package/dist/process/resolve-process-pin.js +63 -0
- package/dist/process/simulate.d.ts +50 -0
- package/dist/process/simulate.js +328 -0
- package/dist/prompt.d.ts +35 -0
- package/dist/prompt.js +65 -0
- package/dist/repos/commands.d.ts +49 -0
- package/dist/repos/commands.js +548 -0
- package/dist/repos/git-clone.d.ts +10 -0
- package/dist/repos/git-clone.js +49 -0
- package/dist/secrets/commands.d.ts +24 -0
- package/dist/secrets/commands.js +704 -0
- package/dist/templates/process/example-process/process.ts +43 -0
- package/dist/templates/process/package.json +23 -0
- package/dist/templates/process/pnpm-workspace.yaml +21 -0
- package/dist/templates/process/tsconfig.json +17 -0
- package/package.json +78 -0
- package/templates/process/example-process/process.ts +43 -0
- package/templates/process/package.json +23 -0
- package/templates/process/pnpm-workspace.yaml +21 -0
- package/templates/process/tsconfig.json +17 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal preview lines for manifest egress — mirrors `buildSecretPreviewLines`
|
|
3
|
+
* in secret-reconcile.ts.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* One-line summary for `functions build` (matches the secrets line).
|
|
7
|
+
* `entries` is the full allowlist — hostnames and IP/CIDR ranges.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatEgressSummary(entries: readonly string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Multi-line egress section for the deploy confirmation preview.
|
|
12
|
+
* `entries` is the full allowlist — hostnames and IP/CIDR ranges.
|
|
13
|
+
*
|
|
14
|
+
* @param log The LOG prefix string (e.g. '[seq-studio]').
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildEgressPreviewLines(log: string, entries: readonly string[]): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Post-deploy hint printed once a version goes live with egress declared.
|
|
19
|
+
* SWP host rules and (especially) per-function VPC routes for IP entries are
|
|
20
|
+
* not instantaneous — a fetch attempted immediately after "is live" can still
|
|
21
|
+
* be denied until the network plane catches up. Observed in practice: a
|
|
22
|
+
* fresh IP route still denying 3m+ after creation (GCP route propagation is
|
|
23
|
+
* eventually consistent with no hard SLO).
|
|
24
|
+
*/
|
|
25
|
+
export declare function egressPropagationNote(log: string): string;
|
|
26
|
+
/** `functions show` — active manifest egress allowlist from the API. */
|
|
27
|
+
export declare function printFunctionEgressHosts({ log, hosts, ipRanges, egressEnforced, }: {
|
|
28
|
+
log: string;
|
|
29
|
+
hosts: readonly string[];
|
|
30
|
+
ipRanges?: readonly string[];
|
|
31
|
+
egressEnforced: boolean;
|
|
32
|
+
}): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal preview lines for manifest egress — mirrors `buildSecretPreviewLines`
|
|
3
|
+
* in secret-reconcile.ts.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* One-line summary for `functions build` (matches the secrets line).
|
|
7
|
+
* `entries` is the full allowlist — hostnames and IP/CIDR ranges.
|
|
8
|
+
*/
|
|
9
|
+
export function formatEgressSummary(entries) {
|
|
10
|
+
return entries.length > 0 ? entries.join(', ') : '(none declared)';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Multi-line egress section for the deploy confirmation preview.
|
|
14
|
+
* `entries` is the full allowlist — hostnames and IP/CIDR ranges.
|
|
15
|
+
*
|
|
16
|
+
* @param log The LOG prefix string (e.g. '[seq-studio]').
|
|
17
|
+
*/
|
|
18
|
+
export function buildEgressPreviewLines(log, entries) {
|
|
19
|
+
if (entries.length === 0) {
|
|
20
|
+
return [`${log} egress: (none declared)`];
|
|
21
|
+
}
|
|
22
|
+
const lines = [`${log} egress:`];
|
|
23
|
+
for (const entry of entries) {
|
|
24
|
+
lines.push(`${log} - ${entry}`);
|
|
25
|
+
}
|
|
26
|
+
return lines;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Post-deploy hint printed once a version goes live with egress declared.
|
|
30
|
+
* SWP host rules and (especially) per-function VPC routes for IP entries are
|
|
31
|
+
* not instantaneous — a fetch attempted immediately after "is live" can still
|
|
32
|
+
* be denied until the network plane catches up. Observed in practice: a
|
|
33
|
+
* fresh IP route still denying 3m+ after creation (GCP route propagation is
|
|
34
|
+
* eventually consistent with no hard SLO).
|
|
35
|
+
*/
|
|
36
|
+
export function egressPropagationNote(log) {
|
|
37
|
+
return `${log} note: egress allowlist — new updates may take a few minutes to propagate`;
|
|
38
|
+
}
|
|
39
|
+
/** `functions show` — active manifest egress allowlist from the API. */
|
|
40
|
+
export function printFunctionEgressHosts({ log, hosts, ipRanges = [], egressEnforced, }) {
|
|
41
|
+
console.log(`${log} egress allowlist:`);
|
|
42
|
+
if (hosts.length === 0 && ipRanges.length === 0) {
|
|
43
|
+
console.log(egressEnforced
|
|
44
|
+
? ' (none — outbound denied for deployed revisions under network lockdown)'
|
|
45
|
+
: ' (none declared)');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
for (const host of hosts) {
|
|
49
|
+
console.log(` ${host}`);
|
|
50
|
+
}
|
|
51
|
+
for (const cidr of ipRanges) {
|
|
52
|
+
console.log(` ${cidr} (direct IP)`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-side mirror of
|
|
3
|
+
* atlas/src/server/services/managed-functions/lockfile-origin.ts — same
|
|
4
|
+
* "keep the two in sync" pattern as the duplicated manifest schema. The CLI
|
|
5
|
+
* only needs classification (to warn at pre-flight); the deploy decision and
|
|
6
|
+
* server-side resolution live in the atlas module.
|
|
7
|
+
*
|
|
8
|
+
* `npm` -> a resolution pins `registry.npmjs.org` (wins even when a
|
|
9
|
+
* Chainguard pin is also present — matches the worker, which
|
|
10
|
+
* re-resolves any npm-pinned lockfile rather than frozen-
|
|
11
|
+
* installing npm tarballs verbatim).
|
|
12
|
+
* `chainguard` -> a resolution pins `libraries.cgr.dev` and none pin npm.
|
|
13
|
+
* `unknown` -> no explicit tarball pins (plain npm-default lockfile) or unparseable.
|
|
14
|
+
*/
|
|
15
|
+
export type LockfileOrigin = 'chainguard' | 'npm' | 'unknown';
|
|
16
|
+
export declare function classifyLockfileOrigin(lockfileText: string): LockfileOrigin;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { load as parseYaml } from 'js-yaml';
|
|
2
|
+
const CHAINGUARD_TARBALL_HOST = 'libraries.cgr.dev';
|
|
3
|
+
const NPM_TARBALL_HOST = 'registry.npmjs.org';
|
|
4
|
+
export function classifyLockfileOrigin(lockfileText) {
|
|
5
|
+
let parsed;
|
|
6
|
+
try {
|
|
7
|
+
const doc = parseYaml(lockfileText);
|
|
8
|
+
if (!doc || typeof doc !== 'object')
|
|
9
|
+
return 'unknown';
|
|
10
|
+
parsed = doc;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return 'unknown';
|
|
14
|
+
}
|
|
15
|
+
const packages = parsed.packages;
|
|
16
|
+
if (!packages || typeof packages !== 'object')
|
|
17
|
+
return 'unknown';
|
|
18
|
+
let sawChainguard = false;
|
|
19
|
+
let sawNpm = false;
|
|
20
|
+
for (const entry of Object.values(packages)) {
|
|
21
|
+
const tarball = entry?.resolution?.tarball;
|
|
22
|
+
if (typeof tarball !== 'string')
|
|
23
|
+
continue;
|
|
24
|
+
// Exact host comparison (not substring) — kept in lockstep with the worker.
|
|
25
|
+
let host;
|
|
26
|
+
try {
|
|
27
|
+
host = new URL(tarball).host.toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (host === NPM_TARBALL_HOST)
|
|
33
|
+
sawNpm = true;
|
|
34
|
+
else if (host === CHAINGUARD_TARBALL_HOST)
|
|
35
|
+
sawChainguard = true;
|
|
36
|
+
}
|
|
37
|
+
// npm wins over Chainguard when both appear — kept in lockstep with the
|
|
38
|
+
// worker (atlas/.../lockfile-origin.ts), where a mixed lockfile must
|
|
39
|
+
// re-resolve rather than frozen-install its npm-pinned tarballs.
|
|
40
|
+
if (sawNpm)
|
|
41
|
+
return 'npm';
|
|
42
|
+
if (sawChainguard)
|
|
43
|
+
return 'chainguard';
|
|
44
|
+
return 'unknown';
|
|
45
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* CLI-side mirror of the server manifest schema at
|
|
4
|
+
* atlas/src/server/services/managed-functions/manifest.ts — same pattern
|
|
5
|
+
* as artifact-studio's duplicated manifest. Keep the two in sync.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MF_MANIFEST_FILENAME = "managed-function.yml";
|
|
8
|
+
/**
|
|
9
|
+
* CLI-side copy of the server's egress entry validation (see
|
|
10
|
+
* atlas/src/server/services/managed-functions/egress.ts). Returns the
|
|
11
|
+
* failure reason, or null when the entry is valid.
|
|
12
|
+
*/
|
|
13
|
+
export declare function egressEntryError(input: string): string | null;
|
|
14
|
+
export declare function egressIpError(input: string): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* CLI-side copy of the server's normalizeEgressHost validation (see
|
|
17
|
+
* atlas/src/server/services/managed-functions/egress.ts) so authors get the
|
|
18
|
+
* same rejection locally at `functions deploy` time instead of a server 400.
|
|
19
|
+
* Returns the failure reason, or null when the entry is a valid egress host.
|
|
20
|
+
*/
|
|
21
|
+
export declare function egressHostError(input: string): string | null;
|
|
22
|
+
export declare const MAX_EGRESS_IP_RANGES = 16;
|
|
23
|
+
/**
|
|
24
|
+
* Normalized, deduped, sorted egress hosts from a validated manifest egress
|
|
25
|
+
* list — mirrors `manifestEgressHosts` on the server so CLI output matches
|
|
26
|
+
* what the deploy pipeline enforces.
|
|
27
|
+
*/
|
|
28
|
+
export declare function manifestEgressHosts(entries: readonly string[]): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Normalized, deduped, sorted egress IP/CIDR ranges from a validated manifest
|
|
31
|
+
* egress list — mirrors `manifestEgressIpRanges` on the server so CLI output
|
|
32
|
+
* matches the per-function routes the deploy pipeline creates.
|
|
33
|
+
*/
|
|
34
|
+
export declare function manifestEgressIpRanges(entries: readonly string[]): string[];
|
|
35
|
+
/**
|
|
36
|
+
* CLI-side copy of the server's SWP sessionMatcher budget check: the whole
|
|
37
|
+
* egress list compiles into ONE proxy rule matcher (2048-char GCP cap).
|
|
38
|
+
* Deduped after normalization — the rule builder compiles the deduped host
|
|
39
|
+
* set, so aliases of one host cost one matcher clause. IP/CIDR entries
|
|
40
|
+
* bypass the matcher and are capped separately (per-function route count).
|
|
41
|
+
*/
|
|
42
|
+
export declare function egressBudgetError(entries: string[]): string | null;
|
|
43
|
+
export declare const managedFunctionManifestSchema: z.ZodObject<{
|
|
44
|
+
schema_version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
45
|
+
function: z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
title: z.ZodString;
|
|
48
|
+
description: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
runtime: z.ZodDefault<z.ZodLiteral<"nodejs20">>;
|
|
51
|
+
entrypoint: z.ZodDefault<z.ZodString>;
|
|
52
|
+
limits: z.ZodDefault<z.ZodObject<{
|
|
53
|
+
memory_mb: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
timeout_seconds: z.ZodDefault<z.ZodNumber>;
|
|
55
|
+
max_instances: z.ZodDefault<z.ZodNumber>;
|
|
56
|
+
invoke_rate_per_minute: z.ZodDefault<z.ZodNumber>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
secrets: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
59
|
+
egress: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
60
|
+
input_schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
61
|
+
output_schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
62
|
+
capabilities: z.ZodDefault<z.ZodObject<{
|
|
63
|
+
roles: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
definitions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
65
|
+
description: z.ZodOptional<z.ZodString>;
|
|
66
|
+
default: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
+
inherits: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
68
|
+
grants: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
69
|
+
}, z.core.$strip>>>;
|
|
70
|
+
capabilities: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
71
|
+
description: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>>>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
uses: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
75
|
+
gates: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
76
|
+
requires: z.ZodString;
|
|
77
|
+
when: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
field: z.ZodString;
|
|
79
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
}, z.core.$strip>>>;
|
|
82
|
+
data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
83
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
84
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
85
|
+
query: z.ZodDefault<z.ZodBoolean>;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export type ManagedFunctionManifest = z.infer<typeof managedFunctionManifestSchema>;
|