@codacy/verity-cli 0.35.0 → 0.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -3
  2. package/bin/verity.js +728 -559
  3. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -2928,7 +2928,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2928
2928
  * @param {(string | Function)} text - string to add, or a function returning a string
2929
2929
  * @return {Command} `this` command for chaining
2930
2930
  */
2931
- addHelpText(position, text2) {
2931
+ addHelpText(position, text3) {
2932
2932
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
2933
2933
  if (!allowedValues.includes(position)) {
2934
2934
  throw new Error(`Unexpected value for position to addHelpText.
@@ -2937,10 +2937,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
2937
2937
  const helpEvent = `${position}Help`;
2938
2938
  this.on(helpEvent, (context) => {
2939
2939
  let helpStr;
2940
- if (typeof text2 === "function") {
2941
- helpStr = text2({ error: context.error, command: context.command });
2940
+ if (typeof text3 === "function") {
2941
+ helpStr = text3({ error: context.error, command: context.command });
2942
2942
  } else {
2943
- helpStr = text2;
2943
+ helpStr = text3;
2944
2944
  }
2945
2945
  if (helpStr) {
2946
2946
  context.write(`${helpStr}
@@ -3750,13 +3750,13 @@ var require_createNode = __commonJS2({
3750
3750
  var defaultTagPrefix = "tag:yaml.org,2002:";
3751
3751
  function findTagObject(value, tagName, tags) {
3752
3752
  if (tagName) {
3753
- const match = tags.filter((t) => t.tag === tagName);
3754
- const tagObj = match.find((t) => !t.format) ?? match[0];
3753
+ const match = tags.filter((t2) => t2.tag === tagName);
3754
+ const tagObj = match.find((t2) => !t2.format) ?? match[0];
3755
3755
  if (!tagObj)
3756
3756
  throw new Error(`Tag ${tagName} not found`);
3757
3757
  return tagObj;
3758
3758
  }
3759
- return tags.find((t) => t.identify?.(value) && !t.format);
3759
+ return tags.find((t2) => t2.identify?.(value) && !t2.format);
3760
3760
  }
3761
3761
  function createNode(value, tagName, ctx) {
3762
3762
  if (identity.isDocument(value))
@@ -3982,14 +3982,14 @@ var require_foldFlowLines = __commonJS2({
3982
3982
  var FOLD_FLOW = "flow";
3983
3983
  var FOLD_BLOCK = "block";
3984
3984
  var FOLD_QUOTED = "quoted";
3985
- function foldFlowLines(text2, indent, mode2 = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
3985
+ function foldFlowLines(text3, indent, mode2 = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
3986
3986
  if (!lineWidth || lineWidth < 0)
3987
- return text2;
3987
+ return text3;
3988
3988
  if (lineWidth < minContentWidth)
3989
3989
  minContentWidth = 0;
3990
3990
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
3991
- if (text2.length <= endStep)
3992
- return text2;
3991
+ if (text3.length <= endStep)
3992
+ return text3;
3993
3993
  const folds = [];
3994
3994
  const escapedFolds = {};
3995
3995
  let end = lineWidth - indent.length;
@@ -4006,14 +4006,14 @@ var require_foldFlowLines = __commonJS2({
4006
4006
  let escStart = -1;
4007
4007
  let escEnd = -1;
4008
4008
  if (mode2 === FOLD_BLOCK) {
4009
- i2 = consumeMoreIndentedLines(text2, i2, indent.length);
4009
+ i2 = consumeMoreIndentedLines(text3, i2, indent.length);
4010
4010
  if (i2 !== -1)
4011
4011
  end = i2 + endStep;
4012
4012
  }
4013
- for (let ch; ch = text2[i2 += 1]; ) {
4013
+ for (let ch; ch = text3[i2 += 1]; ) {
4014
4014
  if (mode2 === FOLD_QUOTED && ch === "\\") {
4015
4015
  escStart = i2;
4016
- switch (text2[i2 + 1]) {
4016
+ switch (text3[i2 + 1]) {
4017
4017
  case "x":
4018
4018
  i2 += 3;
4019
4019
  break;
@@ -4030,12 +4030,12 @@ var require_foldFlowLines = __commonJS2({
4030
4030
  }
4031
4031
  if (ch === "\n") {
4032
4032
  if (mode2 === FOLD_BLOCK)
4033
- i2 = consumeMoreIndentedLines(text2, i2, indent.length);
4033
+ i2 = consumeMoreIndentedLines(text3, i2, indent.length);
4034
4034
  end = i2 + indent.length + endStep;
4035
4035
  split = void 0;
4036
4036
  } else {
4037
4037
  if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
4038
- const next = text2[i2 + 1];
4038
+ const next = text3[i2 + 1];
4039
4039
  if (next && next !== " " && next !== "\n" && next !== " ")
4040
4040
  split = i2;
4041
4041
  }
@@ -4047,12 +4047,12 @@ var require_foldFlowLines = __commonJS2({
4047
4047
  } else if (mode2 === FOLD_QUOTED) {
4048
4048
  while (prev === " " || prev === " ") {
4049
4049
  prev = ch;
4050
- ch = text2[i2 += 1];
4050
+ ch = text3[i2 += 1];
4051
4051
  overflow = true;
4052
4052
  }
4053
4053
  const j = i2 > escEnd + 1 ? i2 - 2 : escStart - 1;
4054
4054
  if (escapedFolds[j])
4055
- return text2;
4055
+ return text3;
4056
4056
  folds.push(j);
4057
4057
  escapedFolds[j] = true;
4058
4058
  end = j + endStep;
@@ -4067,39 +4067,39 @@ var require_foldFlowLines = __commonJS2({
4067
4067
  if (overflow && onOverflow)
4068
4068
  onOverflow();
4069
4069
  if (folds.length === 0)
4070
- return text2;
4070
+ return text3;
4071
4071
  if (onFold)
4072
4072
  onFold();
4073
- let res = text2.slice(0, folds[0]);
4073
+ let res = text3.slice(0, folds[0]);
4074
4074
  for (let i3 = 0; i3 < folds.length; ++i3) {
4075
4075
  const fold2 = folds[i3];
4076
- const end2 = folds[i3 + 1] || text2.length;
4076
+ const end2 = folds[i3 + 1] || text3.length;
4077
4077
  if (fold2 === 0)
4078
4078
  res = `
4079
- ${indent}${text2.slice(0, end2)}`;
4079
+ ${indent}${text3.slice(0, end2)}`;
4080
4080
  else {
4081
4081
  if (mode2 === FOLD_QUOTED && escapedFolds[fold2])
4082
- res += `${text2[fold2]}\\`;
4082
+ res += `${text3[fold2]}\\`;
4083
4083
  res += `
4084
- ${indent}${text2.slice(fold2 + 1, end2)}`;
4084
+ ${indent}${text3.slice(fold2 + 1, end2)}`;
4085
4085
  }
4086
4086
  }
4087
4087
  return res;
4088
4088
  }
4089
- function consumeMoreIndentedLines(text2, i2, indent) {
4089
+ function consumeMoreIndentedLines(text3, i2, indent) {
4090
4090
  let end = i2;
4091
4091
  let start2 = i2 + 1;
4092
- let ch = text2[start2];
4092
+ let ch = text3[start2];
4093
4093
  while (ch === " " || ch === " ") {
4094
4094
  if (i2 < start2 + indent) {
4095
- ch = text2[++i2];
4095
+ ch = text3[++i2];
4096
4096
  } else {
4097
4097
  do {
4098
- ch = text2[++i2];
4098
+ ch = text3[++i2];
4099
4099
  } while (ch && ch !== "\n");
4100
4100
  end = i2;
4101
4101
  start2 = i2 + 1;
4102
- ch = text2[start2];
4102
+ ch = text3[start2];
4103
4103
  }
4104
4104
  }
4105
4105
  return end;
@@ -4383,10 +4383,10 @@ ${indent}`);
4383
4383
  let res = _stringify(type);
4384
4384
  if (res === null) {
4385
4385
  const { defaultKeyType, defaultStringType } = ctx.options;
4386
- const t = implicitKey && defaultKeyType || defaultStringType;
4387
- res = _stringify(t);
4386
+ const t2 = implicitKey && defaultKeyType || defaultStringType;
4387
+ res = _stringify(t2);
4388
4388
  if (res === null)
4389
- throw new Error(`Unsupported default string type ${t}`);
4389
+ throw new Error(`Unsupported default string type ${t2}`);
4390
4390
  }
4391
4391
  return res;
4392
4392
  }
@@ -4446,24 +4446,24 @@ var require_stringify = __commonJS2({
4446
4446
  }
4447
4447
  function getTagObject(tags, item) {
4448
4448
  if (item.tag) {
4449
- const match = tags.filter((t) => t.tag === item.tag);
4449
+ const match = tags.filter((t2) => t2.tag === item.tag);
4450
4450
  if (match.length > 0)
4451
- return match.find((t) => t.format === item.format) ?? match[0];
4451
+ return match.find((t2) => t2.format === item.format) ?? match[0];
4452
4452
  }
4453
4453
  let tagObj = void 0;
4454
4454
  let obj;
4455
4455
  if (identity.isScalar(item)) {
4456
4456
  obj = item.value;
4457
- let match = tags.filter((t) => t.identify?.(obj));
4457
+ let match = tags.filter((t2) => t2.identify?.(obj));
4458
4458
  if (match.length > 1) {
4459
- const testMatch = match.filter((t) => t.test);
4459
+ const testMatch = match.filter((t2) => t2.test);
4460
4460
  if (testMatch.length > 0)
4461
4461
  match = testMatch;
4462
4462
  }
4463
- tagObj = match.find((t) => t.format === item.format) ?? match.find((t) => !t.format);
4463
+ tagObj = match.find((t2) => t2.format === item.format) ?? match.find((t2) => !t2.format);
4464
4464
  } else {
4465
4465
  obj = item;
4466
- tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
4466
+ tagObj = tags.find((t2) => t2.nodeClass && obj instanceof t2.nodeClass);
4467
4467
  }
4468
4468
  if (!tagObj) {
4469
4469
  const name2 = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
@@ -7389,7 +7389,7 @@ var require_compose_collection = __commonJS2({
7389
7389
  if (!tagToken || !tagName || tagName === "!" || tagName === YAMLMap.YAMLMap.tagName && expType === "map" || tagName === YAMLSeq.YAMLSeq.tagName && expType === "seq") {
7390
7390
  return resolveCollection(CN, ctx, token, onError, tagName);
7391
7391
  }
7392
- let tag = ctx.schema.tags.find((t) => t.tag === tagName && t.collection === expType);
7392
+ let tag = ctx.schema.tags.find((t2) => t2.tag === tagName && t2.collection === expType);
7393
7393
  if (!tag) {
7394
7394
  const kt = ctx.schema.knownTags[tagName];
7395
7395
  if (kt?.collection === expType) {
@@ -13882,11 +13882,11 @@ ${JSON.stringify(symbolNames, null, 2)}`);
13882
13882
  for (const c of captures) {
13883
13883
  if (c.name === captureName) nodes.push(c.node.text);
13884
13884
  }
13885
- const test = /* @__PURE__ */ __name((text2, positive) => {
13886
- return positive ? regex.test(text2) : !regex.test(text2);
13885
+ const test = /* @__PURE__ */ __name((text3, positive) => {
13886
+ return positive ? regex.test(text3) : !regex.test(text3);
13887
13887
  }, "test");
13888
13888
  if (nodes.length === 0) return !isPositive;
13889
- return matchAll2 ? nodes.every((text2) => test(text2, isPositive)) : nodes.some((text2) => test(text2, isPositive));
13889
+ return matchAll2 ? nodes.every((text3) => test(text3, isPositive)) : nodes.some((text3) => test(text3, isPositive));
13890
13890
  });
13891
13891
  }
13892
13892
  __name(parseMatchPredicate, "parseMatchPredicate");
@@ -13916,7 +13916,7 @@ ${JSON.stringify(symbolNames, null, 2)}`);
13916
13916
  if (c.name === captureName) nodes.push(c.node.text);
13917
13917
  }
13918
13918
  if (nodes.length === 0) return !isPositive;
13919
- return nodes.every((text2) => values.includes(text2)) === isPositive;
13919
+ return nodes.every((text3) => values.includes(text3)) === isPositive;
13920
13920
  });
13921
13921
  }
13922
13922
  __name(parseAnyOfPredicate, "parseAnyOfPredicate");
@@ -14517,9 +14517,9 @@ function treeDir(identity) {
14517
14517
  return (0, import_node_path.join)(verityHome(), "sessions", identity.userKey, identity.treeKey);
14518
14518
  }
14519
14519
  function scopeIdentity(token, sessionId) {
14520
- const t = (token ?? "").trim();
14520
+ const t2 = (token ?? "").trim();
14521
14521
  const s = (sessionId ?? "").trim();
14522
- const userKey = t.length > 0 ? (0, import_node_crypto.createHash)("sha256").update(t).digest("hex").slice(0, 12) : "anon";
14522
+ const userKey = t2.length > 0 ? (0, import_node_crypto.createHash)("sha256").update(t2).digest("hex").slice(0, 12) : "anon";
14523
14523
  const sessionKey2 = s.length > 0 ? (0, import_node_crypto.createHash)("sha256").update(s).digest("hex").slice(0, 16) : "_default";
14524
14524
  return { userKey, sessionKey: sessionKey2, bucket: `${userKey}/${sessionKey2}` };
14525
14525
  }
@@ -15325,7 +15325,7 @@ function pinRefusalMessage(verdict, targetUrl) {
15325
15325
  // src/lib/cli-version.ts
15326
15326
  function cliVersion() {
15327
15327
  try {
15328
- return true ? "0.35.0" : "dev";
15328
+ return true ? "0.35.1" : "dev";
15329
15329
  } catch {
15330
15330
  return "dev";
15331
15331
  }
@@ -15758,14 +15758,14 @@ function clipboards(platform4, env) {
15758
15758
  if (env.DISPLAY) out2.push(["xclip", ["-selection", "clipboard"]], ["xsel", ["--clipboard", "--input"]]);
15759
15759
  return out2;
15760
15760
  }
15761
- function copyToClipboard(text2, opts = {}) {
15761
+ function copyToClipboard(text3, opts = {}) {
15762
15762
  const env = opts.env ?? process.env;
15763
15763
  const platform4 = opts.platform ?? process.platform;
15764
- if (!/^[A-Za-z0-9-]{1,32}$/.test(text2)) return false;
15764
+ if (!/^[A-Za-z0-9-]{1,32}$/.test(text3)) return false;
15765
15765
  if (env.SSH_CONNECTION || env.SSH_TTY || env.CI) return false;
15766
15766
  for (const [cmd, args2] of clipboards(platform4, env)) {
15767
15767
  try {
15768
- const r = (opts.run ?? import_node_child_process4.spawnSync)(cmd, args2, { input: text2, stdio: ["pipe", "ignore", "ignore"], timeout: 2e3 });
15768
+ const r = (opts.run ?? import_node_child_process4.spawnSync)(cmd, args2, { input: text3, stdio: ["pipe", "ignore", "ignore"], timeout: 2e3 });
15769
15769
  if (!r.error && r.status === 0) return true;
15770
15770
  } catch {
15771
15771
  }
@@ -15835,11 +15835,11 @@ function startSpinner(label2, opts = {}) {
15835
15835
  },
15836
15836
  succeed(message) {
15837
15837
  finish(() => {
15838
- const text2 = message ?? current;
15838
+ const text3 = message ?? current;
15839
15839
  const clock2 = showElapsed ? ` (${secondsSince(start2)})` : "";
15840
15840
  stream.write(
15841
- color ? ` ${GREEN2}\u2713${RESET} ${text2}${DIM2}${clock2}${RESET}
15842
- ` : ` \u2713 ${text2}${clock2}
15841
+ color ? ` ${GREEN2}\u2713${RESET} ${text3}${DIM2}${clock2}${RESET}
15842
+ ` : ` \u2713 ${text3}${clock2}
15843
15843
  `
15844
15844
  );
15845
15845
  });
@@ -16365,11 +16365,11 @@ function clearPendingLogin() {
16365
16365
  // src/lib/login-report.ts
16366
16366
  async function describeLoginOutcome(out2, opts = {}) {
16367
16367
  const lines = [];
16368
- const info2 = (text2) => {
16369
- lines.push({ level: "info", text: text2 });
16368
+ const info2 = (text3) => {
16369
+ lines.push({ level: "info", text: text3 });
16370
16370
  };
16371
- const warn = (text2) => {
16372
- lines.push({ level: "warn", text: text2 });
16371
+ const warn = (text3) => {
16372
+ lines.push({ level: "warn", text: text3 });
16373
16373
  };
16374
16374
  const identity = out2.email ?? (out2.userId != null ? `user #${out2.userId}` : "your account");
16375
16375
  info2(`Logged in as ${identity}. \u2713`);
@@ -16728,15 +16728,15 @@ function runHook(hooks) {
16728
16728
  return false;
16729
16729
  }
16730
16730
  }
16731
- function appendInRoot(root, name2, text2, hooks = {}) {
16731
+ function appendInRoot(root, name2, text3, hooks = {}) {
16732
16732
  return writeVerified(root, name2, hooks, true, (fd) => {
16733
- (0, import_node_fs7.writeSync)(fd, text2);
16733
+ (0, import_node_fs7.writeSync)(fd, text3);
16734
16734
  });
16735
16735
  }
16736
- function replaceInRoot(root, name2, text2, hooks = {}) {
16736
+ function replaceInRoot(root, name2, text3, hooks = {}) {
16737
16737
  return writeVerified(root, name2, hooks, false, (fd) => {
16738
16738
  (0, import_node_fs7.ftruncateSync)(fd, 0);
16739
- (0, import_node_fs7.writeSync)(fd, text2, 0);
16739
+ (0, import_node_fs7.writeSync)(fd, text3, 0);
16740
16740
  });
16741
16741
  }
16742
16742
 
@@ -17321,9 +17321,9 @@ function declaredDependencies(root, files) {
17321
17321
  for (const path of pythonManifests) {
17322
17322
  if (!(0, import_node_fs10.existsSync)(path)) continue;
17323
17323
  try {
17324
- const text2 = (0, import_node_fs10.readFileSync)(path, "utf-8");
17325
- for (const m of text2.matchAll(/^\s*["']?([A-Za-z][A-Za-z0-9._-]+)/gm)) names2.push(m[1]);
17326
- for (const line2 of text2.split("\n")) {
17324
+ const text3 = (0, import_node_fs10.readFileSync)(path, "utf-8");
17325
+ for (const m of text3.matchAll(/^\s*["']?([A-Za-z][A-Za-z0-9._-]+)/gm)) names2.push(m[1]);
17326
+ for (const line2 of text3.split("\n")) {
17327
17327
  if (!/dependencies\s*=/.test(line2)) continue;
17328
17328
  for (const m of line2.matchAll(/["']([A-Za-z][A-Za-z0-9._-]+)/g)) names2.push(m[1]);
17329
17329
  }
@@ -17337,8 +17337,8 @@ function declaredDependencies(root, files) {
17337
17337
  for (const path of goMods) {
17338
17338
  if (!(0, import_node_fs10.existsSync)(path)) continue;
17339
17339
  try {
17340
- const text2 = (0, import_node_fs10.readFileSync)(path, "utf-8");
17341
- for (const m of text2.matchAll(/^\s+([\w.-]+\/[\w./-]+)\s+v/gm)) {
17340
+ const text3 = (0, import_node_fs10.readFileSync)(path, "utf-8");
17341
+ for (const m of text3.matchAll(/^\s+([\w.-]+\/[\w./-]+)\s+v/gm)) {
17342
17342
  names2.push(m[1].replace(/^github\.com\//, ""));
17343
17343
  }
17344
17344
  } catch {
@@ -17348,9 +17348,9 @@ function declaredDependencies(root, files) {
17348
17348
  const path = (0, import_node_path10.join)(root, file);
17349
17349
  if (!(0, import_node_fs10.existsSync)(path)) continue;
17350
17350
  try {
17351
- const text2 = (0, import_node_fs10.readFileSync)(path, "utf-8");
17352
- for (const m of text2.matchAll(/["'<]([A-Za-z][A-Za-z0-9._-]{2,})["'>]/g)) names2.push(m[1]);
17353
- if (file === "Cargo.toml") names2.push(...cargoDependencyKeys(text2));
17351
+ const text3 = (0, import_node_fs10.readFileSync)(path, "utf-8");
17352
+ for (const m of text3.matchAll(/["'<]([A-Za-z][A-Za-z0-9._-]{2,})["'>]/g)) names2.push(m[1]);
17353
+ if (file === "Cargo.toml") names2.push(...cargoDependencyKeys(text3));
17354
17354
  } catch {
17355
17355
  }
17356
17356
  }
@@ -17365,8 +17365,8 @@ function declaredDependencies(root, files) {
17365
17365
  for (const rel of composerFiles) {
17366
17366
  let composer = null;
17367
17367
  try {
17368
- const text2 = manifest(rel);
17369
- composer = text2 === null ? null : JSON.parse(text2);
17368
+ const text3 = manifest(rel);
17369
+ composer = text3 === null ? null : JSON.parse(text3);
17370
17370
  } catch {
17371
17371
  }
17372
17372
  if (!composer || typeof composer !== "object") continue;
@@ -17376,20 +17376,20 @@ function declaredDependencies(root, files) {
17376
17376
  }
17377
17377
  }
17378
17378
  for (const rel of files.filter((f) => /\.(cs|fs)proj$/.test(f)).slice(0, NESTED_MANIFEST_LIMIT)) {
17379
- const text2 = manifest(rel);
17380
- if (text2 === null) continue;
17381
- for (const m of text2.matchAll(/<PackageReference\b[^>]*?\bInclude="([A-Za-z][A-Za-z0-9._-]+)"/g)) names2.push(m[1]);
17379
+ const text3 = manifest(rel);
17380
+ if (text3 === null) continue;
17381
+ for (const m of text3.matchAll(/<PackageReference\b[^>]*?\bInclude="([A-Za-z][A-Za-z0-9._-]+)"/g)) names2.push(m[1]);
17382
17382
  }
17383
17383
  for (const rel of files.filter((f) => f.includes("/") && (0, import_node_path10.basename)(f) === "Cargo.toml").slice(0, NESTED_MANIFEST_LIMIT)) {
17384
- const text2 = manifest(rel);
17385
- if (text2 !== null) names2.push(...cargoDependencyKeys(text2));
17384
+ const text3 = manifest(rel);
17385
+ if (text3 !== null) names2.push(...cargoDependencyKeys(text3));
17386
17386
  }
17387
17387
  return names2;
17388
17388
  }
17389
- function cargoDependencyKeys(text2) {
17389
+ function cargoDependencyKeys(text3) {
17390
17390
  const names2 = [];
17391
17391
  let inDeps = false;
17392
- for (const raw of text2.split("\n")) {
17392
+ for (const raw of text3.split("\n")) {
17393
17393
  const line2 = raw.trim();
17394
17394
  const header = /^\[([^\]]+)\]$/.exec(line2);
17395
17395
  if (header) {
@@ -17651,30 +17651,30 @@ function shipsCli(root, files) {
17651
17651
  };
17652
17652
  const candidates2 = files.filter((f) => Object.hasOwn(CLI_DECLARATION, (0, import_node_path11.basename)(f))).sort((a, b) => a.split("/").length - b.split("/").length || a.localeCompare(b));
17653
17653
  for (const rel of candidates2) {
17654
- const text2 = read2(rel);
17655
- if (text2 !== null && CLI_DECLARATION[(0, import_node_path11.basename)(rel)](text2)) return true;
17654
+ const text3 = read2(rel);
17655
+ if (text3 !== null && CLI_DECLARATION[(0, import_node_path11.basename)(rel)](text3)) return true;
17656
17656
  }
17657
17657
  return false;
17658
17658
  }
17659
17659
  var CLI_DECLARATION = {
17660
- "package.json": (text2) => {
17660
+ "package.json": (text3) => {
17661
17661
  try {
17662
- const bin = JSON.parse(text2).bin;
17662
+ const bin = JSON.parse(text3).bin;
17663
17663
  return typeof bin === "string" && bin.length > 0 || isRecord(bin) && Object.keys(bin).length > 0;
17664
17664
  } catch {
17665
17665
  return false;
17666
17666
  }
17667
17667
  },
17668
- "pyproject.toml": (text2) => /^\s*\[(project\.scripts|tool\.poetry\.scripts)\]\s*$/m.test(text2),
17669
- "setup.py": (text2) => /console_scripts/.test(text2),
17670
- "setup.cfg": (text2) => /console_scripts/.test(text2),
17671
- "Cargo.toml": (text2) => /^\s*\[\[bin\]\]\s*$/m.test(text2)
17668
+ "pyproject.toml": (text3) => /^\s*\[(project\.scripts|tool\.poetry\.scripts)\]\s*$/m.test(text3),
17669
+ "setup.py": (text3) => /console_scripts/.test(text3),
17670
+ "setup.cfg": (text3) => /console_scripts/.test(text3),
17671
+ "Cargo.toml": (text3) => /^\s*\[\[bin\]\]\s*$/m.test(text3)
17672
17672
  };
17673
17673
 
17674
17674
  // src/lib/verity-md.ts
17675
17675
  var UNPRINTABLE = /[\u0000-\u001f\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]+/g;
17676
- function markdownPlain(text2, max = 200) {
17677
- const oneLine2 = text2.replace(UNPRINTABLE, " ").replace(/\s+/g, " ").trim();
17676
+ function markdownPlain(text3, max = 200) {
17677
+ const oneLine2 = text3.replace(UNPRINTABLE, " ").replace(/\s+/g, " ").trim();
17678
17678
  const bounded = oneLine2.length > max ? `${oneLine2.slice(0, max - 1)}\u2026` : oneLine2;
17679
17679
  return bounded.replace(/[\\`*_{}[\]()<>#+!|~]/g, (c) => `\\${c}`);
17680
17680
  }
@@ -17715,7 +17715,7 @@ function describeOrigin(origin) {
17715
17715
  if (origin.kind === "adopted") {
17716
17716
  return `adopted from the service${origin.createdBy ? `, created by ${markdownPlain(origin.createdBy, 120)}` : ""}`;
17717
17717
  }
17718
- return `derived from this codebase${origin.tools.length > 0 ? ` \xB7 ${origin.tools.map((t) => markdownPlain(t, 60)).join(", ")}` : ""}`;
17718
+ return `derived from this codebase${origin.tools.length > 0 ? ` \xB7 ${origin.tools.map((t2) => markdownPlain(t2, 60)).join(", ")}` : ""}`;
17719
17719
  }
17720
17720
  function closingNote(origin) {
17721
17721
  if (origin.kind === "adopted") {
@@ -17748,7 +17748,7 @@ ${list2(dimensions, DEFAULT_DIMENSIONS)}
17748
17748
  ${packs.length > 0 ? `## Review Packs
17749
17749
  ${list2(packs, [])}
17750
17750
 
17751
- The Verity service expands each pack into its patterns. To list them: \`verity standard get --resolved\`
17751
+ The Verity service expands each pack into its patterns. What each pack holds: \`verity standard catalogue <pack>\`, or https://verity.md/review-packs. What this project's review reads: \`verity standard get --resolved\`
17752
17752
  ` : `## Security Patterns
17753
17753
  ${list2(patterns, DEFAULT_SECURITY)}
17754
17754
  `}${custom.length > 0 ? `
@@ -18400,11 +18400,11 @@ function registerTokenCommand(program2) {
18400
18400
  printInfo("No tokens found for this repository.");
18401
18401
  return;
18402
18402
  }
18403
- for (const t of tokens) {
18404
- const type = t.token_type ?? "user";
18405
- const expires = t.expires_at ? `expires ${t.expires_at.slice(0, 10)}` : "no expiry";
18406
- const lastUsed = t.last_used_at ? `last used ${t.last_used_at.slice(0, 10)}` : "never used";
18407
- printInfo(`${t.id} [${type}] ${t.agent_name ?? "unnamed"} (${expires}, ${lastUsed})`);
18403
+ for (const t2 of tokens) {
18404
+ const type = t2.token_type ?? "user";
18405
+ const expires = t2.expires_at ? `expires ${t2.expires_at.slice(0, 10)}` : "no expiry";
18406
+ const lastUsed = t2.last_used_at ? `last used ${t2.last_used_at.slice(0, 10)}` : "never used";
18407
+ printInfo(`${t2.id} [${type}] ${t2.agent_name ?? "unnamed"} (${expires}, ${lastUsed})`);
18408
18408
  }
18409
18409
  });
18410
18410
  token.command("revoke <id>").description("Revoke a token by id (service tokens: any current writer may revoke)").action(async (id) => {
@@ -19340,13 +19340,13 @@ function scrub(s) {
19340
19340
  var installed = false;
19341
19341
  var wroteBanner = false;
19342
19342
  var banner = "";
19343
- function append(text2) {
19343
+ function append(text3) {
19344
19344
  try {
19345
19345
  const dir = projectPath(DEBUG_LOG_DIR);
19346
19346
  const file = projectPath(STDERR_LOG_FILE);
19347
19347
  (0, import_node_fs16.mkdirSync)(dir, { recursive: true });
19348
19348
  rotateIfNeeded(file);
19349
- (0, import_node_fs16.appendFileSync)(file, text2);
19349
+ (0, import_node_fs16.appendFileSync)(file, text3);
19350
19350
  } catch {
19351
19351
  }
19352
19352
  }
@@ -19368,19 +19368,19 @@ function installStderrLog(cmd, argv, version) {
19368
19368
  const result = original(...args2);
19369
19369
  try {
19370
19370
  const chunk = args2[0];
19371
- const text2 = typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString("utf-8") : String(chunk);
19371
+ const text3 = typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString("utf-8") : String(chunk);
19372
19372
  ensureBanner();
19373
- append(scrub(text2));
19373
+ append(scrub(text3));
19374
19374
  } catch {
19375
19375
  }
19376
19376
  return result;
19377
19377
  };
19378
19378
  process.stderr.write = tee;
19379
19379
  }
19380
- function logToFileOnly(text2) {
19380
+ function logToFileOnly(text3) {
19381
19381
  if (!installed) return;
19382
19382
  ensureBanner();
19383
- append(text2.endsWith("\n") ? text2 : `${text2}
19383
+ append(text3.endsWith("\n") ? text3 : `${text3}
19384
19384
  `);
19385
19385
  }
19386
19386
 
@@ -19954,8 +19954,8 @@ var import_promises5 = require("node:fs/promises");
19954
19954
  var import_node_fs19 = require("node:fs");
19955
19955
  var import_node_child_process8 = require("node:child_process");
19956
19956
  var import_node_crypto2 = require("node:crypto");
19957
- function stripImageReferences(text2) {
19958
- return text2.replace(/\[Image #\d+\]/g, "[screenshot \u2014 not available for review]");
19957
+ function stripImageReferences(text3) {
19958
+ return text3.replace(/\[Image #\d+\]/g, "[screenshot \u2014 not available for review]");
19959
19959
  }
19960
19960
  function bufferTmpPath() {
19961
19961
  return `${CONVERSATION_BUFFER_FILE}.${process.pid}.${(0, import_node_crypto2.randomBytes)(4).toString("hex")}.tmp`;
@@ -20192,7 +20192,7 @@ function isNonAuthoringCommand(cmd) {
20192
20192
  function hasNonEditAuthorship(actionSummary, sessionAuthoredCode) {
20193
20193
  if (!actionSummary) return sessionAuthoredCode;
20194
20194
  if ((actionSummary.subagents ?? 0) > 0) return true;
20195
- if (Object.keys(actionSummary.tool_counts ?? {}).some((t) => t.startsWith("mcp__"))) return true;
20195
+ if (Object.keys(actionSummary.tool_counts ?? {}).some((t2) => t2.startsWith("mcp__"))) return true;
20196
20196
  const commands = actionSummary.commands ?? [];
20197
20197
  if (commands.some((c) => FILE_MUTATE_RE.test(c))) return true;
20198
20198
  if (sessionAuthoredCode) {
@@ -20221,7 +20221,7 @@ function narrowToAgentAuthored(files, actionSummary) {
20221
20221
  if (touched.length === 0) return files;
20222
20222
  return files.filter((f) => {
20223
20223
  const suffix = "/" + f;
20224
- return touched.some((t) => t === f || t.endsWith(suffix));
20224
+ return touched.some((t2) => t2 === f || t2.endsWith(suffix));
20225
20225
  });
20226
20226
  }
20227
20227
 
@@ -20731,9 +20731,9 @@ var STOPWORDS = /* @__PURE__ */ new Set([
20731
20731
  "within",
20732
20732
  "without"
20733
20733
  ]);
20734
- function tokenize(text2) {
20734
+ function tokenize(text3) {
20735
20735
  return new Set(
20736
- text2.toLowerCase().replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length > 2 && !STOPWORDS.has(w))
20736
+ text3.toLowerCase().replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length > 2 && !STOPWORDS.has(w))
20737
20737
  );
20738
20738
  }
20739
20739
  function jaccardKeywords(a, b) {
@@ -20750,9 +20750,9 @@ function relevance(node, ctx) {
20750
20750
  if (nodeTags.length > 0 && ctx.changeTags && ctx.changeTags.length > 0) {
20751
20751
  const change = new Set(ctx.changeTags);
20752
20752
  let hit = 0;
20753
- for (const t of nodeTags) {
20754
- if (!change.has(t)) continue;
20755
- hit += t.startsWith("pkg:") || t.startsWith("tbl:") ? 1 : t.startsWith("sym:") ? 0.8 : t.startsWith("dir:") ? 0.4 : 0.15;
20753
+ for (const t2 of nodeTags) {
20754
+ if (!change.has(t2)) continue;
20755
+ hit += t2.startsWith("pkg:") || t2.startsWith("tbl:") ? 1 : t2.startsWith("sym:") ? 0.8 : t2.startsWith("dir:") ? 0.4 : 0.15;
20756
20756
  }
20757
20757
  tagScore = Math.min(1, hit / TAG_SATURATION);
20758
20758
  }
@@ -20810,9 +20810,9 @@ var MAX_BUDGET_TOKENS = 4e3;
20810
20810
  var MAX_NODE_FILE_BYTES = 64 * 1024;
20811
20811
  var MIN_SCORE = RELEVANCE_FLOOR * 0.5;
20812
20812
  var ORG_MIN_SHARED_TERMS = 2;
20813
- function orgTerms(text2) {
20813
+ function orgTerms(text3) {
20814
20814
  return new Set(
20815
- text2.toLowerCase().replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length > 2)
20815
+ text3.toLowerCase().replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length > 2)
20816
20816
  );
20817
20817
  }
20818
20818
  function sharedTerms(a, b) {
@@ -21171,12 +21171,12 @@ function ensureVerityGitignore() {
21171
21171
  if (hasSupersededMemory && !memoryIsCommitted) {
21172
21172
  next = fenceMemoryLines(next);
21173
21173
  }
21174
- let text2 = next.join("\n");
21174
+ let text3 = next.join("\n");
21175
21175
  if (!hasMarker) {
21176
- const sep7 = text2 === "" ? "" : text2.endsWith("\n") ? "\n" : "\n\n";
21177
- text2 = text2 + sep7 + VERITY_GITIGNORE_BLOCK;
21176
+ const sep7 = text3 === "" ? "" : text3.endsWith("\n") ? "\n" : "\n\n";
21177
+ text3 = text3 + sep7 + VERITY_GITIGNORE_BLOCK;
21178
21178
  }
21179
- if (text2 !== content) (0, import_node_fs24.writeFileSync)(".gitignore", text2);
21179
+ if (text3 !== content) (0, import_node_fs24.writeFileSync)(".gitignore", text3);
21180
21180
  return verified(
21181
21181
  memoryIsCommitted ? "memory-tracked" : hasSupersededMemory ? "memory-fenced" : needsRepair ? "repaired" : "added"
21182
21182
  );
@@ -21202,13 +21202,13 @@ function writeFencedBlock() {
21202
21202
  const hasMarker = content.includes(VERITY_GITIGNORE_MARKER);
21203
21203
  let lines = content.split("\n").map((l) => BREAKING_ENTRIES.has(l.trim()) ? ".verity/*" : l);
21204
21204
  lines = fenceMemoryLines(lines);
21205
- let text2 = lines.join("\n");
21205
+ let text3 = lines.join("\n");
21206
21206
  if (!hasMarker) {
21207
- const sep7 = text2 === "" ? "" : text2.endsWith("\n") ? "\n" : "\n\n";
21208
- text2 = text2 + sep7 + VERITY_GITIGNORE_BLOCK;
21207
+ const sep7 = text3 === "" ? "" : text3.endsWith("\n") ? "\n" : "\n\n";
21208
+ text3 = text3 + sep7 + VERITY_GITIGNORE_BLOCK;
21209
21209
  }
21210
21210
  try {
21211
- (0, import_node_fs24.writeFileSync)(".gitignore", text2);
21211
+ (0, import_node_fs24.writeFileSync)(".gitignore", text3);
21212
21212
  return true;
21213
21213
  } catch {
21214
21214
  return false;
@@ -22234,26 +22234,26 @@ var CLAUDE_MD_PROSE_LEGACY = [
22234
22234
  "superseded \u2014 ignore them unless investigating history."
22235
22235
  ].join("\n");
22236
22236
  var PRESERVE_PLACEHOLDER = "<!-- Add binding, hand-curated guidance here; it survives Verity regeneration. -->";
22237
- function* scanLines(text2) {
22237
+ function* scanLines(text3) {
22238
22238
  let offset = 0;
22239
22239
  let inFence = false;
22240
- for (const line2 of text2.split("\n")) {
22240
+ for (const line2 of text3.split("\n")) {
22241
22241
  const isFence = /^(`{3,}|~{3,})/.test(line2.trim());
22242
22242
  if (isFence) inFence = !inFence;
22243
22243
  yield { line: line2, start: offset, inFence: inFence || isFence };
22244
22244
  offset += line2.length + 1;
22245
22245
  }
22246
22246
  }
22247
- function findMarker(text2, marker, from = 0) {
22248
- for (const { line: line2, start: start2, inFence } of scanLines(text2)) {
22247
+ function findMarker(text3, marker, from = 0) {
22248
+ for (const { line: line2, start: start2, inFence } of scanLines(text3)) {
22249
22249
  if (!inFence && start2 >= from && line2.startsWith(marker)) {
22250
22250
  return start2;
22251
22251
  }
22252
22252
  }
22253
22253
  return -1;
22254
22254
  }
22255
- function hasLegacyMemoryBlock(text2) {
22256
- return findMarker(text2, LEGACY_MD_START) !== -1;
22255
+ function hasLegacyMemoryBlock(text3) {
22256
+ return findMarker(text3, LEGACY_MD_START) !== -1;
22257
22257
  }
22258
22258
  async function ensureClaudeMdPointer(cwd = repoRoot()) {
22259
22259
  const claudeMdPath = (0, import_node_path23.join)(cwd, "CLAUDE.md");
@@ -22454,10 +22454,10 @@ var STOP = /* @__PURE__ */ new Set([
22454
22454
  "verify",
22455
22455
  "check"
22456
22456
  ]);
22457
- function pendingTokens(text2) {
22458
- if (!text2 || typeof text2 !== "string") return [];
22457
+ function pendingTokens(text3) {
22458
+ if (!text3 || typeof text3 !== "string") return [];
22459
22459
  const out2 = /* @__PURE__ */ new Set();
22460
- for (const raw of text2.toLowerCase().split(/[^a-z0-9]+/)) {
22460
+ for (const raw of text3.toLowerCase().split(/[^a-z0-9]+/)) {
22461
22461
  if (raw.length <= 3) continue;
22462
22462
  if (STOP.has(raw)) continue;
22463
22463
  out2.add(raw);
@@ -22469,11 +22469,11 @@ function overlapCoefficient(a, b) {
22469
22469
  if (a.length === 0 || b.length === 0) return 0;
22470
22470
  const setB = new Set(b);
22471
22471
  let shared = 0;
22472
- for (const t of a) if (setB.has(t)) shared++;
22472
+ for (const t2 of a) if (setB.has(t2)) shared++;
22473
22473
  return shared / Math.min(a.length, b.length);
22474
22474
  }
22475
- function isRepeatOfAny(text2, priorFingerprints, threshold = REPEAT_THRESHOLD) {
22476
- const tokens = pendingTokens(text2);
22475
+ function isRepeatOfAny(text3, priorFingerprints, threshold = REPEAT_THRESHOLD) {
22476
+ const tokens = pendingTokens(text3);
22477
22477
  if (tokens.length === 0) return false;
22478
22478
  return priorFingerprints.some((prior) => overlapCoefficient(tokens, prior) >= threshold);
22479
22479
  }
@@ -22519,13 +22519,13 @@ var import_node_crypto6 = require("node:crypto");
22519
22519
  var import_node_fs27 = require("node:fs");
22520
22520
  var import_node_path24 = require("node:path");
22521
22521
  var CRC_TABLE = (() => {
22522
- const t = new Int32Array(256);
22522
+ const t2 = new Int32Array(256);
22523
22523
  for (let i2 = 0; i2 < 256; i2++) {
22524
22524
  let c = i2;
22525
22525
  for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
22526
- t[i2] = c;
22526
+ t2[i2] = c;
22527
22527
  }
22528
- return t;
22528
+ return t2;
22529
22529
  })();
22530
22530
  function crc32(s) {
22531
22531
  let c = -1;
@@ -22550,8 +22550,8 @@ function openDossier(identity) {
22550
22550
  }
22551
22551
  var lastSeq = 0;
22552
22552
  function nextSeq() {
22553
- const t = Date.now() * 1e3;
22554
- lastSeq = t > lastSeq ? t : lastSeq + 1;
22553
+ const t2 = Date.now() * 1e3;
22554
+ lastSeq = t2 > lastSeq ? t2 : lastSeq + 1;
22555
22555
  return lastSeq;
22556
22556
  }
22557
22557
  function encodeEvent(ev) {
@@ -22996,7 +22996,7 @@ function expandState(raw) {
22996
22996
  const g = raw.g;
22997
22997
  const a = raw.a;
22998
22998
  const n2 = raw.n;
22999
- const t = raw.t;
22999
+ const t2 = raw.t;
23000
23000
  const c = raw.c;
23001
23001
  const dv = raw.d;
23002
23002
  const m = raw.m;
@@ -23047,7 +23047,7 @@ function expandState(raw) {
23047
23047
  at: iso(x[2]),
23048
23048
  head_sha: x[3]
23049
23049
  })) ?? null,
23050
- statements: t.map((x) => ({
23050
+ statements: t2.map((x) => ({
23051
23051
  anchor_key: x[0],
23052
23052
  file: x[1],
23053
23053
  line: x[2],
@@ -23163,8 +23163,8 @@ function assessContinuity(i2) {
23163
23163
  // src/lib/dossier/reanchor.ts
23164
23164
  var import_node_crypto8 = require("node:crypto");
23165
23165
  var import_node_fs30 = require("node:fs");
23166
- function lineSha(text2) {
23167
- return (0, import_node_crypto8.createHash)("sha256").update(text2.trim()).digest("hex").slice(0, HASH_WIDTH);
23166
+ function lineSha(text3) {
23167
+ return (0, import_node_crypto8.createHash)("sha256").update(text3.trim()).digest("hex").slice(0, HASH_WIDTH);
23168
23168
  }
23169
23169
  function fileHash(path) {
23170
23170
  try {
@@ -23637,20 +23637,20 @@ function recordGoal(d, prompt, source2 = "prompt") {
23637
23637
  appendEvent(d, { k: "goal_continue", text: prompt.slice(0, 64) });
23638
23638
  return;
23639
23639
  }
23640
- const text2 = prompt.slice(0, MAX_GOAL_CHARS);
23640
+ const text3 = prompt.slice(0, MAX_GOAL_CHARS);
23641
23641
  appendEvent(d, {
23642
23642
  k: "goal",
23643
- text: text2,
23643
+ text: text3,
23644
23644
  text_len: prompt.length,
23645
23645
  source: source2,
23646
23646
  ...prompt.length > MAX_GOAL_CHARS && { truncated: true }
23647
23647
  });
23648
23648
  }
23649
- function recordTurn(d, t) {
23649
+ function recordTurn(d, t2) {
23650
23650
  const root = repoRoot();
23651
- for (const a of t.authored) {
23651
+ for (const a of t2.authored) {
23652
23652
  const origin = a.owner === "subagent" ? "subagent" : "edit_tool";
23653
- const prior = t.known?.authored?.get(a.p);
23653
+ const prior = t2.known?.authored?.get(a.p);
23654
23654
  const hash = fileHash((0, import_node_path26.join)(root, a.p));
23655
23655
  const hunks = Math.max(0, a.h - (prior?.hunks ?? 0));
23656
23656
  const adds = Math.max(0, a.a - (prior?.adds ?? 0));
@@ -23658,7 +23658,7 @@ function recordTurn(d, t) {
23658
23658
  if (prior && hunks === 0 && adds === 0 && dels === 0 && prior.hash_now === hash) continue;
23659
23659
  appendEvent(d, { k: "authored", path: a.p, origin, adds, dels, hunks, hash_now: hash });
23660
23660
  }
23661
- for (const c of t.commands) {
23661
+ for (const c of t2.commands) {
23662
23662
  appendEvent(d, {
23663
23663
  k: "command",
23664
23664
  cls: normaliseClass(c.class),
@@ -23671,20 +23671,20 @@ function recordTurn(d, t) {
23671
23671
  });
23672
23672
  }
23673
23673
  const head = getCurrentCommit();
23674
- for (const p of t.dirtyAtStart ?? []) {
23674
+ for (const p of t2.dirtyAtStart ?? []) {
23675
23675
  appendEvent(d, { k: "not_mine", path: p, reason: "dirty_at_start", head_sha: head });
23676
23676
  }
23677
- for (const p of t.foreign ?? []) {
23677
+ for (const p of t2.foreign ?? []) {
23678
23678
  appendEvent(d, { k: "not_mine", path: p, reason: "other_session", head_sha: head });
23679
23679
  }
23680
- for (const u of t.unobserved) {
23680
+ for (const u of t2.unobserved) {
23681
23681
  if (isGeneratedPath(u.p)) {
23682
23682
  appendEvent(d, { k: "not_mine", path: u.p, reason: "generated", head_sha: head });
23683
23683
  }
23684
23684
  }
23685
- const seenDivergence = t.known?.divergence ?? /* @__PURE__ */ new Set();
23685
+ const seenDivergence = t2.known?.divergence ?? /* @__PURE__ */ new Set();
23686
23686
  const fresh = [];
23687
- for (const u of t.unobserved) {
23687
+ for (const u of t2.unobserved) {
23688
23688
  const hash = fileHash((0, import_node_path26.join)(root, u.p));
23689
23689
  const key = divergenceKey(u.p, hash);
23690
23690
  const digest = packedDivergenceDigest(key);
@@ -23701,13 +23701,13 @@ function recordTurn(d, t) {
23701
23701
  appendEvent(d, { k: "divergence", kind: "external_mutation", path: f.path, hash: f.hash });
23702
23702
  }
23703
23703
  }
23704
- const newCompactions = (t.compactions ?? 0) - (t.known?.compactions ?? 0);
23704
+ const newCompactions = (t2.compactions ?? 0) - (t2.known?.compactions ?? 0);
23705
23705
  for (let i2 = 0; i2 < newCompactions; i2++) {
23706
23706
  appendEvent(d, { k: "mark", kind: "compaction", from: null, to: null });
23707
23707
  }
23708
- const known = t.known?.branch ?? null;
23709
- if (known && t.branch && known !== t.branch) {
23710
- appendEvent(d, { k: "mark", kind: "branch_switch", from: known, to: t.branch });
23708
+ const known = t2.known?.branch ?? null;
23709
+ if (known && t2.branch && known !== t2.branch) {
23710
+ appendEvent(d, { k: "mark", kind: "branch_switch", from: known, to: t2.branch });
23711
23711
  }
23712
23712
  }
23713
23713
  function normaliseClass(cls) {
@@ -23772,7 +23772,7 @@ function recordVerdict(d, v) {
23772
23772
  // actually spoke — a silenced turn delivered nothing, so nothing was "said
23773
23773
  // before" and labelling the next turn's items as repeats would be a lie.
23774
23774
  ...v.emitted === true && v.pendingTexts && v.pendingTexts.length > 0 && {
23775
- pending_sigs: v.pendingTexts.slice(0, 8).map((t) => pendingTokens(t).slice(0, 16))
23775
+ pending_sigs: v.pendingTexts.slice(0, 8).map((t2) => pendingTokens(t2).slice(0, 16))
23776
23776
  },
23777
23777
  emitted: v.emitted === true,
23778
23778
  idle: v.idle !== false,
@@ -24580,8 +24580,8 @@ function buildCompactionContext(session) {
24580
24580
  `${r.projection.fold.refused} earlier finding(s) were dropped because the code they pointed at no longer matches. They are resolved; do not revisit them.`
24581
24581
  );
24582
24582
  }
24583
- const text2 = lines.join("\n");
24584
- if (text2.length <= MAX_CHARS) return text2;
24583
+ const text3 = lines.join("\n");
24584
+ if (text3.length <= MAX_CHARS) return text3;
24585
24585
  const trimmed = [...lines.slice(0, 5), ...lines.slice(5, 5 + 2)].join("\n");
24586
24586
  return trimmed.length <= MAX_CHARS ? trimmed : null;
24587
24587
  }
@@ -24647,7 +24647,7 @@ async function readHookStdin() {
24647
24647
  // src/commands/standard.ts
24648
24648
  var import_node_fs38 = require("node:fs");
24649
24649
  var import_node_path31 = require("node:path");
24650
- var import_yaml7 = __toESM2(require_dist());
24650
+ var import_yaml8 = __toESM2(require_dist());
24651
24651
 
24652
24652
  // src/lib/synthesize.ts
24653
24653
  var import_node_fs36 = require("node:fs");
@@ -24858,14 +24858,14 @@ function trackedSourceFiles(root, opts = {}) {
24858
24858
  return files.slice(0, opts.maxFiles ?? 5e3);
24859
24859
  }
24860
24860
  var EFFECT_LINE = /\bawait\b|\basync\s+with\b|\.then\(|\bsetTimeout\(|\bsetInterval\(|\bwith\s+\w[\w.]*\.(?:lock|acquire)\b|\bLock\(\)/;
24861
- function countEffects(text2) {
24861
+ function countEffects(text3) {
24862
24862
  let n2 = 0;
24863
- for (const line2 of text2.split("\n")) if (EFFECT_LINE.test(line2)) n2++;
24863
+ for (const line2 of text3.split("\n")) if (EFFECT_LINE.test(line2)) n2++;
24864
24864
  return n2;
24865
24865
  }
24866
- function scanRisk(text2) {
24866
+ function scanRisk(text3) {
24867
24867
  const counts = Object.fromEntries(RISK_PATTERNS.map(([c]) => [c, 0]));
24868
- for (const line2 of text2.split("\n")) {
24868
+ for (const line2 of text3.split("\n")) {
24869
24869
  for (const [category, re] of RISK_PATTERNS) {
24870
24870
  if (re.test(line2)) counts[category]++;
24871
24871
  }
@@ -24961,14 +24961,14 @@ var SECRET_PATTERNS = [
24961
24961
  var EMAIL = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
24962
24962
  var URL_CREDENTIALS = /\b([a-z][a-z0-9+.-]*:\/\/)[^\s/:@]+:[^\s/@]+@/gi;
24963
24963
  var CONTROL3 = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\u2028-\u202e\u2066-\u2069]/g;
24964
- function redact(text2) {
24965
- let out2 = text2.replace(CONTROL3, "");
24964
+ function redact(text3) {
24965
+ let out2 = text3.replace(CONTROL3, "");
24966
24966
  for (const re of SECRET_PATTERNS) out2 = out2.replace(re, "[redacted]");
24967
24967
  out2 = out2.replace(URL_CREDENTIALS, "$1[redacted]@");
24968
24968
  return out2.replace(EMAIL, "[email]");
24969
24969
  }
24970
- function oneLine(text2, max) {
24971
- return redact(text2.replace(/[\r\n\t]+/g, " ")).trim().slice(0, max);
24970
+ function oneLine(text3, max) {
24971
+ return redact(text3.replace(/[\r\n\t]+/g, " ")).trim().slice(0, max);
24972
24972
  }
24973
24973
  function safePath(p) {
24974
24974
  if (!p || p.length > PATH_MAX || p.startsWith("/") || p.includes("\\")) return null;
@@ -25010,11 +25010,11 @@ function indentWidth(line2) {
25010
25010
  }
25011
25011
  return w;
25012
25012
  }
25013
- function stripCode(text2) {
25013
+ function stripCode(text3) {
25014
25014
  const out2 = [];
25015
25015
  let fence = null;
25016
25016
  let underItem = false;
25017
- for (const line2 of text2.split("\n")) {
25017
+ for (const line2 of text3.split("\n")) {
25018
25018
  const body2 = line2.replace(QUOTE, "");
25019
25019
  if (fence) {
25020
25020
  const close = FENCE_CLOSE.exec(body2);
@@ -25042,27 +25042,27 @@ function stripCode(text2) {
25042
25042
  return out2.join("\n");
25043
25043
  }
25044
25044
  function docText(raw) {
25045
- let text2 = raw;
25046
- const start2 = text2.indexOf(MANAGED_START);
25047
- const end = start2 >= 0 ? text2.indexOf(MANAGED_END, start2) : -1;
25045
+ let text3 = raw;
25046
+ const start2 = text3.indexOf(MANAGED_START);
25047
+ const end = start2 >= 0 ? text3.indexOf(MANAGED_END, start2) : -1;
25048
25048
  if (start2 >= 0 && end > start2) {
25049
- const block = text2.slice(start2, end);
25049
+ const block = text3.slice(start2, end);
25050
25050
  const ps = block.indexOf(PRESERVE_START2);
25051
25051
  const pe = ps >= 0 ? block.indexOf(PRESERVE_END2, ps) : -1;
25052
25052
  const kept = ps >= 0 && pe > ps ? block.slice(ps + PRESERVE_START2.length, pe) : "";
25053
- text2 = text2.slice(0, start2) + kept + text2.slice(end + MANAGED_END.length);
25053
+ text3 = text3.slice(0, start2) + kept + text3.slice(end + MANAGED_END.length);
25054
25054
  }
25055
- text2 = stripCode(text2.replace(/<!--[\s\S]*?-->/g, "").replace(/<!--[\s\S]*$/, "")).replace(/\n{3,}/g, "\n\n");
25056
- return redact(text2).trim();
25055
+ text3 = stripCode(text3.replace(/<!--[\s\S]*?-->/g, "").replace(/<!--[\s\S]*$/, "")).replace(/\n{3,}/g, "\n\n");
25056
+ return redact(text3).trim();
25057
25057
  }
25058
25058
  var RULE_TITLE = /convention|pattern|rule|gotcha|footgun|pitfall|best practice|guideline|principle|standard|style|architecture|design|security|database|migration|schema|\bapi\b|error|state|naming|structure|i18n|internationali[sz]|translation|important|critical|warning|do not|don't|never|must|avoid/i;
25059
25059
  var SETUP_TITLE = /setup|set up|install|getting started|quick ?start|command|script|\bci\b|release|deploy|reference|link|troubleshoot|licen[cs]e|faq|contact|support|changelog|prerequisite|environment|on the web|cloud|skill|documentation/i;
25060
25060
  var NORMATIVE = /\b(must|never|always|do not|don't|should|shouldn't|avoid|prefer|required|only|instead of|make sure|ensure)\b/i;
25061
- function docSections(text2) {
25061
+ function docSections(text3) {
25062
25062
  const out2 = [];
25063
25063
  const open = [];
25064
25064
  let current = { order: 0, heading: null, path: "", parents: [], lines: [] };
25065
- for (const line2 of text2.split("\n")) {
25065
+ for (const line2 of text3.split("\n")) {
25066
25066
  const m = /^(#{1,6})\s+(.*)$/.exec(line2);
25067
25067
  if (!m) {
25068
25068
  current.lines.push(line2);
@@ -25084,9 +25084,9 @@ function sectionRank(s) {
25084
25084
  const title = rule && !setup ? 2 : setup && !rule ? 0 : 1;
25085
25085
  return title * 1e3 + Math.min(999, s.lines.filter((l) => NORMATIVE.test(l)).length);
25086
25086
  }
25087
- function fitDoc(text2, budget) {
25088
- if (utf8(text2) <= budget) return text2;
25089
- const all = docSections(text2);
25087
+ function fitDoc(text3, budget) {
25088
+ if (utf8(text3) <= budget) return text3;
25089
+ const all = docSections(text3);
25090
25090
  const lineBytes = (line2) => utf8(line2) + 1;
25091
25091
  const GAP = lineBytes("\u2026");
25092
25092
  const chosen = /* @__PURE__ */ new Map();
@@ -25127,14 +25127,14 @@ function fitDoc(text2, budget) {
25127
25127
  }
25128
25128
  return cutToBytes(out2.join("\n").replace(/\n{3,}/g, "\n\n").trim(), budget);
25129
25129
  }
25130
- function utf8(text2) {
25131
- return Buffer.byteLength(text2, "utf8");
25130
+ function utf8(text3) {
25131
+ return Buffer.byteLength(text3, "utf8");
25132
25132
  }
25133
- function cutToBytes(text2, max) {
25134
- if (utf8(text2) <= max) return text2;
25133
+ function cutToBytes(text3, max) {
25134
+ if (utf8(text3) <= max) return text3;
25135
25135
  let out2 = "";
25136
25136
  let n2 = 0;
25137
- for (const ch of text2) {
25137
+ for (const ch of text3) {
25138
25138
  const b = utf8(ch);
25139
25139
  if (n2 + b > max) break;
25140
25140
  out2 += ch;
@@ -25161,11 +25161,11 @@ function readDocs(root, files) {
25161
25161
  const read2 = readRegularFileInRoot(root, name2, 256 * 1024);
25162
25162
  if (!read2.ok) continue;
25163
25163
  const fresh = docText(read2.content).split("\n").filter((l) => /^#{1,6}\s/.test(l) || normal(l).length < 25 || !sent.has(normal(l))).join("\n");
25164
- const text2 = fitDoc(fresh, room);
25165
- if (!text2) continue;
25166
- for (const l of text2.split("\n")) if (normal(l).length >= 25) sent.add(normal(l));
25167
- total += utf8(text2);
25168
- out2.push({ name: name2, text: text2 });
25164
+ const text3 = fitDoc(fresh, room);
25165
+ if (!text3) continue;
25166
+ for (const l of text3.split("\n")) if (normal(l).length >= 25) sent.add(normal(l));
25167
+ total += utf8(text3);
25168
+ out2.push({ name: name2, text: text3 });
25169
25169
  }
25170
25170
  return out2;
25171
25171
  }
@@ -25633,8 +25633,8 @@ async function writeSetupState(patch) {
25633
25633
  } catch {
25634
25634
  }
25635
25635
  }
25636
- const text2 = JSON.stringify(next, null, raw !== null ? detectJsonIndent(raw) : 2) + "\n";
25637
- if (!replaceInRoot(projectPath(VERITY_DIR), "setup.json", text2)) {
25636
+ const text3 = JSON.stringify(next, null, raw !== null ? detectJsonIndent(raw) : 2) + "\n";
25637
+ if (!replaceInRoot(projectPath(VERITY_DIR), "setup.json", text3)) {
25638
25638
  throw new Error(`Could not write ${SETUP_STATE_FILE}: it is a link, or ${VERITY_DIR} is not a folder of this repository`);
25639
25639
  }
25640
25640
  return next;
@@ -25823,6 +25823,174 @@ async function runPull(globals) {
25823
25823
  for (const note of r.notes) printWarn(terminalText(note, 300));
25824
25824
  }
25825
25825
 
25826
+ // src/commands/standard-catalogue.ts
25827
+ var import_yaml7 = __toESM2(require_dist());
25828
+ var PAGE = "verity.md/review-packs";
25829
+ var t = (v, max = 300) => terminalText(typeof v === "string" ? v : String(v ?? ""), max);
25830
+ function extendedPacks(yamlText) {
25831
+ if (!yamlText) return /* @__PURE__ */ new Set();
25832
+ try {
25833
+ const doc = (0, import_yaml7.parse)(yamlText);
25834
+ if (!Array.isArray(doc?.extends)) return /* @__PURE__ */ new Set();
25835
+ return new Set(doc.extends.filter((e) => typeof e === "string").map((e) => e.replace(/^verity\//, "").replace(/@.*$/, "")));
25836
+ } catch {
25837
+ return /* @__PURE__ */ new Set();
25838
+ }
25839
+ }
25840
+ function whenText(pack) {
25841
+ if (pack.always) return "always on";
25842
+ const items = pack.when?.any ?? pack.when?.all;
25843
+ if (!items || items.length === 0) return "add it by hand";
25844
+ const list2 = (label2, v) => `${label2} ${v.slice(0, 4).join(", ")}${v.length > 4 ? `, +${v.length - 4} more` : ""}`;
25845
+ const parts2 = items.map((s) => {
25846
+ if (s.bin) return "the repository ships a CLI";
25847
+ if (s.language) return list2("languages", s.language);
25848
+ if (s.framework) return list2("frameworks", s.framework);
25849
+ if (s.dep) return list2("dependencies", s.dep);
25850
+ if (s.path) return list2("paths", s.path);
25851
+ return "another signal";
25852
+ });
25853
+ return `when ${parts2.join(pack.when?.all ? " and " : " or ")}`;
25854
+ }
25855
+ function renderPackList(c, extended) {
25856
+ const width = Math.max(...c.packs.map((p) => p.ref.length));
25857
+ const lines = [`Review packs (catalogue ${t(c.catalogue_version, 40)}). The full catalogue: ${PAGE}`];
25858
+ for (const p of c.packs) {
25859
+ const mark = extended.has(p.id) ? "\u2713" : " ";
25860
+ const n2 = `${p.rules.length} rule${p.rules.length === 1 ? "" : "s"}`;
25861
+ lines.push(` ${mark} ${t(p.ref, 60).padEnd(width)} ${n2.padStart(8)} ${t(whenText(p), 200)}`);
25862
+ }
25863
+ if (extended.size > 0) lines.push(`\u2713 = in "extends" in ${STANDARD_FILE}`);
25864
+ lines.push("The rules of one pack: verity standard catalogue <pack>");
25865
+ return lines;
25866
+ }
25867
+ function renderPack(p, extended) {
25868
+ const head = `${t(p.ref, 60)}: ${t(p.title, 60)} (${p.rules.length} rule${p.rules.length === 1 ? "" : "s"}, ${t(whenText(p), 200)})${extended.has(p.id) ? ". This project extends it." : ""}`;
25869
+ const lines = [head, ` ${t(p.summary, 400)}`];
25870
+ for (const r of p.rules) {
25871
+ const refs = [...r.maps_to.cwe ?? [], ...r.maps_to.owasp ?? [], ...r.maps_to.owasp_api ?? [], ...r.maps_to.owasp_llm ?? []];
25872
+ lines.push("");
25873
+ lines.push(` ${t(r.id, 80)} ${t(r.severity, 10)} ${t(r.category, 20)} ${t(r.title, 120)}${refs.length ? ` [${t(refs.slice(0, 4).join(", "), 120)}]` : ""}`);
25874
+ lines.push(` ${t(r.rule, 600)}`);
25875
+ if (!r.reviewed_in_diff) lines.push(" Not given to the diff reviewer yet: it is seen in commands or the session, not in the code change.");
25876
+ if (r.also_in.length) lines.push(` Also in: ${t(r.also_in.join(", "), 200)}`);
25877
+ }
25878
+ lines.push("");
25879
+ lines.push(`Turn one rule off in ${STANDARD_FILE}: overrides: { <rule-id>: off }, then verity standard push. Examples: ${PAGE}#${t(p.id, 40)}`);
25880
+ return lines;
25881
+ }
25882
+ var LIMITS2 = { packs: 32, rules: 200, list: 200, id: 120, text: 8e3, item: 200 };
25883
+ var text = (v, max = LIMITS2.text) => typeof v === "string" && v.length <= max;
25884
+ var strings = (v) => Array.isArray(v) && v.length <= LIMITS2.list && v.every((x) => text(x, LIMITS2.item));
25885
+ var optionalStrings = (v) => v === void 0 || strings(v);
25886
+ var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
25887
+ function isSignal(v) {
25888
+ if (!isObject(v)) return false;
25889
+ const keys = Object.keys(v);
25890
+ if (keys.length !== 1) return false;
25891
+ const [k] = keys;
25892
+ if (k === "bin") return v.bin === true;
25893
+ return ["language", "framework", "dep", "path"].includes(k) && strings(v[k]);
25894
+ }
25895
+ function isWhen(v) {
25896
+ if (v === null) return true;
25897
+ if (!isObject(v)) return false;
25898
+ const keys = Object.keys(v);
25899
+ if (keys.length !== 1 || keys[0] !== "any" && keys[0] !== "all") return false;
25900
+ const items = v[keys[0]];
25901
+ return Array.isArray(items) && items.length <= LIMITS2.list && items.every(isSignal);
25902
+ }
25903
+ function isRule(v) {
25904
+ if (!isObject(v)) return false;
25905
+ const m = v.maps_to;
25906
+ return text(v.id, LIMITS2.id) && text(v.severity, LIMITS2.id) && text(v.category, LIMITS2.id) && text(v.title, LIMITS2.item) && text(v.rule) && text(v.evidence_required) && typeof v.reviewed_in_diff === "boolean" && strings(v.also_in) && isObject(m) && ["cwe", "owasp", "owasp_api", "owasp_llm"].every((k) => optionalStrings(m[k]));
25907
+ }
25908
+ function isPack(v) {
25909
+ if (!isObject(v)) return false;
25910
+ return text(v.id, LIMITS2.id) && text(v.ref, LIMITS2.id) && text(v.title, LIMITS2.item) && text(v.summary) && typeof v.always === "boolean" && isWhen(v.when) && Array.isArray(v.rules) && v.rules.length <= LIMITS2.rules && v.rules.every(isRule);
25911
+ }
25912
+ var copyStrings = (v) => [...v];
25913
+ function copyRule(v) {
25914
+ const m = v.maps_to;
25915
+ const maps = {};
25916
+ for (const k of ["cwe", "owasp", "owasp_api", "owasp_llm"]) if (m[k] !== void 0) maps[k] = copyStrings(m[k]);
25917
+ return {
25918
+ id: v.id,
25919
+ title: v.title,
25920
+ rule: v.rule,
25921
+ evidence_required: v.evidence_required,
25922
+ category: v.category,
25923
+ severity: v.severity,
25924
+ reviewed_in_diff: v.reviewed_in_diff,
25925
+ maps_to: maps,
25926
+ also_in: copyStrings(v.also_in)
25927
+ };
25928
+ }
25929
+ function copyWhen(v) {
25930
+ if (v === null) return null;
25931
+ const w = v;
25932
+ const key = "any" in w ? "any" : "all";
25933
+ const signals = w[key].map((s) => {
25934
+ const [k, val] = Object.entries(s)[0];
25935
+ return k === "bin" ? { bin: true } : { [k]: copyStrings(val) };
25936
+ });
25937
+ return key === "any" ? { any: signals } : { all: signals };
25938
+ }
25939
+ function asCatalogue(v) {
25940
+ if (!isObject(v) || !text(v.catalogue_version, LIMITS2.id) || !Array.isArray(v.packs) || v.packs.length > LIMITS2.packs || !v.packs.every(isPack)) return null;
25941
+ return {
25942
+ catalogue_version: v.catalogue_version,
25943
+ packs: v.packs.map((p) => ({
25944
+ id: p.id,
25945
+ ref: p.ref,
25946
+ title: p.title,
25947
+ summary: p.summary,
25948
+ always: p.always,
25949
+ when: copyWhen(p.when),
25950
+ rules: p.rules.map(copyRule)
25951
+ }))
25952
+ };
25953
+ }
25954
+ async function runCatalogue(globals, pack, opts) {
25955
+ const url = await resolveServiceUrl(globals.serviceUrl);
25956
+ if (!url.ok) {
25957
+ printError(t(url.error));
25958
+ process.exit(1);
25959
+ }
25960
+ const res = await apiRequest({
25961
+ method: "GET",
25962
+ path: "/standards/catalogue/packs",
25963
+ serviceUrl: url.data,
25964
+ verbose: globals.verbose,
25965
+ cmd: "standard catalogue",
25966
+ withoutRemote: true,
25967
+ timeout: 15e3
25968
+ });
25969
+ if (!res.ok) {
25970
+ printError(`Could not read the review-pack catalogue from the Verity service: ${t(res.error)}. See ${PAGE}`);
25971
+ process.exit(1);
25972
+ }
25973
+ const catalogue = asCatalogue(res.data);
25974
+ if (!catalogue) {
25975
+ printError(`The Verity service answered with something that is not a review-pack catalogue. See ${PAGE}`);
25976
+ process.exit(1);
25977
+ }
25978
+ const extended = extendedPacks(readRepoFile(STANDARD_FILE));
25979
+ if (pack === void 0) {
25980
+ if (opts.json) printJson(catalogue);
25981
+ else for (const line2 of renderPackList(catalogue, extended)) printInfo(line2);
25982
+ return;
25983
+ }
25984
+ const id = pack.replace(/^verity\//, "").replace(/@.*$/, "");
25985
+ const found = catalogue.packs.find((p) => p.id === id);
25986
+ if (!found) {
25987
+ printError(`No review pack named "${t(pack, 60)}". The packs: ${t(catalogue.packs.map((p) => p.id).join(", "), 300)}.`);
25988
+ process.exit(1);
25989
+ }
25990
+ if (opts.json) printJson(found);
25991
+ else for (const line2 of renderPack(found, extended)) printInfo(line2);
25992
+ }
25993
+
25826
25994
  // src/commands/standard.ts
25827
25995
  function registerStandardCommands(program2) {
25828
25996
  const standard = program2.command("standard").description("Manage the project Standard");
@@ -25860,6 +26028,7 @@ function registerStandardCommands(program2) {
25860
26028
  });
25861
26029
  standard.command("generate").description("Have Verity write project-specific rules from a profile of this repository (asks before sending it)").option("--yes", `Send the profile without asking (you have read ${PROFILE_FILE})`).option("--status", "Print whether the service writes project rules for this project: on, off, unsupported or unknown. Sends nothing.").action((opts) => runGenerate(program2.opts(), opts));
25862
26030
  standard.command("pull").description("Write the team's Standard on the service into .verity/standard.yaml (keeps a copy of yours)").action(() => runPull(program2.opts()));
26031
+ standard.command("catalogue [pack]").description("What each review pack holds: every pack, or the rules of one (core, api, data, \u2026)").option("--json", "Print the catalogue as JSON").action((pack, opts) => runCatalogue(program2.opts(), pack, opts));
25863
26032
  standard.command("push").description("Upload the project Standard to the service").option("--file <path>", "Path to standard YAML file", STANDARD_FILE).option("--created-by <name>", "Who created this version", "claude-code").action(async (opts) => {
25864
26033
  const globals = program2.opts();
25865
26034
  const tokenResult = await resolveToken(globals.token);
@@ -25997,7 +26166,7 @@ function standardUploadBody(yamlText, file, ignoreRaw, createdBy) {
25997
26166
  if (!author.ok) return { ok: false, error: `--created-by: ${author.error}. Nothing was sent.` };
25998
26167
  let parsed;
25999
26168
  try {
26000
- parsed = (0, import_yaml7.parse)(yamlText);
26169
+ parsed = (0, import_yaml8.parse)(yamlText);
26001
26170
  } catch (err2) {
26002
26171
  return { ok: false, error: `Invalid YAML in ${shown}: ${terminalText(err2.message, 300)}` };
26003
26172
  }
@@ -27087,15 +27256,15 @@ function renderSeatUsage(d, now = /* @__PURE__ */ new Date()) {
27087
27256
  lines.push(` ${pad("Turn reviews", 24)}session ${pad(used(me.session.turn, ml?.turn.session), 12)}week ${pad(used(w.turn, memberWeek("turn")), 14)}busiest session ${n(w.peak_session.turn)}`);
27088
27257
  lines.push(` This week: ${n(w.blocked)} blocked, ${n(w.warned)} warned \xB7 review time p50 ${secs(w.latency_ms.p50)}, p90 ${secs(w.latency_ms.p90)}`);
27089
27258
  }
27090
- const t = d.totals.weeks[0];
27259
+ const t2 = d.totals.weeks[0];
27091
27260
  lines.push("");
27092
27261
  lines.push(`Team \xB7 ${n(d.totals.active_members)} active this week`);
27093
- const poolUsed = pool?.used ?? (pool ? { commit: t.commit, turn: t.turn } : null);
27262
+ const poolUsed = pool?.used ?? (pool ? { commit: t2.commit, turn: t2.turn } : null);
27094
27263
  if (pool && poolUsed && d.plan) {
27095
27264
  lines.push(
27096
27265
  ` Week pool: ${n(poolUsed.commit)} / ${n(pool.commit)} commit & push, ${n(poolUsed.turn)} / ${n(pool.turn)} turn (${poolText(d.plan, pool.members)}; the session limit is each member's)`
27097
27266
  );
27098
- if (pool.used) lines.push(` Everyone in ${d.organization.name} this week, members or not: ${n(t.commit)} commit & push, ${n(t.turn)} turn.`);
27267
+ if (pool.used) lines.push(` Everyone in ${d.organization.name} this week, members or not: ${n(t2.commit)} commit & push, ${n(t2.turn)} turn.`);
27099
27268
  }
27100
27269
  if (d.viewer !== "member" && d.members.length > 0) {
27101
27270
  const rows = d.members.map((m) => [
@@ -27113,19 +27282,19 @@ function renderSeatUsage(d, now = /* @__PURE__ */ new Date()) {
27113
27282
  const total = [
27114
27283
  "Team total",
27115
27284
  n(d.totals.session.commit),
27116
- used(t.commit, totalLimit("commit")),
27117
- n(t.peak_session.commit),
27285
+ used(t2.commit, totalLimit("commit")),
27286
+ n(t2.peak_session.commit),
27118
27287
  n(d.totals.session.turn),
27119
- used(t.turn, totalLimit("turn")),
27120
- n(t.blocked),
27121
- `${secs(t.latency_ms.p50)} / ${secs(t.latency_ms.p90)}`
27288
+ used(t2.turn, totalLimit("turn")),
27289
+ n(t2.blocked),
27290
+ `${secs(t2.latency_ms.p50)} / ${secs(t2.latency_ms.p90)}`
27122
27291
  ];
27123
27292
  const widths = head.map((h, i2) => Math.max(h.length, ...rows.map((r) => r[i2].length), total[i2].length) + 2);
27124
27293
  lines.push(" " + head.map((h, i2) => pad(h, widths[i2])).join("").trimEnd());
27125
27294
  for (const r of rows) lines.push(" " + r.map((c, i2) => pad(c, widths[i2])).join("").trimEnd());
27126
27295
  lines.push(" " + total.map((c, i2) => pad(c, widths[i2])).join("").trimEnd());
27127
27296
  } else {
27128
- lines.push(` This week: ${n(t.commit)} commit & push reviews, ${n(t.turn)} turn reviews, ${n(t.blocked)} blocked.`);
27297
+ lines.push(` This week: ${n(t2.commit)} commit & push reviews, ${n(t2.turn)} turn reviews, ${n(t2.blocked)} blocked.`);
27129
27298
  if (d.viewer === "member") lines.push(` Only the admins of ${d.organization.name} see every member.`);
27130
27299
  }
27131
27300
  if (d.truncated) lines.push(" (Partial: the org has more reviews than one report reads.)");
@@ -27250,16 +27419,16 @@ function readTextInput(value, flag, readStdin2 = () => (0, import_node_fs42.read
27250
27419
  if (raw.length > MAX_STDIN_BYTES) {
27251
27420
  return { ok: false, error: `${flag} from stdin is ${raw.length} bytes; the limit is ${MAX_STDIN_BYTES}.` };
27252
27421
  }
27253
- const text2 = raw.toString("utf8").replace(/\r?\n$/, "");
27254
- if (!text2.trim()) return { ok: false, error: `${flag} from stdin is empty.` };
27255
- return { ok: true, text: text2 };
27422
+ const text3 = raw.toString("utf8").replace(/\r?\n$/, "");
27423
+ if (!text3.trim()) return { ok: false, error: `${flag} from stdin is empty.` };
27424
+ return { ok: true, text: text3 };
27256
27425
  }
27257
27426
 
27258
27427
  // src/commands/feedback.ts
27259
27428
  function registerFeedbackCommand(program2) {
27260
27429
  const feedbackCmd = program2.command("feedback").description("Send feedback to the Verity team");
27261
- feedbackCmd.command("message <text>").description("Send general feedback (- reads the message from stdin, so the words never pass through shell quoting)").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (text2, opts) => {
27262
- await sendMessageArg(text2, opts, program2.opts());
27430
+ feedbackCmd.command("message <text>").description("Send general feedback (- reads the message from stdin, so the words never pass through shell quoting)").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (text3, opts) => {
27431
+ await sendMessageArg(text3, opts, program2.opts());
27263
27432
  });
27264
27433
  feedbackCmd.command("finding <run-id> <pattern-id> <action> [note]").description("Submit per-finding feedback (false_positive, acknowledged, useful, etc.); a note of - is read from stdin").option("--file <path>", "File path the finding applies to").option("--line <n>", "Line number", parseInt).action(async (runId, patternId, action, inlineNote, opts) => {
27265
27434
  const globals = program2.opts();
@@ -27865,28 +28034,28 @@ function parseRgLine(line2) {
27865
28034
  return { file: line2.slice(0, first), line: n2, text: line2.slice(second + 1) };
27866
28035
  }
27867
28036
  var isWordChar = (c) => c !== void 0 && /[A-Za-z0-9_]/.test(c);
27868
- function wordHit(text2, symbol) {
28037
+ function wordHit(text3, symbol) {
27869
28038
  let from = 0;
27870
28039
  for (; ; ) {
27871
- const at = text2.indexOf(symbol, from);
28040
+ const at = text3.indexOf(symbol, from);
27872
28041
  if (at < 0) return false;
27873
- const before = at === 0 ? void 0 : text2[at - 1];
27874
- const after = text2[at + symbol.length];
28042
+ const before = at === 0 ? void 0 : text3[at - 1];
28043
+ const after = text3[at + symbol.length];
27875
28044
  if (!isWordChar(before) && !isWordChar(after)) return true;
27876
28045
  from = at + 1;
27877
28046
  }
27878
28047
  }
27879
- function isContractLine(text2, symbol) {
28048
+ function isContractLine(text3, symbol) {
27880
28049
  for (const kw of ["implements", "extends"]) {
27881
28050
  let from = 0;
27882
28051
  for (; ; ) {
27883
- const at = text2.indexOf(kw, from);
28052
+ const at = text3.indexOf(kw, from);
27884
28053
  if (at < 0) break;
27885
28054
  from = at + 1;
27886
- const before = at === 0 ? void 0 : text2[at - 1];
27887
- const after = text2[at + kw.length];
28055
+ const before = at === 0 ? void 0 : text3[at - 1];
28056
+ const after = text3[at + kw.length];
27888
28057
  if (isWordChar(before) || isWordChar(after)) continue;
27889
- let clause = text2.slice(at + kw.length);
28058
+ let clause = text3.slice(at + kw.length);
27890
28059
  const stop2 = Math.min(
27891
28060
  ...[clause.indexOf(";"), clause.indexOf("{")].filter((i2) => i2 >= 0)
27892
28061
  );
@@ -27918,20 +28087,20 @@ function partitionSites(rgLines, symbols, opts) {
27918
28087
  if (opts.sentPaths.has(h.file)) continue;
27919
28088
  if (opts.isExcluded(h.file)) continue;
27920
28089
  if (!isCodeSiteFile(h.file)) continue;
27921
- const text2 = h.text.trim();
27922
- if (text2.length === 0 || IMPORT_LINE.test(h.text)) continue;
27923
- if (COMMENT_LINE.test(text2)) continue;
27924
- if (BARE_MEMBER_LINE.test(text2) || GO_IMPORT_PATH_LINE.test(text2)) continue;
28090
+ const text3 = h.text.trim();
28091
+ if (text3.length === 0 || IMPORT_LINE.test(h.text)) continue;
28092
+ if (COMMENT_LINE.test(text3)) continue;
28093
+ if (BARE_MEMBER_LINE.test(text3) || GO_IMPORT_PATH_LINE.test(text3)) continue;
27925
28094
  const n2 = perFile.get(h.file) ?? 0;
27926
28095
  if (n2 >= MAX_SITES_PER_FILE) continue;
27927
28096
  const site = {
27928
28097
  file: h.file,
27929
28098
  line: h.line,
27930
- text: text2.slice(0, SITE_TEXT_MAX),
28099
+ text: text3.slice(0, SITE_TEXT_MAX),
27931
28100
  symbol: h.symbol,
27932
28101
  // R2 falls out of R1 for free: a word search for `Sym` already matches
27933
28102
  // `implements Sym` / `extends Sym` lines — classification is all R2 is.
27934
- ...isContractLine(text2, h.symbol) ? { kind: "contract" } : {}
28103
+ ...isContractLine(text3, h.symbol) ? { kind: "contract" } : {}
27935
28104
  };
27936
28105
  if (isTestPath(h.file)) {
27937
28106
  if (tests.length < MAX_TEST_SLOTS) {
@@ -27951,8 +28120,8 @@ var MAX_IMPORTERS_PER_FILE = 2;
27951
28120
  function moduleKey(path) {
27952
28121
  return path.replace(/\.(ts|tsx|js|jsx|mjs|cjs|mts|cts)$/i, "").replace(/\/index$/, "");
27953
28122
  }
27954
- function importSpecifier(text2) {
27955
- const m = /(?:\bfrom|\brequire\s*\(|\bimport\s*\(|^\s*import)\s*['"]([^'"\n]+)['"]/.exec(text2);
28123
+ function importSpecifier(text3) {
28124
+ const m = /(?:\bfrom|\brequire\s*\(|\bimport\s*\(|^\s*import)\s*['"]([^'"\n]+)['"]/.exec(text3);
27956
28125
  return m?.[1] ?? null;
27957
28126
  }
27958
28127
  function resolveSpecifier(fromFile, spec) {
@@ -28222,8 +28391,8 @@ function extractEnclosingExcerpt(content, siteLine, path) {
28222
28391
  start2 = Math.max(1, siteLine - (EXCERPT_MAX_LINES - 6));
28223
28392
  }
28224
28393
  const end = Math.min(lines.length, start2 + EXCERPT_MAX_LINES - 1);
28225
- const text2 = lines.slice(start2 - 1, end).join("\n").slice(0, EXCERPT_MAX_CHARS);
28226
- return { start_line: start2, text: text2 };
28394
+ const text3 = lines.slice(start2 - 1, end).join("\n").slice(0, EXCERPT_MAX_CHARS);
28395
+ return { start_line: start2, text: text3 };
28227
28396
  }
28228
28397
  function upgradeToExcerpts(rc, opts) {
28229
28398
  if (rc.state !== "ok") return;
@@ -28357,10 +28526,10 @@ function formatRunEvidence(run4, startedAt) {
28357
28526
  }
28358
28527
  }
28359
28528
  if (run4.foldResult?.tools?.length) {
28360
- const shown = run4.foldResult.tools.slice(0, 6).map((t) => {
28361
- const outcome = t.failed > 0 ? `${t.failed} failed` : t.last_status === 0 ? "ok" : "?";
28362
- const where2 = t.targets.length > 0 ? ` \u2192 ${t.targets.slice(0, 2).join(", ")}` : "";
28363
- return `${t.runs}\xD7 ${t.name} (${outcome})${where2}`;
28529
+ const shown = run4.foldResult.tools.slice(0, 6).map((t2) => {
28530
+ const outcome = t2.failed > 0 ? `${t2.failed} failed` : t2.last_status === 0 ? "ok" : "?";
28531
+ const where2 = t2.targets.length > 0 ? ` \u2192 ${t2.targets.slice(0, 2).join(", ")}` : "";
28532
+ return `${t2.runs}\xD7 ${t2.name} (${outcome})${where2}`;
28364
28533
  });
28365
28534
  const more = run4.foldResult.tools.length > 6 ? ` \u2026 +${run4.foldResult.tools.length - 6} more` : "";
28366
28535
  out2 += row("tools", shown.join(" \xB7 ") + more);
@@ -28369,9 +28538,9 @@ function formatRunEvidence(run4, startedAt) {
28369
28538
  }
28370
28539
  }
28371
28540
  if (run4.foldResult?.tasks?.length) {
28372
- const t = run4.foldResult.tasks;
28373
- const done2 = t.filter((x) => x.status === "completed").length;
28374
- out2 += row("tasks", `${t.length} \xB7 ${done2} completed \xB7 ` + list(t.slice(0, 4).map((x) => `#${x.id} ${x.name} [${x.status}]`), 4));
28541
+ const t2 = run4.foldResult.tasks;
28542
+ const done2 = t2.filter((x) => x.status === "completed").length;
28543
+ out2 += row("tasks", `${t2.length} \xB7 ${done2} completed \xB7 ` + list(t2.slice(0, 4).map((x) => `#${x.id} ${x.name} [${x.status}]`), 4));
28375
28544
  }
28376
28545
  if (run4.specs?.length) {
28377
28546
  const readThisSession = new Set(run4.actionSummary?.files_read ?? []);
@@ -28525,31 +28694,31 @@ function parsePushTarget(segment) {
28525
28694
  let refspec = null;
28526
28695
  let isDelete = false;
28527
28696
  for (let i2 = 0; i2 < tokens.length; i2++) {
28528
- const t = tokens[i2];
28529
- if (t === "-d" || t === "--delete") {
28697
+ const t2 = tokens[i2];
28698
+ if (t2 === "-d" || t2 === "--delete") {
28530
28699
  isDelete = true;
28531
28700
  continue;
28532
28701
  }
28533
- if (t.startsWith("--repo=")) {
28534
- remote = t.slice("--repo=".length);
28702
+ if (t2.startsWith("--repo=")) {
28703
+ remote = t2.slice("--repo=".length);
28535
28704
  continue;
28536
28705
  }
28537
- if (t === "--repo") {
28706
+ if (t2 === "--repo") {
28538
28707
  remote = tokens[++i2] ?? null;
28539
28708
  continue;
28540
28709
  }
28541
- if (PUSH_VALUE_FLAGS.has(t)) {
28710
+ if (PUSH_VALUE_FLAGS.has(t2)) {
28542
28711
  i2++;
28543
28712
  continue;
28544
28713
  }
28545
- if (t.startsWith("-")) continue;
28546
- if (SHELL_DYNAMIC.test(t)) return none;
28714
+ if (t2.startsWith("-")) continue;
28715
+ if (SHELL_DYNAMIC.test(t2)) return none;
28547
28716
  if (remote === null) {
28548
- remote = t;
28717
+ remote = t2;
28549
28718
  continue;
28550
28719
  }
28551
28720
  if (refspec === null) {
28552
- refspec = t;
28721
+ refspec = t2;
28553
28722
  continue;
28554
28723
  }
28555
28724
  break;
@@ -28875,21 +29044,21 @@ function rangeMessages(frame, range) {
28875
29044
  return frameGit(frame, ["show", "-s", "--format=%B%x00", ...commits]).split("\0").map((s) => s.trim()).filter(Boolean).join("\n\n");
28876
29045
  }
28877
29046
  function frameTelemetry(frame, range, divergence) {
28878
- const t = {
29047
+ const t2 = {
28879
29048
  anchor: frame.anchor,
28880
29049
  linked_worktree: frame.isLinkedWorktree,
28881
29050
  range_via: range?.via ?? null,
28882
29051
  refusal: frame.refusal
28883
29052
  };
28884
29053
  if (divergence) {
28885
- t.root_differs = !!frame.worktreeRoot && !!divergence.actualRoot && realpathOr2(frame.worktreeRoot) !== realpathOr2(divergence.actualRoot);
29054
+ t2.root_differs = !!frame.worktreeRoot && !!divergence.actualRoot && realpathOr2(frame.worktreeRoot) !== realpathOr2(divergence.actualRoot);
28886
29055
  const a = [...divergence.actualFiles].sort().join("\n");
28887
29056
  const b = [...divergence.frameFiles].sort().join("\n");
28888
- t.files_differ = a !== b;
28889
- t.frame_file_count = divergence.frameFiles.length;
28890
- t.actual_file_count = divergence.actualFiles.length;
29057
+ t2.files_differ = a !== b;
29058
+ t2.frame_file_count = divergence.frameFiles.length;
29059
+ t2.actual_file_count = divergence.actualFiles.length;
28891
29060
  }
28892
- return t;
29061
+ return t2;
28893
29062
  }
28894
29063
 
28895
29064
  // src/lib/transcript-path.ts
@@ -29388,12 +29557,12 @@ function parseKnowledgeNote(raw) {
29388
29557
  if (!raw || typeof raw !== "object") return null;
29389
29558
  const o = raw;
29390
29559
  const node_id = typeof o.node_id === "string" ? o.node_id.trim() : "";
29391
- const text2 = typeof o.text === "string" ? o.text.trim() : "";
29392
- if (!node_id || !text2) return null;
29393
- if (text2.length > 1e3) return null;
29560
+ const text3 = typeof o.text === "string" ? o.text.trim() : "";
29561
+ if (!node_id || !text3) return null;
29562
+ if (text3.length > 1e3) return null;
29394
29563
  return {
29395
29564
  node_id,
29396
- text: text2,
29565
+ text: text3,
29397
29566
  file: typeof o.file === "string" && o.file ? o.file : null,
29398
29567
  line: typeof o.line === "number" && Number.isFinite(o.line) && o.line > 0 ? Math.floor(o.line) : null
29399
29568
  };
@@ -29441,10 +29610,10 @@ function judgedSeverity(f) {
29441
29610
  var MAX_AGENT_CONTEXT_CHARS = 1500;
29442
29611
  var MAX_AGENT_ITEMS = 5;
29443
29612
  var REPORT_PREFIX = "Verity review (a report on the code just written \u2014 relay what matters to the user; it is not an instruction to you):";
29444
- function renderItem(label2, text2, patternId, file, line2) {
29613
+ function renderItem(label2, text3, patternId, file, line2) {
29445
29614
  const where2 = file ? ` (${file}${line2 !== void 0 && line2 !== "" ? `:${line2}` : ""})` : "";
29446
29615
  const id = patternId ? ` [${patternId}]` : "";
29447
- return `- ${label2}${text2}${where2}${id}`;
29616
+ return `- ${label2}${text3}${where2}${id}`;
29448
29617
  }
29449
29618
  function channelInputFrom(response, intentRepeat = 0, priorPendingFingerprints = []) {
29450
29619
  const metadata2 = response.metadata ?? {};
@@ -29535,24 +29704,24 @@ function composeAgentContext(input) {
29535
29704
  for (const p of input.pendingItems ?? []) {
29536
29705
  if (lines.length >= MAX_AGENT_ITEMS) break;
29537
29706
  if (p.pattern_id === "intent-misalignment") continue;
29538
- const text3 = p.description ?? p.title ?? p.reason;
29539
- if (!text3) continue;
29540
- const seenBefore = isRepeatOfAny(text3, input.priorPendingFingerprints ?? []);
29707
+ const text4 = p.description ?? p.title ?? p.reason;
29708
+ if (!text4) continue;
29709
+ const seenBefore = isRepeatOfAny(text4, input.priorPendingFingerprints ?? []);
29541
29710
  lines.push(
29542
- renderItem("", text3, p.pattern_id, p.file, p.line) + (seenBefore ? "\n (raised earlier this session and still open \u2014 do not re-explain it; act on it or carry on)" : "")
29711
+ renderItem("", text4, p.pattern_id, p.file, p.line) + (seenBefore ? "\n (raised earlier this session and still open \u2014 do not re-explain it; act on it or carry on)" : "")
29543
29712
  );
29544
29713
  }
29545
29714
  if (lines.length === 0) return { text: null, shown: [] };
29546
29715
  const body2 = `${REPORT_PREFIX}
29547
29716
  ${lines.slice(0, MAX_AGENT_ITEMS).join("\n")}`;
29548
- const text2 = truncateToCap(body2);
29549
- return { text: text2, shown: shown.filter((s) => text2.split("\n").includes(s.line)).map((s) => s.finding) };
29717
+ const text3 = truncateToCap(body2);
29718
+ return { text: text3, shown: shown.filter((s) => text3.split("\n").includes(s.line)).map((s) => s.finding) };
29550
29719
  }
29551
- function truncateToCap(text2) {
29552
- if (text2.length <= MAX_AGENT_CONTEXT_CHARS) return text2;
29720
+ function truncateToCap(text3) {
29721
+ if (text3.length <= MAX_AGENT_CONTEXT_CHARS) return text3;
29553
29722
  const marker = "\n- (truncated)";
29554
29723
  const budget = MAX_AGENT_CONTEXT_CHARS - marker.length;
29555
- const lines = text2.slice(0, budget).split("\n");
29724
+ const lines = text3.slice(0, budget).split("\n");
29556
29725
  lines.pop();
29557
29726
  return `${lines.join("\n")}${marker}`;
29558
29727
  }
@@ -30728,9 +30897,9 @@ function fold(transcriptPath, opts = {}) {
30728
30897
  runs: s.runs,
30729
30898
  failed: s.failed,
30730
30899
  last_status: s.last_status,
30731
- targets: [...s.targets].map((t) => toRepoRelative(t, opts.repoRoot)).sort()
30900
+ targets: [...s.targets].map((t2) => toRepoRelative(t2, opts.repoRoot)).sort()
30732
30901
  })).sort((a, b) => b.runs - a.runs || a.name.localeCompare(b.name));
30733
- result.tasks = [...taskById.entries()].map(([id, t]) => ({ id, name: t.name, status: t.status })).sort((a, b) => (Number(a.id) || 0) - (Number(b.id) || 0));
30902
+ result.tasks = [...taskById.entries()].map(([id, t2]) => ({ id, name: t2.name, status: t2.status })).sort((a, b) => (Number(a.id) || 0) - (Number(b.id) || 0));
30734
30903
  const authoredPaths = new Set(result.authored.map((a) => a.p));
30735
30904
  for (const raw of opts.changedFiles ?? []) {
30736
30905
  const p = toRepoRelative(raw, opts.repoRoot);
@@ -31416,8 +31585,8 @@ var cap = (s, n2) => {
31416
31585
  function qualifierOf(node, spec) {
31417
31586
  if (spec.id === "go" && node.type === "method_declaration") {
31418
31587
  const receiver = node.childForFieldName("receiver");
31419
- const t = receiver?.descendantsOfType("type_identifier")[0];
31420
- return t ? t.text : null;
31588
+ const t2 = receiver?.descendantsOfType("type_identifier")[0];
31589
+ return t2 ? t2.text : null;
31421
31590
  }
31422
31591
  for (let p = node.parent; p; p = p.parent) {
31423
31592
  if (spec.classes.has(p.type)) return p.childForFieldName("name")?.text ?? null;
@@ -31572,10 +31741,10 @@ function factsOf(def, spec, defs, path) {
31572
31741
  const walk2 = (n2, ctx) => {
31573
31742
  const anonymousMember = n2.parent?.type === "class_body" && n2.parent.parent?.type === "object_creation_expression";
31574
31743
  if (n2.id !== def.fn.id && !anonymousMember && (defs.has(n2.id) || spec.classes.has(n2.type) || spec.definitions[n2.type])) return;
31575
- const t = n2.type;
31744
+ const t2 = n2.type;
31576
31745
  bind(n2);
31577
31746
  const down = (c, next = ctx) => walk2(c, next);
31578
- if (spec.calls.has(t)) {
31747
+ if (spec.calls.has(t2)) {
31579
31748
  const { receiver, name: name2, args: args2 } = callParts(n2, spec);
31580
31749
  if (name2) {
31581
31750
  calls.push({
@@ -31596,29 +31765,29 @@ function factsOf(def, spec, defs, path) {
31596
31765
  return;
31597
31766
  }
31598
31767
  }
31599
- if (spec.awaits.has(t)) awaits.push(line(n2));
31600
- if (t === "defer_statement") {
31768
+ if (spec.awaits.has(t2)) awaits.push(line(n2));
31769
+ if (t2 === "defer_statement") {
31601
31770
  for (const c of n2.namedChildren) down(c, { ...ctx, within: [...ctx.within, "defer"] });
31602
31771
  return;
31603
31772
  }
31604
- if (spec.lockNodes.has(t)) {
31773
+ if (spec.lockNodes.has(t2)) {
31605
31774
  locks.push(line(n2));
31606
31775
  for (const c of n2.namedChildren) down(c, { ...ctx, within: [...ctx.within, "synchronized"] });
31607
31776
  return;
31608
31777
  }
31609
- if (t === "with_statement") {
31778
+ if (t2 === "with_statement") {
31610
31779
  const item = n2.namedChildren[0];
31611
31780
  if (PY_LOCK_ITEM.test(item?.text ?? "")) locks.push(line(n2));
31612
31781
  const label2 = withLabel(item);
31613
31782
  for (const c of n2.namedChildren) down(c, c.type === "block" && label2 ? { ...ctx, within: [...ctx.within, label2] } : ctx);
31614
31783
  return;
31615
31784
  }
31616
- if (spec.loops.has(t)) {
31785
+ if (spec.loops.has(t2)) {
31617
31786
  loops.push(line(n2));
31618
31787
  for (const c of n2.namedChildren) down(c, { ...ctx, inLoop: true });
31619
31788
  return;
31620
31789
  }
31621
- if (spec.tries.has(t)) {
31790
+ if (spec.tries.has(t2)) {
31622
31791
  const handlers = n2.namedChildren.filter((c) => spec.handlers.has(c.type));
31623
31792
  tries.push({ line: line(n2), end: n2.endPosition.row + 1, catches: handlers.length > 0, rethrows: handlers.some(throwsIn) });
31624
31793
  const body2 = n2.childForFieldName("body");
@@ -31737,9 +31906,9 @@ function literalName(literal) {
31737
31906
  return prefix.length >= 2 ? { name: prefix, confidence: "prefix" } : null;
31738
31907
  }
31739
31908
  var SIMPLE_EXPRESSION = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*(?:\(\))?$/;
31740
- var STABLE_EXPRESSION = (t) => {
31741
- if (t.endsWith("()")) return true;
31742
- const root = t.split(".")[0];
31909
+ var STABLE_EXPRESSION = (t2) => {
31910
+ if (t2.endsWith("()")) return true;
31911
+ const root = t2.split(".")[0];
31743
31912
  return root === "this" || root === "self" || /^[A-Z]/.test(root);
31744
31913
  };
31745
31914
  function argResource(kind2, arg) {
@@ -31752,13 +31921,13 @@ function argResource(kind2, arg) {
31752
31921
  const keyed = keyedCall(arg.text);
31753
31922
  return keyed ? { kind: kind2, name: keyed, confidence: "expression" } : { kind: kind2, name: null, confidence: "unknown" };
31754
31923
  }
31755
- function keyedCall(text2) {
31756
- const t = text2.trim();
31757
- const open = t.indexOf("(");
31758
- if (open <= 0 || !t.endsWith(")")) return null;
31759
- const callee = t.slice(0, open);
31924
+ function keyedCall(text3) {
31925
+ const t2 = text3.trim();
31926
+ const open = t2.indexOf("(");
31927
+ if (open <= 0 || !t2.endsWith(")")) return null;
31928
+ const callee = t2.slice(0, open);
31760
31929
  if (!/^[A-Za-z_$][\w$.]*$/.test(callee)) return null;
31761
- const constant = /\b[A-Z][A-Z0-9_]{2,}\b/.exec(t.slice(open + 1, -1));
31930
+ const constant = /\b[A-Z][A-Z0-9_]{2,}\b/.exec(t2.slice(open + 1, -1));
31762
31931
  return constant ? `${callee}(${constant[0]})` : null;
31763
31932
  }
31764
31933
  function snake(s) {
@@ -31787,16 +31956,16 @@ var SQL_TABLE = [
31787
31956
  [/\bfrom\s+[`"[]?([\w.]+)/i, "read"]
31788
31957
  ];
31789
31958
  function sqlLiteral(c) {
31790
- const text2 = c.args.find((a) => a.literal !== null && SQL.test(a.literal))?.literal;
31791
- if (!text2) return null;
31959
+ const text3 = c.args.find((a) => a.literal !== null && SQL.test(a.literal))?.literal;
31960
+ if (!text3) return null;
31792
31961
  for (const [re, op] of SQL_TABLE) {
31793
- const m = re.exec(text2);
31962
+ const m = re.exec(text3);
31794
31963
  if (m) {
31795
31964
  const name2 = m[1].split(".").pop();
31796
- return { op, resource: table(name2), rule: "sql.literal", lock: op === "read" && /\bfor\s+(?:no\s+key\s+)?update\b/i.test(text2) };
31965
+ return { op, resource: table(name2), rule: "sql.literal", lock: op === "read" && /\bfor\s+(?:no\s+key\s+)?update\b/i.test(text3) };
31797
31966
  }
31798
31967
  }
31799
- return { op: /^\s*select\b/i.test(text2) ? "read" : "write", resource: { kind: "table", name: null, confidence: "unknown" }, rule: "sql.literal" };
31968
+ return { op: /^\s*select\b/i.test(text3) ? "read" : "write", resource: { kind: "table", name: null, confidence: "unknown" }, rule: "sql.literal" };
31800
31969
  }
31801
31970
  var SB_WRITE = /* @__PURE__ */ new Set(["insert", "update", "upsert", "delete"]);
31802
31971
  var SB_FROM = /\bfrom\(\s*(['"`])([\w.-]+)\1\s*\)\s*$/;
@@ -31973,7 +32142,7 @@ function heldAt(fn, line2) {
31973
32142
  }
31974
32143
  function contextOf(c, fn) {
31975
32144
  const recvRoot = (c.receiver ?? "").split(".")[0];
31976
- const tryBlock = c.tryAt === null ? null : fn.tries.find((t) => t.line === c.tryAt) ?? null;
32145
+ const tryBlock = c.tryAt === null ? null : fn.tries.find((t2) => t2.line === c.tryAt) ?? null;
31977
32146
  return {
31978
32147
  txn: c.within.some((w) => TXN.has(w)) || recvRoot === "tx" || recvRoot === "trx",
31979
32148
  // A lock this call runs inside, or a statement lock taken earlier and still held.
@@ -32192,42 +32361,42 @@ var ALIAS_OF = "alias-of:";
32192
32361
  var FIELD_OF = "field-of:";
32193
32362
  var IDENT_CHAR = /[\w$]/;
32194
32363
  var isIdent = (s) => /^[A-Za-z_$][\w$]*$/.test(s);
32195
- function wordAt(text2, word) {
32364
+ function wordAt(text3, word) {
32196
32365
  const out2 = [];
32197
- for (let i2 = text2.indexOf(word); i2 >= 0; i2 = text2.indexOf(word, i2 + 1)) {
32198
- if (IDENT_CHAR.test(text2[i2 - 1] ?? "") || IDENT_CHAR.test(text2[i2 + word.length] ?? "")) continue;
32366
+ for (let i2 = text3.indexOf(word); i2 >= 0; i2 = text3.indexOf(word, i2 + 1)) {
32367
+ if (IDENT_CHAR.test(text3[i2 - 1] ?? "") || IDENT_CHAR.test(text3[i2 + word.length] ?? "")) continue;
32199
32368
  out2.push(i2);
32200
32369
  }
32201
32370
  return out2;
32202
32371
  }
32203
32372
  var GO_NOT_TYPES = /* @__PURE__ */ new Set(["int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "float32", "float64", "complex64", "complex128", "string", "bool", "byte", "rune", "error", "any", "func", "chan", "map", "struct", "interface", "range", "make", "new", "nil", "true", "false"]);
32204
- function typeAt(text2, i2, lang) {
32373
+ function typeAt(text3, i2, lang) {
32205
32374
  let j = i2;
32206
32375
  const skip = () => {
32207
- while (j < text2.length && /[\s?*&]/.test(text2[j])) j++;
32376
+ while (j < text3.length && /[\s?*&]/.test(text3[j])) j++;
32208
32377
  };
32209
32378
  skip();
32210
- for (const kw of ["new ", "readonly ", "await "]) if (text2.startsWith(kw, j)) {
32379
+ for (const kw of ["new ", "readonly ", "await "]) if (text3.startsWith(kw, j)) {
32211
32380
  j += kw.length;
32212
32381
  skip();
32213
32382
  }
32214
32383
  let k = j;
32215
- while (k < text2.length && /[\w$.]/.test(text2[k])) k++;
32216
- const name2 = text2.slice(j, k).split(".").pop() ?? "";
32384
+ while (k < text3.length && /[\w$.]/.test(text3[k])) k++;
32385
+ const name2 = text3.slice(j, k).split(".").pop() ?? "";
32217
32386
  if (lang === "go") return /^[A-Za-z_]\w*$/.test(name2) && !GO_NOT_TYPES.has(name2) ? name2 : null;
32218
32387
  return /^[A-Z][\w$]*$/.test(name2) ? name2 : null;
32219
32388
  }
32220
32389
  function declaredType(scope2, v, lang) {
32221
32390
  for (const i2 of wordAt(scope2, v)) {
32222
32391
  const after = scope2.slice(i2 + v.length);
32223
- const t = after.trimStart();
32224
- if (lang !== "go" && lang !== "java" && t.startsWith(":") && !t.startsWith("::")) {
32392
+ const t2 = after.trimStart();
32393
+ if (lang !== "go" && lang !== "java" && t2.startsWith(":") && !t2.startsWith("::")) {
32225
32394
  const ty = typeAt(after, after.indexOf(":") + 1, lang);
32226
32395
  if (ty) return ty;
32227
32396
  }
32228
- const eq = t.startsWith(":=") ? 2 : t.startsWith("=") && !t.startsWith("==") ? 1 : 0;
32397
+ const eq = t2.startsWith(":=") ? 2 : t2.startsWith("=") && !t2.startsWith("==") ? 1 : 0;
32229
32398
  if (eq) {
32230
- const rhs = t.slice(eq).trimStart();
32399
+ const rhs = t2.slice(eq).trimStart();
32231
32400
  if (lang === "go" && rhs.startsWith("new(")) {
32232
32401
  const ty2 = typeAt(rhs, 4, lang);
32233
32402
  if (ty2) return ty2;
@@ -32338,8 +32507,8 @@ function receiverType(content, lang, caller, receiver, callLine) {
32338
32507
  if (lang === "go" && caller && caller.params.includes(receiver)) {
32339
32508
  const body2 = lines.slice(caller.start.line, callLine).join("\n");
32340
32509
  if (rebindsInGo(body2, receiver)) {
32341
- const t = declaredType(body2, receiver, lang);
32342
- return t && !t.includes(":") ? t : null;
32510
+ const t2 = declaredType(body2, receiver, lang);
32511
+ return t2 && !t2.includes(":") ? t2 : null;
32343
32512
  }
32344
32513
  }
32345
32514
  const goReceiver = lang === "go" && caller && caller.params[0] === receiver && caller.qualified.includes(".");
@@ -32363,10 +32532,10 @@ function boundInGo(fnText, name2) {
32363
32532
  const brace = fnText.indexOf("{");
32364
32533
  return wordAt(brace < 0 ? fnText : fnText.slice(0, brace), name2).length > 0;
32365
32534
  }
32366
- function rebindsInGo(text2, name2) {
32367
- for (const i2 of wordAt(text2, name2)) {
32368
- const lineEnd = text2.indexOf("\n", i2);
32369
- const rest = text2.slice(i2 + name2.length, lineEnd < 0 ? void 0 : lineEnd);
32535
+ function rebindsInGo(text3, name2) {
32536
+ for (const i2 of wordAt(text3, name2)) {
32537
+ const lineEnd = text3.indexOf("\n", i2);
32538
+ const rest = text3.slice(i2 + name2.length, lineEnd < 0 ? void 0 : lineEnd);
32370
32539
  const decl = rest.indexOf(":=");
32371
32540
  if (decl >= 0 && /^[\s\w,]*$/.test(rest.slice(0, decl))) return true;
32372
32541
  }
@@ -32391,15 +32560,15 @@ function localType(content, lang, caller, name2, lines, classes, depth) {
32391
32560
  const fnText = caller ? lines.slice(caller.start.line - 1, caller.end.line).join("\n") : "";
32392
32561
  const local = caller ? declaredType(fnText, name2, lang) : null;
32393
32562
  if (!local && caller && lang === "go" && boundInGo(fnText, name2)) return null;
32394
- const t = local ?? declaredType(lang === "go" ? goPackageVars(content) : content, name2, lang);
32395
- if (!t) return null;
32396
- if (t.startsWith(RESULT_OF)) {
32397
- const [fn, idx] = t.slice(RESULT_OF.length).split("#");
32563
+ const t2 = local ?? declaredType(lang === "go" ? goPackageVars(content) : content, name2, lang);
32564
+ if (!t2) return null;
32565
+ if (t2.startsWith(RESULT_OF)) {
32566
+ const [fn, idx] = t2.slice(RESULT_OF.length).split("#");
32398
32567
  return resultTypeOf(content, fn, lang, Number(idx ?? 0)) ?? `${RESULT_OF}${fn}#${idx ?? 0}`;
32399
32568
  }
32400
- if (t.startsWith(ALIAS_OF)) return localType(content, lang, caller, t.slice(ALIAS_OF.length), lines, classes, depth + 1);
32401
- if (t.startsWith(FIELD_OF)) {
32402
- const [base, field] = t.slice(FIELD_OF.length).split(".");
32569
+ if (t2.startsWith(ALIAS_OF)) return localType(content, lang, caller, t2.slice(ALIAS_OF.length), lines, classes, depth + 1);
32570
+ if (t2.startsWith(FIELD_OF)) {
32571
+ const [base, field] = t2.slice(FIELD_OF.length).split(".");
32403
32572
  const baseType = localType(content, lang, caller, base, lines, classes, depth + 1);
32404
32573
  const cls = baseType ? classes.find((c) => c.name === baseType) : null;
32405
32574
  if (!cls) return null;
@@ -32407,7 +32576,7 @@ function localType(content, lang, caller, name2, lines, classes, depth) {
32407
32576
  const self2 = lang === "python" ? "self" : "this";
32408
32577
  return declaredType(body2, field, lang) ?? declaredType(body2, `${self2}.${field}`, lang);
32409
32578
  }
32410
- return t;
32579
+ return t2;
32411
32580
  }
32412
32581
  function classFiles(type, fromPath, content, lang, source2, resolveImport, importOf2) {
32413
32582
  if (classesIn(content, lang).some((c) => c.name === type)) return [fromPath];
@@ -32592,15 +32761,15 @@ function importOf(content, lang, name2, receiver) {
32592
32761
  return null;
32593
32762
  }
32594
32763
  var TS_EXTS = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
32595
- function parseJsonc(text2) {
32764
+ function parseJsonc(text3) {
32596
32765
  let out2 = "";
32597
32766
  let inString = false;
32598
- for (let i2 = 0; i2 < text2.length; i2++) {
32599
- const c = text2[i2];
32767
+ for (let i2 = 0; i2 < text3.length; i2++) {
32768
+ const c = text3[i2];
32600
32769
  if (inString) {
32601
32770
  out2 += c;
32602
32771
  if (c === "\\") {
32603
- out2 += text2[++i2] ?? "";
32772
+ out2 += text3[++i2] ?? "";
32604
32773
  continue;
32605
32774
  }
32606
32775
  if (c === '"') inString = false;
@@ -32611,14 +32780,14 @@ function parseJsonc(text2) {
32611
32780
  out2 += c;
32612
32781
  continue;
32613
32782
  }
32614
- if (c === "/" && text2[i2 + 1] === "/") {
32615
- while (i2 < text2.length && text2[i2] !== "\n") i2++;
32783
+ if (c === "/" && text3[i2 + 1] === "/") {
32784
+ while (i2 < text3.length && text3[i2] !== "\n") i2++;
32616
32785
  out2 += "\n";
32617
32786
  continue;
32618
32787
  }
32619
- if (c === "/" && text2[i2 + 1] === "*") {
32788
+ if (c === "/" && text3[i2 + 1] === "*") {
32620
32789
  i2 += 2;
32621
- while (i2 < text2.length && !(text2[i2] === "*" && text2[i2 + 1] === "/")) i2++;
32790
+ while (i2 < text3.length && !(text3[i2] === "*" && text3[i2 + 1] === "/")) i2++;
32622
32791
  i2++;
32623
32792
  continue;
32624
32793
  }
@@ -32659,8 +32828,8 @@ function tsCandidates(spec, fromPath, cfg) {
32659
32828
  const star = pattern.indexOf("*");
32660
32829
  const matched = star < 0 ? spec === pattern ? "" : null : spec.startsWith(pattern.slice(0, star)) && spec.endsWith(pattern.slice(star + 1)) ? spec.slice(star, spec.length - (pattern.length - star - 1)) : null;
32661
32830
  if (matched === null) continue;
32662
- for (const t of targets) {
32663
- const b = joinPath(root ?? "", t.replace("*", matched));
32831
+ for (const t2 of targets) {
32832
+ const b = joinPath(root ?? "", t2.replace("*", matched));
32664
32833
  if (b !== null) bases.push(b);
32665
32834
  }
32666
32835
  }
@@ -32827,36 +32996,36 @@ function definitionOf(input) {
32827
32996
  }
32828
32997
  var MAX_CALLER_SCAN_FILES = 60;
32829
32998
  var isWordChar2 = (c) => c !== void 0 && /[\w$]/.test(c);
32830
- function callStarts(text2, name2) {
32999
+ function callStarts(text3, name2) {
32831
33000
  const out2 = [];
32832
- for (let i2 = text2.indexOf(name2); i2 >= 0; i2 = text2.indexOf(name2, i2 + 1)) {
33001
+ for (let i2 = text3.indexOf(name2); i2 >= 0; i2 = text3.indexOf(name2, i2 + 1)) {
32833
33002
  let j = i2 + name2.length;
32834
- if (text2[j] === "<") {
33003
+ if (text3[j] === "<") {
32835
33004
  let depth = 0;
32836
- for (; j < text2.length; j++) {
32837
- if (text2[j] === "<") depth++;
32838
- else if (text2[j] === ">" && --depth === 0) break;
33005
+ for (; j < text3.length; j++) {
33006
+ if (text3[j] === "<") depth++;
33007
+ else if (text3[j] === ">" && --depth === 0) break;
32839
33008
  }
32840
33009
  j++;
32841
33010
  }
32842
- if (text2[j] === "(") out2.push({ index: i2, open: j });
33011
+ if (text3[j] === "(") out2.push({ index: i2, open: j });
32843
33012
  }
32844
33013
  return out2;
32845
33014
  }
32846
- function callsName(text2, name2) {
32847
- const t = text2.trim();
32848
- if (t.startsWith("//") || t.startsWith("*") || t.startsWith("/*") || t.startsWith("#")) return false;
32849
- for (const at of callStarts(text2, name2)) {
33015
+ function callsName(text3, name2) {
33016
+ const t2 = text3.trim();
33017
+ if (t2.startsWith("//") || t2.startsWith("*") || t2.startsWith("/*") || t2.startsWith("#")) return false;
33018
+ for (const at of callStarts(text3, name2)) {
32850
33019
  const i2 = at.index;
32851
- const spread = text2.slice(Math.max(0, i2 - 3), i2) === "...";
32852
- if (isWordChar2(text2[i2 - 1]) || text2[i2 - 1] === "." && !spread) continue;
33020
+ const spread = text3.slice(Math.max(0, i2 - 3), i2) === "...";
33021
+ if (isWordChar2(text3[i2 - 1]) || text3[i2 - 1] === "." && !spread) continue;
32853
33022
  let depth = 0;
32854
33023
  let j = at.open;
32855
- for (; j < text2.length; j++) {
32856
- if (text2[j] === "(") depth++;
32857
- else if (text2[j] === ")" && --depth === 0) break;
33024
+ for (; j < text3.length; j++) {
33025
+ if (text3[j] === "(") depth++;
33026
+ else if (text3[j] === ")" && --depth === 0) break;
32858
33027
  }
32859
- const after = text2.slice(j + 1).trimStart();
33028
+ const after = text3.slice(j + 1).trimStart();
32860
33029
  if (after.startsWith(":") || after.startsWith("{")) continue;
32861
33030
  return true;
32862
33031
  }
@@ -32946,11 +33115,11 @@ function callersOf(input) {
32946
33115
  if (seen.has(line2) || declared.has(line2)) continue;
32947
33116
  const inside2 = r.value.some((f) => f.start.line <= line2 && line2 <= f.end.line && f.calls.some((c) => c.line === line2 && c.name === name2));
32948
33117
  if (inside2) continue;
32949
- const text2 = lines[line2 - 1] ?? "";
32950
- if (!callsName(text2, name2) || /^\s*(?:export\s+)?(?:async\s+)?(?:function|def|func)\b/.test(text2)) continue;
33118
+ const text3 = lines[line2 - 1] ?? "";
33119
+ if (!callsName(text3, name2) || /^\s*(?:export\s+)?(?:async\s+)?(?:function|def|func)\b/.test(text3)) continue;
32951
33120
  const enclosing = r.value.filter((f) => f.start.line <= line2 && line2 <= f.end.line).sort((a, b) => a.end.line - a.start.line - (b.end.line - b.start.line))[0];
32952
33121
  seen.add(line2);
32953
- callers.push({ path: p, caller: enclosing ? enclosing.qualified : null, line: line2, text: text2.trim().slice(0, 200), provenance: fileTie });
33122
+ callers.push({ path: p, caller: enclosing ? enclosing.qualified : null, line: line2, text: text3.trim().slice(0, 200), provenance: fileTie });
32954
33123
  }
32955
33124
  }
32956
33125
  }
@@ -33257,24 +33426,24 @@ ${m.accessors.map((x) => ` ${x.fn.path}:${x.fn.start.line} ${x.fn.qualified} \u
33257
33426
  return { ok: true, value: lines.join("\n") };
33258
33427
  };
33259
33428
  var KINDS = ["table", "cache", "file", "http", "queue", "service", "memory"];
33260
- function parseResource(text2) {
33261
- const colon = text2.indexOf(":");
33262
- const kind2 = colon > 0 ? text2.slice(0, colon) : "";
33263
- if (KINDS.includes(kind2)) return { kinds: [kind2], name: text2.slice(colon + 1) };
33264
- return { kinds: KINDS, name: text2 };
33429
+ function parseResource(text3) {
33430
+ const colon = text3.indexOf(":");
33431
+ const kind2 = colon > 0 ? text3.slice(0, colon) : "";
33432
+ if (KINDS.includes(kind2)) return { kinds: [kind2], name: text3.slice(colon + 1) };
33433
+ return { kinds: KINDS, name: text3 };
33265
33434
  }
33266
33435
  var writersOfTool = async (ctx, args2) => {
33267
- const text2 = str2(args2.resource, 300, "resource");
33268
- if (!text2.ok) return text2;
33269
- const { kinds, name: name2 } = parseResource(text2.value);
33436
+ const text3 = str2(args2.resource, 300, "resource");
33437
+ if (!text3.ok) return text3;
33438
+ const { kinds, name: name2 } = parseResource(text3.value);
33270
33439
  if (name2.length < 2) return { ok: false, error: "resource name too short to search for" };
33271
33440
  const deadline = Date.now() + TOOL_MS;
33272
33441
  const src = source(ctx);
33273
33442
  const terms = [.../* @__PURE__ */ new Set([name2, ...searchTerms({ kind: "table", name: name2, confidence: "inferred" })])];
33274
33443
  const files = /* @__PURE__ */ new Set();
33275
33444
  let truncated = false;
33276
- for (const t of terms) {
33277
- const found = src.search(t, { maxHits: 300, timeoutMs: Math.max(100, deadline - Date.now()) });
33445
+ for (const t2 of terms) {
33446
+ const found = src.search(t2, { maxHits: 300, timeoutMs: Math.max(100, deadline - Date.now()) });
33278
33447
  if (!found.ok) {
33279
33448
  truncated = true;
33280
33449
  continue;
@@ -33305,7 +33474,7 @@ var writersOfTool = async (ctx, args2) => {
33305
33474
  if (files.size > 25) truncated = true;
33306
33475
  const list2 = (xs) => xs.length ? xs.slice(0, MAX_LIST).map((x) => ` ${x}`).join("\n") + (xs.length > MAX_LIST ? `
33307
33476
  \u2026 ${xs.length - MAX_LIST} more` : "") : " none found";
33308
- return { ok: true, value: `${text2.value} (${where(ctx)}), heuristic${truncated ? ", search cut short" : ""}
33477
+ return { ok: true, value: `${text3.value} (${where(ctx)}), heuristic${truncated ? ", search cut short" : ""}
33309
33478
  writers:
33310
33479
  ${list2(writers)}
33311
33480
  readers:
@@ -33363,9 +33532,9 @@ function validateRepoPath(value, { allowRoot = false } = {}) {
33363
33532
  function lineNumber(value, fallback) {
33364
33533
  return typeof value === "number" && Number.isInteger(value) && value >= 1 ? value : fallback;
33365
33534
  }
33366
- function capOutput(text2) {
33367
- return text2.length > TOOL_LIMITS.outputChars ? `${text2.slice(0, TOOL_LIMITS.outputChars)}
33368
- [truncated at ${TOOL_LIMITS.outputChars} characters]` : text2;
33535
+ function capOutput(text3) {
33536
+ return text3.length > TOOL_LIMITS.outputChars ? `${text3.slice(0, TOOL_LIMITS.outputChars)}
33537
+ [truncated at ${TOOL_LIMITS.outputChars} characters]` : text3;
33369
33538
  }
33370
33539
  function git(ctx, args2, opts = {}) {
33371
33540
  return runGit(ctx.root, args2, { timeoutMs: opts.timeoutMs ?? TOOL_LIMITS.gitTimeoutMs, maxBuffer: opts.maxBuffer ?? TOOL_LIMITS.fileBytes });
@@ -33499,8 +33668,8 @@ var listFilesTool = async (ctx, args2) => {
33499
33668
  \u2026 ${more} more` : ""}` : "no matching files" };
33500
33669
  };
33501
33670
  var searchTool = async (ctx, args2) => {
33502
- const text2 = args2.text;
33503
- if (typeof text2 !== "string" || text2.length === 0 || text2.length > TOOL_LIMITS.textChars || /[\n\r]/.test(text2)) {
33671
+ const text3 = args2.text;
33672
+ if (typeof text3 !== "string" || text3.length === 0 || text3.length > TOOL_LIMITS.textChars || /[\n\r]/.test(text3)) {
33504
33673
  return { ok: false, error: `text must be 1-${TOOL_LIMITS.textChars} characters on one line` };
33505
33674
  }
33506
33675
  const glob = typeof args2.path_glob === "string" && args2.path_glob.length > 0 ? args2.path_glob : null;
@@ -33509,7 +33678,7 @@ var searchTool = async (ctx, args2) => {
33509
33678
  }
33510
33679
  const pathspec = glob ? [`:(glob)${glob}`] : [];
33511
33680
  const revision = ctx.range.kind === "push" ? [ctx.range.head] : ["--cached"];
33512
- const res = await git(ctx, ["grep", "-n", "-I", "-F", "--no-color", ...revision.filter((r) => r === "--cached"), "-e", text2, ...revision.filter((r) => r !== "--cached"), "--", ...pathspec]);
33681
+ const res = await git(ctx, ["grep", "-n", "-I", "-F", "--no-color", ...revision.filter((r) => r === "--cached"), "-e", text3, ...revision.filter((r) => r !== "--cached"), "--", ...pathspec]);
33513
33682
  if (!res.ok) {
33514
33683
  if (res.error === "failed" && res.stderr.trim() === "") return { ok: true, value: "no matches" };
33515
33684
  return { ok: false, error: gitFailure(res, "search") };
@@ -33643,10 +33812,10 @@ function writerExcerpts(codeMap, writers, read2, maxLines, maxChars, budget) {
33643
33812
  if (content === null) continue;
33644
33813
  const win = functionWindow(codeMap, w.file, content, w.line, maxLines);
33645
33814
  if (!win) continue;
33646
- const text2 = content.split("\n").slice(win.start_line - 1, win.end_line).join("\n").slice(0, maxChars);
33647
- if (used2 + text2.length > budget) break;
33648
- used2 += text2.length;
33649
- out2.push({ file: w.file, start_line: win.start_line, symbol: `${w.symbol} (writes ${w.resource}, like ${w.changed})`, kind: "writer", text: text2 });
33815
+ const text3 = content.split("\n").slice(win.start_line - 1, win.end_line).join("\n").slice(0, maxChars);
33816
+ if (used2 + text3.length > budget) break;
33817
+ used2 += text3.length;
33818
+ out2.push({ file: w.file, start_line: win.start_line, symbol: `${w.symbol} (writes ${w.resource}, like ${w.changed})`, kind: "writer", text: text3 });
33650
33819
  }
33651
33820
  return out2;
33652
33821
  }
@@ -33706,7 +33875,7 @@ async function repoContext(run4) {
33706
33875
  var import_promises11 = require("node:fs/promises");
33707
33876
  var import_node_fs53 = require("node:fs");
33708
33877
  var import_node_path42 = require("node:path");
33709
- var import_yaml8 = __toESM2(require_dist());
33878
+ var import_yaml9 = __toESM2(require_dist());
33710
33879
 
33711
33880
  // src/lib/seed.ts
33712
33881
  function extractReadmeIntro(content) {
@@ -34017,7 +34186,7 @@ async function runSeed(opts) {
34017
34186
  let standardDoc;
34018
34187
  try {
34019
34188
  const raw = await (0, import_promises11.readFile)(STANDARD_FILE, "utf-8");
34020
- standardDoc = (0, import_yaml8.parse)(raw);
34189
+ standardDoc = (0, import_yaml9.parse)(raw);
34021
34190
  } catch {
34022
34191
  return { created: 0, existing: 0, failed: 0, skipped: "no_standard", candidates: [] };
34023
34192
  }
@@ -35093,7 +35262,7 @@ async function reconcile(run4) {
35093
35262
  const episodeSignals = {
35094
35263
  humanSpoke: (conversation?.prompts?.length ?? 0) > 0,
35095
35264
  rawFail: decision === "FAIL",
35096
- tasksCompleted: (foldResult?.tasks ?? []).filter((t) => t.status === "completed").length,
35265
+ tasksCompleted: (foldResult?.tasks ?? []).filter((t2) => t2.status === "completed").length,
35097
35266
  now: Math.floor(Date.now() / 1e3)
35098
35267
  };
35099
35268
  let episode = resolveEpisode(readAdvisoryEpisode(baselineSessionId), episodeSignals);
@@ -36317,7 +36486,7 @@ var IDENT2 = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$/;
36317
36486
  var SHA256 = /^(sha256:)?[0-9a-f]{64}$/;
36318
36487
  var KINDS2 = /* @__PURE__ */ new Set(["structural", "intent"]);
36319
36488
  var RESULTS = /* @__PURE__ */ new Set(["holds", "counterexample", "exhausted", "proved"]);
36320
- var LIMITS2 = {
36489
+ var LIMITS3 = {
36321
36490
  text: 1e3,
36322
36491
  // desc, source
36323
36492
  state: 4e3,
@@ -36348,22 +36517,22 @@ function strArr(v, maxItems, maxItem) {
36348
36517
  return out2;
36349
36518
  }
36350
36519
  function nat(v) {
36351
- return typeof v === "number" && Number.isInteger(v) && v >= 0 && v <= LIMITS2.int ? v : null;
36520
+ return typeof v === "number" && Number.isInteger(v) && v >= 0 && v <= LIMITS3.int ? v : null;
36352
36521
  }
36353
36522
  function repoPath2(v) {
36354
- const s = str3(v, LIMITS2.path);
36523
+ const s = str3(v, LIMITS3.path);
36355
36524
  if (!s || s.startsWith("/") || /^[A-Za-z]:[\\/]/.test(s)) return null;
36356
36525
  if (s.split(/[\\/]/).some((p) => p === ".." || p === "")) return null;
36357
36526
  return s;
36358
36527
  }
36359
36528
  function parseHeader(obj) {
36360
36529
  const model = ident(obj.model);
36361
- if (!model || !Array.isArray(obj.abstracts) || obj.abstracts.length > LIMITS2.abstracts) return null;
36530
+ if (!model || !Array.isArray(obj.abstracts) || obj.abstracts.length > LIMITS3.abstracts) return null;
36362
36531
  const abstracts = [];
36363
36532
  for (const a of obj.abstracts) {
36364
36533
  if (!isPlainObject2(a)) return null;
36365
36534
  const file = repoPath2(a.file);
36366
- const symbol = str3(a.symbol, LIMITS2.symbol);
36535
+ const symbol = str3(a.symbol, LIMITS3.symbol);
36367
36536
  const sha = a.sha256 === void 0 ? "" : str3(a.sha256, 80);
36368
36537
  if (!file || !symbol || sha === null) return null;
36369
36538
  if (sha !== "" && sha !== "TBD" && !SHA256.test(sha)) return null;
@@ -36385,8 +36554,8 @@ function parseProperty(obj) {
36385
36554
  const id = ident(obj.id);
36386
36555
  const kind2 = typeof obj.kind === "string" && KINDS2.has(obj.kind) ? obj.kind : null;
36387
36556
  const result = typeof obj.result === "string" && RESULTS.has(obj.result) ? obj.result : null;
36388
- const source2 = obj.source === void 0 ? "" : str3(obj.source, LIMITS2.text);
36389
- const desc = obj.desc === void 0 ? "" : str3(obj.desc, LIMITS2.text);
36557
+ const source2 = obj.source === void 0 ? "" : str3(obj.source, LIMITS3.text);
36558
+ const desc = obj.desc === void 0 ? "" : str3(obj.desc, LIMITS3.text);
36390
36559
  if (!model || !id || !kind2 || !result || source2 === null || desc === null) return null;
36391
36560
  const p = { model, id, kind: kind2, source: source2, desc, result };
36392
36561
  if (obj.bound !== void 0) {
@@ -36400,24 +36569,24 @@ function parseProperty(obj) {
36400
36569
  p.states = n2;
36401
36570
  }
36402
36571
  if (obj.trace !== void 0) {
36403
- const t = strArr(obj.trace, LIMITS2.traceItems, LIMITS2.traceItem);
36404
- if (!t) return null;
36405
- p.trace = t;
36572
+ const t2 = strArr(obj.trace, LIMITS3.traceItems, LIMITS3.traceItem);
36573
+ if (!t2) return null;
36574
+ p.trace = t2;
36406
36575
  }
36407
36576
  if (obj.states_along !== void 0) {
36408
- const s = strArr(obj.states_along, LIMITS2.traceItems, LIMITS2.state);
36577
+ const s = strArr(obj.states_along, LIMITS3.traceItems, LIMITS3.state);
36409
36578
  if (!s) return null;
36410
36579
  p.states_along = s;
36411
36580
  }
36412
36581
  if (obj.final !== void 0) {
36413
- const f = str3(obj.final, LIMITS2.state);
36582
+ const f = str3(obj.final, LIMITS3.state);
36414
36583
  if (f === null) return null;
36415
36584
  p.final = f;
36416
36585
  }
36417
36586
  if (obj.theorem !== void 0) {
36418
- const t = str3(obj.theorem, LIMITS2.symbol);
36419
- if (t === null) return null;
36420
- p.theorem = t;
36587
+ const t2 = str3(obj.theorem, LIMITS3.symbol);
36588
+ if (t2 === null) return null;
36589
+ p.theorem = t2;
36421
36590
  }
36422
36591
  return p;
36423
36592
  }
@@ -36696,8 +36865,8 @@ function listModelFiles(root) {
36696
36865
  if (!(0, import_node_fs61.existsSync)(modelsAbs)) return [];
36697
36866
  return (0, import_node_fs61.readdirSync)(modelsAbs).filter((f) => isModelInRoot(modelsAbs, f)).sort().map((f) => (0, import_node_path49.join)(modelsAbs, f));
36698
36867
  }
36699
- function trimDiagnostics(text2) {
36700
- return text2.split("\n").filter((l) => !l.startsWith("trace:")).join("\n").trim().slice(0, 4e3);
36868
+ function trimDiagnostics(text3) {
36869
+ return text3.split("\n").filter((l) => !l.startsWith("trace:")).join("\n").trim().slice(0, 4e3);
36701
36870
  }
36702
36871
  function checkModel(tc, root, modelFile, opts = {}) {
36703
36872
  const proofsAbs = (0, import_node_path49.join)(root, PROOFS_DIR);
@@ -37709,9 +37878,9 @@ var HAS_FAILURE = /fail|error|throw|time[sd]?[\s_-]*out|reject|exception|unavail
37709
37878
  var HAS_CRASH = /crash|die|kill|abort|restart/i;
37710
37879
  function missingTrigger(desc, trace) {
37711
37880
  const d = desc.toLowerCase();
37712
- const t = trace.join(" ");
37713
- if (NEEDS_CRASH.test(d) && !HAS_CRASH.test(t)) return "a crash";
37714
- if (NEEDS_FAILURE.test(d) && !HAS_FAILURE.test(t)) return "a failure";
37881
+ const t2 = trace.join(" ");
37882
+ if (NEEDS_CRASH.test(d) && !HAS_CRASH.test(t2)) return "a crash";
37883
+ if (NEEDS_FAILURE.test(d) && !HAS_FAILURE.test(t2)) return "a failure";
37715
37884
  return null;
37716
37885
  }
37717
37886
  function ungroundedMessage(list2) {
@@ -37911,13 +38080,13 @@ var lunaRanker = {
37911
38080
  signal: controller.signal
37912
38081
  });
37913
38082
  if (!res.ok) {
37914
- const text3 = await res.text().catch(() => "");
37915
- return { ok: false, ranker: "luna", error: `OpenAI ${res.status}: ${text3.slice(0, 200)}`, ranked: fallback };
38083
+ const text4 = await res.text().catch(() => "");
38084
+ return { ok: false, ranker: "luna", error: `OpenAI ${res.status}: ${text4.slice(0, 200)}`, ranked: fallback };
37916
38085
  }
37917
38086
  const data = await res.json();
37918
- const text2 = (data.output ?? []).flatMap((o) => o.content ?? []).find((c) => c.type === "output_text")?.text;
37919
- if (!text2) return { ok: false, ranker: "luna", error: "no output_text in response", ranked: fallback };
37920
- const parsed = JSON.parse(text2);
38087
+ const text3 = (data.output ?? []).flatMap((o) => o.content ?? []).find((c) => c.type === "output_text")?.text;
38088
+ if (!text3) return { ok: false, ranker: "luna", error: "no output_text in response", ranked: fallback };
38089
+ const parsed = JSON.parse(text3);
37921
38090
  const items = parsed.items.map((i2) => {
37922
38091
  const legacy = i2.critical === void 0 && i2.hazard === void 0 && i2.error_prone === void 0;
37923
38092
  const criteria = legacy ? { critical: Number(i2.score) || 0, hazard: Number(i2.score) || 0, error_prone: Number(i2.score) || 0 } : { critical: Number(i2.critical) || 0, hazard: Number(i2.hazard) || 0, error_prone: Number(i2.error_prone) || 0 };
@@ -38235,42 +38404,42 @@ function lintModelSource(source2) {
38235
38404
  let sawCheck = false;
38236
38405
  for (const raw of code.split("\n")) {
38237
38406
  const line2 = raw.trimEnd();
38238
- const t = line2.trim();
38239
- if (t === "") continue;
38240
- if (/^import\b/.test(t)) {
38241
- if (t !== "import Verity") reasons.push(`only \`import Verity\` is allowed (got \`${t.slice(0, 40)}\`)`);
38407
+ const t2 = line2.trim();
38408
+ if (t2 === "") continue;
38409
+ if (/^import\b/.test(t2)) {
38410
+ if (t2 !== "import Verity") reasons.push(`only \`import Verity\` is allowed (got \`${t2.slice(0, 40)}\`)`);
38242
38411
  sawImport = true;
38243
38412
  continue;
38244
38413
  }
38245
- if (/^open\b/.test(t)) {
38246
- if (t !== "open Verity") reasons.push(`only \`open Verity\` is allowed (got \`${t.slice(0, 40)}\`)`);
38414
+ if (/^open\b/.test(t2)) {
38415
+ if (t2 !== "open Verity") reasons.push(`only \`open Verity\` is allowed (got \`${t2.slice(0, 40)}\`)`);
38247
38416
  continue;
38248
38417
  }
38249
- if (/^namespace\b/.test(t)) {
38250
- if (!/^namespace Models\.[A-Za-z][A-Za-z0-9_]*$/.test(t)) reasons.push(`namespace must be \`Models.<Name>\` (got \`${t.slice(0, 40)}\`)`);
38418
+ if (/^namespace\b/.test(t2)) {
38419
+ if (!/^namespace Models\.[A-Za-z][A-Za-z0-9_]*$/.test(t2)) reasons.push(`namespace must be \`Models.<Name>\` (got \`${t2.slice(0, 40)}\`)`);
38251
38420
  continue;
38252
38421
  }
38253
- if (/^end\b/.test(t)) {
38254
- if (!/^end( Models\.[A-Za-z][A-Za-z0-9_]*)?$/.test(t)) reasons.push(`unexpected \`${t.slice(0, 40)}\``);
38422
+ if (/^end\b/.test(t2)) {
38423
+ if (!/^end( Models\.[A-Za-z][A-Za-z0-9_]*)?$/.test(t2)) reasons.push(`unexpected \`${t2.slice(0, 40)}\``);
38255
38424
  continue;
38256
38425
  }
38257
- if (/^section\b|^mutual\b/.test(t)) {
38258
- reasons.push(`\`${t.split(/\s/)[0]}\` is not allowed in a model`);
38426
+ if (/^section\b|^mutual\b/.test(t2)) {
38427
+ reasons.push(`\`${t2.split(/\s/)[0]}\` is not allowed in a model`);
38259
38428
  continue;
38260
38429
  }
38261
- const hashes = [...t.matchAll(/#/g)];
38430
+ const hashes = [...t2.matchAll(/#/g)];
38262
38431
  for (const h of hashes) {
38263
38432
  const at = h.index ?? 0;
38264
- if (t[at + 1] === "[") continue;
38265
- if (at === 0 && /^#eval\s+Verity\.(model|check|checkData|proved)\b/.test(t)) {
38266
- if (EFFECT_OPERATORS.test(t.slice(5))) reasons.push(`effect operator on an #eval line: \`${t.slice(0, 60)}\``);
38267
- if (/#eval\s+Verity\.model\b/.test(t)) sawModelHeader = true;
38433
+ if (t2[at + 1] === "[") continue;
38434
+ if (at === 0 && /^#eval\s+Verity\.(model|check|checkData|proved)\b/.test(t2)) {
38435
+ if (EFFECT_OPERATORS.test(t2.slice(5))) reasons.push(`effect operator on an #eval line: \`${t2.slice(0, 60)}\``);
38436
+ if (/#eval\s+Verity\.model\b/.test(t2)) sawModelHeader = true;
38268
38437
  else sawCheck = true;
38269
38438
  continue;
38270
38439
  }
38271
- reasons.push(`command not allowed: \`${t.slice(Math.max(0, at - 5), at + 40)}\` (only \`#eval Verity.model|check|checkData|proved\` at line start)`);
38440
+ reasons.push(`command not allowed: \`${t2.slice(Math.max(0, at - 5), at + 40)}\` (only \`#eval Verity.model|check|checkData|proved\` at line start)`);
38272
38441
  }
38273
- if (/^\s/.test(raw) && EFFECT_OPERATORS.test(t) && /\bVerity\./.test(t)) reasons.push(`effect operator near a Verity call: \`${t.slice(0, 60)}\``);
38442
+ if (/^\s/.test(raw) && EFFECT_OPERATORS.test(t2) && /\bVerity\./.test(t2)) reasons.push(`effect operator near a Verity call: \`${t2.slice(0, 60)}\``);
38274
38443
  }
38275
38444
  if (!sawImport) reasons.push("missing `import Verity`");
38276
38445
  if (!sawModelHeader) reasons.push("no `#eval Verity.model` header");
@@ -38288,11 +38457,11 @@ function joinBrokenLiterals(source2) {
38288
38457
  let i2 = 0;
38289
38458
  while (i2 < raw.length) {
38290
38459
  let r = raw[i2];
38291
- let t = tok[i2];
38460
+ let t2 = tok[i2];
38292
38461
  i2++;
38293
38462
  for (; ; ) {
38294
- const d = depth + braceDelta(t);
38295
- const end = t.trimEnd();
38463
+ const d = depth + braceDelta(t2);
38464
+ const end = t2.trimEnd();
38296
38465
  if (!(d > 0 && end.endsWith(",") && i2 < raw.length)) break;
38297
38466
  while (i2 < raw.length && tok[i2].trim() === "") i2++;
38298
38467
  if (i2 >= raw.length) break;
@@ -38301,10 +38470,10 @@ function joinBrokenLiterals(source2) {
38301
38470
  const nextTok = tok[i2];
38302
38471
  const lead = nextTok.length - nextTok.trimStart().length;
38303
38472
  r = r.slice(0, cut) + " " + nextRaw.slice(lead);
38304
- t = t.slice(0, cut) + " " + nextTok.slice(lead);
38473
+ t2 = t2.slice(0, cut) + " " + nextTok.slice(lead);
38305
38474
  i2++;
38306
38475
  }
38307
- depth = Math.max(0, depth + braceDelta(t));
38476
+ depth = Math.max(0, depth + braceDelta(t2));
38308
38477
  outRaw.push(r);
38309
38478
  }
38310
38479
  return outRaw.join("\n");
@@ -38576,19 +38745,19 @@ var PURE_METHODS2 = /* @__PURE__ */ new Set([
38576
38745
  "test",
38577
38746
  "match"
38578
38747
  ]);
38579
- function callsOn(text2, name2) {
38748
+ function callsOn(text3, name2) {
38580
38749
  const needle = `${name2}.`;
38581
- for (let i2 = text2.indexOf(needle); i2 >= 0; i2 = text2.indexOf(needle, i2 + 1)) {
38582
- if (i2 > 0 && IDENT_CHAR2.test(text2[i2 - 1])) continue;
38583
- const call = CALL_AFTER_DOT.exec(text2.slice(i2 + needle.length));
38750
+ for (let i2 = text3.indexOf(needle); i2 >= 0; i2 = text3.indexOf(needle, i2 + 1)) {
38751
+ if (i2 > 0 && IDENT_CHAR2.test(text3[i2 - 1])) continue;
38752
+ const call = CALL_AFTER_DOT.exec(text3.slice(i2 + needle.length));
38584
38753
  if (call && !PURE_METHODS2.has(call[1])) return true;
38585
38754
  }
38586
38755
  return false;
38587
38756
  }
38588
- function callsDirect(text2, name2) {
38757
+ function callsDirect(text3, name2) {
38589
38758
  const needle = `${name2}(`;
38590
- for (let i2 = text2.indexOf(needle); i2 >= 0; i2 = text2.indexOf(needle, i2 + 1)) {
38591
- if (i2 > 0 && IDENT_CHAR2.test(text2[i2 - 1])) continue;
38759
+ for (let i2 = text3.indexOf(needle); i2 >= 0; i2 = text3.indexOf(needle, i2 + 1)) {
38760
+ if (i2 > 0 && IDENT_CHAR2.test(text3[i2 - 1])) continue;
38592
38761
  return true;
38593
38762
  }
38594
38763
  return false;
@@ -38610,12 +38779,12 @@ function effectSites(numbered2) {
38610
38779
  const out2 = [];
38611
38780
  for (const [i2, r] of rows.entries()) {
38612
38781
  if (i2 === 0) continue;
38613
- const t = r.text.trim();
38614
- if (!t || t.startsWith("//") || t.startsWith("#") || t.startsWith("*")) continue;
38615
- const onParam = [...params].some((p) => callsOn(t, p) || callsDirect(t, p));
38616
- const kind2 = EFFECT_LINE2.test(t) || onParam ? "effect" : CONTROL_LINE.test(t) ? "control" : null;
38782
+ const t2 = r.text.trim();
38783
+ if (!t2 || t2.startsWith("//") || t2.startsWith("#") || t2.startsWith("*")) continue;
38784
+ const onParam = [...params].some((p) => callsOn(t2, p) || callsDirect(t2, p));
38785
+ const kind2 = EFFECT_LINE2.test(t2) || onParam ? "effect" : CONTROL_LINE.test(t2) ? "control" : null;
38617
38786
  if (!kind2) continue;
38618
- out2.push(`L${r.n} [${kind2}] ${t.length > 160 ? t.slice(0, 157) + "\u2026" : t}`);
38787
+ out2.push(`L${r.n} [${kind2}] ${t2.length > 160 ? t2.slice(0, 157) + "\u2026" : t2}`);
38619
38788
  if (out2.length >= MAX_EFFECT_SITES) break;
38620
38789
  }
38621
38790
  return out2;
@@ -38624,7 +38793,7 @@ function starChanged(numbered2, changed) {
38624
38793
  const isChanged = (n2) => !!changed?.some((r) => n2 >= r.from && n2 <= r.to);
38625
38794
  const starred = [];
38626
38795
  let total = 0;
38627
- const text2 = numbered2.split("\n").map((raw) => {
38796
+ const text3 = numbered2.split("\n").map((raw) => {
38628
38797
  const m = NUMBERED_LINE.exec(raw);
38629
38798
  if (!m) return raw;
38630
38799
  total++;
@@ -38640,43 +38809,43 @@ function starChanged(numbered2, changed) {
38640
38809
  runs.push(i2 === j ? `${starred[i2]}` : `${starred[i2]}\u2013${starred[j]}`);
38641
38810
  i2 = j;
38642
38811
  }
38643
- return { text: text2, ranges: runs.join(", "), count: starred.length, total };
38812
+ return { text: text3, ranges: runs.join(", "), count: starred.length, total };
38644
38813
  }
38645
- function renderGenerateInput(t, previous) {
38814
+ function renderGenerateInput(t2, previous) {
38646
38815
  const parts2 = [];
38647
- parts2.push(`# Target: ${t.file} \u2014 \`${t.symbol}\`${t.lines ? ` (lines ${t.lines.from}\u2013${t.lines.to})` : ""}`);
38648
- parts2.push(`Header values: file := "${t.file}", symbol := "${t.symbol}", sha256 := "${t.sha256}", lines := "${t.lines ? `${t.lines.from}-${t.lines.to}` : ""}"`);
38649
- if (t.reasons.length) parts2.push(`Why it was selected: ${t.reasons.join(" \xB7 ")}`);
38650
- if (t.properties.length) parts2.push(`Suggested properties: ${t.properties.join(", ")}`);
38651
- if (t.lens === "security") parts2.push("SECURITY: an attacker outside the trust boundary can drive this code. Follow AN ATTACKER.");
38652
- if (t.hypotheses?.length) parts2.push(`Hypotheses from the selector (questions to try, not verdicts):
38653
- ${t.hypotheses.slice(0, MAX_HYPOTHESES2).map((h) => ` - ${h}`).join("\n")}`);
38654
- const numbered2 = t.numbered.slice(0, MAX_NUMBERED_BYTES);
38816
+ parts2.push(`# Target: ${t2.file} \u2014 \`${t2.symbol}\`${t2.lines ? ` (lines ${t2.lines.from}\u2013${t2.lines.to})` : ""}`);
38817
+ parts2.push(`Header values: file := "${t2.file}", symbol := "${t2.symbol}", sha256 := "${t2.sha256}", lines := "${t2.lines ? `${t2.lines.from}-${t2.lines.to}` : ""}"`);
38818
+ if (t2.reasons.length) parts2.push(`Why it was selected: ${t2.reasons.join(" \xB7 ")}`);
38819
+ if (t2.properties.length) parts2.push(`Suggested properties: ${t2.properties.join(", ")}`);
38820
+ if (t2.lens === "security") parts2.push("SECURITY: an attacker outside the trust boundary can drive this code. Follow AN ATTACKER.");
38821
+ if (t2.hypotheses?.length) parts2.push(`Hypotheses from the selector (questions to try, not verdicts):
38822
+ ${t2.hypotheses.slice(0, MAX_HYPOTHESES2).map((h) => ` - ${h}`).join("\n")}`);
38823
+ const numbered2 = t2.numbered.slice(0, MAX_NUMBERED_BYTES);
38655
38824
  const sites = effectSites(numbered2);
38656
- const push = starChanged(numbered2, t.changed);
38825
+ const push = starChanged(numbered2, t2.changed);
38657
38826
  if (push.count > 0) parts2.push(`A push: it changed ${push.count} of these ${push.total} lines (${push.ranges}), marked \`*|\` below. Look first for a bug the change introduced.`);
38658
38827
  parts2.push("", sites.length ? `Effect sites (STEP 1 \u2014 where the real world can interleave, fail or crash):
38659
38828
  ${sites.map((s) => ` ${s}`).join("\n")}` : "Effect sites: none \u2014 a pure computation (STEP 3: Verity.checkData on concrete inputs).");
38660
38829
  parts2.push("", "```", push.count > 0 ? push.text : numbered2, "```");
38661
- if (t.effects?.length) {
38830
+ if (t2.effects?.length) {
38662
38831
  parts2.push("", `State this function touches (from the parser; "via" names the helper that does it):
38663
- ${t.effects.slice(0, MAX_CONTEXT_EFFECTS).map((e) => ` ${e}`).join("\n")}`);
38832
+ ${t2.effects.slice(0, MAX_CONTEXT_EFFECTS).map((e) => ` ${e}`).join("\n")}`);
38664
38833
  }
38665
- if (t.coAccessors?.length) {
38834
+ if (t2.coAccessors?.length) {
38666
38835
  parts2.push("", "# Other functions that touch the same state (STEP 2 \u2014 the second actor)");
38667
- for (const c of t.coAccessors.slice(0, MAX_CO_ACCESSORS)) {
38836
+ for (const c of t2.coAccessors.slice(0, MAX_CO_ACCESSORS)) {
38668
38837
  parts2.push("", `## ${c.file} \u2014 \`${c.symbol}\` (lines ${c.lines.from}\u2013${c.lines.to})`, `Header values: file := "${c.file}", symbol := "${c.symbol}", sha256 := "${c.sha256}", lines := "${c.lines.from}-${c.lines.to}"`);
38669
38838
  if (c.touches.length) parts2.push(`It touches: ${c.touches.slice(0, MAX_CONTEXT_EFFECTS).join(" \xB7 ")}`);
38670
38839
  parts2.push("```", c.numbered, "```");
38671
38840
  }
38672
38841
  }
38673
- if (t.helpers?.length) {
38842
+ if (t2.helpers?.length) {
38674
38843
  parts2.push("", "# Helpers it calls (their effects happen at the line that calls them)");
38675
- for (const h of t.helpers.slice(0, MAX_HELPERS2)) parts2.push("", `## ${h.file} \u2014 \`${h.symbol}\` (lines ${h.lines.from}\u2013${h.lines.to})`, "```", h.numbered, "```");
38844
+ for (const h of t2.helpers.slice(0, MAX_HELPERS2)) parts2.push("", `## ${h.file} \u2014 \`${h.symbol}\` (lines ${h.lines.from}\u2013${h.lines.to})`, "```", h.numbered, "```");
38676
38845
  }
38677
- if (t.callers?.length) {
38846
+ if (t2.callers?.length) {
38678
38847
  parts2.push("", "# Where it is called (a caller's guard bounds the inputs it can get)");
38679
- for (const c of t.callers.slice(0, MAX_CALLERS2)) parts2.push("", `## ${c.file}:${c.line}${c.caller ? ` \u2014 in \`${c.caller}\`` : ""}`, "```", c.numbered, "```");
38848
+ for (const c of t2.callers.slice(0, MAX_CALLERS2)) parts2.push("", `## ${c.file}:${c.line}${c.caller ? ` \u2014 in \`${c.caller}\`` : ""}`, "```", c.numbered, "```");
38680
38849
  }
38681
38850
  if (previous) {
38682
38851
  parts2.push("", "# Your previous attempt was not accepted \u2014 the diagnostics say why. Fix it (same model, same properties):", "```lean", previous.source.slice(0, 32 * 1024), "```", "Diagnostics:", "```", previous.error.slice(0, 4e3), "```");
@@ -38771,11 +38940,11 @@ async function generateModel(target, opts) {
38771
38940
  return { ok: false, error: name2 === "TimeoutError" || name2 === "AbortError" ? "timed out" : err2.message };
38772
38941
  }
38773
38942
  const usage = data.usage ? { inputTokens: Number(data.usage.input_tokens ?? 0), outputTokens: Number(data.usage.output_tokens ?? 0) } : null;
38774
- const text2 = (data.output ?? []).flatMap((o) => o.content ?? []).find((c) => c.type === "output_text")?.text;
38775
- if (!text2) return { ok: false, error: "no output_text in response", usage };
38943
+ const text3 = (data.output ?? []).flatMap((o) => o.content ?? []).find((c) => c.type === "output_text")?.text;
38944
+ if (!text3) return { ok: false, error: "no output_text in response", usage };
38776
38945
  let parsed;
38777
38946
  try {
38778
- parsed = JSON.parse(text2);
38947
+ parsed = JSON.parse(text3);
38779
38948
  } catch {
38780
38949
  return { ok: false, error: "answer was not JSON", usage };
38781
38950
  }
@@ -38785,8 +38954,8 @@ async function generateModel(target, opts) {
38785
38954
  // src/lib/prove/replay.ts
38786
38955
  var MAX_SOURCE_BYTES = 96 * 1024;
38787
38956
  var MAX_MODEL_BYTES = 32 * 1024;
38788
- function numberLines(text2, from = 1) {
38789
- return text2.split("\n").map((l, i2) => `${String(i2 + from).padStart(5)}| ${l}`).join("\n");
38957
+ function numberLines(text3, from = 1) {
38958
+ return text3.split("\n").map((l, i2) => `${String(i2 + from).padStart(5)}| ${l}`).join("\n");
38790
38959
  }
38791
38960
  var PY_DECL = /^\s*(?:async\s+)?def\s+([A-Za-z_]\w*)\s*\(/;
38792
38961
  var TS_DECLS = [
@@ -38803,8 +38972,8 @@ function copiedLines(brief) {
38803
38972
  const out2 = /* @__PURE__ */ new Set();
38804
38973
  for (const src of brief.sources) {
38805
38974
  for (const l of (src.content ?? "").split("\n")) {
38806
- const t = l.trim();
38807
- if (t) out2.add(t);
38975
+ const t2 = l.trim();
38976
+ if (t2) out2.add(t2);
38808
38977
  }
38809
38978
  }
38810
38979
  return out2;
@@ -38812,8 +38981,8 @@ function copiedLines(brief) {
38812
38981
  function harnessInvokes(texts, symbol, py, copied = /* @__PURE__ */ new Set()) {
38813
38982
  if (!/^[A-Za-z_$][\w$]*$/.test(symbol)) return null;
38814
38983
  let declared = false;
38815
- for (const t of texts) {
38816
- for (const line2 of t.split("\n")) {
38984
+ for (const t2 of texts) {
38985
+ for (const line2 of t2.split("\n")) {
38817
38986
  if (declaresSymbol(line2, symbol, py)) {
38818
38987
  declared = true;
38819
38988
  continue;
@@ -38860,9 +39029,9 @@ function extractSymbolBody(source2, symbol, file, range) {
38860
39029
  }
38861
39030
  return null;
38862
39031
  }
38863
- function significantLines(text2) {
39032
+ function significantLines(text3) {
38864
39033
  const out2 = [];
38865
- for (const raw of text2.split("\n")) {
39034
+ for (const raw of text3.split("\n")) {
38866
39035
  const l = raw.trim();
38867
39036
  if (l.length < 12) continue;
38868
39037
  if (/^(\/\/|\/\*|\*|#)/.test(l)) continue;
@@ -38875,7 +39044,7 @@ function verbatimCoverage(symbolBody, texts) {
38875
39044
  const wanted = significantLines(symbolBody);
38876
39045
  if (wanted.length === 0) return { covered: 0, total: 0, ratio: 0 };
38877
39046
  const have = /* @__PURE__ */ new Set();
38878
- for (const t of texts) for (const l of t.split("\n")) have.add(l.trim());
39047
+ for (const t2 of texts) for (const l of t2.split("\n")) have.add(l.trim());
38879
39048
  const covered = wanted.filter((l) => have.has(l)).length;
38880
39049
  return { covered, total: wanted.length, ratio: covered / wanted.length };
38881
39050
  }
@@ -38887,14 +39056,14 @@ function isTrackedInRoot(root, file) {
38887
39056
  function buildReplayBrief(root, report, property, modelSource, readSource) {
38888
39057
  const sources = (report.header?.abstracts ?? []).map((a) => {
38889
39058
  const read2 = readSource ? readSource(a.file, MAX_SOURCE_BYTES) : isTrackedInRoot(root, a.file) ? readRegularFileInRoot(root, a.file, MAX_SOURCE_BYTES) : { ok: false, reason: "not tracked by git \u2014 models may only abstract tracked source" };
38890
- const text2 = read2.ok ? read2.content : "";
39059
+ const text3 = read2.ok ? read2.content : "";
38891
39060
  return {
38892
39061
  file: a.file,
38893
39062
  symbol: a.symbol,
38894
- numbered: text2 ? numberLines(text2) : `(could not read ${a.file}: ${read2.ok ? "" : read2.reason})`,
38895
- symbolBody: text2 ? extractSymbolBody(text2, a.symbol, a.file, a.lines) : null,
39063
+ numbered: text3 ? numberLines(text3) : `(could not read ${a.file}: ${read2.ok ? "" : read2.reason})`,
39064
+ symbolBody: text3 ? extractSymbolBody(text3, a.symbol, a.file, a.lines) : null,
38896
39065
  lines: a.lines,
38897
- content: text2
39066
+ content: text3
38898
39067
  };
38899
39068
  });
38900
39069
  return { model: report.model, property, modelSource: modelSource.slice(0, MAX_MODEL_BYTES), sources };
@@ -38976,7 +39145,7 @@ function parseReplayOutput(output) {
38976
39145
  let executedCalls = 0;
38977
39146
  const shellTexts = [];
38978
39147
  const outputTexts = [];
38979
- let text2 = null;
39148
+ let text3 = null;
38980
39149
  for (const item of output) {
38981
39150
  if (item.type === "shell_call") {
38982
39151
  shellCalls++;
@@ -38991,14 +39160,14 @@ function parseReplayOutput(output) {
38991
39160
  if (typeof o.stderr === "string" && o.stderr) outputTexts.push(o.stderr);
38992
39161
  }
38993
39162
  } else if (item.type === "message" && Array.isArray(item.content)) {
38994
- const t = item.content.find((c) => c.type === "output_text")?.text;
38995
- if (typeof t === "string") text2 = t;
39163
+ const t2 = item.content.find((c) => c.type === "output_text")?.text;
39164
+ if (typeof t2 === "string") text3 = t2;
38996
39165
  }
38997
39166
  }
38998
39167
  let claim = null;
38999
- if (text2) {
39168
+ if (text3) {
39000
39169
  try {
39001
- const o = JSON.parse(text2);
39170
+ const o = JSON.parse(text3);
39002
39171
  const verdict = o.verdict;
39003
39172
  if (verdict === "reproduced" || verdict === "diverged" || verdict === "unreplayable") {
39004
39173
  claim = {
@@ -39016,7 +39185,7 @@ function parseReplayOutput(output) {
39016
39185
  var RESULT_LINE = /REPLAY_RESULT=(reproduced|diverged)\b/g;
39017
39186
  function printedResult(outputTexts) {
39018
39187
  let last = null;
39019
- for (const t of outputTexts) for (const m of t.matchAll(RESULT_LINE)) last = m[1];
39188
+ for (const t2 of outputTexts) for (const m of t2.matchAll(RESULT_LINE)) last = m[1];
39020
39189
  return last;
39021
39190
  }
39022
39191
  var RESULT_MISSING = "the harness never printed REPLAY_RESULT=reproduced on its own stdout \u2014 the verdict was the model's word, not the run's";
@@ -39057,7 +39226,7 @@ function judgeReplay(brief, parsed) {
39057
39226
  return { claimed, verdict: "unverified", reason: parsed.claim.reason, downgrade: RESULT_MISSING, verbatim };
39058
39227
  }
39059
39228
  const copied = copiedLines(brief);
39060
- if (claimed === "reproduced" && !texts.some((t) => t.split("\n").some((l) => !copied.has(l.trim()) && l.includes("diverged")))) {
39229
+ if (claimed === "reproduced" && !texts.some((t2) => t2.split("\n").some((l) => !copied.has(l.trim()) && l.includes("diverged")))) {
39061
39230
  return { claimed, verdict: "unverified", reason: parsed.claim.reason, downgrade: FIXED_VERDICT, verbatim };
39062
39231
  }
39063
39232
  if (claimed === "reproduced" && primary && harnessInvokes(texts, primary.symbol, /\.py$/.test(primary.file), copied) === false) {
@@ -39418,10 +39587,10 @@ function semanticFingerprint(numbered2) {
39418
39587
  const kept = [];
39419
39588
  for (const raw of numbered2.split("\n")) {
39420
39589
  const line2 = raw.replace(/^\s*\d+\| ?/, "");
39421
- const t = line2.trim();
39422
- if (!t || t.startsWith("//") || t.startsWith("#") || t.startsWith("*") || t.startsWith("/*")) continue;
39423
- if (LOG_LINE.test(t)) continue;
39424
- kept.push(t.replace(/\s+/g, " "));
39590
+ const t2 = line2.trim();
39591
+ if (!t2 || t2.startsWith("//") || t2.startsWith("#") || t2.startsWith("*") || t2.startsWith("/*")) continue;
39592
+ if (LOG_LINE.test(t2)) continue;
39593
+ kept.push(t2.replace(/\s+/g, " "));
39425
39594
  }
39426
39595
  return (0, import_node_crypto19.createHash)("sha256").update(kept.join("\n")).digest("hex");
39427
39596
  }
@@ -40311,7 +40480,7 @@ var MAX_TURNS2 = 14;
40311
40480
  var VERDICTS = ["REAL", "REAL-LOW", "PREVENTED", "ARTIFACT", "UNSURE"];
40312
40481
  var verdictOf = (v) => typeof v === "string" && VERDICTS.includes(v) ? v : null;
40313
40482
  var introducedOf = (v) => v === "yes" || v === "no" ? v : "unknown";
40314
- var text = (v, n2) => typeof v === "string" ? v.slice(0, n2) : "";
40483
+ var text2 = (v, n2) => typeof v === "string" ? v.slice(0, n2) : "";
40315
40484
  function verifyPost(auth3) {
40316
40485
  return async (body2, timeoutMs) => {
40317
40486
  const res = await apiRequest({
@@ -40367,8 +40536,8 @@ async function verifyFinding(input, opts) {
40367
40536
  const res = await opts.post({ ...body2, remaining_ms: remaining() }, Math.max(1, remaining()));
40368
40537
  if (!res.ok) return end("failed", { error: res.error.slice(0, 200) });
40369
40538
  const d = res.data;
40370
- if (d.enabled === false) return end("disabled", { error: text(d.reason, 60) });
40371
- if (d.error && typeof d.error === "object") return end("failed", { error: text(d.error.code, 60) || "SERVICE_ERROR" });
40539
+ if (d.enabled === false) return end("disabled", { error: text2(d.reason, 60) });
40540
+ if (d.error && typeof d.error === "object") return end("failed", { error: text2(d.error.code, 60) || "SERVICE_ERROR" });
40372
40541
  rounds = typeof d.round === "number" && Number.isInteger(d.round) && d.round >= 0 ? d.round : rounds + 1;
40373
40542
  if (typeof d.cost_usd === "number") {
40374
40543
  if (!Number.isFinite(d.cost_usd) || d.cost_usd < 0) return end("failed", { error: "invalid cost" });
@@ -40376,17 +40545,17 @@ async function verifyFinding(input, opts) {
40376
40545
  } else unpriced++;
40377
40546
  if (d.done) {
40378
40547
  const a = d.answer;
40379
- if (!a) return end("failed", { error: text(d.error, 60) || "no verdict" });
40548
+ if (!a) return end("failed", { error: text2(d.error, 60) || "no verdict" });
40380
40549
  const verdict = verdictOf(a.verdict);
40381
40550
  if (!verdict) return end("failed", { error: "unknown verdict" });
40382
40551
  return end("answered", {
40383
40552
  verdict,
40384
40553
  claimed: verdictOf(a.claimed),
40385
40554
  introduced: introducedOf(a.introduced),
40386
- trigger: text(a.trigger, 400),
40555
+ trigger: text2(a.trigger, 400),
40387
40556
  preventedBy: typeof a.prevented_by === "string" ? a.prevented_by.slice(0, 600) : null,
40388
- effect: text(a.effect, 600),
40389
- reason: text(a.reason, 2e3),
40557
+ effect: text2(a.effect, 600),
40558
+ reason: text2(a.reason, 2e3),
40390
40559
  quotes: (Array.isArray(a.quotes) ? a.quotes : []).slice(0, 12).flatMap((q) => {
40391
40560
  const o = q ?? {};
40392
40561
  return typeof o.path === "string" && typeof o.text === "string" ? [{ path: o.path.slice(0, 400), text: o.text.slice(0, 600), witnessed: o.witnessed === true }] : [];
@@ -40668,17 +40837,17 @@ function parsePrIntent(command) {
40668
40837
  }
40669
40838
  var TRIVIAL_INTENT = /^(wip|tmp|temp|test|fix|chore|amend|\.+|fixup!.*|squash!.*|merge\b.*)$/i;
40670
40839
  var SHELL_PLUMBING = /\$\(|`|<<-?\s*['"]?[A-Za-z_]/;
40671
- function isSubstantiveIntent(text2) {
40672
- if (!text2) return false;
40673
- const t = text2.trim();
40674
- if (t.length < 12) return false;
40675
- if (TRIVIAL_INTENT.test(t)) return false;
40676
- if (SHELL_PLUMBING.test(t)) return false;
40840
+ function isSubstantiveIntent(text3) {
40841
+ if (!text3) return false;
40842
+ const t2 = text3.trim();
40843
+ if (t2.length < 12) return false;
40844
+ if (TRIVIAL_INTENT.test(t2)) return false;
40845
+ if (SHELL_PLUMBING.test(t2)) return false;
40677
40846
  return true;
40678
40847
  }
40679
40848
  function extractStatedIntent(moment, command, pushedMessages = null) {
40680
- const text2 = moment === "pre-commit" ? parseCommitMessage(command) : parsePrIntent(command) ?? pushedMessages;
40681
- return isSubstantiveIntent(text2) ? text2 : null;
40849
+ const text3 = moment === "pre-commit" ? parseCommitMessage(command) : parsePrIntent(command) ?? pushedMessages;
40850
+ return isSubstantiveIntent(text3) ? text3 : null;
40682
40851
  }
40683
40852
  function hasBlockingFinding(response, sentFiles) {
40684
40853
  return ofThisChange(response, sentFiles).some((f) => SERIOUS.has(String(f.severity ?? "").toLowerCase()));
@@ -41101,7 +41270,7 @@ async function runGuard(opts, globals) {
41101
41270
  properties: formalOutcome.properties?.map((p) => `${p.id}:${p.result}`) ?? [],
41102
41271
  findings: formalOutcome.findings.map((f) => `${f.property}:${f.verdict}`),
41103
41272
  // Review effort "max" models more than one function: each one, and why the search stopped early.
41104
- targets: (formalOutcome.targets ?? []).map((t) => `${t.file}#${t.symbol}:${t.status}${t.skip ? `(${t.skip})` : ""}`),
41273
+ targets: (formalOutcome.targets ?? []).map((t2) => `${t2.file}#${t2.symbol}:${t2.status}${t2.skip ? `(${t2.skip})` : ""}`),
41105
41274
  stopped_at: formalOutcome.stoppedAt?.skip ?? null,
41106
41275
  // Decision 81: what each property rests on (a rule, or "line"), what was
41107
41276
  // sent back or dropped as ungrounded, and which counterexamples lack their
@@ -41604,10 +41773,10 @@ var utcDay2 = (d) => d.toISOString().slice(0, 10);
41604
41773
  var DAY_MS2 = 864e5;
41605
41774
  function plausibleDay(day, now) {
41606
41775
  if (!DAY.test(day)) return false;
41607
- const t = Date.parse(`${day}T00:00:00Z`);
41608
- if (Number.isNaN(t) || new Date(t).toISOString().slice(0, 10) !== day) return false;
41776
+ const t2 = Date.parse(`${day}T00:00:00Z`);
41777
+ if (Number.isNaN(t2) || new Date(t2).toISOString().slice(0, 10) !== day) return false;
41609
41778
  const today2 = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());
41610
- return t >= today2 - MAX_RUN_AGE_DAYS * DAY_MS2 && t <= today2 + DAY_MS2;
41779
+ return t2 >= today2 - MAX_RUN_AGE_DAYS * DAY_MS2 && t2 <= today2 + DAY_MS2;
41611
41780
  }
41612
41781
  function readPending(now) {
41613
41782
  try {
@@ -41761,21 +41930,21 @@ var PALETTE = {
41761
41930
  glow: [220, 255, 240],
41762
41931
  text: [235, 238, 240]
41763
41932
  };
41764
- function styles(t) {
41765
- const fg = (c, basic) => !t.color ? "" : t.truecolor ? `\x1B[38;2;${c.join(";")}m` : basic;
41933
+ function styles(t2) {
41934
+ const fg = (c, basic) => !t2.color ? "" : t2.truecolor ? `\x1B[38;2;${c.join(";")}m` : basic;
41766
41935
  return {
41767
- reset: t.color ? "\x1B[0m" : "",
41768
- bold: t.color ? "\x1B[1m" : "",
41936
+ reset: t2.color ? "\x1B[0m" : "",
41937
+ bold: t2.color ? "\x1B[1m" : "",
41769
41938
  green: fg(PALETTE.green, "\x1B[32m"),
41770
41939
  teal: fg(PALETTE.teal, "\x1B[36m"),
41771
41940
  gray: fg(PALETTE.gray, "\x1B[90m"),
41772
41941
  faint: fg(PALETTE.faint, "\x1B[90m"),
41773
- yellow: t.color ? "\x1B[33m" : "",
41774
- rgb: (c) => t.truecolor ? `\x1B[38;2;${c.join(";")}m` : ""
41942
+ yellow: t2.color ? "\x1B[33m" : "",
41943
+ rgb: (c) => t2.truecolor ? `\x1B[38;2;${c.join(";")}m` : ""
41775
41944
  };
41776
41945
  }
41777
- var mix = (a, b, t) => [0, 1, 2].map((i2) => Math.round(a[i2] + (b[i2] - a[i2]) * t));
41778
- var ease = (t) => 1 - Math.pow(1 - t, 3);
41946
+ var mix = (a, b, t2) => [0, 1, 2].map((i2) => Math.round(a[i2] + (b[i2] - a[i2]) * t2));
41947
+ var ease = (t2) => 1 - Math.pow(1 - t2, 3);
41779
41948
  var ANSI = /\x1b\[[0-9;?]*[A-Za-z]/g;
41780
41949
  function visibleWidth(s) {
41781
41950
  return [...s.replace(ANSI, "")].length;
@@ -41796,8 +41965,8 @@ function fitLine(s, width) {
41796
41965
  }
41797
41966
  return out2 + "\u2026" + (s.includes("\x1B[") ? "\x1B[0m" : "");
41798
41967
  }
41799
- function wrapText(text2, width, hang = "") {
41800
- const words = text2.split(/\s+/).filter(Boolean);
41968
+ function wrapText(text3, width, hang = "") {
41969
+ const words = text3.split(/\s+/).filter(Boolean);
41801
41970
  if (words.length === 0) return [""];
41802
41971
  const indent = visibleWidth(hang) < width - 1 ? hang : "";
41803
41972
  const lines = [];
@@ -41854,12 +42023,12 @@ var Screen = class {
41854
42023
  this.term = term;
41855
42024
  this.s = styles(term);
41856
42025
  }
41857
- write(text2) {
41858
- this.term.out.write(text2);
42026
+ write(text3) {
42027
+ this.term.out.write(text3);
41859
42028
  }
41860
42029
  /** One frame: one write, inside a synchronized update when motion is on. */
41861
- frame(text2) {
41862
- this.write(this.term.motion ? SYNC_ON + text2 + SYNC_OFF : text2);
42030
+ frame(text3) {
42031
+ this.write(this.term.motion ? SYNC_ON + text3 + SYNC_OFF : text3);
41863
42032
  }
41864
42033
  hideCursor() {
41865
42034
  if (!this.term.screen || this.hidden) return;
@@ -41976,8 +42145,8 @@ var Screen = class {
41976
42145
  this.hideCursor();
41977
42146
  const start2 = Date.now();
41978
42147
  const draw = () => {
41979
- const t = (Math.sin((Date.now() - start2) / 1400 * Math.PI * 2 - Math.PI / 2) + 1) / 2;
41980
- const dot = this.term.truecolor ? `${this.s.rgb(mix(PALETTE.faint, PALETTE.green, t))}\u25CF${this.s.reset}` : `${t > 0.5 ? this.s.green : this.s.faint}\u25CF${this.s.reset}`;
42148
+ const t2 = (Math.sin((Date.now() - start2) / 1400 * Math.PI * 2 - Math.PI / 2) + 1) / 2;
42149
+ const dot = this.term.truecolor ? `${this.s.rgb(mix(PALETTE.faint, PALETTE.green, t2))}\u25CF${this.s.reset}` : `${t2 > 0.5 ? this.s.green : this.s.faint}\u25CF${this.s.reset}`;
41981
42150
  const line2 = `${prefix}${dot} ${label2()} ${this.s.gray}${clock(start2)}${this.s.reset}`;
41982
42151
  this.frame(CLEAR_LINE + fitLine(line2, this.term.columns() - 1));
41983
42152
  };
@@ -42001,9 +42170,9 @@ var Screen = class {
42001
42170
  this.hideCursor();
42002
42171
  const start2 = Date.now();
42003
42172
  for (; ; ) {
42004
- const t = Math.min(1, (Date.now() - start2) / ms);
42005
- this.frame(CLEAR_LINE + fitLine(prefix + render2(targets.map((n2) => Math.round(n2 * ease(t)))), width));
42006
- if (t >= 1) break;
42173
+ const t2 = Math.min(1, (Date.now() - start2) / ms);
42174
+ this.frame(CLEAR_LINE + fitLine(prefix + render2(targets.map((n2) => Math.round(n2 * ease(t2)))), width));
42175
+ if (t2 >= 1) break;
42007
42176
  await sleep2(30);
42008
42177
  }
42009
42178
  this.write("\n");
@@ -42014,17 +42183,17 @@ var sleep2 = (ms) => new Promise((resolve10) => setTimeout(resolve10, ms));
42014
42183
 
42015
42184
  // src/lib/ui/rail-motion.ts
42016
42185
  async function drawLanguages(rail, input) {
42017
- const t = rail.screen.term;
42186
+ const t2 = rail.screen.term;
42018
42187
  const s = rail.screen.s;
42019
42188
  const langs = input.map((l) => ({ name: terminalText(l.name, 40), pct: l.pct }));
42020
- if (!t.screen || langs.length === 0) {
42189
+ if (!t2.screen || langs.length === 0) {
42021
42190
  if (langs.length) rail.line(langs.map((l) => `${l.name} ${l.pct}%`).join(", "));
42022
42191
  return;
42023
42192
  }
42024
- const width = Math.max(10, Math.min(44, t.columns() - 8));
42193
+ const width = Math.max(10, Math.min(44, t2.columns() - 8));
42025
42194
  const tones = [s.green, s.teal, s.gray];
42026
42195
  const bar = (shown) => {
42027
- const track = t.color ? `${s.faint}\u2501` : "\u2500";
42196
+ const track = t2.color ? `${s.faint}\u2501` : "\u2500";
42028
42197
  let out2 = "";
42029
42198
  let cell = 0;
42030
42199
  langs.forEach((l, i2) => {
@@ -42035,7 +42204,7 @@ async function drawLanguages(rail, input) {
42035
42204
  return out2 + s.reset;
42036
42205
  };
42037
42206
  const prefix = `${s.gray}\u2502${s.reset} `;
42038
- if (t.motion) {
42207
+ if (t2.motion) {
42039
42208
  rail.screen.hideCursor();
42040
42209
  const start2 = Date.now();
42041
42210
  for (; ; ) {
@@ -42053,7 +42222,7 @@ async function drawLanguages(rail, input) {
42053
42222
  rail.emitLine(prefix + langs.map((l, i2) => `${tones[Math.min(i2, 2)]}\u25CF${s.reset} ${l.name} ${s.gray}${l.pct}%${s.reset}`).join(" "));
42054
42223
  }
42055
42224
  async function drawRules(rail, input) {
42056
- const t = rail.screen.term;
42225
+ const t2 = rail.screen.term;
42057
42226
  const s = rail.screen.s;
42058
42227
  const w = rail.lineWidth();
42059
42228
  const rules = input.map((r) => ({
@@ -42063,7 +42232,7 @@ async function drawRules(rail, input) {
42063
42232
  basis: terminalText(r.basis, 300)
42064
42233
  }));
42065
42234
  for (const r of rules) {
42066
- if (!t.screen) {
42235
+ if (!t2.screen) {
42067
42236
  rail.emitLine(` - ${r.id}: ${r.description}`);
42068
42237
  rail.emitLine(` Applies: ${r.scope} \xB7 ${r.basis}`);
42069
42238
  continue;
@@ -42075,7 +42244,7 @@ async function drawRules(rail, input) {
42075
42244
  ...desc.map((d) => `${edge} ${c2}${d}${s.reset}`),
42076
42245
  `${edge} ${c3}${r.scope} \xB7 from ${r.basis}${s.reset}`
42077
42246
  ];
42078
- if (!t.motion || !t.truecolor) {
42247
+ if (!t2.motion || !t2.truecolor) {
42079
42248
  for (const l of lines(s.green, "", s.gray)) rail.emitLine(l);
42080
42249
  continue;
42081
42250
  }
@@ -42123,16 +42292,16 @@ function lightRow(screen, row2, r, center) {
42123
42292
  return out2 + screen.s.reset;
42124
42293
  }
42125
42294
  async function wordmark(screen, opts) {
42126
- const t = screen.term;
42127
- if (!t.screen) return;
42295
+ const t2 = screen.term;
42296
+ if (!t2.screen) return;
42128
42297
  screen.write("\n");
42129
- if (t.columns() < 50) {
42298
+ if (t2.columns() < 50) {
42130
42299
  screen.write(` ${screen.s.green}Verity${screen.s.reset}
42131
42300
 
42132
42301
  `);
42133
42302
  return;
42134
42303
  }
42135
- if (!opts.reveal || !t.motion || !t.truecolor) {
42304
+ if (!opts.reveal || !t2.motion || !t2.truecolor) {
42136
42305
  for (const row2 of WORDMARK) screen.write(` ${screen.s.green}${row2}${screen.s.reset}
42137
42306
  `);
42138
42307
  } else {
@@ -42150,7 +42319,7 @@ async function wordmark(screen, opts) {
42150
42319
  }
42151
42320
  screen.showCursor();
42152
42321
  }
42153
- if (TAGLINE.length + 2 <= t.columns()) screen.write(` ${screen.s.gray}${TAGLINE}${screen.s.reset}
42322
+ if (TAGLINE.length + 2 <= t2.columns()) screen.write(` ${screen.s.gray}${TAGLINE}${screen.s.reset}
42154
42323
  `);
42155
42324
  screen.write("\n");
42156
42325
  }
@@ -42230,23 +42399,23 @@ var Rail = class {
42230
42399
  * yellow: something the reader must act on.
42231
42400
  */
42232
42401
  line(raw, tone = "muted") {
42233
- const text2 = terminalText(raw, Number.MAX_SAFE_INTEGER);
42402
+ const text3 = terminalText(raw, Number.MAX_SAFE_INTEGER);
42234
42403
  if (!this.t.screen) {
42235
- this.emit(` ${text2}`);
42404
+ this.emit(` ${text3}`);
42236
42405
  return;
42237
42406
  }
42238
42407
  const color = tone === "muted" ? this.s.gray : tone === "warn" ? this.s.yellow : "";
42239
42408
  const reset = tone === "plain" ? "" : this.s.reset;
42240
- for (const l of wrapText(text2, this.width() - 3)) this.emit(`${this.s.gray}\u2502${this.s.reset} ${color}${l}${reset}`);
42409
+ for (const l of wrapText(text3, this.width() - 3)) this.emit(`${this.s.gray}\u2502${this.s.reset} ${color}${l}${reset}`);
42241
42410
  }
42242
42411
  /**
42243
42412
  * A line that belongs to the NEXT step, said before it starts (where a token
42244
42413
  * is about to go). On a screen it sits on the rail; in a log it stands alone,
42245
42414
  * so it does not read as a detail of the step above.
42246
42415
  */
42247
- note(text2) {
42248
- if (this.t.screen) this.line(text2);
42249
- else this.emit(terminalText(text2, Number.MAX_SAFE_INTEGER));
42416
+ note(text3) {
42417
+ if (this.t.screen) this.line(text3);
42418
+ else this.emit(terminalText(text3, Number.MAX_SAFE_INTEGER));
42250
42419
  }
42251
42420
  /** Key hints: Enter send v view the profile n skip (a screen only). */
42252
42421
  keys(pairs) {
@@ -42293,8 +42462,8 @@ var Rail = class {
42293
42462
  this.block++;
42294
42463
  }
42295
42464
  /** A finished sub-result under the active step (a screen only). */
42296
- ticked(text2) {
42297
- if (this.t.screen) this.emit(`${this.s.gray}\u2502${this.s.reset} ${this.s.green}\u2713${this.s.reset} ${text2}`);
42465
+ ticked(text3) {
42466
+ if (this.t.screen) this.emit(`${this.s.gray}\u2502${this.s.reset} ${this.s.green}\u2713${this.s.reset} ${text3}`);
42298
42467
  }
42299
42468
  /** The end of the rail, and the one next step. */
42300
42469
  end(title, next) {
@@ -42999,7 +43168,7 @@ function classifyCodacyConfig(root = repoRoot()) {
42999
43168
  return "foreign";
43000
43169
  }
43001
43170
  const tools = typeof parsed === "object" && parsed !== null ? parsed.tools : void 0;
43002
- const pointsAtVerity2 = Array.isArray(tools) && tools.some((t) => typeof t === "object" && t !== null && t.localConfigurationFile === VERITY_ESLINT_LOCAL_PATH);
43171
+ const pointsAtVerity2 = Array.isArray(tools) && tools.some((t2) => typeof t2 === "object" && t2 !== null && t2.localConfigurationFile === VERITY_ESLINT_LOCAL_PATH);
43003
43172
  if (!pointsAtVerity2) return "foreign";
43004
43173
  const eslint = readRegularFileInRoot(root, VERITY_ESLINT_CONFIG_FILE, MAX_BYTES);
43005
43174
  return eslint.ok && eslint.content.startsWith(VERITY_ESLINT_FIRST_LINE) ? "verity" : "foreign";
@@ -43272,7 +43441,7 @@ async function hooksStep(ui, ctx) {
43272
43441
  // src/commands/init/standard.ts
43273
43442
  var import_node_fs77 = require("node:fs");
43274
43443
  var import_node_path66 = require("node:path");
43275
- var import_yaml9 = __toESM2(require_dist());
43444
+ var import_yaml10 = __toESM2(require_dist());
43276
43445
 
43277
43446
  // src/lib/catalogue-client.ts
43278
43447
  async function fetchCatalogue(opts) {
@@ -43310,7 +43479,7 @@ async function choosePacks(globals) {
43310
43479
  }
43311
43480
  }
43312
43481
  function sayPacks(ui, plan) {
43313
- ui.rail.line(terminalText(`Review packs: ${describePacks(plan.packs)}`, 400));
43482
+ ui.rail.line(terminalText(`Review packs: ${describePacks(plan.packs)}. What each holds: verity standard catalogue`, 400));
43314
43483
  }
43315
43484
 
43316
43485
  // src/commands/init/team-standard.ts
@@ -43373,7 +43542,7 @@ function hasProjectRules() {
43373
43542
  const raw = readRepoFile(STANDARD_FILE);
43374
43543
  if (raw === null) return true;
43375
43544
  try {
43376
- const content = (0, import_yaml9.parse)(raw);
43545
+ const content = (0, import_yaml10.parse)(raw);
43377
43546
  const rules = content?.custom_patterns;
43378
43547
  if (rules === void 0 || rules === null) return false;
43379
43548
  return !Array.isArray(rules) || rules.length > 0;
@@ -43424,7 +43593,7 @@ function localStandardProblem() {
43424
43593
  if (raw === null) return `${STANDARD_FILE} is a link, not a regular file, or larger than 512 KB.`;
43425
43594
  let parsed;
43426
43595
  try {
43427
- parsed = (0, import_yaml9.parse)(raw);
43596
+ parsed = (0, import_yaml10.parse)(raw);
43428
43597
  } catch (err2) {
43429
43598
  return `${STANDARD_FILE} is not valid YAML: ${terminalText(err2 instanceof Error ? err2.message : String(err2), 200)}`;
43430
43599
  }
@@ -44191,7 +44360,7 @@ async function recordAnswers(ui, momentIds, telemetry, completed) {
44191
44360
  moments: momentIds,
44192
44361
  ...telemetry ? { telemetry } : {},
44193
44362
  // A failed run also clears an earlier stamp: "done" describes this checkout now.
44194
- init: completed ? { completed_at: (/* @__PURE__ */ new Date()).toISOString(), cli_version: true ? "0.35.0" : "dev" } : void 0
44363
+ init: completed ? { completed_at: (/* @__PURE__ */ new Date()).toISOString(), cli_version: true ? "0.35.1" : "dev" } : void 0
44195
44364
  });
44196
44365
  } catch (err2) {
44197
44366
  ui.rail.line(`Could not record the setup answers: ${terminalText(err2.message, 200)}`, "warn");
@@ -44656,13 +44825,13 @@ function registerTaskCommands(program2) {
44656
44825
  return;
44657
44826
  }
44658
44827
  printInfo("Tasks:");
44659
- for (const t of tasks) {
44660
- const status = t.status ?? "active";
44828
+ for (const t2 of tasks) {
44829
+ const status = t2.status ?? "active";
44661
44830
  const statusTag = status !== "active" ? ` [${status}]` : "";
44662
- const runs = t.run_count;
44663
- const ago = t.last_run_at ? timeAgo2(t.last_run_at) : "";
44831
+ const runs = t2.run_count;
44832
+ const ago = t2.last_run_at ? timeAgo2(t2.last_run_at) : "";
44664
44833
  const detail2 = runs != null ? `${runs} run${runs === 1 ? "" : "s"}${ago ? ", " + ago : ""}` : "";
44665
- printInfo(` ${t.label}${statusTag}${detail2 ? " (" + detail2 + ")" : ""}`);
44834
+ printInfo(` ${t2.label}${statusTag}${detail2 ? " (" + detail2 + ")" : ""}`);
44666
44835
  }
44667
44836
  });
44668
44837
  task.command("close").description("Close the current task (next run starts a new task)").option("--id <taskId>", "Close a specific task by ID").action(async (opts) => {
@@ -44893,11 +45062,11 @@ function resolve8(token, treePaths) {
44893
45062
  const matches = treePaths.filter((p) => p.endsWith(suffix));
44894
45063
  return matches.length === 1 ? matches[0] : null;
44895
45064
  }
44896
- function deriveFileGlobs(text2, treePaths) {
44897
- if (!text2 || treePaths.length === 0) return [];
45065
+ function deriveFileGlobs(text3, treePaths) {
45066
+ if (!text3 || treePaths.length === 0) return [];
44898
45067
  const out2 = [];
44899
45068
  const seen = /* @__PURE__ */ new Set();
44900
- for (const raw of text2.match(PATH_TOKEN) ?? []) {
45069
+ for (const raw of text3.match(PATH_TOKEN) ?? []) {
44901
45070
  const token = clean(raw);
44902
45071
  if (!token) continue;
44903
45072
  const path = resolve8(token, treePaths);
@@ -44967,15 +45136,15 @@ function registerReflectCommand(program2) {
44967
45136
  }
44968
45137
  if (!taskId) {
44969
45138
  const recent = mem.data.recent_tasks ?? [];
44970
- for (const t of recent) {
44971
- const label2 = t.label;
45139
+ for (const t2 of recent) {
45140
+ const label2 = t2.label;
44972
45141
  if (isMetaTaskLabel(label2)) continue;
44973
- const lastRunAt = t.last_run_at;
45142
+ const lastRunAt = t2.last_run_at;
44974
45143
  if (lastRunAt) {
44975
45144
  const age = Date.now() - new Date(lastRunAt).getTime();
44976
45145
  if (Number.isFinite(age) && age > STALE_TASK_MS) continue;
44977
45146
  }
44978
- taskId = t.id;
45147
+ taskId = t2.id;
44979
45148
  taskResolution = "recent";
44980
45149
  break;
44981
45150
  }
@@ -46114,10 +46283,10 @@ function registerLeanCommand(program2) {
46114
46283
  }
46115
46284
 
46116
46285
  // src/cli.ts
46117
- program.name("verity").description("CLI for Verity quality gate service").version("0.35.0").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
46286
+ program.name("verity").description("CLI for Verity quality gate service").version("0.35.1").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
46118
46287
  const isTelemetryHelper = actionCommand.name() === "headers" && actionCommand.parent?.name() === "telemetry";
46119
46288
  if (!isTelemetryHelper) {
46120
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.35.0");
46289
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.35.1");
46121
46290
  }
46122
46291
  setUserNamedServiceUrl(program.opts().serviceUrl);
46123
46292
  try {