@sequenceholdings/studio-cli 0.9.23 → 0.9.24
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 +152 -144
- package/dist/access/commands.js +3 -5
- package/dist/access/principal.js +2 -2
- package/dist/access/tier-hosts.js +2 -2
- package/dist/agents/commands.d.ts +1 -1
- package/dist/agents/commands.js +9 -9
- package/dist/agents/scaffold.js +3 -3
- package/dist/agents/voice.d.ts +1 -1
- package/dist/agents/voice.js +1 -1
- package/dist/app/commands.d.ts +2 -2
- package/dist/app/commands.js +31 -21
- package/dist/app/deploy.d.ts +1 -1
- package/dist/app/deploy.js +1 -1
- package/dist/app/manifest.d.ts +9 -9
- package/dist/app/manifest.js +1 -1
- package/dist/app/prepare.js +1 -1
- package/dist/app/primitive-scaffold.js +1 -1
- package/dist/app/readme.js +6 -6
- package/dist/app/scaffold.js +1 -1
- package/dist/app/validate.d.ts +1 -1
- package/dist/app/workspace-scaffold.js +1 -1
- package/dist/artifact/delegate.d.ts +1 -1
- package/dist/artifact/delegate.js +43 -3
- package/dist/auth-cmds/commands.js +1 -2
- package/dist/bin.js +12 -2
- package/dist/cli-attribution.d.ts +4 -0
- package/dist/cli-attribution.js +25 -3
- package/dist/cli-errors.d.ts +9 -1
- package/dist/cli-errors.js +20 -9
- package/dist/command-contract.d.ts +7 -182
- package/dist/command-contract.js +9 -33
- package/dist/command-help.d.ts +4 -4
- package/dist/command-help.js +24 -24
- package/dist/command-telemetry.js +2 -2
- package/dist/config-dir.d.ts +8 -0
- package/dist/config-dir.js +35 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +15 -3
- package/dist/docs/commands.js +9 -4
- package/dist/env-registry.d.ts +4 -0
- package/dist/env-registry.js +15 -6
- package/dist/envs/commands.d.ts +3 -0
- package/dist/envs/commands.js +11 -0
- package/dist/exit-codes.d.ts +16 -0
- package/dist/exit-codes.js +27 -0
- package/dist/functions/bundle.d.ts +1 -1
- package/dist/functions/commands.js +19 -18
- package/dist/functions/manifest.js +1 -1
- package/dist/functions/service-account-guidance.d.ts +1 -1
- package/dist/functions/service-account-guidance.js +2 -2
- package/dist/lifecycle/check.d.ts +13 -0
- package/dist/lifecycle/check.js +116 -0
- package/dist/lifecycle/commands.d.ts +14 -0
- package/dist/lifecycle/commands.js +121 -0
- package/dist/lifecycle/plan.d.ts +28 -0
- package/dist/lifecycle/plan.js +113 -0
- package/dist/lifecycle/rollback.d.ts +7 -0
- package/dist/lifecycle/rollback.js +89 -0
- package/dist/lifecycle/seq-ci-tools.d.ts +107 -0
- package/dist/lifecycle/seq-ci-tools.js +177 -0
- package/dist/lifecycle/upgrade.d.ts +3 -0
- package/dist/lifecycle/upgrade.js +38 -0
- package/dist/machine-output.d.ts +11 -2
- package/dist/machine-output.js +32 -10
- package/dist/main.d.ts +16 -6
- package/dist/main.js +187 -361
- package/dist/orgs.d.ts +45 -0
- package/dist/orgs.js +106 -0
- package/dist/orm/delegate.d.ts +1 -1
- package/dist/orm/delegate.js +32 -18
- package/dist/orm/deployment-policy.js +1 -2
- package/dist/orm/discover.js +6 -8
- package/dist/orm/execute.d.ts +1 -1
- package/dist/orm/execute.js +5 -6
- package/dist/orm/failures.js +2 -2
- package/dist/orm/help.d.ts +1 -1
- package/dist/orm/help.js +5 -5
- package/dist/orm/history.js +1 -2
- package/dist/orm/operation-show.js +1 -2
- package/dist/orm/version-guard.d.ts +7 -2
- package/dist/orm/version-guard.js +12 -7
- package/dist/pipeline/codegen.js +2 -2
- package/dist/pipeline/commands.js +9 -7
- package/dist/pipeline/discovery.d.ts +1 -1
- package/dist/pipeline/discovery.js +2 -3
- package/dist/pipeline/help.d.ts +1 -1
- package/dist/pipeline/help.js +1 -1
- package/dist/pipeline/lifecycle.js +1 -1
- package/dist/pipeline/stage-secrets.js +4 -4
- package/dist/pipeline/templates.js +2 -2
- package/dist/pnpm-auto-update.js +3 -3
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +1 -1
- package/dist/principals/commands.d.ts +1 -1
- package/dist/principals/commands.js +13 -14
- package/dist/process/commands.js +4 -1
- package/dist/process/run-steps.d.ts +2 -2
- package/dist/process/runs.js +1 -2
- package/dist/registry/commands.d.ts +4 -0
- package/dist/registry/commands.js +281 -0
- package/dist/registry/help.d.ts +8 -0
- package/dist/registry/help.js +64 -0
- package/dist/registry/lifecycle-commands.d.ts +3 -0
- package/dist/registry/lifecycle-commands.js +60 -0
- package/dist/registry/lookup.d.ts +6 -0
- package/dist/registry/lookup.js +18 -0
- package/dist/registry/runners.d.ts +14 -0
- package/dist/registry/runners.js +206 -0
- package/dist/registry/spec.d.ts +45 -0
- package/dist/registry/spec.js +8 -0
- package/dist/repos/commands.js +1 -2
- package/dist/repos/github-connect-command.d.ts +10 -1
- package/dist/repos/github-connect-command.js +52 -11
- package/dist/repos/github-init.d.ts +9 -2
- package/dist/repos/github-init.js +18 -2
- package/dist/repos/init-repo.js +1 -2
- package/dist/run-pinned.d.ts +48 -0
- package/dist/run-pinned.js +127 -0
- package/dist/sdk-source.d.ts +64 -0
- package/dist/sdk-source.js +199 -0
- package/dist/secrets/commands.d.ts +1 -1
- package/dist/secrets/commands.js +29 -24
- package/dist/service-accounts/commands.d.ts +1 -1
- package/dist/service-accounts/commands.js +4 -5
- package/dist/staged-env.d.ts +14 -0
- package/dist/staged-env.js +73 -0
- package/dist/storage/commands.js +21 -22
- package/dist/templates/catalog.d.ts +4 -4
- package/dist/update-check.js +3 -3
- package/dist/version-support.d.ts +39 -0
- package/dist/version-support.js +71 -0
- package/package.json +8 -7
- package/release-summary.json +2 -1
package/dist/repos/init-repo.js
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in: run the seq-studio a repository pins (`cli: <major.minor>` in `.seq/github.yml`) instead of this one.
|
|
3
|
+
*
|
|
4
|
+
* With `SEQ_STUDIO_USE_PIN=1`, a command run in a repository pinned to another minor re-runs itself with the pinned
|
|
5
|
+
* CLI. That CLI comes from `SEQ_STUDIO_CLI_CACHE` (images that bake pinned versions in point it at theirs) or
|
|
6
|
+
* `~/.cache/seq-studio/cli/<major.minor>`, installed there on first use with pnpm and the machine's own registry
|
|
7
|
+
* configuration, under the same seven-day `minimumReleaseAge` quarantine as every Sequence project. First-party
|
|
8
|
+
* releases are exempt (release-age.ts), so the newest patch of the pinned minor is used; its third-party dependencies
|
|
9
|
+
* are not. A published cache directory is never replaced while a command may be running from it.
|
|
10
|
+
*
|
|
11
|
+
* It never blocks: when the pinned CLI cannot be found or installed, this CLI runs the command itself after a warning.
|
|
12
|
+
* An offline command only uses a cached CLI; it never installs one.
|
|
13
|
+
* Without the opt-in, a mismatch is only noted (version-support.ts `pinNote`).
|
|
14
|
+
*/
|
|
15
|
+
import { type SpawnSyncOptions } from 'node:child_process';
|
|
16
|
+
export declare const USE_PIN_ENV = "SEQ_STUDIO_USE_PIN";
|
|
17
|
+
export declare const CLI_CACHE_ENV = "SEQ_STUDIO_CLI_CACHE";
|
|
18
|
+
/** Set on the re-run, so the pinned CLI never re-runs again. */
|
|
19
|
+
export declare const PINNED_RUN_ENV = "SEQ_STUDIO_PINNED_RUN";
|
|
20
|
+
export type Spawn = (command: string, args: string[], options: SpawnSyncOptions) => {
|
|
21
|
+
status: number | null;
|
|
22
|
+
error?: Error;
|
|
23
|
+
stderr?: string | Buffer | null;
|
|
24
|
+
};
|
|
25
|
+
export interface RunPinnedDeps {
|
|
26
|
+
spawn: Spawn;
|
|
27
|
+
cacheRoot: string;
|
|
28
|
+
env: NodeJS.ProcessEnv;
|
|
29
|
+
}
|
|
30
|
+
export declare function wantsPinnedRun(env?: NodeJS.ProcessEnv): boolean;
|
|
31
|
+
/** The pinned CLI's entry point under `<cacheRoot>/<pin>`, if a release of that minor is there. */
|
|
32
|
+
export declare function cachedPinnedCli({ cacheRoot, pin }: {
|
|
33
|
+
cacheRoot: string;
|
|
34
|
+
pin: string;
|
|
35
|
+
}): string | undefined;
|
|
36
|
+
/** The pnpm workspace an install runs in: the release-age quarantine, with first-party releases exempt. */
|
|
37
|
+
export declare function pinnedInstallWorkspace(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Run `argv` with the pinned CLI and return its exit code, or null to run it here: when the repository pins nothing
|
|
40
|
+
* or this CLI's minor, or when the pinned CLI is unavailable (after a warning).
|
|
41
|
+
*/
|
|
42
|
+
export declare function runPinned({ pin, installed, argv, offline, deps }: {
|
|
43
|
+
pin: string | undefined;
|
|
44
|
+
installed: string;
|
|
45
|
+
argv: string[];
|
|
46
|
+
offline?: boolean;
|
|
47
|
+
deps?: RunPinnedDeps;
|
|
48
|
+
}): Promise<number | null>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in: run the seq-studio a repository pins (`cli: <major.minor>` in `.seq/github.yml`) instead of this one.
|
|
3
|
+
*
|
|
4
|
+
* With `SEQ_STUDIO_USE_PIN=1`, a command run in a repository pinned to another minor re-runs itself with the pinned
|
|
5
|
+
* CLI. That CLI comes from `SEQ_STUDIO_CLI_CACHE` (images that bake pinned versions in point it at theirs) or
|
|
6
|
+
* `~/.cache/seq-studio/cli/<major.minor>`, installed there on first use with pnpm and the machine's own registry
|
|
7
|
+
* configuration, under the same seven-day `minimumReleaseAge` quarantine as every Sequence project. First-party
|
|
8
|
+
* releases are exempt (release-age.ts), so the newest patch of the pinned minor is used; its third-party dependencies
|
|
9
|
+
* are not. A published cache directory is never replaced while a command may be running from it.
|
|
10
|
+
*
|
|
11
|
+
* It never blocks: when the pinned CLI cannot be found or installed, this CLI runs the command itself after a warning.
|
|
12
|
+
* An offline command only uses a cached CLI; it never installs one.
|
|
13
|
+
* Without the opt-in, a mismatch is only noted (version-support.ts `pinNote`).
|
|
14
|
+
*/
|
|
15
|
+
import { spawnSync } from 'node:child_process';
|
|
16
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
17
|
+
import { mkdir, rename, rm, writeFile } from 'node:fs/promises';
|
|
18
|
+
import { homedir } from 'node:os';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { FIRST_PARTY_RELEASE_AGE_EXCLUDE } from './release-age.js';
|
|
21
|
+
export const USE_PIN_ENV = 'SEQ_STUDIO_USE_PIN';
|
|
22
|
+
export const CLI_CACHE_ENV = 'SEQ_STUDIO_CLI_CACHE';
|
|
23
|
+
/** Set on the re-run, so the pinned CLI never re-runs again. */
|
|
24
|
+
export const PINNED_RUN_ENV = 'SEQ_STUDIO_PINNED_RUN';
|
|
25
|
+
const PACKAGE = '@sequenceholdings/studio-cli';
|
|
26
|
+
const INSTALL_TIMEOUT_MS = 120_000;
|
|
27
|
+
/** Seven days, as every scaffolded project's pnpm-workspace.yaml sets it. */
|
|
28
|
+
const MINIMUM_RELEASE_AGE_MINUTES = 10_080;
|
|
29
|
+
const defaultDeps = () => ({
|
|
30
|
+
spawn: (command, args, options) => spawnSync(command, args, options),
|
|
31
|
+
cacheRoot: process.env[CLI_CACHE_ENV]?.trim() || join(process.env.XDG_CACHE_HOME ?? join(homedir(), '.cache'), 'seq-studio', 'cli'),
|
|
32
|
+
env: process.env,
|
|
33
|
+
});
|
|
34
|
+
export function wantsPinnedRun(env = process.env) {
|
|
35
|
+
const value = env[USE_PIN_ENV]?.trim().toLowerCase();
|
|
36
|
+
return (value === '1' || value === 'true') && env[PINNED_RUN_ENV] !== '1';
|
|
37
|
+
}
|
|
38
|
+
/** The pinned CLI's entry point under `<cacheRoot>/<pin>`, if a release of that minor is there. */
|
|
39
|
+
export function cachedPinnedCli({ cacheRoot, pin }) {
|
|
40
|
+
const directory = join(cacheRoot, pin, 'node_modules', ...PACKAGE.split('/'));
|
|
41
|
+
try {
|
|
42
|
+
const manifest = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8'));
|
|
43
|
+
const version = typeof manifest === 'object' && manifest !== null ? Reflect.get(manifest, 'version') : undefined;
|
|
44
|
+
const bin = join(directory, 'dist', 'bin.js');
|
|
45
|
+
return typeof version === 'string' && version.startsWith(`${pin}.`) && existsSync(bin) ? bin : undefined;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** The pnpm workspace an install runs in: the release-age quarantine, with first-party releases exempt. */
|
|
52
|
+
export function pinnedInstallWorkspace() {
|
|
53
|
+
return [`minimumReleaseAge: ${MINIMUM_RELEASE_AGE_MINUTES}`, 'minimumReleaseAgeExclude:',
|
|
54
|
+
...FIRST_PARTY_RELEASE_AGE_EXCLUDE.map((name) => ` - '${name}'`), ''].join('\n');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Move a finished install into place. A concurrent first use may have published the pin already, and a command may be
|
|
58
|
+
* running from it, so a usable published copy is kept and ours discarded; only an unusable one is replaced.
|
|
59
|
+
*/
|
|
60
|
+
async function publish({ staging, cacheRoot, pin }) {
|
|
61
|
+
const target = join(cacheRoot, pin);
|
|
62
|
+
const published = cachedPinnedCli({ cacheRoot, pin });
|
|
63
|
+
if (published)
|
|
64
|
+
return published;
|
|
65
|
+
try {
|
|
66
|
+
await rename(staging, target);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const winner = cachedPinnedCli({ cacheRoot, pin });
|
|
70
|
+
if (winner)
|
|
71
|
+
return winner;
|
|
72
|
+
if (!(error instanceof Error && 'code' in error && (error.code === 'ENOTEMPTY' || error.code === 'EEXIST')))
|
|
73
|
+
throw error;
|
|
74
|
+
await rm(target, { recursive: true, force: true });
|
|
75
|
+
await rename(staging, target);
|
|
76
|
+
}
|
|
77
|
+
return cachedPinnedCli({ cacheRoot, pin });
|
|
78
|
+
}
|
|
79
|
+
/** Install the newest release of the pinned minor into the cache, atomically; undefined with a reason on failure. */
|
|
80
|
+
async function installPinnedCli({ pin, deps }) {
|
|
81
|
+
const staging = `${join(deps.cacheRoot, pin)}.installing-${process.pid}`;
|
|
82
|
+
await mkdir(staging, { recursive: true });
|
|
83
|
+
try {
|
|
84
|
+
await writeFile(join(staging, 'package.json'), `${JSON.stringify({ name: 'seq-studio-pinned-cli', private: true })}\n`);
|
|
85
|
+
await writeFile(join(staging, 'pnpm-workspace.yaml'), pinnedInstallWorkspace());
|
|
86
|
+
const spec = `${PACKAGE}@~${pin}.0`;
|
|
87
|
+
const result = deps.spawn('pnpm', ['add', '--dir', staging, '--ignore-scripts', '--reporter=silent', spec], { encoding: 'utf8', stdio: ['ignore', 'ignore', 'pipe'], timeout: INSTALL_TIMEOUT_MS, env: deps.env });
|
|
88
|
+
if (result.error || result.status !== 0) {
|
|
89
|
+
const lines = String(result.stderr ?? '').split('\n').map((line) => line.trim()).filter(Boolean);
|
|
90
|
+
const detail = result.error?.message ?? lines.find((line) => line.startsWith('ERR_PNPM')) ?? lines.at(-1) ?? `exit ${result.status}`;
|
|
91
|
+
return { reason: `pnpm add ${spec} failed: ${detail}` };
|
|
92
|
+
}
|
|
93
|
+
const bin = await publish({ staging, cacheRoot: deps.cacheRoot, pin });
|
|
94
|
+
return bin ? { bin } : { reason: `the installed ${PACKAGE} is not a ${pin} release` };
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
await rm(staging, { recursive: true, force: true });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Run `argv` with the pinned CLI and return its exit code, or null to run it here: when the repository pins nothing
|
|
102
|
+
* or this CLI's minor, or when the pinned CLI is unavailable (after a warning).
|
|
103
|
+
*/
|
|
104
|
+
export async function runPinned({ pin, installed, argv, offline = false, deps = defaultDeps() }) {
|
|
105
|
+
if (!pin || installed.split('.').slice(0, 2).join('.') === pin)
|
|
106
|
+
return null;
|
|
107
|
+
let bin = cachedPinnedCli({ cacheRoot: deps.cacheRoot, pin });
|
|
108
|
+
if (!bin && offline) {
|
|
109
|
+
console.error(`note: seq-studio ${pin} (this repository's pin) is not installed and this command runs offline; running ${installed}.`);
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
if (!bin) {
|
|
113
|
+
console.error(`note: installing seq-studio ${pin} (this repository's pin) into ${join(deps.cacheRoot, pin)}…`);
|
|
114
|
+
const installedPin = await installPinnedCli({ pin, deps }).catch((error) => ({ reason: error instanceof Error ? error.message : String(error), bin: undefined }));
|
|
115
|
+
if (!installedPin.bin) {
|
|
116
|
+
console.error(`warning: could not get seq-studio ${pin} (${installedPin.reason}); running ${installed} instead.`);
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
bin = installedPin.bin;
|
|
120
|
+
}
|
|
121
|
+
const result = deps.spawn(process.execPath, [bin, ...argv], { stdio: 'inherit', env: { ...deps.env, [PINNED_RUN_ENV]: '1' } });
|
|
122
|
+
if (result.error) {
|
|
123
|
+
console.error(`warning: could not run seq-studio ${pin} (${result.error.message}); running ${installed} instead.`);
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
return result.status ?? 1;
|
|
127
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare const SDK_ENV = "SEQ_STUDIO_SDK";
|
|
2
|
+
export type SdkMode = 'bundled' | 'project';
|
|
3
|
+
export declare const SDK_PACKAGES: readonly ["@sequenceholdings/orm", "@sequenceholdings/lattice", "@sequenceholdings/artifact-studio", "@sequenceholdings/pipeline-spec"];
|
|
4
|
+
export interface InstalledSdk {
|
|
5
|
+
version?: string;
|
|
6
|
+
directory: string;
|
|
7
|
+
}
|
|
8
|
+
/** The package the project at `cwd` installed: the nearest `node_modules/<name>` at or above it. */
|
|
9
|
+
export declare function projectSdk({ name, cwd }: {
|
|
10
|
+
name: string;
|
|
11
|
+
cwd?: string;
|
|
12
|
+
}): InstalledSdk | undefined;
|
|
13
|
+
/** The copy bundled with this CLI, resolved as an import is (an ESM-only package exports no `require` entry). */
|
|
14
|
+
export declare function bundledSdk({ name }: {
|
|
15
|
+
name: string;
|
|
16
|
+
}): InstalledSdk | undefined;
|
|
17
|
+
/** The ESM file a package's `exports` map gives a subpath (`.` or `./cli`), or undefined. */
|
|
18
|
+
export declare function exportedFile({ directory, subpath }: {
|
|
19
|
+
directory: string;
|
|
20
|
+
subpath: string;
|
|
21
|
+
}): string | undefined;
|
|
22
|
+
/** `--sdk`, then `SEQ_STUDIO_SDK`, then `.seq/github.yml`'s `sdk:`; bundled otherwise. */
|
|
23
|
+
export declare function sdkMode({ cwd }?: {
|
|
24
|
+
cwd?: string;
|
|
25
|
+
}): Promise<SdkMode>;
|
|
26
|
+
export interface SdkComparison {
|
|
27
|
+
name: string;
|
|
28
|
+
bundled?: string;
|
|
29
|
+
project?: string;
|
|
30
|
+
differs: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function compareSdk({ name, cwd }: {
|
|
33
|
+
name: string;
|
|
34
|
+
cwd?: string;
|
|
35
|
+
}): SdkComparison;
|
|
36
|
+
/** The version of `name` this command loaded through importSdk, or undefined before it has. */
|
|
37
|
+
export declare function selectedSdkVersion(name: string): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The file `<name><subpath>` resolves to in the copy this command loaded, so a module imported indirectly (an ORM
|
|
40
|
+
* schema importing `@sequenceholdings/orm/authoring`) matches it. Undefined when that copy does not export it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function selectedSdkFile({ name, subpath }: {
|
|
43
|
+
name: string;
|
|
44
|
+
subpath: string;
|
|
45
|
+
}): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Import `<name><subpath>` from the copy this command runs. `bundled` is the CLI's own static import, so the bundler
|
|
48
|
+
* keeps it. Prints a note once when the project's copy is a different version than the one used.
|
|
49
|
+
*/
|
|
50
|
+
export declare function importSdk<T>({ name, subpath, bundled, cwd }: {
|
|
51
|
+
name: string;
|
|
52
|
+
subpath?: string;
|
|
53
|
+
bundled: () => Promise<T>;
|
|
54
|
+
cwd?: string;
|
|
55
|
+
}): Promise<T>;
|
|
56
|
+
/** One `doctor` line per SDK the project installs: both versions and which one commands run. */
|
|
57
|
+
export declare function sdkSourceLines({ cwd }?: {
|
|
58
|
+
cwd?: string;
|
|
59
|
+
}): Promise<string[]>;
|
|
60
|
+
/** `--sdk bundled|project` from any command, stripped before routing like `--break-glass`. */
|
|
61
|
+
export declare function takeSdkFlag(argv: string[]): {
|
|
62
|
+
argv: string[];
|
|
63
|
+
sdk?: SdkMode | Error;
|
|
64
|
+
};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which copy of an SDK (ORM, Lattice, artifact-studio, pipeline-spec) a command runs: the one bundled with this CLI,
|
|
3
|
+
* or the one the project's lockfile installed.
|
|
4
|
+
*
|
|
5
|
+
* The bundled copy stays the default. A project opts in to its own with `sdk: project` in `.seq/github.yml`,
|
|
6
|
+
* `SEQ_STUDIO_SDK=project`, or `--sdk project` on any command. Until then a version difference is only reported:
|
|
7
|
+
* `doctor` lists both, and a command that loads a differing SDK prints one `note:`. A project copy that cannot be
|
|
8
|
+
* loaded falls back to the bundled one with a warning, so opting in never stops a command.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
11
|
+
import { dirname, join, parse as parsePath, resolve } from 'node:path';
|
|
12
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
13
|
+
export const SDK_ENV = 'SEQ_STUDIO_SDK';
|
|
14
|
+
export const SDK_PACKAGES = [
|
|
15
|
+
'@sequenceholdings/orm', '@sequenceholdings/lattice', '@sequenceholdings/artifact-studio', '@sequenceholdings/pipeline-spec',
|
|
16
|
+
];
|
|
17
|
+
function readPackage(directory) {
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8'));
|
|
20
|
+
return typeof parsed === 'object' && parsed !== null ? { ...parsed } : undefined;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const versionOf = (manifest) => (typeof manifest?.version === 'string' ? manifest.version : undefined);
|
|
27
|
+
/** The package the project at `cwd` installed: the nearest `node_modules/<name>` at or above it. */
|
|
28
|
+
export function projectSdk({ name, cwd = process.cwd() }) {
|
|
29
|
+
let directory = resolve(cwd);
|
|
30
|
+
const { root } = parsePath(directory);
|
|
31
|
+
for (;;) {
|
|
32
|
+
const candidate = join(directory, 'node_modules', name);
|
|
33
|
+
if (existsSync(join(candidate, 'package.json')))
|
|
34
|
+
return { version: versionOf(readPackage(candidate)), directory: candidate };
|
|
35
|
+
if (directory === root)
|
|
36
|
+
return undefined;
|
|
37
|
+
directory = dirname(directory);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** The copy bundled with this CLI, resolved as an import is (an ESM-only package exports no `require` entry). */
|
|
41
|
+
export function bundledSdk({ name }) {
|
|
42
|
+
try {
|
|
43
|
+
let directory = dirname(fileURLToPath(import.meta.resolve(name)));
|
|
44
|
+
const { root } = parsePath(directory);
|
|
45
|
+
for (;;) {
|
|
46
|
+
const manifest = readPackage(directory);
|
|
47
|
+
if (manifest?.name === name)
|
|
48
|
+
return { version: versionOf(manifest), directory };
|
|
49
|
+
if (directory === root)
|
|
50
|
+
return undefined;
|
|
51
|
+
directory = dirname(directory);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** The ESM file a package's `exports` map gives a subpath (`.` or `./cli`), or undefined. */
|
|
59
|
+
export function exportedFile({ directory, subpath }) {
|
|
60
|
+
const exports = readPackage(directory)?.exports;
|
|
61
|
+
const entry = typeof exports === 'string' && subpath === '.' ? exports
|
|
62
|
+
: typeof exports === 'object' && exports !== null ? Reflect.get(exports, subpath) : undefined;
|
|
63
|
+
const pick = (value) => {
|
|
64
|
+
if (typeof value === 'string')
|
|
65
|
+
return value;
|
|
66
|
+
if (typeof value !== 'object' || value === null)
|
|
67
|
+
return undefined;
|
|
68
|
+
for (const condition of ['import', 'node', 'default']) {
|
|
69
|
+
const found = pick(Reflect.get(value, condition));
|
|
70
|
+
if (found)
|
|
71
|
+
return found;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
};
|
|
75
|
+
const file = pick(entry);
|
|
76
|
+
return file ? join(directory, file) : undefined;
|
|
77
|
+
}
|
|
78
|
+
/** `--sdk`, then `SEQ_STUDIO_SDK`, then `.seq/github.yml`'s `sdk:`; bundled otherwise. */
|
|
79
|
+
export async function sdkMode({ cwd = process.cwd() } = {}) {
|
|
80
|
+
const fromEnv = process.env[SDK_ENV]?.trim();
|
|
81
|
+
if (fromEnv === 'project' || fromEnv === 'bundled')
|
|
82
|
+
return fromEnv;
|
|
83
|
+
const { repositorySettings } = await import('./orgs.js');
|
|
84
|
+
return (await repositorySettings(cwd).catch(() => undefined))?.sdk === 'project' ? 'project' : 'bundled';
|
|
85
|
+
}
|
|
86
|
+
export function compareSdk({ name, cwd }) {
|
|
87
|
+
const bundled = bundledSdk({ name })?.version;
|
|
88
|
+
const project = projectSdk({ name, cwd })?.version;
|
|
89
|
+
return { name, bundled, project, differs: Boolean(bundled && project && bundled !== project) };
|
|
90
|
+
}
|
|
91
|
+
const noted = new Set();
|
|
92
|
+
/** The copy of each SDK this command loaded: its version, and the project's directory when it was the project's. */
|
|
93
|
+
const selected = new Map();
|
|
94
|
+
/** The version of `name` this command loaded through importSdk, or undefined before it has. */
|
|
95
|
+
export function selectedSdkVersion(name) {
|
|
96
|
+
return selected.get(name)?.version;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The file `<name><subpath>` resolves to in the copy this command loaded, so a module imported indirectly (an ORM
|
|
100
|
+
* schema importing `@sequenceholdings/orm/authoring`) matches it. Undefined when that copy does not export it.
|
|
101
|
+
*/
|
|
102
|
+
export function selectedSdkFile({ name, subpath }) {
|
|
103
|
+
const projectDirectory = selected.get(name)?.projectDirectory;
|
|
104
|
+
if (projectDirectory)
|
|
105
|
+
return exportedFile({ directory: projectDirectory, subpath });
|
|
106
|
+
try {
|
|
107
|
+
return fileURLToPath(import.meta.resolve(`${name}${subpath.slice(1)}`));
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** The API of the bundled copy that the project's copy lacks. */
|
|
114
|
+
function missingExports({ loaded, bundled }) {
|
|
115
|
+
if (typeof bundled !== 'object' || bundled === null || typeof loaded !== 'object' || loaded === null)
|
|
116
|
+
return [];
|
|
117
|
+
return Object.keys(bundled).filter((key) => !(key in loaded));
|
|
118
|
+
}
|
|
119
|
+
/** The project's copy at `file`, or the bundled one with a warning when it cannot load or lacks what the CLI calls. */
|
|
120
|
+
async function projectCopy({ name, file, directory, bundled, comparison }) {
|
|
121
|
+
const fallbackTo = comparison.bundled ?? 'copy';
|
|
122
|
+
let loaded;
|
|
123
|
+
try {
|
|
124
|
+
loaded = await import(pathToFileURL(file).href);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
note(name, `warning: could not load this project's ${name} (${error instanceof Error ? error.message.split('\n')[0] : String(error)}); using the bundled ${fallbackTo}`);
|
|
128
|
+
return bundled();
|
|
129
|
+
}
|
|
130
|
+
let fallback;
|
|
131
|
+
try {
|
|
132
|
+
fallback = await bundled();
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// ORM and pipeline-spec are optional peers of a global CLI: with no bundled copy to compare against or fall
|
|
136
|
+
// back to, the project's copy that loaded is the one to run.
|
|
137
|
+
selected.set(name, { version: comparison.project, projectDirectory: directory });
|
|
138
|
+
// The project's copy of the same package, which loaded.
|
|
139
|
+
return loaded;
|
|
140
|
+
}
|
|
141
|
+
const missing = missingExports({ loaded, bundled: fallback });
|
|
142
|
+
if (missing.length) {
|
|
143
|
+
note(name, `warning: this project's ${name} ${comparison.project ?? ''} lacks ${missing.slice(0, 3).join(', ')}${missing.length > 3 ? ', …' : ''}, ` +
|
|
144
|
+
`which seq-studio uses; using the bundled ${fallbackTo}. Upgrade the project's ${name} to run it.`);
|
|
145
|
+
return fallback;
|
|
146
|
+
}
|
|
147
|
+
if (comparison.differs)
|
|
148
|
+
note(name, `note: using this project's ${name} ${comparison.project} (sdk: project), not the bundled ${comparison.bundled}`);
|
|
149
|
+
selected.set(name, { version: comparison.project, projectDirectory: directory });
|
|
150
|
+
// Same exports as the bundled copy, checked above: the project's copy of the same package.
|
|
151
|
+
return loaded;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Import `<name><subpath>` from the copy this command runs. `bundled` is the CLI's own static import, so the bundler
|
|
155
|
+
* keeps it. Prints a note once when the project's copy is a different version than the one used.
|
|
156
|
+
*/
|
|
157
|
+
export async function importSdk({ name, subpath = '.', bundled, cwd }) {
|
|
158
|
+
const comparison = compareSdk({ name, cwd });
|
|
159
|
+
const mode = await sdkMode({ cwd });
|
|
160
|
+
const project = mode === 'project' ? projectSdk({ name, cwd }) : undefined;
|
|
161
|
+
const file = project ? exportedFile({ directory: project.directory, subpath }) : undefined;
|
|
162
|
+
// Every path below and every fallback in projectCopy loads the bundled copy; projectCopy overrides on success.
|
|
163
|
+
selected.set(name, { version: comparison.bundled });
|
|
164
|
+
if (file && project)
|
|
165
|
+
return projectCopy({ name, file, directory: project.directory, bundled, comparison });
|
|
166
|
+
if (mode === 'project' && !project)
|
|
167
|
+
note(name, `note: sdk: project, but this project does not install ${name}; using the bundled ${comparison.bundled ?? 'copy'}`);
|
|
168
|
+
else if (comparison.differs) {
|
|
169
|
+
note(name, `note: this project installs ${name} ${comparison.project}; seq-studio runs its bundled ${comparison.bundled}. ` +
|
|
170
|
+
'Set sdk: project in .seq/github.yml (or --sdk project) to run the project\'s.');
|
|
171
|
+
}
|
|
172
|
+
return bundled();
|
|
173
|
+
}
|
|
174
|
+
function note(name, message) {
|
|
175
|
+
if (noted.has(`${name}\n${message}`))
|
|
176
|
+
return;
|
|
177
|
+
noted.add(`${name}\n${message}`);
|
|
178
|
+
console.error(message);
|
|
179
|
+
}
|
|
180
|
+
/** One `doctor` line per SDK the project installs: both versions and which one commands run. */
|
|
181
|
+
export async function sdkSourceLines({ cwd } = {}) {
|
|
182
|
+
const mode = await sdkMode({ cwd });
|
|
183
|
+
return SDK_PACKAGES.map((name) => compareSdk({ name, cwd }))
|
|
184
|
+
.filter((entry) => entry.project !== undefined)
|
|
185
|
+
.map((entry) => `sdk source: ${entry.name} bundled ${entry.bundled ?? 'none'}, project ${entry.project}; runs ${mode === 'project' ? 'project' : 'bundled'}${entry.differs && mode === 'bundled' ? ' (differs; sdk: project in .seq/github.yml runs the project\'s)' : ''}`);
|
|
186
|
+
}
|
|
187
|
+
/** `--sdk bundled|project` from any command, stripped before routing like `--break-glass`. */
|
|
188
|
+
export function takeSdkFlag(argv) {
|
|
189
|
+
const index = argv.findIndex((arg) => arg === '--sdk' || arg.startsWith('--sdk='));
|
|
190
|
+
if (index < 0)
|
|
191
|
+
return { argv };
|
|
192
|
+
const arg = argv[index];
|
|
193
|
+
const inline = arg.startsWith('--sdk=') ? arg.slice('--sdk='.length) : undefined;
|
|
194
|
+
const value = inline ?? argv[index + 1];
|
|
195
|
+
const rest = [...argv.slice(0, index), ...argv.slice(index + (inline === undefined && value !== undefined ? 2 : 1))];
|
|
196
|
+
if (value !== 'bundled' && value !== 'project')
|
|
197
|
+
return { argv: rest, sdk: new Error('--sdk must be bundled or project') };
|
|
198
|
+
return { argv: rest, sdk: value };
|
|
199
|
+
}
|
|
@@ -22,5 +22,5 @@ export declare function secretsSetDefaultCommand(args: ParsedArgs): Promise<numb
|
|
|
22
22
|
* UI: pin + redeploy the function's active version / pin only / cancel.
|
|
23
23
|
*/
|
|
24
24
|
export declare function secretsPinCommand(args: ParsedArgs): Promise<number>;
|
|
25
|
-
export declare const SECRETS_USAGE = "usage:\n seq-studio
|
|
25
|
+
export declare const SECRETS_USAGE = "usage:\n seq-studio secret create <NAME> -e <env> [--type key-value|single] [--org <slug>] [--description text]\n register an org-owned secret\n seq-studio secret set <NAME> -e <env> [--org <slug>] [--from-file <path>|--from-json <path>] [--merge]\n set the shared default value (write-only)\n seq-studio secret list -e <env> secrets you can see (never values)\n seq-studio secret attach <NAME> --fn <slug> -e <env> [--org <slug>] [--map KEY=ENV,KEY=ENV]\n mount default on a function env var\n seq-studio secret detach <NAME> --fn <slug> -e <env> [--org <slug>]\n remove attachment\n seq-studio secret attach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--entry KEY | --fields field=KEY,field=KEY]\n attach to a pipeline stage's credential for one deploy target\n seq-studio secret detach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>]\n remove it (the stage's copy is deleted now)\n seq-studio secret apply --from-env-file .env -e <env> push defaults + attach (keys default from manifest)\n seq-studio secret versions <NAME> -e <env> [--org <slug>] value version history (never values)\n seq-studio secret set-default <NAME> [version] -e <env> [--org <slug>]\n point the default at a prior version (editor)\n seq-studio secret pin <NAME> --fn <slug> [version] -e <env> [--org <slug>]\n pin one function to a version (sticky; --unpin clears)\n\n Note: for the common deploy loop, secrets declared in managed-function.yml are\n reconciled automatically by `seq-studio function deploy` using a local .env.\n Explicit function attachments require the same secret source and mapping in the active manifest.\n Use `secrets` commands for CI (no .env), bulk/multi-function ops, or write-only\n value changes without a redeploy.\n\n Pipelines: managed secrets are the preferred way to give a stage a credential.\n Declare source.credential in the stage spec and read it in code with\n pipeline_runtime.get_credential(\"<name>\"). `seq-studio pipeline plan|deploy`\n attaches the secret named by convention (abrigo_oauth -> ABRIGO_OAUTH) when\n you can edit it (stages already deployed the legacy way are left alone); use\n `secrets attach --stage` for any other name.\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n --org <slug> (target/select managed-scope org; required when a name exists in multiple orgs)\n set: --from-file <path> for single values; --from-json <path> for key/value sets; --merge changes only listed entries (null removes one)\n --fn <slug> \u00B7 --env-var <NAME> \u00B7 --yes\n --stage <slug> \u00B7 --target <id> (deploy target; default from -e) \u00B7 --credential <name> \u00B7 --entry <KEY> or --fields field=KEY,field=KEY (key/value sets)\n (the spec's source.credential; default: NAME lowercased) \u00B7 --repo <ns>/<name> (disambiguate)\n --functions <f1,f2> \u00B7 --keys <K1,K2> \u00B7 --all (override key selection)\n set-default: [version|version-row-id] (defaults to the most recent non-default) \u00B7 --yes\n pin: [version|version-row-id] (defaults to the current default) \u00B7 --unpin \u00B7 --yes (redeploy) \u00B7 --yes --no-redeploy\n";
|
|
26
26
|
export declare function runSecretsCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|
package/dist/secrets/commands.js
CHANGED
|
@@ -27,7 +27,7 @@ function resolveVersionTarget(versions, versionArg) {
|
|
|
27
27
|
if (matches.length > 1) {
|
|
28
28
|
return {
|
|
29
29
|
error: `version "${versionArg}" is ambiguous (${matches.length} rows share v${wanted}). ` +
|
|
30
|
-
`Pass the version row id from "seq-studio
|
|
30
|
+
`Pass the version row id from "seq-studio secret versions": ${matches.map((v) => v.id).join(', ')}`,
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
return { target: matches[0] };
|
|
@@ -123,7 +123,7 @@ async function resolveFunctionBySlug({ ctx, slug, }) {
|
|
|
123
123
|
});
|
|
124
124
|
const fn = functions.find((row) => row.slug === slug);
|
|
125
125
|
if (!fn) {
|
|
126
|
-
throw new Error(`Managed function "${slug}" not found on ${ctx.env.name} (or you don't have access). Run \`seq-studio
|
|
126
|
+
throw new Error(`Managed function "${slug}" not found on ${ctx.env.name} (or you don't have access). Run \`seq-studio function list -e ${ctx.env.name}\` to see what exists.`);
|
|
127
127
|
}
|
|
128
128
|
return fn;
|
|
129
129
|
}
|
|
@@ -150,7 +150,7 @@ async function functionExistsBySlugEventually({ ctx, slug, attempts = 3, retryDe
|
|
|
150
150
|
export async function secretsCreateCommand(args) {
|
|
151
151
|
const name = args.positional[0];
|
|
152
152
|
if (!name) {
|
|
153
|
-
console.error('usage: seq-studio
|
|
153
|
+
console.error('usage: seq-studio secret create <NAME> -e <env> [--type key-value|single] [--org <slug>] [--description text]');
|
|
154
154
|
return 1;
|
|
155
155
|
}
|
|
156
156
|
const ctx = await buildContext(args);
|
|
@@ -182,7 +182,7 @@ export async function secretsCreateCommand(args) {
|
|
|
182
182
|
export async function secretsSetCommand(args) {
|
|
183
183
|
const name = args.positional[0];
|
|
184
184
|
if (!name) {
|
|
185
|
-
console.error('usage: seq-studio
|
|
185
|
+
console.error('usage: seq-studio secret set <NAME> -e <env> [--org <slug>] [--from-file <path>] [--from-json <path>]');
|
|
186
186
|
return 1;
|
|
187
187
|
}
|
|
188
188
|
const ctx = await buildContext(args);
|
|
@@ -357,8 +357,8 @@ export async function secretsAttachCommand(args) {
|
|
|
357
357
|
return secretsAttachToStage(args, name);
|
|
358
358
|
const fnSlug = typeof args.flags.fn === 'string' ? args.flags.fn : args.positional[1];
|
|
359
359
|
if (!name || !fnSlug) {
|
|
360
|
-
console.error('usage: seq-studio
|
|
361
|
-
' seq-studio
|
|
360
|
+
console.error('usage: seq-studio secret attach <NAME> --fn <slug> -e <env> [--org <slug>] [--env-var NAME] [--map KEY=ENV,KEY=ENV]\n' +
|
|
361
|
+
' seq-studio secret attach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--entry KEY | --fields field=KEY,field=KEY] [--repo <ns>/<name>] [--org <slug>]');
|
|
362
362
|
return 1;
|
|
363
363
|
}
|
|
364
364
|
const ctx = await buildContext(args);
|
|
@@ -414,8 +414,8 @@ export async function secretsDetachCommand(args) {
|
|
|
414
414
|
return secretsDetachFromStage(args, name);
|
|
415
415
|
const fnSlug = typeof args.flags.fn === 'string' ? args.flags.fn : args.positional[1];
|
|
416
416
|
if (!name || !fnSlug) {
|
|
417
|
-
console.error('usage: seq-studio
|
|
418
|
-
' seq-studio
|
|
417
|
+
console.error('usage: seq-studio secret detach <NAME> --fn <slug> -e <env> [--org <slug>]\n' +
|
|
418
|
+
' seq-studio secret detach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--repo <ns>/<name>]');
|
|
419
419
|
return 1;
|
|
420
420
|
}
|
|
421
421
|
const ctx = await buildContext(args);
|
|
@@ -472,7 +472,7 @@ function resolveApplyKeys({ parsed, manifest, explicitKeys, applyAll, }) {
|
|
|
472
472
|
export async function secretsApplyCommand(args) {
|
|
473
473
|
const fromEnvFile = args.flags['from-env-file'];
|
|
474
474
|
if (typeof fromEnvFile !== 'string') {
|
|
475
|
-
console.error('usage: seq-studio
|
|
475
|
+
console.error('usage: seq-studio secret apply --from-env-file .env -e <env> [--yes]');
|
|
476
476
|
return 1;
|
|
477
477
|
}
|
|
478
478
|
const dir = workDir(args);
|
|
@@ -652,7 +652,7 @@ async function attachedFunctionSlugs(ctx, secretId) {
|
|
|
652
652
|
export async function secretsVersionsCommand(args) {
|
|
653
653
|
const name = args.positional[0];
|
|
654
654
|
if (!name) {
|
|
655
|
-
console.error('usage: seq-studio
|
|
655
|
+
console.error('usage: seq-studio secret versions <NAME> -e <env> [--org <slug>]');
|
|
656
656
|
return 1;
|
|
657
657
|
}
|
|
658
658
|
const ctx = await buildContext(args);
|
|
@@ -680,7 +680,7 @@ export async function secretsVersionsCommand(args) {
|
|
|
680
680
|
export async function secretsSetDefaultCommand(args) {
|
|
681
681
|
const name = args.positional[0];
|
|
682
682
|
if (!name) {
|
|
683
|
-
console.error('usage: seq-studio
|
|
683
|
+
console.error('usage: seq-studio secret set-default <NAME> [version] -e <env> [--org <slug>] [--yes]');
|
|
684
684
|
return 1;
|
|
685
685
|
}
|
|
686
686
|
const ctx = await buildContext(args);
|
|
@@ -746,7 +746,7 @@ export async function secretsPinCommand(args) {
|
|
|
746
746
|
const name = args.positional[0];
|
|
747
747
|
const fnSlug = typeof args.flags.fn === 'string' ? args.flags.fn : undefined;
|
|
748
748
|
if (!name || !fnSlug) {
|
|
749
|
-
console.error('usage: seq-studio
|
|
749
|
+
console.error('usage: seq-studio secret pin <NAME> --fn <slug> [version] [--unpin] -e <env> [--org <slug>] [--yes] [--no-redeploy]');
|
|
750
750
|
return 1;
|
|
751
751
|
}
|
|
752
752
|
const ctx = await buildContext(args);
|
|
@@ -831,28 +831,28 @@ export async function secretsPinCommand(args) {
|
|
|
831
831
|
// dispatcher
|
|
832
832
|
// ---------------------------------------------------------------------------
|
|
833
833
|
export const SECRETS_USAGE = `usage:
|
|
834
|
-
seq-studio
|
|
834
|
+
seq-studio secret create <NAME> -e <env> [--type key-value|single] [--org <slug>] [--description text]
|
|
835
835
|
register an org-owned secret
|
|
836
|
-
seq-studio
|
|
836
|
+
seq-studio secret set <NAME> -e <env> [--org <slug>] [--from-file <path>|--from-json <path>] [--merge]
|
|
837
837
|
set the shared default value (write-only)
|
|
838
|
-
seq-studio
|
|
839
|
-
seq-studio
|
|
838
|
+
seq-studio secret list -e <env> secrets you can see (never values)
|
|
839
|
+
seq-studio secret attach <NAME> --fn <slug> -e <env> [--org <slug>] [--map KEY=ENV,KEY=ENV]
|
|
840
840
|
mount default on a function env var
|
|
841
|
-
seq-studio
|
|
841
|
+
seq-studio secret detach <NAME> --fn <slug> -e <env> [--org <slug>]
|
|
842
842
|
remove attachment
|
|
843
|
-
seq-studio
|
|
843
|
+
seq-studio secret attach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>] [--entry KEY | --fields field=KEY,field=KEY]
|
|
844
844
|
attach to a pipeline stage's credential for one deploy target
|
|
845
|
-
seq-studio
|
|
845
|
+
seq-studio secret detach <NAME> --stage <slug> -e <env> [--target <id>] [--credential <name>]
|
|
846
846
|
remove it (the stage's copy is deleted now)
|
|
847
|
-
seq-studio
|
|
848
|
-
seq-studio
|
|
849
|
-
seq-studio
|
|
847
|
+
seq-studio secret apply --from-env-file .env -e <env> push defaults + attach (keys default from manifest)
|
|
848
|
+
seq-studio secret versions <NAME> -e <env> [--org <slug>] value version history (never values)
|
|
849
|
+
seq-studio secret set-default <NAME> [version] -e <env> [--org <slug>]
|
|
850
850
|
point the default at a prior version (editor)
|
|
851
|
-
seq-studio
|
|
851
|
+
seq-studio secret pin <NAME> --fn <slug> [version] -e <env> [--org <slug>]
|
|
852
852
|
pin one function to a version (sticky; --unpin clears)
|
|
853
853
|
|
|
854
854
|
Note: for the common deploy loop, secrets declared in managed-function.yml are
|
|
855
|
-
reconciled automatically by \`seq-studio
|
|
855
|
+
reconciled automatically by \`seq-studio function deploy\` using a local .env.
|
|
856
856
|
Explicit function attachments require the same secret source and mapping in the active manifest.
|
|
857
857
|
Use \`secrets\` commands for CI (no .env), bulk/multi-function ops, or write-only
|
|
858
858
|
value changes without a redeploy.
|
|
@@ -875,6 +875,11 @@ export const SECRETS_USAGE = `usage:
|
|
|
875
875
|
pin: [version|version-row-id] (defaults to the current default) · --unpin · --yes (redeploy) · --yes --no-redeploy
|
|
876
876
|
`;
|
|
877
877
|
export async function runSecretsCommand(sub, args) {
|
|
878
|
+
// `secret <verb> --help` is help, not a call missing its arguments.
|
|
879
|
+
if (sub && (args.flags.help === true || args.flags.h === true)) {
|
|
880
|
+
console.log(SECRETS_USAGE);
|
|
881
|
+
return 0;
|
|
882
|
+
}
|
|
878
883
|
try {
|
|
879
884
|
switch (sub) {
|
|
880
885
|
case 'create':
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ParsedArgs } from '../process/commands.js';
|
|
2
|
-
export declare const SERVICE_ACCOUNTS_USAGE = "usage:\n seq-studio service-
|
|
2
|
+
export declare const SERVICE_ACCOUNTS_USAGE = "usage:\n seq-studio service-account list -e <env> [--json]\n seq-studio service-account show <account-id> -e <env> [--json]\n seq-studio service-account create <slug> --display-name <name> -e <env> [--description <text>] [--json]\n\n All results are JSON. Authenticate: seq-studio login --env <env>.\n Administrator provisioning: listing needs Service Accounts surface access;\n create needs its editor grant; show needs admin on that account.\n A normal builder should use the account ID/slug supplied by their administrator.\n Creation does not grant the account access to data or functions. Grant required\n runtime access with seq-studio access using principal user: service-account|<id>.\n The server checks creator, actor, and resource authority on every operation.\n No credential is issued or printed by these commands.\n";
|
|
3
3
|
export declare function runServiceAccountsCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|