@intentius/chant 0.124.100 → 0.124.102
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/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-evidence-claims.d.ts +12 -0
- package/dist/ci-evidence-claims.js +12 -0
- package/dist/ci-system.d.ts +66 -0
- package/dist/ci-system.js +61 -0
- 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 +374 -0
- package/dist/cli/handlers/release.d.ts +43 -2
- package/dist/cli/handlers/release.js +667 -39
- package/dist/cli/handlers/run-generate.js +11 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +44 -101
- package/dist/cli/parse-args.js +48 -0
- package/dist/cli/registry.d.ts +16 -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 +50 -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 +19 -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 +15 -0
- package/dist/cloud-lister/index.d.ts +4 -1
- package/dist/cloud-lister/index.js +2 -1
- package/dist/cloud-lister/kubernetes-components.d.ts +56 -0
- package/dist/cloud-lister/kubernetes-components.js +642 -0
- package/dist/cloud-lister/kubernetes.d.ts +18 -0
- package/dist/cloud-lister/kubernetes.js +26 -1
- package/dist/cloud-lister/mask.d.ts +5 -1
- package/dist/cloud-lister/mask.js +14 -5
- 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-import.d.ts +1 -1
- package/dist/config-import.js +6 -2
- package/dist/config-sandbox.d.ts +1 -1
- package/dist/config-sandbox.js +3 -3
- package/dist/config.d.ts +369 -10
- package/dist/config.js +127 -7
- package/dist/deep-observation.js +9 -3
- package/dist/floor-table.data.js +21 -1
- package/dist/forge-remote.d.ts +13 -0
- package/dist/forge-remote.js +15 -0
- package/dist/lexicon.d.ts +45 -4
- package/dist/lifecycle/__fixtures__/package-files.d.ts +32 -0
- package/dist/lifecycle/__fixtures__/package-files.js +72 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.js +275 -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 +13 -0
- package/dist/lifecycle/publish-declaration.d.ts +322 -4
- package/dist/lifecycle/publish-declaration.js +340 -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-helm.d.ts +83 -0
- package/dist/lifecycle/publish-helm.js +452 -0
- 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-maven.d.ts +79 -0
- package/dist/lifecycle/publish-maven.js +364 -0
- package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
- package/dist/lifecycle/publish-mcp-registry.js +305 -0
- package/dist/lifecycle/publish-npm.d.ts +27 -1
- package/dist/lifecycle/publish-npm.js +216 -3
- package/dist/lifecycle/publish-nuget.d.ts +93 -0
- package/dist/lifecycle/publish-nuget.js +377 -0
- package/dist/lifecycle/publish-oci.d.ts +91 -2
- package/dist/lifecycle/publish-oci.js +247 -8
- package/dist/lifecycle/publish-package-files.d.ts +16 -0
- package/dist/lifecycle/publish-package-files.js +39 -0
- package/dist/lifecycle/publish-pypi.d.ts +138 -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-rubygems.d.ts +84 -0
- package/dist/lifecycle/publish-rubygems.js +366 -0
- package/dist/lifecycle/publish-signing.d.ts +147 -0
- package/dist/lifecycle/publish-signing.js +257 -0
- package/dist/lifecycle/publish-targets.d.ts +37 -1
- package/dist/lifecycle/publish-targets.js +102 -0
- package/dist/lifecycle/publish-tauri.js +43 -0
- package/dist/lifecycle/publish-train-names.d.ts +57 -0
- package/dist/lifecycle/publish-train-names.js +123 -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 +290 -0
- package/dist/lifecycle/release-artifacts.js +808 -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 +64 -4
- package/dist/lifecycle/release-cut.js +147 -34
- package/dist/lifecycle/release-doctor.d.ts +113 -0
- package/dist/lifecycle/release-doctor.js +1198 -0
- package/dist/lifecycle/release-green.d.ts +86 -0
- package/dist/lifecycle/release-green.js +286 -0
- package/dist/lifecycle/release-init-registries.d.ts +48 -0
- package/dist/lifecycle/release-init-registries.js +97 -0
- package/dist/lifecycle/release-init.d.ts +275 -0
- package/dist/lifecycle/release-init.js +984 -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 +251 -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 +247 -35
- 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 +322 -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/op/generate-pipeline.js +1 -1
- package/dist/op/local-executor.d.ts +1 -1
- package/dist/op/local-executor.js +2 -2
- package/dist/op/op-waves-evidence.js +9 -2
- 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 +8 -1
- package/dist/release-floors.js +9 -2
- package/dist/sensitive-key.d.ts +12 -0
- package/dist/sensitive-key.js +52 -0
- package/dist/tool-pins.d.ts +40 -0
- package/dist/tool-pins.js +66 -0
- package/dist/ts-loader.d.ts +8 -0
- package/dist/ts-loader.js +19 -0
- package/dist/wave-runtime.mjs +345 -342
- 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/lexicon-outputs.d.ts +1 -1
- package/dist/workspace/lexicon-outputs.js +1 -1
- package/dist/workspace/member-pipeline.d.ts +2 -1
- package/dist/workspace/member-pipeline.js +5 -2
- package/dist/workspace/reason-codes.d.ts +2 -0
- package/dist/workspace/reason-codes.js +3 -1
- package/dist/workspace/release-changed.d.ts +75 -4
- package/dist/workspace/release-changed.js +205 -34
- package/dist/workspace/release-changed.schema.json +20 -2
- 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 +50 -0
- package/dist/workspace/release-steps/nfpm.d.ts +13 -0
- package/dist/workspace/release-steps/nfpm.js +29 -0
- package/dist/workspace/release-steps/nuget.d.ts +14 -0
- package/dist/workspace/release-steps/nuget.js +16 -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 +36 -0
- package/dist/workspace/release-train-workflow.js +121 -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 +183 -59
- package/dist/workspace/release-workflow.js +570 -201
- 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 +504 -0
- package/dist/workspace/train-prepare.d.ts +64 -0
- package/dist/workspace/train-prepare.js +313 -0
- package/dist/workspace/train-publish.d.ts +177 -0
- package/dist/workspace/train-publish.js +574 -0
- package/dist/workspace/train-range-labels.d.ts +33 -0
- package/dist/workspace/train-range-labels.js +109 -0
- package/dist/workspace/train-shell.d.ts +5 -0
- package/dist/workspace/train-shell.js +17 -0
- package/dist/workspace/trust/check-evidence-report.d.ts +3 -7
- package/dist/workspace/trust/check-evidence-report.js +3 -7
- 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 +1 -1
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
* none, before any target runs; `--require-provenance` refuses instead
|
|
25
25
|
* (`publish-provenance-missing`). Without either, provenance is only the
|
|
26
26
|
* plan's `provenance` field.
|
|
27
|
+
* When `release.signing` or `supply-chain` asks for Sigstore signing and an
|
|
28
|
+
* OCI, forge or pypi target is declared (#5164, ./publish-signing.ts), a run that
|
|
29
|
+
* can't sign keylessly is refused (`publish-signing-no-oidc`,
|
|
30
|
+
* `publish-signing-tool-missing`).
|
|
27
31
|
* The targets come from {@link releasePublishTargets}: the member declares them under `release.publish` in its `chant.config.ts` (#4047).
|
|
28
32
|
* With a target, the checkout must be the release's commit with a clean
|
|
29
33
|
* tree ({@link checkCheckoutIsRelease}), every target is planned before any
|
|
@@ -41,6 +45,8 @@
|
|
|
41
45
|
import { execFileSync } from "node:child_process";
|
|
42
46
|
import { stampedChanges } from "./release-version.js";
|
|
43
47
|
import { createRedactor } from "./publish-credentials.js";
|
|
48
|
+
import { floatingTagOfLine, renderReleaseTag, stableVersionOf } from "./release-tag.js";
|
|
49
|
+
import { prereleaseOf } from "./release-prerelease.js";
|
|
44
50
|
/**
|
|
45
51
|
* Whether the process environment gives this run an OIDC token for
|
|
46
52
|
* provenance: in GitHub Actions, `ACTIONS_ID_TOKEN_REQUEST_URL` and
|
|
@@ -72,11 +78,16 @@ export class PublishTargetError extends Error {
|
|
|
72
78
|
}
|
|
73
79
|
/** The npm dist-tag a set of packages is staged under before `latest` moves (#4048), as chant's own releases do (#3903). */
|
|
74
80
|
export const NPM_STAGE_TAG = "next";
|
|
81
|
+
/** The deprecation message a status change gives a version: the reason, and the release to use instead. */
|
|
82
|
+
export function statusMessage(ctx) {
|
|
83
|
+
const lead = ctx.status === "yanked" ? "yanked" : "deprecated";
|
|
84
|
+
return [ctx.reason ? `${lead}: ${ctx.reason}` : lead, ctx.replacement ? `use ${ctx.replacement}` : null].filter(Boolean).join("; ");
|
|
85
|
+
}
|
|
75
86
|
/** The targets the member at `cwd` declares under `release.publish` in its `chant.config.ts`. */
|
|
76
87
|
export async function releasePublishTargets(cwd, deps = {}) {
|
|
77
88
|
const { loadChantConfig } = await import("../config.js");
|
|
78
89
|
const { createPublishTargets } = await import("./publish-targets.js");
|
|
79
|
-
const { config } = await loadChantConfig(cwd);
|
|
90
|
+
const { config } = await loadChantConfig(cwd, { fresh: true });
|
|
80
91
|
return createPublishTargets(config.release?.publish ?? [], deps);
|
|
81
92
|
}
|
|
82
93
|
/**
|
|
@@ -118,9 +129,10 @@ export async function preparePublish(req) {
|
|
|
118
129
|
const cuts = (await readCuts({ cwd })).cuts.filter((c) => c.releaseDigest === release.releaseDigest);
|
|
119
130
|
const checks = cuts.map((c) => ({
|
|
120
131
|
cut: c,
|
|
121
|
-
check: checkReleaseSignature(rule.rule,
|
|
132
|
+
check: checkReleaseSignature(rule.rule, c),
|
|
122
133
|
}));
|
|
123
|
-
|
|
134
|
+
// #5177: a verified cut whose signature covers its gate is preferred, so the statement carries a gate that is signed.
|
|
135
|
+
const verified = checks.find((c) => c.check.status === "verified" && c.check.gate === "signed") ?? checks.find((c) => c.check.status === "verified");
|
|
124
136
|
const unsigned = checks.every((c) => c.check.status === "unsigned");
|
|
125
137
|
if (rule.requirement && !verified) {
|
|
126
138
|
return {
|
|
@@ -150,12 +162,27 @@ export async function preparePublish(req) {
|
|
|
150
162
|
}
|
|
151
163
|
signatureWarning = `${why}; publishing it anyway under --allow-unsigned, so chant release verify ${label ?? release.releaseDigest} will fail for it`;
|
|
152
164
|
}
|
|
165
|
+
// #5177: where the signature is required, say when it does not cover the gate the cut claims.
|
|
166
|
+
const gateWarning = verified && verified.check.gate === "unsigned" && (rule.requirement || groups.has("verified-releases"))
|
|
167
|
+
? `the cut of ${name} by ${verified.cut.actor} was signed before chant signed the green gate, so the gate its cut line records is not covered by the signature; cut the release again with --sign for a signed gate`
|
|
168
|
+
: null;
|
|
153
169
|
const shown = verified ?? checks.at(-1);
|
|
154
170
|
const signature = shown
|
|
155
|
-
? { status: shown.check.status, actor: shown.cut.actor, key: shown.check.key, reason: shown.check.reason }
|
|
156
|
-
: { status: "unsigned", actor: null, key: null, reason: "no cut names the release" };
|
|
171
|
+
? { status: shown.check.status, actor: shown.cut.actor, key: shown.check.key, reason: shown.check.reason, gate: shown.check.gate }
|
|
172
|
+
: { status: "unsigned", actor: null, key: null, reason: "no cut names the release", gate: "unsigned" };
|
|
157
173
|
const cut = shown
|
|
158
|
-
? {
|
|
174
|
+
? {
|
|
175
|
+
actor: shown.cut.actor,
|
|
176
|
+
label: shown.cut.label,
|
|
177
|
+
timestamp: shown.cut.timestamp,
|
|
178
|
+
runId: shown.cut.runId ?? null,
|
|
179
|
+
signature: shown.cut.signature ?? null,
|
|
180
|
+
...(shown.cut.green ? { green: shown.cut.green } : {}),
|
|
181
|
+
...(shown.cut.override ? { override: shown.cut.override } : {}),
|
|
182
|
+
...(shown.cut.lane ? { lane: shown.cut.lane } : {}),
|
|
183
|
+
...(shown.cut.sealVersion ? { sealVersion: shown.cut.sealVersion } : {}),
|
|
184
|
+
gate: shown.check.gate,
|
|
185
|
+
}
|
|
159
186
|
: null;
|
|
160
187
|
let targets;
|
|
161
188
|
try {
|
|
@@ -164,12 +191,16 @@ export async function preparePublish(req) {
|
|
|
164
191
|
catch (err) {
|
|
165
192
|
return { refusal: { code: "publish-config-invalid", message: `the publish targets can't be read: ${err instanceof Error ? err.message : String(err)}`, fix: "Fix release.publish in chant.config.ts." } };
|
|
166
193
|
}
|
|
194
|
+
const { loadChantConfig } = await import("../config.js");
|
|
195
|
+
const releaseConfig = (await loadChantConfig(cwd)).config.release;
|
|
196
|
+
// #5157: the commands run after every target has staged and before any reveals.
|
|
197
|
+
const verify = (await import("./publish-verify.js")).verifySteps(releaseConfig?.verify);
|
|
167
198
|
// A target publishes files from this checkout, so they must be the release commit's (#4047).
|
|
168
199
|
if (targets.length > 0) {
|
|
169
200
|
// #4840: the files release.version names may carry the label, as the publish job's `chant release stamp` writes them.
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
const refused = checkCheckoutIsRelease(cwd, release.commit, name, version ? { version, label } : {});
|
|
201
|
+
const version = releaseConfig?.version;
|
|
202
|
+
const trains = version?.ranges === "train" && label !== null ? (await import("../workspace/train-range-labels.js")).trainLabelCandidates(cwd, label) : undefined;
|
|
203
|
+
const refused = checkCheckoutIsRelease(cwd, release.commit, name, { ...(version ? { version, label, ...(trains ? { trains: await trains } : {}) } : {}), ...(req.alsoStamped ? { alsoStamped: req.alsoStamped } : {}) });
|
|
173
204
|
if (refused)
|
|
174
205
|
return { refusal: refused };
|
|
175
206
|
}
|
|
@@ -187,14 +218,71 @@ export async function preparePublish(req) {
|
|
|
187
218
|
const warning = provenance.oidc || !groups.has("supply-chain")
|
|
188
219
|
? null
|
|
189
220
|
: `this publish runs without OIDC, so what it publishes carries no provenance: ${provenance.reason}. Publish from CI to get provenance.`;
|
|
190
|
-
|
|
191
|
-
const {
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
const
|
|
221
|
+
// #5164: Sigstore signing, when release.signing or supply-chain asks for it and a target signs.
|
|
222
|
+
const { resolveSigning, signingIdentity, cosignSigner } = await import("./publish-signing.js");
|
|
223
|
+
const { loadChantConfig: loadConfig } = await import("../config.js");
|
|
224
|
+
const signingConfig = (await loadConfig(cwd).catch(() => null))?.config.release?.signing;
|
|
225
|
+
const setting = resolveSigning(signingConfig, groups);
|
|
226
|
+
let signing = null;
|
|
227
|
+
const signs = targets.filter((t) => t.kind === "oci" || t.kind === "forge" || t.kind === "pypi");
|
|
228
|
+
if (setting.on && signs.length > 0) {
|
|
229
|
+
const why = setting.from === "config" ? "release.signing in chant.config.ts" : "the supply-chain group";
|
|
230
|
+
const id = signingIdentity(env);
|
|
231
|
+
if ("reason" in id) {
|
|
232
|
+
return {
|
|
233
|
+
refusal: {
|
|
234
|
+
code: "publish-signing-no-oidc",
|
|
235
|
+
message: `${name} would be signed with Sigstore, as ${why} asks, and this run can't sign keylessly: ${id.reason}`,
|
|
236
|
+
fix: "Publish from a CI job with an OIDC token (GitHub Actions: permissions: id-token: write; GitLab CI: SIGSTORE_ID_TOKEN under id_tokens with aud: sigstore), or set release.signing: false.",
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
const signer = req.deps?.signer ?? cosignSigner(env, createRedactor(env));
|
|
241
|
+
const missing = signer.unavailable();
|
|
242
|
+
if (missing) {
|
|
243
|
+
return {
|
|
244
|
+
refusal: {
|
|
245
|
+
code: "publish-signing-tool-missing",
|
|
246
|
+
message: `${name} would be signed with Sigstore, as ${why} asks, and ${missing}`,
|
|
247
|
+
fix: "Install cosign 3 in the job, as chant release workflow does, or point CHANT_COSIGN at it.",
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
signing = { signer, identity: id.identity };
|
|
252
|
+
}
|
|
253
|
+
// #5150: the tag release.tag gives the label, as the cut made it, and the floating tag the publish moves.
|
|
254
|
+
const { memberTags, ReleaseTagError } = await import("./release-tag.js");
|
|
255
|
+
let tags;
|
|
256
|
+
try {
|
|
257
|
+
tags = await memberTags(cwd);
|
|
258
|
+
}
|
|
259
|
+
catch (err) {
|
|
260
|
+
if (err instanceof ReleaseTagError)
|
|
261
|
+
return { refusal: { code: err.code, message: err.message, ...(err.fix ? { fix: err.fix } : {}) } };
|
|
262
|
+
const { legacyTagTemplate } = await import("./release-tag.js");
|
|
263
|
+
tags = { place: { member: null, path: null }, template: { name: legacyTagTemplate(null), floating: null, legacy: true } };
|
|
264
|
+
}
|
|
265
|
+
let releaseTag;
|
|
266
|
+
try {
|
|
267
|
+
releaseTag = label !== null ? renderReleaseTag(tags.template, tags.place, label) : null;
|
|
268
|
+
}
|
|
269
|
+
catch (err) {
|
|
270
|
+
if (err instanceof ReleaseTagError)
|
|
271
|
+
return { refusal: { code: err.code, message: err.message, ...(err.fix ? { fix: err.fix } : {}) } };
|
|
272
|
+
throw err;
|
|
273
|
+
}
|
|
195
274
|
const redactor = createRedactor(env, targets.flatMap((t) => t.credentialEnv));
|
|
196
275
|
const channel = [...cuts].reverse().find((c) => c.channel)?.channel ?? null;
|
|
197
|
-
|
|
276
|
+
const floating = label !== null ? floatingTagPlan(tags, label, release.commit, channel, (await readCuts({ cwd })).cuts.map((c) => c.label).filter((l) => l !== null)) : null;
|
|
277
|
+
const releaseTagOf = (other) => {
|
|
278
|
+
try {
|
|
279
|
+
return renderReleaseTag(tags.template, tags.place, other);
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
return { release, label, signature, provenance, warning, signatureWarning, gateWarning, cut, releaseTag, releaseTagOf, floating, targets, verify, ...(releaseConfig?.dependsOn ? { dependsOn: releaseConfig.dependsOn } : {}), redactor, requireSbom: groups.has("supply-chain"), channel, signing, signingWarning: setting.warning };
|
|
198
286
|
}
|
|
199
287
|
/**
|
|
200
288
|
* A publish with a target reads files from the checkout it runs in: package
|
|
@@ -216,8 +304,9 @@ export function checkCheckoutIsRelease(cwd, commit, name, o = {}) {
|
|
|
216
304
|
};
|
|
217
305
|
}
|
|
218
306
|
let status = tryGit(cwd, ["status", "--porcelain", "--untracked-files=normal"]);
|
|
219
|
-
|
|
220
|
-
|
|
307
|
+
// #5154: what the train's other members stamped is the commit's too.
|
|
308
|
+
if (status && (o.version || (o.alsoStamped && o.alsoStamped.size > 0)))
|
|
309
|
+
status = withoutStamps(cwd, commit, o.version, o.label ?? null, status, o.trains, o.alsoStamped);
|
|
221
310
|
if (status) {
|
|
222
311
|
const n = status.split("\n").length;
|
|
223
312
|
return {
|
|
@@ -229,7 +318,7 @@ export function checkCheckoutIsRelease(cwd, commit, name, o = {}) {
|
|
|
229
318
|
return null;
|
|
230
319
|
}
|
|
231
320
|
/** The porcelain status without the files {@link stampedChanges} takes as the commit's stamped with the label. */
|
|
232
|
-
function withoutStamps(cwd, commit, version, label, status) {
|
|
321
|
+
function withoutStamps(cwd, commit, version, label, status, trains, alsoStamped) {
|
|
233
322
|
let raw;
|
|
234
323
|
let top;
|
|
235
324
|
try {
|
|
@@ -239,10 +328,10 @@ function withoutStamps(cwd, commit, version, label, status) {
|
|
|
239
328
|
catch {
|
|
240
329
|
return status;
|
|
241
330
|
}
|
|
242
|
-
const stamped = stampedChanges({ cwd, top, commit, config: version, label, status: raw });
|
|
331
|
+
const stamped = version ? stampedChanges({ cwd, top, commit, config: version, label, status: raw, ...(trains ? { trains } : {}) }) : new Set();
|
|
243
332
|
return raw
|
|
244
333
|
.split("\n")
|
|
245
|
-
.filter((l) => l.length > 0 && !stamped.has(l.slice(3)))
|
|
334
|
+
.filter((l) => l.length > 0 && !stamped.has(l.slice(3)) && !alsoStamped?.has(l.slice(3)))
|
|
246
335
|
.join("\n")
|
|
247
336
|
.trim();
|
|
248
337
|
}
|
|
@@ -254,12 +343,62 @@ function tryGit(cwd, args) {
|
|
|
254
343
|
return null;
|
|
255
344
|
}
|
|
256
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* Whether a release labelled `label` moves the member's floating tag: only
|
|
348
|
+
* a stable version, cut with no channel, whose version is the highest of its
|
|
349
|
+
* major among the member's labels, so a fix to an older line never moves
|
|
350
|
+
* `v1` back. A prerelease label leaves it where it is. Null when the member
|
|
351
|
+
* declares no floating tag or the label names no version.
|
|
352
|
+
*/
|
|
353
|
+
export function floatingTagPlan(tags, label, commit, channel, labels) {
|
|
354
|
+
const name = floatingTagOfLine(tags.template, tags.place, label);
|
|
355
|
+
if (name === null)
|
|
356
|
+
return null;
|
|
357
|
+
const leave = (reason) => ({ name, commit, move: false, reason });
|
|
358
|
+
// #5166: the prerelease check every publish target makes; a prerelease never moves the floating tag.
|
|
359
|
+
if (prereleaseOf(label) !== null)
|
|
360
|
+
return leave(`${label} is a prerelease, and only a stable version moves it`);
|
|
361
|
+
const version = stableVersionOf(label);
|
|
362
|
+
if (version === null)
|
|
363
|
+
return null;
|
|
364
|
+
if (channel !== null)
|
|
365
|
+
return leave(`the release was cut for the channel ${channel}, not latest`);
|
|
366
|
+
const cmp = (a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
|
|
367
|
+
const newer = labels.map((l) => ({ l, v: stableVersionOf(l) })).find((o) => o.v !== null && o.v[0] === version[0] && cmp(o.v, version) > 0);
|
|
368
|
+
if (newer)
|
|
369
|
+
return leave(`${newer.l} is a later release of major ${version[0]}`);
|
|
370
|
+
if (labels.some((l) => renderReleaseTag(tags.template, tags.place, l) === name))
|
|
371
|
+
return leave(`the release labelled ${labels.find((l) => renderReleaseTag(tags.template, tags.place, l) === name)} has the tag ${name}`);
|
|
372
|
+
return { name, commit, move: true, reason: null };
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Move the floating tag to the release's commit, here and on `remote`
|
|
376
|
+
* (#5150). Returns a warning when it could not, naming the commands to run
|
|
377
|
+
* by hand; the release is published either way.
|
|
378
|
+
*/
|
|
379
|
+
export function moveFloatingTag(cwd, floating, remote = "origin") {
|
|
380
|
+
const run = (args) => execFileSync("git", args, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] });
|
|
381
|
+
try {
|
|
382
|
+
run(["tag", "-f", floating.name, floating.commit]);
|
|
383
|
+
}
|
|
384
|
+
catch (err) {
|
|
385
|
+
return `the floating tag ${floating.name} was not moved: ${err instanceof Error ? err.message.trim() : String(err)}. Move it by hand: git tag -f ${floating.name} ${floating.commit} && git push --force ${remote} refs/tags/${floating.name}`;
|
|
386
|
+
}
|
|
387
|
+
try {
|
|
388
|
+
run(["push", "--force", remote, `refs/tags/${floating.name}`]);
|
|
389
|
+
}
|
|
390
|
+
catch (err) {
|
|
391
|
+
return `the floating tag ${floating.name} was moved here and not pushed: ${err instanceof Error ? err.message.trim() : String(err)}. Push it: git push --force ${remote} refs/tags/${floating.name}`;
|
|
392
|
+
}
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
257
395
|
/** The context each target is planned and published with. */
|
|
258
396
|
export function publishContext(plan, req) {
|
|
259
397
|
return {
|
|
260
398
|
release: plan.release,
|
|
261
399
|
label: plan.label,
|
|
262
400
|
releaseTag: plan.releaseTag,
|
|
401
|
+
...(plan.releaseTagOf ? { releaseTagOf: plan.releaseTagOf } : {}),
|
|
263
402
|
provenance: plan.provenance,
|
|
264
403
|
cut: plan.cut,
|
|
265
404
|
cwd: req.cwd,
|
|
@@ -268,6 +407,7 @@ export function publishContext(plan, req) {
|
|
|
268
407
|
redactor: plan.redactor,
|
|
269
408
|
log: (line) => req.log(plan.redactor.redact(line)),
|
|
270
409
|
requireSbom: plan.requireSbom,
|
|
410
|
+
signing: plan.signing,
|
|
271
411
|
};
|
|
272
412
|
}
|
|
273
413
|
/** A publish that stopped, with what it left staged and revealed so a run of the same command resumes. */
|
|
@@ -280,14 +420,37 @@ export class PublishRunError extends PublishTargetError {
|
|
|
280
420
|
this.name = "PublishRunError";
|
|
281
421
|
}
|
|
282
422
|
}
|
|
423
|
+
/**
|
|
424
|
+
* The order targets reveal in: every other target in the order declared,
|
|
425
|
+
* then the targets that upload at reveal (`uploadsAtReveal`: marketplace,
|
|
426
|
+
* PyPI, Cargo) in the order declared, then the targets that reveal last
|
|
427
|
+
* (`revealsLast`: the MCP Registry) in the order declared.
|
|
428
|
+
*
|
|
429
|
+
* An upload at reveal can't be taken back, so it waits until the reveals
|
|
430
|
+
* that only move a tag or publish a draft have gone through. A target that
|
|
431
|
+
* reveals last lists packages other targets publish, PyPI ones among them,
|
|
432
|
+
* so it goes after the uploads too.
|
|
433
|
+
*/
|
|
434
|
+
export function revealOrder(targets) {
|
|
435
|
+
const rank = (t) => (t.revealsLast ? 2 : t.uploadsAtReveal ? 1 : 0);
|
|
436
|
+
return [0, 1, 2].flatMap((r) => targets.filter((t) => rank(t) === r));
|
|
437
|
+
}
|
|
283
438
|
/**
|
|
284
439
|
* Publish `targets` all or nothing (#4048), from the record of earlier runs:
|
|
285
440
|
*
|
|
286
441
|
* 1. Stage every target in the order declared, skipping one the record says
|
|
287
442
|
* staged or revealed. Each stage is recorded and pushed as it finishes.
|
|
288
|
-
* A failure here leaves nothing visible to a consumer.
|
|
289
|
-
*
|
|
290
|
-
*
|
|
443
|
+
* A failure here leaves nothing visible to a consumer. A target whose
|
|
444
|
+
* stage is already visible (`stagesVisibly`) is not staged here but just
|
|
445
|
+
* before its reveal, so it is never visible before the others have staged.
|
|
446
|
+
* 2. Run `verify` (#5157), the `release.verify` commands, with the staged
|
|
447
|
+
* references, unless the record shows a reveal. A failure is recorded
|
|
448
|
+
* and stops the publish with nothing visible.
|
|
449
|
+
* 3. Reveal each target in {@link revealOrder}, skipping one the record says
|
|
450
|
+
* revealed, and record each reveal.
|
|
451
|
+
*
|
|
452
|
+
* A target whose refusals are warnings (`refusalWarns`) does not stop
|
|
453
|
+
* either step: it comes back with a `warning` and no reveal is recorded.
|
|
291
454
|
*
|
|
292
455
|
* A run of the same publish after a failure resumes: what went out is not
|
|
293
456
|
* published again, and a stage that failed part way sends only what its
|
|
@@ -324,6 +487,31 @@ export async function runPublish(req) {
|
|
|
324
487
|
const resumed = [];
|
|
325
488
|
const staged = new Map();
|
|
326
489
|
const stagedNames = [];
|
|
490
|
+
const revealedNames = [];
|
|
491
|
+
// #5158: a target whose refusals are warnings and whose stage was refused: not revealed, reported with its warning.
|
|
492
|
+
const refused = new Map();
|
|
493
|
+
const refusal = (target, err) => {
|
|
494
|
+
const why = ctx.redactor.redact(err instanceof Error ? err.message : String(err));
|
|
495
|
+
say(` warning: ${target.name}: ${why}`);
|
|
496
|
+
return { target: target.name, destination: target.destination, items: [{ name: target.name, destination: target.destination, refused: true }], warning: why };
|
|
497
|
+
};
|
|
498
|
+
const stageOne = async (target) => {
|
|
499
|
+
say(` staging to ${target.destination}`);
|
|
500
|
+
let s;
|
|
501
|
+
try {
|
|
502
|
+
s = await target.stage(ctx);
|
|
503
|
+
}
|
|
504
|
+
catch (err) {
|
|
505
|
+
if (target.refusalWarns) {
|
|
506
|
+
refused.set(target.key, refusal(target, err));
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
return fail(err, target, "stage", stagedNames, revealedNames);
|
|
510
|
+
}
|
|
511
|
+
staged.set(target.key, s);
|
|
512
|
+
stagedNames.push(target.name);
|
|
513
|
+
await write(target, "staged", s.items, s.state);
|
|
514
|
+
};
|
|
327
515
|
for (const target of targets) {
|
|
328
516
|
if (progress.revealed.has(target.key)) {
|
|
329
517
|
resumed.push({ target: target.name, step: "revealed" });
|
|
@@ -338,33 +526,57 @@ export async function runPublish(req) {
|
|
|
338
526
|
stagedNames.push(target.name);
|
|
339
527
|
continue;
|
|
340
528
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
529
|
+
// Its stage is visible to a consumer, so it waits for its reveal's turn.
|
|
530
|
+
if (target.stagesVisibly)
|
|
531
|
+
continue;
|
|
532
|
+
await stageOne(target);
|
|
533
|
+
}
|
|
534
|
+
// #5157: release.verify, with nothing visible yet; not once a reveal is recorded, since it could hold nothing back.
|
|
535
|
+
let verified;
|
|
536
|
+
const steps = req.verify ?? [];
|
|
537
|
+
if (steps.length > 0 && targets.some((t) => !progress.revealed.has(t.key))) {
|
|
538
|
+
if (progress.revealed.size > 0) {
|
|
539
|
+
say(" verify: skipped, since an earlier run began revealing");
|
|
540
|
+
verified = "skipped";
|
|
345
541
|
}
|
|
346
|
-
|
|
347
|
-
|
|
542
|
+
else {
|
|
543
|
+
const { runVerifySteps, stagedReference, verifyKey } = await import("./publish-verify.js");
|
|
544
|
+
const refs = targets.filter((t) => staged.has(t.key)).map((t) => stagedReference(t, staged.get(t.key)));
|
|
545
|
+
const outcome = runVerifySteps({ cwd, steps, env: ctx.env, release, label, releaseTag: ctx.releaseTag, staged: refs, say, ...(req.runVerify ? { run: req.runVerify } : {}) });
|
|
546
|
+
const key = { key: verifyKey(steps), kind: "verify", name: "verify" };
|
|
547
|
+
if (!outcome.passed) {
|
|
548
|
+
await write(key, "verify-failed", [], { step: outcome.step.name, exitCode: String(outcome.exitCode) });
|
|
549
|
+
throw new PublishRunError("publish-verify-failed", ctx.redactor.redact(`verify: ${outcome.step.name} exited ${outcome.exitCode ?? "on a signal"}`), "Nothing was revealed. Fix what it found and run the same command again: what staged is not staged again, and the verify commands run again before any reveal. A release that should not go out stays staged, unseen by consumers.", "verify", stagedNames, []);
|
|
550
|
+
}
|
|
551
|
+
await write(key, "verified", [], {});
|
|
552
|
+
verified = "passed";
|
|
348
553
|
}
|
|
349
|
-
staged.set(target.key, s);
|
|
350
|
-
stagedNames.push(target.name);
|
|
351
|
-
await write(target, "staged", s.items, s.state);
|
|
352
554
|
}
|
|
353
555
|
const published = [];
|
|
354
|
-
const
|
|
355
|
-
for (const target of targets) {
|
|
556
|
+
for (const target of revealOrder(targets)) {
|
|
356
557
|
const done = progress.revealed.get(target.key);
|
|
357
558
|
if (done) {
|
|
358
559
|
published.push({ ...done, target: target.name, destination: target.destination, items: done.items.map((i) => ({ ...i, present: true })) });
|
|
359
560
|
revealedNames.push(target.name);
|
|
360
561
|
continue;
|
|
361
562
|
}
|
|
563
|
+
if (!refused.has(target.key) && !staged.has(target.key))
|
|
564
|
+
await stageOne(target);
|
|
565
|
+
const wasRefused = refused.get(target.key);
|
|
566
|
+
if (wasRefused) {
|
|
567
|
+
published.push(wasRefused);
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
362
570
|
say(` revealing ${target.name}`);
|
|
363
571
|
let p;
|
|
364
572
|
try {
|
|
365
573
|
p = await target.reveal(ctx, staged.get(target.key));
|
|
366
574
|
}
|
|
367
575
|
catch (err) {
|
|
576
|
+
if (target.refusalWarns) {
|
|
577
|
+
published.push(refusal(target, err));
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
368
580
|
return fail(err, target, "reveal", stagedNames, revealedNames);
|
|
369
581
|
}
|
|
370
582
|
published.push(p);
|
|
@@ -376,5 +588,5 @@ export async function runPublish(req) {
|
|
|
376
588
|
revealedNames.push(target.name);
|
|
377
589
|
await write(target, "revealed", p.items, {});
|
|
378
590
|
}
|
|
379
|
-
return { published, resumed, recordWarning };
|
|
591
|
+
return { published, resumed, recordWarning, ...(verified ? { verify: verified } : {}) };
|
|
380
592
|
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deprecate, yank and restore a published release (#5163):
|
|
3
|
+
* `chant release deprecate|yank|restore <label|digest>`.
|
|
4
|
+
*
|
|
5
|
+
* A change is one status record (./release-status.ts) and what each publish
|
|
6
|
+
* target does about it:
|
|
7
|
+
*
|
|
8
|
+
* - `deprecate` sets `deprecated`. Consumers keep resolving the release and
|
|
9
|
+
* are warned: npm marks each version with `npm deprecate`. A registry, a
|
|
10
|
+
* forge release and a formula have no deprecation, so nothing changes there.
|
|
11
|
+
* - `yank` sets `yanked`. New consumers stop resolving the release: npm
|
|
12
|
+
* deprecates each version and moves the dist-tag back, the OCI target moves
|
|
13
|
+
* its moving tags back, the forge release becomes a prerelease, a draft or
|
|
14
|
+
* is deleted, and a tap's formula is reverted. "Back" is the head: the
|
|
15
|
+
* newest release of the same line that is active, not revoked and was
|
|
16
|
+
* revealed on that target. The line is the channel the release was cut
|
|
17
|
+
* for, else, for a prerelease label (#5166), its npm dist-tag (`rc`), else
|
|
18
|
+
* the stable line, so a yanked `1.4.0-rc.2` moves `rc` back to `1.4.0-rc.1`
|
|
19
|
+
* and a yanked stable release never moves `latest` onto a prerelease.
|
|
20
|
+
* - `restore` sets `active` again and undoes what the target can: npm clears
|
|
21
|
+
* the message, a forge release is published again, and when the release is
|
|
22
|
+
* the head again the moving tags and the formula point at it.
|
|
23
|
+
*
|
|
24
|
+
* The floating tag (`release.tag.floating`, #5150), such as `v1`, is one
|
|
25
|
+
* more step: a yank of the stable release it names moves it back to the
|
|
26
|
+
* highest active stable release of that major, and a restore moves it
|
|
27
|
+
* forward when the release is that one again. The release's own tag, as
|
|
28
|
+
* `release.tag` renders it, names the forge release.
|
|
29
|
+
*
|
|
30
|
+
* What went out is read from the publish record (`_releases/publishes.jsonl`,
|
|
31
|
+
* ./publish-record.ts), never the checkout, so a change runs from any
|
|
32
|
+
* checkout of the member. A target the release was not revealed on is left
|
|
33
|
+
* alone.
|
|
34
|
+
*
|
|
35
|
+
* The status record goes to `_releases/release-status.jsonl` with `env`
|
|
36
|
+
* `_releases` and the member as `component`, and each target's actions to
|
|
37
|
+
* `_releases/status-actions.jsonl`, both on `chant/lifecycle` and pushed as
|
|
38
|
+
* they are written. A change that stopped part way resumes: run the same
|
|
39
|
+
* command again, and the latest status record, when it already sets the same
|
|
40
|
+
* status, is the change resumed, and a target with an actions line for it is
|
|
41
|
+
* skipped.
|
|
42
|
+
*
|
|
43
|
+
* Under an `identity.gates.release` entry a change must be signed by a signer
|
|
44
|
+
* in the gate's class, as a cut must (`admitReleaseStatus`).
|
|
45
|
+
*/
|
|
46
|
+
import type { Release } from "./release-store.js";
|
|
47
|
+
import type { ReleaseStatusRecord } from "./release-status.js";
|
|
48
|
+
import type { ReleaseStatusValue } from "./release-catalog.js";
|
|
49
|
+
import { type MemberTags } from "./release-tag.js";
|
|
50
|
+
import { PublishTargetError, type ForgeYankMode, type PublishDeps, type PublishItem, type PublishTarget, type StatusAction, type StatusContext, type StatusRelease } from "./release-publish.js";
|
|
51
|
+
import type { Redactor } from "./publish-credentials.js";
|
|
52
|
+
/** The three commands and the status each sets. */
|
|
53
|
+
export type StatusVerb = "deprecate" | "yank" | "restore";
|
|
54
|
+
export declare const STATUS_OF: Readonly<Record<StatusVerb, ReleaseStatusValue>>;
|
|
55
|
+
/** The file each target's actions are appended to, under `_releases/`. */
|
|
56
|
+
export declare const STATUS_ACTIONS_FILE = "status-actions.jsonl";
|
|
57
|
+
/** The ledger directory a status record of a cut release goes to: the release's own, `_releases`. */
|
|
58
|
+
export declare const RELEASE_STATUS_LEDGER = "_releases";
|
|
59
|
+
/** One line of `_releases/status-actions.jsonl`: what one target did for one status change. */
|
|
60
|
+
export interface StatusActionRecord {
|
|
61
|
+
version: 1;
|
|
62
|
+
releaseDigest: string;
|
|
63
|
+
label: string | null;
|
|
64
|
+
status: ReleaseStatusValue;
|
|
65
|
+
/** The `timestamp` of the status record the actions carry out. */
|
|
66
|
+
statusAt: string;
|
|
67
|
+
/** The target's key. */
|
|
68
|
+
target: string;
|
|
69
|
+
kind: string;
|
|
70
|
+
name: string;
|
|
71
|
+
actions: StatusAction[];
|
|
72
|
+
runId: string;
|
|
73
|
+
timestamp: string;
|
|
74
|
+
}
|
|
75
|
+
/** Parse `status-actions.jsonl`. A line that is not a record is skipped. */
|
|
76
|
+
export declare function parseStatusActions(text: string | null): StatusActionRecord[];
|
|
77
|
+
/** Why a status change was refused before anything ran. */
|
|
78
|
+
export interface StatusRefusal {
|
|
79
|
+
code: string;
|
|
80
|
+
message: string;
|
|
81
|
+
fix?: string;
|
|
82
|
+
}
|
|
83
|
+
/** One target of the change, as planned. */
|
|
84
|
+
export interface StatusTargetPlan {
|
|
85
|
+
kind: string;
|
|
86
|
+
name: string;
|
|
87
|
+
key: string;
|
|
88
|
+
destination: string;
|
|
89
|
+
/** Set when the target is left alone, and why: the release was not revealed on it. */
|
|
90
|
+
skip?: string;
|
|
91
|
+
/** True when an earlier run of this change already acted on it. */
|
|
92
|
+
done: boolean;
|
|
93
|
+
/** What it would do (a dry run asks no registry, so a move is conditional on where the tag is). */
|
|
94
|
+
actions: StatusAction[];
|
|
95
|
+
/** The head the target's moving tags should point at, or null. */
|
|
96
|
+
head: StatusRelease | null;
|
|
97
|
+
/** The target and its context, for the run. Absent when skipped. The floating tag's step is a target with only `setStatus`. */
|
|
98
|
+
target?: Pick<PublishTarget, "setStatus">;
|
|
99
|
+
ctx?: StatusContext;
|
|
100
|
+
}
|
|
101
|
+
/** A change ready to run. */
|
|
102
|
+
export interface StatusPlan {
|
|
103
|
+
verb: StatusVerb;
|
|
104
|
+
status: ReleaseStatusValue;
|
|
105
|
+
release: Release;
|
|
106
|
+
label: string | null;
|
|
107
|
+
member: string | null;
|
|
108
|
+
/** The status record's `component`: the member, `.` outside a workspace. */
|
|
109
|
+
component: string;
|
|
110
|
+
/** The status the release has now, and the record that set it. */
|
|
111
|
+
current: {
|
|
112
|
+
status: ReleaseStatusValue;
|
|
113
|
+
record?: ReleaseStatusRecord;
|
|
114
|
+
};
|
|
115
|
+
/** The latest record when it already sets this status: the change is resumed under it, and nothing new is written. */
|
|
116
|
+
resumes: ReleaseStatusRecord | null;
|
|
117
|
+
actor: string;
|
|
118
|
+
reason: string | null;
|
|
119
|
+
replacement: string | null;
|
|
120
|
+
forgeYank: ForgeYankMode;
|
|
121
|
+
/** Whether `identity.gates.release` requires the change to be signed. */
|
|
122
|
+
signed: boolean;
|
|
123
|
+
targets: StatusTargetPlan[];
|
|
124
|
+
/** Targets the release was revealed on that `release.publish` no longer declares, by name. */
|
|
125
|
+
undeclared: string[];
|
|
126
|
+
redactor: Redactor;
|
|
127
|
+
}
|
|
128
|
+
/** A change that stopped at a target. */
|
|
129
|
+
export declare class StatusRunError extends PublishTargetError {
|
|
130
|
+
readonly done: string[];
|
|
131
|
+
constructor(code: string, message: string, fix: string | undefined, done: string[]);
|
|
132
|
+
}
|
|
133
|
+
/** The release key a moving tag is judged by: cuts in the order made, so the newest release is the one cut last. */
|
|
134
|
+
export interface Known {
|
|
135
|
+
release: Release;
|
|
136
|
+
label: string | null;
|
|
137
|
+
firstCut: string;
|
|
138
|
+
channel: string | null;
|
|
139
|
+
/** The channel, else a prerelease label's npm dist-tag, else null for the stable line: what a head is chosen among. */
|
|
140
|
+
line: string | null;
|
|
141
|
+
}
|
|
142
|
+
/** The line of a release cut for `channel` with `label` (#5166): the channel, else the prerelease's dist-tag, else null. */
|
|
143
|
+
export declare function lineOf(channel: string | null, label: string | null): string | null;
|
|
144
|
+
/**
|
|
145
|
+
* The head of `target`: among `known` releases of `line` ({@link lineOf}), the newest whose
|
|
146
|
+
* status (with `override` applied for one digest) is active, that is not
|
|
147
|
+
* revoked and that the record says was revealed on the target.
|
|
148
|
+
*/
|
|
149
|
+
export declare function headOn(key: string, known: readonly Known[], line: string | null, statusOfDigest: (digest: string) => ReleaseStatusValue, revoked: (r: Release) => boolean, revealedOn: (digest: string, key: string) => PublishItem[] | undefined, tagOf: (label: string | null) => string | null): StatusRelease | null;
|
|
150
|
+
/**
|
|
151
|
+
* The floating tag's step (#5150), or null when the release moves none: no
|
|
152
|
+
* `release.tag.floating`, a prerelease or non-version label, or a cut for a
|
|
153
|
+
* channel. Among the stable releases of the same major cut with no channel
|
|
154
|
+
* that are active (with this change applied), not revoked and published, the
|
|
155
|
+
* highest version is where the tag belongs, as `floatingTagPlan` moves it at
|
|
156
|
+
* publish. A yank moves it there when it names this release's commit; a
|
|
157
|
+
* restore moves it to this release when it is that one.
|
|
158
|
+
*/
|
|
159
|
+
export declare function floatingTagStep(o: {
|
|
160
|
+
cwd: string;
|
|
161
|
+
tags: MemberTags;
|
|
162
|
+
known: readonly Known[];
|
|
163
|
+
release: Release;
|
|
164
|
+
label: string | null;
|
|
165
|
+
channel: string | null;
|
|
166
|
+
statusOfDigest: (digest: string) => ReleaseStatusValue;
|
|
167
|
+
revoked: (r: Release) => boolean;
|
|
168
|
+
published: (digest: string) => boolean;
|
|
169
|
+
/** Where the tag is now, a commit or null; the local tag after a fetch of it by default. */
|
|
170
|
+
tagCommit?: (name: string) => string | null;
|
|
171
|
+
/** Move the tag here and on the remote; returns a warning when it could not. */
|
|
172
|
+
move?: (name: string, commit: string) => string | null;
|
|
173
|
+
}): (Required<Pick<PublishTarget, "setStatus">> & {
|
|
174
|
+
name: string;
|
|
175
|
+
}) | null;
|
|
176
|
+
/**
|
|
177
|
+
* Resolve `ref` in the member at `cwd` and plan the change: the status
|
|
178
|
+
* record it writes, or the one it resumes, and what each target would do.
|
|
179
|
+
* Reads the local `chant/lifecycle` and the tags; asks no registry.
|
|
180
|
+
*/
|
|
181
|
+
export declare function prepareStatusChange(req: {
|
|
182
|
+
cwd: string;
|
|
183
|
+
ref: string;
|
|
184
|
+
verb: StatusVerb;
|
|
185
|
+
actor: string;
|
|
186
|
+
reason?: string;
|
|
187
|
+
replacement?: string;
|
|
188
|
+
forgeYank?: ForgeYankMode;
|
|
189
|
+
/** Whether the change will be signed (`--sign`). */
|
|
190
|
+
sign?: boolean;
|
|
191
|
+
env?: NodeJS.ProcessEnv;
|
|
192
|
+
deps?: PublishDeps;
|
|
193
|
+
log?: (line: string) => void;
|
|
194
|
+
}): Promise<StatusPlan | {
|
|
195
|
+
refusal: StatusRefusal;
|
|
196
|
+
}>;
|
|
197
|
+
/** What {@link runStatusChange} did. */
|
|
198
|
+
export interface StatusRun {
|
|
199
|
+
/** The status record written now, or the one resumed. */
|
|
200
|
+
record: ReleaseStatusRecord;
|
|
201
|
+
written: boolean;
|
|
202
|
+
/** Each target acted on, in the order run. */
|
|
203
|
+
results: Array<{
|
|
204
|
+
name: string;
|
|
205
|
+
actions: StatusAction[];
|
|
206
|
+
resumed: boolean;
|
|
207
|
+
}>;
|
|
208
|
+
/** Why a line was not written or pushed, when one wasn't. */
|
|
209
|
+
recordWarning: string | null;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Carry out a planned change: write the status record (signed when `sign`
|
|
213
|
+
* names a key) unless the plan resumes one, then act on each target, last
|
|
214
|
+
* declared first for a yank, so a formula stops naming assets before the
|
|
215
|
+
* forge release that holds them is withdrawn, and first declared first
|
|
216
|
+
* otherwise. Each target's actions are recorded and pushed as it finishes.
|
|
217
|
+
* Throws {@link StatusRunError}.
|
|
218
|
+
*/
|
|
219
|
+
export declare function runStatusChange(plan: StatusPlan, req: {
|
|
220
|
+
cwd: string;
|
|
221
|
+
sign?: string | true;
|
|
222
|
+
env?: NodeJS.ProcessEnv;
|
|
223
|
+
now?: () => Date;
|
|
224
|
+
say?: (line: string) => void;
|
|
225
|
+
record?: boolean;
|
|
226
|
+
}): Promise<StatusRun>;
|