mainfast 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mainfast.cjs CHANGED
@@ -938,8 +938,8 @@ var require_Collection = __commonJS({
938
938
  return this.items.every((node2) => {
939
939
  if (!identity.isPair(node2))
940
940
  return false;
941
- const n = node2.value;
942
- return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
941
+ const n2 = node2.value;
942
+ return n2 == null || allowScalar && identity.isScalar(n2) && n2.value == null && !n2.commentBefore && !n2.comment && !n2.tag;
943
943
  });
944
944
  }
945
945
  /**
@@ -2382,18 +2382,18 @@ var require_stringifyNumber = __commonJS({
2382
2382
  const num2 = typeof value === "number" ? value : Number(value);
2383
2383
  if (!isFinite(num2))
2384
2384
  return isNaN(num2) ? ".nan" : num2 < 0 ? "-.inf" : ".inf";
2385
- let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
2386
- if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
2387
- let i = n.indexOf(".");
2385
+ let n2 = Object.is(value, -0) ? "-0" : JSON.stringify(value);
2386
+ if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n2) && !n2.includes("e")) {
2387
+ let i = n2.indexOf(".");
2388
2388
  if (i < 0) {
2389
- i = n.length;
2390
- n += ".";
2389
+ i = n2.length;
2390
+ n2 += ".";
2391
2391
  }
2392
- let d = minFractionDigits - (n.length - i - 1);
2392
+ let d = minFractionDigits - (n2.length - i - 1);
2393
2393
  while (d-- > 0)
2394
- n += "0";
2394
+ n2 += "0";
2395
2395
  }
2396
- return n;
2396
+ return n2;
2397
2397
  }
2398
2398
  exports2.stringifyNumber = stringifyNumber;
2399
2399
  }
@@ -2637,9 +2637,9 @@ var require_binary = __commonJS({
2637
2637
  type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
2638
2638
  if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
2639
2639
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
2640
- const n = Math.ceil(str2.length / lineWidth);
2641
- const lines = new Array(n);
2642
- for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
2640
+ const n2 = Math.ceil(str2.length / lineWidth);
2641
+ const lines = new Array(n2);
2642
+ for (let i = 0, o = 0; i < n2; ++i, o += lineWidth) {
2643
2643
  lines[i] = str2.substr(o, lineWidth);
2644
2644
  }
2645
2645
  str2 = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
@@ -2911,11 +2911,11 @@ var require_int2 = __commonJS({
2911
2911
  str2 = `0x${str2}`;
2912
2912
  break;
2913
2913
  }
2914
- const n2 = BigInt(str2);
2915
- return sign === "-" ? BigInt(-1) * n2 : n2;
2914
+ const n3 = BigInt(str2);
2915
+ return sign === "-" ? BigInt(-1) * n3 : n3;
2916
2916
  }
2917
- const n = parseInt(str2, radix);
2918
- return sign === "-" ? -1 * n : n;
2917
+ const n2 = parseInt(str2, radix);
2918
+ return sign === "-" ? -1 * n2 : n2;
2919
2919
  }
2920
2920
  function intStringify(node2, radix, prefix) {
2921
2921
  const { value } = node2;
@@ -3064,15 +3064,15 @@ var require_timestamp = __commonJS({
3064
3064
  function parseSexagesimal(str2, asBigInt) {
3065
3065
  const sign = str2[0];
3066
3066
  const parts = sign === "-" || sign === "+" ? str2.substring(1) : str2;
3067
- const num2 = (n) => asBigInt ? BigInt(n) : Number(n);
3067
+ const num2 = (n2) => asBigInt ? BigInt(n2) : Number(n2);
3068
3068
  const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num2(60) + num2(p), num2(0));
3069
3069
  return sign === "-" ? num2(-1) * res : res;
3070
3070
  }
3071
3071
  function stringifySexagesimal(node2) {
3072
3072
  let { value } = node2;
3073
- let num2 = (n) => n;
3073
+ let num2 = (n2) => n2;
3074
3074
  if (typeof value === "bigint")
3075
- num2 = (n) => BigInt(n);
3075
+ num2 = (n2) => BigInt(n2);
3076
3076
  else if (isNaN(value) || !isFinite(value))
3077
3077
  return stringifyNumber.stringifyNumber(node2);
3078
3078
  let sign = "";
@@ -3092,7 +3092,7 @@ var require_timestamp = __commonJS({
3092
3092
  parts.unshift(value);
3093
3093
  }
3094
3094
  }
3095
- return sign + parts.map((n) => String(n).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
3095
+ return sign + parts.map((n2) => String(n2).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
3096
3096
  }
3097
3097
  var intTime = {
3098
3098
  identify: (value) => typeof value === "bigint" || Number.isInteger(value),
@@ -4563,9 +4563,9 @@ var require_resolve_block_scalar = __commonJS({
4563
4563
  if (!chomp && (ch === "-" || ch === "+"))
4564
4564
  chomp = ch;
4565
4565
  else {
4566
- const n = Number(ch);
4567
- if (!indent && n)
4568
- indent = n;
4566
+ const n2 = Number(ch);
4567
+ if (!indent && n2)
4568
+ indent = n2;
4569
4569
  else if (error2 === -1)
4570
4570
  error2 = offset + i;
4571
4571
  }
@@ -5786,8 +5786,8 @@ var require_lexer = __commonJS({
5786
5786
  return this.buffer[i + 1] === "\n";
5787
5787
  return false;
5788
5788
  }
5789
- charAt(n) {
5790
- return this.buffer[this.pos + n];
5789
+ charAt(n2) {
5790
+ return this.buffer[this.pos + n2];
5791
5791
  }
5792
5792
  continueScalar(offset) {
5793
5793
  let ch = this.buffer[offset];
@@ -5821,8 +5821,8 @@ var require_lexer = __commonJS({
5821
5821
  end -= 1;
5822
5822
  return this.buffer.substring(this.pos, end);
5823
5823
  }
5824
- hasChars(n) {
5825
- return this.pos + n <= this.buffer.length;
5824
+ hasChars(n2) {
5825
+ return this.pos + n2 <= this.buffer.length;
5826
5826
  }
5827
5827
  setNext(state) {
5828
5828
  this.buffer = this.buffer.substring(this.pos);
@@ -5831,8 +5831,8 @@ var require_lexer = __commonJS({
5831
5831
  this.next = state;
5832
5832
  return null;
5833
5833
  }
5834
- peek(n) {
5835
- return this.buffer.substr(this.pos, n);
5834
+ peek(n2) {
5835
+ return this.buffer.substr(this.pos, n2);
5836
5836
  }
5837
5837
  *parseNext(next) {
5838
5838
  switch (next) {
@@ -5881,8 +5881,8 @@ var require_lexer = __commonJS({
5881
5881
  else
5882
5882
  break;
5883
5883
  }
5884
- const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));
5885
- yield* this.pushCount(line.length - n);
5884
+ const n2 = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));
5885
+ yield* this.pushCount(line.length - n2);
5886
5886
  this.pushNewline();
5887
5887
  return "stream";
5888
5888
  }
@@ -5920,9 +5920,9 @@ var require_lexer = __commonJS({
5920
5920
  if (!ch1 && !this.atEnd)
5921
5921
  return this.setNext("block-start");
5922
5922
  if ((ch0 === "-" || ch0 === "?" || ch0 === ":") && isEmpty(ch1)) {
5923
- const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
5923
+ const n2 = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
5924
5924
  this.indentNext = this.indentValue + 1;
5925
- this.indentValue += n;
5925
+ this.indentValue += n2;
5926
5926
  return "block-start";
5927
5927
  }
5928
5928
  return "doc";
@@ -5932,10 +5932,10 @@ var require_lexer = __commonJS({
5932
5932
  const line = this.getLine();
5933
5933
  if (line === null)
5934
5934
  return this.setNext("doc");
5935
- let n = yield* this.pushIndicators();
5936
- switch (line[n]) {
5935
+ let n2 = yield* this.pushIndicators();
5936
+ switch (line[n2]) {
5937
5937
  case "#":
5938
- yield* this.pushCount(line.length - n);
5938
+ yield* this.pushCount(line.length - n2);
5939
5939
  // fallthrough
5940
5940
  case void 0:
5941
5941
  yield* this.pushNewline();
@@ -5958,9 +5958,9 @@ var require_lexer = __commonJS({
5958
5958
  return yield* this.parseQuotedScalar();
5959
5959
  case "|":
5960
5960
  case ">":
5961
- n += yield* this.parseBlockScalarHeader();
5962
- n += yield* this.pushSpaces(true);
5963
- yield* this.pushCount(line.length - n);
5961
+ n2 += yield* this.parseBlockScalarHeader();
5962
+ n2 += yield* this.pushSpaces(true);
5963
+ yield* this.pushCount(line.length - n2);
5964
5964
  yield* this.pushNewline();
5965
5965
  return yield* this.parseBlockScalar();
5966
5966
  default:
@@ -5991,18 +5991,18 @@ var require_lexer = __commonJS({
5991
5991
  return yield* this.parseLineStart();
5992
5992
  }
5993
5993
  }
5994
- let n = 0;
5995
- while (line[n] === ",") {
5996
- n += yield* this.pushCount(1);
5997
- n += yield* this.pushSpaces(true);
5994
+ let n2 = 0;
5995
+ while (line[n2] === ",") {
5996
+ n2 += yield* this.pushCount(1);
5997
+ n2 += yield* this.pushSpaces(true);
5998
5998
  this.flowKey = false;
5999
5999
  }
6000
- n += yield* this.pushIndicators();
6001
- switch (line[n]) {
6000
+ n2 += yield* this.pushIndicators();
6001
+ switch (line[n2]) {
6002
6002
  case void 0:
6003
6003
  return "flow";
6004
6004
  case "#":
6005
- yield* this.pushCount(line.length - n);
6005
+ yield* this.pushCount(line.length - n2);
6006
6006
  return "flow";
6007
6007
  case "{":
6008
6008
  case "[":
@@ -6046,10 +6046,10 @@ var require_lexer = __commonJS({
6046
6046
  end = this.buffer.indexOf("'", end + 2);
6047
6047
  } else {
6048
6048
  while (end !== -1) {
6049
- let n = 0;
6050
- while (this.buffer[end - 1 - n] === "\\")
6051
- n += 1;
6052
- if (n % 2 === 0)
6049
+ let n2 = 0;
6050
+ while (this.buffer[end - 1 - n2] === "\\")
6051
+ n2 += 1;
6052
+ if (n2 % 2 === 0)
6053
6053
  break;
6054
6054
  end = this.buffer.indexOf('"', end + 1);
6055
6055
  }
@@ -6203,11 +6203,11 @@ var require_lexer = __commonJS({
6203
6203
  yield* this.pushToIndex(end + 1, true);
6204
6204
  return inFlow ? "flow" : "doc";
6205
6205
  }
6206
- *pushCount(n) {
6207
- if (n > 0) {
6208
- yield this.buffer.substr(this.pos, n);
6209
- this.pos += n;
6210
- return n;
6206
+ *pushCount(n2) {
6207
+ if (n2 > 0) {
6208
+ yield this.buffer.substr(this.pos, n2);
6209
+ this.pos += n2;
6210
+ return n2;
6211
6211
  }
6212
6212
  return 0;
6213
6213
  }
@@ -6222,16 +6222,16 @@ var require_lexer = __commonJS({
6222
6222
  return 0;
6223
6223
  }
6224
6224
  *pushIndicators() {
6225
- let n = 0;
6225
+ let n2 = 0;
6226
6226
  loop: while (true) {
6227
6227
  switch (this.charAt(0)) {
6228
6228
  case "!":
6229
- n += yield* this.pushTag();
6230
- n += yield* this.pushSpaces(true);
6229
+ n2 += yield* this.pushTag();
6230
+ n2 += yield* this.pushSpaces(true);
6231
6231
  continue loop;
6232
6232
  case "&":
6233
- n += yield* this.pushUntil(isNotAnchorChar);
6234
- n += yield* this.pushSpaces(true);
6233
+ n2 += yield* this.pushUntil(isNotAnchorChar);
6234
+ n2 += yield* this.pushSpaces(true);
6235
6235
  continue loop;
6236
6236
  case "-":
6237
6237
  // this is an error
@@ -6245,15 +6245,15 @@ var require_lexer = __commonJS({
6245
6245
  this.indentNext = this.indentValue + 1;
6246
6246
  else if (this.flowKey)
6247
6247
  this.flowKey = false;
6248
- n += yield* this.pushCount(1);
6249
- n += yield* this.pushSpaces(true);
6248
+ n2 += yield* this.pushCount(1);
6249
+ n2 += yield* this.pushSpaces(true);
6250
6250
  continue loop;
6251
6251
  }
6252
6252
  }
6253
6253
  }
6254
6254
  break loop;
6255
6255
  }
6256
- return n;
6256
+ return n2;
6257
6257
  }
6258
6258
  *pushTag() {
6259
6259
  if (this.charAt(1) === "<") {
@@ -6291,12 +6291,12 @@ var require_lexer = __commonJS({
6291
6291
  do {
6292
6292
  ch = this.buffer[++i];
6293
6293
  } while (ch === " " || allowTabs && ch === " ");
6294
- const n = i - this.pos;
6295
- if (n > 0) {
6296
- yield this.buffer.substr(this.pos, n);
6294
+ const n2 = i - this.pos;
6295
+ if (n2 > 0) {
6296
+ yield this.buffer.substr(this.pos, n2);
6297
6297
  this.pos = i;
6298
6298
  }
6299
- return n;
6299
+ return n2;
6300
6300
  }
6301
6301
  *pushUntil(test) {
6302
6302
  let i = this.pos;
@@ -6571,8 +6571,8 @@ var require_parser = __commonJS({
6571
6571
  }
6572
6572
  yield* this.pop();
6573
6573
  }
6574
- peek(n) {
6575
- return this.stack[this.stack.length - n];
6574
+ peek(n2) {
6575
+ return this.stack[this.stack.length - n2];
6576
6576
  }
6577
6577
  *pop(error2) {
6578
6578
  const token = error2 ?? this.stack.pop();
@@ -7840,17 +7840,17 @@ var require_codegen = __commonJS({
7840
7840
  this.nodes = nodes;
7841
7841
  }
7842
7842
  render(opts) {
7843
- return this.nodes.reduce((code, n) => code + n.render(opts), "");
7843
+ return this.nodes.reduce((code, n2) => code + n2.render(opts), "");
7844
7844
  }
7845
7845
  optimizeNodes() {
7846
7846
  const { nodes } = this;
7847
7847
  let i = nodes.length;
7848
7848
  while (i--) {
7849
- const n = nodes[i].optimizeNodes();
7850
- if (Array.isArray(n))
7851
- nodes.splice(i, 1, ...n);
7852
- else if (n)
7853
- nodes[i] = n;
7849
+ const n2 = nodes[i].optimizeNodes();
7850
+ if (Array.isArray(n2))
7851
+ nodes.splice(i, 1, ...n2);
7852
+ else if (n2)
7853
+ nodes[i] = n2;
7854
7854
  else
7855
7855
  nodes.splice(i, 1);
7856
7856
  }
@@ -7860,16 +7860,16 @@ var require_codegen = __commonJS({
7860
7860
  const { nodes } = this;
7861
7861
  let i = nodes.length;
7862
7862
  while (i--) {
7863
- const n = nodes[i];
7864
- if (n.optimizeNames(names, constants2))
7863
+ const n2 = nodes[i];
7864
+ if (n2.optimizeNames(names, constants2))
7865
7865
  continue;
7866
- subtractNames(names, n.names);
7866
+ subtractNames(names, n2.names);
7867
7867
  nodes.splice(i, 1);
7868
7868
  }
7869
7869
  return nodes.length > 0 ? this : void 0;
7870
7870
  }
7871
7871
  get names() {
7872
- return this.nodes.reduce((names, n) => addNames(names, n.names), {});
7872
+ return this.nodes.reduce((names, n2) => addNames(names, n2.names), {});
7873
7873
  }
7874
7874
  };
7875
7875
  var BlockNode = class extends ParentNode {
@@ -8280,8 +8280,8 @@ var require_codegen = __commonJS({
8280
8280
  endFunc() {
8281
8281
  return this._endBlockNode(Func);
8282
8282
  }
8283
- optimize(n = 1) {
8284
- while (n-- > 0) {
8283
+ optimize(n2 = 1) {
8284
+ while (n2-- > 0) {
8285
8285
  this._root.optimizeNodes();
8286
8286
  this._root.optimizeNames(this._root.names, this._constants);
8287
8287
  }
@@ -8295,19 +8295,19 @@ var require_codegen = __commonJS({
8295
8295
  this._nodes.push(node2);
8296
8296
  }
8297
8297
  _endBlockNode(N1, N2) {
8298
- const n = this._currNode;
8299
- if (n instanceof N1 || N2 && n instanceof N2) {
8298
+ const n2 = this._currNode;
8299
+ if (n2 instanceof N1 || N2 && n2 instanceof N2) {
8300
8300
  this._nodes.pop();
8301
8301
  return this;
8302
8302
  }
8303
8303
  throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
8304
8304
  }
8305
8305
  _elseNode(node2) {
8306
- const n = this._currNode;
8307
- if (!(n instanceof If)) {
8306
+ const n2 = this._currNode;
8307
+ if (!(n2 instanceof If)) {
8308
8308
  throw new Error('CodeGen: "else" without "if"');
8309
8309
  }
8310
- this._currNode = n.else = node2;
8310
+ this._currNode = n2.else = node2;
8311
8311
  return this;
8312
8312
  }
8313
8313
  get _root() {
@@ -8324,8 +8324,8 @@ var require_codegen = __commonJS({
8324
8324
  };
8325
8325
  exports2.CodeGen = CodeGen;
8326
8326
  function addNames(names, from) {
8327
- for (const n in from)
8328
- names[n] = (names[n] || 0) + (from[n] || 0);
8327
+ for (const n2 in from)
8328
+ names[n2] = (names[n2] || 0) + (from[n2] || 0);
8329
8329
  return names;
8330
8330
  }
8331
8331
  function addExprNames(names, from) {
@@ -8345,11 +8345,11 @@ var require_codegen = __commonJS({
8345
8345
  items.push(c);
8346
8346
  return items;
8347
8347
  }, []));
8348
- function replaceName(n) {
8349
- const c = constants2[n.str];
8350
- if (c === void 0 || names[n.str] !== 1)
8351
- return n;
8352
- delete names[n.str];
8348
+ function replaceName(n2) {
8349
+ const c = constants2[n2.str];
8350
+ if (c === void 0 || names[n2.str] !== 1)
8351
+ return n2;
8352
+ delete names[n2.str];
8353
8353
  return c;
8354
8354
  }
8355
8355
  function canOptimize(e) {
@@ -8357,8 +8357,8 @@ var require_codegen = __commonJS({
8357
8357
  }
8358
8358
  }
8359
8359
  function subtractNames(names, from) {
8360
- for (const n in from)
8361
- names[n] = (names[n] || 0) - (from[n] || 0);
8360
+ for (const n2 in from)
8361
+ names[n2] = (names[n2] || 0) - (from[n2] || 0);
8362
8362
  }
8363
8363
  function not(x) {
8364
8364
  return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
@@ -14595,7 +14595,7 @@ var import_node_child_process = require("node:child_process");
14595
14595
  // package.json
14596
14596
  var package_default = {
14597
14597
  name: "mainfast",
14598
- version: "0.1.1",
14598
+ version: "0.1.2",
14599
14599
  description: "Set up and run Mainfast, GitHub checks that stop merges from silently breaking main. CLI and MCP server.",
14600
14600
  license: "MIT",
14601
14601
  author: "Mainfast authors",
@@ -14646,7 +14646,7 @@ function git(cwd, args) {
14646
14646
  }
14647
14647
  function repoRoot(dir) {
14648
14648
  const root = git(dir, ["rev-parse", "--show-toplevel"]);
14649
- if (!root) throw new CliError(`not inside a git working tree: ${dir}`);
14649
+ if (!root) throw new CliError(`not inside a git repository: ${dir}`);
14650
14650
  return root;
14651
14651
  }
14652
14652
  function githubRepo(root) {
@@ -14663,7 +14663,7 @@ function mainRef(root, given) {
14663
14663
  const head = git(root, ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"]);
14664
14664
  if (head) return head;
14665
14665
  for (const r of ["origin/main", "origin/master", "main", "master"]) if (git(root, ["rev-parse", "--verify", "--quiet", `${r}^{commit}`])) return r;
14666
- throw new CliError("cannot tell the main branch: pass --main");
14666
+ throw new CliError("could not find the main branch; pass --main");
14667
14667
  }
14668
14668
  function githubToken(env = process.env) {
14669
14669
  for (const name of ["GITHUB_TOKEN", "GH_TOKEN"]) {
@@ -14717,14 +14717,14 @@ var brand_default = {
14717
14717
  freeActiveContributors: 5,
14718
14718
  windowDays: 30,
14719
14719
  proPricePerContributorMonth: "$4",
14720
- _benefitIds: "Polar licence-key benefit id of each plan: a key whose benefit_id is `pro` is Mainfast Pro; `free` is the optional free key (registered user, not Pro).",
14720
+ _benefitIds: "Polar license-key benefit id of each plan: a key whose benefit_id is `pro` is Mainfast Pro; `free` is the optional free key (registered user, not Pro).",
14721
14721
  benefitIds: {
14722
14722
  free: "656e762a-ec6e-4e94-b7fd-f7ff879061ca",
14723
14723
  pro: "ea9b4fcb-3659-404e-bb62-9bec84fb119a"
14724
14724
  }
14725
14725
  },
14726
14726
  polar: {
14727
- _comment: "Licence keys are checked with Polar's public customer-portal endpoint POST {api}/v1/customer-portal/license-keys/validate {key, organization_id}: no merchant secret. These are the live Polar values. While organizationId is all zeros no key is sent anywhere. apiEnv / orgEnv override both, e.g. the sandbox.",
14727
+ _comment: "License keys are checked with Polar's public customer-portal endpoint POST {api}/v1/customer-portal/license-keys/validate {key, organization_id}: no merchant secret. These are the live Polar values. While organizationId is all zeros no key is sent anywhere. apiEnv / orgEnv override both, e.g. the sandbox.",
14728
14728
  api: "https://api.polar.sh",
14729
14729
  organizationId: "3a0d763f-8fac-4df0-898a-a59eb60d3506",
14730
14730
  apiEnv: "MAINFAST_POLAR_API",
@@ -14736,7 +14736,7 @@ var brand_default = {
14736
14736
  intact: {
14737
14737
  productName: "Mainfast Intact",
14738
14738
  tagline: "prove merge commits did not silently drop changes from main",
14739
- description: "Prove merge commits did not silently drop changes from main (dropped hunks, evil merges).",
14739
+ description: "Checks that merge commits did not silently drop changes from main (dropped hunks, evil merges).",
14740
14740
  npmName: "@mainfast/intact",
14741
14741
  cliName: "mainfast",
14742
14742
  configSection: "intact",
@@ -14762,7 +14762,7 @@ var brand_default = {
14762
14762
  rollcall: {
14763
14763
  productName: "Mainfast Rollcall",
14764
14764
  tagline: "required-check integrity audit",
14765
- description: "Audits required status checks (branch protection and rulesets) against what recent merged and open PRs actually reported \u2014 never-ran, skipped-as-success, renamed, path-filtered, merged while pending, drift \u2014 and keeps one tracking issue open while something is wrong.",
14765
+ description: "Finds required status checks that do not protect anything (never ran, skipped but counted as passing, renamed, path-filtered, merged while pending, drift) by comparing branch protection and rulesets with what recent PRs reported. Keeps one tracking issue open while something is wrong.",
14766
14766
  npmName: "@mainfast/rollcall",
14767
14767
  cliName: "mainfast-rollcall",
14768
14768
  configSection: "rollcall",
@@ -14774,7 +14774,7 @@ var brand_default = {
14774
14774
  owners: {
14775
14775
  productName: "Mainfast Owners",
14776
14776
  tagline: "CODEOWNERS drift check",
14777
- description: "CODEOWNERS drift \u2014 unowned files a PR touches, owners who left the org or lost write access, missing teams, dead patterns, dormant owners.",
14777
+ description: "Finds CODEOWNERS drift: unowned files a PR touches, owners who left the org or lost write access, missing teams, dead patterns and dormant owners.",
14778
14778
  npmName: "@mainfast/owners",
14779
14779
  cliName: "mainfast-owners",
14780
14780
  configSection: "owners",
@@ -14786,7 +14786,7 @@ var brand_default = {
14786
14786
  evidence: {
14787
14787
  productName: "Mainfast Evidence",
14788
14788
  tagline: "proof, not review, for pull requests written by coding agents",
14789
- description: "Proof, not review, for pull requests written by coding agents. Posts an evidence card per head commit.",
14789
+ description: "Proof, not review, for pull requests written by coding agents: checks that tests ran on the head commit, required checks passed and tests were not weakened. Posts an evidence card per head commit.",
14790
14790
  npmName: "@mainfast/evidence",
14791
14791
  cliName: "mainfast-evidence",
14792
14792
  configSection: "evidence",
@@ -15605,6 +15605,7 @@ function classifyRequired(context, c, sources = []) {
15605
15605
  }
15606
15606
 
15607
15607
  // ../evidence/src/analyze/checks.ts
15608
+ var plural = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
15608
15609
  function keeper(policy) {
15609
15610
  const ignored = policy.ignoreChecks.map(nameMatcher);
15610
15611
  return (name) => name !== CHECK_NAME && !ignored.some((m) => m(name));
@@ -15677,7 +15678,7 @@ function evaluateChecks(snap, policy) {
15677
15678
  findings.push({
15678
15679
  id: "tests_not_run_on_head",
15679
15680
  title: "No test check ran on the head commit",
15680
- detail: staleTestsOn ? `Tests ran on earlier commit ${staleTestsOn.sha.slice(0, 7)} (${staleTestsOn.tests.map((t) => `${t.name}: ${t.state}`).join(", ")}) but not on head ${short3}. Evidence from an earlier commit does not cover the code being merged.` : `No check run or status on ${short3} matches the test-check patterns (${policy.testChecks.join(", ")}).`
15681
+ detail: staleTestsOn ? `Tests ran on earlier commit ${staleTestsOn.sha.slice(0, 7)} (${staleTestsOn.tests.map((t) => `${t.name}: ${t.state}`).join(", ")}) but not on head ${short3}. Evidence from an earlier commit does not cover the code being merged.` : `No check run or status on ${short3} matches the \`test_checks\` patterns (${policy.testChecks.join(", ")}).`
15681
15682
  });
15682
15683
  } else if (testsState === "failed") {
15683
15684
  const bad = tests.filter((t) => t.state !== "success");
@@ -15692,12 +15693,12 @@ function evaluateChecks(snap, policy) {
15692
15693
  findings.push({
15693
15694
  id: "tests_skipped",
15694
15695
  title: ran ? "Some test checks were skipped on the head commit" : "Every test check was skipped on the head commit",
15695
- detail: `${skipped2.map((t) => `${t.name}: skipped`).join(", ")} \u2014 ${ran ? `${ran} other test check(s) passed, ` : "nothing was tested on this commit; "}a skipped job (an \`if:\` or path filter) verifies nothing.`
15696
+ detail: `${skipped2.map((t) => `${t.name}: skipped`).join(", ")} \u2014 ${ran ? `${plural(ran, "other test check")} passed, ` : "nothing was tested on this commit; "}a skipped job (an \`if:\` or path filter) verifies nothing.`
15696
15697
  });
15697
15698
  } else if (testsState === "empty") {
15698
15699
  findings.push({
15699
15700
  id: "tests_empty",
15700
- title: "Test checks passed but report running zero tests",
15701
+ title: "Test checks passed but ran zero tests",
15701
15702
  detail: tests.map((t) => `${t.name}: "${t.summary}"`).join("; ")
15702
15703
  });
15703
15704
  }
@@ -15721,7 +15722,7 @@ function evaluateChecks(snap, policy) {
15721
15722
  findings.push({
15722
15723
  id: "required_check_missing",
15723
15724
  title: "Required check never reported on the head commit",
15724
- detail: `${missing.map((r) => r.appSatisfied ? r.context : `${r.context} (reported by a different app than the one the rule requires)`).join(", ")} \u2014 nothing that satisfies it ran on ${short3} under that name (renamed job, path filter, the workflow was edited out, or another app posted the name).`
15725
+ detail: `${missing.map((r) => r.appSatisfied ? r.context : `${r.context} (reported by a different app than the one the rule requires)`).join(", ")} \u2014 no check under that name that satisfies the rule ran on ${short3}. Usual causes: a renamed job, a path filter, a removed workflow, or another app posting the name.`
15725
15726
  });
15726
15727
  if (skipped.length)
15727
15728
  findings.push({
@@ -15740,6 +15741,7 @@ function evaluateChecks(snap, policy) {
15740
15741
  }
15741
15742
 
15742
15743
  // ../evidence/src/analyze/claims.ts
15744
+ var plural2 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
15743
15745
  var NEGATION = /\b(no|not|n't|without|never|skip(?:ped)?|none)\b[^.\n]{0,25}$/i;
15744
15746
  var PATTERNS = {
15745
15747
  tests_added: [
@@ -15780,8 +15782,8 @@ function evaluateClaims(title2, body, tamper, checks) {
15780
15782
  for (const c of extractClaims(`${title2}
15781
15783
  ${body}`)) {
15782
15784
  if (c.kind === "tests_added") {
15783
- const n = tamper.addedTestCases;
15784
- if (n > 0) claims.push({ ...c, verdict: "backed", why: `${n} test case(s) added` });
15785
+ const n2 = tamper.addedTestCases;
15786
+ if (n2 > 0) claims.push({ ...c, verdict: "backed", why: `${plural2(n2, "test case")} added` });
15785
15787
  else {
15786
15788
  const why = tamper.testStats.length === 0 ? "the diff changes no test files" : `test files changed but no new test case was added (net assertions ${tamper.net.assertions >= 0 ? "+" : ""}${tamper.net.assertions})`;
15787
15789
  claims.push({ ...c, verdict: "unbacked", why });
@@ -15949,9 +15951,9 @@ function parseLcov(text) {
15949
15951
  files.set(path, cur);
15950
15952
  } else if (line.startsWith("DA:") && cur) {
15951
15953
  const [ln, hits] = line.slice(3).split(",");
15952
- const n = Number(ln);
15954
+ const n2 = Number(ln);
15953
15955
  const h = Number(hits);
15954
- if (Number.isFinite(n) && Number.isFinite(h)) cur.lines.set(n, Math.max(cur.lines.get(n) ?? 0, h));
15956
+ if (Number.isFinite(n2) && Number.isFinite(h)) cur.lines.set(n2, Math.max(cur.lines.get(n2) ?? 0, h));
15955
15957
  } else if (line === "end_of_record") cur = void 0;
15956
15958
  }
15957
15959
  return { format: "lcov", files };
@@ -15977,9 +15979,9 @@ function parseCobertura(xml) {
15977
15979
  files.set(path, cov);
15978
15980
  const body = m[2].replace(/<methods>[\s\S]*?<\/methods>/g, "");
15979
15981
  for (const l of body.matchAll(/<line\b([^>]*)\/?>/g)) {
15980
- const n = Number(attr(l[1], "number"));
15982
+ const n2 = Number(attr(l[1], "number"));
15981
15983
  const h = Number(attr(l[1], "hits"));
15982
- if (Number.isFinite(n) && Number.isFinite(h)) cov.lines.set(n, Math.max(cov.lines.get(n) ?? 0, h));
15984
+ if (Number.isFinite(n2) && Number.isFinite(h)) cov.lines.set(n2, Math.max(cov.lines.get(n2) ?? 0, h));
15983
15985
  }
15984
15986
  }
15985
15987
  return { format: "cobertura", files };
@@ -15995,7 +15997,7 @@ function mergeCoverage(reports) {
15995
15997
  for (const r of reports)
15996
15998
  for (const [p, c] of r.files) {
15997
15999
  const into = files.get(p) ?? { lines: /* @__PURE__ */ new Map() };
15998
- for (const [n, h] of c.lines) into.lines.set(n, Math.max(into.lines.get(n) ?? 0, h));
16000
+ for (const [n2, h] of c.lines) into.lines.set(n2, Math.max(into.lines.get(n2) ?? 0, h));
15999
16001
  files.set(p, into);
16000
16002
  }
16001
16003
  return { format: reports[0].format, files };
@@ -16007,10 +16009,10 @@ function lookup(report, repoPath2) {
16007
16009
  const target = norm(repoPath2);
16008
16010
  let best;
16009
16011
  for (const [p, cov] of report.files) {
16010
- const n = norm(p);
16011
- if (n === target) return cov;
16012
- if (n.endsWith(`/${target}`) || target.endsWith(`/${n}`)) {
16013
- const len = Math.min(n.length, target.length);
16012
+ const n2 = norm(p);
16013
+ if (n2 === target) return cov;
16014
+ if (n2.endsWith(`/${target}`) || target.endsWith(`/${n2}`)) {
16015
+ const len = Math.min(n2.length, target.length);
16014
16016
  if (!best || len > best.len) best = { cov, len };
16015
16017
  }
16016
16018
  }
@@ -16072,6 +16074,7 @@ function compress(lines) {
16072
16074
  }
16073
16075
 
16074
16076
  // ../evidence/src/analyze/provenance.ts
16077
+ var plural3 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
16075
16078
  var AGENT_CATALOG = [
16076
16079
  {
16077
16080
  // Verified: claude[bot] and the claude/ prefix are the defaults of anthropics/claude-code-action
@@ -16175,13 +16178,13 @@ function displayName(id) {
16175
16178
  return AGENT_CATALOG.find((a) => a.id === id)?.name ?? id;
16176
16179
  }
16177
16180
  function countRanges(spec) {
16178
- let n = 0;
16181
+ let n2 = 0;
16179
16182
  for (const part of spec.split(",")) {
16180
16183
  const m = /^(\d+)(?:-(\d+))?$/.exec(part.trim());
16181
16184
  if (!m) continue;
16182
- n += m[2] ? Number(m[2]) - Number(m[1]) + 1 : 1;
16185
+ n2 += m[2] ? Number(m[2]) - Number(m[1]) + 1 : 1;
16183
16186
  }
16184
- return n;
16187
+ return n2;
16185
16188
  }
16186
16189
  function parseGitAiNote(commit, note) {
16187
16190
  const lines = note.replace(/\r\n/g, "\n").split("\n");
@@ -16303,7 +16306,7 @@ function detectProvenance(snap, m) {
16303
16306
  add({
16304
16307
  agent: GIT_AI_TOOL_TO_AGENT[lc(t.tool)] ?? t.tool,
16305
16308
  source: "git_ai",
16306
- detail: `${short3}: git-ai note, ${s.aiLines} AI line(s)${"model" in t && t.model ? `, ${t.model}` : ""}`
16309
+ detail: `${short3}: git-ai note, ${plural3(s.aiLines, "AI line")}${"model" in t && t.model ? `, ${t.model}` : ""}`
16307
16310
  });
16308
16311
  }
16309
16312
  }
@@ -16339,8 +16342,8 @@ function entropy(s) {
16339
16342
  const freq = /* @__PURE__ */ new Map();
16340
16343
  for (const ch of s) freq.set(ch, (freq.get(ch) ?? 0) + 1);
16341
16344
  let e = 0;
16342
- for (const n of freq.values()) {
16343
- const p = n / s.length;
16345
+ for (const n2 of freq.values()) {
16346
+ const p = n2 / s.length;
16344
16347
  e -= p * Math.log2(p);
16345
16348
  }
16346
16349
  return e;
@@ -16387,22 +16390,23 @@ function scanSecrets(files, policy) {
16387
16390
  function evaluateSize(files, policy) {
16388
16391
  const skip = [...policy.paths.lockfiles, ...policy.diff.exclude];
16389
16392
  const counted = files.filter((f) => !matchesAny(f.path, skip));
16390
- const lines = counted.reduce((n, f) => n + f.additions + f.deletions, 0);
16393
+ const lines = counted.reduce((n2, f) => n2 + f.additions + f.deletions, 0);
16391
16394
  const findings = [];
16392
16395
  const over = [];
16393
16396
  if (policy.diff.maxLines > 0 && lines > policy.diff.maxLines) over.push(`${lines} changed lines (limit ${policy.diff.maxLines})`);
16394
16397
  if (policy.diff.maxFiles > 0 && counted.length > policy.diff.maxFiles) over.push(`${counted.length} files (limit ${policy.diff.maxFiles})`);
16395
- if (over.length) findings.push({ id: "diff_too_large", title: "Diff is larger than the policy allows", detail: `${over.join(", ")}. Large agent PRs hide changes; split it.` });
16398
+ if (over.length) findings.push({ id: "diff_too_large", title: "Diff is larger than the policy allows", detail: `${over.join(", ")}. Split it so each part can be reviewed properly.` });
16396
16399
  return {
16397
16400
  files: files.length,
16398
- additions: files.reduce((n, f) => n + f.additions, 0),
16399
- deletions: files.reduce((n, f) => n + f.deletions, 0),
16401
+ additions: files.reduce((n2, f) => n2 + f.additions, 0),
16402
+ deletions: files.reduce((n2, f) => n2 + f.deletions, 0),
16400
16403
  counted: { files: counted.length, lines },
16401
16404
  findings
16402
16405
  };
16403
16406
  }
16404
16407
 
16405
16408
  // ../evidence/src/analyze/tamper.ts
16409
+ var plural4 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
16406
16410
  var LANG_RULES = {
16407
16411
  js: {
16408
16412
  testCase: /(?:^|[\s;(,])[xf]?(?:it|test)(?:\.[a-zA-Z]+)*\s*(?:\(|`)/,
@@ -16499,10 +16503,10 @@ function evaluateTamper(files, policy) {
16499
16503
  const unanalyzed = files.filter((f) => f.patch === void 0 && f.additions + f.deletions > 0).map((f) => f.path);
16500
16504
  const testStats = tests.map(analyzeTestFile).filter((s) => !!s);
16501
16505
  const net = {
16502
- assertions: testStats.reduce((n, s) => n + s.assertionsAdded - s.assertionsRemoved, 0),
16503
- cases: testStats.reduce((n, s) => n + s.casesAdded - s.casesRemoved, 0)
16506
+ assertions: testStats.reduce((n2, s) => n2 + s.assertionsAdded - s.assertionsRemoved, 0),
16507
+ cases: testStats.reduce((n2, s) => n2 + s.casesAdded - s.casesRemoved, 0)
16504
16508
  };
16505
- const addedTestCases = testStats.reduce((n, s) => n + s.casesAdded, 0);
16509
+ const addedTestCases = testStats.reduce((n2, s) => n2 + s.casesAdded, 0);
16506
16510
  const findings = [];
16507
16511
  const list5 = (xs) => xs.map((x) => `\`${x}\``).join(", ");
16508
16512
  if (touched2.workflows.length)
@@ -16521,13 +16525,13 @@ function evaluateTamper(files, policy) {
16521
16525
  findings.push({
16522
16526
  id: "tests_removed",
16523
16527
  title: "Fewer test cases than before",
16524
- detail: `Net ${net.cases} test case(s) across the diff. Per file: ${perFile((s) => s.casesAdded - s.casesRemoved)}.`
16528
+ detail: `Net ${plural4(net.cases, "test case")} across the diff. Per file: ${perFile((s) => s.casesAdded - s.casesRemoved)}.`
16525
16529
  });
16526
16530
  if (net.assertions < 0)
16527
16531
  findings.push({
16528
16532
  id: "assertions_dropped",
16529
16533
  title: "Assertion count dropped",
16530
- detail: `Net ${net.assertions} assertion(s) across test files. Per file: ${perFile((s) => s.assertionsAdded - s.assertionsRemoved)}.`
16534
+ detail: `Net ${plural4(net.assertions, "assertion")} across test files. Per file: ${perFile((s) => s.assertionsAdded - s.assertionsRemoved)}.`
16531
16535
  });
16532
16536
  const loc = (kind, pick2) => testStats.flatMap((s) => pick2(s).map((l) => ({ path: s.path, line: l.line, message: `${kind}: ${l.text.trim().slice(0, 160)}` })));
16533
16537
  const lineFinding = (id, title2, kind, pick2) => {
@@ -16536,14 +16540,14 @@ function evaluateTamper(files, policy) {
16536
16540
  findings.push({ id, title: title2, detail: locations.map((l) => `\`${l.path}:${l.line}\` ${l.message.slice(kind.length + 2)}`).join("\n"), locations });
16537
16541
  };
16538
16542
  lineFinding("skip_added", "Tests skipped", "skip added", (s) => s.skips);
16539
- lineFinding("focus_added", "Focused test added (.only / fit) \u2014 other tests in the file stop running", "focus added", (s) => s.focus);
16543
+ lineFinding("focus_added", "Focused test added (.only / fit) \u2014 the other tests in the file are skipped", "focus added", (s) => s.focus);
16540
16544
  lineFinding("assertions_commented_out", "Assertions commented out", "commented-out assertion", (s) => s.commentedOut);
16541
16545
  lineFinding("trivial_assertion_added", "Assertion that cannot fail", "trivial assertion", (s) => s.trivial);
16542
16546
  if (unanalyzed.length)
16543
16547
  findings.push({
16544
16548
  id: "diff_unanalyzed",
16545
- title: "Some files could not be analysed",
16546
- detail: `GitHub returned no patch for ${list5(unanalyzed)} (diff too large). Run with a full checkout to analyse them locally.`
16549
+ title: "Some files could not be analyzed",
16550
+ detail: `GitHub returned no patch for ${list5(unanalyzed)} (diff too large). Run with a full checkout (\`fetch-depth: 0\`) to analyze them locally.`
16547
16551
  });
16548
16552
  return { touched: touched2, testStats, net, addedTestCases, unanalyzed, findings };
16549
16553
  }
@@ -16606,15 +16610,15 @@ var FLAG_FIXES = {
16606
16610
  touched_workflows: "Have a human review the CI change, or move it to its own PR; agents should not edit what judges them.",
16607
16611
  touched_codeowners: "Have a code owner review the CODEOWNERS change in a separate, human-authored PR.",
16608
16612
  touched_lockfiles: "Check the dependency change is intended (`npm ci` / lockfile diff), or set `touched_lockfiles: off`.",
16609
- touched_tests: "Check each removed or rewritten test line is intended; keep the old assertions unless the behaviour changed.",
16613
+ touched_tests: "Check each removed or rewritten test line is intended; keep the old assertions unless the behavior changed.",
16610
16614
  touched_test_config: "Review the test-config change: coverage thresholds, excluded paths and test globs can switch tests off.",
16611
16615
  touched_policy: "Change `.mainfast.yml` in a separate, human-reviewed PR; this PR is judged by the base branch's policy anyway.",
16612
- tests_deleted: "Restore the deleted test file, or explain in the PR why the behaviour it covered is gone.",
16616
+ tests_deleted: "Restore the deleted test file, or explain in the PR why the behavior it covered is gone.",
16613
16617
  tests_removed: "Restore the removed test cases, or replace them with equivalent ones.",
16614
16618
  assertions_dropped: "Restore the dropped assertions; a test without them passes whatever the code does.",
16615
16619
  assertions_commented_out: "Uncomment the assertion and fix the code it was catching, or delete it on purpose with a reason.",
16616
16620
  skip_added: "Remove the skip marker and fix the test, or open an issue and link it next to the skip.",
16617
- focus_added: "Remove `.only` / `fit` / `fdescribe`; they stop every other test in the file.",
16621
+ focus_added: "Remove `.only` / `fit` / `fdescribe`; they make the runner skip every other test in the file.",
16618
16622
  trivial_assertion_added: "Replace the always-true assertion with one that checks the code's result.",
16619
16623
  claim_tests_added_unbacked: "Add the tests the description promises, or correct the description.",
16620
16624
  claim_tests_pass_unbacked: "Wait for the test checks on this commit to pass, or correct the description.",
@@ -16645,14 +16649,14 @@ var RestClient = class {
16645
16649
  }
16646
16650
  return out;
16647
16651
  }
16648
- getPull(o, r, n) {
16649
- return this.raw("GET", `/repos/${enc2(o)}/${enc2(r)}/pulls/${n}`).then((x) => x.data);
16652
+ getPull(o, r, n2) {
16653
+ return this.raw("GET", `/repos/${enc2(o)}/${enc2(r)}/pulls/${n2}`).then((x) => x.data);
16650
16654
  }
16651
- listPullCommits(o, r, n) {
16652
- return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/pulls/${n}/commits`, void 0, 250);
16655
+ listPullCommits(o, r, n2) {
16656
+ return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/pulls/${n2}/commits`, void 0, 250);
16653
16657
  }
16654
- listPullFiles(o, r, n) {
16655
- return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/pulls/${n}/files`);
16658
+ listPullFiles(o, r, n2) {
16659
+ return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/pulls/${n2}/files`);
16656
16660
  }
16657
16661
  listCheckRunsForRef(o, r, ref, checkName) {
16658
16662
  const q = checkName ? `?check_name=${enc2(checkName)}&filter=latest` : "?filter=latest";
@@ -16680,11 +16684,11 @@ var RestClient = class {
16680
16684
  return void 0;
16681
16685
  }
16682
16686
  }
16683
- listIssueComments(o, r, n) {
16684
- return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/issues/${n}/comments`);
16687
+ listIssueComments(o, r, n2) {
16688
+ return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/issues/${n2}/comments`);
16685
16689
  }
16686
- createIssueComment(o, r, n, body) {
16687
- return this.raw("POST", `/repos/${enc2(o)}/${enc2(r)}/issues/${n}/comments`, { body }).then((x) => x.data);
16690
+ createIssueComment(o, r, n2, body) {
16691
+ return this.raw("POST", `/repos/${enc2(o)}/${enc2(r)}/issues/${n2}/comments`, { body }).then((x) => x.data);
16688
16692
  }
16689
16693
  updateIssueComment(o, r, id, body) {
16690
16694
  return this.raw("PATCH", `/repos/${enc2(o)}/${enc2(r)}/issues/comments/${id}`, { body }).then((x) => x.data);
@@ -16776,7 +16780,7 @@ async function fetchRequired(api, owner, repo, branch) {
16776
16780
  const snap = await fetchRequiredSources(api.gh, owner, repo, branch, { rulesets: false });
16777
16781
  const set = resolveRequiredChecks({ classic: snap.classic, branchRules: snap.branchRules });
16778
16782
  const sources = [];
16779
- const rulesNote = snap.notes.some((n) => n.includes("/rules/branches/"));
16783
+ const rulesNote = snap.notes.some((n2) => n2.includes("/rules/branches/"));
16780
16784
  if (!rulesNote) {
16781
16785
  const any = snap.branchRules.some((r) => r.type === "required_status_checks" && (r.parameters?.required_status_checks ?? []).length > 0);
16782
16786
  sources.push(any ? "rulesets" : "rulesets (none required)");
@@ -16798,7 +16802,7 @@ async function collectSnapshot(api, repoFull, prNumber, policy, opts = {}) {
16798
16802
  fetchRequired(api, owner, repo, pr.baseRef)
16799
16803
  ]);
16800
16804
  const isTest = policy.testChecks.map(nameMatcher);
16801
- const headHasTests = [...headChecks.checkRuns.map((r) => r.name), ...headChecks.statuses.map((s) => s.context)].some((n) => isTest.some((m) => m(n)));
16805
+ const headHasTests = [...headChecks.checkRuns.map((r) => r.name), ...headChecks.statuses.map((s) => s.context)].some((n2) => isTest.some((m) => m(n2)));
16802
16806
  const previousChecks = [];
16803
16807
  if (!headHasTests) {
16804
16808
  const earlier = commits.filter((c) => c.sha !== pr.headSha).reverse().slice(0, opts.previousCommitsToCheck ?? 3);
@@ -16914,6 +16918,7 @@ function mdCell(s, max = MAX_INLINE) {
16914
16918
  }
16915
16919
 
16916
16920
  // ../evidence/src/render.ts
16921
+ var plural5 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
16917
16922
  var MAX_SUMMARY = 65e3;
16918
16923
  var MAX_CELL_ITEM = 200;
16919
16924
  var MAX_LIST = 20;
@@ -16961,9 +16966,9 @@ function testsCell(r, e = MD) {
16961
16966
  function requiredCell(r, e = MD) {
16962
16967
  const c = r.checks;
16963
16968
  if (!c.evaluated) return "not evaluated (offline)";
16964
- const unknown2 = c.notes.some((n) => /classic required checks unknown/.test(n)) ? " (classic protection unreadable; list them in `required_checks`)" : "";
16969
+ const unknown2 = c.notes.some((n2) => /classic required checks unknown/.test(n2)) ? " (could not read branch protection; list the checks in `required_checks`)" : "";
16965
16970
  if (!c.required.length)
16966
- return c.requiredSources.length ? `none configured${unknown2}` : "unknown (no ruleset/protection readable; set `required_checks`)";
16971
+ return c.requiredSources.length ? `none configured${unknown2}` : "unknown (could not read rulesets or branch protection; list the checks in `required_checks`)";
16967
16972
  const ok = c.required.filter((x) => x.state === "success").length;
16968
16973
  const bad = c.required.filter((x) => x.state !== "success").map((x) => `${e.t(x.context, MAX_CELL_ITEM)}: ${e.t(x.state, 40)}`);
16969
16974
  return `${ok}/${c.required.length} passed${bad.length ? ` \u2014 ${joinCapped(bad, ", ")}` : ""}${unknown2}`;
@@ -16974,7 +16979,7 @@ function coverageCell(r, e = MD) {
16974
16979
  if (!c.present) return "no report";
16975
16980
  const format = e.t(String(c.format), 40);
16976
16981
  if (c.pct === void 0) return `no instrumented changed lines (${format})`;
16977
- return `${c.pct}% (${c.covered}/${c.instrumented} changed lines, ${format})${c.notInReport.length ? `; ${c.notInReport.length} changed file(s) not in report` : ""}`;
16982
+ return `${c.pct}% (${c.covered}/${c.instrumented} changed lines, ${format})${c.notInReport.length ? `; ${plural5(c.notInReport.length, "changed file")} not in report` : ""}`;
16978
16983
  }
16979
16984
  function tamperCell(r) {
16980
16985
  const t = r.tamper.touched;
@@ -16988,8 +16993,8 @@ function tamperCell(r) {
16988
16993
  ].filter(([, v]) => v.length).map(([k, v]) => `${k} (${v.length})`);
16989
16994
  const w = [];
16990
16995
  const s = r.tamper.testStats;
16991
- const skips = s.reduce((n, x) => n + x.skips.length + x.focus.length, 0);
16992
- if (skips) w.push(`${skips} skip/focus marker(s)`);
16996
+ const skips = s.reduce((n2, x) => n2 + x.skips.length + x.focus.length, 0);
16997
+ if (skips) w.push(`${plural5(skips, "skip/focus marker")}`);
16993
16998
  if (r.tamper.net.assertions < 0) w.push(`assertions ${r.tamper.net.assertions}`);
16994
16999
  if (r.tamper.net.cases < 0) w.push(`test cases ${r.tamper.net.cases}`);
16995
17000
  return [...parts, ...w].join(", ") || "nothing sensitive touched";
@@ -17007,7 +17012,7 @@ function renderCard(r, opts = {}) {
17007
17012
  const checkUrl = safeUrl(opts.checkUrl);
17008
17013
  if (checkUrl) meta2.push(`[check run](${checkUrl})`);
17009
17014
  lines.push(meta2.join(" \xB7 "), "");
17010
- if (!r.applies) lines.push(`${mdText(r.appliesReason)}; this repository's policy gates agent PRs only (${mdCode("apply_to: all")} gates every PR).`, "");
17015
+ if (!r.applies) lines.push(`${mdText(r.appliesReason)}; this repository's policy checks agent PRs only (set ${mdCode("apply_to: all")} to check every PR).`, "");
17011
17016
  if (r.applies) {
17012
17017
  lines.push("| Evidence | On this commit |", "|---|---|");
17013
17018
  lines.push(`| Tests ran | ${testsCell(r)} |`);
@@ -17015,7 +17020,7 @@ function renderCard(r, opts = {}) {
17015
17020
  lines.push(`| Changed-line coverage | ${coverageCell(r)} |`);
17016
17021
  lines.push(`| Sensitive files / test weakening | ${tamperCell(r)} |`);
17017
17022
  lines.push(`| Description claims | ${claimsCell(r)} |`);
17018
- lines.push(`| Diff size | +${r.size.additions} \u2212${r.size.deletions} in ${r.size.files} file(s) |`);
17023
+ lines.push(`| Diff size | +${r.size.additions} \u2212${r.size.deletions} in ${plural5(r.size.files, "file")} |`);
17019
17024
  lines.push(`| Secret-like strings | ${r.secrets.length ? `${r.secrets.length} found` : "none"} |`, "");
17020
17025
  const section = (sev, heading) => {
17021
17026
  const fs = r.flags.filter((f) => f.severity === sev);
@@ -17042,7 +17047,7 @@ function renderCard(r, opts = {}) {
17042
17047
  }
17043
17048
  if (r.checks.notes.length) {
17044
17049
  lines.push("<details><summary>Not readable with this token</summary>", "");
17045
- for (const n of r.checks.notes.slice(0, 20)) lines.push(`- ${mdText(n)}`);
17050
+ for (const n2 of r.checks.notes.slice(0, 20)) lines.push(`- ${mdText(n2)}`);
17046
17051
  lines.push("", "</details>", "");
17047
17052
  }
17048
17053
  if (r.policyWarnings.length) {
@@ -17050,7 +17055,7 @@ function renderCard(r, opts = {}) {
17050
17055
  for (const w of r.policyWarnings.slice(0, 50)) lines.push(`- ${mdText(w)}`);
17051
17056
  lines.push("", "</details>", "");
17052
17057
  }
17053
- lines.push(`<sub>Evidence is for ${mdCode(r.pr.headSha, 80)} only and is re-evaluated on every push. Policy read from the base branch. [What is this?](${DOCS_URL})</sub>`);
17058
+ lines.push(`<sub>This evidence covers ${mdCode(r.pr.headSha, 80)} only and is re-evaluated on every push. The policy is read from the base branch. [What is this?](${DOCS_URL})</sub>`);
17054
17059
  const out = lines.join("\n");
17055
17060
  return out.length > MAX_SUMMARY ? `${out.slice(0, MAX_SUMMARY - 40)}
17056
17061
 
@@ -17061,7 +17066,7 @@ function renderText(r) {
17061
17066
  const out = [];
17062
17067
  out.push(`${PRODUCT_NAME}: ${badge(r)} \u2014 ${headline(r, (s) => e.t(s))}`);
17063
17068
  out.push(`head ${r.pr.headSha.slice(0, 7)} \xB7 ${r.provenance.agents.length ? r.provenance.agents.map((a) => e.t(a, 60)).join(", ") : "no agent detected"}`);
17064
- if (!r.applies) out.push(`${e.t(r.appliesReason)}; the policy gates agent PRs only (apply_to: all gates every PR).`);
17069
+ if (!r.applies) out.push(`${e.t(r.appliesReason)}; the policy checks agent PRs only (set apply_to: all to check every PR).`);
17065
17070
  if (r.applies) {
17066
17071
  const rows = [
17067
17072
  ["Tests ran", testsCell(r, e)],
@@ -17069,7 +17074,7 @@ function renderText(r) {
17069
17074
  ["Changed-line coverage", coverageCell(r, e)],
17070
17075
  ["Sensitive files", tamperCell(r)],
17071
17076
  ["Description claims", claimsCell(r, e)],
17072
- ["Diff size", `+${r.size.additions} \u2212${r.size.deletions} in ${r.size.files} file(s)`],
17077
+ ["Diff size", `+${r.size.additions} \u2212${r.size.deletions} in ${plural5(r.size.files, "file")}`],
17073
17078
  ["Secret-like strings", r.secrets.length ? `${r.secrets.length} found` : "none"]
17074
17079
  ];
17075
17080
  out.push("");
@@ -17093,7 +17098,7 @@ function renderText(r) {
17093
17098
  for (const s of p.signals.slice(0, 30)) out.push(` ${s.source}: ${e.t(s.detail)}`);
17094
17099
  if (p.humanCommits.length) out.push(` commits with no agent signal: ${joinCapped(p.humanCommits.map((s) => s.slice(0, 7)), ", ")}`);
17095
17100
  }
17096
- for (const n of r.checks.notes.slice(0, 20)) out.push(`note: ${e.t(n)}`);
17101
+ for (const n2 of r.checks.notes.slice(0, 20)) out.push(`note: ${e.t(n2)}`);
17097
17102
  for (const w of r.policyWarnings.slice(0, 50)) out.push(`policy warning: ${e.t(w)}`);
17098
17103
  return out.join("\n");
17099
17104
  }
@@ -17237,8 +17242,8 @@ function readGitAiNotes(cwd, shas, opts = {}) {
17237
17242
  if (opts.fetch) git2(cwd, ["fetch", "--quiet", "origin", `+${GIT_AI_NOTES_REF}:${GIT_AI_NOTES_REF}`], { allowFail: true });
17238
17243
  const notes = {};
17239
17244
  for (const sha of shas) {
17240
- const n = git2(cwd, ["notes", `--ref=${GIT_AI_NOTES_REF}`, "show", sha], { allowFail: true });
17241
- if (n.trim()) notes[sha] = n;
17245
+ const n2 = git2(cwd, ["notes", `--ref=${GIT_AI_NOTES_REF}`, "show", sha], { allowFail: true });
17246
+ if (n2.trim()) notes[sha] = n2;
17242
17247
  }
17243
17248
  return notes;
17244
17249
  }
@@ -17765,10 +17770,10 @@ function blame(a, path, lines) {
17765
17770
  if (m && inRange.has(m[1])) counts.set(m[1], (counts.get(m[1]) ?? 0) + 1);
17766
17771
  }
17767
17772
  let best;
17768
- let n = 0;
17769
- for (const [sha, c] of counts) if (c > n) {
17773
+ let n2 = 0;
17774
+ for (const [sha, c] of counts) if (c > n2) {
17770
17775
  best = sha;
17771
- n = c;
17776
+ n2 = c;
17772
17777
  }
17773
17778
  return best;
17774
17779
  }
@@ -18009,16 +18014,16 @@ function bagOf(lines) {
18009
18014
  }
18010
18015
  function subtract(a, b) {
18011
18016
  const out = /* @__PURE__ */ new Map();
18012
- for (const [t, n] of a) {
18013
- const d = n - (b.get(t) ?? 0);
18017
+ for (const [t, n2] of a) {
18018
+ const d = n2 - (b.get(t) ?? 0);
18014
18019
  if (d > 0) out.set(t, d);
18015
18020
  }
18016
18021
  return out;
18017
18022
  }
18018
18023
  function total(bag) {
18019
- let n = 0;
18020
- for (const v of bag.values()) n += v;
18021
- return n;
18024
+ let n2 = 0;
18025
+ for (const v of bag.values()) n2 += v;
18026
+ return n2;
18022
18027
  }
18023
18028
  function significant(line) {
18024
18029
  return /[A-Za-z0-9]/.test(line);
@@ -18070,15 +18075,15 @@ function isVersionOnly(h) {
18070
18075
  if (h.added.length === 0 || h.removed.length === 0) return false;
18071
18076
  const counts = /* @__PURE__ */ new Map();
18072
18077
  for (const line of h.removed) {
18073
- const n = normalize2(line);
18074
- counts.set(n, (counts.get(n) ?? 0) + 1);
18078
+ const n2 = normalize2(line);
18079
+ counts.set(n2, (counts.get(n2) ?? 0) + 1);
18075
18080
  }
18076
18081
  let paired = 0;
18077
18082
  for (const line of h.added) {
18078
- const n = normalize2(line);
18079
- const left = counts.get(n) ?? 0;
18080
- if (left > 0 && n.includes(PLACEHOLDER2)) {
18081
- counts.set(n, left - 1);
18083
+ const n2 = normalize2(line);
18084
+ const left = counts.get(n2) ?? 0;
18085
+ if (left > 0 && n2.includes(PLACEHOLDER2)) {
18086
+ counts.set(n2, left - 1);
18082
18087
  paired++;
18083
18088
  }
18084
18089
  }
@@ -18106,6 +18111,7 @@ function isGenerated(git4, rev, path) {
18106
18111
  }
18107
18112
 
18108
18113
  // ../intact/src/analyze.ts
18114
+ var plural6 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
18109
18115
  var EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
18110
18116
  var WINDOW = 2;
18111
18117
  var PARTIAL_THRESHOLD = 0.2;
@@ -18168,7 +18174,7 @@ function analyzeTwoParent(git4, report, opts) {
18168
18174
  report.changedFromAutoMerge = relevant.map(filePath).sort();
18169
18175
  report.conflictedFiles = [...auto.conflicted].filter((p) => !isIgnored(config2, p)).sort();
18170
18176
  const ignoredCount = auto.files.length - relevant.length;
18171
- if (ignoredCount > 0) report.notes.push(`${ignoredCount} file(s) differing from the automatic merge are ignored by config`);
18177
+ if (ignoredCount > 0) report.notes.push(`${plural6(ignoredCount, "file")} differing from the automatic merge are ignored by config`);
18172
18178
  if (relevant.length === 0) {
18173
18179
  report.status = "clean";
18174
18180
  return;
@@ -18359,9 +18365,9 @@ function judgeHunk(h, blocks, ps, mLines) {
18359
18365
  const psBag = bagOf(ps.slice(Math.max(0, psFrom - WINDOW), psTo + WINDOW));
18360
18366
  const mBag = bagOf(mLines.slice(Math.max(0, mFrom - WINDOW), mTo + WINDOW));
18361
18367
  let missing = 0;
18362
- for (const [t, n] of addTok) missing += Math.min(n, Math.max(0, (psBag.get(t) ?? 0) - (mBag.get(t) ?? 0)));
18368
+ for (const [t, n2] of addTok) missing += Math.min(n2, Math.max(0, (psBag.get(t) ?? 0) - (mBag.get(t) ?? 0)));
18363
18369
  let restored = 0;
18364
- for (const [t, n] of remTok) restored += Math.min(n, Math.max(0, (mBag.get(t) ?? 0) - (psBag.get(t) ?? 0)));
18370
+ for (const [t, n2] of remTok) restored += Math.min(n2, Math.max(0, (mBag.get(t) ?? 0) - (psBag.get(t) ?? 0)));
18365
18371
  const sigAdded = h.added.some(significant);
18366
18372
  const sigRemoved = h.removed.some(significant);
18367
18373
  if (A > 0 && sigAdded) {
@@ -18625,6 +18631,7 @@ var STATUS_LABEL = {
18625
18631
  "not-a-merge": "skip not a merge commit",
18626
18632
  error: "ERROR analysis failed"
18627
18633
  };
18634
+ var n = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
18628
18635
  function lineRef(f) {
18629
18636
  if (!f.mergeLines) return f.path;
18630
18637
  const { start, end } = f.mergeLines;
@@ -18674,14 +18681,14 @@ function formatMerge(m) {
18674
18681
  if (m.strategy) facts.push(`via ${m.strategy}`);
18675
18682
  out.push(` ${facts.join(", ")}`);
18676
18683
  if (m.conflictedFiles.length) out.push(` conflicted: ${m.conflictedFiles.join(", ")}`);
18677
- for (const n of m.notes) out.push(` note: ${n}`);
18684
+ for (const n2 of m.notes) out.push(` note: ${n2}`);
18678
18685
  if (m.error) out.push(` error: ${m.error}`);
18679
18686
  for (const g of groupFindings(m.findings)) {
18680
18687
  out.push(...formatFinding(g[0]));
18681
18688
  if (g.length > 1) {
18682
18689
  const refs = g.slice(1).map((f) => f.mergeLines ? String(f.mergeLines.start) : "file");
18683
18690
  const shown = refs.slice(0, 30).join(", ") + (refs.length > 30 ? `, ... (${refs.length - 30} more)` : "");
18684
- out.push(` and ${g.length - 1} more ${g[0].kind} hunk${g.length === 2 ? "" : "s"} like it in ${g[0].path} at line ${shown}`);
18691
+ out.push(` and ${g.length - 1} more ${g[0].kind} hunk${g.length === 2 ? "" : "s"} like it in ${g[0].path} at line${refs.length === 1 ? "" : "s"} ${shown}`);
18685
18692
  out.push(` (a resolution that took one side's whole file looks like this; --json lists every hunk)`);
18686
18693
  }
18687
18694
  }
@@ -18718,7 +18725,7 @@ function formatHuman(r) {
18718
18725
  }
18719
18726
  const s = r.summary;
18720
18727
  out.push(
18721
- `summary: ${s.clean} clean, ${s.conflictResolution} resolved, ${s.withFindings} with findings${s.unsupported ? `, ${s.unsupported} unsupported` : ""}${s.errors ? `, ${s.errors} errors` : ""} | ${s.findings.error} error, ${s.findings.warning} warning, ${s.findings.notice} notice`
18728
+ `summary: ${s.clean} clean, ${s.conflictResolution} resolved, ${s.withFindings} with findings${s.unsupported ? `, ${s.unsupported} unsupported` : ""}${s.errors ? `, ${s.errors} failed to analyze` : ""} | ${n(s.findings.error, "error")}, ${n(s.findings.warning, "warning")}, ${n(s.findings.notice, "notice")}`
18722
18729
  );
18723
18730
  return out.join("\n") + "\n";
18724
18731
  }
@@ -18733,14 +18740,14 @@ usage:
18733
18740
 
18734
18741
  options:
18735
18742
  --range A..B check every merge commit in the range
18736
- --main <branch> main branch (default: config main_branch, origin/HEAD, main, master)
18743
+ --main <branch> the main branch (default: config main_branch, origin/HEAD, main, master)
18737
18744
  --config <path> config file (default: ${BRAND.configFile} at the repo root). An
18738
18745
  owner/repo extends is read with GITHUB_TOKEN or GH_TOKEN when set
18739
18746
  --json machine-readable report on stdout
18740
18747
  --fail-on <level> lowest level that makes the exit code 1: error, warning (default), notice
18741
18748
  --strategy <name> force remerge-diff, merge-tree or worktree (default: by git version)
18742
18749
  -C <dir> run in <dir>
18743
- -h, --help this help
18750
+ -h, --help show this help
18744
18751
  -v, --version print the version
18745
18752
 
18746
18753
  exit codes: 0 clean, 1 findings, 2 error
@@ -18786,13 +18793,13 @@ function parseArgs2(argv) {
18786
18793
  break;
18787
18794
  case "--fail-on": {
18788
18795
  const v = value();
18789
- if (!LEVELS.includes(v) || v === "off") throw new UsageError(`--fail-on must be error, warning or notice`);
18796
+ if (!LEVELS.includes(v) || v === "off") throw new UsageError(`--fail-on: expected error, warning or notice`);
18790
18797
  p.failOn = v;
18791
18798
  break;
18792
18799
  }
18793
18800
  case "--strategy": {
18794
18801
  const v = value();
18795
- if (v !== "remerge-diff" && v !== "merge-tree" && v !== "worktree") throw new UsageError(`unknown strategy: ${v}`);
18802
+ if (v !== "remerge-diff" && v !== "merge-tree" && v !== "worktree") throw new UsageError(`unknown strategy: ${v} (expected remerge-diff, merge-tree or worktree)`);
18796
18803
  p.strategy = v;
18797
18804
  break;
18798
18805
  }
@@ -19125,13 +19132,13 @@ var alembic = {
19125
19132
  const referenced = new Set(revs.flatMap((r) => r.parents));
19126
19133
  const heads = revs.filter((r) => !referenced.has(r.revision));
19127
19134
  if (heads.length > 1) {
19128
- const labelled = revs.some((r) => r.branchLabels);
19135
+ const labeled = revs.some((r) => r.branchLabels);
19129
19136
  findings.push({
19130
19137
  framework: "alembic",
19131
19138
  root,
19132
19139
  code: "multiple-heads",
19133
- severity: labelled ? "warning" : "error",
19134
- message: `${heads.length} heads: ${heads.map((h) => `${h.revision} (${basename(h.path)})`).join(", ")}. \`alembic upgrade head\` will refuse to run.` + (labelled ? " Some revisions carry branch_labels, so this may be an intentional multi-branch ledger." : ""),
19140
+ severity: labeled ? "warning" : "error",
19141
+ message: `${heads.length} heads: ${heads.map((h) => `${h.revision} (${basename(h.path)})`).join(", ")}. \`alembic upgrade head\` will refuse to run.` + (labeled ? " Some revisions set branch_labels, so the multiple heads may be intended." : ""),
19135
19142
  files: heads.map((h) => h.path),
19136
19143
  hint: `alembic merge -m "merge heads" ${heads.map((h) => h.revision).join(" ")} (or re-parent the branch's revision onto main's head)`,
19137
19144
  // keyed on the count so a PR that adds a third head to a two-head main is still reported
@@ -19203,7 +19210,7 @@ var django = {
19203
19210
  const migs = migrations(tree, root);
19204
19211
  const app = migs[0]?.app ?? basename(dirname(root));
19205
19212
  const findings = [];
19206
- const names = new Set(migs.flatMap((m) => [m.name, ...m.replaces.filter(([a]) => a === app).map(([, n]) => n)]));
19213
+ const names = new Set(migs.flatMap((m) => [m.name, ...m.replaces.filter(([a]) => a === app).map(([, n2]) => n2)]));
19207
19214
  for (const [num2, list5] of groupBy(migs, (m) => m.number)) {
19208
19215
  if (list5.length > 1 && /^\d{4}$/.test(num2))
19209
19216
  findings.push({
@@ -19234,13 +19241,13 @@ var django = {
19234
19241
  }
19235
19242
  }
19236
19243
  const dependedOn = /* @__PURE__ */ new Set();
19237
- for (const m of migs) for (const [a, n] of m.deps) if (a === app) dependedOn.add(n);
19244
+ for (const m of migs) for (const [a, n2] of m.deps) if (a === app) dependedOn.add(n2);
19238
19245
  for (const m of migs) {
19239
19246
  if (!m.replaces.length) continue;
19240
- const replaced = m.replaces.filter(([a]) => a === app).map(([, n]) => n);
19241
- if (replaced.some((n) => dependedOn.has(n))) dependedOn.add(m.name);
19242
- if (dependedOn.has(m.name)) replaced.forEach((n) => dependedOn.add(n));
19243
- replaced.forEach((n) => dependedOn.add(n));
19247
+ const replaced = m.replaces.filter(([a]) => a === app).map(([, n2]) => n2);
19248
+ if (replaced.some((n2) => dependedOn.has(n2))) dependedOn.add(m.name);
19249
+ if (dependedOn.has(m.name)) replaced.forEach((n2) => dependedOn.add(n2));
19250
+ replaced.forEach((n2) => dependedOn.add(n2));
19244
19251
  }
19245
19252
  const leaves = migs.filter((m) => !dependedOn.has(m.name));
19246
19253
  if (leaves.length > 1)
@@ -19259,6 +19266,7 @@ var django = {
19259
19266
  };
19260
19267
 
19261
19268
  // ../migrations/src/frameworks/drizzle.ts
19269
+ var plural7 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
19262
19270
  var ZERO_ID = "00000000-0000-0000-0000-000000000000";
19263
19271
  function parseJournal(text) {
19264
19272
  if (text === void 0) return void 0;
@@ -19298,7 +19306,7 @@ var drizzle = {
19298
19306
  root,
19299
19307
  code: "journal-unreadable",
19300
19308
  severity: "error",
19301
- message: `${jp} is missing or is not valid JSON (unresolved merge markers?)`,
19309
+ message: `${jp} is missing or is not valid JSON (check for leftover merge conflict markers)`,
19302
19310
  files: [jp],
19303
19311
  hint: "Resolve the journal: union the entries by tag and re-index idx sequentially.",
19304
19312
  key: `drizzle:${root}:unreadable`
@@ -19426,7 +19434,7 @@ var drizzle = {
19426
19434
  root: ctx.root,
19427
19435
  code: "journal-fork",
19428
19436
  severity,
19429
- message: `main added ${mainAdded.length} migration(s) since this branch forked (${missingFromHead.map((e) => e.tag).join(", ")}) and the branch added ${headAdded.length} (${headAdded.map((e) => e.tag).join(", ")}). The branch's snapshot was generated against a schema that is no longer main's.`,
19437
+ message: `main added ${plural7(mainAdded.length, "migration")} since this branch forked (${missingFromHead.map((e) => e.tag).join(", ")}) and the branch added ${headAdded.length} (${headAdded.map((e) => e.tag).join(", ")}). The branch's snapshot was generated against a schema that is no longer main's.`,
19430
19438
  files: [jp],
19431
19439
  hint: "Merge main, union the journal entries by tag, re-index idx sequentially, and fix the branch snapshot's single prevId (or delete the branch migration and re-run drizzle-kit generate).",
19432
19440
  key: `drizzle:${ctx.root}:journal-fork`
@@ -19557,17 +19565,17 @@ var rails = {
19557
19565
  key: `rails:${root}:dupver:${v}`
19558
19566
  });
19559
19567
  }
19560
- for (const [n, l] of groupBy(migs, (m) => m.name)) {
19568
+ for (const [n2, l] of groupBy(migs, (m) => m.name)) {
19561
19569
  if (l.length > 1)
19562
19570
  findings.push({
19563
19571
  framework: "rails",
19564
19572
  root,
19565
19573
  code: "duplicate-name",
19566
19574
  severity: "error",
19567
- message: `${l.length} migrations are named ${n}; Rails raises DuplicateMigrationNameError`,
19575
+ message: `${l.length} migrations are named ${n2}; Rails raises DuplicateMigrationNameError`,
19568
19576
  files: l.map((m) => m.path),
19569
19577
  hint: "Rename the branch migration (file and class).",
19570
- key: `rails:${root}:dupname:${n}`
19578
+ key: `rails:${root}:dupname:${n2}`
19571
19579
  });
19572
19580
  }
19573
19581
  return findings;
@@ -19761,6 +19769,7 @@ function analyzeTrees(opts) {
19761
19769
  }
19762
19770
 
19763
19771
  // ../migrations/src/report.ts
19772
+ var plural8 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
19764
19773
  var short = (sha) => sha.slice(0, 7);
19765
19774
  var icon = (f) => f.severity === "error" ? "error" : "warning";
19766
19775
  function toMarkdown(r, opts = {}) {
@@ -19770,11 +19779,11 @@ function toMarkdown(r, opts = {}) {
19770
19779
  lines.push(`### ${opts.title ?? PRODUCT}`);
19771
19780
  lines.push("");
19772
19781
  if (!r.roots.length) {
19773
- lines.push("No migration ledgers found.");
19782
+ lines.push("No migrations found for a supported framework.");
19774
19783
  return lines.join("\n");
19775
19784
  }
19776
19785
  lines.push(
19777
- r.findings.length ? `**${errors2} error(s), ${warnings} warning(s)** merging ${mdCode(r.head.ref, 200)} (${short(r.head.sha)}) into ${mdCode(r.main.ref, 200)} (${short(r.main.sha)}).` : `Migration ledgers stay consistent after merging ${mdCode(r.head.ref, 200)} (${short(r.head.sha)}) into ${mdCode(r.main.ref, 200)} (${short(r.main.sha)}).`
19786
+ r.findings.length ? `**${plural8(errors2, "error")}, ${plural8(warnings, "warning")}** merging ${mdCode(r.head.ref, 200)} (${short(r.head.sha)}) into ${mdCode(r.main.ref, 200)} (${short(r.main.sha)}).` : `Migrations stay consistent after merging ${mdCode(r.head.ref, 200)} (${short(r.head.sha)}) into ${mdCode(r.main.ref, 200)} (${short(r.main.sha)}).`
19778
19787
  );
19779
19788
  lines.push("");
19780
19789
  if (r.findings.length) {
@@ -19787,7 +19796,7 @@ function toMarkdown(r, opts = {}) {
19787
19796
  lines.push("");
19788
19797
  }
19789
19798
  lines.push(
19790
- `<details><summary>Ledgers checked (${r.roots.length})</summary>
19799
+ `<details><summary>Migration directories checked (${r.roots.length})</summary>
19791
19800
 
19792
19801
  ` + r.roots.map((x) => `- ${x.framework}: ${mdCode(x.root, 200)}${x.touched ? " (changed in this PR)" : ""}`).join("\n") + (r.preExisting.length ? `
19793
19802
 
@@ -19813,6 +19822,7 @@ function toText(r) {
19813
19822
  }
19814
19823
 
19815
19824
  // ../migrations/src/publish.ts
19825
+ var plural9 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
19816
19826
  async function publish2(report, o) {
19817
19827
  const stale = !report.ok;
19818
19828
  const base = `/repos/${o.owner}/${o.repo}`;
@@ -19854,7 +19864,7 @@ Resolved: migrations are consistent with ${mdCode(report.main.ref)} at ${report.
19854
19864
  await o.gh.request("POST", `${base}/statuses/${report.head.sha}`, {
19855
19865
  state,
19856
19866
  context: STATUS_CONTEXT,
19857
- description: (stale ? `${errors2} migration error(s) against ${report.main.ref}` : `Migrations consistent with ${report.main.ref}`).slice(0, 140),
19867
+ description: (stale ? `${plural9(errors2, "migration error")} against ${report.main.ref}` : `Migrations consistent with ${report.main.ref}`).slice(0, 140),
19858
19868
  target_url: o.targetUrl
19859
19869
  });
19860
19870
  result.status = state;
@@ -19863,8 +19873,9 @@ Resolved: migrations are consistent with ${mdCode(report.main.ref)} at ${report.
19863
19873
  }
19864
19874
 
19865
19875
  // ../migrations/src/recheck.ts
19876
+ var plural10 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
19866
19877
  var MAIN_REF = "refs/mainfast/main";
19867
- var prRef = (n) => `refs/mainfast/pr/${n}`;
19878
+ var prRef = (n2) => `refs/mainfast/pr/${n2}`;
19868
19879
  async function recheckOpenPrs(o) {
19869
19880
  const remote = o.remote ?? "origin";
19870
19881
  const pulls = (await o.gh.paginate(
@@ -19874,7 +19885,7 @@ async function recheckOpenPrs(o) {
19874
19885
  if (!o.noFetch) {
19875
19886
  const fetch2 = (specs) => git3(o.repoDir, ["fetch", "--no-tags", "--quiet", remote, ...specs]);
19876
19887
  const mainSpec = `+refs/heads/${o.mainBranch}:${MAIN_REF}`;
19877
- const prSpec = (n) => `+refs/pull/${n}/head:${prRef(n)}`;
19888
+ const prSpec = (n2) => `+refs/pull/${n2}/head:${prRef(n2)}`;
19878
19889
  try {
19879
19890
  fetch2([mainSpec, ...pulls.map((p) => prSpec(p.number))]);
19880
19891
  } catch {
@@ -19931,7 +19942,7 @@ function recheckMarkdown(entries, mainBranch) {
19931
19942
  const lines = [
19932
19943
  `### Open PRs re-checked against ${mdCode(mainBranch)}`,
19933
19944
  "",
19934
- `${entries.length} open PR(s) checked, ${stale.length} stale.`,
19945
+ `${plural10(entries.length, "open PR")} checked, ${stale.length} stale.`,
19935
19946
  ""
19936
19947
  ];
19937
19948
  if (entries.length) {
@@ -20013,7 +20024,7 @@ async function main3(argv) {
20013
20024
  console.log(values.format === "json" ? JSON.stringify(entries, null, 2) : recheckMarkdown(entries, values["main-branch"]));
20014
20025
  return 0;
20015
20026
  }
20016
- console.error(`unknown command ${cmd}
20027
+ console.error(`unknown command: ${cmd}
20017
20028
 
20018
20029
  ${USAGE2}`);
20019
20030
  return 2;
@@ -20318,12 +20329,12 @@ var OwnersApi = class {
20318
20329
  });
20319
20330
  }
20320
20331
  /** GET /repos/{o}/{r}/pulls/{n}. */
20321
- pull(n) {
20322
- return this.memo(`pull:${n}`, () => this.gh.get(`${this.base}/pulls/${n}`));
20332
+ pull(n2) {
20333
+ return this.memo(`pull:${n2}`, () => this.gh.get(`${this.base}/pulls/${n2}`));
20323
20334
  }
20324
20335
  /** GET /repos/{o}/{r}/pulls/{n}/files (paginated, capped by GitHub at 3000 files). */
20325
- prFiles(n) {
20326
- return this.memo(`files:${n}`, () => this.gh.paginate(`${this.base}/pulls/${n}/files?per_page=100`));
20336
+ prFiles(n2) {
20337
+ return this.memo(`files:${n2}`, () => this.gh.paginate(`${this.base}/pulls/${n2}/files?per_page=100`));
20327
20338
  }
20328
20339
  /** GET /repos/{o}/{r}/git/trees/{ref}?recursive=1 -> blob paths. */
20329
20340
  treePaths(ref) {
@@ -20431,9 +20442,9 @@ function level(key2, v) {
20431
20442
  return s;
20432
20443
  }
20433
20444
  function wholeNumber(key2, v, min, max) {
20434
- const n = Number(v);
20435
- if (v === "" || v === null || typeof v === "boolean" || !Number.isInteger(n) || n < min || n > max) throw new Error(`${key2}: expected a whole number ${min}..${max}`);
20436
- return n;
20445
+ const n2 = Number(v);
20446
+ if (v === "" || v === null || typeof v === "boolean" || !Number.isInteger(n2) || n2 < min || n2 > max) throw new Error(`${key2}: expected a whole number ${min}..${max}`);
20447
+ return n2;
20437
20448
  }
20438
20449
  function fromSection(raw) {
20439
20450
  const cfg = { ...DEFAULT_CONFIG2 };
@@ -20467,6 +20478,7 @@ function configFromDoc2(doc) {
20467
20478
  }
20468
20479
 
20469
20480
  // ../owners/src/audit.ts
20481
+ var plural11 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
20470
20482
  var FIXES = {
20471
20483
  "unowned-files": "Add a CODEOWNERS line for these paths (see the suggested lines), or list them under `owners.ignore`.",
20472
20484
  "unknown-user": "The account was deleted or renamed: put the current login or a team in its place.",
@@ -20664,7 +20676,7 @@ var ownersIn = (rules) => rules.flatMap((r) => r.owners);
20664
20676
  function orgNote(org, checker, api) {
20665
20677
  const { usersUnchecked: u, teamsUnchecked: t } = checker;
20666
20678
  if (!u && !t) return void 0;
20667
- const what = [t ? `${t} team owner(s) (existence and write access)` : "", u ? `org membership of ${u} user owner(s)` : ""].filter(Boolean).join(" and ");
20679
+ const what = [t ? `${plural11(t, "team owner")} (existence and write access)` : "", u ? `org membership of ${plural11(u, "user owner")}` : ""].filter(Boolean).join(" and ");
20668
20680
  const why = org === "refused" ? `the \`org-token\` was refused (${api.orgRefusal ?? "error"}); it needs Organization \u2192 Members: read for ${api.owner}` : "this needs a token with Organization \u2192 Members: read, which GITHUB_TOKEN cannot have; pass one as `org-token`";
20669
20681
  return `Not checked: ${what}: ${why}. Unchecked teams count as valid owners; user owners were still checked for existence and write access.`;
20670
20682
  }
@@ -20682,9 +20694,9 @@ async function dormancy(statuses, api, cfg, days, now, org) {
20682
20694
  let total2 = 0;
20683
20695
  let complete = true;
20684
20696
  for (const m of members2) {
20685
- const n = await api.reviewsSince(m, since);
20686
- if (n === void 0) complete = false;
20687
- else total2 += n;
20697
+ const n2 = await api.reviewsSince(m, since);
20698
+ if (n2 === void 0) complete = false;
20699
+ else total2 += n2;
20688
20700
  if (total2 > 0) break;
20689
20701
  }
20690
20702
  st.reviews = total2 > 0 || complete ? total2 : void 0;
@@ -20769,13 +20781,13 @@ async function auditOwners(input) {
20769
20781
  code: "unowned-files",
20770
20782
  severity: cfg.requireOwners ? "error" : "warning",
20771
20783
  scope: "current",
20772
- message: `${unowned.length} changed file(s) have no code owner in \`${co.path}\` on \`${input.ref ?? "the base branch"}\` (the file GitHub uses to request reviews)`,
20784
+ message: `${plural11(unowned.length, "changed file")} ${unowned.length === 1 ? "has" : "have"} no code owner in \`${co.path}\` on \`${input.ref ?? "the base branch"}\` (the file GitHub uses to request reviews)`,
20773
20785
  paths: unowned
20774
20786
  } : {
20775
20787
  code: "unowned-files",
20776
20788
  severity: "warning",
20777
20789
  scope: "current",
20778
- message: `${unowned.length} of ${needOwners.length} tracked files have no code owner; largest gaps: ${dirsOf(unowned).slice(0, 5).map(([d, n]) => `\`${d}\` (${n})`).join(", ")}`,
20790
+ message: `${unowned.length} of ${needOwners.length} tracked files have no code owner; largest gaps: ${dirsOf(unowned).slice(0, 5).map(([d, n2]) => `\`${d}\` (${n2})`).join(", ")}`,
20779
20791
  paths: unowned.slice(0, 200)
20780
20792
  }
20781
20793
  );
@@ -20826,14 +20838,14 @@ async function auditOwners(input) {
20826
20838
  report.orgChecks = "untrusted-pr";
20827
20839
  if (checker.publicOnly)
20828
20840
  notes.push(
20829
- `This PR comes from a fork or from an author without write access, so owners were checked for public account existence only: team, org membership and repository access checks (and GitHub's own CODEOWNERS errors) would show private org data to the PR author. ${checker.publicOnly} owner(s) count as valid here; the scheduled audit checks them in full.`
20841
+ `This PR comes from a fork or from an author without write access, so owners were checked for public account existence only: team, org membership and repository access checks (and GitHub's own CODEOWNERS errors) would show private org data to the PR author. ${plural11(checker.publicOnly, "owner")} count as valid here; the scheduled audit checks them in full.`
20830
20842
  );
20831
20843
  report.owners = [...checker.statuses.values()];
20832
20844
  } else if (checker && api) {
20833
20845
  report.orgChecks = await api.orgChecks();
20834
20846
  const note = orgNote(report.orgChecks, checker, api);
20835
20847
  if (note) notes.push(note);
20836
- if (checker.permUnknown) notes.push(`Repository permission of ${checker.permUnknown} user owner(s) could not be read (403); they count as valid.`);
20848
+ if (checker.permUnknown) notes.push(`Repository permission of ${plural11(checker.permUnknown, "user owner")} could not be read (403); they count as valid.`);
20837
20849
  if (co && days > 0) {
20838
20850
  const sts = [...new Set(ownersIn(co.rules).map(key))].map((k) => checker.statuses.get(k)).filter((s) => !!s);
20839
20851
  await dormancy(sts, api, cfg, days, now, report.orgChecks);
@@ -20842,7 +20854,7 @@ async function auditOwners(input) {
20842
20854
  if (report.dormancy.capped) {
20843
20855
  const total2 = sts.filter((s) => s.reviews !== void 0).length;
20844
20856
  notes.push(
20845
- `Dormancy checked for ${total2} of ${total2 + report.dormancy.skipped} owner(s): stopped after ${report.dormancy.searches} search request(s) (${api.searchStop ?? `owners.maxSearches is ${cfg.maxSearches}`}). The order rotates weekly, so the next runs cover the rest.`
20857
+ `Dormancy checked for ${total2} of ${plural11(total2 + report.dormancy.skipped, "owner")}: stopped after ${plural11(report.dormancy.searches, "search request")} (${api.searchStop ?? `owners.maxSearches is ${cfg.maxSearches}`}). The order rotates weekly, so the next runs cover the rest.`
20846
20858
  );
20847
20859
  }
20848
20860
  if (cfg.expandTeams && report.orgChecks !== "enabled" && sts.some((s) => s.kind === "team"))
@@ -20913,6 +20925,7 @@ async function loadConfigFromRepo(gh, owner, repo, ref) {
20913
20925
  }
20914
20926
 
20915
20927
  // ../owners/src/report.ts
20928
+ var plural12 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
20916
20929
  var MAX_PATHS = 50;
20917
20930
  var MAX_ROWS = 100;
20918
20931
  var MAX_MD = 65e3;
@@ -20936,15 +20949,15 @@ function headline2(r) {
20936
20949
  const current = r.findings.filter((f) => f.scope === "current");
20937
20950
  const proposed = r.findings.filter((f) => f.scope === "proposed");
20938
20951
  if (r.mode === "pr") {
20939
- const files = r.unowned.length ? `${r.unowned.length} of ${r.checkedFiles} changed file(s) have no code owner` : "every changed file has a code owner";
20952
+ const files = r.unowned.length ? `${r.unowned.length} of ${plural12(r.checkedFiles, "changed file")} ${r.unowned.length === 1 ? "has" : "have"} no code owner` : "every changed file has a code owner";
20940
20953
  const pe = errors(proposed);
20941
20954
  const pw = proposed.length - pe;
20942
- const p = r.proposed ? proposed.length ? `; this PR's CODEOWNERS: ${pe} error(s), ${pw} warning(s)` : "; this PR's CODEOWNERS looks right" : "";
20955
+ const p = r.proposed ? proposed.length ? `; this PR's CODEOWNERS: ${plural12(pe, "error")}, ${plural12(pw, "warning")}` : "; this PR's CODEOWNERS looks right" : "";
20943
20956
  return plainText(`${files}${p}`, 255, true);
20944
20957
  }
20945
20958
  const e = errors(current);
20946
20959
  return plainText(
20947
- current.length ? `${e} error(s), ${current.length - e} warning(s) in ${r.codeownersPath ?? "CODEOWNERS"}` : `${r.codeownersPath ?? "CODEOWNERS"} is healthy`,
20960
+ current.length ? `${plural12(e, "error")}, ${plural12(current.length - e, "warning")} in ${r.codeownersPath ?? "CODEOWNERS"}` : `${r.codeownersPath ?? "CODEOWNERS"} is healthy`,
20948
20961
  255,
20949
20962
  true
20950
20963
  );
@@ -20983,7 +20996,7 @@ function toMarkdown2(r, o = {}) {
20983
20996
  out.push(`#### This PR's CODEOWNERS (${where})`, "");
20984
20997
  out.push(...proposed.length ? table(proposed) : ["No problems found: valid syntax, every owner can review, no dead or shadowed lines."], "");
20985
20998
  }
20986
- if (r.notes.length) out.push("**Not checked / notes**", "", ...r.notes.map((n) => `- ${mdCell(n, 1e3)}`), "");
20999
+ if (r.notes.length) out.push("**Notes**", "", ...r.notes.map((n2) => `- ${mdCell(n2, 1e3)}`), "");
20987
21000
  const run = safeUrl(o.runUrl);
20988
21001
  out.push(`${run ? `[run](${run}) \xB7 ` : ""}[docs](${DOCS_URL3})`);
20989
21002
  const md = out.join("\n");
@@ -20999,7 +21012,7 @@ function toText2(r) {
20999
21012
  if (f.code === "unowned-files" && f.paths) for (const p of f.paths.slice(0, MAX_PATHS)) out.push(` ${t(p)}`);
21000
21013
  if (f.hint) out.push(t(` fix: ${f.hint}`));
21001
21014
  }
21002
- for (const n of r.notes) out.push(t(`note: ${n}`));
21015
+ for (const n2 of r.notes) out.push(t(`note: ${n2}`));
21003
21016
  out.push(r.ok ? "ok" : "FAILED");
21004
21017
  return out.join("\n");
21005
21018
  }
@@ -21083,9 +21096,9 @@ async function main4(argv) {
21083
21096
  const probe = new OwnersApi(gh, owner, repo);
21084
21097
  let loadedPr;
21085
21098
  if (cmd === "pr") {
21086
- const n = Number(values.pr);
21087
- if (!Number.isInteger(n) || n <= 0) throw new Error("pr needs --pr N");
21088
- loadedPr = await probe.pull(n);
21099
+ const n2 = Number(values.pr);
21100
+ if (!Number.isInteger(n2) || n2 <= 0) throw new Error("pr needs --pr N");
21101
+ loadedPr = await probe.pull(n2);
21089
21102
  }
21090
21103
  const baseRef = loadedPr ? loadedPr.base.ref : values.ref ?? await probe.defaultBranch();
21091
21104
  config2 ??= (await loadConfigFromRepo(gh, owner, repo, baseRef)).cfg;
@@ -21382,6 +21395,7 @@ function branchAllowed(t, branch) {
21382
21395
  }
21383
21396
 
21384
21397
  // ../rollcall/src/audit.ts
21398
+ var plural13 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
21385
21399
  function requiredSet(s) {
21386
21400
  return resolveRequiredChecks({ classic: s.classic, branchRules: s.branchRules, rulesets: s.rulesets });
21387
21401
  }
@@ -21391,7 +21405,7 @@ var FIXES2 = {
21391
21405
  "stopped-reporting": "Find the commit that removed or renamed the job, then restore it or update the required list.",
21392
21406
  "matrix-name-mismatch": "Require each matrix leg by its full name, or add an `if: always()` gate job with the required name that fails unless every leg succeeded.",
21393
21407
  "skipped-as-success": "Make the required check a gate job with `if: always()` that fails when its dependencies did not succeed, or move the condition from the job into its steps.",
21394
- "path-filtered": "Drop the paths filter and skip inside the job (e.g. a paths-filter step + step conditions), or require a gate job that always runs.",
21408
+ "path-filtered": "Drop the paths filter and skip inside the job (for example, a paths-filter step with step conditions), or require a gate job that always runs.",
21395
21409
  "branch-filtered": "Add this branch to the workflow's `pull_request` branches filter (or remove the filter).",
21396
21410
  "not-on-pull-request": "Add a `pull_request` trigger (and `merge_group` if you use a merge queue).",
21397
21411
  "app-mismatch": "Pin the requirement to the app that reports it (GitHub Actions is 15368 on github.com), or to any source.",
@@ -21432,7 +21446,7 @@ function similarity(a, b) {
21432
21446
  const jac = shared / Math.max(1, (/* @__PURE__ */ new Set([...tx, ...ty])).size);
21433
21447
  return Math.max(lev, jac);
21434
21448
  }
21435
- var prList = (ns) => ns.map((n) => `#${n}`).join(", ");
21449
+ var prList = (ns) => ns.map((n2) => `#${n2}`).join(", ");
21436
21450
  var ALWAYS = /\b(always|failure|cancelled)\s*\(\s*\)/;
21437
21451
  var isMerged = (p) => (p.state ?? "merged") === "merged";
21438
21452
  var STALLED_MERGES_DAYS = 7;
@@ -21458,7 +21472,7 @@ function mergedWithout(context, missing) {
21458
21472
  code: "merged-without",
21459
21473
  severity: "warning",
21460
21474
  context,
21461
- message: `${missing.length} merged PR(s) have no \`${context}\` result on their head commit (${prList(missing.slice(0, 10))}): merged by bypass, or the requirement was added after them`,
21475
+ message: `${plural13(missing.length, "merged PR")} have no \`${context}\` result on their head commit (${prList(missing.slice(0, 10))}): merged by bypass, or the requirement was added after them`,
21462
21476
  evidence: missing.slice(0, 10)
21463
21477
  };
21464
21478
  }
@@ -21479,7 +21493,7 @@ function audit(s, opts = {}) {
21479
21493
  return { p, c, names };
21480
21494
  });
21481
21495
  const seenNames = /* @__PURE__ */ new Map();
21482
- for (const { p, names } of obs) for (const n of names) seenNames.set(n, [...seenNames.get(n) ?? [], p.number]);
21496
+ for (const { p, names } of obs) for (const n2 of names) seenNames.set(n2, [...seenNames.get(n2) ?? [], p.number]);
21483
21497
  for (const w of workflows)
21484
21498
  if (w.error) findings.push({ code: "workflow-unparsable", severity: "warning", message: `\`${w.path}\` is not valid YAML: ${w.error}` });
21485
21499
  for (const r of set.notEnforced) {
@@ -21568,22 +21582,22 @@ function audit(s, opts = {}) {
21568
21582
  });
21569
21583
  const seen = pulls.length - by.missing.length;
21570
21584
  if (pulls.length && seen === 0) {
21571
- const matrixLegs = [...seenNames.keys()].filter((n) => n.startsWith(`${r.context} (`) && !requiredNames.has(n));
21585
+ const matrixLegs = [...seenNames.keys()].filter((n2) => n2.startsWith(`${r.context} (`) && !requiredNames.has(n2));
21572
21586
  const staticLegs = workflows.flatMap((w) => w.jobs).filter((j) => j.matrix && j.rawName === r.context);
21573
21587
  if (matrixLegs.length || staticLegs.length) {
21574
21588
  findings.push({
21575
21589
  code: "matrix-name-mismatch",
21576
21590
  severity: "error",
21577
21591
  context: r.context,
21578
- message: `\`${r.context}\` is required, but the job is a matrix and reports ${matrixLegs.length ? matrixLegs.slice(0, 4).map((n) => `\`${n}\``).join(", ") : `\`${r.context} (\u2026)\``}. No check is ever named exactly \`${r.context}\`, so PRs wait for it ("Expected \u2014 Waiting for status to be reported") or get merged by bypass.`,
21592
+ message: `\`${r.context}\` is required, but the job is a matrix and reports ${matrixLegs.length ? matrixLegs.slice(0, 4).map((n2) => `\`${n2}\``).join(", ") : `\`${r.context} (\u2026)\``}. No check is ever named exactly \`${r.context}\`, so PRs wait for it ("Expected \u2014 Waiting for status to be reported") or get merged by bypass.`,
21579
21593
  hint: `Require each matrix leg by its full name, or add a gate job (needs: ${staticLegs[0]?.id ?? "the matrix job"}, if: always()) named \`${r.context}\` that fails unless every leg succeeded.`
21580
21594
  });
21581
21595
  } else {
21582
21596
  const candidates = /* @__PURE__ */ new Set([
21583
- ...[...seenNames.keys()].filter((n) => !requiredNames.has(n)),
21584
- ...workflows.flatMap((w) => w.jobs).filter((j) => !/\$\{\{/.test(j.rawName) && !j.matrix && !j.reusable).map((j) => j.rawName).filter((n) => !requiredNames.has(n))
21597
+ ...[...seenNames.keys()].filter((n2) => !requiredNames.has(n2)),
21598
+ ...workflows.flatMap((w) => w.jobs).filter((j) => !/\$\{\{/.test(j.rawName) && !j.matrix && !j.reusable).map((j) => j.rawName).filter((n2) => !requiredNames.has(n2))
21585
21599
  ]);
21586
- const best = [...candidates].map((n) => ({ n, s: similarity(r.context, n) })).sort((a, b) => b.s - a.s)[0];
21600
+ const best = [...candidates].map((n2) => ({ n: n2, s: similarity(r.context, n2) })).sort((a, b) => b.s - a.s)[0];
21587
21601
  if (best && best.s >= 0.5) {
21588
21602
  const on = seenNames.get(best.n)?.length ?? 0;
21589
21603
  findings.push({
@@ -21605,12 +21619,12 @@ function audit(s, opts = {}) {
21605
21619
  }
21606
21620
  } else if (pulls.length) {
21607
21621
  const missingStreak = (list5) => {
21608
- let n = 0;
21622
+ let n2 = 0;
21609
21623
  for (const x of list5) {
21610
21624
  if (!missingAt.has(x.p.number)) break;
21611
- n++;
21625
+ n2++;
21612
21626
  }
21613
- return n;
21627
+ return n2;
21614
21628
  };
21615
21629
  const mergedObs = obs.filter((x) => isMerged(x.p));
21616
21630
  const streak = missingStreak(mergedObs);
@@ -21625,8 +21639,8 @@ function audit(s, opts = {}) {
21625
21639
  const recent = streak >= stoppedAfter ? mergedObs.slice(0, streak) : openFirst.slice(0, blockedOpen);
21626
21640
  const older = streak >= stoppedAfter ? mergedObs.slice(streak) : mergedObs;
21627
21641
  const reportedBefore = older.filter((x) => !missingAt.has(x.p.number)).length;
21628
- const appeared = [...seenNames.keys()].filter((n) => !requiredNames.has(n) && recent.every((x) => x.names.has(n)) && !older.some((x) => x.names.has(n)));
21629
- const best = appeared.map((n) => ({ n, s: similarity(r.context, n) })).filter((x) => x.s >= 0.5).sort((a, b) => b.s - a.s)[0];
21642
+ const appeared = [...seenNames.keys()].filter((n2) => !requiredNames.has(n2) && recent.every((x) => x.names.has(n2)) && !older.some((x) => x.names.has(n2)));
21643
+ const best = appeared.map((n2) => ({ n: n2, s: similarity(r.context, n2) })).filter((x) => x.s >= 0.5).sort((a, b) => b.s - a.s)[0];
21630
21644
  const onlyOpen = streak < stoppedAfter;
21631
21645
  if (!best && onlyPathFiltered(producers, workflows)) {
21632
21646
  if (mergedBy.missing.length) findings.push(mergedWithout(r.context, mergedBy.missing));
@@ -21665,7 +21679,7 @@ function audit(s, opts = {}) {
21665
21679
  evidence: mergedBy.failed.slice(0, 10)
21666
21680
  });
21667
21681
  const notDone = /* @__PURE__ */ new Set([...mergedBy.pending, ...mergedBy.stale]);
21668
- const pendingAtMerge = obs.map((x) => x.p.number).filter((n) => notDone.has(n));
21682
+ const pendingAtMerge = obs.map((x) => x.p.number).filter((n2) => notDone.has(n2));
21669
21683
  if (pendingAtMerge.length)
21670
21684
  findings.push({
21671
21685
  code: "merged-while-pending",
@@ -21788,6 +21802,7 @@ function producesRequired(j, required2) {
21788
21802
  }
21789
21803
 
21790
21804
  // ../rollcall/src/collect.ts
21805
+ var plural14 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
21791
21806
  async function soft2(notes, what, fn, fallback) {
21792
21807
  try {
21793
21808
  return await fn();
@@ -21843,7 +21858,7 @@ async function collect(o) {
21843
21858
  if (!obs.checkRuns.length && !obs.statuses.length) silent++;
21844
21859
  else pulls.push(obs);
21845
21860
  }
21846
- if (silent) notes.push(`${silent} open PR(s) had no check runs or statuses on their head yet and were not counted`);
21861
+ if (silent) notes.push(`${plural14(silent, "open PR")} ${silent === 1 ? "had no check runs or statuses on its head yet and was" : "had no check runs or statuses on their head yet and were"} not counted`);
21847
21862
  }
21848
21863
  pulls.sort((x, y) => String(y.mergedAt ?? y.updatedAt ?? "").localeCompare(String(x.mergedAt ?? x.updatedAt ?? "")));
21849
21864
  const workflows = o.workflows ?? await fetchWorkflows(gh, owner, repo, branch, notes);
@@ -21872,9 +21887,9 @@ function level2(key2, v) {
21872
21887
  return s;
21873
21888
  }
21874
21889
  function int(key2, v, min, max) {
21875
- const n = Number(v);
21876
- if (!Number.isInteger(n) || n < min || n > max) throw new Error(`${CONFIG_SECTION4}.${key2}: expected ${min}..${max}`);
21877
- return n;
21890
+ const n2 = Number(v);
21891
+ if (!Number.isInteger(n2) || n2 < min || n2 > max) throw new Error(`${CONFIG_SECTION4}.${key2}: expected ${min}..${max}`);
21892
+ return n2;
21878
21893
  }
21879
21894
  function fromSection2(raw) {
21880
21895
  const cfg = { ...DEFAULT_CONFIG3 };
@@ -21902,7 +21917,7 @@ function readLocalWorkflows(repoDir) {
21902
21917
  const rel = ".github/workflows";
21903
21918
  if (repoPathKind(repoDir, rel) !== "directory") return void 0;
21904
21919
  const out = [];
21905
- for (const f of (0, import_node_fs9.readdirSync)((0, import_node_path7.join)(repoDir, rel)).filter((n) => /\.ya?ml$/.test(n)).sort()) {
21920
+ for (const f of (0, import_node_fs9.readdirSync)((0, import_node_path7.join)(repoDir, rel)).filter((n2) => /\.ya?ml$/.test(n2)).sort()) {
21906
21921
  try {
21907
21922
  const text = readRepoFile(repoDir, `${rel}/${f}`);
21908
21923
  if (text !== void 0) out.push({ path: `${rel}/${f}`, text });
@@ -21914,23 +21929,25 @@ function readLocalWorkflows(repoDir) {
21914
21929
  }
21915
21930
 
21916
21931
  // ../rollcall/src/report.ts
21932
+ var plural15 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
21917
21933
  var cellCode = (s) => mdCode(s).replace(/\|/g, "\\|");
21918
- var prRefs = (ns) => ns.map((n) => `#${n}`).join(", ");
21934
+ var prRefs = (ns) => ns.map((n2) => `#${n2}`).join(", ");
21919
21935
  function rulesUnread(r) {
21920
- return !r.required.length && r.notes.some((n) => /\/(rules\/branches\/|rulesets)[^:]*: 403/.test(n));
21936
+ return !r.required.length && r.notes.some((n2) => /\/(rules\/branches\/|rulesets)[^:]*: 403/.test(n2));
21921
21937
  }
21922
21938
  function title(r) {
21923
21939
  if (rulesUnread(r)) return "Required checks could not be read";
21924
21940
  const e = r.findings.filter((f) => f.severity === "error").length;
21925
21941
  const w = r.findings.length - e;
21926
21942
  return plainText(
21927
- r.findings.length ? `${e} error(s), ${w} warning(s) in ${r.required.length} required check(s)` : `${r.required.length} required check(s) report as intended`,
21943
+ r.findings.length ? `${plural15(e, "error")}, ${plural15(w, "warning")} in ${plural15(r.required.length, "required check")}` : `${plural15(r.required.length, "required check")} report as intended`,
21928
21944
  255,
21929
21945
  true
21930
21946
  );
21931
21947
  }
21932
21948
  function sampleLine(r) {
21933
- return `across the last ${r.sampledPulls.length} merged${r.sampledOpen.length ? ` and ${r.sampledOpen.length} open` : ""} PR(s)`;
21949
+ const total2 = r.sampledPulls.length + r.sampledOpen.length;
21950
+ return `across the last ${r.sampledPulls.length} merged${r.sampledOpen.length ? ` and ${r.sampledOpen.length} open` : ""} ${total2 === 1 ? "PR" : "PRs"}`;
21934
21951
  }
21935
21952
  function toMarkdown3(r, o = {}) {
21936
21953
  const h = o.heading ?? "###";
@@ -21954,7 +21971,7 @@ function toMarkdown3(r, o = {}) {
21954
21971
  );
21955
21972
  lines.push("");
21956
21973
  }
21957
- if (r.notes.length) lines.push("<details><summary>Notes</summary>", "", ...r.notes.map((n) => `- ${mdText(n, 1e3)}`), "", "</details>", "");
21974
+ if (r.notes.length) lines.push("<details><summary>Notes</summary>", "", ...r.notes.map((n2) => `- ${mdText(n2, 1e3)}`), "", "</details>", "");
21958
21975
  const run = safeUrl(o.runUrl);
21959
21976
  lines.push(
21960
21977
  `Sampled merged: ${prRefs(r.sampledPulls) || "none"}${r.sampledOpen.length ? ` \xB7 open: ${prRefs(r.sampledOpen)}` : ""}${run ? ` \xB7 [run](${run})` : ""} \xB7 [docs](${DOCS_URL4})`
@@ -21974,7 +21991,7 @@ function toText3(r) {
21974
21991
  out.push(`${f.severity.toUpperCase()} [${f.code}] ${f.message}`);
21975
21992
  if (f.hint) out.push(` fix: ${f.hint}`);
21976
21993
  }
21977
- for (const n of r.notes) out.push(`note: ${n}`);
21994
+ for (const n2 of r.notes) out.push(`note: ${n2}`);
21978
21995
  out.push(r.ok ? "ok" : "FAILED");
21979
21996
  return out.map((l) => plainText(l, 4e3, true)).join("\n");
21980
21997
  }
@@ -22088,10 +22105,10 @@ function parseReport(r) {
22088
22105
  // src/commands.ts
22089
22106
  var AUDIT_CHECKS = ["rollcall", "owners", "migrations", "evidence"];
22090
22107
  var AUDIT_NEEDS = {
22091
- rollcall: "A GitHub origin remote, and GITHUB_TOKEN or GH_TOKEN for a private repository. Branch protection also needs Administration: read. No checkout needed.",
22092
- owners: "Nothing for offline lint. With a GitHub origin remote and a token: the full audit, including whether owners exist and have write access.",
22093
- migrations: "A checkout with the main branch fetched. No token.",
22094
- evidence: "A checkout with the main branch fetched for local mode, which skips check-based evidence. For pr mode: a GitHub origin remote and a token."
22108
+ rollcall: "A GitHub origin remote. A private repository also needs GITHUB_TOKEN or GH_TOKEN, and reading branch protection needs Administration: read. No checkout needed.",
22109
+ owners: "Nothing for the offline lint. With a GitHub origin remote and a token it runs the full audit, which also checks that each owner exists and has write access.",
22110
+ migrations: "A checkout with the main branch fetched. No token needed.",
22111
+ evidence: "A checkout with the main branch fetched; this local run skips the evidence that comes from CI checks. To evaluate a pull request: a GitHub origin remote and a token."
22095
22112
  };
22096
22113
  function assemble(command, extra, r, text) {
22097
22114
  if (text) {
@@ -22128,12 +22145,12 @@ function auditArgs(root, o) {
22128
22145
  return ["check", "--repo", root, "--main", mainRef(root, o.main), "--format", "json"];
22129
22146
  case "evidence":
22130
22147
  if (o.pr !== void 0) {
22131
- if (!Number.isInteger(o.pr) || o.pr <= 0) throw new CliError("pr: expected a pull request number");
22148
+ if (!Number.isInteger(o.pr) || o.pr <= 0) throw new CliError("--pr: expected a pull request number");
22132
22149
  return ["pr", "--repo", needRepo(), "--pr", String(o.pr), "--json"];
22133
22150
  }
22134
22151
  return ["local", "--base", mainRef(root, o.main), "--repo", root, "--json"];
22135
22152
  default:
22136
- throw new CliError(`unknown check: ${o.check}; one of ${AUDIT_CHECKS.join(", ")}`);
22153
+ throw new CliError(`unknown check: ${o.check} (expected one of ${AUDIT_CHECKS.join(", ")})`);
22137
22154
  }
22138
22155
  }
22139
22156
  async function runAudit(o) {
@@ -22148,19 +22165,19 @@ var import_node_fs11 = require("node:fs");
22148
22165
  var import_node_path8 = require("node:path");
22149
22166
 
22150
22167
  // raw:../evidence/examples/workflows/evidence.yml
22151
- var evidence_default = '# Copy to .github/workflows/evidence.yml.\n#\n# Two jobs on purpose:\n# - pr (pull_request, same-repository PRs): re-evaluates on every push, edit and label change.\n# Runs with the PR\'s own workflow file and an ordinary token; checks out the PR head only to\n# diff it locally (nothing from it is run).\n# - ci (workflow_run): re-evaluates once your CI finishes, so "tests ran on THIS sha" sees the\n# final result, and gives fork PRs a card. workflow_run always runs THIS file from the default\n# branch with a write token, so it never checks out or runs PR code: the diff, the policy\n# (.mainfast.yml at the PR\'s base commit) and the checks all come from the API. The coverage\n# artifact is data the PR\'s CI run produced: parsed, never executed.\n# Make the "Mainfast Evidence" check required in your ruleset to gate merges on it.\n# Never put ${{ github.event.* }} text (branch names, titles, commit messages) into a `run:` step.\nname: Evidence\n\non:\n pull_request:\n types: [opened, synchronize, reopened, edited, labeled, unlabeled, ready_for_review]\n workflow_run:\n workflows: [CI] # the name of your test workflow\n types: [completed]\n\npermissions: {}\n\njobs:\n pr:\n # Fork PRs get a read-only token here and could not post; the ci job covers them.\n if: github.event_name == \'pull_request\' && github.event.pull_request.head.repo.full_name == github.repository\n runs-on: ubuntu-latest\n permissions:\n contents: read\n checks: write\n pull-requests: write\n statuses: read # commit statuses (e.g. ci/circleci: \u2026) count as checks\n concurrency:\n group: evidence-pr-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0 # full history: local diff without GitHub\'s patch truncation, plus git-ai notes\n ref: ${{ github.event.pull_request.head.sha }}\n # credentials stay so the Action can fetch refs/notes/ai (git-ai) in a private repo\n - uses: mainfast/evidence@v0\n with:\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n # Give CI a few minutes so the first card is not "no tests ran".\n wait-for-checks: "600"\n\n ci:\n if: github.event_name == \'workflow_run\'\n runs-on: ubuntu-latest\n permissions:\n contents: read\n checks: write\n pull-requests: write\n statuses: read # commit statuses (e.g. ci/circleci: \u2026) count as checks\n actions: read # download the coverage artifact from the CI run\n concurrency:\n group: evidence-ci-${{ github.event.workflow_run.head_sha }}\n cancel-in-progress: true\n steps:\n # No actions/checkout: this job holds a write token, so PR code never lands on its disk.\n # Optional: changed-line coverage from the CI run\'s artifact (data only).\n - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2\n continue-on-error: true\n with:\n name: coverage\n path: coverage\n run-id: ${{ github.event.workflow_run.id }}\n github-token: ${{ github.token }}\n\n - uses: mainfast/evidence@v0\n with:\n # license: ${{ secrets.MAINFAST_LICENSE }}\n coverage-files: coverage/lcov.info\n local-diff: "false" # no checkout in this job: the diff comes from the API\n';
22168
+ var evidence_default = '# Copy to .github/workflows/mainfast-evidence.yml.\n#\n# Two jobs on purpose:\n# - pr (pull_request, same-repository PRs): re-evaluates on every push, edit and label change.\n# Runs with the PR\'s own workflow file and an ordinary token; checks out the PR head only to\n# diff it locally (nothing from it is run).\n# - ci (workflow_run): re-evaluates once your CI finishes, so "tests ran on THIS sha" sees the\n# final result, and gives fork PRs a card. workflow_run always runs THIS file from the default\n# branch with a write token, so it never checks out or runs PR code: the diff, the policy\n# (.mainfast.yml at the PR\'s base commit) and the checks all come from the API. The coverage\n# artifact is data the PR\'s CI run produced: parsed, never executed.\n# Make the "Mainfast Evidence" check required in your ruleset to gate merges on it.\n# Never put ${{ github.event.* }} text (branch names, titles, commit messages) into a `run:` step.\nname: Evidence\n\non:\n pull_request:\n types: [opened, synchronize, reopened, edited, labeled, unlabeled, ready_for_review]\n workflow_run:\n workflows: [CI] # the name of your test workflow\n types: [completed]\n\npermissions: {}\n\njobs:\n pr:\n # Fork PRs get a read-only token here and could not post; the ci job covers them.\n if: github.event_name == \'pull_request\' && github.event.pull_request.head.repo.full_name == github.repository\n runs-on: ubuntu-latest\n permissions:\n contents: read\n checks: write\n pull-requests: write\n statuses: read # commit statuses (e.g. ci/circleci: \u2026) count as checks\n concurrency:\n group: evidence-pr-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0 # full history: local diff without GitHub\'s patch truncation, plus git-ai notes\n ref: ${{ github.event.pull_request.head.sha }}\n # credentials stay so the Action can fetch refs/notes/ai (git-ai) in a private repo\n - uses: mainfast/evidence@v0\n with:\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n # Give CI a few minutes so the first card is not "no tests ran".\n wait-for-checks: "600"\n\n ci:\n if: github.event_name == \'workflow_run\'\n runs-on: ubuntu-latest\n permissions:\n contents: read\n checks: write\n pull-requests: write\n statuses: read # commit statuses (e.g. ci/circleci: \u2026) count as checks\n actions: read # download the coverage artifact from the CI run\n concurrency:\n group: evidence-ci-${{ github.event.workflow_run.head_sha }}\n cancel-in-progress: true\n steps:\n # No actions/checkout: this job holds a write token, so PR code never lands on its disk.\n # Optional: changed-line coverage from the CI run\'s artifact (data only).\n - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2\n continue-on-error: true\n with:\n name: coverage\n path: coverage\n run-id: ${{ github.event.workflow_run.id }}\n github-token: ${{ github.token }}\n\n - uses: mainfast/evidence@v0\n with:\n # license: ${{ secrets.MAINFAST_LICENSE }}\n coverage-files: coverage/lcov.info\n local-diff: "false" # no checkout in this job: the diff comes from the API\n';
22152
22169
 
22153
22170
  // raw:../intact/examples/mainfast-intact.yml
22154
- var mainfast_intact_default = "# Copy to .github/workflows/mainfast-intact.yml\nname: Mainfast Intact\n\non:\n pull_request:\n push:\n branches-ignore:\n - main # your default branch: PR merges into it are clean by construction\n\npermissions:\n contents: read\n checks: write # optional: without it the action reports via job summary + annotations\n\njobs:\n intact:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0 # the check needs both parents and the merge base\n ref: ${{ github.event.pull_request.head.sha || github.sha }}\n - uses: mainfast/intact@v0\n # Report-only by default. To block, uncomment with: and fail-on (error fails on dropped\n # changes; warning also fails on evil merges and partial drops).\n # with:\n # fail-on: warning\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n";
22171
+ var mainfast_intact_default = "# Copy to .github/workflows/mainfast-intact.yml\nname: Mainfast Intact\n\non:\n pull_request:\n push:\n branches-ignore:\n - main # your default branch: PR merges into it are clean by construction\n\npermissions:\n contents: read\n checks: write # optional: without it the action reports via job summary + annotations\n\njobs:\n intact:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0 # the check needs both parents and the merge base\n ref: ${{ github.event.pull_request.head.sha || github.sha }}\n - uses: mainfast/intact@v0\n # Report-only by default. To fail the job, uncomment `with:` and `fail-on:` (error fails\n # on dropped changes; warning also fails on evil merges and partial drops).\n # with:\n # fail-on: warning\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n";
22155
22172
 
22156
22173
  // raw:../migrations/examples/mainfast-migrations.yml
22157
22174
  var mainfast_migrations_default = '# Copy to .github/workflows/mainfast-migrations.yml.\n#\n# pull_request: checks this PR\'s migrations against the current main.\n# push to main: re-checks every open PR, because main moving can make a clean PR stale.\n# Both set the commit status `mainfast/migrations` on the PR head (failure = stale, success = clean).\n# Only that status blocks a merge, and only once branch protection (or a ruleset) requires it:\n# Settings > Branches > main > Require status checks > add "mainfast/migrations".\nname: Mainfast Migrations\non:\n pull_request:\n push:\n branches: [main]\n\npermissions:\n contents: read\n pull-requests: write # sticky comment + stale label on PRs\n statuses: write # the blocking mainfast/migrations commit status\n\nconcurrency:\n group: mainfast-migrations-${{ github.event.pull_request.number || github.ref }}\n cancel-in-progress: true\n\njobs:\n migrations:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0 # the merge-base must be reachable\n - uses: mainfast/migrations@v0\n # with:\n # status: false # no commit status: comment + label only (then nothing blocks the merge)\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n';
22158
22175
 
22159
22176
  // raw:../owners/examples/owners.yml
22160
- var owners_default = "# Copy to .github/workflows/owners.yml.\n# No checkout step: Owners reads CODEOWNERS, .mainfast.yml and the tree through the API at the\n# right refs (the PR's base branch, the PR's head when it edits CODEOWNERS, the default branch\n# for the weekly audit), never from a checkout.\nname: Code owners\non:\n pull_request: # changed files judged with the base CODEOWNERS; a CODEOWNERS edit is linted on its own\n schedule:\n - cron: \"23 6 * * 1\" # weekly full audit, with dormant owners (180 days by default)\n workflow_dispatch:\n\npermissions:\n contents: read # CODEOWNERS, .mainfast.yml, git tree\n pull-requests: write # PR files + the one sticky comment\n\nconcurrency:\n group: mainfast-owners-${{ github.event.pull_request.number || github.ref }}\n cancel-in-progress: true\n\njobs:\n owners:\n runs-on: ubuntu-latest\n steps:\n - uses: mainfast/owners@v0\n with:\n # Optional: org membership, team existence and team access. GITHUB_TOKEN cannot read\n # them; a fine-grained token (or GitHub App token) with Organization > Members: read\n # can. Without it those checks are skipped with one note. Never used on fork PRs.\n org-token: ${{ secrets.MAINFAST_OWNERS_ORG_TOKEN }}\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n";
22177
+ var owners_default = "# Copy to .github/workflows/mainfast-owners.yml.\n# No checkout step: Owners reads CODEOWNERS, .mainfast.yml and the tree through the API at the\n# right refs (the PR's base branch, the PR's head when it edits CODEOWNERS, the default branch\n# for the weekly audit), never from a checkout.\nname: Code owners\non:\n pull_request: # changed files judged with the base CODEOWNERS; a CODEOWNERS edit is linted on its own\n schedule:\n - cron: \"23 6 * * 1\" # weekly full audit, with dormant owners (180 days by default)\n workflow_dispatch:\n\npermissions:\n contents: read # CODEOWNERS, .mainfast.yml, git tree\n pull-requests: write # PR files + the one sticky comment\n\nconcurrency:\n group: mainfast-owners-${{ github.event.pull_request.number || github.ref }}\n cancel-in-progress: true\n\njobs:\n owners:\n runs-on: ubuntu-latest\n steps:\n - uses: mainfast/owners@v0\n with:\n # Optional: org membership, team existence and team access. GITHUB_TOKEN cannot read\n # them; a fine-grained token (or GitHub App token) with Organization > Members: read\n # can. Without it those checks are skipped with one note. Never used on fork PRs.\n org-token: ${{ secrets.MAINFAST_OWNERS_ORG_TOKEN }}\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n";
22161
22178
 
22162
22179
  // raw:../rollcall/examples/rollcall.yml
22163
- var rollcall_default = '# Copy to .github/workflows/rollcall.yml.\n# No checkout step: Rollcall reads .mainfast.yml (default branch) and .github/workflows (audited\n# branch) through the API, so a manual run from any branch audits exactly what the schedule does.\nname: Required-check audit\non:\n schedule:\n - cron: "17 6 * * 1" # Mondays: also catches ruleset changes, which trigger no workflow event\n workflow_dispatch: # run it by hand after editing a ruleset\n branch_protection_rule: # classic branch protection created / edited / deleted\n push:\n branches: [main]\n paths: [".github/workflows/**", ".mainfast.yml"]\n\npermissions:\n contents: read # .mainfast.yml, workflow files, "Get a branch" (classic required checks)\n pull-requests: read # the merged and open PRs to sample\n statuses: read # commit statuses on each sampled PR head\n checks: write # read check runs, post the Rollcall check run\n issues: write # the one tracking issue\n\nconcurrency:\n group: mainfast-rollcall\n cancel-in-progress: true\n\njobs:\n rollcall:\n runs-on: ubuntu-latest\n steps:\n - uses: mainfast/rollcall@v0\n with:\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n pulls: 30\n';
22180
+ var rollcall_default = '# Copy to .github/workflows/mainfast-rollcall.yml.\n# No checkout step: Rollcall reads .mainfast.yml (default branch) and .github/workflows (audited\n# branch) through the API, so a manual run from any branch audits exactly what the schedule does.\nname: Required-check audit\non:\n schedule:\n - cron: "17 6 * * 1" # Mondays: also catches ruleset changes, which trigger no workflow event\n workflow_dispatch: # run it by hand after editing a ruleset\n branch_protection_rule: # classic branch protection created / edited / deleted\n push:\n branches: [main]\n paths: [".github/workflows/**", ".mainfast.yml"]\n\npermissions:\n contents: read # .mainfast.yml, workflow files, "Get a branch" (classic required checks)\n pull-requests: read # the merged and open PRs to sample\n statuses: read # commit statuses on each sampled PR head\n checks: write # read check runs, post the Rollcall check run\n issues: write # the one tracking issue\n\nconcurrency:\n group: mainfast-rollcall\n cancel-in-progress: true\n\njobs:\n rollcall:\n runs-on: ubuntu-latest\n steps:\n - uses: mainfast/rollcall@v0\n with:\n # license: ${{ secrets.MAINFAST_LICENSE }} # Pro: private repos with more than 5 active contributors\n pulls: 30\n';
22164
22181
 
22165
22182
  // src/templates.ts
22166
22183
  var WORKFLOWS = { intact: mainfast_intact_default, migrations: mainfast_migrations_default, rollcall: rollcall_default, owners: owners_default, evidence: evidence_default };
@@ -22189,16 +22206,16 @@ function nextSteps(slugs) {
22189
22206
  const steps = ["Review the new files, commit them and open a pull request. Nothing has been pushed."];
22190
22207
  const required2 = slugs.filter((s) => s !== "rollcall" && s !== "migrations").map((s) => `"${product(s).checkName}"`);
22191
22208
  if (slugs.includes("migrations")) required2.push(`"${product("migrations").statusContext ?? "mainfast/migrations"}"`);
22192
- if (required2.length) steps.push(`To let a finding block a merge, require ${required2.join(", ")} in branch protection or a ruleset.`);
22209
+ if (required2.length) steps.push(`To block merges on findings, make ${required2.join(", ")} required in branch protection or a ruleset.`);
22193
22210
  if (slugs.includes("evidence")) steps.push(`Evidence: set workflows: [CI] in ${workflowPath("evidence")} to the name of your test workflow.`);
22194
- if (slugs.includes("rollcall")) steps.push("Rollcall runs weekly and files one tracking issue; run it by hand from the Actions tab after a ruleset edit.");
22195
- if (slugs.includes("owners")) steps.push("Owners needs a CODEOWNERS file to judge; without one it reports that.");
22211
+ if (slugs.includes("rollcall")) steps.push("Rollcall runs weekly and keeps one tracking issue open while it finds problems. After you change a ruleset, run it by hand from the Actions tab.");
22212
+ if (slugs.includes("owners")) steps.push("Owners needs a CODEOWNERS file; until you add one, every run reports it as missing.");
22196
22213
  return steps;
22197
22214
  }
22198
22215
  function runInit(opts) {
22199
22216
  const root = repoRoot(opts.dir);
22200
22217
  const wanted = opts.checks?.length ? opts.checks : PRODUCT_SLUGS;
22201
- for (const c of wanted) if (!PRODUCT_SLUGS.includes(c)) throw new CliError(`unknown check: ${c}; one of ${PRODUCT_SLUGS.join(", ")}`);
22218
+ for (const c of wanted) if (!PRODUCT_SLUGS.includes(c)) throw new CliError(`unknown check: ${c} (expected one of ${PRODUCT_SLUGS.join(", ")})`);
22202
22219
  const slugs = [...new Set(wanted)];
22203
22220
  const written = [];
22204
22221
  const overwritten = [];
@@ -22209,7 +22226,7 @@ function runInit(opts) {
22209
22226
  const abs = (0, import_node_path8.join)(root, rel);
22210
22227
  const exists = current !== void 0;
22211
22228
  if (current === content) return void unchanged.push(rel);
22212
- if (exists && !opts.force) return void skipped.push({ path: rel, reason: "exists with other content; use force to replace it" });
22229
+ if (exists && !opts.force) return void skipped.push({ path: rel, reason: "exists with different content; use --force to replace it" });
22213
22230
  if (!opts.dryRun) {
22214
22231
  (0, import_node_fs11.mkdirSync)((0, import_node_path8.dirname)(abs), { recursive: true });
22215
22232
  (0, import_node_fs11.writeFileSync)(abs, content);
@@ -22280,15 +22297,15 @@ function runDoctor(dir) {
22280
22297
  const token = githubToken();
22281
22298
  const repo = githubRepo(root) ?? null;
22282
22299
  const codeowners = [".github/CODEOWNERS", "CODEOWNERS", "docs/CODEOWNERS"].find((f) => kindOf(f) === "file") ?? null;
22283
- if (!installed.length && workflowsOk) missing.push("No check is installed. Run: mainfast init");
22284
- if (!repo) missing.push("No GitHub origin remote, so audit cannot read the repository through the API.");
22285
- if (!token) missing.push("No GITHUB_TOKEN or GH_TOKEN: audit rollcall needs one for private repositories, audit owners falls back to offline lint.");
22286
- if (installed.includes("owners") && !codeowners) missing.push("Owners is installed but there is no CODEOWNERS file.");
22300
+ if (!installed.length && workflowsOk) missing.push("No checks are installed. Run: mainfast init");
22301
+ if (!repo) missing.push("No GitHub origin remote, so audit cannot read the repository through the GitHub API.");
22302
+ if (!token) missing.push("No GITHUB_TOKEN or GH_TOKEN: audit rollcall needs one for a private repository, and audit owners runs only the offline lint.");
22303
+ if (installed.includes("owners") && !codeowners) missing.push("Owners is installed but there is no CODEOWNERS file. Add .github/CODEOWNERS.");
22287
22304
  const ok = config2.ok && workflowsOk && installed.length > 0;
22288
22305
  const json = { schema: SCHEMA, command: "doctor", ok, repo: root, github_repo: repo, checks, config: config2, codeowners, token: { present: Boolean(token), source: token?.name ?? null }, missing, hosted_app: hostedAppUrl() };
22289
22306
  const lines = [
22290
22307
  ...PRODUCT_SLUGS.map((s) => `${checks[s].installed ? "installed" : "missing "} ${s}${checks[s].installed ? ` (${checks[s].files.join(", ")})` : ""}`),
22291
- `config ${path ? config2.ok ? `${path} parses` : `${path} does not parse` : "none, defaults apply"}`,
22308
+ `config ${path ? config2.ok ? `${path} parses` : `${path} does not parse` : "none (defaults apply)"}`,
22292
22309
  `token ${token ? `set (${token.name})` : "not set"}`,
22293
22310
  ...missing.length ? ["", "To do:", ...missing.map((m) => `- ${m}`)] : []
22294
22311
  ];
@@ -24543,10 +24560,10 @@ function capSize(inst, size) {
24543
24560
  const cap2 = Math.min(...caps.map((c) => c[0]));
24544
24561
  const parse4 = inst._zod.parse;
24545
24562
  inst._zod.parse = (payload, ctx) => {
24546
- const n = size(payload.value);
24547
- if (n > cap2 && !ctx?.skipChecks && ctx?.direction !== "backward") {
24563
+ const n2 = size(payload.value);
24564
+ if (n2 > cap2 && !ctx?.skipChecks && ctx?.direction !== "backward") {
24548
24565
  for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
24549
- if (n > max && ch._zod.def.when(payload)) {
24566
+ if (n2 > max && ch._zod.def.when(payload)) {
24550
24567
  const start = payload.issues.length;
24551
24568
  ch._zod.check(payload);
24552
24569
  payload.issues[start].continue = false;
@@ -28340,17 +28357,17 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
28340
28357
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
28341
28358
  inst.element = def.element;
28342
28359
  }, {
28343
- min(n, params) {
28344
- return this.check(_minLength(n, params));
28360
+ min(n2, params) {
28361
+ return this.check(_minLength(n2, params));
28345
28362
  },
28346
28363
  nonempty(params) {
28347
28364
  return this.check(_minLength(1, params));
28348
28365
  },
28349
- max(n, params) {
28350
- return this.check(_maxLength(n, params));
28366
+ max(n2, params) {
28367
+ return this.check(_maxLength(n2, params));
28351
28368
  },
28352
- length(n, params) {
28353
- return this.check(_length(n, params));
28369
+ length(n2, params) {
28370
+ return this.check(_length(n2, params));
28354
28371
  },
28355
28372
  unwrap() {
28356
28373
  return this.element;
@@ -32090,14 +32107,14 @@ var str = (v) => typeof v === "string" && v ? v : void 0;
32090
32107
  var TOOLS = [
32091
32108
  {
32092
32109
  name: "init",
32093
- description: `WRITES FILES in the repository: the workflow of each chosen check under .github/workflows and a starter ${SUITE.configFile}. Never replaces a file with other content unless force is true. Does not commit, push or change branch protection. Pass dry_run: true to see what it would do without writing.`,
32110
+ description: `WRITES FILES in the repository: the workflow of each chosen check under .github/workflows and a starter ${SUITE.configFile}. Never replaces a file that has different content unless force is true. Does not commit, push or change branch protection. Pass dry_run: true to see what it would do without writing.`,
32094
32111
  inputSchema: {
32095
32112
  type: "object",
32096
32113
  properties: {
32097
32114
  repo_path: repoPath,
32098
32115
  checks: { type: "array", items: { type: "string", enum: [...PRODUCT_SLUGS] }, description: "Default: all five." },
32099
- dry_run: { type: "boolean", description: "Report only, write nothing. Default: false." },
32100
- force: { type: "boolean", description: "Replace files that have other content. Default: false." }
32116
+ dry_run: { type: "boolean", description: "Show what would change without writing anything. Default: false." },
32117
+ force: { type: "boolean", description: "Replace files that have different content. Default: false." }
32101
32118
  },
32102
32119
  additionalProperties: false
32103
32120
  },
@@ -32112,7 +32129,7 @@ var TOOLS = [
32112
32129
  },
32113
32130
  {
32114
32131
  name: "check",
32115
- description: "Reads only. Runs Mainfast Intact locally on the merge commits in this branch: did a merge silently drop main's changes or add an unrelated edit? Run it before pushing a merge. ok is false when there are findings.",
32132
+ description: "Reads only. Runs Mainfast Intact locally on the merge commits in this branch: did a merge silently drop main's changes or add an unrelated edit? Run it before pushing a merge. ok is false when a finding is at or above fail_on.",
32116
32133
  inputSchema: {
32117
32134
  type: "object",
32118
32135
  properties: {
@@ -32120,7 +32137,7 @@ var TOOLS = [
32120
32137
  commit: { type: "string", description: "One merge commit. Default: every merge commit in main..HEAD." },
32121
32138
  range: { type: "string", description: "A range, A..B." },
32122
32139
  main: { type: "string", description: "The main branch. Default: from the config or origin." },
32123
- fail_on: { type: "string", enum: ["error", "warning", "notice"], description: "Lowest level that counts as a finding. Default: warning." }
32140
+ fail_on: { type: "string", enum: ["error", "warning", "notice"], description: "Lowest level that fails the check (ok false). Default: warning." }
32124
32141
  },
32125
32142
  additionalProperties: false
32126
32143
  },
@@ -32136,7 +32153,7 @@ var TOOLS = [
32136
32153
  check: { type: "string", enum: [...AUDIT_CHECKS] },
32137
32154
  main: { type: "string", description: "The main branch, for migrations and evidence." },
32138
32155
  pr: { type: "integer", description: "For evidence: evaluate this pull request through the API." },
32139
- offline: { type: "boolean", description: "For owners: lint offline even with a token." }
32156
+ offline: { type: "boolean", description: "For owners: run the offline lint even when a token is set." }
32140
32157
  },
32141
32158
  required: ["check"],
32142
32159
  additionalProperties: false
@@ -32212,35 +32229,36 @@ async function runMcp() {
32212
32229
  }
32213
32230
 
32214
32231
  // src/main.ts
32215
- var COMMON = " -C <dir> run in <dir> (default: the current directory)\n --json one JSON object on stdout\n -h, --help this help\n";
32232
+ var COMMON = " -C <dir> run in <dir> (default: the current directory)\n --json one JSON object on stdout\n -h, --help show this help\n";
32216
32233
  var HELP2 = {
32217
32234
  "": `mainfast ${VERSION}: set up and run GitHub checks that stop merges from silently breaking main.
32218
32235
 
32219
32236
  usage: mainfast <command> [options]
32220
32237
 
32221
32238
  init write the workflows and a starter config into this repository
32222
- doctor what is installed, whether the config parses, what is missing
32239
+ doctor show which checks are installed, check the config, list what is missing
32223
32240
  check run Intact on the merge commits in this branch
32224
- audit run rollcall, owners, migrations or evidence now; reads only
32241
+ audit run Rollcall, Owners, Migrations or Evidence once; posts nothing
32225
32242
  mcp serve these commands as MCP tools over stdio
32226
32243
 
32227
32244
  Run mainfast <command> --help for its options. Every command takes --json.
32228
32245
  Exit codes: 0 nothing failed (warnings can still be listed), 1 findings that fail or something missing, 2 error.
32229
- Token: GITHUB_TOKEN or GH_TOKEN, never printed.
32246
+ Token: read from GITHUB_TOKEN or GH_TOKEN, never printed.
32230
32247
  `,
32231
32248
  init: `usage: mainfast init [--checks intact,owners,...] [--dry-run] [--force]
32232
32249
 
32233
- Writes .github/workflows/mainfast-<check>.yml for each check and a starter config. Replaces a file
32234
- with other content only with --force. Does not commit, push or change branch protection.
32250
+ Writes .github/workflows/mainfast-<check>.yml for each check and a starter config. Leaves a file
32251
+ that already has different content alone unless you pass --force. Does not commit, push or change
32252
+ branch protection.
32235
32253
 
32236
32254
  --checks <a,b> intact, migrations, rollcall, owners, evidence (default: all)
32237
- --dry-run report what would change, write nothing
32238
- --force replace files that have other content
32255
+ --dry-run show what would change without writing anything
32256
+ --force replace files that have different content
32239
32257
  ${COMMON}`,
32240
32258
  doctor: `usage: mainfast doctor
32241
32259
 
32242
- Which checks are installed, whether the config parses, whether a token is set. Exit 1 if nothing is
32243
- installed or the config does not parse.
32260
+ Shows which checks are installed, whether the config parses and whether a token is set. Exits 1 if no
32261
+ check is installed or the config does not parse.
32244
32262
 
32245
32263
  ${COMMON}`,
32246
32264
  check: `usage: mainfast check [<merge-commit>] [--range A..B] [--main <branch>] [--fail-on error|warning|notice]
@@ -32248,16 +32266,21 @@ ${COMMON}`,
32248
32266
  Runs Intact locally. With no commit or range, checks every merge commit in <main>..HEAD.
32249
32267
  Exit codes: 0 nothing failed (warnings can still be listed), 1 findings that fail, 2 error.
32250
32268
 
32269
+ <merge-commit> check this one merge commit
32270
+ --range A..B check every merge commit in the range
32271
+ --main <branch> the main branch (default: from the config, else origin's default branch)
32272
+ --fail-on <level> lowest level that fails: error, warning (default) or notice
32251
32273
  ${COMMON}`,
32252
32274
  audit: `usage: mainfast audit <${AUDIT_CHECKS.join("|")}> [--main <branch>] [--pr <n>] [--offline]
32253
32275
 
32254
- Runs one check now. Reads only: it posts nothing to GitHub.
32276
+ Runs one check once and prints the result. Posts nothing to GitHub.
32255
32277
 
32278
+ What each check needs:
32256
32279
  ${AUDIT_CHECKS.map((c) => ` ${c}: ${AUDIT_NEEDS[c]}`).join("\n")}
32257
32280
 
32258
- --main <branch> the main branch, for migrations and evidence
32259
- --pr <n> evidence: evaluate this pull request through the API
32260
- --offline owners: lint offline even with a token
32281
+ --main <branch> the main branch (migrations and evidence)
32282
+ --pr <n> evidence: evaluate this pull request through the GitHub API
32283
+ --offline owners: run the offline lint even when a token is set
32261
32284
  ${COMMON}`,
32262
32285
  mcp: `usage: mainfast mcp
32263
32286
 
@@ -32303,8 +32326,8 @@ ${HELP2[""]}`);
32303
32326
  json = values.json ?? false;
32304
32327
  if (values.help) return process.stdout.write(HELP2[command]), 0;
32305
32328
  const dir = values.C ?? process.cwd();
32306
- const tooMany = (n) => {
32307
- if (positionals.length > n) throw new CliError(`unexpected argument: ${positionals[n]}`);
32329
+ const tooMany = (n2) => {
32330
+ if (positionals.length > n2) throw new CliError(`unexpected argument: ${positionals[n2]}`);
32308
32331
  };
32309
32332
  switch (command) {
32310
32333
  case "init":
@@ -32318,7 +32341,7 @@ ${HELP2[""]}`);
32318
32341
  return emit(await runCheck2({ dir, commit: positionals[0], range: values.range, main: values.main, failOn: values["fail-on"], text: !json }), json);
32319
32342
  case "audit": {
32320
32343
  tooMany(1);
32321
- if (!positionals[0]) throw new CliError(`audit needs a check: ${AUDIT_CHECKS.join(", ")}`);
32344
+ if (!positionals[0]) throw new CliError(`audit needs a check name: ${AUDIT_CHECKS.join(", ")}`);
32322
32345
  return emit(await runAudit({ dir, check: positionals[0], main: values.main, pr: values.pr === void 0 ? void 0 : Number(values.pr), offline: values.offline, text: !json }), json);
32323
32346
  }
32324
32347
  case "mcp":