@intentius/chant 0.124.78 → 0.124.79

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 (150) hide show
  1. package/dist/action-pins.d.ts.map +1 -1
  2. package/dist/action-pins.js +1 -2
  3. package/dist/change-set.d.ts +10 -1
  4. package/dist/change-set.d.ts.map +1 -1
  5. package/dist/change-set.js +4 -1
  6. package/dist/ci-agent.d.ts +16 -2
  7. package/dist/ci-agent.d.ts.map +1 -1
  8. package/dist/ci-agent.js +6 -1
  9. package/dist/ci-commit.d.ts.map +1 -1
  10. package/dist/ci-commit.js +2 -3
  11. package/dist/ci-product.d.ts +6 -2
  12. package/dist/ci-product.d.ts.map +1 -1
  13. package/dist/ci-product.js +5 -1
  14. package/dist/cli/handlers/release.d.ts +8 -0
  15. package/dist/cli/handlers/release.d.ts.map +1 -1
  16. package/dist/cli/handlers/release.js +64 -2
  17. package/dist/cli/handlers/run-wave.js +1 -0
  18. package/dist/cli/main.d.ts.map +1 -1
  19. package/dist/cli/main.js +7 -0
  20. package/dist/cli/mcp/product-tools.d.ts +6 -0
  21. package/dist/cli/mcp/product-tools.d.ts.map +1 -1
  22. package/dist/cli/mcp/product-tools.js +7 -0
  23. package/dist/cli/mcp/read-only.d.ts +12 -0
  24. package/dist/cli/mcp/read-only.d.ts.map +1 -1
  25. package/dist/cli/mcp/read-only.js +16 -0
  26. package/dist/cli/mcp/server.d.ts +11 -0
  27. package/dist/cli/mcp/server.d.ts.map +1 -1
  28. package/dist/cli/mcp/server.js +26 -5
  29. package/dist/cli/mcp/types.d.ts +5 -1
  30. package/dist/cli/mcp/types.d.ts.map +1 -1
  31. package/dist/components/capability.d.ts +42 -0
  32. package/dist/components/capability.d.ts.map +1 -1
  33. package/dist/components/group-digest.d.ts +17 -0
  34. package/dist/components/group-digest.d.ts.map +1 -0
  35. package/dist/components/group-digest.js +18 -0
  36. package/dist/components/groups.d.ts +2 -11
  37. package/dist/components/groups.d.ts.map +1 -1
  38. package/dist/components/groups.js +2 -12
  39. package/dist/components/index.d.ts +1 -1
  40. package/dist/components/index.d.ts.map +1 -1
  41. package/dist/config.d.ts +14 -0
  42. package/dist/config.d.ts.map +1 -1
  43. package/dist/config.js +5 -0
  44. package/dist/lexicon.d.ts.map +1 -1
  45. package/dist/lexicon.js +1 -2
  46. package/dist/lifecycle/release-cut.d.ts +7 -1
  47. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  48. package/dist/lifecycle/release-cut.js +1 -0
  49. package/dist/lifecycle/release-images.d.ts +12 -3
  50. package/dist/lifecycle/release-images.d.ts.map +1 -1
  51. package/dist/lifecycle/release-images.js +6 -7
  52. package/dist/lifecycle/release-publish.d.ts +8 -1
  53. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  54. package/dist/lifecycle/release-publish.js +30 -3
  55. package/dist/lifecycle/release-version.d.ts +86 -0
  56. package/dist/lifecycle/release-version.d.ts.map +1 -0
  57. package/dist/lifecycle/release-version.js +209 -0
  58. package/dist/mcp/types.d.ts +26 -0
  59. package/dist/mcp/types.d.ts.map +1 -1
  60. package/dist/notify-product.d.ts.map +1 -1
  61. package/dist/notify-product.js +1 -2
  62. package/dist/op/activities/review-product.d.ts.map +1 -1
  63. package/dist/op/activities/review-product.js +1 -2
  64. package/dist/op/gate.d.ts +17 -0
  65. package/dist/op/gate.d.ts.map +1 -1
  66. package/dist/op/gate.js +36 -0
  67. package/dist/op/index.d.ts +8 -6
  68. package/dist/op/index.d.ts.map +1 -1
  69. package/dist/op/index.js +5 -4
  70. package/dist/op/op-waves-after-plan.d.ts +76 -1
  71. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  72. package/dist/op/op-waves-after-plan.js +142 -3
  73. package/dist/op/op-waves-capability-spec.js +1 -2
  74. package/dist/op/op-waves-capability.d.ts +89 -2
  75. package/dist/op/op-waves-capability.d.ts.map +1 -1
  76. package/dist/op/op-waves-capability.js +215 -7
  77. package/dist/op/op-waves-run-hooks.d.ts +104 -0
  78. package/dist/op/op-waves-run-hooks.d.ts.map +1 -0
  79. package/dist/op/op-waves-run-hooks.js +146 -0
  80. package/dist/op/op-waves-run.d.ts +21 -0
  81. package/dist/op/op-waves-run.d.ts.map +1 -1
  82. package/dist/op/op-waves-run.js +233 -13
  83. package/dist/op/op-waves.d.ts +11 -1
  84. package/dist/op/op-waves.d.ts.map +1 -1
  85. package/dist/op/op-waves.js +7 -1
  86. package/dist/op/runtime.d.ts +2 -0
  87. package/dist/op/runtime.d.ts.map +1 -1
  88. package/dist/pr-plan-note.d.ts.map +1 -1
  89. package/dist/pr-plan-note.js +1 -2
  90. package/dist/release-floors.d.ts +5 -1
  91. package/dist/release-floors.d.ts.map +1 -1
  92. package/dist/release-floors.js +9 -5
  93. package/dist/wave-runtime.mjs +314 -314
  94. package/dist/workspace/change-set.schema.json +7 -0
  95. package/dist/workspace/release-workflow.d.ts +7 -0
  96. package/dist/workspace/release-workflow.d.ts.map +1 -1
  97. package/dist/workspace/release-workflow.js +11 -1
  98. package/package.json +1 -1
  99. package/src/action-pins.test.ts +1 -2
  100. package/src/action-pins.ts +1 -3
  101. package/src/change-set.test.ts +20 -0
  102. package/src/change-set.ts +11 -1
  103. package/src/ci-agent.test.ts +9 -0
  104. package/src/ci-agent.ts +15 -2
  105. package/src/ci-commit.test.ts +2 -3
  106. package/src/ci-commit.ts +2 -3
  107. package/src/ci-product.ts +6 -2
  108. package/src/cli/handlers/release.ts +55 -2
  109. package/src/cli/handlers/run-wave.ts +1 -0
  110. package/src/cli/main.ts +7 -0
  111. package/src/cli/mcp/product-tools.test.ts +50 -0
  112. package/src/cli/mcp/product-tools.ts +8 -0
  113. package/src/cli/mcp/read-only.ts +19 -0
  114. package/src/cli/mcp/server.test.ts +30 -0
  115. package/src/cli/mcp/server.ts +28 -5
  116. package/src/cli/mcp/types.ts +6 -1
  117. package/src/components/capability.ts +41 -0
  118. package/src/components/group-digest.ts +20 -0
  119. package/src/components/groups.ts +3 -13
  120. package/src/components/index.ts +2 -0
  121. package/src/config.ts +15 -0
  122. package/src/lexicon.ts +1 -2
  123. package/src/lifecycle/release-cut.ts +11 -0
  124. package/src/lifecycle/release-images-dockerfile.test.ts +10 -2
  125. package/src/lifecycle/release-images.ts +12 -8
  126. package/src/lifecycle/release-publish.ts +34 -3
  127. package/src/lifecycle/release-version.test.ts +155 -0
  128. package/src/lifecycle/release-version.ts +227 -0
  129. package/src/mcp/types.ts +27 -0
  130. package/src/notify-message-words.test.ts +1 -2
  131. package/src/notify-product.ts +1 -2
  132. package/src/op/activities/review-product.ts +1 -2
  133. package/src/op/gate.ts +46 -0
  134. package/src/op/index.ts +10 -4
  135. package/src/op/op-waves-after-plan-wave.test.ts +226 -0
  136. package/src/op/op-waves-after-plan.ts +170 -5
  137. package/src/op/op-waves-capability-spec.ts +1 -1
  138. package/src/op/op-waves-capability.test.ts +6 -0
  139. package/src/op/op-waves-capability.ts +243 -10
  140. package/src/op/op-waves-run-hooks.test.ts +184 -0
  141. package/src/op/op-waves-run-hooks.ts +195 -0
  142. package/src/op/op-waves-run.ts +240 -16
  143. package/src/op/op-waves-step-wave.test.ts +277 -0
  144. package/src/op/op-waves.ts +15 -2
  145. package/src/op/runtime.ts +2 -0
  146. package/src/pr-plan-note.ts +1 -2
  147. package/src/release-floors.ts +11 -5
  148. package/src/workspace/change-set.schema.json +7 -0
  149. package/src/workspace/release-workflow.test.ts +18 -0
  150. package/src/workspace/release-workflow.ts +21 -1
@@ -0,0 +1,227 @@
1
+ /**
2
+ * The release's label as the package version (#4840).
3
+ *
4
+ * A product released with `chant release cut <label>` used to set its
5
+ * version with a commit first, because the npm target publishes the
6
+ * package directory's `package.json`, the bundle imports the version from
7
+ * it, and `releaseImagePins` refuses a label that is not the version.
8
+ * `release.version` in `chant.config.ts` names the package directories
9
+ * whose `package.json` the release stamps with the label instead, and the
10
+ * lockfile whose entries for them follow:
11
+ *
12
+ * ```ts
13
+ * release: { version: { packages: ["packages/terragucci"] } },
14
+ * ```
15
+ *
16
+ * The cut stamps them after its clean-tree check and before it builds the
17
+ * images and runs the build, and puts the files back when it is done. The
18
+ * publish job runs `chant release stamp <label>` before its build, and
19
+ * `chant release publish` accepts a tree whose only changes are those files
20
+ * as the commit's own stamped with the release's label
21
+ * ({@link stampedChanges}). Only `version` changes: dependency ranges and
22
+ * every other field are left as committed. scripts/release-pack.sh does the
23
+ * same for chant itself, and more (the `@intentius/` ranges, the floors, the
24
+ * packing in dependency layers), so chant's own release keeps it.
25
+ *
26
+ * This module reaches only Node's built-ins and git.
27
+ */
28
+
29
+ import { execFileSync } from "node:child_process";
30
+ import { existsSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
31
+ import { isAbsolute, posix, relative, resolve } from "node:path";
32
+ import { NEXT_RELEASE } from "../release-floors";
33
+
34
+ /** The first chant with `release.version` and `chant release stamp` (#4840). Products feature-detect on it. */
35
+ export const RELEASE_VERSION_FLOOR = NEXT_RELEASE;
36
+
37
+ /** `release.version` in `chant.config.ts`. */
38
+ export interface ReleaseVersionConfig {
39
+ /** The package directories, relative to the member, whose `package.json` takes the label as its `version`: `"."` for the member's own. */
40
+ packages: string[];
41
+ /** The lockfile whose entries for those packages take it too. Default `package-lock.json` when the member has one; `false` for none. */
42
+ lockfile?: string | false;
43
+ }
44
+
45
+ export class ReleaseVersionError extends Error {
46
+ constructor(
47
+ readonly code: string,
48
+ message: string,
49
+ readonly fix?: string,
50
+ ) {
51
+ super(message);
52
+ this.name = "ReleaseVersionError";
53
+ }
54
+ }
55
+
56
+ /** A version npm takes: MAJOR.MINOR.PATCH with an optional prerelease and build. */
57
+ const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
58
+
59
+ /** Refuse a label `package.json` can't carry as its version. */
60
+ export function checkVersionLabel(label: string | null): asserts label is string {
61
+ if (label === null) {
62
+ throw new ReleaseVersionError("release-version-no-label", "release.version stamps the release's label into package.json, and this release has no label", "Cut it with a label: chant release cut <version>.");
63
+ }
64
+ if (!SEMVER.test(label)) {
65
+ throw new ReleaseVersionError(
66
+ "release-version-label-invalid",
67
+ `release.version stamps the label into package.json, and "${label}" is not a version npm takes`,
68
+ `Label the release MAJOR.MINOR.PATCH, such as ${SEMVER.test(label.replace(/^v/, "")) ? label.replace(/^v/, "") : "1.4.0"}${/^v\d/.test(label) ? ", with no v" : ""}.`,
69
+ );
70
+ }
71
+ }
72
+
73
+ const norm = (p: string): string => posix.normalize(p.split("\\").join("/")).replace(/\/$/, "") || ".";
74
+
75
+ const outside = (p: string): boolean => isAbsolute(p) || norm(p).split("/").includes("..");
76
+
77
+ /** Check the declaration's paths: at least one package, every path inside the member. */
78
+ export function checkReleaseVersion(config: ReleaseVersionConfig): void {
79
+ if (config.packages.length === 0) throw new ReleaseVersionError("release-version-invalid", "release.version.packages names no package directory");
80
+ for (const p of [...config.packages, ...(typeof config.lockfile === "string" ? [config.lockfile] : [])]) {
81
+ if (outside(p)) throw new ReleaseVersionError("release-version-invalid", `release.version: ${p} is not a path inside the member`);
82
+ }
83
+ }
84
+
85
+ /** The lockfile the declaration names, relative to the member, or null. */
86
+ function lockfileOf(cwd: string, config: ReleaseVersionConfig): string | null {
87
+ if (config.lockfile === false) return null;
88
+ if (typeof config.lockfile === "string") return norm(config.lockfile);
89
+ return existsSync(resolve(cwd, "package-lock.json")) ? "package-lock.json" : null;
90
+ }
91
+
92
+ /** The files the release stamps, relative to the member: each package's `package.json`, then the lockfile. */
93
+ export function releaseVersionFiles(cwd: string, config: ReleaseVersionConfig): string[] {
94
+ const files = config.packages.map((p) => (norm(p) === "." ? "package.json" : `${norm(p)}/package.json`));
95
+ const lock = lockfileOf(cwd, config);
96
+ return lock ? [...files, lock] : files;
97
+ }
98
+
99
+ /** The indent a JSON file was written with, so the stamped file differs from it in the version alone. */
100
+ function indentOf(text: string): string {
101
+ return /^\{\r?\n([ \t]+)"/.exec(text)?.[1] ?? " ";
102
+ }
103
+
104
+ function rewrite(text: string, edit: (doc: Record<string, unknown>) => void): string {
105
+ const doc = JSON.parse(text) as Record<string, unknown>;
106
+ edit(doc);
107
+ const out = JSON.stringify(doc, null, indentOf(text));
108
+ return text.endsWith("\n") ? `${out}\n` : out;
109
+ }
110
+
111
+ /**
112
+ * One file's text stamped with `label`: a `package.json`'s `version`, or a
113
+ * lockfile's entries for `packageDirs` (relative to the lockfile's
114
+ * directory), with the root entry's `version` beside it for `"."`. A
115
+ * lockfile entry that is not there is not added.
116
+ */
117
+ export function stampText(text: string, label: string, kind: "package" | "lockfile", packageDirs: readonly string[] = []): string {
118
+ if (kind === "package") {
119
+ return rewrite(text, (doc) => {
120
+ if (typeof doc.version !== "string") throw new ReleaseVersionError("release-version-no-package", "package.json has no version to stamp");
121
+ doc.version = label;
122
+ });
123
+ }
124
+ return rewrite(text, (doc) => {
125
+ const packages = (doc.packages ?? {}) as Record<string, { version?: unknown }>;
126
+ for (const dir of packageDirs) {
127
+ const key = dir === "." ? "" : dir;
128
+ const entry = packages[key];
129
+ if (entry && typeof entry === "object" && typeof entry.version === "string") entry.version = label;
130
+ if (key === "" && typeof doc.version === "string") doc.version = label;
131
+ }
132
+ });
133
+ }
134
+
135
+ /** Each stamped file's text, given its committed text. */
136
+ function stamper(cwd: string, config: ReleaseVersionConfig, label: string): (file: string, text: string) => string {
137
+ const lock = lockfileOf(cwd, config);
138
+ const lockDir = lock ? posix.dirname(lock) : ".";
139
+ const dirs = config.packages.map((p) => norm(posix.relative(lockDir, norm(p))) || ".");
140
+ return (file, text) => (file === lock ? stampText(text, label, "lockfile", dirs) : stampText(text, label, "package"));
141
+ }
142
+
143
+ export interface Stamped {
144
+ /** The files stamped, relative to the member. */
145
+ files: string[];
146
+ /** Put every stamped file back as it was. */
147
+ restore(): void;
148
+ }
149
+
150
+ /**
151
+ * Stamp the label into each file {@link releaseVersionFiles} names, and
152
+ * return how to put them back. Refuses a label that is not a version and a
153
+ * package directory with no `package.json`, before anything is written.
154
+ */
155
+ export function stampReleaseVersion(i: { cwd: string; config: ReleaseVersionConfig; label: string | null }): Stamped {
156
+ checkReleaseVersion(i.config);
157
+ checkVersionLabel(i.label);
158
+ const stamp = stamper(i.cwd, i.config, i.label);
159
+ const files = releaseVersionFiles(i.cwd, i.config);
160
+ const before = new Map<string, string>();
161
+ for (const f of files) {
162
+ const abs = resolve(i.cwd, f);
163
+ if (!existsSync(abs)) throw new ReleaseVersionError("release-version-no-package", `release.version names ${f}, which does not exist`, "Name the directory that holds the package.json, as the npm target does.");
164
+ before.set(f, readFileSync(abs, "utf-8"));
165
+ }
166
+ const after = new Map<string, string>();
167
+ for (const [f, text] of before) {
168
+ try {
169
+ after.set(f, stamp(f, text));
170
+ } catch (err) {
171
+ if (err instanceof ReleaseVersionError) throw new ReleaseVersionError(err.code, `${f}: ${err.message}`);
172
+ throw new ReleaseVersionError("release-version-invalid", `${f} is not JSON: ${(err as Error).message}`);
173
+ }
174
+ }
175
+ for (const [f, text] of after) writeFileSync(resolve(i.cwd, f), text);
176
+ let restored = false;
177
+ return {
178
+ files,
179
+ restore() {
180
+ if (restored) return;
181
+ restored = true;
182
+ for (const [f, text] of before) writeFileSync(resolve(i.cwd, f), text);
183
+ },
184
+ };
185
+ }
186
+
187
+ function gitShow(cwd: string, commit: string, file: string): string | null {
188
+ try {
189
+ return execFileSync("git", ["show", `${commit}:./${file}`], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 256 * 1024 * 1024 });
190
+ } catch {
191
+ return null;
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Of `git status --porcelain` lines, the paths (relative to the member)
197
+ * that are a stamped file whose text is exactly the commit's stamped with
198
+ * `label`. A publish takes those as the commit's (#4840); every other
199
+ * change still makes the tree dirty. `top` is the repository root the
200
+ * porcelain paths are relative to.
201
+ */
202
+ export function stampedChanges(i: { cwd: string; top: string; commit: string; config: ReleaseVersionConfig; label: string | null; status: string }): Set<string> {
203
+ const out = new Set<string>();
204
+ if (i.label === null || !SEMVER.test(i.label)) return out;
205
+ const stamp = stamper(i.cwd, i.config, i.label);
206
+ const files = new Set(releaseVersionFiles(i.cwd, i.config));
207
+ // git prints the top as its real path (macOS's /private/var for /var).
208
+ const cwd = realpathSync(i.cwd);
209
+ const top = realpathSync(i.top);
210
+ for (const line of i.status.split("\n")) {
211
+ // Only a modified tracked file, " M" or "M ", can be a stamp.
212
+ if (!/^(?: M|M |MM) /.test(line)) continue;
213
+ const path = line.slice(3);
214
+ const rel = relative(cwd, resolve(top, path)).split("\\").join("/");
215
+ if (!files.has(rel)) continue;
216
+ const committed = gitShow(i.cwd, i.commit, rel);
217
+ if (committed === null) continue;
218
+ let expected: string;
219
+ try {
220
+ expected = stamp(rel, committed);
221
+ } catch {
222
+ continue;
223
+ }
224
+ if (readFileSync(resolve(i.cwd, rel), "utf-8") === expected) out.add(path);
225
+ }
226
+ return out;
227
+ }
package/src/mcp/types.ts CHANGED
@@ -2,6 +2,24 @@
2
2
  * MCP contribution types for lexicon plugins.
3
3
  */
4
4
 
5
+ /**
6
+ * MCP's tool annotations (schema 2025-06-18 on), hints a client reads off
7
+ * `tools/list`. A client that gets none treats a tool as one that may change
8
+ * things and may destroy them.
9
+ */
10
+ export interface ToolAnnotations {
11
+ /** A human-readable title. */
12
+ title?: string;
13
+ /** The tool changes nothing. */
14
+ readOnlyHint?: boolean;
15
+ /** The tool may destroy what it changes, when not read-only. MCP's default is true. */
16
+ destructiveHint?: boolean;
17
+ /** Calling the tool again with the same arguments changes nothing more. */
18
+ idempotentHint?: boolean;
19
+ /** The tool reaches entities outside a closed domain, such as the web. */
20
+ openWorldHint?: boolean;
21
+ }
22
+
5
23
  export interface McpToolContribution {
6
24
  name: string;
7
25
  description: string;
@@ -27,6 +45,15 @@ export interface McpToolContribution {
27
45
  * serves it as any other tool. Lexicon tools do not use it.
28
46
  */
29
47
  forgeWrite?: true;
48
+ /**
49
+ * The tool's MCP annotations, listed in `tools/list` (chant#4823). chant
50
+ * sets `readOnlyHint` and `destructiveHint` from the declaration above,
51
+ * over what this says: `readOnly: true` lists `readOnlyHint: true,
52
+ * destructiveHint: false`, and `forgeWrite: true` lists `readOnlyHint:
53
+ * false, destructiveHint: false`. The other hints, and both on a tool that
54
+ * declares neither, are listed as given.
55
+ */
56
+ annotations?: ToolAnnotations;
30
57
  }
31
58
 
32
59
  export interface McpResourceContribution {
@@ -12,7 +12,6 @@ import { describe, expect, test } from "vitest";
12
12
  import { makeNotifyEvent, sendNotify, slackMessage, teamsMessage, type NotifyEvent, type NotifyFetch, type NotifyMessageWords } from "./notify";
13
13
  import { driftNotifyFields, NOTIFY_MESSAGE_WORDS_FLOOR, productSendOptions } from "./notify-product";
14
14
  import { assertProductWords } from "./ci-product-words";
15
- import { NEXT_RELEASE } from "./release-floors";
16
15
  import { NOTIFY_MESSAGE_EVENTS } from "./__fixtures__/notify-messages/events";
17
16
  import recorded from "./__fixtures__/notify-messages/messages.json";
18
17
  import * as tg from "./__fixtures__/terragucci-notify";
@@ -182,5 +181,5 @@ describe("chant's own words for the re-run button and the relay (#4818)", () =>
182
181
  expect(card.body[2]).toEqual({ type: "TextBlock", wrap: true, text: "Approve here: reply @chant-relay approve signed-ref. Decline: reply @chant-relay decline signed-ref." });
183
182
  });
184
183
 
185
- test("the floor names the next release", () => expect(NOTIFY_MESSAGE_WORDS_FLOOR).toBe(NEXT_RELEASE));
184
+ test("the floor names the next release", () => expect(NOTIFY_MESSAGE_WORDS_FLOOR).toBe("0.124.78"));
186
185
  });
@@ -14,7 +14,6 @@
14
14
 
15
15
  import { CHANT_WORDS, isChantWords, type CiProductNotifyWords, type CiProductWords } from "./ci-product-words";
16
16
  import type { NotifyFields, SendNotifyOptions } from "./notify";
17
- import { NEXT_RELEASE } from "./release-floors";
18
17
 
19
18
  /**
20
19
  * The first chant whose Slack and Teams messages take a product's words, a
@@ -22,7 +21,7 @@ import { NEXT_RELEASE } from "./release-floors";
22
21
  * the words, `message` in sendNotify's options, and the third argument of
23
22
  * `slackMessage` and `teamsMessage`.
24
23
  */
25
- export const NOTIFY_MESSAGE_WORDS_FLOOR = NEXT_RELEASE;
24
+ export const NOTIFY_MESSAGE_WORDS_FLOOR = "0.124.78";
26
25
 
27
26
  /** The notify slots of `words`, chant's when a caller built words before #4610. */
28
27
  export function productNotifyWords(words: CiProductWords): CiProductNotifyWords {
@@ -15,10 +15,9 @@
15
15
  */
16
16
 
17
17
  import { MAX_DIFF, quoted, REVIEW_RISKS, reviewResultMarker, riskOf, type ReviewRisk } from "./review-agent";
18
- import { NEXT_RELEASE } from "../../release-floors";
19
18
 
20
19
  /** The first chant whose review agent takes a product's words, data sections and job id (#4811). */
21
- export const REVIEW_PRODUCT_FLOOR = NEXT_RELEASE;
20
+ export const REVIEW_PRODUCT_FLOOR = "0.124.78";
22
21
 
23
22
  const MAX_BODY = 10_000;
24
23
  const MAX_REVIEW = 50_000;
package/src/op/gate.ts CHANGED
@@ -132,6 +132,14 @@ export interface GateLedgerPort {
132
132
  * keeps none.
133
133
  */
134
134
  storeRequestAttachment?(op: string, digest: string, text: string): Promise<void>;
135
+ /**
136
+ * Store a product's report of the plans a wave's pending fact asks approval
137
+ * for (#4842), at {@link opWaveGateReportPath}, once per digest, and push
138
+ * it. Absent on a port that keeps none.
139
+ */
140
+ storeGateReport?(op: string, gate: string, digest: string, text: string): Promise<void>;
141
+ /** The report stored for `digest` at `gate` (#4842), or null when none was. */
142
+ readGateReport?(op: string, gate: string, digest: string): Promise<string | null>;
135
143
  /**
136
144
  * Store the checkpoint of a run that stops at a gate that resumes (#3947),
137
145
  * at `_gates/<op>/checkpoints/<runId>.json`. Written before the pending
@@ -236,6 +244,18 @@ export function gitGateLedgerPort(opts?: { cwd?: string }): GateLedgerPort {
236
244
  await requireLifecycleLedger(opts);
237
245
  if ((await readPathSha(dir, file, opts)) === null) await writeBlobToPath(dir, file, text, `Request on ${op}: ${digest}`, opts);
238
246
  },
247
+ async storeGateReport(op, gate, digest, text) {
248
+ const { dir, file } = gateReportParts(op, gate, digest);
249
+ await requireLifecycleLedger(opts);
250
+ if ((await readPathSha(dir, file, opts)) !== null) return;
251
+ await writeBlobToPath(dir, file, text, `The plans of ${op} ${gate}: ${digest}`, opts);
252
+ await pushGateLine(opts);
253
+ },
254
+ async readGateReport(op, gate, digest) {
255
+ await requireLifecycleLedger(opts);
256
+ const { dir, file } = gateReportParts(op, gate, digest);
257
+ return readBlobFromPath(dir, file, opts);
258
+ },
239
259
  };
240
260
 
241
261
  /** Append one line to `_gates/<op>/applied.jsonl` on top of the remote's ledger, retrying on a concurrent writer, and push. */
@@ -265,6 +285,21 @@ export function gitGateLedgerPort(opts?: { cwd?: string }): GateLedgerPort {
265
285
  }
266
286
  }
267
287
 
288
+ /**
289
+ * Where a product's report of a wave's plans is kept on the ledger branch
290
+ * (#4842): `_gates/<op>/<gate>/<digest>.json`, the digest's `:` as `_`,
291
+ * beside the pending fact that asks approval for that digest. terragucci
292
+ * kept its stored report at this path before chant did.
293
+ */
294
+ export function opWaveGateReportPath(op: string, gate: string, digest: string): string {
295
+ const { dir, file } = gateReportParts(op, gate, digest);
296
+ return `${dir}/${file}`;
297
+ }
298
+
299
+ function gateReportParts(op: string, gate: string, digest: string): { dir: string; file: string } {
300
+ return { dir: `_gates/${op}/${gate}`, file: `${digest.replace(/:/g, "_")}.json` };
301
+ }
302
+
268
303
  /** A gate ledger held in memory — what a test, or a caller that has already read the ledger, hands {@link evaluateGate}. */
269
304
  export function memoryGateLedgerPort(
270
305
  seed: { resolutions?: GateResolutionRecord[]; pending?: PendingGateRecord[]; applied?: AppliedGateRecord[] } = {},
@@ -276,6 +311,8 @@ export function memoryGateLedgerPort(
276
311
  finished: FinishedGateRecord[];
277
312
  /** Stored request attachments by `<op>/<digest>` (#4623). */
278
313
  attachments: Map<string, string>;
314
+ /** Stored gate reports by their path on the ledger branch (#4842). */
315
+ reports: Map<string, string>;
279
316
  /** Checkpoint texts by `<op>/<runId>` (#3947). */
280
317
  checkpoints: Map<string, string>;
281
318
  } {
@@ -287,7 +324,16 @@ export function memoryGateLedgerPort(
287
324
  const checkpoints = new Map<string, string>();
288
325
  const finished: FinishedGateRecord[] = [];
289
326
  const attachments = new Map<string, string>();
327
+ const reports = new Map<string, string>();
290
328
  return {
329
+ reports,
330
+ async storeGateReport(op, gate, digest, text) {
331
+ const at = opWaveGateReportPath(op, gate, digest);
332
+ if (!reports.has(at)) reports.set(at, text);
333
+ },
334
+ async readGateReport(op, gate, digest) {
335
+ return reports.get(opWaveGateReportPath(op, gate, digest)) ?? null;
336
+ },
291
337
  appended,
292
338
  resolved,
293
339
  applied,
package/src/op/index.ts CHANGED
@@ -83,6 +83,7 @@ export {
83
83
  OP_WAVE_PLAN_PATH_FLOOR,
84
84
  OP_WAVES_PREVIEW_FLOOR,
85
85
  opWaveRunsPath,
86
+ opWaveReportDir,
86
87
  opWaveSetDigest,
87
88
  parseOpWavesSpec,
88
89
  recordOpWaveHeadPlans,
@@ -123,23 +124,28 @@ export type {
123
124
  export {
124
125
  OP_WAVE_COST_FORMATS,
125
126
  OP_WAVE_COST_MEMBER,
127
+ OP_WAVE_STEP_WAVE_FLOOR,
128
+ OP_WAVE_TOGETHER_MEMBER,
126
129
  opWaveCostVerdict,
130
+ opWaveDiscoverInput,
127
131
  opWaveHoldsAt,
128
132
  opWaveHoldsProblems,
129
133
  opWaveStepInput,
130
134
  opWaveStepProblems,
131
135
  readCostEstimate,
132
136
  } from "./op-waves-capability";
133
- export type { OpWaveCostFormat, OpWaveCostHold, OpWaveCostVerdict, OpWaveHolds, OpWaveRunCost, OpWaveStep, OpWaveStepApply, OpWaveStepPlan } from "./op-waves-capability";
137
+ export type { OpWaveCostFormat, OpWaveCostHold, OpWaveCostVerdict, OpWaveHolds, OpWaveRunCost, OpWaveStep, OpWaveStepApply, OpWaveStepGroup, OpWaveStepPlan } from "./op-waves-capability";
134
138
  export { notifyOpWave, opWaveNotifyFields } from "./op-waves-notify";
135
139
  export { OP_WAVE_STAND_DOWN_FLOOR, gitOpWaveNewerCommit, newerCommitOnBranch, opWaveRunBranch, opWaveStandDownReason, tipAppliesTargets } from "./op-waves-stand-down";
136
140
  export type { OpWaveNewerCommit, OpWaveNewerCommitPort } from "./op-waves-stand-down";
137
141
  export { OP_WAVE_RELEASE_RECORD_FLOOR, opWaveReleaseNames, opWaveReleaseProblems, releaseOfCommit } from "./op-waves-release";
138
142
  export { gitOpWaveReleasePort } from "./op-waves-release-port";
139
143
  export type { OpWaveReleaseNames, OpWaveReleaseOutcome, OpWaveReleasePort, OpWaveReleaseRequest } from "./op-waves-release";
140
- export { foldPolicyRows, opWaveAfterPlanProblems, opWaveAfterPlanResultProblems, runOpWaveAfterPlanHooks } from "./op-waves-after-plan";
141
- export type { OpWaveAfterPlanHook, OpWaveAfterPlanOutcome, OpWaveAfterPlanResult, OpWaveAfterPlanRun, OpWaveAfterPlanRunOutcome } from "./op-waves-after-plan";
144
+ export { OP_WAVE_AFTER_PLAN_WAVE_FLOOR, foldPolicyRows, opWaveAfterPlanProblems, opWaveAfterPlanResultProblems, opWaveAfterPlanWaveResultProblems, runOpWaveAfterPlanHooks } from "./op-waves-after-plan";
145
+ export type { OpWaveAfterPlanHook, OpWaveAfterPlanOutcome, OpWaveAfterPlanResult, OpWaveAfterPlanRun, OpWaveAfterPlanRunOutcome, OpWaveAfterPlanWave, OpWaveAfterPlanWaveOutcome, OpWaveAfterPlanWaveResult } from "./op-waves-after-plan";
142
146
  export { OP_WAVE_AFTER_PLAN_FLOOR } from "./runtime";
147
+ export { OP_WAVE_RUN_HOOKS_FLOOR, opWaveRunHooksProblems } from "./op-waves-run-hooks";
148
+ export type { OpWaveAfterApplyResult, OpWaveBeforePlanResult, OpWaveRunHookApplied, OpWaveRunHookPlanned, OpWaveRunHookRun, OpWaveRunHooks } from "./op-waves-run-hooks";
143
149
  export type { OpRunPolicyRow, OpRunWave, OpRunWavePlan, OpRunWaveTarget } from "./runtime";
144
150
  export type { OpWaveOutcome } from "./op-waves-notify";
145
151
  export { loadActivities, loadProfiles, resolveActivity } from "./activity-registry";
@@ -154,7 +160,7 @@ export { runOpLocally, parseDuration, OpRunFailure } from "./local-executor";
154
160
  export type { StepRecord, OpRunResult, RunOpOptions } from "./local-executor";
155
161
  export { currentOpRun, withOpRunContext } from "./run-context";
156
162
  export type { OpRunContext, PassedGate } from "./run-context";
157
- export { evaluateGate, gitGateLedgerPort, memoryGateLedgerPort, approveCommand, describeGateMismatch, gateIsSealed } from "./gate";
163
+ export { evaluateGate, gitGateLedgerPort, memoryGateLedgerPort, approveCommand, describeGateMismatch, gateIsSealed, opWaveGateReportPath } from "./gate";
158
164
  export type { GateLedgerPort, GateCheck, GateCheckInput, PendingGatePush, GateDigestMismatch, GateQuorumProgress, GateTally } from "./gate";
159
165
  export { tallyGateApprovals, humanQuorumSince, approverOf } from "./gate";
160
166
  export { planGateResumes, standingGateFacts } from "./gate-resume-plan";