@sequenceholdings/studio-cli 0.9.22 → 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 +11 -10
- package/release-summary.json +3 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** `seq-studio affected` and `seq-studio check`: this repository's seq-ci release, run locally. */
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { ExitCode, UsageError } from '../exit-codes.js';
|
|
4
|
+
import { affectedArgs, checkArgs, dockerExecutable, localImageId, localRevisions, parseAffected, registryAuth, run, seqCiPinsFromWorkflow, seqCiToolsDirectory, } from './seq-ci-tools.js';
|
|
5
|
+
const AFFECTED_USAGE = `usage:
|
|
6
|
+
seq-studio affected [--base <rev>] [--head <rev>] [--dir <checkout>] [--json]
|
|
7
|
+
|
|
8
|
+
Which targets a change reaches, computed by this repository's pinned seq-ci release exactly as its pull request
|
|
9
|
+
job does. Compares the committed HEAD with where it left the dev branch (origin/<dev>), or --base. Uncommitted
|
|
10
|
+
edits are not included. Needs Docker, gh, and read access to the seq-ci image registry.`;
|
|
11
|
+
const CHECK_USAGE = `usage:
|
|
12
|
+
seq-studio check [<target>...] [--base <rev>] [--head <rev>] [--dir <checkout>]
|
|
13
|
+
|
|
14
|
+
Run seq-ci's checks locally, in the same sandboxes and images CI uses: every affected target, or the ones named.
|
|
15
|
+
Exit 0 when all pass, 1 when any fails, 3 when the plan has blocking findings. Needs Docker, gh, and read access
|
|
16
|
+
to the seq-ci image registry. Dependencies install from the Chainguard registry with the _auth in ~/.npmrc (or
|
|
17
|
+
SEQ_CI_REGISTRY_AUTH), as CI does with its org secret. Docker is found on PATH, or set SEQ_CI_DOCKER.`;
|
|
18
|
+
function flagString(args, name) {
|
|
19
|
+
const value = args.flags[name];
|
|
20
|
+
if (value === true)
|
|
21
|
+
throw new UsageError(`--${name} needs a value`);
|
|
22
|
+
return typeof value === 'string' ? value : undefined;
|
|
23
|
+
}
|
|
24
|
+
async function defaultDeps() {
|
|
25
|
+
const { gh, githubRepository } = await import('../repos/github-connect-command.js');
|
|
26
|
+
const { SEQ_CI_REPOSITORY } = await import('../repos/github-init.js');
|
|
27
|
+
return {
|
|
28
|
+
exec: run,
|
|
29
|
+
workflowText: (release) => Buffer.from(gh(['api', `repos/${SEQ_CI_REPOSITORY}/contents/.github/workflows/pipeline.yml?ref=${release}`, '--jq', '.content']), 'base64').toString('utf8'),
|
|
30
|
+
githubRepository: (directory) => githubRepository({ directory }),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Everything a local run needs, read from the checkout's `.seq/github.yml` and its pinned seq-ci release. */
|
|
34
|
+
async function prepare({ args, deps }) {
|
|
35
|
+
const directory = resolve(flagString(args, 'dir') ?? '.');
|
|
36
|
+
const { resolveSettings } = await import('../repos/github-init.js');
|
|
37
|
+
const settings = await resolveSettings({ directory }).catch((error) => {
|
|
38
|
+
throw new UsageError(`No usable .seq/github.yml in ${directory}: ${error instanceof Error ? error.message : String(error)}. Set the repository up with seq-studio repo init.`);
|
|
39
|
+
});
|
|
40
|
+
const pins = seqCiPinsFromWorkflow({ workflowText: deps.workflowText(settings.seq_ci), release: settings.seq_ci });
|
|
41
|
+
const github = deps.githubRepository(directory);
|
|
42
|
+
const revisions = localRevisions({ directory, devBranch: settings.branches.dev, base: flagString(args, 'base'), head: flagString(args, 'head'), exec: deps.exec });
|
|
43
|
+
// Resolved once so SEQ_CI_DOCKER reaches every image step, not only the check runner.
|
|
44
|
+
const docker = dockerExecutable();
|
|
45
|
+
const tools = await seqCiToolsDirectory({ pins, docker, exec: deps.exec });
|
|
46
|
+
const candidateId = localImageId({ image: pins.candidateImage, docker, exec: deps.exec });
|
|
47
|
+
// Managed Pipelines stay released under the git-service name, as Atlas plans them.
|
|
48
|
+
return { tools, pins, directory, githubRepositoryId: github.id, repository: settings.release_repository ?? github.repository, revisions, candidateId, docker };
|
|
49
|
+
}
|
|
50
|
+
function affected({ prepared, deps }) {
|
|
51
|
+
const result = deps.exec(process.execPath, affectedArgs(prepared), { cwd: prepared.directory });
|
|
52
|
+
if (result.status !== 0 && result.status !== ExitCode.Blocked) {
|
|
53
|
+
throw new Error(`affected.mjs failed: ${result.stderr.trim().split('\n').slice(-3).join(' ') || `exit ${result.status}`}`);
|
|
54
|
+
}
|
|
55
|
+
return { stdout: result.stdout, stderr: result.stderr, blocked: result.status === ExitCode.Blocked, ...parseAffected(result.stdout) };
|
|
56
|
+
}
|
|
57
|
+
export async function runAffectedCommand(args, deps) {
|
|
58
|
+
if (args.flags.help === true || args.flags.h === true) {
|
|
59
|
+
console.log(AFFECTED_USAGE);
|
|
60
|
+
return ExitCode.Ok;
|
|
61
|
+
}
|
|
62
|
+
const resolved = deps ?? await defaultDeps();
|
|
63
|
+
const prepared = await prepare({ args, deps: resolved });
|
|
64
|
+
const result = affected({ prepared, deps: resolved });
|
|
65
|
+
if (args.flags.json === true)
|
|
66
|
+
console.log(result.stdout.trim());
|
|
67
|
+
else {
|
|
68
|
+
console.log(`seq-ci ${prepared.pins.release} · ${prepared.revisions.base.slice(0, 7)}..${prepared.revisions.head.slice(0, 7)}`);
|
|
69
|
+
for (const target of result.targets)
|
|
70
|
+
console.log(`${target.affected ? 'check' : 'skip '} ${target.key}${target.reasons.length ? ` ${target.reasons.join('; ')}` : ''}`);
|
|
71
|
+
}
|
|
72
|
+
for (const finding of result.findings)
|
|
73
|
+
console.error(`${finding.severity}: ${finding.target ? `${finding.target}: ` : ''}${finding.message}`);
|
|
74
|
+
return result.blocked ? ExitCode.Blocked : ExitCode.Ok;
|
|
75
|
+
}
|
|
76
|
+
export async function runCheckCommand(args, deps) {
|
|
77
|
+
if (args.flags.help === true || args.flags.h === true) {
|
|
78
|
+
console.log(CHECK_USAGE);
|
|
79
|
+
return ExitCode.Ok;
|
|
80
|
+
}
|
|
81
|
+
const resolved = deps ?? await defaultDeps();
|
|
82
|
+
const prepared = await prepare({ args, deps: resolved });
|
|
83
|
+
const plan = affected({ prepared, deps: resolved });
|
|
84
|
+
for (const finding of plan.findings)
|
|
85
|
+
console.error(`${finding.severity}: ${finding.target ? `${finding.target}: ` : ''}${finding.message}`);
|
|
86
|
+
if (plan.blocked)
|
|
87
|
+
return ExitCode.Blocked;
|
|
88
|
+
const known = new Set(plan.targets.map(({ key }) => key));
|
|
89
|
+
const unknown = args.positional.filter((target) => !known.has(target));
|
|
90
|
+
if (unknown.length)
|
|
91
|
+
throw new UsageError(`Unknown target${unknown.length > 1 ? 's' : ''} ${unknown.join(', ')}. Targets: ${[...known].join(', ') || 'none'}`);
|
|
92
|
+
const targets = args.positional.length ? args.positional : plan.targets.filter(({ affected: reached }) => reached).map(({ key }) => key);
|
|
93
|
+
if (!targets.length) {
|
|
94
|
+
console.log('Nothing to check: no target is affected by this change.');
|
|
95
|
+
return ExitCode.Ok;
|
|
96
|
+
}
|
|
97
|
+
const { docker } = prepared;
|
|
98
|
+
const auth = registryAuth();
|
|
99
|
+
if (!auth) {
|
|
100
|
+
throw new Error('check installs dependencies from the Chainguard registry, as CI does, and found no credential for it. ' +
|
|
101
|
+
'Log in to libraries.cgr.dev in ~/.npmrc (an //libraries.cgr.dev/...:_auth= line), or set SEQ_CI_REGISTRY_AUTH to that value.');
|
|
102
|
+
}
|
|
103
|
+
const nextId = localImageId({ image: prepared.pins.nextImage, docker, exec: resolved.exec });
|
|
104
|
+
const runId = `local:${Date.now()}`;
|
|
105
|
+
const failed = [];
|
|
106
|
+
for (const target of targets) {
|
|
107
|
+
console.error(`checking ${target}…`);
|
|
108
|
+
const result = resolved.exec(process.execPath, checkArgs({ ...prepared, nextId, target, runId }), {
|
|
109
|
+
cwd: prepared.directory, stdio: 'inherit', env: { ...process.env, SEQ_CI_DOCKER: docker, SEQ_CI_REGISTRY_AUTH: auth },
|
|
110
|
+
});
|
|
111
|
+
if (result.status !== 0)
|
|
112
|
+
failed.push(target);
|
|
113
|
+
}
|
|
114
|
+
console.log(failed.length ? `${failed.length} of ${targets.length} failed: ${failed.join(', ')}` : `${targets.length} passed`);
|
|
115
|
+
return failed.length ? ExitCode.Failed : ExitCode.Ok;
|
|
116
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App lifecycle at the top level: `apply` and `status` (spec §4).
|
|
3
|
+
*
|
|
4
|
+
* `apply` is the app-level deploy under its 1.0 name. Once a repository is
|
|
5
|
+
* connected to deploy from GitHub, deploying one of its stages from a laptop is
|
|
6
|
+
* refused unless the caller names a reason with `--break-glass`.
|
|
7
|
+
*
|
|
8
|
+
* This is the CLI's half. Atlas checks every laptop deploy of a resource a connected
|
|
9
|
+
* repository controls: it warns, or refuses where the connection enforces it, unless the
|
|
10
|
+
* request carries the break-glass reason (laptop-deploy-guard.ts).
|
|
11
|
+
*/
|
|
12
|
+
import type { ParsedArgs } from '../argv.js';
|
|
13
|
+
export declare function runApplyCommand(args: ParsedArgs): Promise<number>;
|
|
14
|
+
export declare function runStatusCommand(args: ParsedArgs): Promise<number>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ExitCode, UsageError } from '../exit-codes.js';
|
|
2
|
+
const APPLY_USAGE = `usage:
|
|
3
|
+
seq-studio apply -e <env> [--only <id1,id2>] [--dir <app>] [--yes] [--dry-run]
|
|
4
|
+
|
|
5
|
+
Deploy this app's primitives from sequence.app.yml (formerly seq-studio deploy).
|
|
6
|
+
When this GitHub repository is connected to deploy <env>'s stage from GitHub, apply
|
|
7
|
+
from a laptop is refused: merge to the dev branch, or Promote, instead. apply
|
|
8
|
+
deploys only platform git-service clones, so in an emergency deploy the one
|
|
9
|
+
affected primitive with its own command (for example seq-studio function deploy).
|
|
10
|
+
--break-glass "<reason>" is recorded on a git-service clone whose connection
|
|
11
|
+
cannot be confirmed.
|
|
12
|
+
|
|
13
|
+
All other options are those of the app deploy: seq-studio apply --help-deploy.`;
|
|
14
|
+
const STATUS_USAGE = `usage:
|
|
15
|
+
seq-studio status [-e <env>] [--stage staging|prod] [--limit <n>] [--dir <checkout>] [--json]
|
|
16
|
+
seq-studio status --compare <env-a> <env-b> [--dir <checkout>]
|
|
17
|
+
|
|
18
|
+
This repository's releases on an Atlas, newest first, with each target's state.
|
|
19
|
+
Inside a repository on a terminal, -e defaults to staging; scripts and --json must pass -e.
|
|
20
|
+
--compare prints both environments, one after the other; it does not take --json.`;
|
|
21
|
+
function flagString(args, name) {
|
|
22
|
+
const value = args.flags[name];
|
|
23
|
+
return typeof value === 'string' ? value : undefined;
|
|
24
|
+
}
|
|
25
|
+
/** The numeric id of the checkout's GitHub origin, or null when it is not a GitHub checkout or gh cannot read it. */
|
|
26
|
+
async function githubRepositoryId(directory) {
|
|
27
|
+
const { githubRepository } = await import('../repos/github-connect-command.js');
|
|
28
|
+
try {
|
|
29
|
+
return githubRepository({ directory }).id;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Whether this checkout's GitHub repository deploys to the target from GitHub.
|
|
37
|
+
* `unknown` when it cannot be read (not a GitHub checkout, no gh, or not in the release group).
|
|
38
|
+
*/
|
|
39
|
+
async function connectionState(args) {
|
|
40
|
+
const id = await githubRepositoryId(flagString(args, 'dir') ?? '.');
|
|
41
|
+
if (!id)
|
|
42
|
+
return 'unknown';
|
|
43
|
+
try {
|
|
44
|
+
const [{ getJson }, { buildContext, clientOptions }] = await Promise.all([import('../atlas-client.js'), import('../functions/commands.js')]);
|
|
45
|
+
const ctx = await buildContext(args);
|
|
46
|
+
const { connections } = await getJson({ ...clientOptions(ctx), path: `/api/ci/github/connections?githubRepositoryId=${id}` });
|
|
47
|
+
return connections.length > 0 ? 'connected' : 'not-connected';
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return 'unknown';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export async function runApplyCommand(args) {
|
|
54
|
+
if (args.flags.help === true || args.flags.h === true) {
|
|
55
|
+
console.log(APPLY_USAGE);
|
|
56
|
+
return ExitCode.Ok;
|
|
57
|
+
}
|
|
58
|
+
const { runAppDeployCommand, APP_DEPLOY_USAGE } = await import('../app/commands.js');
|
|
59
|
+
if (args.flags['help-deploy'] === true) {
|
|
60
|
+
console.log(APP_DEPLOY_USAGE.replaceAll('seq-studio deploy', 'seq-studio apply'));
|
|
61
|
+
return ExitCode.Ok;
|
|
62
|
+
}
|
|
63
|
+
// The router takes --break-glass off argv for every command and hands its reason over in the environment.
|
|
64
|
+
const breakGlass = args.flags['break-glass'] ?? process.env.SEQ_STUDIO_BREAK_GLASS;
|
|
65
|
+
if (breakGlass === true || (typeof breakGlass === 'string' && breakGlass.trim() === '')) {
|
|
66
|
+
throw new UsageError('--break-glass needs a reason: --break-glass "<why CI cannot deploy this>"');
|
|
67
|
+
}
|
|
68
|
+
const { ['break-glass']: _reason, ...flags } = args.flags;
|
|
69
|
+
const forwarded = { ...args, flags };
|
|
70
|
+
if (args.flags['dry-run'] !== true) {
|
|
71
|
+
const state = await connectionState(args);
|
|
72
|
+
if (state === 'connected') {
|
|
73
|
+
console.error('error this repository deploys from GitHub; apply from a laptop is refused');
|
|
74
|
+
console.error(' why: it is connected (seq-studio repo status), so its dev branch deploys staging and Promote deploys prod');
|
|
75
|
+
console.error(' next: merge to the dev branch, or Promote in GitHub; in an emergency, deploy the one affected primitive with its own command (for example seq-studio function deploy)');
|
|
76
|
+
return ExitCode.Usage;
|
|
77
|
+
}
|
|
78
|
+
if (typeof breakGlass === 'string') {
|
|
79
|
+
console.error(`note: break-glass deploy (connection not confirmed): ${breakGlass}`);
|
|
80
|
+
}
|
|
81
|
+
else if (state === 'unknown') {
|
|
82
|
+
console.error('note: could not confirm whether this repository deploys from GitHub; if it does, use that path instead');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return runAppDeployCommand(forwarded);
|
|
86
|
+
}
|
|
87
|
+
function isTerminal() {
|
|
88
|
+
return process.stdout.isTTY === true && process.stdin.isTTY === true;
|
|
89
|
+
}
|
|
90
|
+
export async function runStatusCommand(args) {
|
|
91
|
+
if (args.flags.help === true || args.flags.h === true) {
|
|
92
|
+
console.log(STATUS_USAGE);
|
|
93
|
+
return ExitCode.Ok;
|
|
94
|
+
}
|
|
95
|
+
const { runRepoConnectCommand } = await import('../repos/github-connect-command.js');
|
|
96
|
+
const compare = args.flags.compare;
|
|
97
|
+
if (compare !== undefined) {
|
|
98
|
+
const envs = [typeof compare === 'string' ? compare : undefined, args.positional[0]].filter((value) => Boolean(value));
|
|
99
|
+
if (envs.length !== 2)
|
|
100
|
+
throw new UsageError('--compare needs two environments: seq-studio status --compare <env-a> <env-b>');
|
|
101
|
+
// Two headed sections are not one JSON document.
|
|
102
|
+
if (args.flags.json === true)
|
|
103
|
+
throw new UsageError('--compare prints for people; for JSON run seq-studio status -e <env> --json once per environment');
|
|
104
|
+
let worst = ExitCode.Ok;
|
|
105
|
+
for (const env of envs) {
|
|
106
|
+
console.log(`== ${env} ==`);
|
|
107
|
+
const { compare: _compare, ...flags } = args.flags;
|
|
108
|
+
worst = Math.max(worst, await runRepoConnectCommand('status', { ...args, positional: [], flags: { ...flags, env } }));
|
|
109
|
+
}
|
|
110
|
+
return worst;
|
|
111
|
+
}
|
|
112
|
+
const hasEnv = typeof args.flags.env === 'string' || typeof args.flags.e === 'string';
|
|
113
|
+
if (!hasEnv) {
|
|
114
|
+
const { repositoryOrg } = await import('../orgs.js');
|
|
115
|
+
if (args.flags.json === true || !isTerminal() || !await repositoryOrg(flagString(args, 'dir') ?? '.')) {
|
|
116
|
+
throw new UsageError('status needs -e <env> here; it defaults to staging only inside a repository on a terminal, without --json');
|
|
117
|
+
}
|
|
118
|
+
return runRepoConnectCommand('status', { ...args, flags: { ...args.flags, env: 'staging' } });
|
|
119
|
+
}
|
|
120
|
+
return runRepoConnectCommand('status', args);
|
|
121
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ParsedArgs } from '../argv.js';
|
|
2
|
+
import type { CheckDeps } from './check.js';
|
|
3
|
+
interface PlannedTarget {
|
|
4
|
+
key: string;
|
|
5
|
+
action: string;
|
|
6
|
+
buildRequired?: boolean;
|
|
7
|
+
reasons?: string[];
|
|
8
|
+
}
|
|
9
|
+
interface PlanFinding {
|
|
10
|
+
severity: string;
|
|
11
|
+
message: string;
|
|
12
|
+
target?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PreviewResult {
|
|
15
|
+
planHash: string;
|
|
16
|
+
targets: PlannedTarget[];
|
|
17
|
+
plan?: {
|
|
18
|
+
findings?: PlanFinding[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface PlanDeps extends CheckDeps {
|
|
22
|
+
post: (args: {
|
|
23
|
+
args: ParsedArgs;
|
|
24
|
+
body: unknown;
|
|
25
|
+
}) => Promise<PreviewResult>;
|
|
26
|
+
}
|
|
27
|
+
export declare function runPlanCommand(args: ParsedArgs, deps?: PlanDeps): Promise<number>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `seq-studio plan`: what merging (staging) or promoting (prod) this committed change would do on an Atlas, from
|
|
3
|
+
* that Atlas's own receipts and live state. The request is built by the repository's pinned seq-ci planner, exactly
|
|
4
|
+
* as its deploy job builds one, and Atlas plans it as it plans a pull request: nothing is stored, built or deployed.
|
|
5
|
+
*/
|
|
6
|
+
import { resolve } from 'node:path';
|
|
7
|
+
import { ExitCode, UsageError } from '../exit-codes.js';
|
|
8
|
+
import { dockerExecutable, localRevisions, run, seqCiPinsFromWorkflow, seqCiToolsDirectory } from './seq-ci-tools.js';
|
|
9
|
+
const PLAN_USAGE = `usage:
|
|
10
|
+
seq-studio plan -e <env> [--stage staging|prod] [--base <rev>] [--head <rev>] [--dir <checkout>] [--json]
|
|
11
|
+
|
|
12
|
+
What this committed change would do on an Atlas: each target's action (create, update, unchanged, blocked) and
|
|
13
|
+
every finding, from that Atlas's receipts and live state. Nothing is stored, built or deployed. --stage defaults to
|
|
14
|
+
the stage -e names (-e <org>/staging, -e <org>/prod); staging compares HEAD with origin/<dev>, prod with
|
|
15
|
+
origin/<release>. Exit 3 when the plan has blocking findings. Needs the release group, Docker, gh, and read
|
|
16
|
+
access to the seq-ci image registry.`;
|
|
17
|
+
/**
|
|
18
|
+
* Builds the plan request with the pinned planner bundle; prints it as JSON on stdout. Like deploy.mjs, it sends the
|
|
19
|
+
* build identity the tools bundle recorded for exactly these images, so Atlas keys builds as CI does and finds them.
|
|
20
|
+
*/
|
|
21
|
+
const REQUEST_BUILDER = `
|
|
22
|
+
const { existsSync } = await import('node:fs')
|
|
23
|
+
const { dirname, join } = await import('node:path')
|
|
24
|
+
const [planner, cwd, stage, baseSha, headSha, image, nextImage] = process.argv.slice(1)
|
|
25
|
+
const { githubPlanRequest, gitBlobReader, readTree, EMPTY_TREE_SHA } = await import(planner)
|
|
26
|
+
const tools = dirname(planner)
|
|
27
|
+
const identityModule = join(tools, 'toolchain-identity.mjs')
|
|
28
|
+
const buildIdentity = existsSync(identityModule)
|
|
29
|
+
? await (await import(identityModule)).recordedToolchainIdentity({ directory: tools, image, nextImage })
|
|
30
|
+
: undefined
|
|
31
|
+
const baseEntries = baseSha === EMPTY_TREE_SHA ? [] : await readTree({ cwd, revision: baseSha })
|
|
32
|
+
const headEntries = await readTree({ cwd, revision: headSha })
|
|
33
|
+
const toolchain = { image, nextImage, ...(buildIdentity ? { buildIdentity } : {}) }
|
|
34
|
+
const request = await githubPlanRequest({ stage, baseSha, headSha, baseEntries, headEntries, readBlobs: gitBlobReader({ cwd }), toolchain })
|
|
35
|
+
process.stdout.write(JSON.stringify(request))
|
|
36
|
+
`;
|
|
37
|
+
/** Post the plan, and again without the build identity to an Atlas that predates identities, as CI does. */
|
|
38
|
+
async function postPlan({ post, args, githubRepositoryId, plan }) {
|
|
39
|
+
try {
|
|
40
|
+
return await post({ args, body: { githubRepositoryId, plan } });
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const status = error instanceof Error ? Reflect.get(error, 'status') : undefined;
|
|
44
|
+
if (status !== 400 || !plan.toolchain?.buildIdentity || !String(error.message).includes('buildIdentity'))
|
|
45
|
+
throw error;
|
|
46
|
+
const { buildIdentity: _omitted, ...toolchain } = plan.toolchain;
|
|
47
|
+
return post({ args, body: { githubRepositoryId, plan: { ...plan, toolchain } } });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function flagString(args, name) {
|
|
51
|
+
const value = args.flags[name];
|
|
52
|
+
if (value === true)
|
|
53
|
+
throw new UsageError(`--${name} needs a value`);
|
|
54
|
+
return typeof value === 'string' ? value : undefined;
|
|
55
|
+
}
|
|
56
|
+
function stageFrom({ args, envName }) {
|
|
57
|
+
const explicit = flagString(args, 'stage');
|
|
58
|
+
const named = envName.includes('/') ? envName.slice(envName.indexOf('/') + 1) : envName;
|
|
59
|
+
const stage = explicit ?? (named === 'staging' || named === 'prod' ? named : undefined);
|
|
60
|
+
if (stage !== 'staging' && stage !== 'prod')
|
|
61
|
+
throw new UsageError('plan needs --stage staging|prod (or -e <org>/staging, -e <org>/prod)');
|
|
62
|
+
return stage;
|
|
63
|
+
}
|
|
64
|
+
async function defaultDeps() {
|
|
65
|
+
const { gh, githubRepository } = await import('../repos/github-connect-command.js');
|
|
66
|
+
const { SEQ_CI_REPOSITORY } = await import('../repos/github-init.js');
|
|
67
|
+
return {
|
|
68
|
+
exec: run,
|
|
69
|
+
workflowText: (release) => Buffer.from(gh(['api', `repos/${SEQ_CI_REPOSITORY}/contents/.github/workflows/pipeline.yml?ref=${release}`, '--jq', '.content']), 'base64').toString('utf8'),
|
|
70
|
+
githubRepository: (directory) => githubRepository({ directory }),
|
|
71
|
+
post: async ({ args, body }) => {
|
|
72
|
+
const [{ postJson }, { buildContext, clientOptions }] = await Promise.all([import('../atlas-client.js'), import('../functions/commands.js')]);
|
|
73
|
+
return postJson({ ...clientOptions(await buildContext(args)), path: '/api/ci/github/plan/preview', body });
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export async function runPlanCommand(args, deps) {
|
|
78
|
+
if (args.flags.help === true || args.flags.h === true) {
|
|
79
|
+
console.log(PLAN_USAGE);
|
|
80
|
+
return ExitCode.Ok;
|
|
81
|
+
}
|
|
82
|
+
const envName = flagString(args, 'env') ?? flagString(args, 'e');
|
|
83
|
+
if (!envName)
|
|
84
|
+
throw new UsageError('plan needs -e <env>: the Atlas to plan against');
|
|
85
|
+
const stage = stageFrom({ args, envName });
|
|
86
|
+
const resolved = deps ?? await defaultDeps();
|
|
87
|
+
const directory = resolve(flagString(args, 'dir') ?? '.');
|
|
88
|
+
const { resolveSettings } = await import('../repos/github-init.js');
|
|
89
|
+
const settings = await resolveSettings({ directory }).catch((error) => {
|
|
90
|
+
throw new UsageError(`No usable .seq/github.yml in ${directory}: ${error instanceof Error ? error.message : String(error)}. Set the repository up with seq-studio repo init.`);
|
|
91
|
+
});
|
|
92
|
+
const pins = seqCiPinsFromWorkflow({ workflowText: resolved.workflowText(settings.seq_ci), release: settings.seq_ci });
|
|
93
|
+
const github = resolved.githubRepository(directory);
|
|
94
|
+
const revisions = localRevisions({ directory, devBranch: stage === 'prod' ? settings.branches.release : settings.branches.dev,
|
|
95
|
+
base: flagString(args, 'base'), head: flagString(args, 'head'), exec: resolved.exec });
|
|
96
|
+
const tools = await seqCiToolsDirectory({ pins, docker: dockerExecutable(), exec: resolved.exec });
|
|
97
|
+
const built = resolved.exec(process.execPath, ['--input-type=module', '-e', REQUEST_BUILDER,
|
|
98
|
+
`${tools}/planner.mjs`, directory, stage, revisions.base, revisions.head, pins.candidateImage, pins.nextImage], { cwd: directory });
|
|
99
|
+
if (built.status !== 0)
|
|
100
|
+
throw new Error(`Building the plan request failed: ${built.stderr.trim().split('\n').slice(-3).join(' ')}`);
|
|
101
|
+
const result = await postPlan({ post: resolved.post, args, githubRepositoryId: github.id, plan: JSON.parse(built.stdout) });
|
|
102
|
+
const findings = result.plan?.findings ?? [];
|
|
103
|
+
if (args.flags.json === true)
|
|
104
|
+
console.log(JSON.stringify(result, null, 2));
|
|
105
|
+
else {
|
|
106
|
+
console.log(`${stage} plan of ${revisions.base.slice(0, 7)}..${revisions.head.slice(0, 7)} (seq-ci ${pins.release}, plan ${result.planHash.slice(0, 12)})`);
|
|
107
|
+
for (const target of result.targets)
|
|
108
|
+
console.log(` ${target.action.padEnd(10)} ${target.key}${target.buildRequired ? ' (builds)' : ''}`);
|
|
109
|
+
}
|
|
110
|
+
for (const finding of findings)
|
|
111
|
+
console.error(`${finding.severity}: ${finding.target ? `${finding.target}: ` : ''}${finding.message}`);
|
|
112
|
+
return findings.some((finding) => finding.severity === 'error') ? ExitCode.Blocked : ExitCode.Ok;
|
|
113
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `seq-studio rollback --to <rev>`: put the dev branch back to an earlier commit through the normal GitHub path.
|
|
3
|
+
*
|
|
4
|
+
* It commits the earlier commit's exact tree on top of origin/<dev> and opens a pull request. Merging it deploys
|
|
5
|
+
* staging the way any merge does; because the targets' build fingerprints are the earlier release's, the deploy
|
|
6
|
+
* reuses that release's verified outputs instead of rebuilding. Prod follows by Promote, as always.
|
|
7
|
+
*
|
|
8
|
+
* Nothing here deploys or calls Atlas: a rollback gets the same checks, merger authority and audit trail as any
|
|
9
|
+
* other change. For an incident that cannot wait for CI, the per-primitive rollbacks (`artifact rollback`,
|
|
10
|
+
* `function rollback`, `pipeline rollback`) re-activate a previous version directly.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync } from 'node:fs';
|
|
13
|
+
import { join, resolve } from 'node:path';
|
|
14
|
+
import { ExitCode, UsageError } from '../exit-codes.js';
|
|
15
|
+
import { run } from './seq-ci-tools.js';
|
|
16
|
+
const ROLLBACK_PR_TYPE = 'type: bug';
|
|
17
|
+
const ROLLBACK_USAGE = `usage:
|
|
18
|
+
seq-studio rollback --to <rev> [--dir <checkout>] [--no-push]
|
|
19
|
+
|
|
20
|
+
Open a pull request that puts the dev branch back to <rev>: one commit, on top of origin/<dev>, whose files are
|
|
21
|
+
exactly <rev>'s. Merging it deploys staging, reusing what <rev>'s release already built; Promote then takes it to
|
|
22
|
+
prod. Run git fetch first so origin/<dev> is current. --no-push creates the branch locally and prints the rest.
|
|
23
|
+
In an incident that cannot wait for CI, roll a single primitive back directly: seq-studio artifact|function|pipeline rollback.`;
|
|
24
|
+
function flagString(args, name) {
|
|
25
|
+
const value = args.flags[name];
|
|
26
|
+
if (value === true)
|
|
27
|
+
throw new UsageError(`--${name} needs a value`);
|
|
28
|
+
return typeof value === 'string' ? value : undefined;
|
|
29
|
+
}
|
|
30
|
+
export async function runRollbackCommand(args, deps = { exec: run, now: () => new Date() }) {
|
|
31
|
+
if (args.flags.help === true || args.flags.h === true) {
|
|
32
|
+
console.log(ROLLBACK_USAGE);
|
|
33
|
+
return ExitCode.Ok;
|
|
34
|
+
}
|
|
35
|
+
const to = flagString(args, 'to');
|
|
36
|
+
if (!to)
|
|
37
|
+
throw new UsageError('rollback needs --to <rev>: the earlier commit whose files the dev branch should have again');
|
|
38
|
+
const directory = resolve(flagString(args, 'dir') ?? '.');
|
|
39
|
+
const { resolveSettings } = await import('../repos/github-init.js');
|
|
40
|
+
const settings = await resolveSettings({ directory }).catch((error) => {
|
|
41
|
+
throw new UsageError(`No usable .seq/github.yml in ${directory}: ${error instanceof Error ? error.message : String(error)}. Set the repository up with seq-studio repo init.`);
|
|
42
|
+
});
|
|
43
|
+
const dev = settings.branches.dev;
|
|
44
|
+
const git = (gitArgs) => {
|
|
45
|
+
const result = deps.exec('git', ['-C', directory, ...gitArgs]);
|
|
46
|
+
if (result.status !== 0)
|
|
47
|
+
throw new Error(`git ${gitArgs[0]} failed: ${result.stderr.trim().split('\n').slice(-2).join(' ')}`);
|
|
48
|
+
return result.stdout.trim();
|
|
49
|
+
};
|
|
50
|
+
const tip = git(['rev-parse', '--verify', `refs/remotes/origin/${dev}^{commit}`]);
|
|
51
|
+
const target = git(['rev-parse', '--verify', `${to}^{commit}`]);
|
|
52
|
+
if (deps.exec('git', ['-C', directory, 'merge-base', '--is-ancestor', target, tip]).status !== 0) {
|
|
53
|
+
throw new UsageError(`${to} is not on origin/${dev}; roll back only to a commit the dev branch already had`);
|
|
54
|
+
}
|
|
55
|
+
if (git(['rev-parse', `${target}^{tree}`]) === git(['rev-parse', `${tip}^{tree}`])) {
|
|
56
|
+
console.log(`origin/${dev} already has ${to}'s files; nothing to roll back.`);
|
|
57
|
+
return ExitCode.Ok;
|
|
58
|
+
}
|
|
59
|
+
const short = target.slice(0, 7);
|
|
60
|
+
const message = `Roll back ${dev} to ${short}\n\nRestores the files of ${target} on top of ${tip.slice(0, 7)}, made with seq-studio rollback.`;
|
|
61
|
+
const commit = git(['commit-tree', `${target}^{tree}`, '-p', tip, '-m', message]);
|
|
62
|
+
const stamp = deps.now().toISOString().replace(/[-:]/g, '').replace(/\..*$/, '');
|
|
63
|
+
const branch = `rollback/${short}-${stamp}`;
|
|
64
|
+
git(['branch', branch, commit]);
|
|
65
|
+
console.log(`Created ${branch}: ${dev} with ${short}'s files (commit ${commit.slice(0, 7)}).`);
|
|
66
|
+
const title = `Roll back ${dev} to ${short}`;
|
|
67
|
+
const prCommand = ['gh', 'pr', 'create', '--base', dev, '--head', branch, '--title', title, '--body', `Restores the files of ${target}. Merging deploys staging, reusing ${short}'s verified builds; Promote takes it to prod.`];
|
|
68
|
+
// repo init requires exactly one type label (pr-type); a rollback undoes a change that went wrong.
|
|
69
|
+
const labeled = existsSync(join(directory, '.github', 'pr-types.json')) ? [...prCommand, '--label', ROLLBACK_PR_TYPE] : prCommand;
|
|
70
|
+
if (args.flags['no-push'] === true) {
|
|
71
|
+
console.log(`Next: git push -u origin ${branch}`);
|
|
72
|
+
console.log(`Then: ${labeled.map((part) => (/\s/.test(part) ? JSON.stringify(part) : part)).join(' ')}`);
|
|
73
|
+
return ExitCode.Ok;
|
|
74
|
+
}
|
|
75
|
+
git(['push', '-u', 'origin', branch]);
|
|
76
|
+
let pr = deps.exec(labeled[0], labeled.slice(1), { cwd: directory });
|
|
77
|
+
if (pr.status !== 0 && labeled !== prCommand) {
|
|
78
|
+
// The label may not exist yet (repo init's label sync has not run): open it unlabeled and say which to add.
|
|
79
|
+
pr = deps.exec(prCommand[0], prCommand.slice(1), { cwd: directory });
|
|
80
|
+
if (pr.status === 0)
|
|
81
|
+
console.error(`note: add the "${ROLLBACK_PR_TYPE}" label to the pull request; its pr-type check requires one.`);
|
|
82
|
+
}
|
|
83
|
+
if (pr.status !== 0) {
|
|
84
|
+
console.error(`note: could not open the pull request with gh (${pr.stderr.trim().split('\n').at(-1) ?? 'unknown error'}); open it from ${branch} into ${dev}.`);
|
|
85
|
+
return ExitCode.Ok;
|
|
86
|
+
}
|
|
87
|
+
console.log(`Opened ${pr.stdout.trim()}. Merge it to deploy staging; then Promote to take it to prod.`);
|
|
88
|
+
return ExitCode.Ok;
|
|
89
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the repository's pinned seq-ci release on this machine: the same `affected.mjs` and `check.mjs` its GitHub
|
|
3
|
+
* jobs run, from the same tools image, against the same candidate images. Nothing here reimplements the planner, so
|
|
4
|
+
* a local pass means what a CI pass means.
|
|
5
|
+
*
|
|
6
|
+
* The tools are copied out of the release's tools image once per digest into
|
|
7
|
+
* `~/.cache/seq-studio/seq-ci-tools/<digest>`. Pulling the images needs read access to their registry, as CI has.
|
|
8
|
+
*/
|
|
9
|
+
import { type SpawnSyncOptions } from 'node:child_process';
|
|
10
|
+
export interface SeqCiPins {
|
|
11
|
+
release: string;
|
|
12
|
+
toolsImage: string;
|
|
13
|
+
candidateImage: string;
|
|
14
|
+
nextImage: string;
|
|
15
|
+
policyVersion: string;
|
|
16
|
+
}
|
|
17
|
+
/** The images and policy version a seq-ci release's pipeline workflow pins. */
|
|
18
|
+
export declare function seqCiPinsFromWorkflow({ workflowText, release }: {
|
|
19
|
+
workflowText: string;
|
|
20
|
+
release: string;
|
|
21
|
+
}): SeqCiPins;
|
|
22
|
+
export type Run = (command: string, args: string[], options?: SpawnSyncOptions) => {
|
|
23
|
+
status: number | null;
|
|
24
|
+
stdout: string;
|
|
25
|
+
stderr: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const run: Run;
|
|
28
|
+
export declare function toolsCacheRoot(): string;
|
|
29
|
+
/** The release's tools directory, copied out of its tools image the first time this digest is used. */
|
|
30
|
+
export declare function seqCiToolsDirectory({ pins, docker, exec, cacheRoot }: {
|
|
31
|
+
pins: SeqCiPins;
|
|
32
|
+
docker?: string;
|
|
33
|
+
exec?: Run;
|
|
34
|
+
cacheRoot?: string;
|
|
35
|
+
}): Promise<string>;
|
|
36
|
+
/** A pinned image's local image id, pulling it first: what the planner and checks key their toolchain on. */
|
|
37
|
+
export declare function localImageId({ image, docker, exec }: {
|
|
38
|
+
image: string;
|
|
39
|
+
docker?: string;
|
|
40
|
+
exec?: Run;
|
|
41
|
+
}): string;
|
|
42
|
+
export interface RepositoryRevisions {
|
|
43
|
+
base: string;
|
|
44
|
+
head: string;
|
|
45
|
+
branch: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* What a local run compares: the committed HEAD against where it left the dev branch, as a pull request into it would.
|
|
49
|
+
* Uncommitted edits are never part of a plan or check; CI sees only commits.
|
|
50
|
+
*/
|
|
51
|
+
export declare function localRevisions({ directory, devBranch, base, head, exec }: {
|
|
52
|
+
directory: string;
|
|
53
|
+
devBranch: string;
|
|
54
|
+
base?: string;
|
|
55
|
+
head?: string;
|
|
56
|
+
exec?: Run;
|
|
57
|
+
}): RepositoryRevisions;
|
|
58
|
+
export interface ToolRun {
|
|
59
|
+
tools: string;
|
|
60
|
+
pins: SeqCiPins;
|
|
61
|
+
directory: string;
|
|
62
|
+
githubRepositoryId: string;
|
|
63
|
+
repository: string;
|
|
64
|
+
revisions: RepositoryRevisions;
|
|
65
|
+
}
|
|
66
|
+
/** `node affected.mjs` arguments, exactly as seq-ci's plan job passes them. */
|
|
67
|
+
export declare function affectedArgs({ tools, pins, directory, githubRepositoryId, repository, revisions, candidateId }: ToolRun & {
|
|
68
|
+
candidateId: string;
|
|
69
|
+
}): string[];
|
|
70
|
+
/** `node check.mjs` arguments for one target, exactly as seq-ci's check job passes them. */
|
|
71
|
+
export declare function checkArgs({ tools, pins, directory, githubRepositoryId, repository, revisions, candidateId, nextId, target, runId }: ToolRun & {
|
|
72
|
+
candidateId: string;
|
|
73
|
+
nextId: string;
|
|
74
|
+
target: string;
|
|
75
|
+
runId: string;
|
|
76
|
+
}): string[];
|
|
77
|
+
export interface AffectedTarget {
|
|
78
|
+
key: string;
|
|
79
|
+
affected: boolean;
|
|
80
|
+
reasons: string[];
|
|
81
|
+
}
|
|
82
|
+
/** The targets in affected.mjs's JSON result. */
|
|
83
|
+
export declare function parseAffected(stdout: string): {
|
|
84
|
+
targets: AffectedTarget[];
|
|
85
|
+
findings: Array<{
|
|
86
|
+
severity: string;
|
|
87
|
+
message: string;
|
|
88
|
+
target?: string;
|
|
89
|
+
}>;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The absolute path of `docker`, which seq-ci's check runner requires (it refuses bare executable names): SEQ_CI_DOCKER
|
|
93
|
+
* when set, else the first `docker` on PATH.
|
|
94
|
+
*/
|
|
95
|
+
export declare function dockerExecutable({ env, isExecutable }?: {
|
|
96
|
+
env?: NodeJS.ProcessEnv;
|
|
97
|
+
isExecutable?: (path: string) => boolean;
|
|
98
|
+
}): string;
|
|
99
|
+
/**
|
|
100
|
+
* The dependency registry credential seq-ci's dependency preparation uses: SEQ_CI_REGISTRY_AUTH when set, else the
|
|
101
|
+
* Chainguard `_auth` in the user's npm config, the same value CI's org secret holds. `${VAR}` references expand from the
|
|
102
|
+
* environment, as npm does. Undefined when neither has one.
|
|
103
|
+
*/
|
|
104
|
+
export declare function registryAuth({ env, readNpmrc }?: {
|
|
105
|
+
env?: NodeJS.ProcessEnv;
|
|
106
|
+
readNpmrc?: (path: string) => string | undefined;
|
|
107
|
+
}): string | undefined;
|