@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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ci.forge` and `ci.system` (#5170): the forge the repository is on and the
|
|
3
|
+
* CI system that runs its jobs, read from the declaration at base, as
|
|
4
|
+
* `ci.locks` is (./ci-locks.ts). Null outside a workspace and when the
|
|
5
|
+
* declaration names neither, and then each command takes the forge from its
|
|
6
|
+
* job or its flags, and the CI system is the forge's own.
|
|
7
|
+
*/
|
|
8
|
+
import type { ForgeCi } from "../ci-system.js";
|
|
9
|
+
/** The `ci.forge` and `ci.system` of the workspace holding `cwd`, read at `at` when given, else at base, else from the working tree. */
|
|
10
|
+
export declare function ciForgeAt(cwd: string, at?: string): ForgeCi | null;
|
|
11
|
+
/**
|
|
12
|
+
* Why `chant build --components --generate <lexicon>` would write the wrong
|
|
13
|
+
* CI system's files for the declaration's `ci.system`, or undefined when it
|
|
14
|
+
* writes the right one. A lexicon that names no CI system is left to the
|
|
15
|
+
* generator, which refuses one with no pipeline generator.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateTargetProblem(lexicon: string, declared: ForgeCi | null): string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CI_SYSTEMS, isCiSystem } from "../ci-system.js";
|
|
2
|
+
import { scopeSource } from "./write-scope.js";
|
|
3
|
+
/** The `ci.forge` and `ci.system` of the workspace holding `cwd`, read at `at` when given, else at base, else from the working tree. */
|
|
4
|
+
export function ciForgeAt(cwd, at) {
|
|
5
|
+
return scopeSource(cwd, at).declaration?.ci?.forgeCi ?? null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Why `chant build --components --generate <lexicon>` would write the wrong
|
|
9
|
+
* CI system's files for the declaration's `ci.system`, or undefined when it
|
|
10
|
+
* writes the right one. A lexicon that names no CI system is left to the
|
|
11
|
+
* generator, which refuses one with no pipeline generator.
|
|
12
|
+
*/
|
|
13
|
+
export function generateTargetProblem(lexicon, declared) {
|
|
14
|
+
if (!declared || !isCiSystem(lexicon) || lexicon === declared.ci)
|
|
15
|
+
return undefined;
|
|
16
|
+
return `chant.workspace.json names ci.system ${declared.ci} for the ${declared.forge} forge, and --generate ${lexicon} writes ${lexicon}'s pipeline files; generate ${declared.ci}, or change ci.system (one of ${CI_SYSTEMS.join(", ")})`;
|
|
17
|
+
}
|
|
@@ -274,7 +274,7 @@ export function proposeCiInit(root, options) {
|
|
|
274
274
|
notes.push(`${forge} has no check runs for ci tick to read; set ci.green.source to runs and run chant ci tick from a scheduled job (see the green-commits guide).`);
|
|
275
275
|
}
|
|
276
276
|
if (reported("ci-workflow-publish-missing"))
|
|
277
|
-
commands.push({ cwd: ".", args: ["release", "workflow", "--forge", forge], why: "the publish job for release
|
|
277
|
+
commands.push({ cwd: ".", args: ["release", "workflow", "--forge", forge], why: "the publish job for release tags" });
|
|
278
278
|
}
|
|
279
279
|
return { files, commands, notes, findings };
|
|
280
280
|
}
|
|
@@ -613,6 +613,7 @@
|
|
|
613
613
|
"required": ["forge", "workflow", "reason"],
|
|
614
614
|
"properties": {
|
|
615
615
|
"forge": { "enum": ["github", "gitlab", "forgejo", null] },
|
|
616
|
+
"ci": { "enum": ["github", "gitlab", "forgejo", "prow"], "description": "The CI system that runs the workflow, present only when chant.config.ts names one on the executor; absent, the forge's own (GitHub Actions, GitLab CI or Forgejo Actions). prow runs a GitHub repository's jobs, and workflow is then the job config file Prow loads (#5170). Added by chant 0.124.101." },
|
|
616
617
|
"workflow": { "type": ["string", "null"], "description": "The workflow file the forge runs, such as deploy-prod.yml under .github/workflows/, or .gitlab-ci.yml." },
|
|
617
618
|
"reason": {
|
|
618
619
|
"oneOf": [
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* runs. The level-0 goldens (#2526) fail if a level-0 command loads it.
|
|
17
17
|
*/
|
|
18
18
|
import { type RetentionOverride } from "../lifecycle/retention-policy.js";
|
|
19
|
+
import { type ForgeCi } from "../ci-system.js";
|
|
19
20
|
import { type NotifyConfig } from "../notify.js";
|
|
20
21
|
import { type CloudIdentityDeclaration } from "../ci-identity.js";
|
|
21
22
|
import { EXAMPLES_KIND } from "./kinds.js";
|
|
@@ -331,6 +332,13 @@ export type CiLocks = "apply" | "plan";
|
|
|
331
332
|
export type CiLockGrain = "target" | "resource" | "repo";
|
|
332
333
|
/** The declaration's `ci` block (#3573). */
|
|
333
334
|
export interface CiDeclaration {
|
|
335
|
+
/**
|
|
336
|
+
* `ci.forge` and `ci.system` (#5170): the forge the repository is on and
|
|
337
|
+
* the CI system that runs its jobs, with the system defaulting to the
|
|
338
|
+
* forge's own and the forge to the one the system serves. Absent when the
|
|
339
|
+
* declaration names neither.
|
|
340
|
+
*/
|
|
341
|
+
forgeCi?: ForgeCi;
|
|
334
342
|
green: CiGreen | null;
|
|
335
343
|
/** `ci.workflow` (#4168 step 6): the workflow every member follows unless it names its own; absent when the declaration sets none. */
|
|
336
344
|
workflow?: CiWorkflow;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { RETENTION_KINDS } from "../lifecycle/retention-policy.js";
|
|
19
19
|
import { parseReportUrl } from "../pr-report-url.js";
|
|
20
|
+
import { defaultCiOf, defaultForgeOf, forgeCiProblem } from "../ci-system.js";
|
|
20
21
|
import { notifyConfigProblem } from "../notify.js";
|
|
21
22
|
import schema from "./declaration.schema.json" with { type: "json" };
|
|
22
23
|
import { routeConflicts } from "./ci-branches.js";
|
|
@@ -632,7 +633,18 @@ function ciOf(raw, at) {
|
|
|
632
633
|
const block = raw;
|
|
633
634
|
const hooks = ciHooksOf(block.hooks, "/ci/hooks", at);
|
|
634
635
|
const policy = ciPolicyOf(block.policy, at);
|
|
636
|
+
// #5170: the forge and its CI system, each defaulting from the other.
|
|
637
|
+
let forgeCi;
|
|
638
|
+
if (block.forge !== undefined || block.system !== undefined) {
|
|
639
|
+
const forge = block.forge ?? defaultForgeOf(block.system);
|
|
640
|
+
const ci = block.system ?? defaultCiOf(forge);
|
|
641
|
+
const problem = forgeCiProblem(forge, ci);
|
|
642
|
+
if (problem)
|
|
643
|
+
throw new WorkspaceReadError("declaration-invalid", `ci.system: ${problem.replace(/^ci: /, "")}`, at("/ci/system"));
|
|
644
|
+
forgeCi = { forge, ci };
|
|
645
|
+
}
|
|
635
646
|
const workflow = {
|
|
647
|
+
...(forgeCi ? { forgeCi } : {}),
|
|
636
648
|
...(block.workflow !== undefined ? { workflow: block.workflow } : {}),
|
|
637
649
|
...(hooks ? { hooks } : {}),
|
|
638
650
|
...(block.branches !== undefined ? { branches: globMap(block.branches) } : {}),
|
|
@@ -209,6 +209,14 @@
|
|
|
209
209
|
},
|
|
210
210
|
"description": "What the workspace's CI decides about its commits (#3573, ws-103). Added in schema 1 by chant 0.108.0, so a declaration that uses it sets minReader to 0.108.0 or newer.",
|
|
211
211
|
"properties": {
|
|
212
|
+
"forge": {
|
|
213
|
+
"enum": ["github", "gitlab", "forgejo"],
|
|
214
|
+
"description": "The forge the repository is on (#5170): where its pull requests, comments and commit statuses live, and whose API chant reads. Absent: the forge system names, else the forge each command reads from its job or its flags. Added in schema 1 by chant 0.124.101, so a declaration that uses it sets minReader to 0.124.101 or newer."
|
|
215
|
+
},
|
|
216
|
+
"system": {
|
|
217
|
+
"enum": ["github", "gitlab", "forgejo", "prow"],
|
|
218
|
+
"description": "The CI system that runs the repository's jobs and reads the pipeline files chant writes (#5170): github (GitHub Actions), gitlab (GitLab CI), forgejo (Forgejo Actions) or prow. Absent: the forge's own. prow runs jobs for a repository on github only, and a pair that cannot run is refused. Added in schema 1 by chant 0.124.101, so a declaration that uses it sets minReader to 0.124.101 or newer."
|
|
219
|
+
},
|
|
212
220
|
"green": {
|
|
213
221
|
"$ref": "#/$defs/ciGreen"
|
|
214
222
|
},
|
|
@@ -55,6 +55,8 @@ export type ExecutorReasonCode = (typeof EXECUTOR_REASON_CODES)[number];
|
|
|
55
55
|
/** The forge workflow that deploys an environment (#4402), or why none is named. */
|
|
56
56
|
export interface ComponentExecutor {
|
|
57
57
|
forge: EnvironmentExecutor["forge"] | null;
|
|
58
|
+
/** The CI system that runs the workflow (#5170), present only when the config names one; absent, the forge's own. */
|
|
59
|
+
ci?: NonNullable<EnvironmentExecutor["ci"]>;
|
|
58
60
|
workflow: string | null;
|
|
59
61
|
/** Null when `forge` and `workflow` are set. */
|
|
60
62
|
reason: {
|
|
@@ -150,7 +150,7 @@ export function executorFor(env, member) {
|
|
|
150
150
|
}
|
|
151
151
|
const found = environmentExecutor(member?.declared ?? undefined, env);
|
|
152
152
|
if (found)
|
|
153
|
-
return { forge: found.forge, workflow: found.workflow, reason: null };
|
|
153
|
+
return { forge: found.forge, ...(found.ci ? { ci: found.ci } : {}), workflow: found.workflow, reason: null };
|
|
154
154
|
return { forge: null, workflow: null, reason: { code: "executor-none-declared", message: `chant.config.ts declares no executor for ${env}` } };
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
@@ -67,7 +67,14 @@ export declare function admitApprover(rule: GateAdmissionRule, a: SealedGateAppr
|
|
|
67
67
|
export declare const RELEASE_GATE = "release";
|
|
68
68
|
/** The ssh signature namespace of a release cut's signature (#4031), so no other signature can stand in for one. */
|
|
69
69
|
export declare const RELEASE_SEAL_NAMESPACE = "chant-release";
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* The version of the payload a new cut's signature signs (#5177). Version 1
|
|
72
|
+
* (#4031) is four lines; version 2 adds the green-gate record. A cut line
|
|
73
|
+
* written with version 2 says so in `sealVersion`; a line without it was
|
|
74
|
+
* signed over version 1.
|
|
75
|
+
*/
|
|
76
|
+
export declare const RELEASE_CUT_SEAL_VERSION = 2;
|
|
77
|
+
/** A cut line's fields its signature covers (#4031, #5177), and the signature. */
|
|
71
78
|
export interface SignedReleaseCut {
|
|
72
79
|
releaseDigest: string;
|
|
73
80
|
label: string | null;
|
|
@@ -75,13 +82,55 @@ export interface SignedReleaseCut {
|
|
|
75
82
|
timestamp: string;
|
|
76
83
|
/** The armored ssh signature, or null for an unsigned cut. */
|
|
77
84
|
signature: string | null;
|
|
85
|
+
/** The payload version the signature signs (#5177): 2 covers the gate record; absent, version 1, which does not. */
|
|
86
|
+
sealVersion?: number;
|
|
87
|
+
/** The green gate the cut passed (#5149), as the cut line records it. */
|
|
88
|
+
green?: unknown;
|
|
89
|
+
/** The override the cut ran under (#4693), as the cut line records it. */
|
|
90
|
+
override?: unknown;
|
|
91
|
+
/** The green lane the cut checked (#4692). */
|
|
92
|
+
lane?: string;
|
|
78
93
|
}
|
|
79
94
|
/**
|
|
80
|
-
* The bytes a release cut's signature signs (#4031): the
|
|
81
|
-
* the label (empty for none), the actor who cut it and the
|
|
82
|
-
* joined by LF with no final newline.
|
|
95
|
+
* The bytes a release cut's signature signs under version 1 (#4031): the
|
|
96
|
+
* release digest, the label (empty for none), the actor who cut it and the
|
|
97
|
+
* cut's time, joined by LF with no final newline.
|
|
98
|
+
*/
|
|
99
|
+
export declare function releaseSealPayload(cut: Pick<SignedReleaseCut, "releaseDigest" | "label" | "actor" | "timestamp">): Buffer;
|
|
100
|
+
/**
|
|
101
|
+
* The green-gate record a version 2 cut signature covers (#5177): the cut
|
|
102
|
+
* line's `green`, `override` and `lane`, those it holds, as sorted JSON.
|
|
103
|
+
* `{}` for a cut that records none of them.
|
|
83
104
|
*/
|
|
84
|
-
export declare function
|
|
105
|
+
export declare function releaseCutGateRecord(cut: Pick<SignedReleaseCut, "green" | "override" | "lane">): string;
|
|
106
|
+
/**
|
|
107
|
+
* The bytes a version 2 cut signature signs (#5177): the four lines of
|
|
108
|
+
* version 1, then `seal:2` and `gate:<record>`. The release digest stays the
|
|
109
|
+
* digest of the release file, so two cuts of one commit still share it, and
|
|
110
|
+
* the gate each cut claims is under its own signature. The `seal:2` line keeps
|
|
111
|
+
* the bytes apart from a version 1 cut's and from a status change's
|
|
112
|
+
* (`status:<status>`) in the shared `chant-release` namespace.
|
|
113
|
+
*/
|
|
114
|
+
export declare function releaseGateSealPayload(cut: Omit<SignedReleaseCut, "signature" | "sealVersion">): Buffer;
|
|
115
|
+
/** The bytes the cut's signature signs, by the version its line names: version 2 with `sealVersion: 2`, else version 1. */
|
|
116
|
+
export declare function releaseCutSealPayload(cut: Omit<SignedReleaseCut, "signature">): Buffer;
|
|
117
|
+
/** A release status change's fields its signature covers (#5163), and the signature. */
|
|
118
|
+
export interface SignedReleaseStatus extends SignedReleaseCut {
|
|
119
|
+
/** The status set: `deprecated`, `yanked` or `active`. */
|
|
120
|
+
status: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The bytes a release status change's signature signs (#5163): the cut's
|
|
124
|
+
* four lines, then `status:<status>`, so it is never the bytes of a cut and
|
|
125
|
+
* one can't stand in for the other in the shared `chant-release` namespace.
|
|
126
|
+
*/
|
|
127
|
+
export declare function releaseStatusSealPayload(s: Omit<SignedReleaseStatus, "signature">): Buffer;
|
|
128
|
+
/**
|
|
129
|
+
* Why a status change of a release may not be made under the `release`
|
|
130
|
+
* gate's rule, or null when it may (#5163): the same rule as a cut, so whoever
|
|
131
|
+
* may cut may deprecate, yank or restore, and no one else.
|
|
132
|
+
*/
|
|
133
|
+
export declare function admitReleaseStatus(rule: GateAdmissionRule, s: SignedReleaseStatus): string | null;
|
|
85
134
|
/**
|
|
86
135
|
* Why `cut` may not be made under the `release` gate's rule, or null when
|
|
87
136
|
* it may (#4031): its signature verifies for its actor against the signers
|
|
@@ -97,6 +146,13 @@ export interface ReleaseSignatureCheck {
|
|
|
97
146
|
/** The fingerprint of the key in the signature, or null for an unsigned cut or one that can't be read. */
|
|
98
147
|
key: string | null;
|
|
99
148
|
reason: string;
|
|
149
|
+
/**
|
|
150
|
+
* Whether the green-gate record on the cut line is covered by a signature
|
|
151
|
+
* that verifies (#5177): `signed` for a verified version 2 signature,
|
|
152
|
+
* `unsigned` otherwise, including a verified version 1 signature, made
|
|
153
|
+
* before chant signed the gate.
|
|
154
|
+
*/
|
|
155
|
+
gate: "signed" | "unsigned";
|
|
100
156
|
}
|
|
101
157
|
/** Judge a stored cut's signature against `rule`, read at base. A rule with no class checks the signature alone. */
|
|
102
158
|
export declare function checkReleaseSignature(rule: GateAdmissionRule, cut: SignedReleaseCut): ReleaseSignatureCheck;
|
|
@@ -71,26 +71,95 @@ export const RELEASE_GATE = "release";
|
|
|
71
71
|
/** The ssh signature namespace of a release cut's signature (#4031), so no other signature can stand in for one. */
|
|
72
72
|
export const RELEASE_SEAL_NAMESPACE = "chant-release";
|
|
73
73
|
/**
|
|
74
|
-
* The
|
|
75
|
-
*
|
|
76
|
-
*
|
|
74
|
+
* The version of the payload a new cut's signature signs (#5177). Version 1
|
|
75
|
+
* (#4031) is four lines; version 2 adds the green-gate record. A cut line
|
|
76
|
+
* written with version 2 says so in `sealVersion`; a line without it was
|
|
77
|
+
* signed over version 1.
|
|
78
|
+
*/
|
|
79
|
+
export const RELEASE_CUT_SEAL_VERSION = 2;
|
|
80
|
+
/**
|
|
81
|
+
* The bytes a release cut's signature signs under version 1 (#4031): the
|
|
82
|
+
* release digest, the label (empty for none), the actor who cut it and the
|
|
83
|
+
* cut's time, joined by LF with no final newline.
|
|
77
84
|
*/
|
|
78
85
|
export function releaseSealPayload(cut) {
|
|
79
86
|
return Buffer.from(`${cut.releaseDigest}\n${cut.label ?? ""}\n${cut.actor}\n${cut.timestamp}`, "utf-8");
|
|
80
87
|
}
|
|
88
|
+
/** `v` as JSON with every object's keys sorted, so the same record gives the same bytes. */
|
|
89
|
+
function canonicalJson(v) {
|
|
90
|
+
if (Array.isArray(v))
|
|
91
|
+
return `[${v.map(canonicalJson).join(",")}]`;
|
|
92
|
+
if (v !== null && typeof v === "object") {
|
|
93
|
+
const o = v;
|
|
94
|
+
return `{${Object.keys(o)
|
|
95
|
+
.filter((k) => o[k] !== undefined)
|
|
96
|
+
.sort()
|
|
97
|
+
.map((k) => `${JSON.stringify(k)}:${canonicalJson(o[k])}`)
|
|
98
|
+
.join(",")}}`;
|
|
99
|
+
}
|
|
100
|
+
return JSON.stringify(v);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The green-gate record a version 2 cut signature covers (#5177): the cut
|
|
104
|
+
* line's `green`, `override` and `lane`, those it holds, as sorted JSON.
|
|
105
|
+
* `{}` for a cut that records none of them.
|
|
106
|
+
*/
|
|
107
|
+
export function releaseCutGateRecord(cut) {
|
|
108
|
+
return canonicalJson({ green: cut.green, override: cut.override, lane: cut.lane });
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The bytes a version 2 cut signature signs (#5177): the four lines of
|
|
112
|
+
* version 1, then `seal:2` and `gate:<record>`. The release digest stays the
|
|
113
|
+
* digest of the release file, so two cuts of one commit still share it, and
|
|
114
|
+
* the gate each cut claims is under its own signature. The `seal:2` line keeps
|
|
115
|
+
* the bytes apart from a version 1 cut's and from a status change's
|
|
116
|
+
* (`status:<status>`) in the shared `chant-release` namespace.
|
|
117
|
+
*/
|
|
118
|
+
export function releaseGateSealPayload(cut) {
|
|
119
|
+
return Buffer.concat([releaseSealPayload(cut), Buffer.from(`\nseal:2\ngate:${releaseCutGateRecord(cut)}`, "utf-8")]);
|
|
120
|
+
}
|
|
121
|
+
/** The bytes the cut's signature signs, by the version its line names: version 2 with `sealVersion: 2`, else version 1. */
|
|
122
|
+
export function releaseCutSealPayload(cut) {
|
|
123
|
+
return cut.sealVersion === 2 ? releaseGateSealPayload(cut) : releaseSealPayload(cut);
|
|
124
|
+
}
|
|
81
125
|
/** Why the cut's signature does not verify for its actor against the signers at base, or null when it does. */
|
|
82
|
-
function releaseSignatureRefusal(signers, cut) {
|
|
126
|
+
function releaseSignatureRefusal(signers, cut, payload = releaseCutSealPayload(cut), what = "cut") {
|
|
83
127
|
if (cut.signature === null)
|
|
84
|
-
return `the
|
|
128
|
+
return `the ${what} by ${cut.actor} is not signed`;
|
|
129
|
+
// The payloads are LF-joined lines; a field holding a newline could make one kind's bytes another's.
|
|
130
|
+
if ([cut.releaseDigest, cut.label ?? "", cut.actor, cut.timestamp].some((f) => f.includes("\n")))
|
|
131
|
+
return `the ${what} by ${cut.actor} has a signed field with a line break, so its signature can't count`;
|
|
85
132
|
if (!signers.active)
|
|
86
|
-
return `there is no signers file (${signers.signersPath}) at base to check the
|
|
133
|
+
return `there is no signers file (${signers.signersPath}) at base to check the ${what}'s signature against`;
|
|
87
134
|
const where = `${signers.signersPath} at base`;
|
|
88
135
|
const listed = signers.signers.filter((s) => normalise(s.principal) === normalise(cut.actor));
|
|
89
136
|
if (listed.length === 0)
|
|
90
|
-
return `${cut.actor} has no key in ${where}, so the
|
|
137
|
+
return `${cut.actor} has no key in ${where}, so the ${what}'s signature can't count`;
|
|
91
138
|
const keys = listed.filter((s) => namespaceAllowed(s.namespaces, RELEASE_SEAL_NAMESPACE)).map((s) => Buffer.from(s.key.split(" ")[1] ?? "", "base64"));
|
|
92
|
-
const r = verifySshSignatureWith(cut.signature,
|
|
93
|
-
return r.ok ? null : `the
|
|
139
|
+
const r = verifySshSignatureWith(cut.signature, payload, RELEASE_SEAL_NAMESPACE, keys);
|
|
140
|
+
return r.ok ? null : `the ${what}'s signature does not verify for ${cut.actor} against ${where}: ${r.reason}`;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The bytes a release status change's signature signs (#5163): the cut's
|
|
144
|
+
* four lines, then `status:<status>`, so it is never the bytes of a cut and
|
|
145
|
+
* one can't stand in for the other in the shared `chant-release` namespace.
|
|
146
|
+
*/
|
|
147
|
+
export function releaseStatusSealPayload(s) {
|
|
148
|
+
return Buffer.concat([releaseSealPayload(s), Buffer.from(`\nstatus:${s.status}`, "utf-8")]);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Why a status change of a release may not be made under the `release`
|
|
152
|
+
* gate's rule, or null when it may (#5163): the same rule as a cut, so whoever
|
|
153
|
+
* may cut may deprecate, yank or restore, and no one else.
|
|
154
|
+
*/
|
|
155
|
+
export function admitReleaseStatus(rule, s) {
|
|
156
|
+
const unknown = unknownClassRefusal(rule, "status change");
|
|
157
|
+
if (unknown !== null)
|
|
158
|
+
return unknown;
|
|
159
|
+
const seal = releaseSignatureRefusal(rule.signers, s, releaseStatusSealPayload(s), "status change");
|
|
160
|
+
if (seal !== null)
|
|
161
|
+
return `${seal}; identity.gates.${rule.gate} needs a status change signed with --sign`;
|
|
162
|
+
return classRefusal(rule, s.actor);
|
|
94
163
|
}
|
|
95
164
|
/**
|
|
96
165
|
* Why `cut` may not be made under the `release` gate's rule, or null when
|
|
@@ -111,13 +180,13 @@ export function admitReleaseCut(rule, cut) {
|
|
|
111
180
|
/** Judge a stored cut's signature against `rule`, read at base. A rule with no class checks the signature alone. */
|
|
112
181
|
export function checkReleaseSignature(rule, cut) {
|
|
113
182
|
if (cut.signature === null)
|
|
114
|
-
return { status: "unsigned", key: null, reason: "the cut carries no signature" };
|
|
183
|
+
return { status: "unsigned", key: null, reason: "the cut carries no signature", gate: "unsigned" };
|
|
115
184
|
const blob = sshSignatureKey(cut.signature);
|
|
116
185
|
const key = blob ? sshKeyFingerprint(blob) : null;
|
|
117
186
|
const why = unknownClassRefusal(rule, "cut") ?? releaseSignatureRefusal(rule.signers, cut) ?? classRefusal(rule, cut.actor);
|
|
118
187
|
if (why !== null)
|
|
119
|
-
return { status: "unverified", key, reason: why };
|
|
120
|
-
return { status: "verified", key, reason: `signed by ${cut.actor}${rule.class !== null ? `, in the class ${rule.class}` : ""}
|
|
188
|
+
return { status: "unverified", key, reason: why, gate: "unsigned" };
|
|
189
|
+
return { status: "verified", key, reason: `signed by ${cut.actor}${rule.class !== null ? `, in the class ${rule.class}` : ""}`, gate: cut.sealVersion === 2 ? "signed" : "unsigned" };
|
|
121
190
|
}
|
|
122
191
|
/** The seal step, worded as `checkGateSeal` (`./trust/seal.ts`) words it against an active signers file at base. */
|
|
123
192
|
function sealRefusal(gate, signers, a) {
|
|
@@ -66,7 +66,8 @@ export declare function memberPipelineDir(provider: string): string | undefined;
|
|
|
66
66
|
/**
|
|
67
67
|
* The default path of a member's component pipeline for one environment,
|
|
68
68
|
* relative to the repository root: `chant-<member>-<env>.yml` in the forge's
|
|
69
|
-
* workflow directory,
|
|
69
|
+
* workflow directory, `.gitlab/ci/chant-<member>-<env>.gitlab-ci.yml`, or
|
|
70
|
+
* Prow's `prow/chant-<member>-<env>.yaml` (#5189).
|
|
70
71
|
* A pull-request pipeline (`kind` `"pr"`, #3465) is `chant-pr.<member>.<env>`, with the dots the apply group uses so no
|
|
71
72
|
* two member and environment pairs share one name, and it sits beside the
|
|
72
73
|
* member's deploy pipeline for the same environment.
|
|
@@ -90,6 +90,8 @@ const PIPELINE_DIRS = {
|
|
|
90
90
|
forgejo: ".forgejo/workflows",
|
|
91
91
|
// GitLab reads only .gitlab-ci.yml, which includes these (`include: local: .gitlab/ci/*.gitlab-ci.yml`).
|
|
92
92
|
gitlab: ".gitlab/ci",
|
|
93
|
+
// #5189: a Prow job config, which the installation's job_config_path names.
|
|
94
|
+
prow: "prow",
|
|
93
95
|
};
|
|
94
96
|
/** The directory a forge's generated files go in for a member, relative to the repository root, or undefined for a forge chant doesn't know. */
|
|
95
97
|
export function memberPipelineDir(provider) {
|
|
@@ -98,7 +100,8 @@ export function memberPipelineDir(provider) {
|
|
|
98
100
|
/**
|
|
99
101
|
* The default path of a member's component pipeline for one environment,
|
|
100
102
|
* relative to the repository root: `chant-<member>-<env>.yml` in the forge's
|
|
101
|
-
* workflow directory,
|
|
103
|
+
* workflow directory, `.gitlab/ci/chant-<member>-<env>.gitlab-ci.yml`, or
|
|
104
|
+
* Prow's `prow/chant-<member>-<env>.yaml` (#5189).
|
|
102
105
|
* A pull-request pipeline (`kind` `"pr"`, #3465) is `chant-pr.<member>.<env>`, with the dots the apply group uses so no
|
|
103
106
|
* two member and environment pairs share one name, and it sits beside the
|
|
104
107
|
* member's deploy pipeline for the same environment.
|
|
@@ -108,7 +111,7 @@ export function memberPipelineFile(provider, member, env, kind = "components") {
|
|
|
108
111
|
if (dir === undefined)
|
|
109
112
|
return undefined;
|
|
110
113
|
const stem = kind === "pr" ? `chant-pr.${member}.${env}` : `chant-${member}-${env}`;
|
|
111
|
-
return `${dir}/${stem}${provider === "gitlab" ? ".gitlab-ci.yml" : ".yml"}`;
|
|
114
|
+
return `${dir}/${stem}${provider === "gitlab" ? ".gitlab-ci.yml" : provider === "prow" ? ".yaml" : ".yml"}`;
|
|
112
115
|
}
|
|
113
116
|
/** A repository-relative path for an absolute one. */
|
|
114
117
|
export function repoRelative(ctx, absolute) {
|
|
@@ -320,6 +320,12 @@ export declare const REASONS: {
|
|
|
320
320
|
readonly "ref-update-invalid": "The hook's standard input is not the lines git hands a pre-receive or pre-push hook.";
|
|
321
321
|
readonly "ref-evidence-missing": "No runner evidence for a check the policy at base requires for the ref is attached to the pushed commit.";
|
|
322
322
|
readonly "ref-evidence-stale": "Evidence for a required check verifies, but a record it names changed after it was signed, or it names no records and was signed over another tree.";
|
|
323
|
+
readonly "bump-invalid": "--bump-member is not <member>=major|minor|patch, or names a member the declaration does not have.";
|
|
324
|
+
readonly "paths-changed": "The member has paths changed since its last release, after changes.ignore and generated files, or has no release yet.";
|
|
325
|
+
readonly "needed-by": "A member of the release depends on this one, and this one has changes since its last release.";
|
|
326
|
+
readonly "range-broken-by": "The range this member last published for a dependency does not admit that dependency's next label.";
|
|
327
|
+
readonly "intent-pending": "An intent file under .chant/release names the member, and no cut of it consumed the file (#5159).";
|
|
328
|
+
readonly "intent-invalid": "An intent file under .chant/release can't be read: its front matter is not lines of <member>: major|minor|patch, or names a member the declaration does not have (#5159).";
|
|
323
329
|
readonly "lock-invalid": "The lineage lock can't be read.";
|
|
324
330
|
readonly "manual-step-open": "A scope in the lineage lock has an open manual step.";
|
|
325
331
|
readonly "missing-dir": "The chant member's directory does not exist, so there is nothing to build.";
|
|
@@ -300,7 +300,7 @@ export const REASONS = {
|
|
|
300
300
|
"work-item-closed": "A claim on a work item in a closed state, such as done or dropped: there is no work left to claim.",
|
|
301
301
|
// Evidence attached to a criterion under the run's work lease (#2772): why it was refused. Nothing is written.
|
|
302
302
|
"work-criterion-unknown": "The work record lists no acceptance criterion with the id the evidence names, or its kind has no acceptance criteria.",
|
|
303
|
-
// The work lease: why a claim, renew or release was refused (exit
|
|
303
|
+
// The work lease: why a claim, renew or release was refused (exit 5 when held or raced, 1 when not held or the token is stale).
|
|
304
304
|
"lease-held": "Someone holds a live lease on the work item: another worker, or, for a claim, the same one.",
|
|
305
305
|
"lease-not-held": "Nobody holds a live lease on the work item: it expired, was released or was never claimed.",
|
|
306
306
|
"lease-token-mismatch": "The live lease on the work item carries another fencing token than the one given.",
|
|
@@ -383,6 +383,13 @@ export const REASONS = {
|
|
|
383
383
|
"ref-update-invalid": "The hook's standard input is not the lines git hands a pre-receive or pre-push hook.",
|
|
384
384
|
"ref-evidence-missing": "No runner evidence for a check the policy at base requires for the ref is attached to the pushed commit.",
|
|
385
385
|
"ref-evidence-stale": "Evidence for a required check verifies, but a record it names changed after it was signed, or it names no records and was signed over another tree.",
|
|
386
|
+
// The release-changed read (release changed, #5134): why the read stopped, and why a member is in the release.
|
|
387
|
+
"bump-invalid": "--bump-member is not <member>=major|minor|patch, or names a member the declaration does not have.",
|
|
388
|
+
"paths-changed": "The member has paths changed since its last release, after changes.ignore and generated files, or has no release yet.",
|
|
389
|
+
"needed-by": "A member of the release depends on this one, and this one has changes since its last release.",
|
|
390
|
+
"range-broken-by": "The range this member last published for a dependency does not admit that dependency's next label.",
|
|
391
|
+
"intent-pending": "An intent file under .chant/release names the member, and no cut of it consumed the file (#5159).",
|
|
392
|
+
"intent-invalid": "An intent file under .chant/release can't be read: its front matter is not lines of <member>: major|minor|patch, or names a member the declaration does not have (#5159).",
|
|
386
393
|
// The lineage lock (check).
|
|
387
394
|
"lock-invalid": "The lineage lock can't be read.",
|
|
388
395
|
"manual-step-open": "A scope in the lineage lock has an open manual step.",
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `release-changed` read (#5134, design #5132 decisions 3 and 4): the
|
|
3
|
+
* members of a workspace whose members release separately, that a release at
|
|
4
|
+
* one commit has to cut, in the order to publish them.
|
|
5
|
+
*
|
|
6
|
+
* `chant release changed [--at <sha>] [--bump-member <member>=<level>]... [--json]`
|
|
7
|
+
* prints this document. It runs in the root of the workspace whose `chant`
|
|
8
|
+
* members are the releasable units (the nested `release/` workspace of a
|
|
9
|
+
* repository that publishes many packages), reads local refs and tags only,
|
|
10
|
+
* and never fetches.
|
|
11
|
+
*
|
|
12
|
+
* For each `chant` member it finds the commit of its last release: the newest
|
|
13
|
+
* cut in the member's ledger, else the newest legacy tag, one of the
|
|
14
|
+
* `release.legacyTags` prefixes of the root's `chant.config.ts` or the
|
|
15
|
+
* member's own followed by a version (`release/npm/0.124.44`,
|
|
16
|
+
* `chant-v0.124.44`). It then lists the
|
|
17
|
+
* paths changed from there to the commit, takes the outer member that holds
|
|
18
|
+
* each (`memberHolding`, the outermost workspace's members, one of which has
|
|
19
|
+
* the member's own name), and drops the paths `changes.ignore` matches and
|
|
20
|
+
* the generated files. A member with paths left, or with no release yet, is
|
|
21
|
+
* `changed`.
|
|
22
|
+
*
|
|
23
|
+
* The closure then runs to a fixed point:
|
|
24
|
+
*
|
|
25
|
+
* - upward: a member of the release also releases each workspace dependency
|
|
26
|
+
* of it, direct or transitive, that is `changed` (`needed-by <member>`; a
|
|
27
|
+
* changed member no other member needs keeps `paths-changed`).
|
|
28
|
+
* Dependencies are the `dependencies`, `peerDependencies` and
|
|
29
|
+
* `optionalDependencies` of the member's package.json at the commit, as
|
|
30
|
+
* `publish_layers` reads them.
|
|
31
|
+
* - downward: a dependent the release does not already take is added when
|
|
32
|
+
* the range its last release's package.json gives a dependency does not
|
|
33
|
+
* admit that dependency's next label (`range-broken-by <member>`). The next
|
|
34
|
+
* label is the last label bumped by `--bump-member` (default patch).
|
|
35
|
+
*
|
|
36
|
+
* Members come in dependency layers, each layer sorted by name.
|
|
37
|
+
*/
|
|
38
|
+
export declare const RELEASE_CHANGED_CONTRACT_VERSION = 1;
|
|
39
|
+
export declare const RELEASE_CHANGED_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/release-changed/v1/release-changed.schema.json";
|
|
40
|
+
/** Why the read stopped. Closed; each code is in `reason-codes.ts`. */
|
|
41
|
+
export declare const RELEASE_CHANGED_ERROR_CODES: readonly ["not-a-git-repository", "declaration-missing", "revision-unknown", "bump-invalid", "ledger-unreadable", "intent-invalid"];
|
|
42
|
+
/** Why a member is in the release. Closed; each code is in `reason-codes.ts`. */
|
|
43
|
+
export declare const RELEASE_CHANGED_REASON_CODES: readonly ["paths-changed", "needed-by", "range-broken-by", "intent-pending"];
|
|
44
|
+
export declare const RELEASE_BUMPS: readonly ["major", "minor", "patch"];
|
|
45
|
+
export type ReleaseBump = (typeof RELEASE_BUMPS)[number];
|
|
46
|
+
export interface ReleaseChangedReason {
|
|
47
|
+
code: (typeof RELEASE_CHANGED_REASON_CODES)[number];
|
|
48
|
+
/** The member that needs this one (`needed-by`) or whose next label breaks its range (`range-broken-by`); null for `changed`. */
|
|
49
|
+
member: string | null;
|
|
50
|
+
}
|
|
51
|
+
export interface LastRelease {
|
|
52
|
+
/** The label of the release, or null when its cut has none. */
|
|
53
|
+
label: string | null;
|
|
54
|
+
/** The full sha it was cut from. */
|
|
55
|
+
commit: string;
|
|
56
|
+
/** `ledger` for a cut in the member's ledger, `legacy` for a legacy tag. */
|
|
57
|
+
source: "ledger" | "legacy";
|
|
58
|
+
}
|
|
59
|
+
export interface ReleaseChangedMember {
|
|
60
|
+
member: string;
|
|
61
|
+
/** The dependency layer, 0 for the members that need no other member of the release. Members of one layer publish together. */
|
|
62
|
+
layer: number;
|
|
63
|
+
reason: ReleaseChangedReason;
|
|
64
|
+
/** The member's last release, or null when it has none. */
|
|
65
|
+
last: LastRelease | null;
|
|
66
|
+
/** The bump applied to `last.label`. */
|
|
67
|
+
bump: ReleaseBump;
|
|
68
|
+
/**
|
|
69
|
+
* Where the bump came from (#5159): `flag` for `--bump-member`, `commits`
|
|
70
|
+
* or `intents` for the higher of the conventional commits over `paths`
|
|
71
|
+
* since the last release and the pending intent files (`commits` when
|
|
72
|
+
* they tie), `default` for a patch when neither gives one.
|
|
73
|
+
*/
|
|
74
|
+
bumpFrom: "flag" | "commits" | "intents" | "default";
|
|
75
|
+
/** The intent files under `.chant/release/` that name the member and that no cut of it consumed (#5159), by path. */
|
|
76
|
+
intents: string[];
|
|
77
|
+
/** The label a release of it would carry, or null when there is no last label to bump. */
|
|
78
|
+
next: string | null;
|
|
79
|
+
/** The changed paths that count, from the outermost workspace root. Empty for a member taken only by the closure. */
|
|
80
|
+
paths: string[];
|
|
81
|
+
}
|
|
82
|
+
export type ReleaseChangedDocument = {
|
|
83
|
+
$schema: string;
|
|
84
|
+
contract: number;
|
|
85
|
+
chant: string;
|
|
86
|
+
/** The full sha the read was made at. */
|
|
87
|
+
at: string;
|
|
88
|
+
/** In publish order: layer, then name. */
|
|
89
|
+
members: ReleaseChangedMember[];
|
|
90
|
+
} | {
|
|
91
|
+
$schema: string;
|
|
92
|
+
contract: number;
|
|
93
|
+
chant: string;
|
|
94
|
+
error: {
|
|
95
|
+
code: (typeof RELEASE_CHANGED_ERROR_CODES)[number];
|
|
96
|
+
message: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export interface ReleaseChangedQuery {
|
|
100
|
+
cwd: string;
|
|
101
|
+
/** The commit to read at; the tip of the trunk without it. */
|
|
102
|
+
at?: string;
|
|
103
|
+
/** `<member>=<level>` bumps; a member with none gets a patch. */
|
|
104
|
+
bump?: string[];
|
|
105
|
+
}
|
|
106
|
+
type Version = [number, number, number];
|
|
107
|
+
/** `1.2.3` (a leading `v` allowed) as numbers, or null. */
|
|
108
|
+
export declare function parseVersion(text: string): Version | null;
|
|
109
|
+
/** The label `bump` makes of `label`, or null when `label` is not a version. */
|
|
110
|
+
export declare function bumpLabel(label: string, bump: ReleaseBump): string | null;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the npm range `range` admits `label`. A range chant does not read
|
|
113
|
+
* (`workspace:*`, a URL, a tag) admits everything: it forces no release.
|
|
114
|
+
*/
|
|
115
|
+
export declare function rangeAdmits(range: string, label: string): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* The directory whose commits count for the member at `memberDir` (#5159):
|
|
118
|
+
* as `release changed` maps paths, the directory of the outermost
|
|
119
|
+
* workspace's member of the same name when there is one (a release member
|
|
120
|
+
* under `release/<name>` releases the package at `packages/<name>`), else
|
|
121
|
+
* the member's own directory.
|
|
122
|
+
*/
|
|
123
|
+
export declare function memberSourcePath(memberDir: string): string;
|
|
124
|
+
/**
|
|
125
|
+
* A shape the version tags of earlier releases take: the literal before and
|
|
126
|
+
* after the version. A `release.legacyTags` prefix is a shape with no
|
|
127
|
+
* suffix; a `release.tag` template gives one through `tagShape`, with
|
|
128
|
+
* `render`, the tag a label gets, so a match is confirmed by rendering it
|
|
129
|
+
* back (#5200).
|
|
130
|
+
*/
|
|
131
|
+
export interface VersionTagShape {
|
|
132
|
+
prefix: string;
|
|
133
|
+
suffix: string;
|
|
134
|
+
render?: (label: string) => string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The newest tag of `shapes` that names a version, as a release, or null.
|
|
138
|
+
* The version between prefix and suffix holds no `/`: `release/npm/core/0.125.0`
|
|
139
|
+
* is a member's tag, not one of the prefix `release/`. The label drops a
|
|
140
|
+
* leading `v`, unless the shape's `render` only gives the tag back with it.
|
|
141
|
+
* With `at`, only a tag on that commit or an ancestor of it counts; with
|
|
142
|
+
* `stable`, only a version with no prerelease part; with `skip`, no
|
|
143
|
+
* version it lists (written without a leading `v`).
|
|
144
|
+
*/
|
|
145
|
+
export declare function tagHistoryRelease(top: string, shapes: readonly VersionTagShape[], opts?: {
|
|
146
|
+
at?: string;
|
|
147
|
+
stable?: boolean;
|
|
148
|
+
skip?: readonly string[];
|
|
149
|
+
}): (LastRelease & {
|
|
150
|
+
tag: string;
|
|
151
|
+
}) | null;
|
|
152
|
+
/** The `release` settings of the `chant.config.ts` (or `.json`) in `dir` that pick a next label; empty when it has none or can't be read. */
|
|
153
|
+
export declare function releaseSettingsAt(dir: string): Promise<{
|
|
154
|
+
legacyTags: string[];
|
|
155
|
+
breakingOnZero?: "minor" | "major";
|
|
156
|
+
}>;
|
|
157
|
+
/**
|
|
158
|
+
* The settings for the member at `memberDir` (#5200, #5191): its own
|
|
159
|
+
* `release.legacyTags` with those of the workspace root it sits in, and its
|
|
160
|
+
* own `release.breakingOnZero`, else the root's. A project with no
|
|
161
|
+
* workspace reads its own config alone.
|
|
162
|
+
*/
|
|
163
|
+
export declare function memberReleaseSettings(memberDir: string, root?: {
|
|
164
|
+
dir: string;
|
|
165
|
+
settings: Awaited<ReturnType<typeof releaseSettingsAt>>;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
legacyTags: string[];
|
|
168
|
+
breakingOnZero: "minor" | "major";
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* The bump a commit gives on the version `label` (#5191): on 0.x, unless
|
|
172
|
+
* `breakingOnZero` is `major`, a breaking change bumps minor and a feature
|
|
173
|
+
* patch, since a 0.x project moves to 1.0.0 by choice (an intent file or a
|
|
174
|
+
* typed level of `major`). Any other version, or a null bump, is as given.
|
|
175
|
+
*/
|
|
176
|
+
export declare function zeroShift(bump: ReleaseBump | null, label: string | null, breakingOnZero: "minor" | "major"): ReleaseBump | null;
|
|
177
|
+
/** Read what a release at a commit of the workspace at `query.cwd` has to cut. */
|
|
178
|
+
export declare function releaseChangedDocument(query: ReleaseChangedQuery): Promise<ReleaseChangedDocument>;
|
|
179
|
+
export {};
|