@intentius/chant 0.124.99 → 0.124.101
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/bin/chant +3 -3
- package/dist/action-pins.d.ts +2 -0
- package/dist/action-pins.js +3 -0
- package/dist/ci-detect.d.ts +13 -0
- package/dist/ci-detect.js +12 -0
- package/dist/ci-system.d.ts +66 -0
- package/dist/ci-system.js +61 -0
- package/dist/cli/commands/carve-emit.js +2 -2
- package/dist/cli/commands/check-lexicon-plugin.d.ts +2 -2
- package/dist/cli/commands/check-lexicon-plugin.js +3 -3
- package/dist/cli/commands/check-lexicon.js +4 -4
- package/dist/cli/commands/init-lexicon/templates/project.d.ts +1 -1
- package/dist/cli/commands/init-lexicon/templates/project.js +4 -4
- package/dist/cli/commands/init.d.ts +13 -0
- package/dist/cli/commands/init.js +30 -2
- package/dist/cli/handlers/build.js +27 -0
- package/dist/cli/handlers/release-doctor.d.ts +12 -0
- package/dist/cli/handlers/release-doctor.js +118 -0
- package/dist/cli/handlers/release-init.d.ts +10 -0
- package/dist/cli/handlers/release-init.js +342 -0
- package/dist/cli/handlers/release.d.ts +50 -1
- package/dist/cli/handlers/release.js +688 -30
- package/dist/cli/handlers/run-generate.js +11 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +45 -97
- package/dist/cli/parse-args.js +55 -0
- package/dist/cli/registry.d.ts +18 -0
- package/dist/cli/release-commands/artifacts.d.ts +3 -0
- package/dist/cli/release-commands/artifacts.js +14 -0
- package/dist/cli/release-commands/candidates.d.ts +3 -0
- package/dist/cli/release-commands/candidates.js +16 -0
- package/dist/cli/release-commands/changed.d.ts +3 -0
- package/dist/cli/release-commands/changed.js +14 -0
- package/dist/cli/release-commands/compose.d.ts +3 -0
- package/dist/cli/release-commands/compose.js +16 -0
- package/dist/cli/release-commands/cut.d.ts +3 -0
- package/dist/cli/release-commands/cut.js +49 -0
- package/dist/cli/release-commands/doctor.d.ts +3 -0
- package/dist/cli/release-commands/doctor.js +14 -0
- package/dist/cli/release-commands/export.d.ts +3 -0
- package/dist/cli/release-commands/export.js +12 -0
- package/dist/cli/release-commands/images.d.ts +3 -0
- package/dist/cli/release-commands/images.js +13 -0
- package/dist/cli/release-commands/index.d.ts +8 -0
- package/dist/cli/release-commands/index.js +52 -0
- package/dist/cli/release-commands/init.d.ts +3 -0
- package/dist/cli/release-commands/init.js +16 -0
- package/dist/cli/release-commands/list.d.ts +3 -0
- package/dist/cli/release-commands/list.js +10 -0
- package/dist/cli/release-commands/next.d.ts +3 -0
- package/dist/cli/release-commands/next.js +13 -0
- package/dist/cli/release-commands/publish.d.ts +3 -0
- package/dist/cli/release-commands/publish.js +22 -0
- package/dist/cli/release-commands/stamp.d.ts +3 -0
- package/dist/cli/release-commands/stamp.js +15 -0
- package/dist/cli/release-commands/status.d.ts +3 -0
- package/dist/cli/release-commands/status.js +17 -0
- package/dist/cli/release-commands/tag.d.ts +3 -0
- package/dist/cli/release-commands/tag.js +12 -0
- package/dist/cli/release-commands/types.d.ts +20 -0
- package/dist/cli/release-commands/types.js +1 -0
- package/dist/cli/release-commands/verify.d.ts +3 -0
- package/dist/cli/release-commands/verify.js +15 -0
- package/dist/cli/release-commands/workflow.d.ts +3 -0
- package/dist/cli/release-commands/workflow.js +13 -0
- package/dist/codegen/pinned-upgrade.js +1 -1
- package/dist/components/capability-plugin.d.ts +1 -1
- package/dist/components/capability-plugin.js +1 -1
- package/dist/components/cli-support.d.ts +1 -1
- package/dist/components/cli-support.js +1 -1
- package/dist/config-environments.d.ts +8 -1
- package/dist/config-environments.js +2 -0
- package/dist/config.d.ts +299 -6
- package/dist/config.js +102 -5
- package/dist/dead-guards.d.ts +5 -1
- package/dist/dead-guards.js +34 -23
- package/dist/discovery/sandbox/driver.js +1 -1
- package/dist/discovery/specifier-resolve.js +1 -1
- package/dist/floor-table.d.ts +3 -1
- package/dist/floor-table.data.js +23 -3
- package/dist/floor-table.js +4 -3
- package/dist/forge-remote.d.ts +13 -0
- package/dist/forge-remote.js +15 -0
- package/dist/lexicon.d.ts +41 -2
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.js +270 -3
- package/dist/lifecycle/publish-attachments.d.ts +2 -1
- package/dist/lifecycle/publish-attachments.js +19 -2
- package/dist/lifecycle/publish-cargo.d.ts +99 -0
- package/dist/lifecycle/publish-cargo.js +412 -0
- package/dist/lifecycle/publish-credentials.d.ts +1 -1
- package/dist/lifecycle/publish-credentials.js +8 -0
- package/dist/lifecycle/publish-declaration.d.ts +199 -4
- package/dist/lifecycle/publish-declaration.js +200 -9
- package/dist/lifecycle/publish-forge.d.ts +45 -2
- package/dist/lifecycle/publish-forge.js +434 -34
- package/dist/lifecycle/publish-git-ssh.d.ts +15 -0
- package/dist/lifecycle/publish-git-ssh.js +30 -4
- package/dist/lifecycle/publish-github.d.ts +40 -2
- package/dist/lifecycle/publish-github.js +100 -3
- package/dist/lifecycle/publish-homebrew.d.ts +7 -9
- package/dist/lifecycle/publish-homebrew.js +34 -197
- package/dist/lifecycle/publish-index.d.ts +141 -0
- package/dist/lifecycle/publish-index.js +719 -0
- package/dist/lifecycle/publish-marketplace.js +77 -0
- package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
- package/dist/lifecycle/publish-mcp-registry.js +306 -0
- package/dist/lifecycle/publish-npm.js +165 -2
- package/dist/lifecycle/publish-oci.d.ts +34 -1
- package/dist/lifecycle/publish-oci.js +246 -7
- package/dist/lifecycle/publish-pypi.d.ts +136 -0
- package/dist/lifecycle/publish-pypi.js +657 -0
- package/dist/lifecycle/publish-record.d.ts +6 -3
- package/dist/lifecycle/publish-record.js +6 -3
- package/dist/lifecycle/publish-signing.d.ts +147 -0
- package/dist/lifecycle/publish-signing.js +257 -0
- package/dist/lifecycle/publish-targets.d.ts +27 -1
- package/dist/lifecycle/publish-targets.js +80 -0
- package/dist/lifecycle/publish-tauri.js +43 -0
- package/dist/lifecycle/publish-train-names.d.ts +54 -0
- package/dist/lifecycle/publish-train-names.js +118 -0
- package/dist/lifecycle/publish-verify.d.ts +121 -0
- package/dist/lifecycle/publish-verify.js +130 -0
- package/dist/lifecycle/query.js +8 -0
- package/dist/lifecycle/release-artifacts.d.ts +212 -0
- package/dist/lifecycle/release-artifacts.js +571 -0
- package/dist/lifecycle/release-changelog.d.ts +13 -1
- package/dist/lifecycle/release-changelog.js +35 -2
- package/dist/lifecycle/release-cut.d.ts +58 -3
- package/dist/lifecycle/release-cut.js +132 -34
- package/dist/lifecycle/release-doctor.d.ts +113 -0
- package/dist/lifecycle/release-doctor.js +996 -0
- package/dist/lifecycle/release-green.d.ts +86 -0
- package/dist/lifecycle/release-green.js +286 -0
- package/dist/lifecycle/release-init.d.ts +255 -0
- package/dist/lifecycle/release-init.js +859 -0
- package/dist/lifecycle/release-intents.d.ts +73 -0
- package/dist/lifecycle/release-intents.js +128 -0
- package/dist/lifecycle/release-next.d.ts +111 -0
- package/dist/lifecycle/release-next.js +252 -0
- package/dist/lifecycle/release-prerelease.d.ts +19 -0
- package/dist/lifecycle/release-prerelease.js +30 -0
- package/dist/lifecycle/release-publish.d.ts +256 -10
- package/dist/lifecycle/release-publish.js +246 -34
- package/dist/lifecycle/release-status-change.d.ts +226 -0
- package/dist/lifecycle/release-status-change.js +478 -0
- package/dist/lifecycle/release-status.d.ts +11 -0
- package/dist/lifecycle/release-status.js +1 -1
- package/dist/lifecycle/release-store.d.ts +73 -2
- package/dist/lifecycle/release-store.js +32 -1
- package/dist/lifecycle/release-tag.d.ts +142 -0
- package/dist/lifecycle/release-tag.js +323 -0
- package/dist/lifecycle/release-verify.d.ts +73 -1
- package/dist/lifecycle/release-verify.js +117 -2
- package/dist/lifecycle/release-version-formats.d.ts +73 -0
- package/dist/lifecycle/release-version-formats.js +570 -0
- package/dist/lifecycle/release-version.d.ts +58 -10
- package/dist/lifecycle/release-version.js +164 -36
- package/dist/lifecycle/release-workstation.d.ts +3 -2
- package/dist/lifecycle/release-workstation.js +3 -2
- package/dist/module-source.d.ts +2 -2
- package/dist/module-source.js +8 -8
- package/dist/op/generate-pipeline.js +1 -1
- package/dist/pr-forge-base.js +4 -2
- package/dist/pr-forge.d.ts +20 -2
- package/dist/pr-forge.js +46 -10
- package/dist/release-floors.d.ts +10 -1
- package/dist/release-floors.js +10 -1
- package/dist/tool-pins.d.ts +38 -0
- package/dist/tool-pins.js +54 -0
- package/dist/ts-loader.d.ts +1 -1
- package/dist/ts-loader.js +6 -6
- package/dist/wave-runtime.mjs +337 -334
- package/dist/workspace/ci-forge.d.ts +17 -0
- package/dist/workspace/ci-forge.js +17 -0
- package/dist/workspace/ci-init.js +1 -1
- package/dist/workspace/composites.schema.json +1 -0
- package/dist/workspace/declaration.d.ts +8 -0
- package/dist/workspace/declaration.js +12 -0
- package/dist/workspace/declaration.schema.json +8 -0
- package/dist/workspace/environments.d.ts +2 -0
- package/dist/workspace/environments.js +1 -1
- package/dist/workspace/identity-gate-rule.d.ts +61 -5
- package/dist/workspace/identity-gate-rule.js +81 -12
- package/dist/workspace/member-pipeline.d.ts +2 -1
- package/dist/workspace/member-pipeline.js +5 -2
- package/dist/workspace/reason-codes.d.ts +6 -0
- package/dist/workspace/reason-codes.js +8 -1
- package/dist/workspace/release-changed.d.ts +179 -0
- package/dist/workspace/release-changed.js +625 -0
- package/dist/workspace/release-changed.schema.json +206 -0
- package/dist/workspace/release-steps/artifacts.d.ts +7 -0
- package/dist/workspace/release-steps/artifacts.js +45 -0
- package/dist/workspace/release-steps/builds.d.ts +12 -0
- package/dist/workspace/release-steps/builds.js +38 -0
- package/dist/workspace/release-steps/doctor.d.ts +8 -0
- package/dist/workspace/release-steps/doctor.js +14 -0
- package/dist/workspace/release-steps/goreleaser.d.ts +16 -0
- package/dist/workspace/release-steps/goreleaser.js +36 -0
- package/dist/workspace/release-steps/green.d.ts +3 -0
- package/dist/workspace/release-steps/green.js +6 -0
- package/dist/workspace/release-steps/images.d.ts +22 -0
- package/dist/workspace/release-steps/images.js +59 -0
- package/dist/workspace/release-steps/index.d.ts +9 -0
- package/dist/workspace/release-steps/index.js +46 -0
- package/dist/workspace/release-steps/pypi.d.ts +15 -0
- package/dist/workspace/release-steps/pypi.js +21 -0
- package/dist/workspace/release-steps/qemu.d.ts +21 -0
- package/dist/workspace/release-steps/qemu.js +35 -0
- package/dist/workspace/release-steps/signing.d.ts +18 -0
- package/dist/workspace/release-steps/signing.js +30 -0
- package/dist/workspace/release-steps/stamp.d.ts +3 -0
- package/dist/workspace/release-steps/stamp.js +4 -0
- package/dist/workspace/release-steps/targets.d.ts +31 -0
- package/dist/workspace/release-steps/targets.js +40 -0
- package/dist/workspace/release-steps/types.d.ts +104 -0
- package/dist/workspace/release-steps/types.js +2 -0
- package/dist/workspace/release-steps/verify.d.ts +3 -0
- package/dist/workspace/release-steps/verify.js +4 -0
- package/dist/workspace/release-toolchains.d.ts +59 -0
- package/dist/workspace/release-toolchains.js +133 -0
- package/dist/workspace/release-train-workflow.d.ts +29 -0
- package/dist/workspace/release-train-workflow.js +85 -0
- package/dist/workspace/release-train.d.ts +3 -1
- package/dist/workspace/release-train.js +20 -3
- package/dist/workspace/release-workflow.d.ts +160 -61
- package/dist/workspace/release-workflow.js +539 -193
- package/dist/workspace/releases.schema.json +70 -1
- package/dist/workspace/search-contract.d.ts +1 -1
- package/dist/workspace/security.js +9 -2
- package/dist/workspace/train-cut.d.ts +182 -0
- package/dist/workspace/train-cut.js +482 -0
- package/dist/workspace/train-prepare.d.ts +61 -0
- package/dist/workspace/train-prepare.js +267 -0
- package/dist/workspace/train-publish.d.ts +177 -0
- package/dist/workspace/train-publish.js +575 -0
- package/dist/workspace/train-range-labels.d.ts +33 -0
- package/dist/workspace/train-range-labels.js +109 -0
- package/dist/workspace/trust/seal.d.ts +13 -3
- package/dist/workspace/trust/seal.js +14 -4
- package/dist/workspace/work-cli.d.ts +3 -2
- package/dist/workspace/work-cli.js +3 -2
- package/dist/workspace/workspace-ledger.d.ts +14 -1
- package/dist/workspace/workspace-ledger.js +33 -7
- package/package.json +26 -26
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
* in `identity.gates`, a cut must be signed (`--sign`), its signature must
|
|
37
37
|
* verify for the actor against the signers at base, and when the gate names
|
|
38
38
|
* a class the actor must be in it. A cut signed without that gate is signed
|
|
39
|
-
* all the same, and readers report whether the signature verifies.
|
|
39
|
+
* all the same, and readers report whether the signature verifies. The
|
|
40
|
+
* signature covers the gate the cut line records (`green`, `override`,
|
|
41
|
+
* `lane`) as well as the release digest (#5177), so a reader can trust the
|
|
42
|
+
* gate a signed cut claims. With
|
|
40
43
|
* `ci.green.signedSince` declared, a green tag counts only with a valid
|
|
41
44
|
* statement (`../workspace/ci-green.ts`), so a hand-pushed tag cuts nothing.
|
|
42
45
|
*
|
|
@@ -55,8 +58,9 @@
|
|
|
55
58
|
* which `chant approve policy-override` answers. A revoked commit is never
|
|
56
59
|
* cut, override or not.
|
|
57
60
|
*/
|
|
58
|
-
import { type Release, type ReleaseArtifact, type ReleaseCut, type ReleaseCutOverride, type ReleaseTarget } from "./release-store.js";
|
|
61
|
+
import { type Release, type ReleaseArtifact, type ReleaseCut, type ReleaseCutGreen, type ReleaseCutIntent, type ReleaseCutOverride, type ReleasePublish, type ReleaseTarget } from "./release-store.js";
|
|
59
62
|
import type { CompiledTarget, TargetCompiler } from "../components/release-compile.js";
|
|
63
|
+
import type { ForgeChecksReader, ReleaseGreenSource } from "./release-green.js";
|
|
60
64
|
/** The first chant that cuts from a lane's green tag and writes `lane` on the cut line (#4692). */
|
|
61
65
|
export declare const RELEASE_CUT_LANE_FLOOR = "0.124.64";
|
|
62
66
|
/** The first chant that cuts a commit that is not green under an override and writes `override` on the cut line (#4693). */
|
|
@@ -66,7 +70,15 @@ export declare function greenOverrideSubject(commit: string): string;
|
|
|
66
70
|
/** The rule an override of a cut names (#4693): `ci-green`, or `ci-green-<lane>` for a lane's tag. */
|
|
67
71
|
export declare function greenOverrideRule(lane: string | null): string;
|
|
68
72
|
/** The stable codes a cut refuses with. */
|
|
69
|
-
export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked"
|
|
73
|
+
export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked"
|
|
74
|
+
/** #5149: `release.green: "none"` under a security group or release gate that needs a green commit. */
|
|
75
|
+
| "release-green-none-refused"
|
|
76
|
+
/** #5149: `release.green: "forge-checks"`, and the forge could not be asked. */
|
|
77
|
+
| "release-forge-checks-unavailable" | "release-worktree-dirty" | "release-no-environments" | "release-no-components" | "release-build-inputs-differ" | "release-image-invalid" | "release-image-unknown-component" | "release-image-name-taken" | "release-image-build-failed"
|
|
78
|
+
/** #5151: `release.artifacts`, as ./release-artifacts.ts refuses it. */
|
|
79
|
+
| "release-artifact-invalid" | "release-artifact-name-invalid" | "release-artifact-name-taken" | "release-artifact-outside" | "release-artifact-build-failed" | "release-artifact-no-output" | "release-artifact-output-taken" | "release-artifact-no-label" | "release-artifact-version-mismatch" | "release-artifact-checksums-name-taken"
|
|
80
|
+
/** #5183: an entry with no build command whose files are not there, or are read from a checkout of another commit. */
|
|
81
|
+
| "release-artifact-not-built" | "release-artifact-wrong-commit" | "release-version-no-label" | "release-version-label-invalid" | "release-version-no-package" | "release-version-invalid" | "release-version-no-file" | "release-version-no-field" | "release-version-format-unknown" | "release-unsigned" | "release-signer-refused" | "declaration-invalid"
|
|
70
82
|
/** #4941: the npm target's image check, run by the cut (./publish-npm.ts `checkPackageImages`). */
|
|
71
83
|
| "publish-npm-carries-image" | "publish-npm-pack-failed";
|
|
72
84
|
export declare class ReleaseCutError extends Error {
|
|
@@ -87,6 +99,19 @@ export interface CutRequest {
|
|
|
87
99
|
actor: string;
|
|
88
100
|
/** The environments in promotion order. Read from the member's `chant.config.ts` when absent. */
|
|
89
101
|
environments?: readonly string[];
|
|
102
|
+
/**
|
|
103
|
+
* `release.green` (#5149): what says the commit may be released. Absent:
|
|
104
|
+
* `chant` when the declaration at base has `ci.green`, else `forge-checks`.
|
|
105
|
+
*/
|
|
106
|
+
green?: ReleaseGreenSource;
|
|
107
|
+
/** Reads the forge's checks on the commit under `forge-checks` (#5149). Default: the forge the job or the origin remote names. */
|
|
108
|
+
forgeChecks?: ForgeChecksReader;
|
|
109
|
+
/**
|
|
110
|
+
* The `release.publish` targets (#5149). A member with no environments is
|
|
111
|
+
* cut as an artifact release, which records these in place of compile
|
|
112
|
+
* targets; with none, and no `release.images`, it has nothing to release.
|
|
113
|
+
*/
|
|
114
|
+
publishes?: readonly ReleasePublish[];
|
|
90
115
|
now?: () => Date;
|
|
91
116
|
/** The process environment the CI run is read from. */
|
|
92
117
|
env?: NodeJS.ProcessEnv;
|
|
@@ -130,12 +155,26 @@ export interface CutRequest {
|
|
|
130
155
|
* Given the commit being cut; returns each as an image artifact.
|
|
131
156
|
*/
|
|
132
157
|
buildImages?: (commit: string) => Promise<ReleaseArtifact[]> | ReleaseArtifact[];
|
|
158
|
+
/**
|
|
159
|
+
* Build the files `release.artifacts` declares (#5151), once the images
|
|
160
|
+
* are built and before the build command. Given the commit being cut;
|
|
161
|
+
* returns each file as an asset artifact.
|
|
162
|
+
*/
|
|
163
|
+
buildArtifacts?: (commit: string) => Promise<ReleaseArtifact[]> | ReleaseArtifact[];
|
|
133
164
|
/**
|
|
134
165
|
* Stamp the label into the files `release.version` names (#4840), once the
|
|
135
166
|
* tree is found clean and before the images are built or any environment
|
|
136
167
|
* compiled. The caller puts the files back after the cut.
|
|
137
168
|
*/
|
|
138
169
|
stamp?: () => void | Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Run the build command of an artifact release (#5149), once the images
|
|
172
|
+
* are built: what a compile runs first for a release cut from
|
|
173
|
+
* environments, so a commit that does not build is not cut.
|
|
174
|
+
*/
|
|
175
|
+
build?: () => void | Promise<void>;
|
|
176
|
+
/** The intent files the cut consumes (#5159), recorded on its cut line. */
|
|
177
|
+
intents?: readonly ReleaseCutIntent[];
|
|
139
178
|
}
|
|
140
179
|
export interface CutResult {
|
|
141
180
|
release: Release;
|
|
@@ -185,6 +224,18 @@ export declare function differingBuildSteps(targets: readonly CompiledTarget[]):
|
|
|
185
224
|
component: string;
|
|
186
225
|
envs: string[];
|
|
187
226
|
}>;
|
|
227
|
+
/**
|
|
228
|
+
* Every cut release of this member from `commit` or an ancestor of it, the
|
|
229
|
+
* nearest commit first and the newest cut of one commit first, each with
|
|
230
|
+
* the label its cuts give it (#5159). Read from the member's ledger only:
|
|
231
|
+
* no tag is read.
|
|
232
|
+
*/
|
|
233
|
+
export declare function ancestorReleases(top: string, commit: string, cwd: string): Promise<Array<{
|
|
234
|
+
release: Release;
|
|
235
|
+
label: string | null;
|
|
236
|
+
}>>;
|
|
237
|
+
/** The earlier release of this member cut from the nearest ancestor of `commit`. */
|
|
238
|
+
export declare function previousRelease(top: string, commit: string, cwd: string): Promise<Release | undefined>;
|
|
188
239
|
/** What a dry run of the cut found (#4027): what the cut would do, with nothing built, signed or written. */
|
|
189
240
|
export interface CutPlan {
|
|
190
241
|
commit: string;
|
|
@@ -226,6 +277,10 @@ export interface CutPlan {
|
|
|
226
277
|
lane: string | null;
|
|
227
278
|
/** The override the cut would run under and spend (#4693), when the commit is not green; null when it is. */
|
|
228
279
|
override: ReleaseCutOverride | null;
|
|
280
|
+
/** The green gate the commit passed (#5149), or null under an override. */
|
|
281
|
+
green: ReleaseCutGreen | null;
|
|
282
|
+
/** An artifact release's targets (#5149), or null for a release cut from environments. */
|
|
283
|
+
publishes: ReleasePublish[] | null;
|
|
229
284
|
}
|
|
230
285
|
/**
|
|
231
286
|
* The dry run of {@link cutRelease} (#4027): the same checks and compile,
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
* in `identity.gates`, a cut must be signed (`--sign`), its signature must
|
|
37
37
|
* verify for the actor against the signers at base, and when the gate names
|
|
38
38
|
* a class the actor must be in it. A cut signed without that gate is signed
|
|
39
|
-
* all the same, and readers report whether the signature verifies.
|
|
39
|
+
* all the same, and readers report whether the signature verifies. The
|
|
40
|
+
* signature covers the gate the cut line records (`green`, `override`,
|
|
41
|
+
* `lane`) as well as the release digest (#5177), so a reader can trust the
|
|
42
|
+
* gate a signed cut claims. With
|
|
40
43
|
* `ci.green.signedSince` declared, a green tag counts only with a valid
|
|
41
44
|
* statement (`../workspace/ci-green.ts`), so a hand-pushed tag cuts nothing.
|
|
42
45
|
*
|
|
@@ -115,6 +118,14 @@ function tryGit(top, args) {
|
|
|
115
118
|
return null;
|
|
116
119
|
}
|
|
117
120
|
}
|
|
121
|
+
/** The branch `origin/HEAD` names, else the checkout's, for the forge's required checks; null when neither is known. */
|
|
122
|
+
function trunkBranch(top) {
|
|
123
|
+
const head = tryGit(top, ["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"]);
|
|
124
|
+
if (head)
|
|
125
|
+
return head.replace(/^origin\//, "");
|
|
126
|
+
const branch = tryGit(top, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
|
|
127
|
+
return branch || null;
|
|
128
|
+
}
|
|
118
129
|
/**
|
|
119
130
|
* Whether `sha` has a green tag and no revoked tag, read from local tags,
|
|
120
131
|
* and the tags on it that were ignored for want of a valid statement
|
|
@@ -156,21 +167,31 @@ export function differingBuildSteps(targets) {
|
|
|
156
167
|
}
|
|
157
168
|
return out.sort((a, b) => (a.component < b.component ? -1 : 1));
|
|
158
169
|
}
|
|
159
|
-
/**
|
|
160
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Every cut release of this member from `commit` or an ancestor of it, the
|
|
172
|
+
* nearest commit first and the newest cut of one commit first, each with
|
|
173
|
+
* the label its cuts give it (#5159). Read from the member's ledger only:
|
|
174
|
+
* no tag is read.
|
|
175
|
+
*/
|
|
176
|
+
export async function ancestorReleases(top, commit, cwd) {
|
|
161
177
|
const { releases } = await readAllReleases({ cwd });
|
|
162
178
|
const { cuts } = await readCuts({ cwd });
|
|
163
179
|
const cutAt = new Map();
|
|
164
180
|
for (const c of cuts)
|
|
165
181
|
if (!cutAt.has(c.releaseDigest) || c.timestamp > cutAt.get(c.releaseDigest))
|
|
166
182
|
cutAt.set(c.releaseDigest, c.timestamp);
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
.filter((r) =>
|
|
183
|
+
const labels = labelsByDigest(cuts);
|
|
184
|
+
return (releases
|
|
185
|
+
.filter((r) => cutAt.has(r.releaseDigest))
|
|
186
|
+
.filter((r) => r.commit === commit || tryGit(top, ["merge-base", "--is-ancestor", r.commit, commit]) !== null)
|
|
170
187
|
.map((r) => ({ r, depth: Number(tryGit(top, ["rev-list", "--count", r.commit]) ?? 0), at: cutAt.get(r.releaseDigest) }))
|
|
171
188
|
// The nearest ancestor first, then the newest cut of it.
|
|
172
|
-
.sort((a, b) => b.depth - a.depth || (b.at < a.at ? -1 : b.at > a.at ? 1 : 0))
|
|
173
|
-
|
|
189
|
+
.sort((a, b) => b.depth - a.depth || (b.at < a.at ? -1 : b.at > a.at ? 1 : 0))
|
|
190
|
+
.map(({ r }) => ({ release: r, label: labels.get(r.releaseDigest) ?? null })));
|
|
191
|
+
}
|
|
192
|
+
/** The earlier release of this member cut from the nearest ancestor of `commit`. */
|
|
193
|
+
export async function previousRelease(top, commit, cwd) {
|
|
194
|
+
return (await ancestorReleases(top, commit, cwd)).find((a) => a.release.commit !== commit)?.release;
|
|
174
195
|
}
|
|
175
196
|
/**
|
|
176
197
|
* Decide the override of a cut of `commit`, which has no green tag that
|
|
@@ -272,33 +293,83 @@ async function prepare(req, record = false) {
|
|
|
272
293
|
const { releaseRuleFrom } = await import("../workspace/identity.js");
|
|
273
294
|
const source = scopeSource(cwd);
|
|
274
295
|
const green = source.declaration?.ci?.green ?? null;
|
|
275
|
-
const
|
|
276
|
-
const
|
|
296
|
+
const { resolveGreenSource } = await import("./release-green.js");
|
|
297
|
+
const gate = resolveGreenSource(req.green, green !== null, req.green === undefined && green === null && (tryGit(top, ["tag", "--list", "ci/green/*", "ci/green-*/*"]) ?? "") !== "");
|
|
277
298
|
// Who may cut is the declaration's identity.gates.release, read at base.
|
|
278
299
|
const releaseRule = releaseRuleFrom(source);
|
|
300
|
+
if (gate !== "chant" && req.lane !== undefined) {
|
|
301
|
+
throw new ReleaseCutError("declaration-invalid", `the cut asks for lane ${JSON.stringify(req.lane)}, and a lane is a ci.green lane, which release.green ${JSON.stringify(gate)} does not read`, 'Drop --lane and release.lane, or set release.green to "chant".');
|
|
302
|
+
}
|
|
303
|
+
const lane = req.lane !== undefined ? await declaredLane(green, req.lane) : null;
|
|
279
304
|
let override = null;
|
|
280
|
-
|
|
281
|
-
|
|
305
|
+
let passed = null;
|
|
306
|
+
/** Why the commit is not green, and the tag (or check) an override stands in for; null when it is. */
|
|
307
|
+
let notGreen = null;
|
|
308
|
+
if (gate === "none") {
|
|
309
|
+
// #5149: a workspace that asks for verified or supply-chain releases, or gates who cuts, needs a green commit.
|
|
310
|
+
const { securityGroupsIn } = await import("../workspace/security.js");
|
|
311
|
+
const groups = securityGroupsIn(source, cwd);
|
|
312
|
+
const why = [
|
|
313
|
+
...["supply-chain", "verified-releases"].filter((g) => groups.has(g)).map((g) => `the ${g} security group`),
|
|
314
|
+
...(releaseRule.requirement ? ["the release gate in identity.gates"] : []),
|
|
315
|
+
];
|
|
316
|
+
if (why.length > 0) {
|
|
317
|
+
throw new ReleaseCutError("release-green-none-refused", `release.green is "none", and chant.workspace.json at base turns on ${why.join(" and ")}, which releases only a commit a green gate passed`, 'Set release.green in chant.config.ts to "forge-checks" (the forge\'s checks on the commit) or "chant" (ci/green tags).');
|
|
318
|
+
}
|
|
319
|
+
passed = { source: "none" };
|
|
320
|
+
}
|
|
321
|
+
else if (gate === "forge-checks") {
|
|
322
|
+
const { forgeChecksReader, forgeChecksTarget, ForgeChecksUnavailableError } = await import("./release-green.js");
|
|
323
|
+
let verdict;
|
|
324
|
+
try {
|
|
325
|
+
const read = req.forgeChecks ?? forgeChecksReader(await forgeChecksTarget(cwd, req.env ?? process.env), req.env ?? process.env);
|
|
326
|
+
verdict = await read(commit, green?.branch ?? trunkBranch(top));
|
|
327
|
+
}
|
|
328
|
+
catch (err) {
|
|
329
|
+
if (err instanceof ForgeChecksUnavailableError)
|
|
330
|
+
throw new ReleaseCutError("release-forge-checks-unavailable", `no release was cut: ${err.message}`, err.fix);
|
|
331
|
+
throw err;
|
|
332
|
+
}
|
|
333
|
+
if (verdict.green)
|
|
334
|
+
passed = { source: "forge-checks", forge: verdict.forge, checks: verdict.checks };
|
|
335
|
+
else {
|
|
336
|
+
notGreen = {
|
|
337
|
+
message: `commit ${commit.slice(0, 12)} is not green: ${verdict.why}, so no release is cut from it`,
|
|
338
|
+
fix: "Cut once its checks have passed, or check out a commit whose checks passed.",
|
|
339
|
+
tag: `forge-checks/${commit}`,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
const { state, ignored } = await greenState(top, commit, green, lane ?? undefined);
|
|
282
345
|
// #4692: a lane's tags are ci/green-<lane>/ and ci/revoked-<lane>/.
|
|
283
346
|
const greenTag = lane !== null ? `ci/green-${lane}` : "ci/green";
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
: ignored.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
347
|
+
if (state === "green")
|
|
348
|
+
passed = { source: "chant", tag: `${greenTag}/${commit}` };
|
|
349
|
+
else {
|
|
350
|
+
const why = ignored.length > 0 ? `; ignored: ${ignored.map((t) => `${t.tag} (${t.status}): ${t.reason}`).join("; ")}` : "";
|
|
351
|
+
const revokedTag = lane !== null ? `ci/revoked-${lane}` : "ci/revoked";
|
|
352
|
+
const message = state === "revoked"
|
|
353
|
+
? `commit ${commit.slice(0, 12)} has a ${revokedTag} tag: it went red after it was green, so no release is cut from it`
|
|
354
|
+
: ignored.some((t) => t.tag.startsWith(`${greenTag}/`))
|
|
355
|
+
? `commit ${commit.slice(0, 12)} has no ${greenTag} tag that counts, so no release is cut from it${why}`
|
|
356
|
+
: `commit ${commit.slice(0, 12)} has no ${greenTag} tag, so no release is cut from it`;
|
|
357
|
+
const fix = `Check out a green commit (\`chant ci last-green${lane !== null ? ` --lane ${lane}` : ""}\` names the newest) after fetching the tags: git fetch origin --tags`;
|
|
358
|
+
if (state === "revoked") {
|
|
359
|
+
throw new ReleaseCutError("release-commit-revoked", req.overrideGreen ? `${message}, and an override does not cut a revoked commit` : message, fix);
|
|
360
|
+
}
|
|
361
|
+
notGreen = { message, fix, tag: `${greenTag}/${commit}` };
|
|
293
362
|
}
|
|
363
|
+
}
|
|
364
|
+
if (notGreen) {
|
|
294
365
|
if (!req.overrideGreen)
|
|
295
|
-
throw new ReleaseCutError("release-commit-not-green", message, fix);
|
|
366
|
+
throw new ReleaseCutError("release-commit-not-green", notGreen.message, notGreen.fix);
|
|
296
367
|
// #4693: a person's override of this commit lets it through.
|
|
297
368
|
const now = (req.now ?? (() => new Date()))().toISOString();
|
|
298
369
|
const decided = await greenOverride({ top, cwd, commit, lane, sealed: releaseRule.requirement !== null, record, now });
|
|
299
370
|
if (decided.override === null)
|
|
300
|
-
throw new ReleaseCutError("release-commit-not-green", `${message}; ${decided.why}`, decided.fix, decided.recorded);
|
|
301
|
-
override = { green: false, tag:
|
|
371
|
+
throw new ReleaseCutError("release-commit-not-green", `${notGreen.message}; ${decided.why}`, decided.fix, decided.recorded);
|
|
372
|
+
override = { green: false, tag: notGreen.tag, ...decided.override };
|
|
302
373
|
}
|
|
303
374
|
if (releaseRule.requirement && req.sign === undefined) {
|
|
304
375
|
throw new ReleaseCutError("release-unsigned", `chant.workspace.json at base names a release gate in identity.gates${releaseRule.requirement.class !== null ? `, from the class ${releaseRule.requirement.class}` : ""}, and this cut is not signed`, `chant release cut <label> --actor <principal> --sign [<key file>], with a key ${releaseRule.rule.signers.signersPath} at base lists for that principal.`);
|
|
@@ -313,17 +384,23 @@ async function prepare(req, record = false) {
|
|
|
313
384
|
const { readMemberPromotionOrder } = await import("../workspace/promotion-order.js");
|
|
314
385
|
envs = ((await readMemberPromotionOrder(cwd)) ?? []).map((s) => s.name);
|
|
315
386
|
}
|
|
316
|
-
|
|
317
|
-
|
|
387
|
+
// #5149: with no environments the release is what release.publish publishes and release.images builds, and nothing is compiled.
|
|
388
|
+
const artifactRelease = envs.length === 0;
|
|
389
|
+
if (artifactRelease && (req.publishes ?? []).length === 0 && !req.buildImages && !req.buildArtifacts) {
|
|
390
|
+
throw new ReleaseCutError("release-no-environments", "this member's chant.config.ts declares no environments and no release.publish target, so there is nothing to release", "Declare where the release publishes (release.publish: [{ type: \"npm\", packages: [\".\"] }]), or the environments it is compiled for in promotion order (environments: [\"dev\", \"staging\", \"prod\"]).");
|
|
318
391
|
}
|
|
319
392
|
// #4657: the images first, so the build command that packs a package can pin their digests.
|
|
320
393
|
const builtImages = req.buildImages ? await req.buildImages(commit) : [];
|
|
394
|
+
// #5151: the files, after the images and before the build command.
|
|
395
|
+
const builtFiles = req.buildArtifacts ? await req.buildArtifacts(commit) : [];
|
|
396
|
+
if (artifactRelease)
|
|
397
|
+
await req.build?.();
|
|
321
398
|
const compiled = [];
|
|
322
399
|
for (const env of envs)
|
|
323
400
|
compiled.push(await req.compiler.compile(env));
|
|
324
401
|
// A project with no components compiles to its build output (#4046), so only a target with neither is empty.
|
|
325
|
-
if (compiled.every((t) => t.components.length === 0 && t.templates.length === 0)) {
|
|
326
|
-
throw new ReleaseCutError("release-no-components", "no component is enabled in any environment and nothing was compiled, so there is nothing to release", "Enable a component under one environment's parameters, or remove the component files so the project's build output is released.");
|
|
402
|
+
if (!artifactRelease && compiled.every((t) => t.components.length === 0 && t.templates.length === 0)) {
|
|
403
|
+
throw new ReleaseCutError("release-no-components", "no component is enabled in any environment and nothing was compiled, so there is nothing to release", "Enable a component under one environment's parameters, or remove the component files so the project's build output is released. A project that only publishes packages or files drops environments from chant.config.ts, and its release records what release.publish publishes.");
|
|
327
404
|
}
|
|
328
405
|
const differing = differingBuildSteps(compiled);
|
|
329
406
|
if (differing.length > 0) {
|
|
@@ -348,6 +425,11 @@ async function prepare(req, record = false) {
|
|
|
348
425
|
throw new ReleaseCutError("release-image-name-taken", `release.images names "${image.component}", which is also a component of this member, and a release records one image per name`, "Rename the image in release.images.");
|
|
349
426
|
}
|
|
350
427
|
}
|
|
428
|
+
for (const name of new Set(builtFiles.map((f) => f.component))) {
|
|
429
|
+
if (enabled.has(name) || handedTo.has(name)) {
|
|
430
|
+
throw new ReleaseCutError("release-artifact-name-taken", `release.artifacts names "${name}", which is also a component of this member, and a release records each name once`, "Rename the entry in release.artifacts.");
|
|
431
|
+
}
|
|
432
|
+
}
|
|
351
433
|
// Which environment each component's artifacts are built in: the first one it is enabled in.
|
|
352
434
|
const firstEnv = new Map();
|
|
353
435
|
for (const t of compiled) {
|
|
@@ -359,7 +441,7 @@ async function prepare(req, record = false) {
|
|
|
359
441
|
const realCwd = realpathSync(cwd);
|
|
360
442
|
const previous = firstEnv.size > 0 ? await previousRelease(top, commit, cwd) : undefined;
|
|
361
443
|
const reused = [];
|
|
362
|
-
const artifacts = [...handedArtifacts, ...builtImages];
|
|
444
|
+
const artifacts = [...handedArtifacts, ...builtImages, ...builtFiles];
|
|
363
445
|
const toBuild = new Map();
|
|
364
446
|
for (const [component, target] of firstEnv) {
|
|
365
447
|
const prior = previous?.artifactDigests.filter((a) => a.component === component) ?? [];
|
|
@@ -392,6 +474,8 @@ async function prepare(req, record = false) {
|
|
|
392
474
|
member: ledger.members.length > 0 ? ledger.members.join("/") : null,
|
|
393
475
|
lane,
|
|
394
476
|
override,
|
|
477
|
+
green: passed,
|
|
478
|
+
publishes: artifactRelease ? [...(req.publishes ?? [])] : undefined,
|
|
395
479
|
};
|
|
396
480
|
}
|
|
397
481
|
/**
|
|
@@ -434,7 +518,7 @@ export async function planRelease(req) {
|
|
|
434
518
|
for (const env of p.envs)
|
|
435
519
|
for (const component of p.toBuild.get(env) ?? [])
|
|
436
520
|
build.push({ component, env });
|
|
437
|
-
const releaseDigest = build.length === 0 ? makeRelease({ member: p.member, commit: p.commit, artifactDigests: p.carried, targets }).releaseDigest : null;
|
|
521
|
+
const releaseDigest = build.length === 0 ? makeRelease({ member: p.member, commit: p.commit, artifactDigests: p.carried, targets, ...(p.publishes ? { publishes: p.publishes } : {}) }).releaseDigest : null;
|
|
438
522
|
const { cuts } = await readCuts({ cwd: p.cwd });
|
|
439
523
|
const labels = labelsByDigest(cuts);
|
|
440
524
|
let alreadyCut = null;
|
|
@@ -487,6 +571,8 @@ export async function planRelease(req) {
|
|
|
487
571
|
signatureRequired: p.releaseRule.requirement !== null,
|
|
488
572
|
lane: p.lane,
|
|
489
573
|
override: p.override,
|
|
574
|
+
green: p.green,
|
|
575
|
+
publishes: p.publishes ?? null,
|
|
490
576
|
};
|
|
491
577
|
}
|
|
492
578
|
/**
|
|
@@ -513,7 +599,7 @@ export async function cutRelease(req) {
|
|
|
513
599
|
artifacts.push(...(await req.compiler.buildArtifacts(env, names)));
|
|
514
600
|
}
|
|
515
601
|
const { targets, templates } = targetsOf(compiled);
|
|
516
|
-
const release = makeRelease({ member: p.member, commit, artifactDigests: artifacts, targets });
|
|
602
|
+
const release = makeRelease({ member: p.member, commit, artifactDigests: artifacts, targets, ...(p.publishes ? { publishes: p.publishes } : {}) });
|
|
517
603
|
// #4941: an npm package that would carry an image archive stops the cut here, before anything is recorded or
|
|
518
604
|
// tagged, rather than the publish job once the label is spent. The check is the npm target's own plan check.
|
|
519
605
|
if (release.artifactDigests.some((a) => a.kind === "image" && a.path !== "")) {
|
|
@@ -530,7 +616,16 @@ export async function cutRelease(req) {
|
|
|
530
616
|
}
|
|
531
617
|
}
|
|
532
618
|
const timestamp = (req.now ?? (() => new Date()))().toISOString();
|
|
533
|
-
|
|
619
|
+
// #5177: the signature covers the gate the cut line records, beside the digest, which stays the release file's.
|
|
620
|
+
const signed = {
|
|
621
|
+
releaseDigest: release.releaseDigest,
|
|
622
|
+
label: req.label,
|
|
623
|
+
actor: req.actor,
|
|
624
|
+
timestamp,
|
|
625
|
+
...(p.lane !== null ? { lane: p.lane } : {}),
|
|
626
|
+
...(p.override ? { override: p.override } : {}),
|
|
627
|
+
...(p.green ? { green: p.green } : {}),
|
|
628
|
+
};
|
|
534
629
|
let signature = null;
|
|
535
630
|
if (req.sign !== undefined) {
|
|
536
631
|
const { resolveSigningKey, sealReleaseCut, SealError } = await import("../workspace/trust/seal.js");
|
|
@@ -550,8 +645,8 @@ export async function cutRelease(req) {
|
|
|
550
645
|
}
|
|
551
646
|
}
|
|
552
647
|
if (releaseRule.requirement) {
|
|
553
|
-
const { admitReleaseCut } = await import("../workspace/identity-gate-rule.js");
|
|
554
|
-
const why = admitReleaseCut(releaseRule.rule, { ...signed, signature });
|
|
648
|
+
const { admitReleaseCut, RELEASE_CUT_SEAL_VERSION } = await import("../workspace/identity-gate-rule.js");
|
|
649
|
+
const why = admitReleaseCut(releaseRule.rule, { ...signed, signature, ...(signature !== null ? { sealVersion: RELEASE_CUT_SEAL_VERSION } : {}) });
|
|
555
650
|
if (why !== null) {
|
|
556
651
|
throw new ReleaseCutError("release-signer-refused", `no release was cut: ${why}`, `identity.gates.release in chant.workspace.json at base counts only a cut signed by a key ${releaseRule.rule.signers.signersPath} lists for the actor` +
|
|
557
652
|
(releaseRule.requirement.class !== null ? `, who holds the role of the class ${releaseRule.requirement.class}` : "") +
|
|
@@ -575,10 +670,13 @@ export async function cutRelease(req) {
|
|
|
575
670
|
runId,
|
|
576
671
|
runOrigin: ci?.runOrigin ?? { forge: "local" },
|
|
577
672
|
signature,
|
|
673
|
+
...(signature !== null ? { sealVersion: 2 } : {}),
|
|
578
674
|
...(req.composed ? { composed: req.composed } : {}),
|
|
579
675
|
...(req.channel ? { channel: req.channel } : {}),
|
|
580
676
|
...(p.lane !== null ? { lane: p.lane } : {}),
|
|
581
677
|
...(p.override ? { override: p.override } : {}),
|
|
678
|
+
...(p.green ? { green: p.green } : {}),
|
|
679
|
+
...(req.intents && req.intents.length > 0 ? { intents: [...req.intents] } : {}),
|
|
582
680
|
}, { cwd });
|
|
583
681
|
return {
|
|
584
682
|
release,
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant release doctor` (#5161): before anything is cut, ask each target
|
|
3
|
+
* `release.publish` declares whether a publish from this environment can
|
|
4
|
+
* succeed, without changing anything on any registry.
|
|
5
|
+
*
|
|
6
|
+
* Each check ends in one of four states:
|
|
7
|
+
*
|
|
8
|
+
* - `ok`: the registry or forge said yes.
|
|
9
|
+
* - `fail`: it said no, or a credential the publish needs is not here. In CI
|
|
10
|
+
* a missing credential fails; on a workstation it is a warning, since the
|
|
11
|
+
* release job's environment is not this one.
|
|
12
|
+
* - `warn`: something the publish can live with, or evidence that points the
|
|
13
|
+
* wrong way without proving it, such as the workflow the last version was
|
|
14
|
+
* published from.
|
|
15
|
+
* - `unknown`: what can't be observed from here. npm matches a trusted
|
|
16
|
+
* publisher against the workflow that asks, so only a run of the release
|
|
17
|
+
* workflow can test the record; whether a record allows `npm dist-tag`, and
|
|
18
|
+
* what a job token may do, are not shown to anyone. The doctor says so
|
|
19
|
+
* rather than guessing.
|
|
20
|
+
*
|
|
21
|
+
* The probes are reads, apart from two exchanges that hand back a short-lived
|
|
22
|
+
* publishing token, which is masked and dropped: npm's OIDC exchange and Open
|
|
23
|
+
* VSX's trusted-publishing exchange, the same requests a publish makes first.
|
|
24
|
+
*
|
|
25
|
+
* Under `release.green: "forge-checks"` (#5149) the cut asks the forge for the
|
|
26
|
+
* commit's checks, so the doctor reads the checks of the checked-out commit
|
|
27
|
+
* with the token the cut would use (`green-forge-checks`). Whether that
|
|
28
|
+
* commit is green is the cut's question; the doctor only asks whether the
|
|
29
|
+
* forge answers.
|
|
30
|
+
*
|
|
31
|
+
* When the publish signs with Sigstore (#5164, ./publish-signing.ts), the
|
|
32
|
+
* doctor checks what signing needs from the job it runs in: the OIDC token
|
|
33
|
+
* cosign signs with (`signing-oidc`) and cosign 3 (`signing-cosign`).
|
|
34
|
+
*/
|
|
35
|
+
import type { PublishDeclaration } from "./publish-declaration.js";
|
|
36
|
+
import type { PublishFetch } from "./release-publish.js";
|
|
37
|
+
/** The first chant with `chant release doctor`, which checks each `release.publish` target before a cut, and whose `chant release workflow` runs it in a dispatched release's cut job (`release.workflow.doctor`) (#5161). */
|
|
38
|
+
export declare const RELEASE_DOCTOR_FLOOR = "0.124.101";
|
|
39
|
+
export type DoctorStatus = "ok" | "warn" | "fail" | "unknown";
|
|
40
|
+
export interface DoctorCheck {
|
|
41
|
+
/** What was checked, such as `npm-trusted-publisher`. */
|
|
42
|
+
check: string;
|
|
43
|
+
status: DoctorStatus;
|
|
44
|
+
/** What the check found, or why it can't tell. */
|
|
45
|
+
message: string;
|
|
46
|
+
fix?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DoctorTarget {
|
|
49
|
+
kind: string;
|
|
50
|
+
/** For messages, such as `npm @acme/core` or `oci ghcr.io/acme/api`. */
|
|
51
|
+
name: string;
|
|
52
|
+
checks: DoctorCheck[];
|
|
53
|
+
}
|
|
54
|
+
/** Where the doctor runs, which decides what it can observe. */
|
|
55
|
+
export interface DoctorEnvironment {
|
|
56
|
+
/** `github`, `gitlab`, another CI, or null on a workstation. */
|
|
57
|
+
ci: "github" | "gitlab" | "other" | null;
|
|
58
|
+
/** Whether the run can get an OIDC ID token. */
|
|
59
|
+
oidc: boolean;
|
|
60
|
+
/** The workflow file this run is, from the repository root, when the CI says (GitHub: `GITHUB_WORKFLOW_REF`). */
|
|
61
|
+
workflow: string | null;
|
|
62
|
+
/** `owner/name` of the repository, from the CI or the `origin` remote. */
|
|
63
|
+
repository: string | null;
|
|
64
|
+
/** The release workflow file, from the repository root: `release.workflow.file` or the forge's default. */
|
|
65
|
+
releaseWorkflow: string | null;
|
|
66
|
+
}
|
|
67
|
+
export interface DoctorReport {
|
|
68
|
+
environment: DoctorEnvironment;
|
|
69
|
+
targets: DoctorTarget[];
|
|
70
|
+
counts: Record<DoctorStatus, number>;
|
|
71
|
+
}
|
|
72
|
+
/** A command run for a check: npm or vsce. */
|
|
73
|
+
export type DoctorRun = (bin: string, args: string[], opts: {
|
|
74
|
+
cwd: string;
|
|
75
|
+
env: NodeJS.ProcessEnv;
|
|
76
|
+
}) => Promise<{
|
|
77
|
+
code: number;
|
|
78
|
+
stdout: string;
|
|
79
|
+
stderr: string;
|
|
80
|
+
}>;
|
|
81
|
+
export interface DoctorDeps {
|
|
82
|
+
fetch?: PublishFetch;
|
|
83
|
+
run?: DoctorRun;
|
|
84
|
+
/** The npm executable. Default `npm`. */
|
|
85
|
+
npm?: string;
|
|
86
|
+
/** The vsce executable. Default `vsce`. */
|
|
87
|
+
vsce?: string;
|
|
88
|
+
/** What would sign with Sigstore (#5164). Default: cosign, as the publish runs it. */
|
|
89
|
+
signer?: Pick<import("./publish-signing.js").Signer, "name" | "unavailable">;
|
|
90
|
+
/** The cargo executable. Default `cargo`. */
|
|
91
|
+
cargo?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare const DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
94
|
+
/** The CI this process runs in, and whether it can get an OIDC token, from its environment. */
|
|
95
|
+
export declare function doctorEnvironment(env: NodeJS.ProcessEnv, req: {
|
|
96
|
+
cwd: string;
|
|
97
|
+
releaseWorkflow: string | null;
|
|
98
|
+
}): DoctorEnvironment;
|
|
99
|
+
/** Check every declared target. Nothing is published, tagged or changed. */
|
|
100
|
+
export declare function releaseDoctor(req: {
|
|
101
|
+
cwd: string;
|
|
102
|
+
publish: readonly PublishDeclaration[];
|
|
103
|
+
env?: NodeJS.ProcessEnv;
|
|
104
|
+
releaseWorkflow: string | null;
|
|
105
|
+
/** The cut's green gate (#5149); `forge-checks` adds the check that the forge answers for the commit's checks. */
|
|
106
|
+
green?: import("./release-green.js").ReleaseGreenSource;
|
|
107
|
+
/** The commit whose checks are read under `forge-checks`. Default: HEAD of `cwd`. */
|
|
108
|
+
commit?: string;
|
|
109
|
+
/** `release.signing` (#5164), and the workspace's security groups, which decide whether the publish signs. */
|
|
110
|
+
signing?: import("./publish-signing.js").SigningConfig;
|
|
111
|
+
groups?: ReadonlySet<import("../workspace/security.js").SecurityGroup>;
|
|
112
|
+
deps?: DoctorDeps;
|
|
113
|
+
}): Promise<DoctorReport>;
|