mainfast 0.1.1 → 0.1.3

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.3",
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"]) {
@@ -14707,6 +14707,8 @@ var brand_default = {
14707
14707
  docsUrl: "https://github.com/mainfast/mainfast#readme",
14708
14708
  issuesUrl: "https://github.com/mainfast/mainfast/issues",
14709
14709
  pricingUrl: "https://mainfast.dev/pricing",
14710
+ appUrl: "https://github.com/apps/mainfast",
14711
+ dashboardUrl: "https://app.mainfast.dev",
14710
14712
  npmScope: "@mainfast",
14711
14713
  configFile: ".mainfast.yml",
14712
14714
  configFileAlt: ".mainfast.yaml",
@@ -14717,14 +14719,14 @@ var brand_default = {
14717
14719
  freeActiveContributors: 5,
14718
14720
  windowDays: 30,
14719
14721
  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).",
14722
+ _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
14723
  benefitIds: {
14722
14724
  free: "656e762a-ec6e-4e94-b7fd-f7ff879061ca",
14723
14725
  pro: "ea9b4fcb-3659-404e-bb62-9bec84fb119a"
14724
14726
  }
14725
14727
  },
14726
14728
  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.",
14729
+ _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
14730
  api: "https://api.polar.sh",
14729
14731
  organizationId: "3a0d763f-8fac-4df0-898a-a59eb60d3506",
14730
14732
  apiEnv: "MAINFAST_POLAR_API",
@@ -14736,7 +14738,7 @@ var brand_default = {
14736
14738
  intact: {
14737
14739
  productName: "Mainfast Intact",
14738
14740
  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).",
14741
+ description: "Checks that merge commits did not silently drop changes from main (dropped hunks, evil merges).",
14740
14742
  npmName: "@mainfast/intact",
14741
14743
  cliName: "mainfast",
14742
14744
  configSection: "intact",
@@ -14762,7 +14764,7 @@ var brand_default = {
14762
14764
  rollcall: {
14763
14765
  productName: "Mainfast Rollcall",
14764
14766
  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.",
14767
+ 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
14768
  npmName: "@mainfast/rollcall",
14767
14769
  cliName: "mainfast-rollcall",
14768
14770
  configSection: "rollcall",
@@ -14774,7 +14776,7 @@ var brand_default = {
14774
14776
  owners: {
14775
14777
  productName: "Mainfast Owners",
14776
14778
  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.",
14779
+ 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
14780
  npmName: "@mainfast/owners",
14779
14781
  cliName: "mainfast-owners",
14780
14782
  configSection: "owners",
@@ -14786,7 +14788,7 @@ var brand_default = {
14786
14788
  evidence: {
14787
14789
  productName: "Mainfast Evidence",
14788
14790
  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.",
14791
+ 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
14792
  npmName: "@mainfast/evidence",
14791
14793
  cliName: "mainfast-evidence",
14792
14794
  configSection: "evidence",
@@ -15605,6 +15607,7 @@ function classifyRequired(context, c, sources = []) {
15605
15607
  }
15606
15608
 
15607
15609
  // ../evidence/src/analyze/checks.ts
15610
+ var plural = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
15608
15611
  function keeper(policy) {
15609
15612
  const ignored = policy.ignoreChecks.map(nameMatcher);
15610
15613
  return (name) => name !== CHECK_NAME && !ignored.some((m) => m(name));
@@ -15677,7 +15680,7 @@ function evaluateChecks(snap, policy) {
15677
15680
  findings.push({
15678
15681
  id: "tests_not_run_on_head",
15679
15682
  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(", ")}).`
15683
+ 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
15684
  });
15682
15685
  } else if (testsState === "failed") {
15683
15686
  const bad = tests.filter((t) => t.state !== "success");
@@ -15692,12 +15695,12 @@ function evaluateChecks(snap, policy) {
15692
15695
  findings.push({
15693
15696
  id: "tests_skipped",
15694
15697
  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.`
15698
+ 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
15699
  });
15697
15700
  } else if (testsState === "empty") {
15698
15701
  findings.push({
15699
15702
  id: "tests_empty",
15700
- title: "Test checks passed but report running zero tests",
15703
+ title: "Test checks passed but ran zero tests",
15701
15704
  detail: tests.map((t) => `${t.name}: "${t.summary}"`).join("; ")
15702
15705
  });
15703
15706
  }
@@ -15721,7 +15724,7 @@ function evaluateChecks(snap, policy) {
15721
15724
  findings.push({
15722
15725
  id: "required_check_missing",
15723
15726
  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).`
15727
+ 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
15728
  });
15726
15729
  if (skipped.length)
15727
15730
  findings.push({
@@ -15740,6 +15743,7 @@ function evaluateChecks(snap, policy) {
15740
15743
  }
15741
15744
 
15742
15745
  // ../evidence/src/analyze/claims.ts
15746
+ var plural2 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
15743
15747
  var NEGATION = /\b(no|not|n't|without|never|skip(?:ped)?|none)\b[^.\n]{0,25}$/i;
15744
15748
  var PATTERNS = {
15745
15749
  tests_added: [
@@ -15780,8 +15784,8 @@ function evaluateClaims(title2, body, tamper, checks) {
15780
15784
  for (const c of extractClaims(`${title2}
15781
15785
  ${body}`)) {
15782
15786
  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` });
15787
+ const n2 = tamper.addedTestCases;
15788
+ if (n2 > 0) claims.push({ ...c, verdict: "backed", why: `${plural2(n2, "test case")} added` });
15785
15789
  else {
15786
15790
  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
15791
  claims.push({ ...c, verdict: "unbacked", why });
@@ -15949,9 +15953,9 @@ function parseLcov(text) {
15949
15953
  files.set(path, cur);
15950
15954
  } else if (line.startsWith("DA:") && cur) {
15951
15955
  const [ln, hits] = line.slice(3).split(",");
15952
- const n = Number(ln);
15956
+ const n2 = Number(ln);
15953
15957
  const h = Number(hits);
15954
- if (Number.isFinite(n) && Number.isFinite(h)) cur.lines.set(n, Math.max(cur.lines.get(n) ?? 0, h));
15958
+ if (Number.isFinite(n2) && Number.isFinite(h)) cur.lines.set(n2, Math.max(cur.lines.get(n2) ?? 0, h));
15955
15959
  } else if (line === "end_of_record") cur = void 0;
15956
15960
  }
15957
15961
  return { format: "lcov", files };
@@ -15977,9 +15981,9 @@ function parseCobertura(xml) {
15977
15981
  files.set(path, cov);
15978
15982
  const body = m[2].replace(/<methods>[\s\S]*?<\/methods>/g, "");
15979
15983
  for (const l of body.matchAll(/<line\b([^>]*)\/?>/g)) {
15980
- const n = Number(attr(l[1], "number"));
15984
+ const n2 = Number(attr(l[1], "number"));
15981
15985
  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));
15986
+ if (Number.isFinite(n2) && Number.isFinite(h)) cov.lines.set(n2, Math.max(cov.lines.get(n2) ?? 0, h));
15983
15987
  }
15984
15988
  }
15985
15989
  return { format: "cobertura", files };
@@ -15995,7 +15999,7 @@ function mergeCoverage(reports) {
15995
15999
  for (const r of reports)
15996
16000
  for (const [p, c] of r.files) {
15997
16001
  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));
16002
+ for (const [n2, h] of c.lines) into.lines.set(n2, Math.max(into.lines.get(n2) ?? 0, h));
15999
16003
  files.set(p, into);
16000
16004
  }
16001
16005
  return { format: reports[0].format, files };
@@ -16007,10 +16011,10 @@ function lookup(report, repoPath2) {
16007
16011
  const target = norm(repoPath2);
16008
16012
  let best;
16009
16013
  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);
16014
+ const n2 = norm(p);
16015
+ if (n2 === target) return cov;
16016
+ if (n2.endsWith(`/${target}`) || target.endsWith(`/${n2}`)) {
16017
+ const len = Math.min(n2.length, target.length);
16014
16018
  if (!best || len > best.len) best = { cov, len };
16015
16019
  }
16016
16020
  }
@@ -16072,6 +16076,7 @@ function compress(lines) {
16072
16076
  }
16073
16077
 
16074
16078
  // ../evidence/src/analyze/provenance.ts
16079
+ var plural3 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
16075
16080
  var AGENT_CATALOG = [
16076
16081
  {
16077
16082
  // Verified: claude[bot] and the claude/ prefix are the defaults of anthropics/claude-code-action
@@ -16175,13 +16180,13 @@ function displayName(id) {
16175
16180
  return AGENT_CATALOG.find((a) => a.id === id)?.name ?? id;
16176
16181
  }
16177
16182
  function countRanges(spec) {
16178
- let n = 0;
16183
+ let n2 = 0;
16179
16184
  for (const part of spec.split(",")) {
16180
16185
  const m = /^(\d+)(?:-(\d+))?$/.exec(part.trim());
16181
16186
  if (!m) continue;
16182
- n += m[2] ? Number(m[2]) - Number(m[1]) + 1 : 1;
16187
+ n2 += m[2] ? Number(m[2]) - Number(m[1]) + 1 : 1;
16183
16188
  }
16184
- return n;
16189
+ return n2;
16185
16190
  }
16186
16191
  function parseGitAiNote(commit, note) {
16187
16192
  const lines = note.replace(/\r\n/g, "\n").split("\n");
@@ -16303,7 +16308,7 @@ function detectProvenance(snap, m) {
16303
16308
  add({
16304
16309
  agent: GIT_AI_TOOL_TO_AGENT[lc(t.tool)] ?? t.tool,
16305
16310
  source: "git_ai",
16306
- detail: `${short3}: git-ai note, ${s.aiLines} AI line(s)${"model" in t && t.model ? `, ${t.model}` : ""}`
16311
+ detail: `${short3}: git-ai note, ${plural3(s.aiLines, "AI line")}${"model" in t && t.model ? `, ${t.model}` : ""}`
16307
16312
  });
16308
16313
  }
16309
16314
  }
@@ -16339,8 +16344,8 @@ function entropy(s) {
16339
16344
  const freq = /* @__PURE__ */ new Map();
16340
16345
  for (const ch of s) freq.set(ch, (freq.get(ch) ?? 0) + 1);
16341
16346
  let e = 0;
16342
- for (const n of freq.values()) {
16343
- const p = n / s.length;
16347
+ for (const n2 of freq.values()) {
16348
+ const p = n2 / s.length;
16344
16349
  e -= p * Math.log2(p);
16345
16350
  }
16346
16351
  return e;
@@ -16387,22 +16392,23 @@ function scanSecrets(files, policy) {
16387
16392
  function evaluateSize(files, policy) {
16388
16393
  const skip = [...policy.paths.lockfiles, ...policy.diff.exclude];
16389
16394
  const counted = files.filter((f) => !matchesAny(f.path, skip));
16390
- const lines = counted.reduce((n, f) => n + f.additions + f.deletions, 0);
16395
+ const lines = counted.reduce((n2, f) => n2 + f.additions + f.deletions, 0);
16391
16396
  const findings = [];
16392
16397
  const over = [];
16393
16398
  if (policy.diff.maxLines > 0 && lines > policy.diff.maxLines) over.push(`${lines} changed lines (limit ${policy.diff.maxLines})`);
16394
16399
  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.` });
16400
+ 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
16401
  return {
16397
16402
  files: files.length,
16398
- additions: files.reduce((n, f) => n + f.additions, 0),
16399
- deletions: files.reduce((n, f) => n + f.deletions, 0),
16403
+ additions: files.reduce((n2, f) => n2 + f.additions, 0),
16404
+ deletions: files.reduce((n2, f) => n2 + f.deletions, 0),
16400
16405
  counted: { files: counted.length, lines },
16401
16406
  findings
16402
16407
  };
16403
16408
  }
16404
16409
 
16405
16410
  // ../evidence/src/analyze/tamper.ts
16411
+ var plural4 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
16406
16412
  var LANG_RULES = {
16407
16413
  js: {
16408
16414
  testCase: /(?:^|[\s;(,])[xf]?(?:it|test)(?:\.[a-zA-Z]+)*\s*(?:\(|`)/,
@@ -16499,10 +16505,10 @@ function evaluateTamper(files, policy) {
16499
16505
  const unanalyzed = files.filter((f) => f.patch === void 0 && f.additions + f.deletions > 0).map((f) => f.path);
16500
16506
  const testStats = tests.map(analyzeTestFile).filter((s) => !!s);
16501
16507
  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)
16508
+ assertions: testStats.reduce((n2, s) => n2 + s.assertionsAdded - s.assertionsRemoved, 0),
16509
+ cases: testStats.reduce((n2, s) => n2 + s.casesAdded - s.casesRemoved, 0)
16504
16510
  };
16505
- const addedTestCases = testStats.reduce((n, s) => n + s.casesAdded, 0);
16511
+ const addedTestCases = testStats.reduce((n2, s) => n2 + s.casesAdded, 0);
16506
16512
  const findings = [];
16507
16513
  const list5 = (xs) => xs.map((x) => `\`${x}\``).join(", ");
16508
16514
  if (touched2.workflows.length)
@@ -16521,13 +16527,13 @@ function evaluateTamper(files, policy) {
16521
16527
  findings.push({
16522
16528
  id: "tests_removed",
16523
16529
  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)}.`
16530
+ detail: `Net ${plural4(net.cases, "test case")} across the diff. Per file: ${perFile((s) => s.casesAdded - s.casesRemoved)}.`
16525
16531
  });
16526
16532
  if (net.assertions < 0)
16527
16533
  findings.push({
16528
16534
  id: "assertions_dropped",
16529
16535
  title: "Assertion count dropped",
16530
- detail: `Net ${net.assertions} assertion(s) across test files. Per file: ${perFile((s) => s.assertionsAdded - s.assertionsRemoved)}.`
16536
+ detail: `Net ${plural4(net.assertions, "assertion")} across test files. Per file: ${perFile((s) => s.assertionsAdded - s.assertionsRemoved)}.`
16531
16537
  });
16532
16538
  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
16539
  const lineFinding = (id, title2, kind, pick2) => {
@@ -16536,14 +16542,14 @@ function evaluateTamper(files, policy) {
16536
16542
  findings.push({ id, title: title2, detail: locations.map((l) => `\`${l.path}:${l.line}\` ${l.message.slice(kind.length + 2)}`).join("\n"), locations });
16537
16543
  };
16538
16544
  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);
16545
+ lineFinding("focus_added", "Focused test added (.only / fit) \u2014 the other tests in the file are skipped", "focus added", (s) => s.focus);
16540
16546
  lineFinding("assertions_commented_out", "Assertions commented out", "commented-out assertion", (s) => s.commentedOut);
16541
16547
  lineFinding("trivial_assertion_added", "Assertion that cannot fail", "trivial assertion", (s) => s.trivial);
16542
16548
  if (unanalyzed.length)
16543
16549
  findings.push({
16544
16550
  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.`
16551
+ title: "Some files could not be analyzed",
16552
+ detail: `GitHub returned no patch for ${list5(unanalyzed)} (diff too large). Run with a full checkout (\`fetch-depth: 0\`) to analyze them locally.`
16547
16553
  });
16548
16554
  return { touched: touched2, testStats, net, addedTestCases, unanalyzed, findings };
16549
16555
  }
@@ -16606,15 +16612,15 @@ var FLAG_FIXES = {
16606
16612
  touched_workflows: "Have a human review the CI change, or move it to its own PR; agents should not edit what judges them.",
16607
16613
  touched_codeowners: "Have a code owner review the CODEOWNERS change in a separate, human-authored PR.",
16608
16614
  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.",
16615
+ touched_tests: "Check each removed or rewritten test line is intended; keep the old assertions unless the behavior changed.",
16610
16616
  touched_test_config: "Review the test-config change: coverage thresholds, excluded paths and test globs can switch tests off.",
16611
16617
  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.",
16618
+ tests_deleted: "Restore the deleted test file, or explain in the PR why the behavior it covered is gone.",
16613
16619
  tests_removed: "Restore the removed test cases, or replace them with equivalent ones.",
16614
16620
  assertions_dropped: "Restore the dropped assertions; a test without them passes whatever the code does.",
16615
16621
  assertions_commented_out: "Uncomment the assertion and fix the code it was catching, or delete it on purpose with a reason.",
16616
16622
  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.",
16623
+ focus_added: "Remove `.only` / `fit` / `fdescribe`; they make the runner skip every other test in the file.",
16618
16624
  trivial_assertion_added: "Replace the always-true assertion with one that checks the code's result.",
16619
16625
  claim_tests_added_unbacked: "Add the tests the description promises, or correct the description.",
16620
16626
  claim_tests_pass_unbacked: "Wait for the test checks on this commit to pass, or correct the description.",
@@ -16645,14 +16651,14 @@ var RestClient = class {
16645
16651
  }
16646
16652
  return out;
16647
16653
  }
16648
- getPull(o, r, n) {
16649
- return this.raw("GET", `/repos/${enc2(o)}/${enc2(r)}/pulls/${n}`).then((x) => x.data);
16654
+ getPull(o, r, n2) {
16655
+ return this.raw("GET", `/repos/${enc2(o)}/${enc2(r)}/pulls/${n2}`).then((x) => x.data);
16650
16656
  }
16651
- listPullCommits(o, r, n) {
16652
- return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/pulls/${n}/commits`, void 0, 250);
16657
+ listPullCommits(o, r, n2) {
16658
+ return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/pulls/${n2}/commits`, void 0, 250);
16653
16659
  }
16654
- listPullFiles(o, r, n) {
16655
- return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/pulls/${n}/files`);
16660
+ listPullFiles(o, r, n2) {
16661
+ return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/pulls/${n2}/files`);
16656
16662
  }
16657
16663
  listCheckRunsForRef(o, r, ref, checkName) {
16658
16664
  const q = checkName ? `?check_name=${enc2(checkName)}&filter=latest` : "?filter=latest";
@@ -16680,11 +16686,11 @@ var RestClient = class {
16680
16686
  return void 0;
16681
16687
  }
16682
16688
  }
16683
- listIssueComments(o, r, n) {
16684
- return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/issues/${n}/comments`);
16689
+ listIssueComments(o, r, n2) {
16690
+ return this.paginate(`/repos/${enc2(o)}/${enc2(r)}/issues/${n2}/comments`);
16685
16691
  }
16686
- createIssueComment(o, r, n, body) {
16687
- return this.raw("POST", `/repos/${enc2(o)}/${enc2(r)}/issues/${n}/comments`, { body }).then((x) => x.data);
16692
+ createIssueComment(o, r, n2, body) {
16693
+ return this.raw("POST", `/repos/${enc2(o)}/${enc2(r)}/issues/${n2}/comments`, { body }).then((x) => x.data);
16688
16694
  }
16689
16695
  updateIssueComment(o, r, id, body) {
16690
16696
  return this.raw("PATCH", `/repos/${enc2(o)}/${enc2(r)}/issues/comments/${id}`, { body }).then((x) => x.data);
@@ -16776,7 +16782,7 @@ async function fetchRequired(api, owner, repo, branch) {
16776
16782
  const snap = await fetchRequiredSources(api.gh, owner, repo, branch, { rulesets: false });
16777
16783
  const set = resolveRequiredChecks({ classic: snap.classic, branchRules: snap.branchRules });
16778
16784
  const sources = [];
16779
- const rulesNote = snap.notes.some((n) => n.includes("/rules/branches/"));
16785
+ const rulesNote = snap.notes.some((n2) => n2.includes("/rules/branches/"));
16780
16786
  if (!rulesNote) {
16781
16787
  const any = snap.branchRules.some((r) => r.type === "required_status_checks" && (r.parameters?.required_status_checks ?? []).length > 0);
16782
16788
  sources.push(any ? "rulesets" : "rulesets (none required)");
@@ -16798,7 +16804,7 @@ async function collectSnapshot(api, repoFull, prNumber, policy, opts = {}) {
16798
16804
  fetchRequired(api, owner, repo, pr.baseRef)
16799
16805
  ]);
16800
16806
  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)));
16807
+ const headHasTests = [...headChecks.checkRuns.map((r) => r.name), ...headChecks.statuses.map((s) => s.context)].some((n2) => isTest.some((m) => m(n2)));
16802
16808
  const previousChecks = [];
16803
16809
  if (!headHasTests) {
16804
16810
  const earlier = commits.filter((c) => c.sha !== pr.headSha).reverse().slice(0, opts.previousCommitsToCheck ?? 3);
@@ -16914,6 +16920,7 @@ function mdCell(s, max = MAX_INLINE) {
16914
16920
  }
16915
16921
 
16916
16922
  // ../evidence/src/render.ts
16923
+ var plural5 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
16917
16924
  var MAX_SUMMARY = 65e3;
16918
16925
  var MAX_CELL_ITEM = 200;
16919
16926
  var MAX_LIST = 20;
@@ -16961,9 +16968,9 @@ function testsCell(r, e = MD) {
16961
16968
  function requiredCell(r, e = MD) {
16962
16969
  const c = r.checks;
16963
16970
  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`)" : "";
16971
+ const unknown2 = c.notes.some((n2) => /classic required checks unknown/.test(n2)) ? " (could not read branch protection; list the checks in `required_checks`)" : "";
16965
16972
  if (!c.required.length)
16966
- return c.requiredSources.length ? `none configured${unknown2}` : "unknown (no ruleset/protection readable; set `required_checks`)";
16973
+ return c.requiredSources.length ? `none configured${unknown2}` : "unknown (could not read rulesets or branch protection; list the checks in `required_checks`)";
16967
16974
  const ok = c.required.filter((x) => x.state === "success").length;
16968
16975
  const bad = c.required.filter((x) => x.state !== "success").map((x) => `${e.t(x.context, MAX_CELL_ITEM)}: ${e.t(x.state, 40)}`);
16969
16976
  return `${ok}/${c.required.length} passed${bad.length ? ` \u2014 ${joinCapped(bad, ", ")}` : ""}${unknown2}`;
@@ -16974,7 +16981,7 @@ function coverageCell(r, e = MD) {
16974
16981
  if (!c.present) return "no report";
16975
16982
  const format = e.t(String(c.format), 40);
16976
16983
  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` : ""}`;
16984
+ return `${c.pct}% (${c.covered}/${c.instrumented} changed lines, ${format})${c.notInReport.length ? `; ${plural5(c.notInReport.length, "changed file")} not in report` : ""}`;
16978
16985
  }
16979
16986
  function tamperCell(r) {
16980
16987
  const t = r.tamper.touched;
@@ -16988,8 +16995,8 @@ function tamperCell(r) {
16988
16995
  ].filter(([, v]) => v.length).map(([k, v]) => `${k} (${v.length})`);
16989
16996
  const w = [];
16990
16997
  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)`);
16998
+ const skips = s.reduce((n2, x) => n2 + x.skips.length + x.focus.length, 0);
16999
+ if (skips) w.push(`${plural5(skips, "skip/focus marker")}`);
16993
17000
  if (r.tamper.net.assertions < 0) w.push(`assertions ${r.tamper.net.assertions}`);
16994
17001
  if (r.tamper.net.cases < 0) w.push(`test cases ${r.tamper.net.cases}`);
16995
17002
  return [...parts, ...w].join(", ") || "nothing sensitive touched";
@@ -17007,7 +17014,7 @@ function renderCard(r, opts = {}) {
17007
17014
  const checkUrl = safeUrl(opts.checkUrl);
17008
17015
  if (checkUrl) meta2.push(`[check run](${checkUrl})`);
17009
17016
  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).`, "");
17017
+ 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
17018
  if (r.applies) {
17012
17019
  lines.push("| Evidence | On this commit |", "|---|---|");
17013
17020
  lines.push(`| Tests ran | ${testsCell(r)} |`);
@@ -17015,7 +17022,7 @@ function renderCard(r, opts = {}) {
17015
17022
  lines.push(`| Changed-line coverage | ${coverageCell(r)} |`);
17016
17023
  lines.push(`| Sensitive files / test weakening | ${tamperCell(r)} |`);
17017
17024
  lines.push(`| Description claims | ${claimsCell(r)} |`);
17018
- lines.push(`| Diff size | +${r.size.additions} \u2212${r.size.deletions} in ${r.size.files} file(s) |`);
17025
+ lines.push(`| Diff size | +${r.size.additions} \u2212${r.size.deletions} in ${plural5(r.size.files, "file")} |`);
17019
17026
  lines.push(`| Secret-like strings | ${r.secrets.length ? `${r.secrets.length} found` : "none"} |`, "");
17020
17027
  const section = (sev, heading) => {
17021
17028
  const fs = r.flags.filter((f) => f.severity === sev);
@@ -17042,7 +17049,7 @@ function renderCard(r, opts = {}) {
17042
17049
  }
17043
17050
  if (r.checks.notes.length) {
17044
17051
  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)}`);
17052
+ for (const n2 of r.checks.notes.slice(0, 20)) lines.push(`- ${mdText(n2)}`);
17046
17053
  lines.push("", "</details>", "");
17047
17054
  }
17048
17055
  if (r.policyWarnings.length) {
@@ -17050,7 +17057,7 @@ function renderCard(r, opts = {}) {
17050
17057
  for (const w of r.policyWarnings.slice(0, 50)) lines.push(`- ${mdText(w)}`);
17051
17058
  lines.push("", "</details>", "");
17052
17059
  }
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>`);
17060
+ 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
17061
  const out = lines.join("\n");
17055
17062
  return out.length > MAX_SUMMARY ? `${out.slice(0, MAX_SUMMARY - 40)}
17056
17063
 
@@ -17061,7 +17068,7 @@ function renderText(r) {
17061
17068
  const out = [];
17062
17069
  out.push(`${PRODUCT_NAME}: ${badge(r)} \u2014 ${headline(r, (s) => e.t(s))}`);
17063
17070
  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).`);
17071
+ if (!r.applies) out.push(`${e.t(r.appliesReason)}; the policy checks agent PRs only (set apply_to: all to check every PR).`);
17065
17072
  if (r.applies) {
17066
17073
  const rows = [
17067
17074
  ["Tests ran", testsCell(r, e)],
@@ -17069,7 +17076,7 @@ function renderText(r) {
17069
17076
  ["Changed-line coverage", coverageCell(r, e)],
17070
17077
  ["Sensitive files", tamperCell(r)],
17071
17078
  ["Description claims", claimsCell(r, e)],
17072
- ["Diff size", `+${r.size.additions} \u2212${r.size.deletions} in ${r.size.files} file(s)`],
17079
+ ["Diff size", `+${r.size.additions} \u2212${r.size.deletions} in ${plural5(r.size.files, "file")}`],
17073
17080
  ["Secret-like strings", r.secrets.length ? `${r.secrets.length} found` : "none"]
17074
17081
  ];
17075
17082
  out.push("");
@@ -17093,7 +17100,7 @@ function renderText(r) {
17093
17100
  for (const s of p.signals.slice(0, 30)) out.push(` ${s.source}: ${e.t(s.detail)}`);
17094
17101
  if (p.humanCommits.length) out.push(` commits with no agent signal: ${joinCapped(p.humanCommits.map((s) => s.slice(0, 7)), ", ")}`);
17095
17102
  }
17096
- for (const n of r.checks.notes.slice(0, 20)) out.push(`note: ${e.t(n)}`);
17103
+ for (const n2 of r.checks.notes.slice(0, 20)) out.push(`note: ${e.t(n2)}`);
17097
17104
  for (const w of r.policyWarnings.slice(0, 50)) out.push(`policy warning: ${e.t(w)}`);
17098
17105
  return out.join("\n");
17099
17106
  }
@@ -17237,8 +17244,8 @@ function readGitAiNotes(cwd, shas, opts = {}) {
17237
17244
  if (opts.fetch) git2(cwd, ["fetch", "--quiet", "origin", `+${GIT_AI_NOTES_REF}:${GIT_AI_NOTES_REF}`], { allowFail: true });
17238
17245
  const notes = {};
17239
17246
  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;
17247
+ const n2 = git2(cwd, ["notes", `--ref=${GIT_AI_NOTES_REF}`, "show", sha], { allowFail: true });
17248
+ if (n2.trim()) notes[sha] = n2;
17242
17249
  }
17243
17250
  return notes;
17244
17251
  }
@@ -17765,10 +17772,10 @@ function blame(a, path, lines) {
17765
17772
  if (m && inRange.has(m[1])) counts.set(m[1], (counts.get(m[1]) ?? 0) + 1);
17766
17773
  }
17767
17774
  let best;
17768
- let n = 0;
17769
- for (const [sha, c] of counts) if (c > n) {
17775
+ let n2 = 0;
17776
+ for (const [sha, c] of counts) if (c > n2) {
17770
17777
  best = sha;
17771
- n = c;
17778
+ n2 = c;
17772
17779
  }
17773
17780
  return best;
17774
17781
  }
@@ -18009,16 +18016,16 @@ function bagOf(lines) {
18009
18016
  }
18010
18017
  function subtract(a, b) {
18011
18018
  const out = /* @__PURE__ */ new Map();
18012
- for (const [t, n] of a) {
18013
- const d = n - (b.get(t) ?? 0);
18019
+ for (const [t, n2] of a) {
18020
+ const d = n2 - (b.get(t) ?? 0);
18014
18021
  if (d > 0) out.set(t, d);
18015
18022
  }
18016
18023
  return out;
18017
18024
  }
18018
18025
  function total(bag) {
18019
- let n = 0;
18020
- for (const v of bag.values()) n += v;
18021
- return n;
18026
+ let n2 = 0;
18027
+ for (const v of bag.values()) n2 += v;
18028
+ return n2;
18022
18029
  }
18023
18030
  function significant(line) {
18024
18031
  return /[A-Za-z0-9]/.test(line);
@@ -18070,15 +18077,15 @@ function isVersionOnly(h) {
18070
18077
  if (h.added.length === 0 || h.removed.length === 0) return false;
18071
18078
  const counts = /* @__PURE__ */ new Map();
18072
18079
  for (const line of h.removed) {
18073
- const n = normalize2(line);
18074
- counts.set(n, (counts.get(n) ?? 0) + 1);
18080
+ const n2 = normalize2(line);
18081
+ counts.set(n2, (counts.get(n2) ?? 0) + 1);
18075
18082
  }
18076
18083
  let paired = 0;
18077
18084
  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);
18085
+ const n2 = normalize2(line);
18086
+ const left = counts.get(n2) ?? 0;
18087
+ if (left > 0 && n2.includes(PLACEHOLDER2)) {
18088
+ counts.set(n2, left - 1);
18082
18089
  paired++;
18083
18090
  }
18084
18091
  }
@@ -18106,6 +18113,7 @@ function isGenerated(git4, rev, path) {
18106
18113
  }
18107
18114
 
18108
18115
  // ../intact/src/analyze.ts
18116
+ var plural6 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
18109
18117
  var EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
18110
18118
  var WINDOW = 2;
18111
18119
  var PARTIAL_THRESHOLD = 0.2;
@@ -18168,7 +18176,7 @@ function analyzeTwoParent(git4, report, opts) {
18168
18176
  report.changedFromAutoMerge = relevant.map(filePath).sort();
18169
18177
  report.conflictedFiles = [...auto.conflicted].filter((p) => !isIgnored(config2, p)).sort();
18170
18178
  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`);
18179
+ if (ignoredCount > 0) report.notes.push(`${plural6(ignoredCount, "file")} differing from the automatic merge are ignored by config`);
18172
18180
  if (relevant.length === 0) {
18173
18181
  report.status = "clean";
18174
18182
  return;
@@ -18359,9 +18367,9 @@ function judgeHunk(h, blocks, ps, mLines) {
18359
18367
  const psBag = bagOf(ps.slice(Math.max(0, psFrom - WINDOW), psTo + WINDOW));
18360
18368
  const mBag = bagOf(mLines.slice(Math.max(0, mFrom - WINDOW), mTo + WINDOW));
18361
18369
  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)));
18370
+ for (const [t, n2] of addTok) missing += Math.min(n2, Math.max(0, (psBag.get(t) ?? 0) - (mBag.get(t) ?? 0)));
18363
18371
  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)));
18372
+ for (const [t, n2] of remTok) restored += Math.min(n2, Math.max(0, (mBag.get(t) ?? 0) - (psBag.get(t) ?? 0)));
18365
18373
  const sigAdded = h.added.some(significant);
18366
18374
  const sigRemoved = h.removed.some(significant);
18367
18375
  if (A > 0 && sigAdded) {
@@ -18625,6 +18633,7 @@ var STATUS_LABEL = {
18625
18633
  "not-a-merge": "skip not a merge commit",
18626
18634
  error: "ERROR analysis failed"
18627
18635
  };
18636
+ var n = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
18628
18637
  function lineRef(f) {
18629
18638
  if (!f.mergeLines) return f.path;
18630
18639
  const { start, end } = f.mergeLines;
@@ -18674,14 +18683,14 @@ function formatMerge(m) {
18674
18683
  if (m.strategy) facts.push(`via ${m.strategy}`);
18675
18684
  out.push(` ${facts.join(", ")}`);
18676
18685
  if (m.conflictedFiles.length) out.push(` conflicted: ${m.conflictedFiles.join(", ")}`);
18677
- for (const n of m.notes) out.push(` note: ${n}`);
18686
+ for (const n2 of m.notes) out.push(` note: ${n2}`);
18678
18687
  if (m.error) out.push(` error: ${m.error}`);
18679
18688
  for (const g of groupFindings(m.findings)) {
18680
18689
  out.push(...formatFinding(g[0]));
18681
18690
  if (g.length > 1) {
18682
18691
  const refs = g.slice(1).map((f) => f.mergeLines ? String(f.mergeLines.start) : "file");
18683
18692
  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}`);
18693
+ 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
18694
  out.push(` (a resolution that took one side's whole file looks like this; --json lists every hunk)`);
18686
18695
  }
18687
18696
  }
@@ -18718,7 +18727,7 @@ function formatHuman(r) {
18718
18727
  }
18719
18728
  const s = r.summary;
18720
18729
  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`
18730
+ `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
18731
  );
18723
18732
  return out.join("\n") + "\n";
18724
18733
  }
@@ -18733,14 +18742,14 @@ usage:
18733
18742
 
18734
18743
  options:
18735
18744
  --range A..B check every merge commit in the range
18736
- --main <branch> main branch (default: config main_branch, origin/HEAD, main, master)
18745
+ --main <branch> the main branch (default: config main_branch, origin/HEAD, main, master)
18737
18746
  --config <path> config file (default: ${BRAND.configFile} at the repo root). An
18738
18747
  owner/repo extends is read with GITHUB_TOKEN or GH_TOKEN when set
18739
18748
  --json machine-readable report on stdout
18740
18749
  --fail-on <level> lowest level that makes the exit code 1: error, warning (default), notice
18741
18750
  --strategy <name> force remerge-diff, merge-tree or worktree (default: by git version)
18742
18751
  -C <dir> run in <dir>
18743
- -h, --help this help
18752
+ -h, --help show this help
18744
18753
  -v, --version print the version
18745
18754
 
18746
18755
  exit codes: 0 clean, 1 findings, 2 error
@@ -18786,13 +18795,13 @@ function parseArgs2(argv) {
18786
18795
  break;
18787
18796
  case "--fail-on": {
18788
18797
  const v = value();
18789
- if (!LEVELS.includes(v) || v === "off") throw new UsageError(`--fail-on must be error, warning or notice`);
18798
+ if (!LEVELS.includes(v) || v === "off") throw new UsageError(`--fail-on: expected error, warning or notice`);
18790
18799
  p.failOn = v;
18791
18800
  break;
18792
18801
  }
18793
18802
  case "--strategy": {
18794
18803
  const v = value();
18795
- if (v !== "remerge-diff" && v !== "merge-tree" && v !== "worktree") throw new UsageError(`unknown strategy: ${v}`);
18804
+ if (v !== "remerge-diff" && v !== "merge-tree" && v !== "worktree") throw new UsageError(`unknown strategy: ${v} (expected remerge-diff, merge-tree or worktree)`);
18796
18805
  p.strategy = v;
18797
18806
  break;
18798
18807
  }
@@ -19125,13 +19134,13 @@ var alembic = {
19125
19134
  const referenced = new Set(revs.flatMap((r) => r.parents));
19126
19135
  const heads = revs.filter((r) => !referenced.has(r.revision));
19127
19136
  if (heads.length > 1) {
19128
- const labelled = revs.some((r) => r.branchLabels);
19137
+ const labeled = revs.some((r) => r.branchLabels);
19129
19138
  findings.push({
19130
19139
  framework: "alembic",
19131
19140
  root,
19132
19141
  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." : ""),
19142
+ severity: labeled ? "warning" : "error",
19143
+ 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
19144
  files: heads.map((h) => h.path),
19136
19145
  hint: `alembic merge -m "merge heads" ${heads.map((h) => h.revision).join(" ")} (or re-parent the branch's revision onto main's head)`,
19137
19146
  // keyed on the count so a PR that adds a third head to a two-head main is still reported
@@ -19203,7 +19212,7 @@ var django = {
19203
19212
  const migs = migrations(tree, root);
19204
19213
  const app = migs[0]?.app ?? basename(dirname(root));
19205
19214
  const findings = [];
19206
- const names = new Set(migs.flatMap((m) => [m.name, ...m.replaces.filter(([a]) => a === app).map(([, n]) => n)]));
19215
+ const names = new Set(migs.flatMap((m) => [m.name, ...m.replaces.filter(([a]) => a === app).map(([, n2]) => n2)]));
19207
19216
  for (const [num2, list5] of groupBy(migs, (m) => m.number)) {
19208
19217
  if (list5.length > 1 && /^\d{4}$/.test(num2))
19209
19218
  findings.push({
@@ -19234,13 +19243,13 @@ var django = {
19234
19243
  }
19235
19244
  }
19236
19245
  const dependedOn = /* @__PURE__ */ new Set();
19237
- for (const m of migs) for (const [a, n] of m.deps) if (a === app) dependedOn.add(n);
19246
+ for (const m of migs) for (const [a, n2] of m.deps) if (a === app) dependedOn.add(n2);
19238
19247
  for (const m of migs) {
19239
19248
  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));
19249
+ const replaced = m.replaces.filter(([a]) => a === app).map(([, n2]) => n2);
19250
+ if (replaced.some((n2) => dependedOn.has(n2))) dependedOn.add(m.name);
19251
+ if (dependedOn.has(m.name)) replaced.forEach((n2) => dependedOn.add(n2));
19252
+ replaced.forEach((n2) => dependedOn.add(n2));
19244
19253
  }
19245
19254
  const leaves = migs.filter((m) => !dependedOn.has(m.name));
19246
19255
  if (leaves.length > 1)
@@ -19259,6 +19268,7 @@ var django = {
19259
19268
  };
19260
19269
 
19261
19270
  // ../migrations/src/frameworks/drizzle.ts
19271
+ var plural7 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
19262
19272
  var ZERO_ID = "00000000-0000-0000-0000-000000000000";
19263
19273
  function parseJournal(text) {
19264
19274
  if (text === void 0) return void 0;
@@ -19298,7 +19308,7 @@ var drizzle = {
19298
19308
  root,
19299
19309
  code: "journal-unreadable",
19300
19310
  severity: "error",
19301
- message: `${jp} is missing or is not valid JSON (unresolved merge markers?)`,
19311
+ message: `${jp} is missing or is not valid JSON (check for leftover merge conflict markers)`,
19302
19312
  files: [jp],
19303
19313
  hint: "Resolve the journal: union the entries by tag and re-index idx sequentially.",
19304
19314
  key: `drizzle:${root}:unreadable`
@@ -19426,7 +19436,7 @@ var drizzle = {
19426
19436
  root: ctx.root,
19427
19437
  code: "journal-fork",
19428
19438
  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.`,
19439
+ 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
19440
  files: [jp],
19431
19441
  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
19442
  key: `drizzle:${ctx.root}:journal-fork`
@@ -19557,17 +19567,17 @@ var rails = {
19557
19567
  key: `rails:${root}:dupver:${v}`
19558
19568
  });
19559
19569
  }
19560
- for (const [n, l] of groupBy(migs, (m) => m.name)) {
19570
+ for (const [n2, l] of groupBy(migs, (m) => m.name)) {
19561
19571
  if (l.length > 1)
19562
19572
  findings.push({
19563
19573
  framework: "rails",
19564
19574
  root,
19565
19575
  code: "duplicate-name",
19566
19576
  severity: "error",
19567
- message: `${l.length} migrations are named ${n}; Rails raises DuplicateMigrationNameError`,
19577
+ message: `${l.length} migrations are named ${n2}; Rails raises DuplicateMigrationNameError`,
19568
19578
  files: l.map((m) => m.path),
19569
19579
  hint: "Rename the branch migration (file and class).",
19570
- key: `rails:${root}:dupname:${n}`
19580
+ key: `rails:${root}:dupname:${n2}`
19571
19581
  });
19572
19582
  }
19573
19583
  return findings;
@@ -19761,6 +19771,7 @@ function analyzeTrees(opts) {
19761
19771
  }
19762
19772
 
19763
19773
  // ../migrations/src/report.ts
19774
+ var plural8 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
19764
19775
  var short = (sha) => sha.slice(0, 7);
19765
19776
  var icon = (f) => f.severity === "error" ? "error" : "warning";
19766
19777
  function toMarkdown(r, opts = {}) {
@@ -19770,11 +19781,11 @@ function toMarkdown(r, opts = {}) {
19770
19781
  lines.push(`### ${opts.title ?? PRODUCT}`);
19771
19782
  lines.push("");
19772
19783
  if (!r.roots.length) {
19773
- lines.push("No migration ledgers found.");
19784
+ lines.push("No migrations found for a supported framework.");
19774
19785
  return lines.join("\n");
19775
19786
  }
19776
19787
  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)}).`
19788
+ 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
19789
  );
19779
19790
  lines.push("");
19780
19791
  if (r.findings.length) {
@@ -19787,7 +19798,7 @@ function toMarkdown(r, opts = {}) {
19787
19798
  lines.push("");
19788
19799
  }
19789
19800
  lines.push(
19790
- `<details><summary>Ledgers checked (${r.roots.length})</summary>
19801
+ `<details><summary>Migration directories checked (${r.roots.length})</summary>
19791
19802
 
19792
19803
  ` + r.roots.map((x) => `- ${x.framework}: ${mdCode(x.root, 200)}${x.touched ? " (changed in this PR)" : ""}`).join("\n") + (r.preExisting.length ? `
19793
19804
 
@@ -19813,6 +19824,7 @@ function toText(r) {
19813
19824
  }
19814
19825
 
19815
19826
  // ../migrations/src/publish.ts
19827
+ var plural9 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
19816
19828
  async function publish2(report, o) {
19817
19829
  const stale = !report.ok;
19818
19830
  const base = `/repos/${o.owner}/${o.repo}`;
@@ -19854,7 +19866,7 @@ Resolved: migrations are consistent with ${mdCode(report.main.ref)} at ${report.
19854
19866
  await o.gh.request("POST", `${base}/statuses/${report.head.sha}`, {
19855
19867
  state,
19856
19868
  context: STATUS_CONTEXT,
19857
- description: (stale ? `${errors2} migration error(s) against ${report.main.ref}` : `Migrations consistent with ${report.main.ref}`).slice(0, 140),
19869
+ description: (stale ? `${plural9(errors2, "migration error")} against ${report.main.ref}` : `Migrations consistent with ${report.main.ref}`).slice(0, 140),
19858
19870
  target_url: o.targetUrl
19859
19871
  });
19860
19872
  result.status = state;
@@ -19863,8 +19875,9 @@ Resolved: migrations are consistent with ${mdCode(report.main.ref)} at ${report.
19863
19875
  }
19864
19876
 
19865
19877
  // ../migrations/src/recheck.ts
19878
+ var plural10 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
19866
19879
  var MAIN_REF = "refs/mainfast/main";
19867
- var prRef = (n) => `refs/mainfast/pr/${n}`;
19880
+ var prRef = (n2) => `refs/mainfast/pr/${n2}`;
19868
19881
  async function recheckOpenPrs(o) {
19869
19882
  const remote = o.remote ?? "origin";
19870
19883
  const pulls = (await o.gh.paginate(
@@ -19874,7 +19887,7 @@ async function recheckOpenPrs(o) {
19874
19887
  if (!o.noFetch) {
19875
19888
  const fetch2 = (specs) => git3(o.repoDir, ["fetch", "--no-tags", "--quiet", remote, ...specs]);
19876
19889
  const mainSpec = `+refs/heads/${o.mainBranch}:${MAIN_REF}`;
19877
- const prSpec = (n) => `+refs/pull/${n}/head:${prRef(n)}`;
19890
+ const prSpec = (n2) => `+refs/pull/${n2}/head:${prRef(n2)}`;
19878
19891
  try {
19879
19892
  fetch2([mainSpec, ...pulls.map((p) => prSpec(p.number))]);
19880
19893
  } catch {
@@ -19931,7 +19944,7 @@ function recheckMarkdown(entries, mainBranch) {
19931
19944
  const lines = [
19932
19945
  `### Open PRs re-checked against ${mdCode(mainBranch)}`,
19933
19946
  "",
19934
- `${entries.length} open PR(s) checked, ${stale.length} stale.`,
19947
+ `${plural10(entries.length, "open PR")} checked, ${stale.length} stale.`,
19935
19948
  ""
19936
19949
  ];
19937
19950
  if (entries.length) {
@@ -20013,7 +20026,7 @@ async function main3(argv) {
20013
20026
  console.log(values.format === "json" ? JSON.stringify(entries, null, 2) : recheckMarkdown(entries, values["main-branch"]));
20014
20027
  return 0;
20015
20028
  }
20016
- console.error(`unknown command ${cmd}
20029
+ console.error(`unknown command: ${cmd}
20017
20030
 
20018
20031
  ${USAGE2}`);
20019
20032
  return 2;
@@ -20318,12 +20331,12 @@ var OwnersApi = class {
20318
20331
  });
20319
20332
  }
20320
20333
  /** GET /repos/{o}/{r}/pulls/{n}. */
20321
- pull(n) {
20322
- return this.memo(`pull:${n}`, () => this.gh.get(`${this.base}/pulls/${n}`));
20334
+ pull(n2) {
20335
+ return this.memo(`pull:${n2}`, () => this.gh.get(`${this.base}/pulls/${n2}`));
20323
20336
  }
20324
20337
  /** 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`));
20338
+ prFiles(n2) {
20339
+ return this.memo(`files:${n2}`, () => this.gh.paginate(`${this.base}/pulls/${n2}/files?per_page=100`));
20327
20340
  }
20328
20341
  /** GET /repos/{o}/{r}/git/trees/{ref}?recursive=1 -> blob paths. */
20329
20342
  treePaths(ref) {
@@ -20431,9 +20444,9 @@ function level(key2, v) {
20431
20444
  return s;
20432
20445
  }
20433
20446
  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;
20447
+ const n2 = Number(v);
20448
+ if (v === "" || v === null || typeof v === "boolean" || !Number.isInteger(n2) || n2 < min || n2 > max) throw new Error(`${key2}: expected a whole number ${min}..${max}`);
20449
+ return n2;
20437
20450
  }
20438
20451
  function fromSection(raw) {
20439
20452
  const cfg = { ...DEFAULT_CONFIG2 };
@@ -20467,6 +20480,7 @@ function configFromDoc2(doc) {
20467
20480
  }
20468
20481
 
20469
20482
  // ../owners/src/audit.ts
20483
+ var plural11 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
20470
20484
  var FIXES = {
20471
20485
  "unowned-files": "Add a CODEOWNERS line for these paths (see the suggested lines), or list them under `owners.ignore`.",
20472
20486
  "unknown-user": "The account was deleted or renamed: put the current login or a team in its place.",
@@ -20664,7 +20678,7 @@ var ownersIn = (rules) => rules.flatMap((r) => r.owners);
20664
20678
  function orgNote(org, checker, api) {
20665
20679
  const { usersUnchecked: u, teamsUnchecked: t } = checker;
20666
20680
  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 ");
20681
+ const what = [t ? `${plural11(t, "team owner")} (existence and write access)` : "", u ? `org membership of ${plural11(u, "user owner")}` : ""].filter(Boolean).join(" and ");
20668
20682
  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
20683
  return `Not checked: ${what}: ${why}. Unchecked teams count as valid owners; user owners were still checked for existence and write access.`;
20670
20684
  }
@@ -20682,9 +20696,9 @@ async function dormancy(statuses, api, cfg, days, now, org) {
20682
20696
  let total2 = 0;
20683
20697
  let complete = true;
20684
20698
  for (const m of members2) {
20685
- const n = await api.reviewsSince(m, since);
20686
- if (n === void 0) complete = false;
20687
- else total2 += n;
20699
+ const n2 = await api.reviewsSince(m, since);
20700
+ if (n2 === void 0) complete = false;
20701
+ else total2 += n2;
20688
20702
  if (total2 > 0) break;
20689
20703
  }
20690
20704
  st.reviews = total2 > 0 || complete ? total2 : void 0;
@@ -20769,13 +20783,13 @@ async function auditOwners(input) {
20769
20783
  code: "unowned-files",
20770
20784
  severity: cfg.requireOwners ? "error" : "warning",
20771
20785
  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)`,
20786
+ 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
20787
  paths: unowned
20774
20788
  } : {
20775
20789
  code: "unowned-files",
20776
20790
  severity: "warning",
20777
20791
  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(", ")}`,
20792
+ 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
20793
  paths: unowned.slice(0, 200)
20780
20794
  }
20781
20795
  );
@@ -20826,14 +20840,14 @@ async function auditOwners(input) {
20826
20840
  report.orgChecks = "untrusted-pr";
20827
20841
  if (checker.publicOnly)
20828
20842
  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.`
20843
+ `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
20844
  );
20831
20845
  report.owners = [...checker.statuses.values()];
20832
20846
  } else if (checker && api) {
20833
20847
  report.orgChecks = await api.orgChecks();
20834
20848
  const note = orgNote(report.orgChecks, checker, api);
20835
20849
  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.`);
20850
+ if (checker.permUnknown) notes.push(`Repository permission of ${plural11(checker.permUnknown, "user owner")} could not be read (403); they count as valid.`);
20837
20851
  if (co && days > 0) {
20838
20852
  const sts = [...new Set(ownersIn(co.rules).map(key))].map((k) => checker.statuses.get(k)).filter((s) => !!s);
20839
20853
  await dormancy(sts, api, cfg, days, now, report.orgChecks);
@@ -20842,7 +20856,7 @@ async function auditOwners(input) {
20842
20856
  if (report.dormancy.capped) {
20843
20857
  const total2 = sts.filter((s) => s.reviews !== void 0).length;
20844
20858
  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.`
20859
+ `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
20860
  );
20847
20861
  }
20848
20862
  if (cfg.expandTeams && report.orgChecks !== "enabled" && sts.some((s) => s.kind === "team"))
@@ -20913,6 +20927,7 @@ async function loadConfigFromRepo(gh, owner, repo, ref) {
20913
20927
  }
20914
20928
 
20915
20929
  // ../owners/src/report.ts
20930
+ var plural12 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
20916
20931
  var MAX_PATHS = 50;
20917
20932
  var MAX_ROWS = 100;
20918
20933
  var MAX_MD = 65e3;
@@ -20936,15 +20951,15 @@ function headline2(r) {
20936
20951
  const current = r.findings.filter((f) => f.scope === "current");
20937
20952
  const proposed = r.findings.filter((f) => f.scope === "proposed");
20938
20953
  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";
20954
+ 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
20955
  const pe = errors(proposed);
20941
20956
  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" : "";
20957
+ const p = r.proposed ? proposed.length ? `; this PR's CODEOWNERS: ${plural12(pe, "error")}, ${plural12(pw, "warning")}` : "; this PR's CODEOWNERS looks right" : "";
20943
20958
  return plainText(`${files}${p}`, 255, true);
20944
20959
  }
20945
20960
  const e = errors(current);
20946
20961
  return plainText(
20947
- current.length ? `${e} error(s), ${current.length - e} warning(s) in ${r.codeownersPath ?? "CODEOWNERS"}` : `${r.codeownersPath ?? "CODEOWNERS"} is healthy`,
20962
+ current.length ? `${plural12(e, "error")}, ${plural12(current.length - e, "warning")} in ${r.codeownersPath ?? "CODEOWNERS"}` : `${r.codeownersPath ?? "CODEOWNERS"} is healthy`,
20948
20963
  255,
20949
20964
  true
20950
20965
  );
@@ -20983,7 +20998,7 @@ function toMarkdown2(r, o = {}) {
20983
20998
  out.push(`#### This PR's CODEOWNERS (${where})`, "");
20984
20999
  out.push(...proposed.length ? table(proposed) : ["No problems found: valid syntax, every owner can review, no dead or shadowed lines."], "");
20985
21000
  }
20986
- if (r.notes.length) out.push("**Not checked / notes**", "", ...r.notes.map((n) => `- ${mdCell(n, 1e3)}`), "");
21001
+ if (r.notes.length) out.push("**Notes**", "", ...r.notes.map((n2) => `- ${mdCell(n2, 1e3)}`), "");
20987
21002
  const run = safeUrl(o.runUrl);
20988
21003
  out.push(`${run ? `[run](${run}) \xB7 ` : ""}[docs](${DOCS_URL3})`);
20989
21004
  const md = out.join("\n");
@@ -20999,7 +21014,7 @@ function toText2(r) {
20999
21014
  if (f.code === "unowned-files" && f.paths) for (const p of f.paths.slice(0, MAX_PATHS)) out.push(` ${t(p)}`);
21000
21015
  if (f.hint) out.push(t(` fix: ${f.hint}`));
21001
21016
  }
21002
- for (const n of r.notes) out.push(t(`note: ${n}`));
21017
+ for (const n2 of r.notes) out.push(t(`note: ${n2}`));
21003
21018
  out.push(r.ok ? "ok" : "FAILED");
21004
21019
  return out.join("\n");
21005
21020
  }
@@ -21083,9 +21098,9 @@ async function main4(argv) {
21083
21098
  const probe = new OwnersApi(gh, owner, repo);
21084
21099
  let loadedPr;
21085
21100
  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);
21101
+ const n2 = Number(values.pr);
21102
+ if (!Number.isInteger(n2) || n2 <= 0) throw new Error("pr needs --pr N");
21103
+ loadedPr = await probe.pull(n2);
21089
21104
  }
21090
21105
  const baseRef = loadedPr ? loadedPr.base.ref : values.ref ?? await probe.defaultBranch();
21091
21106
  config2 ??= (await loadConfigFromRepo(gh, owner, repo, baseRef)).cfg;
@@ -21382,6 +21397,7 @@ function branchAllowed(t, branch) {
21382
21397
  }
21383
21398
 
21384
21399
  // ../rollcall/src/audit.ts
21400
+ var plural13 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
21385
21401
  function requiredSet(s) {
21386
21402
  return resolveRequiredChecks({ classic: s.classic, branchRules: s.branchRules, rulesets: s.rulesets });
21387
21403
  }
@@ -21391,7 +21407,7 @@ var FIXES2 = {
21391
21407
  "stopped-reporting": "Find the commit that removed or renamed the job, then restore it or update the required list.",
21392
21408
  "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
21409
  "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.",
21410
+ "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
21411
  "branch-filtered": "Add this branch to the workflow's `pull_request` branches filter (or remove the filter).",
21396
21412
  "not-on-pull-request": "Add a `pull_request` trigger (and `merge_group` if you use a merge queue).",
21397
21413
  "app-mismatch": "Pin the requirement to the app that reports it (GitHub Actions is 15368 on github.com), or to any source.",
@@ -21432,7 +21448,7 @@ function similarity(a, b) {
21432
21448
  const jac = shared / Math.max(1, (/* @__PURE__ */ new Set([...tx, ...ty])).size);
21433
21449
  return Math.max(lev, jac);
21434
21450
  }
21435
- var prList = (ns) => ns.map((n) => `#${n}`).join(", ");
21451
+ var prList = (ns) => ns.map((n2) => `#${n2}`).join(", ");
21436
21452
  var ALWAYS = /\b(always|failure|cancelled)\s*\(\s*\)/;
21437
21453
  var isMerged = (p) => (p.state ?? "merged") === "merged";
21438
21454
  var STALLED_MERGES_DAYS = 7;
@@ -21458,7 +21474,7 @@ function mergedWithout(context, missing) {
21458
21474
  code: "merged-without",
21459
21475
  severity: "warning",
21460
21476
  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`,
21477
+ 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
21478
  evidence: missing.slice(0, 10)
21463
21479
  };
21464
21480
  }
@@ -21479,7 +21495,7 @@ function audit(s, opts = {}) {
21479
21495
  return { p, c, names };
21480
21496
  });
21481
21497
  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]);
21498
+ for (const { p, names } of obs) for (const n2 of names) seenNames.set(n2, [...seenNames.get(n2) ?? [], p.number]);
21483
21499
  for (const w of workflows)
21484
21500
  if (w.error) findings.push({ code: "workflow-unparsable", severity: "warning", message: `\`${w.path}\` is not valid YAML: ${w.error}` });
21485
21501
  for (const r of set.notEnforced) {
@@ -21568,22 +21584,22 @@ function audit(s, opts = {}) {
21568
21584
  });
21569
21585
  const seen = pulls.length - by.missing.length;
21570
21586
  if (pulls.length && seen === 0) {
21571
- const matrixLegs = [...seenNames.keys()].filter((n) => n.startsWith(`${r.context} (`) && !requiredNames.has(n));
21587
+ const matrixLegs = [...seenNames.keys()].filter((n2) => n2.startsWith(`${r.context} (`) && !requiredNames.has(n2));
21572
21588
  const staticLegs = workflows.flatMap((w) => w.jobs).filter((j) => j.matrix && j.rawName === r.context);
21573
21589
  if (matrixLegs.length || staticLegs.length) {
21574
21590
  findings.push({
21575
21591
  code: "matrix-name-mismatch",
21576
21592
  severity: "error",
21577
21593
  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.`,
21594
+ 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
21595
  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
21596
  });
21581
21597
  } else {
21582
21598
  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))
21599
+ ...[...seenNames.keys()].filter((n2) => !requiredNames.has(n2)),
21600
+ ...workflows.flatMap((w) => w.jobs).filter((j) => !/\$\{\{/.test(j.rawName) && !j.matrix && !j.reusable).map((j) => j.rawName).filter((n2) => !requiredNames.has(n2))
21585
21601
  ]);
21586
- const best = [...candidates].map((n) => ({ n, s: similarity(r.context, n) })).sort((a, b) => b.s - a.s)[0];
21602
+ const best = [...candidates].map((n2) => ({ n: n2, s: similarity(r.context, n2) })).sort((a, b) => b.s - a.s)[0];
21587
21603
  if (best && best.s >= 0.5) {
21588
21604
  const on = seenNames.get(best.n)?.length ?? 0;
21589
21605
  findings.push({
@@ -21605,12 +21621,12 @@ function audit(s, opts = {}) {
21605
21621
  }
21606
21622
  } else if (pulls.length) {
21607
21623
  const missingStreak = (list5) => {
21608
- let n = 0;
21624
+ let n2 = 0;
21609
21625
  for (const x of list5) {
21610
21626
  if (!missingAt.has(x.p.number)) break;
21611
- n++;
21627
+ n2++;
21612
21628
  }
21613
- return n;
21629
+ return n2;
21614
21630
  };
21615
21631
  const mergedObs = obs.filter((x) => isMerged(x.p));
21616
21632
  const streak = missingStreak(mergedObs);
@@ -21625,8 +21641,8 @@ function audit(s, opts = {}) {
21625
21641
  const recent = streak >= stoppedAfter ? mergedObs.slice(0, streak) : openFirst.slice(0, blockedOpen);
21626
21642
  const older = streak >= stoppedAfter ? mergedObs.slice(streak) : mergedObs;
21627
21643
  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];
21644
+ const appeared = [...seenNames.keys()].filter((n2) => !requiredNames.has(n2) && recent.every((x) => x.names.has(n2)) && !older.some((x) => x.names.has(n2)));
21645
+ 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
21646
  const onlyOpen = streak < stoppedAfter;
21631
21647
  if (!best && onlyPathFiltered(producers, workflows)) {
21632
21648
  if (mergedBy.missing.length) findings.push(mergedWithout(r.context, mergedBy.missing));
@@ -21665,7 +21681,7 @@ function audit(s, opts = {}) {
21665
21681
  evidence: mergedBy.failed.slice(0, 10)
21666
21682
  });
21667
21683
  const notDone = /* @__PURE__ */ new Set([...mergedBy.pending, ...mergedBy.stale]);
21668
- const pendingAtMerge = obs.map((x) => x.p.number).filter((n) => notDone.has(n));
21684
+ const pendingAtMerge = obs.map((x) => x.p.number).filter((n2) => notDone.has(n2));
21669
21685
  if (pendingAtMerge.length)
21670
21686
  findings.push({
21671
21687
  code: "merged-while-pending",
@@ -21788,6 +21804,7 @@ function producesRequired(j, required2) {
21788
21804
  }
21789
21805
 
21790
21806
  // ../rollcall/src/collect.ts
21807
+ var plural14 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
21791
21808
  async function soft2(notes, what, fn, fallback) {
21792
21809
  try {
21793
21810
  return await fn();
@@ -21843,7 +21860,7 @@ async function collect(o) {
21843
21860
  if (!obs.checkRuns.length && !obs.statuses.length) silent++;
21844
21861
  else pulls.push(obs);
21845
21862
  }
21846
- if (silent) notes.push(`${silent} open PR(s) had no check runs or statuses on their head yet and were not counted`);
21863
+ 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
21864
  }
21848
21865
  pulls.sort((x, y) => String(y.mergedAt ?? y.updatedAt ?? "").localeCompare(String(x.mergedAt ?? x.updatedAt ?? "")));
21849
21866
  const workflows = o.workflows ?? await fetchWorkflows(gh, owner, repo, branch, notes);
@@ -21872,9 +21889,9 @@ function level2(key2, v) {
21872
21889
  return s;
21873
21890
  }
21874
21891
  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;
21892
+ const n2 = Number(v);
21893
+ if (!Number.isInteger(n2) || n2 < min || n2 > max) throw new Error(`${CONFIG_SECTION4}.${key2}: expected ${min}..${max}`);
21894
+ return n2;
21878
21895
  }
21879
21896
  function fromSection2(raw) {
21880
21897
  const cfg = { ...DEFAULT_CONFIG3 };
@@ -21902,7 +21919,7 @@ function readLocalWorkflows(repoDir) {
21902
21919
  const rel = ".github/workflows";
21903
21920
  if (repoPathKind(repoDir, rel) !== "directory") return void 0;
21904
21921
  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()) {
21922
+ for (const f of (0, import_node_fs9.readdirSync)((0, import_node_path7.join)(repoDir, rel)).filter((n2) => /\.ya?ml$/.test(n2)).sort()) {
21906
21923
  try {
21907
21924
  const text = readRepoFile(repoDir, `${rel}/${f}`);
21908
21925
  if (text !== void 0) out.push({ path: `${rel}/${f}`, text });
@@ -21914,23 +21931,25 @@ function readLocalWorkflows(repoDir) {
21914
21931
  }
21915
21932
 
21916
21933
  // ../rollcall/src/report.ts
21934
+ var plural15 = (n2, noun) => `${n2} ${noun}${n2 === 1 ? "" : "s"}`;
21917
21935
  var cellCode = (s) => mdCode(s).replace(/\|/g, "\\|");
21918
- var prRefs = (ns) => ns.map((n) => `#${n}`).join(", ");
21936
+ var prRefs = (ns) => ns.map((n2) => `#${n2}`).join(", ");
21919
21937
  function rulesUnread(r) {
21920
- return !r.required.length && r.notes.some((n) => /\/(rules\/branches\/|rulesets)[^:]*: 403/.test(n));
21938
+ return !r.required.length && r.notes.some((n2) => /\/(rules\/branches\/|rulesets)[^:]*: 403/.test(n2));
21921
21939
  }
21922
21940
  function title(r) {
21923
21941
  if (rulesUnread(r)) return "Required checks could not be read";
21924
21942
  const e = r.findings.filter((f) => f.severity === "error").length;
21925
21943
  const w = r.findings.length - e;
21926
21944
  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`,
21945
+ 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
21946
  255,
21929
21947
  true
21930
21948
  );
21931
21949
  }
21932
21950
  function sampleLine(r) {
21933
- return `across the last ${r.sampledPulls.length} merged${r.sampledOpen.length ? ` and ${r.sampledOpen.length} open` : ""} PR(s)`;
21951
+ const total2 = r.sampledPulls.length + r.sampledOpen.length;
21952
+ return `across the last ${r.sampledPulls.length} merged${r.sampledOpen.length ? ` and ${r.sampledOpen.length} open` : ""} ${total2 === 1 ? "PR" : "PRs"}`;
21934
21953
  }
21935
21954
  function toMarkdown3(r, o = {}) {
21936
21955
  const h = o.heading ?? "###";
@@ -21954,7 +21973,7 @@ function toMarkdown3(r, o = {}) {
21954
21973
  );
21955
21974
  lines.push("");
21956
21975
  }
21957
- if (r.notes.length) lines.push("<details><summary>Notes</summary>", "", ...r.notes.map((n) => `- ${mdText(n, 1e3)}`), "", "</details>", "");
21976
+ if (r.notes.length) lines.push("<details><summary>Notes</summary>", "", ...r.notes.map((n2) => `- ${mdText(n2, 1e3)}`), "", "</details>", "");
21958
21977
  const run = safeUrl(o.runUrl);
21959
21978
  lines.push(
21960
21979
  `Sampled merged: ${prRefs(r.sampledPulls) || "none"}${r.sampledOpen.length ? ` \xB7 open: ${prRefs(r.sampledOpen)}` : ""}${run ? ` \xB7 [run](${run})` : ""} \xB7 [docs](${DOCS_URL4})`
@@ -21974,7 +21993,7 @@ function toText3(r) {
21974
21993
  out.push(`${f.severity.toUpperCase()} [${f.code}] ${f.message}`);
21975
21994
  if (f.hint) out.push(` fix: ${f.hint}`);
21976
21995
  }
21977
- for (const n of r.notes) out.push(`note: ${n}`);
21996
+ for (const n2 of r.notes) out.push(`note: ${n2}`);
21978
21997
  out.push(r.ok ? "ok" : "FAILED");
21979
21998
  return out.map((l) => plainText(l, 4e3, true)).join("\n");
21980
21999
  }
@@ -22088,10 +22107,10 @@ function parseReport(r) {
22088
22107
  // src/commands.ts
22089
22108
  var AUDIT_CHECKS = ["rollcall", "owners", "migrations", "evidence"];
22090
22109
  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."
22110
+ 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.",
22111
+ 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.",
22112
+ migrations: "A checkout with the main branch fetched. No token needed.",
22113
+ 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
22114
  };
22096
22115
  function assemble(command, extra, r, text) {
22097
22116
  if (text) {
@@ -22128,12 +22147,12 @@ function auditArgs(root, o) {
22128
22147
  return ["check", "--repo", root, "--main", mainRef(root, o.main), "--format", "json"];
22129
22148
  case "evidence":
22130
22149
  if (o.pr !== void 0) {
22131
- if (!Number.isInteger(o.pr) || o.pr <= 0) throw new CliError("pr: expected a pull request number");
22150
+ if (!Number.isInteger(o.pr) || o.pr <= 0) throw new CliError("--pr: expected a pull request number");
22132
22151
  return ["pr", "--repo", needRepo(), "--pr", String(o.pr), "--json"];
22133
22152
  }
22134
22153
  return ["local", "--base", mainRef(root, o.main), "--repo", root, "--json"];
22135
22154
  default:
22136
- throw new CliError(`unknown check: ${o.check}; one of ${AUDIT_CHECKS.join(", ")}`);
22155
+ throw new CliError(`unknown check: ${o.check} (expected one of ${AUDIT_CHECKS.join(", ")})`);
22137
22156
  }
22138
22157
  }
22139
22158
  async function runAudit(o) {
@@ -22148,19 +22167,19 @@ var import_node_fs11 = require("node:fs");
22148
22167
  var import_node_path8 = require("node:path");
22149
22168
 
22150
22169
  // 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';
22170
+ 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
22171
 
22153
22172
  // 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";
22173
+ 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
22174
 
22156
22175
  // raw:../migrations/examples/mainfast-migrations.yml
22157
22176
  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
22177
 
22159
22178
  // 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";
22179
+ 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
22180
 
22162
22181
  // 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';
22182
+ 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
22183
 
22165
22184
  // src/templates.ts
22166
22185
  var WORKFLOWS = { intact: mainfast_intact_default, migrations: mainfast_migrations_default, rollcall: rollcall_default, owners: owners_default, evidence: evidence_default };
@@ -22189,16 +22208,16 @@ function nextSteps(slugs) {
22189
22208
  const steps = ["Review the new files, commit them and open a pull request. Nothing has been pushed."];
22190
22209
  const required2 = slugs.filter((s) => s !== "rollcall" && s !== "migrations").map((s) => `"${product(s).checkName}"`);
22191
22210
  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.`);
22211
+ if (required2.length) steps.push(`To block merges on findings, make ${required2.join(", ")} required in branch protection or a ruleset.`);
22193
22212
  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.");
22213
+ 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.");
22214
+ if (slugs.includes("owners")) steps.push("Owners needs a CODEOWNERS file; until you add one, every run reports it as missing.");
22196
22215
  return steps;
22197
22216
  }
22198
22217
  function runInit(opts) {
22199
22218
  const root = repoRoot(opts.dir);
22200
22219
  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(", ")}`);
22220
+ for (const c of wanted) if (!PRODUCT_SLUGS.includes(c)) throw new CliError(`unknown check: ${c} (expected one of ${PRODUCT_SLUGS.join(", ")})`);
22202
22221
  const slugs = [...new Set(wanted)];
22203
22222
  const written = [];
22204
22223
  const overwritten = [];
@@ -22209,7 +22228,7 @@ function runInit(opts) {
22209
22228
  const abs = (0, import_node_path8.join)(root, rel);
22210
22229
  const exists = current !== void 0;
22211
22230
  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" });
22231
+ if (exists && !opts.force) return void skipped.push({ path: rel, reason: "exists with different content; use --force to replace it" });
22213
22232
  if (!opts.dryRun) {
22214
22233
  (0, import_node_fs11.mkdirSync)((0, import_node_path8.dirname)(abs), { recursive: true });
22215
22234
  (0, import_node_fs11.writeFileSync)(abs, content);
@@ -22280,15 +22299,15 @@ function runDoctor(dir) {
22280
22299
  const token = githubToken();
22281
22300
  const repo = githubRepo(root) ?? null;
22282
22301
  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.");
22302
+ if (!installed.length && workflowsOk) missing.push("No checks are installed. Run: mainfast init");
22303
+ if (!repo) missing.push("No GitHub origin remote, so audit cannot read the repository through the GitHub API.");
22304
+ 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.");
22305
+ if (installed.includes("owners") && !codeowners) missing.push("Owners is installed but there is no CODEOWNERS file. Add .github/CODEOWNERS.");
22287
22306
  const ok = config2.ok && workflowsOk && installed.length > 0;
22288
22307
  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
22308
  const lines = [
22290
22309
  ...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"}`,
22310
+ `config ${path ? config2.ok ? `${path} parses` : `${path} does not parse` : "none (defaults apply)"}`,
22292
22311
  `token ${token ? `set (${token.name})` : "not set"}`,
22293
22312
  ...missing.length ? ["", "To do:", ...missing.map((m) => `- ${m}`)] : []
22294
22313
  ];
@@ -24543,10 +24562,10 @@ function capSize(inst, size) {
24543
24562
  const cap2 = Math.min(...caps.map((c) => c[0]));
24544
24563
  const parse4 = inst._zod.parse;
24545
24564
  inst._zod.parse = (payload, ctx) => {
24546
- const n = size(payload.value);
24547
- if (n > cap2 && !ctx?.skipChecks && ctx?.direction !== "backward") {
24565
+ const n2 = size(payload.value);
24566
+ if (n2 > cap2 && !ctx?.skipChecks && ctx?.direction !== "backward") {
24548
24567
  for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
24549
- if (n > max && ch._zod.def.when(payload)) {
24568
+ if (n2 > max && ch._zod.def.when(payload)) {
24550
24569
  const start = payload.issues.length;
24551
24570
  ch._zod.check(payload);
24552
24571
  payload.issues[start].continue = false;
@@ -28340,17 +28359,17 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
28340
28359
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
28341
28360
  inst.element = def.element;
28342
28361
  }, {
28343
- min(n, params) {
28344
- return this.check(_minLength(n, params));
28362
+ min(n2, params) {
28363
+ return this.check(_minLength(n2, params));
28345
28364
  },
28346
28365
  nonempty(params) {
28347
28366
  return this.check(_minLength(1, params));
28348
28367
  },
28349
- max(n, params) {
28350
- return this.check(_maxLength(n, params));
28368
+ max(n2, params) {
28369
+ return this.check(_maxLength(n2, params));
28351
28370
  },
28352
- length(n, params) {
28353
- return this.check(_length(n, params));
28371
+ length(n2, params) {
28372
+ return this.check(_length(n2, params));
28354
28373
  },
28355
28374
  unwrap() {
28356
28375
  return this.element;
@@ -32090,14 +32109,14 @@ var str = (v) => typeof v === "string" && v ? v : void 0;
32090
32109
  var TOOLS = [
32091
32110
  {
32092
32111
  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.`,
32112
+ 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
32113
  inputSchema: {
32095
32114
  type: "object",
32096
32115
  properties: {
32097
32116
  repo_path: repoPath,
32098
32117
  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." }
32118
+ dry_run: { type: "boolean", description: "Show what would change without writing anything. Default: false." },
32119
+ force: { type: "boolean", description: "Replace files that have different content. Default: false." }
32101
32120
  },
32102
32121
  additionalProperties: false
32103
32122
  },
@@ -32112,7 +32131,7 @@ var TOOLS = [
32112
32131
  },
32113
32132
  {
32114
32133
  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.",
32134
+ 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
32135
  inputSchema: {
32117
32136
  type: "object",
32118
32137
  properties: {
@@ -32120,7 +32139,7 @@ var TOOLS = [
32120
32139
  commit: { type: "string", description: "One merge commit. Default: every merge commit in main..HEAD." },
32121
32140
  range: { type: "string", description: "A range, A..B." },
32122
32141
  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." }
32142
+ fail_on: { type: "string", enum: ["error", "warning", "notice"], description: "Lowest level that fails the check (ok false). Default: warning." }
32124
32143
  },
32125
32144
  additionalProperties: false
32126
32145
  },
@@ -32136,7 +32155,7 @@ var TOOLS = [
32136
32155
  check: { type: "string", enum: [...AUDIT_CHECKS] },
32137
32156
  main: { type: "string", description: "The main branch, for migrations and evidence." },
32138
32157
  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." }
32158
+ offline: { type: "boolean", description: "For owners: run the offline lint even when a token is set." }
32140
32159
  },
32141
32160
  required: ["check"],
32142
32161
  additionalProperties: false
@@ -32212,35 +32231,36 @@ async function runMcp() {
32212
32231
  }
32213
32232
 
32214
32233
  // 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";
32234
+ 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
32235
  var HELP2 = {
32217
32236
  "": `mainfast ${VERSION}: set up and run GitHub checks that stop merges from silently breaking main.
32218
32237
 
32219
32238
  usage: mainfast <command> [options]
32220
32239
 
32221
32240
  init write the workflows and a starter config into this repository
32222
- doctor what is installed, whether the config parses, what is missing
32241
+ doctor show which checks are installed, check the config, list what is missing
32223
32242
  check run Intact on the merge commits in this branch
32224
- audit run rollcall, owners, migrations or evidence now; reads only
32243
+ audit run Rollcall, Owners, Migrations or Evidence once; posts nothing
32225
32244
  mcp serve these commands as MCP tools over stdio
32226
32245
 
32227
32246
  Run mainfast <command> --help for its options. Every command takes --json.
32228
32247
  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.
32248
+ Token: read from GITHUB_TOKEN or GH_TOKEN, never printed.
32230
32249
  `,
32231
32250
  init: `usage: mainfast init [--checks intact,owners,...] [--dry-run] [--force]
32232
32251
 
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.
32252
+ Writes .github/workflows/mainfast-<check>.yml for each check and a starter config. Leaves a file
32253
+ that already has different content alone unless you pass --force. Does not commit, push or change
32254
+ branch protection.
32235
32255
 
32236
32256
  --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
32257
+ --dry-run show what would change without writing anything
32258
+ --force replace files that have different content
32239
32259
  ${COMMON}`,
32240
32260
  doctor: `usage: mainfast doctor
32241
32261
 
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.
32262
+ Shows which checks are installed, whether the config parses and whether a token is set. Exits 1 if no
32263
+ check is installed or the config does not parse.
32244
32264
 
32245
32265
  ${COMMON}`,
32246
32266
  check: `usage: mainfast check [<merge-commit>] [--range A..B] [--main <branch>] [--fail-on error|warning|notice]
@@ -32248,16 +32268,21 @@ ${COMMON}`,
32248
32268
  Runs Intact locally. With no commit or range, checks every merge commit in <main>..HEAD.
32249
32269
  Exit codes: 0 nothing failed (warnings can still be listed), 1 findings that fail, 2 error.
32250
32270
 
32271
+ <merge-commit> check this one merge commit
32272
+ --range A..B check every merge commit in the range
32273
+ --main <branch> the main branch (default: from the config, else origin's default branch)
32274
+ --fail-on <level> lowest level that fails: error, warning (default) or notice
32251
32275
  ${COMMON}`,
32252
32276
  audit: `usage: mainfast audit <${AUDIT_CHECKS.join("|")}> [--main <branch>] [--pr <n>] [--offline]
32253
32277
 
32254
- Runs one check now. Reads only: it posts nothing to GitHub.
32278
+ Runs one check once and prints the result. Posts nothing to GitHub.
32255
32279
 
32280
+ What each check needs:
32256
32281
  ${AUDIT_CHECKS.map((c) => ` ${c}: ${AUDIT_NEEDS[c]}`).join("\n")}
32257
32282
 
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
32283
+ --main <branch> the main branch (migrations and evidence)
32284
+ --pr <n> evidence: evaluate this pull request through the GitHub API
32285
+ --offline owners: run the offline lint even when a token is set
32261
32286
  ${COMMON}`,
32262
32287
  mcp: `usage: mainfast mcp
32263
32288
 
@@ -32303,8 +32328,8 @@ ${HELP2[""]}`);
32303
32328
  json = values.json ?? false;
32304
32329
  if (values.help) return process.stdout.write(HELP2[command]), 0;
32305
32330
  const dir = values.C ?? process.cwd();
32306
- const tooMany = (n) => {
32307
- if (positionals.length > n) throw new CliError(`unexpected argument: ${positionals[n]}`);
32331
+ const tooMany = (n2) => {
32332
+ if (positionals.length > n2) throw new CliError(`unexpected argument: ${positionals[n2]}`);
32308
32333
  };
32309
32334
  switch (command) {
32310
32335
  case "init":
@@ -32318,7 +32343,7 @@ ${HELP2[""]}`);
32318
32343
  return emit(await runCheck2({ dir, commit: positionals[0], range: values.range, main: values.main, failOn: values["fail-on"], text: !json }), json);
32319
32344
  case "audit": {
32320
32345
  tooMany(1);
32321
- if (!positionals[0]) throw new CliError(`audit needs a check: ${AUDIT_CHECKS.join(", ")}`);
32346
+ if (!positionals[0]) throw new CliError(`audit needs a check name: ${AUDIT_CHECKS.join(", ")}`);
32322
32347
  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
32348
  }
32324
32349
  case "mcp":