@intentius/chant 0.124.70 → 0.124.72

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.
Files changed (169) hide show
  1. package/dist/ci-agent.d.ts +12 -1
  2. package/dist/ci-agent.d.ts.map +1 -1
  3. package/dist/ci-agent.js +13 -8
  4. package/dist/ci-commit.d.ts +326 -0
  5. package/dist/ci-commit.d.ts.map +1 -0
  6. package/dist/ci-commit.js +725 -0
  7. package/dist/ci-estate/delivery.d.ts +75 -2
  8. package/dist/ci-estate/delivery.d.ts.map +1 -1
  9. package/dist/ci-estate/delivery.js +129 -0
  10. package/dist/ci-estate.d.ts +3 -1
  11. package/dist/ci-estate.d.ts.map +1 -1
  12. package/dist/ci-estate.js +4 -1
  13. package/dist/ci-product-words.d.ts +6 -1
  14. package/dist/ci-product-words.d.ts.map +1 -1
  15. package/dist/ci-product-words.js +3 -1
  16. package/dist/ci-product.d.ts +1 -1
  17. package/dist/ci-product.d.ts.map +1 -1
  18. package/dist/ci-product.js +1 -1
  19. package/dist/cli/handlers/approve.d.ts.map +1 -1
  20. package/dist/cli/handlers/approve.js +7 -2
  21. package/dist/cli/handlers/commit.d.ts +26 -0
  22. package/dist/cli/handlers/commit.d.ts.map +1 -0
  23. package/dist/cli/handlers/commit.js +145 -0
  24. package/dist/cli/handlers/notify-relay.d.ts.map +1 -1
  25. package/dist/cli/handlers/notify-relay.js +22 -2
  26. package/dist/cli/handlers/pr.d.ts +6 -0
  27. package/dist/cli/handlers/pr.d.ts.map +1 -1
  28. package/dist/cli/handlers/pr.js +16 -7
  29. package/dist/cli/handlers/release.d.ts +9 -0
  30. package/dist/cli/handlers/release.d.ts.map +1 -1
  31. package/dist/cli/handlers/release.js +114 -5
  32. package/dist/cli/main.d.ts.map +1 -1
  33. package/dist/cli/main.js +17 -0
  34. package/dist/components/product-pipeline.d.ts +33 -0
  35. package/dist/components/product-pipeline.d.ts.map +1 -1
  36. package/dist/components/product-pipeline.js +34 -1
  37. package/dist/components/release-compile.d.ts +2 -0
  38. package/dist/components/release-compile.d.ts.map +1 -1
  39. package/dist/components/release-compile.js +8 -4
  40. package/dist/config.d.ts +60 -0
  41. package/dist/config.d.ts.map +1 -1
  42. package/dist/config.js +16 -0
  43. package/dist/lexicon.d.ts +54 -0
  44. package/dist/lexicon.d.ts.map +1 -1
  45. package/dist/lexicon.js +28 -0
  46. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +4 -0
  47. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
  48. package/dist/lifecycle/__fixtures__/publish-fakes.js +6 -2
  49. package/dist/lifecycle/gated-request.d.ts +3 -1
  50. package/dist/lifecycle/gated-request.d.ts.map +1 -1
  51. package/dist/lifecycle/gated-request.js +5 -2
  52. package/dist/lifecycle/git.d.ts.map +1 -1
  53. package/dist/lifecycle/git.js +57 -0
  54. package/dist/lifecycle/publish-declaration.d.ts +16 -0
  55. package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
  56. package/dist/lifecycle/publish-declaration.js +35 -3
  57. package/dist/lifecycle/publish-forge.d.ts +12 -0
  58. package/dist/lifecycle/publish-forge.d.ts.map +1 -1
  59. package/dist/lifecycle/publish-forge.js +102 -19
  60. package/dist/lifecycle/publish-npm.d.ts +15 -0
  61. package/dist/lifecycle/publish-npm.d.ts.map +1 -1
  62. package/dist/lifecycle/publish-npm.js +28 -1
  63. package/dist/lifecycle/publish-oci.d.ts +2 -0
  64. package/dist/lifecycle/publish-oci.d.ts.map +1 -1
  65. package/dist/lifecycle/publish-oci.js +10 -0
  66. package/dist/lifecycle/release-cut.d.ts +7 -1
  67. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  68. package/dist/lifecycle/release-cut.js +8 -1
  69. package/dist/lifecycle/release-images.d.ts +87 -0
  70. package/dist/lifecycle/release-images.d.ts.map +1 -0
  71. package/dist/lifecycle/release-images.js +138 -0
  72. package/dist/lifecycle/release-publish.d.ts +2 -0
  73. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  74. package/dist/notify-relay.d.ts +41 -1
  75. package/dist/notify-relay.d.ts.map +1 -1
  76. package/dist/notify-relay.js +40 -0
  77. package/dist/notify.d.ts +16 -3
  78. package/dist/notify.d.ts.map +1 -1
  79. package/dist/notify.js +16 -10
  80. package/dist/op/activities/review-agent.d.ts.map +1 -1
  81. package/dist/op/activities/review-agent.js +4 -2
  82. package/dist/op/gate.d.ts +5 -1
  83. package/dist/op/gate.d.ts.map +1 -1
  84. package/dist/op/gate.js +7 -2
  85. package/dist/op/op-waves-notify.d.ts +1 -1
  86. package/dist/op/op-waves-notify.d.ts.map +1 -1
  87. package/dist/op/op-waves-notify.js +2 -1
  88. package/dist/op/op-waves-run.d.ts.map +1 -1
  89. package/dist/op/op-waves-run.js +12 -8
  90. package/dist/op/op-waves.d.ts +9 -0
  91. package/dist/op/op-waves.d.ts.map +1 -1
  92. package/dist/op/op-waves.js +11 -0
  93. package/dist/pr-forge-base.d.ts +18 -0
  94. package/dist/pr-forge-base.d.ts.map +1 -0
  95. package/dist/pr-forge-base.js +29 -0
  96. package/dist/release-floors.d.ts +1 -1
  97. package/dist/release-floors.js +1 -1
  98. package/dist/wave-runtime.mjs +315 -315
  99. package/dist/workspace/ci-green.d.ts.map +1 -1
  100. package/dist/workspace/ci-green.js +1 -2
  101. package/dist/workspace/release-workflow.d.ts +47 -0
  102. package/dist/workspace/release-workflow.d.ts.map +1 -1
  103. package/dist/workspace/release-workflow.js +258 -14
  104. package/package.json +1 -1
  105. package/src/ci-agent.ts +13 -8
  106. package/src/ci-commit.test.ts +415 -0
  107. package/src/ci-commit.ts +901 -0
  108. package/src/ci-estate/__fixtures__/terragucci-dora.json +1305 -0
  109. package/src/ci-estate/delivery.ts +186 -2
  110. package/src/ci-estate/records-delivery.test.ts +55 -0
  111. package/src/ci-estate.ts +10 -0
  112. package/src/ci-product-words.ts +6 -2
  113. package/src/ci-product.ts +1 -0
  114. package/src/cli/handlers/approve.ts +6 -2
  115. package/src/cli/handlers/commit.ts +155 -0
  116. package/src/cli/handlers/notify-relay.ts +21 -2
  117. package/src/cli/handlers/operator.test.ts +2 -0
  118. package/src/cli/handlers/pr-wave-approve-lines.test.ts +32 -0
  119. package/src/cli/handlers/pr.ts +17 -7
  120. package/src/cli/handlers/release.ts +110 -5
  121. package/src/cli/main.ts +17 -0
  122. package/src/components/product-pipeline.test.ts +28 -1
  123. package/src/components/product-pipeline.ts +54 -1
  124. package/src/components/release-compile.ts +9 -3
  125. package/src/config.ts +31 -0
  126. package/src/lexicon.ts +72 -0
  127. package/src/lifecycle/__fixtures__/publish-fakes.ts +11 -5
  128. package/src/lifecycle/gated-request-spend.test.ts +115 -0
  129. package/src/lifecycle/gated-request.ts +5 -2
  130. package/src/lifecycle/git.ts +53 -0
  131. package/src/lifecycle/ledger-two-clones.test.ts +132 -0
  132. package/src/lifecycle/publish-declaration.ts +35 -3
  133. package/src/lifecycle/publish-forge-notes.test.ts +193 -0
  134. package/src/lifecycle/publish-forge.ts +100 -22
  135. package/src/lifecycle/publish-npm.ts +31 -2
  136. package/src/lifecycle/publish-oci.ts +10 -0
  137. package/src/lifecycle/publish-targets.test.ts +2 -1
  138. package/src/lifecycle/release-cut.ts +17 -1
  139. package/src/lifecycle/release-images.test.ts +242 -0
  140. package/src/lifecycle/release-images.ts +174 -0
  141. package/src/lifecycle/release-publish.ts +2 -0
  142. package/src/notify-relay.test.ts +55 -1
  143. package/src/notify-relay.ts +49 -1
  144. package/src/notify.ts +25 -12
  145. package/src/op/activities/review-agent.test.ts +20 -1
  146. package/src/op/activities/review-agent.ts +5 -2
  147. package/src/op/gate.ts +7 -2
  148. package/src/op/op-waves-approve-target.test.ts +108 -0
  149. package/src/op/op-waves-notify.ts +2 -2
  150. package/src/op/op-waves-run.ts +12 -7
  151. package/src/op/op-waves.ts +12 -0
  152. package/src/pr-forge-base.test.ts +37 -0
  153. package/src/pr-forge-base.ts +36 -0
  154. package/src/release-floors.ts +1 -1
  155. package/src/workspace/__fixtures__/release-workflow/forgejo-plain-member.yml +26 -0
  156. package/src/workspace/__fixtures__/release-workflow/forgejo-plain.yml +23 -0
  157. package/src/workspace/__fixtures__/release-workflow/forgejo-secure-member.yml +27 -0
  158. package/src/workspace/__fixtures__/release-workflow/forgejo-secure.yml +24 -0
  159. package/src/workspace/__fixtures__/release-workflow/github-plain-member.yml +26 -0
  160. package/src/workspace/__fixtures__/release-workflow/github-plain.yml +23 -0
  161. package/src/workspace/__fixtures__/release-workflow/github-secure-member.yml +27 -0
  162. package/src/workspace/__fixtures__/release-workflow/github-secure.yml +24 -0
  163. package/src/workspace/__fixtures__/release-workflow/gitlab-plain-member.yml +13 -0
  164. package/src/workspace/__fixtures__/release-workflow/gitlab-plain.yml +12 -0
  165. package/src/workspace/__fixtures__/release-workflow/gitlab-secure-member.yml +14 -0
  166. package/src/workspace/__fixtures__/release-workflow/gitlab-secure.yml +13 -0
  167. package/src/workspace/ci-green.ts +1 -2
  168. package/src/workspace/release-workflow.test.ts +199 -0
  169. package/src/workspace/release-workflow.ts +356 -14
@@ -200,6 +200,11 @@ export async function writeLedgerFiles(files, commitMessage, opts) {
200
200
  if ((await getStateBranchTip(cwd)) === null) {
201
201
  await requireLifecycleLedger({ ...(cwd ? { cwd } : {}) });
202
202
  }
203
+ // #4637: start from the remote's records this checkout already fetched. A
204
+ // caller that read a tip (`expectTip`) keeps it, and a run that records
205
+ // nothing leaves the branch alone.
206
+ if (opts?.expectTip === undefined && !ledgerRecordingOff())
207
+ await catchUpLifecycle(cwd);
203
208
  // 2-5. Read the trees, build the commit, and CAS-update the branch ref —
204
209
  // retried on a conflict (#1959 finding 1). Before that retry existed a
205
210
  // conflict from step 5's `updateRefCAS` simply threw, breaking every caller
@@ -621,6 +626,45 @@ export async function getRemoteLifecycleBranchSha(remote, opts) {
621
626
  return null;
622
627
  return result.stdout.trim() || null;
623
628
  }
629
+ /** Whether `ancestor` is in `descendant`'s history. */
630
+ async function isAncestor(ancestor, descendant, cwd) {
631
+ const rt = getRuntime();
632
+ return (await rt.spawn(["git", "merge-base", "--is-ancestor", ancestor, descendant], { cwd, env: C_LOCALE_ENV })).exitCode === 0;
633
+ }
634
+ /**
635
+ * Fast-forward the local `chant/lifecycle` to the ledger remote's tip this
636
+ * checkout has already fetched, when it is behind it (#4637). A plain
637
+ * `git fetch` in a full clone moves `refs/remotes/<remote>/chant/lifecycle`
638
+ * and leaves the branch, so a write built on the branch would sit beside the
639
+ * records made elsewhere instead of after them. Nothing is fetched here, and a
640
+ * branch with commits the remote lacks is left for the push to replay. The
641
+ * move is a compare-and-swap, so a writer that moved the branch meanwhile is
642
+ * never undone, and a checked-out `chant/lifecycle` is left alone.
643
+ */
644
+ async function catchUpLifecycle(cwd) {
645
+ const rt = getRuntime();
646
+ const found = await ledgerRemote(cwd);
647
+ if (found === null || "failed" in found)
648
+ return;
649
+ const fetched = await getRemoteLifecycleBranchSha(found.remote, { cwd });
650
+ if (!fetched)
651
+ return;
652
+ const local = await getStateBranchTip(cwd);
653
+ if (!local || local === fetched)
654
+ return;
655
+ if (!(await isAncestor(local, fetched, cwd)))
656
+ return;
657
+ const head = await rt.spawn(["git", "symbolic-ref", "-q", "HEAD"], { cwd, env: C_LOCALE_ENV });
658
+ if (head.exitCode === 0 && head.stdout.trim() === `refs/heads/${STATE_BRANCH}`)
659
+ return;
660
+ try {
661
+ await updateRefCAS(`refs/heads/${STATE_BRANCH}`, fetched, local, { cwd });
662
+ }
663
+ catch (err) {
664
+ if (!(err instanceof RefCASConflictError))
665
+ throw err;
666
+ }
667
+ }
624
668
  /**
625
669
  * Point `refs/remotes/<remote>/chant/lifecycle` at `sha`, the remote tip this
626
670
  * checkout has just seen (#3391).
@@ -664,6 +708,19 @@ export async function pushLifecycleStatus(opts) {
664
708
  const expected = await getRemoteLifecycleBranchSha(remote, opts);
665
709
  const lease = `refs/heads/${STATE_BRANCH}:${expected ?? ""}`;
666
710
  const tip = await getStateBranchTip(cwd);
711
+ // #4637: the lease only says the remote still holds `expected`. A plain
712
+ // `git fetch` moves that ref without moving the local branch, so a branch
713
+ // that does not contain it would pass the lease and push over every record
714
+ // made since (an approval from another clone). Refused as stale, so a
715
+ // rebasing caller replays its commits onto the remote's tip.
716
+ if (expected && tip && expected !== tip && !(await isAncestor(expected, tip, cwd))) {
717
+ return {
718
+ status: "stale",
719
+ remote,
720
+ expected,
721
+ stderr: `this checkout's ${STATE_BRANCH} does not contain ${expected.slice(0, 12)}, the tip it last fetched from "${remote}"; pushing it would drop the records made since`,
722
+ };
723
+ }
667
724
  const pushResult = await rt.spawn(["git", "push", `--force-with-lease=${lease}`, remote, `${STATE_BRANCH}:${STATE_BRANCH}`], { cwd, env: C_LOCALE_ENV });
668
725
  if (pushResult.exitCode !== 0) {
669
726
  const stderr = (pushResult.stderr ?? "").trim();
@@ -38,6 +38,7 @@ export declare const NpmPublishSchema: z.ZodObject<{
38
38
  sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
39
39
  stage: z.ZodOptional<z.ZodBoolean>;
40
40
  tokenEnv: z.ZodOptional<z.ZodString>;
41
+ pins: z.ZodOptional<z.ZodString>;
41
42
  registryWait: z.ZodOptional<z.ZodNumber>;
42
43
  }, z.core.$strict>;
43
44
  /** An OCI registry such as GHCR or Docker Hub: the image is pushed by digest, then tagged. */
@@ -61,6 +62,13 @@ export declare const ForgePublishSchema: z.ZodObject<{
61
62
  repo: z.ZodString;
62
63
  api: z.ZodOptional<z.ZodString>;
63
64
  assets: z.ZodArray<z.ZodString>;
65
+ notes: z.ZodOptional<z.ZodObject<{
66
+ file: z.ZodString;
67
+ heading: z.ZodString;
68
+ linkBase: z.ZodOptional<z.ZodString>;
69
+ before: z.ZodOptional<z.ZodString>;
70
+ after: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strict>>;
64
72
  tag: z.ZodOptional<z.ZodString>;
65
73
  tokenEnv: z.ZodOptional<z.ZodString>;
66
74
  sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
@@ -135,6 +143,7 @@ export declare const PublishDeclarationSchema: z.ZodDiscriminatedUnion<[z.ZodObj
135
143
  sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
136
144
  stage: z.ZodOptional<z.ZodBoolean>;
137
145
  tokenEnv: z.ZodOptional<z.ZodString>;
146
+ pins: z.ZodOptional<z.ZodString>;
138
147
  registryWait: z.ZodOptional<z.ZodNumber>;
139
148
  }, z.core.$strict>, z.ZodObject<{
140
149
  type: z.ZodLiteral<"oci">;
@@ -154,6 +163,13 @@ export declare const PublishDeclarationSchema: z.ZodDiscriminatedUnion<[z.ZodObj
154
163
  repo: z.ZodString;
155
164
  api: z.ZodOptional<z.ZodString>;
156
165
  assets: z.ZodArray<z.ZodString>;
166
+ notes: z.ZodOptional<z.ZodObject<{
167
+ file: z.ZodString;
168
+ heading: z.ZodString;
169
+ linkBase: z.ZodOptional<z.ZodString>;
170
+ before: z.ZodOptional<z.ZodString>;
171
+ after: z.ZodOptional<z.ZodString>;
172
+ }, z.core.$strict>>;
157
173
  tag: z.ZodOptional<z.ZodString>;
158
174
  tokenEnv: z.ZodOptional<z.ZodString>;
159
175
  sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"publish-declaration.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;kBAqClB,CAAC;AAEZ,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB;;;;;;;;kBAgBlB,CAAC;AAEZ,wFAAwF;AACxF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;kBAwBpB,CAAC;AAEZ;;;;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lB,CAAC;AAEZ,wFAAwF;AACxF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;kBAgD6G,CAAC;AAE7I;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;kBA0BvB,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;kBA4B1B,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;kBA4B3B,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAqK,CAAC;AAE3M,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC/E,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACrF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACvF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -65,6 +65,14 @@ export const NpmPublishSchema = z
65
65
  * registry accepts a publish before it serves it. Unset, the wait ends
66
66
  * only when every version is served or the registry fails (#4271).
67
67
  */
68
+ /**
69
+ * A file in the package, from its root, holding the image digests it pins
70
+ * (#4657), such as `dist/image-digests.json`. Every `sha256:` digest in it
71
+ * must be an image the release records, or the plan and `chant release
72
+ * verify` refuse the package. A package without the file is not checked,
73
+ * and a target none of whose packages has it is refused.
74
+ */
75
+ pins: z.string().min(1).optional(),
68
76
  registryWait: z.number().int().min(0).optional(),
69
77
  })
70
78
  .strict();
@@ -95,8 +103,31 @@ export const ForgePublishSchema = z
95
103
  repo: z.string().min(1),
96
104
  /** The API root: default `$GITHUB_API_URL` or `https://api.github.com` on GitHub, `$CI_API_V4_URL` or `https://gitlab.com/api/v4` on GitLab, `$GITHUB_API_URL` on Forgejo, which has no default. */
97
105
  api: z.string().url().optional(),
98
- /** Files to attach, relative to the member. */
99
- assets: z.array(z.string().min(1)).min(1),
106
+ /** Files to attach, relative to the member. May be empty when `notes` gives the release its body. */
107
+ assets: z.array(z.string().min(1)),
108
+ /**
109
+ * The release's notes (#4658): a section of a file in the member, sent as
110
+ * the release's body on GitHub and Forgejo and its description on GitLab.
111
+ */
112
+ notes: z
113
+ .object({
114
+ /** The file, relative to the member, such as `CHANGELOG.md` or a docs site's changes page. */
115
+ file: z.string().min(1),
116
+ /**
117
+ * The heading that starts the section, such as `## In {version}` or `## [{version}]`. `{label}`, `{version}`
118
+ * (the label from its first digit) and `{tag}` are filled in. The section runs to the next heading of the same
119
+ * level or higher.
120
+ */
121
+ heading: z.string().regex(/^#{1,6} \S/, "a markdown heading, such as ## {version}"),
122
+ /** Links that start with `/` are made absolute against this, such as `https://docs.example.com`. */
123
+ linkBase: z.string().url().optional(),
124
+ /** A paragraph before the section, with the same placeholders. */
125
+ before: z.string().min(1).optional(),
126
+ /** A paragraph after the section, with the same placeholders. */
127
+ after: z.string().min(1).optional(),
128
+ })
129
+ .strict()
130
+ .optional(),
100
131
  /** The forge release's tag. Default: the tag the cut made, `release/<label>` or `release/<member>/<label>`. */
101
132
  tag: z.string().min(1).optional(),
102
133
  /** The variable holding the token. Default `GITHUB_TOKEN`, `GITLAB_TOKEN` (then `CI_JOB_TOKEN`), or `FORGEJO_TOKEN`. */
@@ -111,7 +142,8 @@ export const ForgePublishSchema = z
111
142
  */
112
143
  latest: z.union([z.boolean(), z.literal("legacy")]).optional(),
113
144
  })
114
- .strict();
145
+ .strict()
146
+ .refine((d) => d.assets.length > 0 || d.notes !== undefined, { message: "a forge release needs assets, notes or both", path: ["assets"] });
115
147
  /**
116
148
  * A Homebrew formula in a tap repository on GitHub (#4676), rendered from a
117
149
  * template in the member with the release's version and each asset's URL and
@@ -47,6 +47,18 @@ import type { ForgePublishDeclaration } from "./publish-declaration.js";
47
47
  import { type PublishDeps, type PublishTarget } from "./release-publish.js";
48
48
  /** The first chant that reads `latest` on a forge target and sends it as GitHub's `make_latest` (#4676). */
49
49
  export declare const PUBLISH_FORGE_LATEST_FLOOR = "0.124.63";
50
+ /** The first chant whose forge target reads `notes` and may have no assets (#4658). Products feature-detect on it. */
51
+ export declare const PUBLISH_FORGE_NOTES_FLOOR = "0.124.71";
52
+ /**
53
+ * The section of `page` that starts at the heading `heading` names (#4658),
54
+ * up to the next heading of the same level or higher, trimmed. A heading
55
+ * matches when it is the pattern, or the pattern and then whitespace, so
56
+ * `## [1.2.3] - 2026-11-07` matches `## [1.2.3]`, and neither `## 1.2.30`
57
+ * nor `## 1.2.3-rc.1` matches `## 1.2.3`. Links that start with `/` are
58
+ * made absolute against `linkBase`. Throws when there is no such heading or
59
+ * the section is empty.
60
+ */
61
+ export declare function releaseNotesSection(page: string, heading: string, linkBase?: string): string;
50
62
  /** The variables a forge's token is read from, in order. */
51
63
  export declare function forgeTokenEnv(decl: Pick<ForgePublishDeclaration, "forge" | "tokenEnv">): string[];
52
64
  /** The API root a forge is reached at. */
@@ -1 +1 @@
1
- {"version":3,"file":"publish-forge.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAMH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,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AAC,GAAG,MAAM,EAAE,CAKjG;AAED,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,GAAG,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,GAAG,IAAI,CAGpH;AA8ID,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,WAAW,GAAG,aAAa,CAqJ3F"}
@@ -46,11 +46,60 @@
46
46
  import { readFileSync } from "node:fs";
47
47
  import { basename } from "node:path";
48
48
  import { memberSbom, releaseProvenance } from "./publish-attachments.js";
49
+ import { releaseVersion } from "./publish-homebrew.js";
49
50
  import { readCredential } from "./publish-credentials.js";
50
51
  import { bytesDigest, checkReleaseDigest, memberFile, publishTargetKey } from "./publish-targets.js";
51
52
  import { PublishTargetError } from "./release-publish.js";
52
53
  /** The first chant that reads `latest` on a forge target and sends it as GitHub's `make_latest` (#4676). */
53
54
  export const PUBLISH_FORGE_LATEST_FLOOR = "0.124.63";
55
+ /** The first chant whose forge target reads `notes` and may have no assets (#4658). Products feature-detect on it. */
56
+ export const PUBLISH_FORGE_NOTES_FLOOR = "0.124.71";
57
+ /** `text` with `{label}`, `{version}` and `{tag}` filled in. */
58
+ function fillNotesText(text, values) {
59
+ return text.replaceAll("{label}", values.label).replaceAll("{version}", values.version).replaceAll("{tag}", values.tag);
60
+ }
61
+ /**
62
+ * The section of `page` that starts at the heading `heading` names (#4658),
63
+ * up to the next heading of the same level or higher, trimmed. A heading
64
+ * matches when it is the pattern, or the pattern and then whitespace, so
65
+ * `## [1.2.3] - 2026-11-07` matches `## [1.2.3]`, and neither `## 1.2.30`
66
+ * nor `## 1.2.3-rc.1` matches `## 1.2.3`. Links that start with `/` are
67
+ * made absolute against `linkBase`. Throws when there is no such heading or
68
+ * the section is empty.
69
+ */
70
+ export function releaseNotesSection(page, heading, linkBase) {
71
+ const level = /^(#+)/.exec(heading)[1].length;
72
+ const lines = page.split("\n");
73
+ const matches = (l) => {
74
+ const t = l.trimEnd();
75
+ return t === heading || (t.startsWith(heading) && /^\s/.test(t.slice(heading.length)));
76
+ };
77
+ const start = lines.findIndex(matches);
78
+ if (start < 0)
79
+ throw new Error(`it has no heading "${heading}"`);
80
+ // A `#` line inside a fenced code block is code, not a heading.
81
+ let end = lines.length;
82
+ let fence = null;
83
+ for (let i = start + 1; i < lines.length; i++) {
84
+ const f = /^\s*(```|~~~)/.exec(lines[i]);
85
+ if (f)
86
+ fence = fence === null ? f[1] : fence === f[1] ? null : fence;
87
+ if (fence !== null || f)
88
+ continue;
89
+ const m = /^(#{1,6}) /.exec(lines[i]);
90
+ if (m && m[1].length <= level) {
91
+ end = i;
92
+ break;
93
+ }
94
+ }
95
+ const body = lines.slice(start + 1, end).join("\n").trim();
96
+ if (!body)
97
+ throw new Error(`its "${heading}" section is empty`);
98
+ if (!linkBase)
99
+ return body;
100
+ const base = linkBase.replace(/\/+$/, "");
101
+ return body.replace(/\]\((\/(?!\/)[^)\s]*)/g, (_, path) => `](${base}${path}`);
102
+ }
54
103
  /** The variables a forge's token is read from, in order. */
55
104
  export function forgeTokenEnv(decl) {
56
105
  if (decl.tokenEnv)
@@ -125,7 +174,7 @@ class ForgeClient {
125
174
  return this.toRelease(found.json, tag);
126
175
  }
127
176
  /** GitHub and Forgejo: the draft release for `tag`, made at `commit` when there is none. */
128
- async draft(tag, commit, name) {
177
+ async draft(tag, commit, name, body) {
129
178
  const list = await this.call("GET", `${this.repoPath}/releases?per_page=100`);
130
179
  if (list.status !== 200)
131
180
  this.fail("listing releases", list.status, list.text);
@@ -136,22 +185,31 @@ class ForgeClient {
136
185
  return this.toRelease(mine, tag);
137
186
  }
138
187
  this.ctx.log(`creating a draft ${this.decl.forge} release for ${tag} at ${commit.slice(0, 12)}`);
139
- const create = await this.call("POST", `${this.repoPath}/releases`, JSON.stringify({ tag_name: tag, target_commitish: commit, name, draft: true }));
188
+ const create = await this.call("POST", `${this.repoPath}/releases`, JSON.stringify({ tag_name: tag, target_commitish: commit, name, draft: true, ...(body !== undefined ? { body } : {}) }));
140
189
  if (create.status !== 201 || !create.json)
141
190
  this.fail(`creating a draft release ${tag}`, create.status, create.text);
142
191
  return this.toRelease(create.json, tag);
143
192
  }
144
- /** GitHub and Forgejo: publish the draft `id`, with GitHub's `make_latest` when `latest` is declared. */
145
- async publishDraft(id, tag) {
146
- const latest = this.decl.latest;
147
- const body = latest === undefined ? { draft: false } : { draft: false, make_latest: String(latest) };
193
+ /**
194
+ * GitHub and Forgejo: publish the draft `id` with its notes. GitHub gets
195
+ * `make_latest`: the declared `latest`, else `false` for a release cut to a
196
+ * channel and `true` for any other (#4658). Forgejo has no such setting and
197
+ * takes the newest release that is not a prerelease, so a channel's release
198
+ * is marked a prerelease there.
199
+ */
200
+ async publishDraft(id, tag, o) {
201
+ const body = { draft: false, ...(o.notes !== undefined ? { body: o.notes } : {}) };
202
+ if (this.decl.forge === "github")
203
+ body.make_latest = String(this.decl.latest ?? !o.channel);
204
+ else if (o.channel)
205
+ body.prerelease = true;
148
206
  const res = await this.call("PATCH", `${this.repoPath}/releases/${id}`, JSON.stringify(body));
149
207
  if (res.status !== 200)
150
208
  this.fail(`publishing the draft release ${tag}`, res.status, res.text);
151
209
  }
152
210
  /** GitLab: create the release for `tag` at `commit` with a link to each asset. */
153
- async createWithLinks(tag, commit, name, links) {
154
- const res = await this.call("POST", `${this.repoPath}/releases`, JSON.stringify({ tag_name: tag, ref: commit, name, assets: { links: links.map((l) => ({ ...l, link_type: "package" })) } }));
211
+ async createWithLinks(tag, commit, name, links, notes) {
212
+ const res = await this.call("POST", `${this.repoPath}/releases`, JSON.stringify({ tag_name: tag, ref: commit, name, ...(notes !== undefined ? { description: notes } : {}), assets: { links: links.map((l) => ({ ...l, link_type: "package" })) } }));
155
213
  if (res.status !== 201)
156
214
  this.fail(`creating release ${tag}`, res.status, res.text);
157
215
  }
@@ -210,9 +268,11 @@ export function forgeTarget(decl, deps) {
210
268
  checkReleaseDigest(ctx.release, "asset", ctx.cwd, p, [digest]);
211
269
  return { path: p, name: basename(p), bytes, digest };
212
270
  });
213
- // #4049: the SBOM and the provenance statement over the assets go on the release with them.
271
+ // #4049: the SBOM and the provenance statement over the assets go on the release with them. A release of notes alone has no asset to state.
214
272
  const sbom = memberSbom(ctx, decl.sbom, `${decl.repo}@${tag}`, `the ${decl.forge} target`);
215
- const provenance = releaseProvenance(ctx, assets.map((a) => ({ name: a.name, digest: a.digest })));
273
+ const provenance = assets.length > 0
274
+ ? releaseProvenance(ctx, assets.map((a) => ({ name: a.name, digest: a.digest })))
275
+ : null;
216
276
  for (const a of [sbom, provenance])
217
277
  if (a)
218
278
  assets.push({ path: a.name, name: a.name, bytes: a.bytes, digest: a.digest, attachment: a.kind });
@@ -222,7 +282,25 @@ export function forgeTarget(decl, deps) {
222
282
  throw new PublishTargetError("publish-forge-asset-name-taken", `two assets are named ${a.name}, and a release holds one asset per name`);
223
283
  names.add(a.name);
224
284
  }
225
- return { tag, api, token, assets };
285
+ return { tag, api, token, assets, notes: releaseNotes(ctx, tag) };
286
+ };
287
+ // #4658: the notes are read when the target is planned, so a missing or empty section refuses before any target publishes.
288
+ const releaseNotes = (ctx, tag) => {
289
+ const n = decl.notes;
290
+ if (!n)
291
+ return undefined;
292
+ const label = ctx.label ?? tag;
293
+ const values = { label, version: releaseVersion(ctx.label) ?? label, tag };
294
+ const heading = fillNotesText(n.heading, values);
295
+ let section;
296
+ try {
297
+ section = releaseNotesSection(readFileSync(memberFile(ctx.cwd, n.file), "utf8"), heading, n.linkBase);
298
+ }
299
+ catch (err) {
300
+ const why = err.code === "ENOENT" ? "it does not exist" : err.message;
301
+ throw new PublishTargetError("publish-forge-notes-missing", `the ${decl.forge} release's notes come from ${n.file}, and ${why}`, `Write the "${heading}" section in ${n.file}, or change notes.heading.`);
302
+ }
303
+ return [...(n.before ? [fillNotesText(n.before, values), ""] : []), section, ...(n.after ? ["", fillNotesText(n.after, values)] : [])].join("\n") + "\n";
226
304
  };
227
305
  const att = (a) => (a.attachment ? { attachment: a.attachment } : {});
228
306
  const where = (tag, name) => `${decl.forge} ${decl.repo} release ${tag}, asset ${name}`;
@@ -234,11 +312,14 @@ export function forgeTarget(decl, deps) {
234
312
  credentialEnv: tokenNames,
235
313
  key: publishTargetKey(decl),
236
314
  async plan(ctx) {
237
- const { tag, assets } = setup(ctx);
238
- return assets.map((a) => ({ name: a.path, destination: where(tag, a.name), digest: a.digest, ...att(a) }));
315
+ const { tag, assets, notes } = setup(ctx);
316
+ return [
317
+ ...assets.map((a) => ({ name: a.path, destination: where(tag, a.name), digest: a.digest, ...att(a) })),
318
+ ...(notes !== undefined ? [{ name: decl.notes.file, destination: `${decl.forge} ${decl.repo} release ${tag}, notes`, notes }] : []),
319
+ ];
239
320
  },
240
321
  async stage(ctx) {
241
- const { tag, api, token, assets } = setup(ctx);
322
+ const { tag, api, token, assets, notes } = setup(ctx);
242
323
  ctx.log(`using the token from ${token.from}`);
243
324
  const client = new ForgeClient(decl, api, token, fetchImpl, ctx);
244
325
  const done = (items, state) => ({ target: this.name, destination: this.destination, items, state });
@@ -268,7 +349,7 @@ export function forgeTarget(decl, deps) {
268
349
  }
269
350
  return done(items, {});
270
351
  }
271
- const rel = await client.draft(tag, ctx.release.commit, ctx.label ?? tag);
352
+ const rel = await client.draft(tag, ctx.release.commit, ctx.label ?? tag, notes);
272
353
  const items = [];
273
354
  for (const a of assets) {
274
355
  if (rel.assets.has(a.name)) {
@@ -285,21 +366,23 @@ export function forgeTarget(decl, deps) {
285
366
  return done(items, { releaseId: rel.id });
286
367
  },
287
368
  async reveal(ctx, staged) {
288
- const { tag, api, token } = setup(ctx);
369
+ const { tag, api, token, notes } = setup(ctx);
289
370
  const client = new ForgeClient(decl, api, token, fetchImpl, ctx);
290
371
  const items = staged.items.map((i) => ({ name: i.name, destination: i.destination, ...(i.digest ? { digest: i.digest } : {}), ...(i.attachment ? { attachment: i.attachment } : {}) }));
291
372
  if (staged.state.published === "true")
292
373
  return { target: this.name, destination: this.destination, items: items.map((i) => ({ ...i, present: true })) };
293
374
  if (decl.forge === "gitlab") {
294
375
  ctx.log(`creating the gitlab release ${tag} at ${ctx.release.commit.slice(0, 12)} with ${items.length} asset link(s)`);
295
- await client.createWithLinks(tag, ctx.release.commit, ctx.label ?? tag, items.map((i) => ({ name: basename(i.name), url: i.destination })));
376
+ await client.createWithLinks(tag, ctx.release.commit, ctx.label ?? tag, items.map((i) => ({ name: basename(i.name), url: i.destination })), notes);
296
377
  }
297
378
  else {
298
379
  const id = staged.state.releaseId;
299
380
  if (!id)
300
381
  throw new PublishTargetError("publish-forge-failed", `the staged ${decl.forge} release for ${tag} has no draft id to publish`);
301
- ctx.log(`publishing the draft ${decl.forge} release ${tag}${decl.latest === undefined ? "" : ` with make_latest ${String(decl.latest)}`}`);
302
- await client.publishDraft(id, tag);
382
+ const channel = ctx.tag !== null;
383
+ const latest = decl.forge === "github" ? ` with make_latest ${String(decl.latest ?? !channel)}` : channel ? " as a prerelease, since it was cut to a channel" : "";
384
+ ctx.log(`publishing the draft ${decl.forge} release ${tag}${notes !== undefined ? " with its notes" : ""}${latest}`);
385
+ await client.publishDraft(id, tag, { ...(notes !== undefined ? { notes } : {}), channel });
303
386
  }
304
387
  return { target: this.name, destination: this.destination, items };
305
388
  },
@@ -53,6 +53,15 @@
53
53
  */
54
54
  import type { NpmPublishDeclaration } from "./publish-declaration.js";
55
55
  import { type PublishContext, type PublishDeps, type PublishTarget } from "./release-publish.js";
56
+ export interface NpmPackage {
57
+ path: string;
58
+ abs: string;
59
+ name: string;
60
+ version: string;
61
+ digest?: string;
62
+ /** The SBOM file at its root, or undefined under `sbom: false`. */
63
+ sbom?: string;
64
+ }
56
65
  /** The arguments of one `npm publish`, which stages under `tag`. */
57
66
  export declare function npmPublishArgs(decl: Pick<NpmPublishDeclaration, "registry" | "access">, abs: string, ctx: Pick<PublishContext, "provenance">, tag?: string): string[];
58
67
  /** The arguments of the `npm dist-tag add` that reveals a staged version under `tag`. */
@@ -65,5 +74,11 @@ export declare function npmAuditSignaturesArgs(decl: Pick<NpmPublishDeclaration,
65
74
  export declare const NPM_REGISTRY_POLL_MS = 10000;
66
75
  /** Between progress lines while the reveal waits for the registry (#4271). */
67
76
  export declare const NPM_REGISTRY_PROGRESS_MS = 60000;
77
+ /**
78
+ * #4657: refuse a package whose `pins` file holds an image digest the release
79
+ * does not record, and a target none of whose packages has the file. Read
80
+ * by the plan, so nothing is published, and by `chant release verify`.
81
+ */
82
+ export declare function checkPackagePins(decl: Pick<NpmPublishDeclaration, "pins">, release: PublishContext["release"], pkgs: ReadonlyArray<Pick<NpmPackage, "path" | "abs" | "name">>): void;
68
83
  export declare function npmTarget(decl: NpmPublishDeclaration, deps: PublishDeps): PublishTarget;
69
84
  //# sourceMappingURL=publish-npm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"publish-npm.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-npm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAOH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAqC,KAAK,cAAc,EAAE,KAAK,WAAW,EAAoB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAoDnJ,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,GAAG,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,EAAE,CAUpL;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAA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,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,EAAE,CAUpL;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAElI;AAED,iIAAiI;AACjI,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,GAAG,MAAM,EAAE,CAE3F;AAED,+CAA+C;AAC/C,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,GAAG,MAAM,EAAE,CAE9F;AAuBD,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAM/C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC,GAAG,IAAI,CAiBpL;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,WAAW,GAAG,aAAa,CA2MvF"}
@@ -57,6 +57,7 @@ import { tmpdir } from "node:os";
57
57
  import { join } from "node:path";
58
58
  import { packageSbom } from "./publish-attachments.js";
59
59
  import { checkReleaseDigest, fileDigest, isDir, memberFile, publishTargetKey } from "./publish-targets.js";
60
+ import { readPins, unknownPins } from "./release-images.js";
60
61
  import { NPM_STAGE_TAG, PublishTargetError } from "./release-publish.js";
61
62
  /** npm's output when a publish could not authenticate, as publish-packages.sh matches it. */
62
63
  const NPM_AUTH_FAILED = /ENEEDAUTH|E401|need auth/;
@@ -156,6 +157,28 @@ export const NPM_REGISTRY_PROGRESS_MS = 60000;
156
157
  const NPM_VIEW_NOT_YET = /\bE404\b|\b404 Not Found\b|is not in (this|the npm) registry|No match found for version|\b(ETARGET|notarget)\b/;
157
158
  /** npm's errors for a version the registry does not serve yet. */
158
159
  const NPM_NOT_SERVED = /\b(ETARGET|ERESOLVE|notarget)\b|No matching version found/;
160
+ /**
161
+ * #4657: refuse a package whose `pins` file holds an image digest the release
162
+ * does not record, and a target none of whose packages has the file. Read
163
+ * by the plan, so nothing is published, and by `chant release verify`.
164
+ */
165
+ export function checkPackagePins(decl, release, pkgs) {
166
+ if (!decl.pins)
167
+ return;
168
+ let found = 0;
169
+ for (const pkg of pkgs) {
170
+ const text = readPins(pkg.abs, decl.pins, isDir(pkg.abs));
171
+ if (text === null)
172
+ continue;
173
+ found++;
174
+ const unknown = unknownPins(text, release);
175
+ if (unknown.length > 0) {
176
+ throw new PublishTargetError("publish-npm-pin-unknown", `${pkg.name} (${pkg.path}) pins ${unknown.join(", ")} in ${decl.pins}, which release ${release.releaseDigest} does not record as an image`, "Build the package from the digests the cut wrote (CHANT_RELEASE_DIGESTS, or chant release images <label>), or cut a new release.");
177
+ }
178
+ }
179
+ if (found === 0)
180
+ throw new PublishTargetError("publish-npm-pins-missing", `no package of the npm target holds ${decl.pins}, which pins names`, "Build the package so it carries the file, or remove pins.");
181
+ }
159
182
  export function npmTarget(decl, deps) {
160
183
  const bin = deps.npm ?? "npm";
161
184
  const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
@@ -210,7 +233,11 @@ export function npmTarget(decl, deps) {
210
233
  rmSync(dir, { recursive: true, force: true });
211
234
  }
212
235
  };
213
- const read = (ctx) => decl.packages.map((p) => readPackage(ctx, p, decl.sbom));
236
+ const read = (ctx) => {
237
+ const pkgs = decl.packages.map((p) => readPackage(ctx, p, decl.sbom));
238
+ checkPackagePins(decl, ctx.release, pkgs);
239
+ return pkgs;
240
+ };
214
241
  const extra = (pkg) => ({ ...(pkg.digest ? { digest: pkg.digest } : {}), ...(pkg.sbom ? { sbom: pkg.sbom } : {}) });
215
242
  const plan = async (ctx) => read(ctx).map((pkg) => ({ name: `${pkg.name}@${pkg.version}`, destination: staging ? `${shown(NPM_STAGE_TAG)}, then ${revealTag(ctx)}` : shown(revealTag(ctx)), ...extra(pkg) }));
216
243
  /**
@@ -60,5 +60,7 @@ export declare function referrerManifest(a: Attachment, subject: {
60
60
  }): Uint8Array;
61
61
  /** The tags to point at the digest: the context's tag when set, else the declared ones with `{label}` filled in. */
62
62
  export declare function ociTags(decl: OciPublishDeclaration, ctx: Pick<PublishContext, "tag" | "label">): string[];
63
+ /** The digest an OCI archive (a layout directory or a tar file of one) is pushed under: its top manifest's (#4657). */
64
+ export declare function ociArchiveDigest(abs: string): string;
63
65
  export declare function ociTarget(decl: OciPublishDeclaration, deps: PublishDeps): PublishTarget;
64
66
  //# sourceMappingURL=publish-oci.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"publish-oci.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-oci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAMH,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,WAAW,EAAuC,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvJ,kFAAkF;AAClF,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC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AAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAWxH;AAED,oHAAoH;AACpH,wBAAgB,OAAO,CAAC,IAAI,EAAE,qBAAqB,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,MAAM,EAAE,CAIzG;AAED,uHAAuH;AACvH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,WAAW,GAAG,aAAa,CAyGvF"}
@@ -266,6 +266,16 @@ export function ociTags(decl, ctx) {
266
266
  const declared = decl.tags ?? (ctx.label ? ["{label}"] : []);
267
267
  return declared.filter((t) => ctx.label !== null || !t.includes("{label}")).map((t) => t.split("{label}").join(ctx.label ?? ""));
268
268
  }
269
+ /** The digest an OCI archive (a layout directory or a tar file of one) is pushed under: its top manifest's (#4657). */
270
+ export function ociArchiveDigest(abs) {
271
+ const layout = readLayout(abs);
272
+ try {
273
+ return layout.top.digest;
274
+ }
275
+ finally {
276
+ layout.cleanup();
277
+ }
278
+ }
269
279
  export function ociTarget(decl, deps) {
270
280
  const repo = parseRepository(decl.repository);
271
281
  const fetchImpl = deps.fetch ?? ((url, init) => fetch(url, init));
@@ -66,7 +66,7 @@ export declare function greenOverrideSubject(commit: string): string;
66
66
  /** The rule an override of a cut names (#4693): `ci-green`, or `ci-green-<lane>` for a lane's tag. */
67
67
  export declare function greenOverrideRule(lane: string | null): string;
68
68
  /** The stable codes a cut refuses with. */
69
- export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked" | "release-worktree-dirty" | "release-no-environments" | "release-no-components" | "release-build-inputs-differ" | "release-image-invalid" | "release-image-unknown-component" | "release-unsigned" | "release-signer-refused" | "declaration-invalid";
69
+ export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked" | "release-worktree-dirty" | "release-no-environments" | "release-no-components" | "release-build-inputs-differ" | "release-image-invalid" | "release-image-unknown-component" | "release-image-name-taken" | "release-image-build-failed" | "release-unsigned" | "release-signer-refused" | "declaration-invalid";
70
70
  export declare class ReleaseCutError extends Error {
71
71
  readonly code: ReleaseCutCode;
72
72
  readonly fix?: string | undefined;
@@ -122,6 +122,12 @@ export interface CutRequest {
122
122
  * image, and the cut builds nothing for it.
123
123
  */
124
124
  images?: Readonly<Record<string, string>>;
125
+ /**
126
+ * Build the images `release.images` declares (#4657), before any
127
+ * environment is compiled, so the build command can read their digests.
128
+ * Given the commit being cut; returns each as an image artifact.
129
+ */
130
+ buildImages?: (commit: string) => Promise<ReleaseArtifact[]> | ReleaseArtifact[];
125
131
  }
126
132
  export interface CutResult {
127
133
  release: Release;
@@ -1 +1 @@
1
- {"version":3,"file":"release-cut.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-cut.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AASH,OAAO,EAUL,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAGnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpF,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,aAAa,CAAC;AACjD,4HAA4H;AAC5H,eAAO,MAAM,0BAA0B,aAAa,CAAC;AAErD,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,sGAAsG;AACtG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE7D;AAKD,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GACtB,sBAAsB,GACtB,0BAA0B,GAC1B,wBAAwB,G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G,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAyEpE"}
@@ -315,6 +315,8 @@ async function prepare(req, record = false) {
315
315
  if (envs.length === 0) {
316
316
  throw new ReleaseCutError("release-no-environments", "this member's chant.config.ts declares no environments, so there is nothing to compile a release for", "Declare them in promotion order: environments: [\"dev\", \"staging\", \"prod\"]");
317
317
  }
318
+ // #4657: the images first, so the build command that packs a package can pin their digests.
319
+ const builtImages = req.buildImages ? await req.buildImages(commit) : [];
318
320
  const compiled = [];
319
321
  for (const env of envs)
320
322
  compiled.push(await req.compiler.compile(env));
@@ -340,6 +342,11 @@ async function prepare(req, record = false) {
340
342
  handedArtifacts.push(artifact);
341
343
  }
342
344
  const handedTo = new Set(handedArtifacts.map((a) => a.component));
345
+ for (const image of builtImages) {
346
+ if (enabled.has(image.component) || handedTo.has(image.component)) {
347
+ throw new ReleaseCutError("release-image-name-taken", `release.images names "${image.component}", which is also a component of this member, and a release records one image per name`, "Rename the image in release.images.");
348
+ }
349
+ }
343
350
  // Which environment each component's artifacts are built in: the first one it is enabled in.
344
351
  const firstEnv = new Map();
345
352
  for (const t of compiled) {
@@ -351,7 +358,7 @@ async function prepare(req, record = false) {
351
358
  const realCwd = realpathSync(cwd);
352
359
  const previous = firstEnv.size > 0 ? await previousRelease(top, commit, cwd) : undefined;
353
360
  const reused = [];
354
- const artifacts = [...handedArtifacts];
361
+ const artifacts = [...handedArtifacts, ...builtImages];
355
362
  const toBuild = new Map();
356
363
  for (const [component, target] of firstEnv) {
357
364
  const prior = previous?.artifactDigests.filter((a) => a.component === component) ?? [];