@intentius/chant 0.124.77 → 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 (228) hide show
  1. package/dist/__fixtures__/notify-messages/events.d.ts +9 -0
  2. package/dist/__fixtures__/notify-messages/events.d.ts.map +1 -0
  3. package/dist/__fixtures__/notify-messages/events.js +21 -0
  4. package/dist/__fixtures__/product-words.d.ts +14 -0
  5. package/dist/__fixtures__/product-words.d.ts.map +1 -1
  6. package/dist/__fixtures__/product-words.js +11 -0
  7. package/dist/__fixtures__/terragucci-notify.d.ts +66 -0
  8. package/dist/__fixtures__/terragucci-notify.d.ts.map +1 -0
  9. package/dist/__fixtures__/terragucci-notify.js +133 -0
  10. package/dist/action-pins.d.ts +8 -0
  11. package/dist/action-pins.d.ts.map +1 -1
  12. package/dist/action-pins.js +8 -0
  13. package/dist/agent-guard.d.ts.map +1 -1
  14. package/dist/agent-guard.js +1 -2
  15. package/dist/change-set.d.ts +10 -1
  16. package/dist/change-set.d.ts.map +1 -1
  17. package/dist/change-set.js +4 -1
  18. package/dist/ci-agent.d.ts +16 -2
  19. package/dist/ci-agent.d.ts.map +1 -1
  20. package/dist/ci-agent.js +6 -1
  21. package/dist/ci-commit.d.ts +66 -2
  22. package/dist/ci-commit.d.ts.map +1 -1
  23. package/dist/ci-commit.js +147 -19
  24. package/dist/ci-own-jobs.d.ts.map +1 -1
  25. package/dist/ci-own-jobs.js +1 -2
  26. package/dist/ci-product-words.d.ts +18 -4
  27. package/dist/ci-product-words.d.ts.map +1 -1
  28. package/dist/ci-product-words.js +26 -6
  29. package/dist/ci-product.d.ts +7 -3
  30. package/dist/ci-product.d.ts.map +1 -1
  31. package/dist/ci-product.js +8 -5
  32. package/dist/cli/handlers/release.d.ts +8 -0
  33. package/dist/cli/handlers/release.d.ts.map +1 -1
  34. package/dist/cli/handlers/release.js +68 -6
  35. package/dist/cli/handlers/run-wave.js +1 -0
  36. package/dist/cli/main.d.ts.map +1 -1
  37. package/dist/cli/main.js +7 -0
  38. package/dist/cli/mcp/product-tools.d.ts +6 -0
  39. package/dist/cli/mcp/product-tools.d.ts.map +1 -1
  40. package/dist/cli/mcp/product-tools.js +7 -0
  41. package/dist/cli/mcp/read-only.d.ts +12 -0
  42. package/dist/cli/mcp/read-only.d.ts.map +1 -1
  43. package/dist/cli/mcp/read-only.js +16 -0
  44. package/dist/cli/mcp/server.d.ts +11 -0
  45. package/dist/cli/mcp/server.d.ts.map +1 -1
  46. package/dist/cli/mcp/server.js +26 -5
  47. package/dist/cli/mcp/types.d.ts +5 -1
  48. package/dist/cli/mcp/types.d.ts.map +1 -1
  49. package/dist/components/capability.d.ts +42 -0
  50. package/dist/components/capability.d.ts.map +1 -1
  51. package/dist/components/group-digest.d.ts +17 -0
  52. package/dist/components/group-digest.d.ts.map +1 -0
  53. package/dist/components/group-digest.js +18 -0
  54. package/dist/components/groups.d.ts +2 -11
  55. package/dist/components/groups.d.ts.map +1 -1
  56. package/dist/components/groups.js +2 -12
  57. package/dist/components/index.d.ts +1 -1
  58. package/dist/components/index.d.ts.map +1 -1
  59. package/dist/components/pr-env-components.d.ts.map +1 -1
  60. package/dist/components/pr-env-components.js +1 -2
  61. package/dist/config.d.ts +28 -8
  62. package/dist/config.d.ts.map +1 -1
  63. package/dist/config.js +21 -1
  64. package/dist/lexicon.d.ts +8 -0
  65. package/dist/lexicon.d.ts.map +1 -1
  66. package/dist/lexicon.js +8 -0
  67. package/dist/lifecycle/release-cut.d.ts +7 -1
  68. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  69. package/dist/lifecycle/release-cut.js +1 -0
  70. package/dist/lifecycle/release-images.d.ts +86 -3
  71. package/dist/lifecycle/release-images.d.ts.map +1 -1
  72. package/dist/lifecycle/release-images.js +131 -6
  73. package/dist/lifecycle/release-publish.d.ts +8 -1
  74. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  75. package/dist/lifecycle/release-publish.js +30 -3
  76. package/dist/lifecycle/release-version.d.ts +86 -0
  77. package/dist/lifecycle/release-version.d.ts.map +1 -0
  78. package/dist/lifecycle/release-version.js +209 -0
  79. package/dist/mcp/types.d.ts +26 -0
  80. package/dist/mcp/types.d.ts.map +1 -1
  81. package/dist/notify-product.d.ts +11 -2
  82. package/dist/notify-product.d.ts.map +1 -1
  83. package/dist/notify-product.js +15 -4
  84. package/dist/notify-relay.d.ts.map +1 -1
  85. package/dist/notify-relay.js +1 -2
  86. package/dist/notify.d.ts +36 -4
  87. package/dist/notify.d.ts.map +1 -1
  88. package/dist/notify.js +31 -21
  89. package/dist/notify.schema.json +1 -0
  90. package/dist/op/activities/review-product.d.ts +111 -0
  91. package/dist/op/activities/review-product.d.ts.map +1 -0
  92. package/dist/op/activities/review-product.js +115 -0
  93. package/dist/op/gate.d.ts +17 -0
  94. package/dist/op/gate.d.ts.map +1 -1
  95. package/dist/op/gate.js +36 -0
  96. package/dist/op/index.d.ts +8 -6
  97. package/dist/op/index.d.ts.map +1 -1
  98. package/dist/op/index.js +5 -4
  99. package/dist/op/op-waves-after-plan.d.ts +76 -1
  100. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  101. package/dist/op/op-waves-after-plan.js +142 -3
  102. package/dist/op/op-waves-capability-spec.js +1 -2
  103. package/dist/op/op-waves-capability.d.ts +89 -2
  104. package/dist/op/op-waves-capability.d.ts.map +1 -1
  105. package/dist/op/op-waves-capability.js +215 -7
  106. package/dist/op/op-waves-run-hooks.d.ts +104 -0
  107. package/dist/op/op-waves-run-hooks.d.ts.map +1 -0
  108. package/dist/op/op-waves-run-hooks.js +146 -0
  109. package/dist/op/op-waves-run.d.ts +21 -0
  110. package/dist/op/op-waves-run.d.ts.map +1 -1
  111. package/dist/op/op-waves-run.js +233 -13
  112. package/dist/op/op-waves.d.ts +11 -1
  113. package/dist/op/op-waves.d.ts.map +1 -1
  114. package/dist/op/op-waves.js +7 -1
  115. package/dist/op/runtime.d.ts +2 -0
  116. package/dist/op/runtime.d.ts.map +1 -1
  117. package/dist/policy-engine.d.ts.map +1 -1
  118. package/dist/policy-engine.js +1 -2
  119. package/dist/pr-forge-reads.d.ts +124 -0
  120. package/dist/pr-forge-reads.d.ts.map +1 -0
  121. package/dist/pr-forge-reads.js +322 -0
  122. package/dist/pr-forge.d.ts +14 -0
  123. package/dist/pr-forge.d.ts.map +1 -1
  124. package/dist/pr-forge.js +21 -13
  125. package/dist/pr-plan-note.d.ts +293 -0
  126. package/dist/pr-plan-note.d.ts.map +1 -0
  127. package/dist/pr-plan-note.js +361 -0
  128. package/dist/release-floors.d.ts +13 -1
  129. package/dist/release-floors.d.ts.map +1 -1
  130. package/dist/release-floors.js +13 -1
  131. package/dist/state-export.d.ts.map +1 -1
  132. package/dist/state-export.js +1 -2
  133. package/dist/state-migration.d.ts.map +1 -1
  134. package/dist/state-migration.js +1 -2
  135. package/dist/state-unlock.d.ts.map +1 -1
  136. package/dist/state-unlock.js +1 -2
  137. package/dist/wave-runtime.mjs +314 -314
  138. package/dist/workspace/change-set.schema.json +7 -0
  139. package/dist/workspace/release-workflow.d.ts +7 -0
  140. package/dist/workspace/release-workflow.d.ts.map +1 -1
  141. package/dist/workspace/release-workflow.js +13 -2
  142. package/package.json +1 -1
  143. package/src/__fixtures__/notify-messages/events.ts +23 -0
  144. package/src/__fixtures__/notify-messages/messages.json +50 -0
  145. package/src/__fixtures__/pr-loop/terragucci-plan.note.golden.md +53 -0
  146. package/src/__fixtures__/pr-loop/terragucci-plan.note.json +83 -0
  147. package/src/__fixtures__/product-words.ts +12 -0
  148. package/src/__fixtures__/review-agent/terragucci-review.json +94 -0
  149. package/src/__fixtures__/terragucci-notify.ts +170 -0
  150. package/src/action-pins.test.ts +11 -1
  151. package/src/action-pins.ts +9 -0
  152. package/src/agent-guard.test.ts +1 -2
  153. package/src/agent-guard.ts +1 -2
  154. package/src/change-set.test.ts +20 -0
  155. package/src/change-set.ts +11 -1
  156. package/src/ci-agent.test.ts +9 -0
  157. package/src/ci-agent.ts +15 -2
  158. package/src/ci-commit.test.ts +162 -0
  159. package/src/ci-commit.ts +167 -21
  160. package/src/ci-own-jobs.test.ts +1 -2
  161. package/src/ci-own-jobs.ts +1 -2
  162. package/src/ci-product-words.ts +35 -7
  163. package/src/ci-product.ts +9 -6
  164. package/src/cli/handlers/build-pr-loop-control.test.ts +1 -2
  165. package/src/cli/handlers/build-run-group.test.ts +1 -2
  166. package/src/cli/handlers/release.ts +60 -7
  167. package/src/cli/handlers/run-wave.ts +1 -0
  168. package/src/cli/main.ts +7 -0
  169. package/src/cli/mcp/product-tools.test.ts +50 -0
  170. package/src/cli/mcp/product-tools.ts +8 -0
  171. package/src/cli/mcp/read-only.ts +19 -0
  172. package/src/cli/mcp/server.test.ts +30 -0
  173. package/src/cli/mcp/server.ts +28 -5
  174. package/src/cli/mcp/types.ts +6 -1
  175. package/src/components/capability.ts +41 -0
  176. package/src/components/group-digest.ts +20 -0
  177. package/src/components/groups.ts +3 -13
  178. package/src/components/index.ts +2 -0
  179. package/src/components/pr-env-components.test.ts +1 -2
  180. package/src/components/pr-env-components.ts +1 -2
  181. package/src/config.ts +38 -3
  182. package/src/gate-policy-bundle.test.ts +1 -1
  183. package/src/lexicon.ts +9 -0
  184. package/src/lifecycle/release-cut.ts +11 -0
  185. package/src/lifecycle/release-images-dockerfile.test.ts +229 -0
  186. package/src/lifecycle/release-images.ts +171 -8
  187. package/src/lifecycle/release-publish.ts +34 -3
  188. package/src/lifecycle/release-version.test.ts +155 -0
  189. package/src/lifecycle/release-version.ts +227 -0
  190. package/src/mcp/types.ts +27 -0
  191. package/src/notify-message-words.test.ts +185 -0
  192. package/src/notify-product.ts +16 -4
  193. package/src/notify-relay.ts +1 -2
  194. package/src/notify.schema.json +1 -0
  195. package/src/notify.ts +59 -19
  196. package/src/op/activities/review-product.test.ts +116 -0
  197. package/src/op/activities/review-product.ts +199 -0
  198. package/src/op/gate.ts +46 -0
  199. package/src/op/index.ts +10 -4
  200. package/src/op/op-waves-after-plan-wave.test.ts +226 -0
  201. package/src/op/op-waves-after-plan.ts +170 -5
  202. package/src/op/op-waves-capability-spec.ts +1 -1
  203. package/src/op/op-waves-capability.test.ts +6 -0
  204. package/src/op/op-waves-capability.ts +243 -10
  205. package/src/op/op-waves-run-hooks.test.ts +184 -0
  206. package/src/op/op-waves-run-hooks.ts +195 -0
  207. package/src/op/op-waves-run.ts +240 -16
  208. package/src/op/op-waves-step-wave.test.ts +277 -0
  209. package/src/op/op-waves.ts +15 -2
  210. package/src/op/runtime.ts +2 -0
  211. package/src/op/schedule-overdue.test.ts +26 -0
  212. package/src/policy-engine.test.ts +1 -2
  213. package/src/policy-engine.ts +1 -2
  214. package/src/pr-forge-reads.test.ts +285 -0
  215. package/src/pr-forge-reads.ts +424 -0
  216. package/src/pr-forge.ts +30 -16
  217. package/src/pr-plan-note.test.ts +105 -0
  218. package/src/pr-plan-note.ts +520 -0
  219. package/src/release-floors.ts +19 -1
  220. package/src/state-export.test.ts +1 -2
  221. package/src/state-export.ts +1 -2
  222. package/src/state-migration.test.ts +1 -2
  223. package/src/state-migration.ts +1 -2
  224. package/src/state-unlock.test.ts +1 -2
  225. package/src/state-unlock.ts +1 -2
  226. package/src/workspace/change-set.schema.json +7 -0
  227. package/src/workspace/release-workflow.test.ts +18 -0
  228. package/src/workspace/release-workflow.ts +23 -2
package/src/ci-commit.ts CHANGED
@@ -30,9 +30,8 @@ import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "no
30
30
  import { join } from "node:path";
31
31
  import { CHANT_EXIT } from "./exit-codes";
32
32
  import { FORGE_TOKEN_VARS } from "./ci-handover";
33
- import { NEXT_RELEASE } from "./release-floors";
34
33
  import { agentForbiddenPaths, AgentError, branchOk, errText, LOGIN, readSmall, SHA, type AgentGit } from "./ci-agent";
35
- import { parseProductComment, type CiProductWords } from "./ci-product-words";
34
+ import { COMMIT_COMMENT_ARG, parseProductComment, type CiProductWords } from "./ci-product-words";
36
35
  import type { OpRunRecord, OpRunRecordInput } from "./op/runtime";
37
36
  import type { RunOrigin } from "./lifecycle/release-ledger";
38
37
  import type { PrForge } from "./pr-forge";
@@ -49,7 +48,11 @@ export const CI_COMMIT_FILES_FLOOR = "0.124.73";
49
48
  * `CHANT_COMMIT_PR`, keeps the tail of its standard error and replies with a
50
49
  * product's refusal text ({@link setCommitRefusalReply}) (#4724).
51
50
  */
52
- export const CI_COMMIT_REPLY_FLOOR = NEXT_RELEASE;
51
+ export const CI_COMMIT_REPLY_FLOOR = "0.124.77";
52
+ /** The first chant whose commit job takes `commentArg`, one argument after the comment's word passed into the argv (#4820). */
53
+ export const CI_COMMIT_ARG_FLOOR = "0.124.78";
54
+ /** The first chant whose `commit land` reads {@link COMMIT_HARNESS_BREAK_ENV} in a BREAK arm of chant's e2e harness (#4836). */
55
+ export const CI_COMMIT_HARNESS_BREAK_FLOOR = "0.124.78";
53
56
 
54
57
  /** What starts a commit run: a person's comment, or a check job's finding. */
55
58
  export type CommitTrigger = "comment" | "check";
@@ -119,6 +122,22 @@ export interface OpCommitSpec {
119
122
  * on GitLab they are the project's CI/CD variables.
120
123
  */
121
124
  commandEnv?: string[];
125
+ /**
126
+ * For `on: "comment"` (#4820): the comment may carry one argument after
127
+ * the word, `/<product> <word> <arg>`, which must match `pattern` (a
128
+ * regular expression's source, anchored with `^` and `$`) and chant's
129
+ * own plain-name check ({@link COMMIT_COMMENT_ARG}). It goes into the
130
+ * command's argv at index `position`, from 1 (after the program) to the
131
+ * argv's length (at the end). With no argument the argv is `command`. On
132
+ * GitLab the pipeline's {@link GITLAB_COMMIT_ARG_VAR} carries it.
133
+ */
134
+ commentArg?: CommitCommentArg;
135
+ }
136
+
137
+ /** Where a commit job's command takes the comment's argument (#4820). */
138
+ export interface CommitCommentArg {
139
+ pattern: string;
140
+ position: number;
122
141
  }
123
142
 
124
143
  /** A commit job's settings, every default filled and checked. */
@@ -141,6 +160,8 @@ export interface CommitSettings {
141
160
  after: string[];
142
161
  /** The job variables the command sees (#4724). */
143
162
  commandEnv: string[];
163
+ /** The comment's argument and where it goes in the argv (#4820). */
164
+ commentArg?: CommitCommentArg;
144
165
  }
145
166
 
146
167
  export const COMMIT_MAX_RUNS = 3;
@@ -165,6 +186,7 @@ export const COMMIT_ENV = {
165
186
  env: "CHANT_COMMIT_ENV",
166
187
  mergeBase: "CHANT_COMMIT_MERGE_BASE",
167
188
  commandEnv: "CHANT_COMMIT_COMMAND_ENV",
189
+ commentArg: "CHANT_COMMIT_COMMENT_ARG",
168
190
  } as const;
169
191
 
170
192
  /** The variable the command reads the pull request's number from (#4724), such as for a default name. */
@@ -173,6 +195,8 @@ export const COMMIT_PR_ENV = "CHANT_COMMIT_PR";
173
195
  /** GitLab starts no pipeline on a note: a pipeline of the default branch started with these runs a comment commit job. */
174
196
  export const GITLAB_COMMIT_PR_VAR = "CHANT_COMMIT_PR";
175
197
  export const GITLAB_COMMIT_WORD_VAR = "CHANT_COMMIT";
198
+ /** With `commentArg` (#4820): the argument, as the comment would give it after the word. */
199
+ export const GITLAB_COMMIT_ARG_VAR = "CHANT_COMMIT_ARG";
176
200
 
177
201
  /** Where the jobs keep the decision, the exit code and the patch, from the job's directory. */
178
202
  export const COMMIT_DIR = ".chant/commit";
@@ -259,6 +283,20 @@ export function resolveCommitSpec(name: string, spec: OpCommitSpec, product = "c
259
283
  if (!Array.isArray(commandEnv) || !commandEnv.every((v) => typeof v === "string" && VAR.test(v))) throw new AgentError(`${where}: commandEnv is a list of variable names`);
260
284
  const tokens = commandEnv.filter((v) => (FORGE_TOKEN_VARS as readonly string[]).includes(v) || v === spec.tokenEnv || v.startsWith("CHANT_COMMIT_"));
261
285
  if (tokens.length > 0) throw new AgentError(`${where}: commandEnv may not pass ${tokens.join(", ")}: the command never sees a forge token or the job's own settings`);
286
+ let commentArg: CommitCommentArg | undefined;
287
+ if (spec.commentArg !== undefined) {
288
+ const a = spec.commentArg as Partial<CommitCommentArg>;
289
+ if (spec.on !== "comment") throw new AgentError(`${where}: commentArg is for the comment trigger, which has a comment to read it from`);
290
+ if (typeof a.pattern !== "string" || !a.pattern.startsWith("^") || !a.pattern.endsWith("$") || a.pattern.length > 200) {
291
+ throw new AgentError(`${where}: commentArg's pattern is a regular expression's source anchored with ^ and $, such as "^[a-z0-9]+(?:[-_][a-z0-9]+)*$"`);
292
+ }
293
+ try {
294
+ new RegExp(a.pattern);
295
+ } catch (e) {
296
+ throw new AgentError(`${where}: commentArg's pattern is not a regular expression (${(e as Error).message})`);
297
+ }
298
+ commentArg = { pattern: a.pattern, position: intIn(`${where}: commentArg's position`, a.position, 1, spec.command.length) };
299
+ }
262
300
  return {
263
301
  name,
264
302
  on: spec.on,
@@ -275,9 +313,28 @@ export function resolveCommitSpec(name: string, spec: OpCommitSpec, product = "c
275
313
  jobToken: spec.jobToken === true,
276
314
  after: [...after],
277
315
  commandEnv: [...new Set(commandEnv)],
316
+ ...(commentArg ? { commentArg } : {}),
278
317
  };
279
318
  }
280
319
 
320
+ /** The words that take an argument, for {@link parseProductComment}: this job's word, when it has `commentArg`. */
321
+ function commentArgPatterns(s: Partial<Pick<CommitSettings, "comment" | "commentArg">>): Record<string, RegExp> {
322
+ const word = s.comment?.split(" ")[1];
323
+ return word && s.commentArg ? { [word]: new RegExp(s.commentArg.pattern) } : {};
324
+ }
325
+
326
+ /**
327
+ * The argv the command runs (#4820): `command`, with the comment's argument
328
+ * at `commentArg.position` when there is one. An argument the settings do
329
+ * not take, or one off its pattern, throws.
330
+ */
331
+ export function commitArgv(s: Pick<CommitSettings, "command"> & Partial<Pick<CommitSettings, "commentArg">>, arg: string | undefined): string[] {
332
+ if (arg === undefined) return [...s.command];
333
+ if (!s.commentArg) throw new AgentError("this commit job takes no argument after its word");
334
+ if (!COMMIT_COMMENT_ARG.test(arg) || !new RegExp(s.commentArg.pattern).test(arg)) throw new AgentError(`${JSON.stringify(arg)} is not a name this commit job takes`);
335
+ return [...s.command.slice(0, s.commentArg.position), arg, ...s.command.slice(s.commentArg.position)];
336
+ }
337
+
281
338
  /** The settings as the generated jobs' variables. */
282
339
  export function commitSettingsEnv(s: CommitSettings): Record<string, string> {
283
340
  return {
@@ -294,6 +351,7 @@ export function commitSettingsEnv(s: CommitSettings): Record<string, string> {
294
351
  [COMMIT_ENV.env]: s.env,
295
352
  ...(s.mergeBase ? { [COMMIT_ENV.mergeBase]: "1" } : {}),
296
353
  ...(s.commandEnv.length > 0 ? { [COMMIT_ENV.commandEnv]: JSON.stringify(s.commandEnv) } : {}),
354
+ ...(s.commentArg ? { [COMMIT_ENV.commentArg]: JSON.stringify(s.commentArg) } : {}),
297
355
  };
298
356
  }
299
357
 
@@ -323,6 +381,17 @@ export function commitSettingsFromEnv(env: Record<string, string | undefined>, p
323
381
  const maxRuns = num(COMMIT_ENV.maxRuns);
324
382
  const timeout = num(COMMIT_ENV.timeout);
325
383
  const guarded = list(COMMIT_ENV.guarded);
384
+ let commentArg: CommitCommentArg | undefined;
385
+ const argText = env[COMMIT_ENV.commentArg];
386
+ if (argText) {
387
+ try {
388
+ const parsed = JSON.parse(argText) as unknown;
389
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("not an object");
390
+ commentArg = parsed as CommitCommentArg;
391
+ } catch (e) {
392
+ throw new AgentError(`${COMMIT_ENV.commentArg} is a JSON object with pattern and position (${(e as Error).message})`);
393
+ }
394
+ }
326
395
  const spec: OpCommitSpec = {
327
396
  on: env[COMMIT_ENV.on] as CommitTrigger,
328
397
  ...(env[COMMIT_ENV.comment] ? { comment: env[COMMIT_ENV.comment] } : {}),
@@ -336,6 +405,7 @@ export function commitSettingsFromEnv(env: Record<string, string | undefined>, p
336
405
  ...(env[COMMIT_ENV.env] ? { env: env[COMMIT_ENV.env] } : {}),
337
406
  ...(env[COMMIT_ENV.mergeBase] === "1" ? { mergeBase: true } : {}),
338
407
  ...(list(COMMIT_ENV.commandEnv) ? { commandEnv: list(COMMIT_ENV.commandEnv)! } : {}),
408
+ ...(commentArg ? { commentArg } : {}),
339
409
  };
340
410
  return resolveCommitSpec(name, spec, product);
341
411
  }
@@ -368,6 +438,8 @@ export interface CommitRequest {
368
438
  pr: number;
369
439
  /** The commenter, or the person who started the GitLab pipeline. Absent on the `check` trigger. */
370
440
  user?: string;
441
+ /** The comment's argument (#4820), checked against `commentArg`. */
442
+ arg?: string;
371
443
  }
372
444
 
373
445
  /**
@@ -378,7 +450,7 @@ export interface CommitRequest {
378
450
  * pull request the check ran for, from the `pull_request` event or the
379
451
  * merge request pipeline.
380
452
  */
381
- export function commitRequestFromRun(words: CiProductWords, s: Pick<CommitSettings, "on" | "comment">, env: Record<string, string | undefined>, event: unknown): CommitRequest | { refused: string } {
453
+ export function commitRequestFromRun(words: CiProductWords, s: Pick<CommitSettings, "on" | "comment"> & Partial<Pick<CommitSettings, "commentArg">>, env: Record<string, string | undefined>, event: unknown): CommitRequest | { refused: string } {
382
454
  const gitlab = env.GITLAB_CI === "true";
383
455
  let pr: unknown;
384
456
  if (s.on === "check") {
@@ -391,7 +463,8 @@ export function commitRequestFromRun(words: CiProductWords, s: Pick<CommitSettin
391
463
  const word = s.comment?.split(" ")[1];
392
464
  if (gitlab) {
393
465
  pr = Number(env[GITLAB_COMMIT_PR_VAR]);
394
- body = env[GITLAB_COMMIT_WORD_VAR] === word ? s.comment : `/${words.product} ${env[GITLAB_COMMIT_WORD_VAR] ?? ""}`;
466
+ const arg = env[GITLAB_COMMIT_ARG_VAR];
467
+ body = env[GITLAB_COMMIT_WORD_VAR] === word ? `${s.comment}${arg ? ` ${arg}` : ""}` : `/${words.product} ${env[GITLAB_COMMIT_WORD_VAR] ?? ""}`;
395
468
  user = env.GITLAB_USER_LOGIN;
396
469
  } else {
397
470
  const e = event as { comment?: { body?: unknown; user?: { login?: unknown } }; issue?: { number?: unknown } } | undefined;
@@ -401,10 +474,10 @@ export function commitRequestFromRun(words: CiProductWords, s: Pick<CommitSettin
401
474
  }
402
475
  if (typeof pr !== "number" || !Number.isInteger(pr) || pr < 1) return { refused: "the run names no pull request" };
403
476
  if (typeof user !== "string" || !LOGIN.test(user)) return { refused: "the run names nobody who asked" };
404
- const parsed = parseProductComment(words, body, env);
477
+ const parsed = parseProductComment(words, body, env, commentArgPatterns(s));
405
478
  if (parsed?.kind === "refused") return { refused: parsed.reason };
406
479
  if (parsed?.kind !== "commit" || parsed.word !== word) return { refused: `the comment is not ${s.comment}` };
407
- return { pr, user };
480
+ return { pr, user, ...(parsed.arg !== undefined ? { arg: parsed.arg } : {}) };
408
481
  }
409
482
 
410
483
  /**
@@ -441,7 +514,7 @@ function pushedBranch(env: Record<string, string | undefined>): string | undefin
441
514
  */
442
515
  export async function resolveCommitRequest(
443
516
  words: CiProductWords,
444
- s: Pick<CommitSettings, "on" | "comment">,
517
+ s: Pick<CommitSettings, "on" | "comment"> & Partial<Pick<CommitSettings, "commentArg">>,
445
518
  env: Record<string, string | undefined>,
446
519
  event: unknown,
447
520
  forge?: Partial<Pick<PrForge, "findPullRequest">>,
@@ -472,6 +545,8 @@ export interface CommitDecision {
472
545
  pr?: number;
473
546
  branch?: string;
474
547
  user?: string;
548
+ /** The comment's argument (#4820), which `commit run` puts in the argv. */
549
+ arg?: string;
475
550
  /** With `mergeBase`: the base branch and the tip the command ran on. */
476
551
  base?: string;
477
552
  baseSha?: string;
@@ -487,6 +562,7 @@ export function readCommitDecision(dir: string): CommitDecision | undefined {
487
562
  if (d.branch !== undefined && !branchOk(d.branch)) return undefined;
488
563
  if (d.base !== undefined && !branchOk(d.base)) return undefined;
489
564
  if (d.baseSha !== undefined && !SHA.test(d.baseSha)) return undefined;
565
+ if (d.arg !== undefined && !(typeof d.arg === "string" && COMMIT_COMMENT_ARG.test(d.arg))) return undefined;
490
566
  return d as CommitDecision;
491
567
  } catch {
492
568
  return undefined;
@@ -618,7 +694,7 @@ export async function prepareCommitRun(i: CommitPrepareInput): Promise<CommitDec
618
694
 
619
695
  const req = await resolveCommitRequest(i.words, s, i.env, i.event, i.forge);
620
696
  if ("refused" in req) return no(req.refused, s.on === "check" ? "skipped" : "refused");
621
- const who = { pr: req.pr, ...(req.user ? { user: req.user } : {}) };
697
+ const who = { pr: req.pr, ...(req.user ? { user: req.user } : {}), ...(req.arg !== undefined ? { arg: req.arg } : {}) };
622
698
  if (req.user && i.forge?.userCanWrite && !(await i.forge.userCanWrite(req.user))) return no(`${req.user} cannot write to the repository, so ${s.name} does not run for them`, "refused", who);
623
699
 
624
700
  let sha: string;
@@ -747,6 +823,13 @@ export async function runCommit(i: CommitRunInput): Promise<{ rc: string; change
747
823
  writeFileSync(rcFile, "refused\n");
748
824
  return { rc: "refused", changed: false };
749
825
  }
826
+ let argv: string[];
827
+ try {
828
+ argv = commitArgv(i.settings, decision.arg);
829
+ } catch {
830
+ writeFileSync(rcFile, "refused\n");
831
+ return { rc: "refused", changed: false };
832
+ }
750
833
  i.git(["worktree", "add", "--detach", "--force", i.workDir, decision.sha]);
751
834
  if (i.settings.mergeBase) {
752
835
  if (!decision.baseSha) {
@@ -762,7 +845,7 @@ export async function runCommit(i: CommitRunInput): Promise<{ rc: string; change
762
845
  }
763
846
  }
764
847
  const env = commitCommandEnv(i.env, i.checkout, { names: i.settings.commandEnv, ...(decision.pr !== undefined ? { pr: decision.pr } : {}) });
765
- const out = await i.runCommand(i.settings.command, { cwd: i.workDir, env, timeoutMs: i.settings.timeout * 60_000 });
848
+ const out = await i.runCommand(argv, { cwd: i.workDir, env, timeoutMs: i.settings.timeout * 60_000 });
766
849
  const rc = out.timedOut ? "timeout" : out.exitCode === null ? "no-exit" : String(out.exitCode);
767
850
  writeFileSync(rcFile, `${rc}\n`);
768
851
  if (out.output) writeFileSync(join(i.dir, COMMIT_OUTPUT_FILE), out.output.slice(-COMMIT_OUTPUT_LIMIT));
@@ -772,6 +855,51 @@ export async function runCommit(i: CommitRunInput): Promise<{ rc: string; change
772
855
  return { rc, changed: patch.length > 0 };
773
856
  }
774
857
 
858
+ // ── the harness's BREAK switch (#4836) ─────────────────────────────────────
859
+
860
+ /**
861
+ * The push job's variable that turns one of land's checks off, for a BREAK
862
+ * arm of a product's e2e harness scenario: a comma list of
863
+ * {@link COMMIT_HARNESS_CHECKS}. It proves the check matters: with it off,
864
+ * the scenario's expectations must fail. Read only by `chant commit land`,
865
+ * and refused anywhere but chant's harness ({@link commitHarnessBreaks}).
866
+ * The command never sees it: `commandEnv` refuses every `CHANT_COMMIT_*`.
867
+ */
868
+ export const COMMIT_HARNESS_BREAK_ENV = "CHANT_COMMIT_HARNESS_BREAK";
869
+
870
+ /**
871
+ * The checks the switch may turn off. `paths`: a change outside `allowed`
872
+ * and `allowedFiles` lands (a guarded path is still refused). `moved-base`:
873
+ * with `mergeBase`, a base that moved while the command ran lands the merge
874
+ * of the tip the command ran on.
875
+ */
876
+ export const COMMIT_HARNESS_CHECKS = ["paths", "moved-base"] as const;
877
+ export type CommitHarnessCheck = (typeof COMMIT_HARNESS_CHECKS)[number];
878
+
879
+ /** The forge a job of chant's e2e harness reaches, `HARNESS_HOSTS.forgejo` (./e2e-harness/stack.ts). */
880
+ export const COMMIT_HARNESS_FORGE = "http://forgejo:3000";
881
+
882
+ const HARNESS_WORDS: Record<CommitHarnessCheck, string> = { paths: "the path check", "moved-base": "the moved-base check" };
883
+
884
+ /**
885
+ * The checks {@link COMMIT_HARNESS_BREAK_ENV} turns off, or why it is
886
+ * refused. It is read only in a BREAK arm of chant's e2e harness: `BREAK=1`,
887
+ * not GitLab, and a job whose `GITHUB_SERVER_URL` is the harness's Forgejo,
888
+ * {@link COMMIT_HARNESS_FORGE}. Unset or empty, no check is off.
889
+ */
890
+ export function commitHarnessBreaks(env: Record<string, string | undefined>): { checks: CommitHarnessCheck[] } | { refused: string } {
891
+ const raw = env[COMMIT_HARNESS_BREAK_ENV]?.trim() ?? "";
892
+ if (raw === "") return { checks: [] };
893
+ const server = env.GITHUB_SERVER_URL?.replace(/\/+$/, "");
894
+ if (env.BREAK !== "1" || env.GITLAB_CI === "true" || server !== COMMIT_HARNESS_FORGE) {
895
+ return { refused: `${COMMIT_HARNESS_BREAK_ENV} is read only in a BREAK arm of chant's e2e harness (BREAK=1 on the harness's Forgejo, ${COMMIT_HARNESS_FORGE}), and this job is not one` };
896
+ }
897
+ const named = raw.split(",").map((c) => c.trim()).filter((c) => c !== "");
898
+ const bad = named.filter((c) => !(COMMIT_HARNESS_CHECKS as readonly string[]).includes(c));
899
+ if (bad.length > 0) return { refused: `${COMMIT_HARNESS_BREAK_ENV} names ${bad.join(", ")}; the checks it turns off are ${COMMIT_HARNESS_CHECKS.join(" and ")}` };
900
+ return { checks: [...new Set(named)] as CommitHarnessCheck[] };
901
+ }
902
+
775
903
  // ── commit land ────────────────────────────────────────────────────────────
776
904
 
777
905
  /**
@@ -888,16 +1016,27 @@ export async function landCommitChange(i: CommitLandInput): Promise<CommitLandOu
888
1016
  const req = await resolveCommitRequest(i.words, s, i.env, i.event, i.forge);
889
1017
  if ("refused" in req) return finish({ result: s.on === "check" ? "skipped" : "refused", reason: req.refused });
890
1018
  ({ pr, user } = req);
1019
+ // #4836: a BREAK arm of the harness may turn a check off; anywhere else the switch fails the land.
1020
+ const harness = commitHarnessBreaks(i.env);
1021
+ if ("refused" in harness) return finish({ result: "failed", reason: harness.refused }, `${harness.refused}, so nothing was pushed.`);
1022
+ const off = new Set(harness.checks);
891
1023
  const decision = readCommitDecision(i.dir);
892
- if (!decision || decision.name !== s.name || decision.on !== s.on || (decision.pr !== undefined && decision.pr !== pr)) {
1024
+ if (!decision || decision.name !== s.name || decision.on !== s.on || (decision.pr !== undefined && decision.pr !== pr) || (decision.go && decision.arg !== req.arg)) {
893
1025
  return finish({ result: "failed", reason: "the commit job left no decision this job can read" }, "the commit job left nothing to land, so nothing was pushed.");
894
1026
  }
895
1027
  if (!decision.go) return finish({ result: decision.stop ?? "refused", reason: decision.reason ?? "refused" }, `${decision.reason ?? `${s.name} did not run`}, so nothing was pushed.`);
1028
+ // What ran, as the replies and the commit name it: the command with the comment's argument (#4820).
1029
+ let ranArgv: string;
1030
+ try {
1031
+ ranArgv = commitArgv(s, req.arg).join(" ");
1032
+ } catch (e) {
1033
+ return finish({ result: "refused", reason: errText(e) }, `${errText(e)}, so nothing was pushed.`);
1034
+ }
896
1035
  const rc = readSmall(join(i.dir, COMMIT_RC_FILE))?.trim() ?? "";
897
1036
  if (rc === "conflict") {
898
1037
  return finish({ result: "refused", reason: `merging ${decision.base ?? "the base"} into the head conflicts` }, `merging ${code(decision.base ?? "the base")} into the ${what} conflicts, so ${s.name} did not run and nothing was pushed. Resolve the conflict on the branch.`);
899
1038
  }
900
- if (rc === "timeout") return finish({ result: "stopped", reason: `the command passed its ${s.timeout} minute limit` }, `${code(s.command.join(" "))} was stopped at its ${s.timeout} minute limit, so nothing was pushed.`);
1039
+ if (rc === "timeout") return finish({ result: "stopped", reason: `the command passed its ${s.timeout} minute limit` }, `${code(ranArgv)} was stopped at its ${s.timeout} minute limit, so nothing was pushed.`);
901
1040
  if (rc !== "0" && /^[0-9]+$/.test(rc) && i.refusalReply) {
902
1041
  let said: string | undefined;
903
1042
  try {
@@ -907,7 +1046,7 @@ export async function landCommitChange(i: CommitLandInput): Promise<CommitLandOu
907
1046
  }
908
1047
  if (said) return finish({ result: "refused", reason: `the command refused, exiting ${rc}` }, `${said.trim()} Nothing was pushed.`);
909
1048
  }
910
- if (rc !== "0") return finish({ result: "failed", reason: `the command exited ${rc || "with no code"}` }, `${code(s.command.join(" "))} stopped with ${rc ? `exit code ${rc}` : "no exit code"}, so nothing was pushed. The commit job's log has its output.`);
1049
+ if (rc !== "0") return finish({ result: "failed", reason: `the command exited ${rc || "with no code"}` }, `${code(ranArgv)} stopped with ${rc ? `exit code ${rc}` : "no exit code"}, so nothing was pushed. The commit job's log has its output.`);
911
1050
 
912
1051
  const head = await i.forge.pullRequestHead?.(pr!).catch(() => undefined);
913
1052
  if (!head || !head.open || !head.sameRepo || !branchOk(head.branch)) return finish({ result: "refused", reason: `#${pr} is not an open ${what} from this repository` }, `#${pr} is not an open ${what} from this repository, so nothing was pushed.`);
@@ -928,7 +1067,11 @@ export async function landCommitChange(i: CommitLandInput): Promise<CommitLandOu
928
1067
  } catch (e) {
929
1068
  return finish({ result: "failed", reason: `could not fetch ${target} (${errText(e)})` });
930
1069
  }
931
- if (baseSha !== decision.baseSha) return finish({ result: s.on === "check" ? "skipped" : "refused", reason: "the base moved" }, `${code(target)} moved while ${s.name} ran, so nothing was pushed. Ask again.`);
1070
+ if (baseSha !== decision.baseSha) {
1071
+ if (!off.has("moved-base")) return finish({ result: s.on === "check" ? "skipped" : "refused", reason: "the base moved" }, `${code(target)} moved while ${s.name} ran, so nothing was pushed. Ask again.`);
1072
+ // BREAK: land the merge of the tip the command ran on, which the check exists to stop.
1073
+ baseSha = decision.baseSha;
1074
+ }
932
1075
  }
933
1076
 
934
1077
  // The limit and the approval again, on this job's own read.
@@ -945,7 +1088,7 @@ export async function landCommitChange(i: CommitLandInput): Promise<CommitLandOu
945
1088
 
946
1089
  const patch = join(i.dir, COMMIT_PATCH_FILE);
947
1090
  const nothing = (): Promise<CommitLandOutcome> =>
948
- finish({ result: s.on === "check" ? "skipped" : "refused", reason: "the command changed nothing" }, `${code(s.command.join(" "))} changed nothing, so nothing was pushed.`);
1091
+ finish({ result: s.on === "check" ? "skipped" : "refused", reason: "the command changed nothing" }, `${code(ranArgv)} changed nothing, so nothing was pushed.`);
949
1092
  if (!existsSync(patch) || statSync(patch).size === 0) return nothing();
950
1093
  let paths: string[];
951
1094
  try {
@@ -966,17 +1109,19 @@ export async function landCommitChange(i: CommitLandInput): Promise<CommitLandOu
966
1109
  return finish({ result: "refused", reason: `the patch does not apply to ${sha.slice(0, 8)}` }, `the change does not apply to ${sha.slice(0, 8)} (${errText(e)}), so nothing was pushed.`);
967
1110
  }
968
1111
  if (paths.length === 0) return nothing();
969
- const { forbidden, outside } = commitRefusedPaths(paths, s);
1112
+ const refusedPaths = commitRefusedPaths(paths, s);
1113
+ const forbidden = refusedPaths.forbidden;
1114
+ const outside = off.has("paths") ? [] : refusedPaths.outside;
970
1115
  if (forbidden.length > 0 || outside.length > 0) {
971
1116
  const bad = [...new Set([...forbidden, ...outside])];
972
1117
  return finish(
973
1118
  { result: "refused", reason: `the change touches ${bad.join(", ")}`, paths },
974
- `${code(s.command.join(" "))} changed ${bad.map(code).join(", ")}, which ${s.name} may not change (it may change ${[...s.allowed, ...s.allowedFiles].map(code).join(", ")}, and never CI, chant's settings and state, code owners, agent instructions or git settings), so nothing was pushed.`,
1119
+ `${code(ranArgv)} changed ${bad.map(code).join(", ")}, which ${s.name} may not change (it may change ${[...s.allowed, ...s.allowedFiles].map(code).join(", ")}, and never CI, chant's settings and state, code owners, agent instructions or git settings), so nothing was pushed.`,
975
1120
  );
976
1121
  }
977
1122
 
978
- const title = s.on === "comment" ? `${s.comment} asked for by ${user} on ${what} #${pr}` : `${s.name} after the check found something at ${sha.slice(0, 8)}`;
979
- const ran = baseSha ? `Merged ${decision.base} at ${baseSha.slice(0, 12)} into ${sha.slice(0, 12)}, then ran ${s.command.join(" ")}.` : `Ran ${s.command.join(" ")} on ${sha.slice(0, 12)}.`;
1123
+ const title = s.on === "comment" ? `${s.comment}${req.arg !== undefined ? ` ${req.arg}` : ""} asked for by ${user} on ${what} #${pr}` : `${s.name} after the check found something at ${sha.slice(0, 8)}`;
1124
+ const ran = baseSha ? `Merged ${decision.base} at ${baseSha.slice(0, 12)} into ${sha.slice(0, 12)}, then ran ${ranArgv}.` : `Ran ${ranArgv} on ${sha.slice(0, 12)}.`;
980
1125
  const message = [title, "", ran, "", ...(user ? [`Requested-by: ${user}`] : []), `${COMMIT_TRAILER}: ${s.name}`, ""].join("\n");
981
1126
  let commitSha: string;
982
1127
  try {
@@ -991,10 +1136,11 @@ export async function landCommitChange(i: CommitLandInput): Promise<CommitLandOu
991
1136
  } catch (e) {
992
1137
  return finish({ result: "failed", reason: `could not push to ${head.branch} (${errText(e)})`, commit: commitSha }, `could not push to ${code(head.branch)} (${errText(e)}), so nothing was pushed.`);
993
1138
  }
1139
+ const breakNote = off.size > 0 ? ` (BREAK: ${[...off].map((c) => HARNESS_WORDS[c]).join(" and ")} ${off.size === 1 ? "was" : "were"} off)` : "";
994
1140
  const voided = approved ? ` The plan of ${code(sha.slice(0, 8))} was approved by ${approved}; the new commit is planned again and needs approval again.` : "";
995
1141
  return finish(
996
- { result: "pushed", reason: `pushed ${commitSha} to ${head.branch}`, commit: commitSha, paths, ...(approved ? { approvalVoided: approved } : {}) },
997
- `pushed ${code(commitSha.slice(0, 8))} to ${code(head.branch)}${user ? ` for ${user}` : ""}, from ${baseSha ? `a merge of ${code(decision.base!)} and ` : ""}${code(s.command.join(" "))}, changing ${paths.map(code).join(", ")}.${voided} Nothing was applied, approved or merged.`,
1142
+ { result: "pushed", reason: `pushed ${commitSha} to ${head.branch}${breakNote}`, commit: commitSha, paths, ...(approved ? { approvalVoided: approved } : {}) },
1143
+ `pushed ${code(commitSha.slice(0, 8))} to ${code(head.branch)}${user ? ` for ${user}` : ""}, from ${baseSha ? `a merge of ${code(decision.base!)} and ` : ""}${code(ranArgv)}, changing ${paths.map(code).join(", ")}.${voided} Nothing was applied, approved or merged.${breakNote}`,
998
1144
  );
999
1145
  }
1000
1146
 
@@ -9,7 +9,6 @@ import { join } from "node:path";
9
9
  import { describe, expect, test } from "vitest";
10
10
  import { isGeneratedJob, jobNames, keepOwnJobs, mergeOwnJobs, OWN_JOBS_LINE, OwnJobsError, readOwnJobsFile } from "./ci-own-jobs";
11
11
  import * as ciProduct from "./ci-product";
12
- import { NEXT_RELEASE } from "./release-floors";
13
12
 
14
13
  const GITHUB = ["name: chant", "on:", " pull_request:", "jobs:", " plan:", " runs-on: ubuntu-latest", " steps:", " - run: chant components pr-plan prod", " plan-note:", " runs-on: ubuntu-latest", " steps:", " - run: chant components pr-post prod", ""].join("\n");
15
14
  const GITLAB = ["stages:", " - plan", "variables:", " A: b", "plan:", " stage: plan", " script:", " - chant components pr-plan prod", ""].join("\n");
@@ -103,7 +102,7 @@ describe("keepOwnJobs", () => {
103
102
  });
104
103
 
105
104
  test("the ci-product entry carries both, and OWN_JOBS_FLOOR marks them", () => {
106
- expect(ciProduct.OWN_JOBS_FLOOR).toBe(NEXT_RELEASE);
105
+ expect(ciProduct.OWN_JOBS_FLOOR).toBe("0.124.77");
107
106
  expect(typeof ciProduct.mergeOwnJobs).toBe("function");
108
107
  expect(typeof ciProduct.keepOwnJobs).toBe("function");
109
108
  });
@@ -22,10 +22,9 @@
22
22
 
23
23
  import { readFileSync } from "node:fs";
24
24
  import { emitYAMLEntry, parseYAMLDocument } from "./yaml";
25
- import { NEXT_RELEASE } from "./release-floors";
26
25
 
27
26
  /** The first chant with `mergeOwnJobs`, `keepOwnJobs` and `chant build --own-jobs` / `--keep-own-jobs` (#4769). Products feature-detect on it. */
28
- export const OWN_JOBS_FLOOR = NEXT_RELEASE;
27
+ export const OWN_JOBS_FLOOR = "0.124.77";
29
28
 
30
29
  /** The forges whose pipeline files take own jobs. */
31
30
  export type OwnJobsForge = "github" | "gitlab" | "forgejo";
@@ -19,10 +19,12 @@
19
19
  * command's lifetime. Every renderer here reads {@link activeProductWords}
20
20
  * when it is given none.
21
21
  *
22
- * This module imports nothing: the pull request loop bundle (pr-loop.ts,
23
- * pr-loop-bundle.test.ts) carries it.
22
+ * This module imports nothing at run time (the one import is a type): the
23
+ * pull request loop bundle (pr-loop.ts, pr-loop-bundle.test.ts) carries it.
24
24
  */
25
25
 
26
+ import type { NotifyMessageWords } from "./notify";
27
+
26
28
  /** The stages a product names: the status context after the prefix, and the word in the note. */
27
29
  export type CiProductStage = "plan" | "apply" | "record" | "check" | "drift" | "lock" | "approval" | "control";
28
30
 
@@ -139,6 +141,8 @@ export interface CiProductNotifyWordsInput {
139
141
  wave?: string;
140
142
  /** The signed webhook's header prefix. Default `x-<product>`, so chant's stays `x-chant`. */
141
143
  headers?: string;
144
+ /** The labels, re-run button and other words of chant's Slack and Teams messages (#4818). Default: chant's. */
145
+ message?: NotifyMessageWords;
142
146
  }
143
147
 
144
148
  /** The notify slots, filled. */
@@ -146,6 +150,7 @@ export interface CiProductNotifyWords {
146
150
  source: string;
147
151
  wave: string;
148
152
  headers: string;
153
+ message?: NotifyMessageWords;
149
154
  }
150
155
 
151
156
  /** chant's own wave label in a notify summary. */
@@ -220,6 +225,7 @@ export function resolveProductWords(input: CiProductWordsInput | CiProductWords
220
225
  source: input.notify?.source ?? product,
221
226
  wave: input.notify?.wave ?? CHANT_NOTIFY_WAVE_TEMPLATE,
222
227
  headers: input.notify?.headers ?? `x-${product}`,
228
+ ...(input.notify?.message ? { message: input.notify.message } : {}),
223
229
  },
224
230
  };
225
231
  }
@@ -465,7 +471,7 @@ export type ParsedProductComment =
465
471
  */
466
472
  | { kind: "action"; member: string; address: string }
467
473
  /** A commit job's command (#4722), by the word typed: `/terragucci fmt`. Several words may each map onto `commit`. */
468
- | { kind: "commit"; word: string }
474
+ | { kind: "commit"; word: string; arg?: string }
469
475
  | { kind: "refused"; reason: string };
470
476
 
471
477
  /** A member as a comment may name it: path segments, no leading dash, no shell or glob syntax. */
@@ -483,6 +489,12 @@ const TARGET = /^[A-Za-z0-9_][A-Za-z0-9_.:\/\[\]"*@=+$,-]{0,499}$/;
483
489
  * No leading dash, no spaces, no shell or glob syntax.
484
490
  */
485
491
  const ACTION = /^[A-Za-z_][A-Za-z0-9_.\[\]"-]{0,299}$/;
492
+ /**
493
+ * The one argument a commit word may take after it (#4820), on top of the
494
+ * product's own pattern: a plain name, no leading dash, no path or shell
495
+ * syntax, at most 100 characters.
496
+ */
497
+ export const COMMIT_COMMENT_ARG = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$/;
486
498
  /** The longest ask an agent comment may carry. */
487
499
  export const PRODUCT_COMMENT_ASK_MAX = 2000;
488
500
  /** Commands a comment never runs, named in the reply so nobody waits on them. */
@@ -496,9 +508,17 @@ const NEVER = new Set(["approve", "override", "force-unlock", "unlock-state", "i
496
508
  * comment is untrusted input: only a member path checked against a pattern
497
509
  * with no shell syntax, and a wave number, leave this function.
498
510
  *
499
- * `env` turns on an alias whose `when` variable is `1` there.
511
+ * `env` turns on an alias whose `when` variable is `1` there. `commitArgs`
512
+ * names the commit words that take one argument after them (#4820), each
513
+ * with the pattern it must match; it must also match
514
+ * {@link COMMIT_COMMENT_ARG}. Any other commit word takes nothing.
500
515
  */
501
- export function parseProductComment(words: CiProductWords, body: unknown, env: Record<string, string | undefined> = {}): ParsedProductComment | undefined {
516
+ export function parseProductComment(
517
+ words: CiProductWords,
518
+ body: unknown,
519
+ env: Record<string, string | undefined> = {},
520
+ commitArgs: Readonly<Record<string, RegExp>> = {},
521
+ ): ParsedProductComment | undefined {
502
522
  if (typeof body !== "string") return undefined;
503
523
  let text = body.trim();
504
524
  const prefix = `/${words.product}`;
@@ -541,8 +561,16 @@ export function parseProductComment(words: CiProductWords, body: unknown, env: R
541
561
  case "lock":
542
562
  case "unlock":
543
563
  return parts.length === 2 ? { kind: command } : { kind: "refused", reason: `${line} takes nothing after it` };
544
- case "commit":
545
- return parts.length === 2 ? { kind: "commit", word: typed } : { kind: "refused", reason: `${line} takes nothing after it` };
564
+ case "commit": {
565
+ if (parts.length === 2) return { kind: "commit", word: typed };
566
+ const pattern = Object.prototype.hasOwnProperty.call(commitArgs, typed) ? commitArgs[typed] : undefined;
567
+ if (pattern === undefined) return { kind: "refused", reason: `${line} takes nothing after it` };
568
+ const arg = parts[2]!;
569
+ if (parts.length !== 3 || !COMMIT_COMMENT_ARG.test(arg) || !pattern.test(arg)) {
570
+ return { kind: "refused", reason: `${line} takes nothing, or one name after it matching \`${pattern.source}\`` };
571
+ }
572
+ return { kind: "commit", word: typed, arg };
573
+ }
546
574
  case "agent": {
547
575
  const ask = text.slice(`${prefix} ${typed}`.length).trim();
548
576
  if (ask === "") return { kind: "refused", reason: `${line} needs an ask after it, on the same line` };
package/src/ci-product.ts CHANGED
@@ -13,7 +13,6 @@ import type { CiProductWords, CiProductWordsInput } from "./ci-product-words";
13
13
  import type { ProductMcpHook } from "./cli/mcp/product-tools";
14
14
  import type { ProductWaveHook } from "./op/op-waves-after-plan";
15
15
  import { OTLP_EXPORTER_FLOOR } from "./otlp";
16
- import { NEXT_RELEASE } from "./release-floors";
17
16
 
18
17
  /**
19
18
  * The first chant with the product pipeline (#4550): the words, the
@@ -65,7 +64,7 @@ export {
65
64
  type ParsedProductComment,
66
65
  type ProductActionRequest,
67
66
  } from "./ci-product-words";
68
- export { driftNotifyFields, productNotifySource, productNotifyWords, productSendOptions, type DriftNotifyInput } from "./notify-product";
67
+ export { driftNotifyFields, NOTIFY_MESSAGE_WORDS_FLOOR, productNotifySource, productNotifyWords, productSendOptions, type DriftNotifyInput } from "./notify-product";
69
68
 
70
69
  /** The first chant with `chant notify relay` and the notify relay buttons (#4611). */
71
70
  export const NOTIFY_RELAY_FLOOR = "0.124.55";
@@ -209,7 +208,7 @@ export {
209
208
  * group of its own keeps it, and GitHub and GitLab files are unchanged. A
210
209
  * product feature-detects on this floor.
211
210
  */
212
- export const FORGEJO_RUN_GROUP_FLOOR = NEXT_RELEASE;
211
+ export const FORGEJO_RUN_GROUP_FLOOR = "0.124.77";
213
212
  export { RUN_GROUP_KEYS, type RunGroupKey } from "./lexicon";
214
213
 
215
214
  /**
@@ -220,7 +219,7 @@ export { RUN_GROUP_KEYS, type RunGroupKey } from "./lexicon";
220
219
  * the step `productPipelineJobs(...).post.control` returns. A product that
221
220
  * writes its pipeline with the build feature-detects on this floor.
222
221
  */
223
- export const PR_LOOP_CONTROL_FLOOR = NEXT_RELEASE;
222
+ export const PR_LOOP_CONTROL_FLOOR = "0.124.77";
224
223
  export {
225
224
  CI_RESPOND_DEFAULTS,
226
225
  CI_RESPOND_ENV,
@@ -323,9 +322,13 @@ export type { ProductMcpContext, ProductMcpHook } from "./cli/mcp/product-tools"
323
322
  * true` for these, and its hook gains `propose?: boolean`. Feature-detect on
324
323
  * `PRODUCT_MCP_PROPOSE_FLOOR`: on an older chant the read-only server drops a
325
324
  * `forgeWrite` tool, and `--propose` is not a flag it parses.
325
+ *
326
+ * `tools/list` gives each tool's MCP annotations from `MCP_TOOL_ANNOTATIONS_FLOOR`
327
+ * on (chant#4823): `readOnly: true` and `forgeWrite: true` set `readOnlyHint`
328
+ * and `destructiveHint`, and a contribution's `annotations` add the rest.
326
329
  */
327
- export { PRODUCT_MCP_PROPOSE_FLOOR, PRODUCT_TOOL_PROPOSE_WORDS } from "./cli/mcp/product-tools";
328
- export type { McpToolContribution } from "./mcp/types";
330
+ export { MCP_TOOL_ANNOTATIONS_FLOOR, PRODUCT_MCP_PROPOSE_FLOOR, PRODUCT_TOOL_PROPOSE_WORDS } from "./cli/mcp/product-tools";
331
+ export type { McpToolContribution, ToolAnnotations } from "./mcp/types";
329
332
  export {
330
333
  activeOtlp,
331
334
  configureOtlp,
@@ -83,6 +83,5 @@ describe("build --pr-loop --control", () => {
83
83
 
84
84
  test("PR_LOOP_CONTROL_FLOOR marks it in the ci-product entry", async () => {
85
85
  const ciProduct = await import("../../ci-product");
86
- const { NEXT_RELEASE } = await import("../../release-floors");
87
- expect((ciProduct as Record<string, unknown>).PR_LOOP_CONTROL_FLOOR).toBe(NEXT_RELEASE);
86
+ expect((ciProduct as Record<string, unknown>).PR_LOOP_CONTROL_FLOOR).toBe("0.124.77");
88
87
  });
@@ -54,7 +54,6 @@ describe("--run-group", () => {
54
54
 
55
55
  test("FORGEJO_RUN_GROUP_FLOOR marks it in the ci-product entry", async () => {
56
56
  const ciProduct = await import("../../ci-product");
57
- const { NEXT_RELEASE } = await import("../../release-floors");
58
- expect(ciProduct.FORGEJO_RUN_GROUP_FLOOR).toBe(NEXT_RELEASE);
57
+ expect(ciProduct.FORGEJO_RUN_GROUP_FLOOR).toBe("0.124.77");
59
58
  expect(ciProduct.RUN_GROUP_KEYS).toEqual(["commit", "pull-request"]);
60
59
  });