@codacy/verity-cli 0.34.0-experimental.85ad809 → 0.34.0-experimental.9001e08

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/verity.js CHANGED
@@ -6975,10 +6975,10 @@ var require_resolve_block_map = __commonJS2({
6975
6975
  let offset = bm.offset;
6976
6976
  let commentEnd = null;
6977
6977
  for (const collItem of bm.items) {
6978
- const { start: start2, key, sep: sep6, value } = collItem;
6978
+ const { start: start2, key, sep: sep5, value } = collItem;
6979
6979
  const keyProps = resolveProps.resolveProps(start2, {
6980
6980
  indicator: "explicit-key-ind",
6981
- next: key ?? sep6?.[0],
6981
+ next: key ?? sep5?.[0],
6982
6982
  offset,
6983
6983
  onError,
6984
6984
  parentIndent: bm.indent,
@@ -6992,7 +6992,7 @@ var require_resolve_block_map = __commonJS2({
6992
6992
  else if ("indent" in key && key.indent !== bm.indent)
6993
6993
  onError(offset, "BAD_INDENT", startColMsg);
6994
6994
  }
6995
- if (!keyProps.anchor && !keyProps.tag && !sep6) {
6995
+ if (!keyProps.anchor && !keyProps.tag && !sep5) {
6996
6996
  commentEnd = keyProps.end;
6997
6997
  if (keyProps.comment) {
6998
6998
  if (map.comment)
@@ -7016,7 +7016,7 @@ var require_resolve_block_map = __commonJS2({
7016
7016
  ctx.atKey = false;
7017
7017
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
7018
7018
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
7019
- const valueProps = resolveProps.resolveProps(sep6 ?? [], {
7019
+ const valueProps = resolveProps.resolveProps(sep5 ?? [], {
7020
7020
  indicator: "map-value-ind",
7021
7021
  next: value,
7022
7022
  offset: keyNode.range[2],
@@ -7032,7 +7032,7 @@ var require_resolve_block_map = __commonJS2({
7032
7032
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
7033
7033
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
7034
7034
  }
7035
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
7035
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep5, null, valueProps, onError);
7036
7036
  if (ctx.schema.compat)
7037
7037
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
7038
7038
  offset = valueNode.range[2];
@@ -7123,7 +7123,7 @@ var require_resolve_end = __commonJS2({
7123
7123
  let comment = "";
7124
7124
  if (end) {
7125
7125
  let hasSpace = false;
7126
- let sep6 = "";
7126
+ let sep5 = "";
7127
7127
  for (const token of end) {
7128
7128
  const { source: source2, type } = token;
7129
7129
  switch (type) {
@@ -7137,13 +7137,13 @@ var require_resolve_end = __commonJS2({
7137
7137
  if (!comment)
7138
7138
  comment = cb;
7139
7139
  else
7140
- comment += sep6 + cb;
7141
- sep6 = "";
7140
+ comment += sep5 + cb;
7141
+ sep5 = "";
7142
7142
  break;
7143
7143
  }
7144
7144
  case "newline":
7145
7145
  if (comment)
7146
- sep6 += source2;
7146
+ sep5 += source2;
7147
7147
  hasSpace = true;
7148
7148
  break;
7149
7149
  default:
@@ -7186,18 +7186,18 @@ var require_resolve_flow_collection = __commonJS2({
7186
7186
  let offset = fc.offset + fc.start.source.length;
7187
7187
  for (let i2 = 0; i2 < fc.items.length; ++i2) {
7188
7188
  const collItem = fc.items[i2];
7189
- const { start: start2, key, sep: sep6, value } = collItem;
7189
+ const { start: start2, key, sep: sep5, value } = collItem;
7190
7190
  const props = resolveProps.resolveProps(start2, {
7191
7191
  flow: fcName,
7192
7192
  indicator: "explicit-key-ind",
7193
- next: key ?? sep6?.[0],
7193
+ next: key ?? sep5?.[0],
7194
7194
  offset,
7195
7195
  onError,
7196
7196
  parentIndent: fc.indent,
7197
7197
  startOnNewline: false
7198
7198
  });
7199
7199
  if (!props.found) {
7200
- if (!props.anchor && !props.tag && !sep6 && !value) {
7200
+ if (!props.anchor && !props.tag && !sep5 && !value) {
7201
7201
  if (i2 === 0 && props.comma)
7202
7202
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
7203
7203
  else if (i2 < fc.items.length - 1)
@@ -7251,8 +7251,8 @@ var require_resolve_flow_collection = __commonJS2({
7251
7251
  }
7252
7252
  }
7253
7253
  }
7254
- if (!isMap && !sep6 && !props.found) {
7255
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
7254
+ if (!isMap && !sep5 && !props.found) {
7255
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep5, null, props, onError);
7256
7256
  coll.items.push(valueNode);
7257
7257
  offset = valueNode.range[2];
7258
7258
  if (isBlock(value))
@@ -7264,7 +7264,7 @@ var require_resolve_flow_collection = __commonJS2({
7264
7264
  if (isBlock(key))
7265
7265
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
7266
7266
  ctx.atKey = false;
7267
- const valueProps = resolveProps.resolveProps(sep6 ?? [], {
7267
+ const valueProps = resolveProps.resolveProps(sep5 ?? [], {
7268
7268
  flow: fcName,
7269
7269
  indicator: "map-value-ind",
7270
7270
  next: value,
@@ -7275,8 +7275,8 @@ var require_resolve_flow_collection = __commonJS2({
7275
7275
  });
7276
7276
  if (valueProps.found) {
7277
7277
  if (!isMap && !props.found && ctx.options.strict) {
7278
- if (sep6)
7279
- for (const st of sep6) {
7278
+ if (sep5)
7279
+ for (const st of sep5) {
7280
7280
  if (st === valueProps.found)
7281
7281
  break;
7282
7282
  if (st.type === "newline") {
@@ -7293,7 +7293,7 @@ var require_resolve_flow_collection = __commonJS2({
7293
7293
  else
7294
7294
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
7295
7295
  }
7296
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
7296
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep5, null, valueProps, onError) : null;
7297
7297
  if (valueNode) {
7298
7298
  if (isBlock(value))
7299
7299
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -7473,7 +7473,7 @@ var require_resolve_block_scalar = __commonJS2({
7473
7473
  chompStart = i2 + 1;
7474
7474
  }
7475
7475
  let value = "";
7476
- let sep6 = "";
7476
+ let sep5 = "";
7477
7477
  let prevMoreIndented = false;
7478
7478
  for (let i2 = 0; i2 < contentStart; ++i2)
7479
7479
  value += lines[i2][0].slice(trimIndent) + "\n";
@@ -7490,24 +7490,24 @@ var require_resolve_block_scalar = __commonJS2({
7490
7490
  indent = "";
7491
7491
  }
7492
7492
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
7493
- value += sep6 + indent.slice(trimIndent) + content;
7494
- sep6 = "\n";
7493
+ value += sep5 + indent.slice(trimIndent) + content;
7494
+ sep5 = "\n";
7495
7495
  } else if (indent.length > trimIndent || content[0] === " ") {
7496
- if (sep6 === " ")
7497
- sep6 = "\n";
7498
- else if (!prevMoreIndented && sep6 === "\n")
7499
- sep6 = "\n\n";
7500
- value += sep6 + indent.slice(trimIndent) + content;
7501
- sep6 = "\n";
7496
+ if (sep5 === " ")
7497
+ sep5 = "\n";
7498
+ else if (!prevMoreIndented && sep5 === "\n")
7499
+ sep5 = "\n\n";
7500
+ value += sep5 + indent.slice(trimIndent) + content;
7501
+ sep5 = "\n";
7502
7502
  prevMoreIndented = true;
7503
7503
  } else if (content === "") {
7504
- if (sep6 === "\n")
7504
+ if (sep5 === "\n")
7505
7505
  value += "\n";
7506
7506
  else
7507
- sep6 = "\n";
7507
+ sep5 = "\n";
7508
7508
  } else {
7509
- value += sep6 + content;
7510
- sep6 = " ";
7509
+ value += sep5 + content;
7510
+ sep5 = " ";
7511
7511
  prevMoreIndented = false;
7512
7512
  }
7513
7513
  }
@@ -7689,25 +7689,25 @@ var require_resolve_flow_scalar = __commonJS2({
7689
7689
  if (!match)
7690
7690
  return source2;
7691
7691
  let res = match[1];
7692
- let sep6 = " ";
7692
+ let sep5 = " ";
7693
7693
  let pos = first.lastIndex;
7694
7694
  line2.lastIndex = pos;
7695
7695
  while (match = line2.exec(source2)) {
7696
7696
  if (match[1] === "") {
7697
- if (sep6 === "\n")
7698
- res += sep6;
7697
+ if (sep5 === "\n")
7698
+ res += sep5;
7699
7699
  else
7700
- sep6 = "\n";
7700
+ sep5 = "\n";
7701
7701
  } else {
7702
- res += sep6 + match[1];
7703
- sep6 = " ";
7702
+ res += sep5 + match[1];
7703
+ sep5 = " ";
7704
7704
  }
7705
7705
  pos = line2.lastIndex;
7706
7706
  }
7707
7707
  const last = /[ \t]*(.*)/sy;
7708
7708
  last.lastIndex = pos;
7709
7709
  match = last.exec(source2);
7710
- return res + sep6 + (match?.[1] ?? "");
7710
+ return res + sep5 + (match?.[1] ?? "");
7711
7711
  }
7712
7712
  function doubleQuotedValue(source2, onError) {
7713
7713
  let res = "";
@@ -8514,14 +8514,14 @@ var require_cst_stringify = __commonJS2({
8514
8514
  }
8515
8515
  }
8516
8516
  }
8517
- function stringifyItem({ start: start2, key, sep: sep6, value }) {
8517
+ function stringifyItem({ start: start2, key, sep: sep5, value }) {
8518
8518
  let res = "";
8519
8519
  for (const st of start2)
8520
8520
  res += st.source;
8521
8521
  if (key)
8522
8522
  res += stringifyToken(key);
8523
- if (sep6)
8524
- for (const st of sep6)
8523
+ if (sep5)
8524
+ for (const st of sep5)
8525
8525
  res += st.source;
8526
8526
  if (value)
8527
8527
  res += stringifyToken(value);
@@ -9671,18 +9671,18 @@ var require_parser = __commonJS2({
9671
9671
  if (this.type === "map-value-ind") {
9672
9672
  const prev = getPrevProps(this.peek(2));
9673
9673
  const start2 = getFirstKeyStartProps(prev);
9674
- let sep6;
9674
+ let sep5;
9675
9675
  if (scalar.end) {
9676
- sep6 = scalar.end;
9677
- sep6.push(this.sourceToken);
9676
+ sep5 = scalar.end;
9677
+ sep5.push(this.sourceToken);
9678
9678
  delete scalar.end;
9679
9679
  } else
9680
- sep6 = [this.sourceToken];
9680
+ sep5 = [this.sourceToken];
9681
9681
  const map = {
9682
9682
  type: "block-map",
9683
9683
  offset: scalar.offset,
9684
9684
  indent: scalar.indent,
9685
- items: [{ start: start2, key: scalar, sep: sep6 }]
9685
+ items: [{ start: start2, key: scalar, sep: sep5 }]
9686
9686
  };
9687
9687
  this.onKeyLine = true;
9688
9688
  this.stack[this.stack.length - 1] = map;
@@ -9835,15 +9835,15 @@ var require_parser = __commonJS2({
9835
9835
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
9836
9836
  const start3 = getFirstKeyStartProps(it.start);
9837
9837
  const key = it.key;
9838
- const sep6 = it.sep;
9839
- sep6.push(this.sourceToken);
9838
+ const sep5 = it.sep;
9839
+ sep5.push(this.sourceToken);
9840
9840
  delete it.key;
9841
9841
  delete it.sep;
9842
9842
  this.stack.push({
9843
9843
  type: "block-map",
9844
9844
  offset: this.offset,
9845
9845
  indent: this.indent,
9846
- items: [{ start: start3, key, sep: sep6 }]
9846
+ items: [{ start: start3, key, sep: sep5 }]
9847
9847
  });
9848
9848
  } else if (start2.length > 0) {
9849
9849
  it.sep = it.sep.concat(start2, this.sourceToken);
@@ -10037,13 +10037,13 @@ var require_parser = __commonJS2({
10037
10037
  const prev = getPrevProps(parent);
10038
10038
  const start2 = getFirstKeyStartProps(prev);
10039
10039
  fixFlowSeqItems(fc);
10040
- const sep6 = fc.end.splice(1, fc.end.length);
10041
- sep6.push(this.sourceToken);
10040
+ const sep5 = fc.end.splice(1, fc.end.length);
10041
+ sep5.push(this.sourceToken);
10042
10042
  const map = {
10043
10043
  type: "block-map",
10044
10044
  offset: fc.offset,
10045
10045
  indent: fc.indent,
10046
- items: [{ start: start2, key: fc, sep: sep6 }]
10046
+ items: [{ start: start2, key: fc, sep: sep5 }]
10047
10047
  };
10048
10048
  this.onKeyLine = true;
10049
10049
  this.stack[this.stack.length - 1] = map;
@@ -10435,13 +10435,13 @@ var require_web_tree_sitter2 = __commonJS2({
10435
10435
  }
10436
10436
  readAsync = /* @__PURE__ */ __name(async (url) => {
10437
10437
  if (isFileURI(url)) {
10438
- return new Promise((resolve9, reject) => {
10438
+ return new Promise((resolve8, reject) => {
10439
10439
  var xhr = new XMLHttpRequest();
10440
10440
  xhr.open("GET", url, true);
10441
10441
  xhr.responseType = "arraybuffer";
10442
10442
  xhr.onload = () => {
10443
10443
  if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
10444
- resolve9(xhr.response);
10444
+ resolve8(xhr.response);
10445
10445
  return;
10446
10446
  }
10447
10447
  reject(xhr.status);
@@ -10634,9 +10634,9 @@ var require_web_tree_sitter2 = __commonJS2({
10634
10634
  __name(receiveInstantiationResult, "receiveInstantiationResult");
10635
10635
  var info2 = getWasmImports();
10636
10636
  if (Module["instantiateWasm"]) {
10637
- return new Promise((resolve9, reject) => {
10637
+ return new Promise((resolve8, reject) => {
10638
10638
  Module["instantiateWasm"](info2, (mod, inst) => {
10639
- resolve9(receiveInstance(mod, inst));
10639
+ resolve8(receiveInstance(mod, inst));
10640
10640
  });
10641
10641
  });
10642
10642
  }
@@ -11969,8 +11969,8 @@ var require_web_tree_sitter2 = __commonJS2({
11969
11969
  if (runtimeInitialized) {
11970
11970
  moduleRtn = Module;
11971
11971
  } else {
11972
- moduleRtn = new Promise((resolve9, reject) => {
11973
- readyPromiseResolve = resolve9;
11972
+ moduleRtn = new Promise((resolve8, reject) => {
11973
+ readyPromiseResolve = resolve8;
11974
11974
  readyPromiseReject = reject;
11975
11975
  });
11976
11976
  }
@@ -14447,87 +14447,8 @@ var import_node_child_process4 = require("node:child_process");
14447
14447
 
14448
14448
  // src/constants.ts
14449
14449
  var import_node_child_process = require("node:child_process");
14450
- var import_node_fs2 = require("node:fs");
14451
- var import_node_path2 = require("node:path");
14452
-
14453
- // src/lib/context-identity.ts
14454
- var import_node_crypto = require("node:crypto");
14455
14450
  var import_node_fs = require("node:fs");
14456
- var import_node_os = require("node:os");
14457
14451
  var import_node_path = require("node:path");
14458
- var SHARED_SENTINELS = /* @__PURE__ */ new Set([
14459
- "",
14460
- "-",
14461
- "n/a",
14462
- "na",
14463
- "none",
14464
- "null",
14465
- "undefined",
14466
- "unknown",
14467
- "anon",
14468
- "anonymous",
14469
- "default",
14470
- "_default"
14471
- ]);
14472
- function isSharedSentinel(value) {
14473
- if (value == null) return true;
14474
- return SHARED_SENTINELS.has(value.trim().toLowerCase());
14475
- }
14476
- var ephemeral = /* @__PURE__ */ new Map();
14477
- function ephemeralId(slot, width) {
14478
- let id = ephemeral.get(slot);
14479
- if (!id) {
14480
- id = `eph-${(0, import_node_crypto.randomBytes)(Math.ceil(width / 2)).toString("hex").slice(0, width - 4)}`;
14481
- ephemeral.set(slot, id);
14482
- }
14483
- return id;
14484
- }
14485
- function contextIdentity(input) {
14486
- const tokenUsable = !isSharedSentinel(input.token ?? null);
14487
- const sessionUsable = !isSharedSentinel(input.sessionId ?? null);
14488
- const userKey = tokenUsable ? (0, import_node_crypto.createHash)("sha256").update(String(input.token)).digest("hex").slice(0, 12) : ephemeralId("user", 12);
14489
- const sessionKey2 = sessionUsable ? (0, import_node_crypto.createHash)("sha256").update(String(input.sessionId)).digest("hex").slice(0, 16) : ephemeralId("session", 16);
14490
- let treeKey = "no-tree";
14491
- const rawTree = input.treeRoot;
14492
- if (rawTree && !isSharedSentinel(rawTree)) {
14493
- let resolved = rawTree;
14494
- try {
14495
- resolved = import_node_fs.realpathSync.native(rawTree);
14496
- } catch {
14497
- }
14498
- treeKey = (0, import_node_crypto.createHash)("sha256").update(resolved).digest("hex").slice(0, 12);
14499
- }
14500
- return {
14501
- userKey,
14502
- treeKey,
14503
- sessionKey: sessionKey2,
14504
- userKeySource: tokenUsable ? "token" : "ephemeral",
14505
- sessionKeySource: sessionUsable ? "session_id" : "ephemeral",
14506
- ephemeral: !tokenUsable || !sessionUsable
14507
- };
14508
- }
14509
- function verityHome() {
14510
- const override = process.env.VERITY_HOME;
14511
- return override && override.trim() ? (0, import_node_path.resolve)(override) : (0, import_node_path.join)((0, import_node_os.homedir)(), ".verity");
14512
- }
14513
- function dossierDir(identity) {
14514
- return (0, import_node_path.join)(verityHome(), "sessions", identity.userKey, identity.treeKey, identity.sessionKey);
14515
- }
14516
- function treeDir(identity) {
14517
- return (0, import_node_path.join)(verityHome(), "sessions", identity.userKey, identity.treeKey);
14518
- }
14519
- function scopeIdentity(token, sessionId) {
14520
- const t = (token ?? "").trim();
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";
14523
- const sessionKey2 = s.length > 0 ? (0, import_node_crypto.createHash)("sha256").update(s).digest("hex").slice(0, 16) : "_default";
14524
- return { userKey, sessionKey: sessionKey2, bucket: `${userKey}/${sessionKey2}` };
14525
- }
14526
- function sessionScopeKey(token, sessionId) {
14527
- return scopeIdentity(token, sessionId).bucket;
14528
- }
14529
-
14530
- // src/constants.ts
14531
14452
  var _repoRoot = null;
14532
14453
  function repoRoot() {
14533
14454
  if (_repoRoot === null) {
@@ -14555,36 +14476,17 @@ function mainWorktreeRoot() {
14555
14476
  _mainRoot = null;
14556
14477
  return _mainRoot;
14557
14478
  }
14558
- const abs = common.startsWith("/") ? common : (0, import_node_path2.join)(repoRoot(), common);
14559
- _mainRoot = (0, import_node_path2.dirname)(abs);
14479
+ const abs = common.startsWith("/") ? common : (0, import_node_path.join)(repoRoot(), common);
14480
+ _mainRoot = (0, import_node_path.dirname)(abs);
14560
14481
  } catch {
14561
14482
  _mainRoot = null;
14562
14483
  }
14563
14484
  return _mainRoot;
14564
14485
  }
14565
14486
  function verityConfigured() {
14566
- if (isProjectVerityDir((0, import_node_path2.join)(repoRoot(), VERITY_DIR))) return true;
14487
+ if ((0, import_node_fs.existsSync)((0, import_node_path.join)(repoRoot(), VERITY_DIR))) return true;
14567
14488
  const main = mainWorktreeRoot();
14568
- return !!main && isProjectVerityDir((0, import_node_path2.join)(main, VERITY_DIR));
14569
- }
14570
- function isProjectVerityDir(dir) {
14571
- return (0, import_node_fs2.existsSync)(dir) && !isMachineStore(dir);
14572
- }
14573
- function isMachineStore(dir) {
14574
- const here = canonicalPath(dir);
14575
- const stores = [process.env.HOME ? (0, import_node_path2.join)(process.env.HOME, VERITY_DIR) : null, verityHome()];
14576
- return stores.some((s) => s !== null && canonicalPath(s) === here);
14577
- }
14578
- function canonicalPath(p) {
14579
- try {
14580
- return import_node_fs2.realpathSync.native(p);
14581
- } catch {
14582
- }
14583
- try {
14584
- return (0, import_node_path2.join)(import_node_fs2.realpathSync.native((0, import_node_path2.dirname)(p)), (0, import_node_path2.basename)(p));
14585
- } catch {
14586
- return (0, import_node_path2.resolve)(p);
14587
- }
14489
+ return !!main && (0, import_node_fs.existsSync)((0, import_node_path.join)(main, VERITY_DIR));
14588
14490
  }
14589
14491
  var VERITY_DIR = ".verity";
14590
14492
  var CREDENTIALS_FILE = `${VERITY_DIR}/credentials`;
@@ -14605,7 +14507,7 @@ var MEMORY_DIR = `${VERITY_DIR}/memory`;
14605
14507
  var CODACY_CONFIG_FILE = ".codacy/codacy.config.json";
14606
14508
  var VERITYIGNORE_FILE = ".verityignore";
14607
14509
  function projectPath(relativePath) {
14608
- return (0, import_node_path2.join)(repoRoot(), relativePath);
14510
+ return (0, import_node_path.join)(repoRoot(), relativePath);
14609
14511
  }
14610
14512
  var MAX_DELTA_BYTES = 194560;
14611
14513
  var MAX_FILES = 40;
@@ -14779,7 +14681,7 @@ function printVerbose(msg, verbose) {
14779
14681
  }
14780
14682
 
14781
14683
  // src/lib/debug-log.ts
14782
- var import_node_fs3 = require("node:fs");
14684
+ var import_node_fs2 = require("node:fs");
14783
14685
  function isDebugEnabled() {
14784
14686
  const v = process.env.VERITY_DEBUG;
14785
14687
  if (v === "0" || v === "false" || v === "off") return false;
@@ -14797,24 +14699,24 @@ function writeLine(obj) {
14797
14699
  try {
14798
14700
  const dir = projectPath(DEBUG_LOG_DIR);
14799
14701
  const file = projectPath(DEBUG_LOG_FILE);
14800
- (0, import_node_fs3.mkdirSync)(dir, { recursive: true });
14702
+ (0, import_node_fs2.mkdirSync)(dir, { recursive: true });
14801
14703
  rotateIfNeeded(file);
14802
- (0, import_node_fs3.appendFileSync)(file, JSON.stringify(obj) + "\n");
14704
+ (0, import_node_fs2.appendFileSync)(file, JSON.stringify(obj) + "\n");
14803
14705
  } catch {
14804
14706
  }
14805
14707
  }
14806
14708
  function rotateIfNeeded(file) {
14807
14709
  try {
14808
- const s = (0, import_node_fs3.statSync)(file);
14710
+ const s = (0, import_node_fs2.statSync)(file);
14809
14711
  if (s.size < DEBUG_LOG_MAX_BYTES) return;
14810
- (0, import_node_fs3.renameSync)(file, `${file}.1`);
14712
+ (0, import_node_fs2.renameSync)(file, `${file}.1`);
14811
14713
  } catch {
14812
14714
  }
14813
14715
  }
14814
14716
 
14815
14717
  // src/lib/credentials.ts
14816
14718
  var import_promises = require("node:fs/promises");
14817
- var import_node_path3 = require("node:path");
14719
+ var import_node_path2 = require("node:path");
14818
14720
  var import_node_child_process2 = require("node:child_process");
14819
14721
  function globalCredentialsPath() {
14820
14722
  return `${process.env.HOME}/.verity/credentials`;
@@ -14889,7 +14791,7 @@ async function readGlobalCredential(remote) {
14889
14791
  }
14890
14792
  async function upsertGlobalCredential(remote, rec) {
14891
14793
  const path = globalCredentialsPath();
14892
- await (0, import_promises.mkdir)((0, import_node_path3.dirname)(path), { recursive: true });
14794
+ await (0, import_promises.mkdir)((0, import_node_path2.dirname)(path), { recursive: true });
14893
14795
  let content = "";
14894
14796
  try {
14895
14797
  content = await (0, import_promises.readFile)(path, "utf-8");
@@ -15033,10 +14935,10 @@ async function foldLegacyLocalCredential(remoteArg) {
15033
14935
 
15034
14936
  // src/lib/git.ts
15035
14937
  var import_node_child_process3 = require("node:child_process");
15036
- var import_node_fs4 = require("node:fs");
15037
- var import_node_path4 = require("node:path");
14938
+ var import_node_fs3 = require("node:fs");
14939
+ var import_node_path3 = require("node:path");
15038
14940
  function resolveFile(relpath) {
15039
- return (0, import_node_fs4.existsSync)(relpath) ? relpath : null;
14941
+ return (0, import_node_fs3.existsSync)(relpath) ? relpath : null;
15040
14942
  }
15041
14943
  function execGit(cmd) {
15042
14944
  try {
@@ -15054,7 +14956,7 @@ function readBaselineSha() {
15054
14956
  if (sha === null) return null;
15055
14957
  if (!commitResolves(sha)) {
15056
14958
  try {
15057
- (0, import_node_fs4.unlinkSync)(BASELINE_SHA_FILE);
14959
+ (0, import_node_fs3.unlinkSync)(BASELINE_SHA_FILE);
15058
14960
  } catch {
15059
14961
  }
15060
14962
  return null;
@@ -15062,10 +14964,10 @@ function readBaselineSha() {
15062
14964
  return sha;
15063
14965
  }
15064
14966
  function readRawBaselineSha() {
15065
- if (!(0, import_node_fs4.existsSync)(BASELINE_SHA_FILE)) return null;
14967
+ if (!(0, import_node_fs3.existsSync)(BASELINE_SHA_FILE)) return null;
15066
14968
  let sha;
15067
14969
  try {
15068
- sha = (0, import_node_fs4.readFileSync)(BASELINE_SHA_FILE, "utf-8").trim();
14970
+ sha = (0, import_node_fs3.readFileSync)(BASELINE_SHA_FILE, "utf-8").trim();
15069
14971
  } catch {
15070
14972
  return null;
15071
14973
  }
@@ -15074,8 +14976,8 @@ function readRawBaselineSha() {
15074
14976
  function writeBaselineSha(sha) {
15075
14977
  if (!SHA_RE.test(sha)) return;
15076
14978
  try {
15077
- (0, import_node_fs4.mkdirSync)((0, import_node_path4.dirname)(BASELINE_SHA_FILE), { recursive: true });
15078
- (0, import_node_fs4.writeFileSync)(BASELINE_SHA_FILE, sha);
14979
+ (0, import_node_fs3.mkdirSync)((0, import_node_path3.dirname)(BASELINE_SHA_FILE), { recursive: true });
14980
+ (0, import_node_fs3.writeFileSync)(BASELINE_SHA_FILE, sha);
15079
14981
  } catch {
15080
14982
  }
15081
14983
  }
@@ -15163,17 +15065,17 @@ function showContentAtRef(ref, repoRelPath) {
15163
15065
  }
15164
15066
  function filterAnalyzable(files) {
15165
15067
  return files.filter((f) => {
15166
- const ext = (0, import_node_path4.extname)(f).slice(1);
15068
+ const ext = (0, import_node_path3.extname)(f).slice(1);
15167
15069
  return ANALYZABLE_EXTENSIONS.has(ext);
15168
15070
  });
15169
15071
  }
15170
15072
  function filterReviewable(files) {
15171
15073
  return files.filter((f) => {
15172
- const ext = (0, import_node_path4.extname)(f).slice(1);
15074
+ const ext = (0, import_node_path3.extname)(f).slice(1);
15173
15075
  if (ANALYZABLE_EXTENSIONS.has(ext)) return false;
15174
15076
  if (REVIEWABLE_EXTENSIONS.has(ext)) return true;
15175
- const basename9 = f.split("/").pop() ?? "";
15176
- if (REVIEWABLE_FILENAMES.has(basename9)) return true;
15077
+ const basename8 = f.split("/").pop() ?? "";
15078
+ if (REVIEWABLE_FILENAMES.has(basename8)) return true;
15177
15079
  if (REVIEWABLE_PATH_PATTERNS.some((p) => p.test(f))) return true;
15178
15080
  return false;
15179
15081
  });
@@ -15648,7 +15550,7 @@ async function maybeHealServiceUrl(resolution, verbose) {
15648
15550
 
15649
15551
  // src/lib/register.ts
15650
15552
  var readline = __toESM2(require("node:readline/promises"));
15651
- var import_node_os2 = require("node:os");
15553
+ var import_node_os = require("node:os");
15652
15554
 
15653
15555
  // src/lib/spinner.ts
15654
15556
  var FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -15736,7 +15638,7 @@ function startSpinner(label2, opts = {}) {
15736
15638
  }
15737
15639
 
15738
15640
  // src/lib/provider-auth.ts
15739
- var sleep = (ms) => new Promise((resolve9) => setTimeout(resolve9, ms));
15641
+ var sleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
15740
15642
  var form = (fields) => new URLSearchParams(fields).toString();
15741
15643
  async function githubAccountId(owner) {
15742
15644
  try {
@@ -16001,7 +15903,7 @@ function deviceLabel() {
16001
15903
  const override = process.env.VERITY_DEVICE_LABEL?.trim();
16002
15904
  if (override) return override;
16003
15905
  try {
16004
- return (0, import_node_os2.hostname)() || void 0;
15906
+ return (0, import_node_os.hostname)() || void 0;
16005
15907
  } catch {
16006
15908
  return void 0;
16007
15909
  }
@@ -16159,8 +16061,8 @@ function registerAuthCommands(program2) {
16159
16061
  }
16160
16062
 
16161
16063
  // src/lib/pending-login.ts
16162
- var import_node_fs5 = require("node:fs");
16163
- var import_node_path5 = require("node:path");
16064
+ var import_node_fs4 = require("node:fs");
16065
+ var import_node_path4 = require("node:path");
16164
16066
  function pendingLoginPath() {
16165
16067
  return `${process.env.HOME}/.verity/pending-login.json`;
16166
16068
  }
@@ -16176,26 +16078,26 @@ function savePendingLogin(dc, serviceUrl, now = Date.now()) {
16176
16078
  created_at: new Date(now).toISOString()
16177
16079
  };
16178
16080
  const path = pendingLoginPath();
16179
- (0, import_node_fs5.mkdirSync)((0, import_node_path5.dirname)(path), { recursive: true });
16081
+ (0, import_node_fs4.mkdirSync)((0, import_node_path4.dirname)(path), { recursive: true });
16180
16082
  clearPendingLogin();
16181
- (0, import_node_fs5.writeFileSync)(path, JSON.stringify(record, null, 2) + "\n", { mode: 384, flag: "wx" });
16083
+ (0, import_node_fs4.writeFileSync)(path, JSON.stringify(record, null, 2) + "\n", { mode: 384, flag: "wx" });
16182
16084
  try {
16183
- (0, import_node_fs5.chmodSync)(path, 384);
16085
+ (0, import_node_fs4.chmodSync)(path, 384);
16184
16086
  } catch {
16185
16087
  }
16186
16088
  return record;
16187
16089
  }
16188
16090
  function readPendingLogin(now = Date.now()) {
16189
16091
  const path = pendingLoginPath();
16190
- if (!(0, import_node_fs5.existsSync)(path)) return { status: "none" };
16092
+ if (!(0, import_node_fs4.existsSync)(path)) return { status: "none" };
16191
16093
  try {
16192
- if ((0, import_node_fs5.lstatSync)(path).isSymbolicLink()) return { status: "invalid", reason: "it is a symlink" };
16094
+ if ((0, import_node_fs4.lstatSync)(path).isSymbolicLink()) return { status: "invalid", reason: "it is a symlink" };
16193
16095
  } catch {
16194
16096
  return { status: "none" };
16195
16097
  }
16196
16098
  let parsed;
16197
16099
  try {
16198
- parsed = JSON.parse((0, import_node_fs5.readFileSync)(path, "utf-8"));
16100
+ parsed = JSON.parse((0, import_node_fs4.readFileSync)(path, "utf-8"));
16199
16101
  } catch {
16200
16102
  return { status: "invalid", reason: "it is not valid JSON" };
16201
16103
  }
@@ -16216,7 +16118,7 @@ function readPendingLogin(now = Date.now()) {
16216
16118
  }
16217
16119
  function clearPendingLogin() {
16218
16120
  try {
16219
- (0, import_node_fs5.unlinkSync)(pendingLoginPath());
16121
+ (0, import_node_fs4.unlinkSync)(pendingLoginPath());
16220
16122
  return true;
16221
16123
  } catch {
16222
16124
  return false;
@@ -16772,11 +16674,11 @@ function registerLogoutCommand(program2) {
16772
16674
 
16773
16675
  // src/lib/hooks.ts
16774
16676
  var import_promises4 = require("node:fs/promises");
16775
- var import_node_path7 = require("node:path");
16677
+ var import_node_path6 = require("node:path");
16776
16678
 
16777
16679
  // src/lib/json-file.ts
16778
16680
  var import_promises3 = require("node:fs/promises");
16779
- var import_node_path6 = require("node:path");
16681
+ var import_node_path5 = require("node:path");
16780
16682
  function jsonSemanticEqual(a, b) {
16781
16683
  if (a === b) return true;
16782
16684
  if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
@@ -16822,7 +16724,7 @@ async function writeJsonFilePreservingStyle(file, value) {
16822
16724
  const indent = currentRaw !== null ? detectJsonIndent(currentRaw) : 2;
16823
16725
  const next = JSON.stringify(value, null, indent) + "\n";
16824
16726
  if (next === currentRaw) return false;
16825
- await (0, import_promises3.mkdir)((0, import_node_path6.dirname)(file), { recursive: true });
16727
+ await (0, import_promises3.mkdir)((0, import_node_path5.dirname)(file), { recursive: true });
16826
16728
  await (0, import_promises3.writeFile)(file, next);
16827
16729
  return true;
16828
16730
  }
@@ -17007,13 +16909,13 @@ async function writeSettings(settings) {
17007
16909
  }
17008
16910
  async function readSettingsAt(root) {
17009
16911
  try {
17010
- return JSON.parse(await (0, import_promises4.readFile)((0, import_node_path7.join)(root, CLAUDE_SETTINGS_FILE), "utf-8"));
16912
+ return JSON.parse(await (0, import_promises4.readFile)((0, import_node_path6.join)(root, CLAUDE_SETTINGS_FILE), "utf-8"));
17011
16913
  } catch {
17012
16914
  return {};
17013
16915
  }
17014
16916
  }
17015
16917
  async function writeSettingsAt(root, settings) {
17016
- await writeJsonFilePreservingStyle((0, import_node_path7.join)(root, CLAUDE_SETTINGS_FILE), settings);
16918
+ await writeJsonFilePreservingStyle((0, import_node_path6.join)(root, CLAUDE_SETTINGS_FILE), settings);
17017
16919
  }
17018
16920
  async function hasLegacyHooksAt(root) {
17019
16921
  const settings = await readSettingsAt(root);
@@ -17202,13 +17104,13 @@ async function applyMomentSelection(moments) {
17202
17104
  }
17203
17105
 
17204
17106
  // src/lib/project-config.ts
17205
- var import_node_fs7 = require("node:fs");
17206
- var import_node_path9 = require("node:path");
17207
-
17208
- // src/lib/repo-controlled.ts
17209
17107
  var import_node_fs6 = require("node:fs");
17210
17108
  var import_node_path8 = require("node:path");
17211
17109
 
17110
+ // src/lib/repo-controlled.ts
17111
+ var import_node_fs5 = require("node:fs");
17112
+ var import_node_path7 = require("node:path");
17113
+
17212
17114
  // src/lib/hardened-git.ts
17213
17115
  var import_node_child_process5 = require("node:child_process");
17214
17116
  var HARDENED_CONFIG_ARGS = [
@@ -17288,7 +17190,7 @@ function repoControlled(worktree, rel) {
17288
17190
  for (let i2 = 1; i2 <= parts2.length; i2++) {
17289
17191
  let st;
17290
17192
  try {
17291
- st = (0, import_node_fs6.lstatSync)((0, import_node_path8.join)(worktree, ...parts2.slice(0, i2)));
17193
+ st = (0, import_node_fs5.lstatSync)((0, import_node_path7.join)(worktree, ...parts2.slice(0, i2)));
17292
17194
  } catch (err2) {
17293
17195
  const code = err2?.code;
17294
17196
  if (code === "ENOENT" || code === "ENOTDIR") return null;
@@ -17312,8 +17214,8 @@ function parseMoments(raw) {
17312
17214
  }
17313
17215
  function readConfigFile(path) {
17314
17216
  try {
17315
- if (!(0, import_node_fs7.existsSync)(path)) return null;
17316
- const raw = JSON.parse((0, import_node_fs7.readFileSync)(path, "utf-8"));
17217
+ if (!(0, import_node_fs6.existsSync)(path)) return null;
17218
+ const raw = JSON.parse((0, import_node_fs6.readFileSync)(path, "utf-8"));
17317
17219
  const moments = Array.isArray(raw.git_moments) ? raw.git_moments.filter(isMoment) : [];
17318
17220
  const source2 = raw.git_moments_source === "user" || raw.git_moments_source === "init" ? raw.git_moments_source : void 0;
17319
17221
  return {
@@ -17330,13 +17232,13 @@ function candidates() {
17330
17232
  const out2 = [{ path: local, source: "local" }];
17331
17233
  const main = mainWorktreeRoot();
17332
17234
  if (main) {
17333
- const inherited = (0, import_node_path9.join)(main, PROJECT_CONFIG_FILE);
17235
+ const inherited = (0, import_node_path8.join)(main, PROJECT_CONFIG_FILE);
17334
17236
  if (inherited !== local) out2.push({ path: inherited, source: "main-worktree" });
17335
17237
  }
17336
17238
  return out2;
17337
17239
  }
17338
17240
  function formalRefusal(path) {
17339
- return repoControlled((0, import_node_path9.dirname)((0, import_node_path9.dirname)(path)), PROJECT_CONFIG_FILE);
17241
+ return repoControlled((0, import_node_path8.dirname)((0, import_node_path8.dirname)(path)), PROJECT_CONFIG_FILE);
17340
17242
  }
17341
17243
  function readProjectConfigRaw() {
17342
17244
  for (const { path, source: source2 } of candidates()) {
@@ -17372,8 +17274,8 @@ function writeProjectConfig(patch) {
17372
17274
  ...patch
17373
17275
  };
17374
17276
  const target = projectPath(PROJECT_CONFIG_FILE);
17375
- (0, import_node_fs7.mkdirSync)((0, import_node_path9.dirname)(target), { recursive: true });
17376
- (0, import_node_fs7.writeFileSync)(target, JSON.stringify(next, null, 2) + "\n");
17277
+ (0, import_node_fs6.mkdirSync)((0, import_node_path8.dirname)(target), { recursive: true });
17278
+ (0, import_node_fs6.writeFileSync)(target, JSON.stringify(next, null, 2) + "\n");
17377
17279
  return next;
17378
17280
  }
17379
17281
  function resolveGuardMoments(explicit) {
@@ -17382,11 +17284,11 @@ function resolveGuardMoments(explicit) {
17382
17284
  }
17383
17285
 
17384
17286
  // src/lib/plugin-ownership.ts
17385
- var import_node_fs10 = require("node:fs");
17287
+ var import_node_fs9 = require("node:fs");
17386
17288
 
17387
17289
  // src/lib/which.ts
17388
- var import_node_fs8 = require("node:fs");
17389
- var import_node_path10 = require("node:path");
17290
+ var import_node_fs7 = require("node:fs");
17291
+ var import_node_path9 = require("node:path");
17390
17292
  function executableExtensions(platform4, pathext) {
17391
17293
  if (platform4 !== "win32") return [""];
17392
17294
  const raw = (pathext ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean);
@@ -17404,14 +17306,14 @@ function whichSync(bin, opts = {}) {
17404
17306
  if (!rawPath) return null;
17405
17307
  const exts = executableExtensions(platform4, opts.pathext ?? process.env.PATHEXT);
17406
17308
  const real = opts.real ?? true;
17407
- for (const dir of rawPath.split(import_node_path10.delimiter)) {
17309
+ for (const dir of rawPath.split(import_node_path9.delimiter)) {
17408
17310
  if (!dir) continue;
17409
17311
  for (const ext of exts) {
17410
- const candidate = (0, import_node_path10.join)(dir, bin + ext);
17312
+ const candidate = (0, import_node_path9.join)(dir, bin + ext);
17411
17313
  try {
17412
- if (!(0, import_node_fs8.statSync)(candidate).isFile()) continue;
17413
- if (platform4 !== "win32") (0, import_node_fs8.accessSync)(candidate, import_node_fs8.constants.X_OK);
17414
- return real ? (0, import_node_fs8.realpathSync)(candidate) : candidate;
17314
+ if (!(0, import_node_fs7.statSync)(candidate).isFile()) continue;
17315
+ if (platform4 !== "win32") (0, import_node_fs7.accessSync)(candidate, import_node_fs7.constants.X_OK);
17316
+ return real ? (0, import_node_fs7.realpathSync)(candidate) : candidate;
17415
17317
  } catch {
17416
17318
  continue;
17417
17319
  }
@@ -17421,11 +17323,11 @@ function whichSync(bin, opts = {}) {
17421
17323
  }
17422
17324
 
17423
17325
  // src/lib/plugin-ownership.ts
17424
- var import_node_os3 = require("node:os");
17425
- var import_node_path11 = require("node:path");
17326
+ var import_node_os2 = require("node:os");
17327
+ var import_node_path10 = require("node:path");
17426
17328
 
17427
17329
  // src/lib/stderr-log.ts
17428
- var import_node_fs9 = require("node:fs");
17330
+ var import_node_fs8 = require("node:fs");
17429
17331
  var TOKEN_RE2 = /verity_[0-9a-f]{16,}/g;
17430
17332
  var ANSI_RE = /\u001b\[[0-?]*[ -/]*[@-~]/g;
17431
17333
  function scrub(s) {
@@ -17438,9 +17340,9 @@ function append(text) {
17438
17340
  try {
17439
17341
  const dir = projectPath(DEBUG_LOG_DIR);
17440
17342
  const file = projectPath(STDERR_LOG_FILE);
17441
- (0, import_node_fs9.mkdirSync)(dir, { recursive: true });
17343
+ (0, import_node_fs8.mkdirSync)(dir, { recursive: true });
17442
17344
  rotateIfNeeded(file);
17443
- (0, import_node_fs9.appendFileSync)(file, text);
17345
+ (0, import_node_fs8.appendFileSync)(file, text);
17444
17346
  } catch {
17445
17347
  }
17446
17348
  }
@@ -17488,8 +17390,8 @@ function markerPath() {
17488
17390
  }
17489
17391
  function readMarker() {
17490
17392
  try {
17491
- if (!(0, import_node_fs10.existsSync)(markerPath())) return null;
17492
- const raw = JSON.parse((0, import_node_fs10.readFileSync)(markerPath(), "utf-8"));
17393
+ if (!(0, import_node_fs9.existsSync)(markerPath())) return null;
17394
+ const raw = JSON.parse((0, import_node_fs9.readFileSync)(markerPath(), "utf-8"));
17493
17395
  const pluginRoot = typeof raw.plugin_root === "string" ? raw.plugin_root : "";
17494
17396
  if (!pluginRoot || CONTROL_CHARS2.test(pluginRoot)) return null;
17495
17397
  const version = typeof raw.version === "string" && !CONTROL_CHARS2.test(raw.version) ? raw.version : null;
@@ -17507,23 +17409,23 @@ function recordPluginOwnership(sessionId) {
17507
17409
  const pluginRoot = process.env.VERITY_PLUGIN_ROOT;
17508
17410
  if (!pluginRoot) return;
17509
17411
  try {
17510
- (0, import_node_fs10.mkdirSync)(projectPath(VERITY_DIR), { recursive: true });
17412
+ (0, import_node_fs9.mkdirSync)(projectPath(VERITY_DIR), { recursive: true });
17511
17413
  const marker = {
17512
17414
  session_id: sessionId,
17513
17415
  plugin_root: pluginRoot,
17514
17416
  version: process.env.VERITY_PLUGIN_VERSION || null,
17515
17417
  ts: Math.floor(Date.now() / 1e3)
17516
17418
  };
17517
- (0, import_node_fs10.writeFileSync)(markerPath(), JSON.stringify(marker));
17419
+ (0, import_node_fs9.writeFileSync)(markerPath(), JSON.stringify(marker));
17518
17420
  } catch {
17519
17421
  }
17520
17422
  }
17521
17423
  function claudeConfigDir() {
17522
- return process.env.CLAUDE_CONFIG_DIR || (0, import_node_path11.join)((0, import_node_os3.homedir)(), ".claude");
17424
+ return process.env.CLAUDE_CONFIG_DIR || (0, import_node_path10.join)((0, import_node_os2.homedir)(), ".claude");
17523
17425
  }
17524
17426
  function readJsonFile(path) {
17525
17427
  try {
17526
- const parsed = JSON.parse((0, import_node_fs10.readFileSync)(path, "utf-8"));
17428
+ const parsed = JSON.parse((0, import_node_fs9.readFileSync)(path, "utf-8"));
17527
17429
  return parsed && typeof parsed === "object" ? parsed : null;
17528
17430
  } catch {
17529
17431
  return null;
@@ -17531,9 +17433,9 @@ function readJsonFile(path) {
17531
17433
  }
17532
17434
  function enabledPluginSetting(key) {
17533
17435
  const files = [
17534
- projectPath((0, import_node_path11.join)(".claude", "settings.local.json")),
17535
- projectPath((0, import_node_path11.join)(".claude", "settings.json")),
17536
- (0, import_node_path11.join)(claudeConfigDir(), "settings.json")
17436
+ projectPath((0, import_node_path10.join)(".claude", "settings.local.json")),
17437
+ projectPath((0, import_node_path10.join)(".claude", "settings.json")),
17438
+ (0, import_node_path10.join)(claudeConfigDir(), "settings.json")
17537
17439
  ];
17538
17440
  for (const file of files) {
17539
17441
  const map = readJsonFile(file)?.enabledPlugins;
@@ -17545,11 +17447,11 @@ function enabledPluginSetting(key) {
17545
17447
  }
17546
17448
  function marketplaceLocations() {
17547
17449
  const out2 = /* @__PURE__ */ new Map();
17548
- const known = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "known_marketplaces.json"));
17450
+ const known = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "known_marketplaces.json"));
17549
17451
  if (!known) return out2;
17550
17452
  for (const [name2, entry] of Object.entries(known)) {
17551
17453
  const loc2 = entry?.installLocation;
17552
- if (typeof loc2 === "string" && loc2) out2.set(name2, (0, import_node_path11.resolve)(loc2));
17454
+ if (typeof loc2 === "string" && loc2) out2.set(name2, (0, import_node_path10.resolve)(loc2));
17553
17455
  }
17554
17456
  return out2;
17555
17457
  }
@@ -17563,7 +17465,7 @@ function globalVerityVersion() {
17563
17465
  const entry = verityPathEntry();
17564
17466
  if (!entry) return null;
17565
17467
  try {
17566
- const pkg = readJsonFile((0, import_node_path11.join)((0, import_node_path11.dirname)((0, import_node_fs10.realpathSync)(entry)), "..", "package.json"));
17468
+ const pkg = readJsonFile((0, import_node_path10.join)((0, import_node_path10.dirname)((0, import_node_fs9.realpathSync)(entry)), "..", "package.json"));
17567
17469
  if (pkg?.name !== "@codacy/verity-cli" || typeof pkg.version !== "string") return null;
17568
17470
  return pkg.version;
17569
17471
  } catch {
@@ -17580,7 +17482,7 @@ var VERITY_MARKETPLACE_REPO = "codacy/verity";
17580
17482
  function marketplaceConflict() {
17581
17483
  const wanted = VERITY_MARKETPLACE;
17582
17484
  for (const file of ["settings.json", "settings.local.json"]) {
17583
- const path = (0, import_node_path11.join)(claudeConfigDir(), file);
17485
+ const path = (0, import_node_path10.join)(claudeConfigDir(), file);
17584
17486
  const declared = readJsonFile(path)?.extraKnownMarketplaces ?? null;
17585
17487
  const entry2 = declared && typeof declared === "object" ? declared[wanted] : void 0;
17586
17488
  if (entry2 && typeof entry2 === "object") {
@@ -17590,7 +17492,7 @@ function marketplaceConflict() {
17590
17492
  }
17591
17493
  }
17592
17494
  }
17593
- const known = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "known_marketplaces.json"));
17495
+ const known = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "known_marketplaces.json"));
17594
17496
  const entry = known?.[wanted];
17595
17497
  if (entry && typeof entry === "object" && !pointsAtVerity(entry.source)) {
17596
17498
  return { name: wanted, declaredAs: describeSource(entry.source) };
@@ -17611,7 +17513,7 @@ function describeSource(src) {
17611
17513
  return target ? `${kind} \u2192 ${target}` : kind;
17612
17514
  }
17613
17515
  function legacyMarketplaceInstall() {
17614
- const plugins = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17516
+ const plugins = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17615
17517
  if (!plugins || typeof plugins !== "object") return null;
17616
17518
  for (const key of Object.keys(plugins)) {
17617
17519
  const at = key.lastIndexOf("@");
@@ -17623,13 +17525,13 @@ function legacyMarketplaceInstall() {
17623
17525
  }
17624
17526
  function realpathOr(p) {
17625
17527
  try {
17626
- return import_node_fs10.realpathSync.native(p);
17528
+ return import_node_fs9.realpathSync.native(p);
17627
17529
  } catch {
17628
- return (0, import_node_path11.resolve)(p);
17530
+ return (0, import_node_path10.resolve)(p);
17629
17531
  }
17630
17532
  }
17631
17533
  function isWithin(want, dir) {
17632
- return want === dir || want.startsWith(dir + import_node_path11.sep);
17534
+ return want === dir || want.startsWith(dir + import_node_path10.sep);
17633
17535
  }
17634
17536
  function entryAppliesHere(entry, here) {
17635
17537
  const e = entry;
@@ -17639,9 +17541,9 @@ function entryAppliesHere(entry, here) {
17639
17541
  return forProject === here;
17640
17542
  }
17641
17543
  function registrySays(pluginRoot) {
17642
- const plugins = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17544
+ const plugins = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17643
17545
  if (!plugins || typeof plugins !== "object") return "unverified";
17644
- const want = (0, import_node_path11.resolve)(pluginRoot);
17546
+ const want = (0, import_node_path10.resolve)(pluginRoot);
17645
17547
  const here = realpathOr(repoRoot());
17646
17548
  const markets = marketplaceLocations();
17647
17549
  for (const [key, value] of Object.entries(plugins)) {
@@ -17650,15 +17552,15 @@ function registrySays(pluginRoot) {
17650
17552
  const applicable = (Array.isArray(value) ? value : []).filter((entry) => entryAppliesHere(entry, here));
17651
17553
  const claims = applicable.some((entry) => {
17652
17554
  const installPath = entry?.installPath;
17653
- return typeof installPath === "string" && (0, import_node_path11.resolve)(installPath) === want;
17555
+ return typeof installPath === "string" && (0, import_node_path10.resolve)(installPath) === want;
17654
17556
  }) || source2 !== void 0 && applicable.length > 0 && isWithin(want, source2);
17655
17557
  if (claims) {
17656
17558
  if (enabledPluginSetting(key) === false) return "gone";
17657
- return (0, import_node_fs10.existsSync)(pluginRoot) ? "live" : "gone";
17559
+ return (0, import_node_fs9.existsSync)(pluginRoot) ? "live" : "gone";
17658
17560
  }
17659
17561
  }
17660
- const managed = (0, import_node_path11.resolve)((0, import_node_path11.join)(claudeConfigDir(), "plugins", "cache"));
17661
- return want === managed || want.startsWith(managed + import_node_path11.sep) ? "gone" : "unverified";
17562
+ const managed = (0, import_node_path10.resolve)((0, import_node_path10.join)(claudeConfigDir(), "plugins", "cache"));
17563
+ return want === managed || want.startsWith(managed + import_node_path10.sep) ? "gone" : "unverified";
17662
17564
  }
17663
17565
  var _live = /* @__PURE__ */ new Map();
17664
17566
  function pluginLiveness(pluginRoot) {
@@ -17672,7 +17574,7 @@ function clearStalePluginMarker() {
17672
17574
  const marker = readMarker();
17673
17575
  if (!marker || pluginLiveness(marker.plugin_root) !== "gone") return null;
17674
17576
  try {
17675
- (0, import_node_fs10.rmSync)(markerPath(), { force: true });
17577
+ (0, import_node_fs9.rmSync)(markerPath(), { force: true });
17676
17578
  } catch {
17677
17579
  return null;
17678
17580
  }
@@ -17700,7 +17602,7 @@ function pluginActiveHere() {
17700
17602
  return activePluginInstall() !== null;
17701
17603
  }
17702
17604
  function registeredVerityPlugin() {
17703
- const plugins = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17605
+ const plugins = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17704
17606
  if (!plugins || typeof plugins !== "object") return null;
17705
17607
  const here = realpathOr(repoRoot());
17706
17608
  for (const [key, value] of Object.entries(plugins)) {
@@ -17710,7 +17612,7 @@ function registeredVerityPlugin() {
17710
17612
  for (const entry of Array.isArray(value) ? value : []) {
17711
17613
  const e = entry;
17712
17614
  const installPath = typeof e.installPath === "string" ? e.installPath : "";
17713
- if (!installPath || !(0, import_node_fs10.existsSync)(installPath)) continue;
17615
+ if (!installPath || !(0, import_node_fs9.existsSync)(installPath)) continue;
17714
17616
  if (!entryAppliesHere(entry, here)) continue;
17715
17617
  return { pluginRoot: installPath, version: typeof e.version === "string" ? e.version : null };
17716
17618
  }
@@ -17762,28 +17664,28 @@ async function resolveHookWiring() {
17762
17664
  }
17763
17665
 
17764
17666
  // src/lib/cli-provenance.ts
17765
- var import_node_fs11 = require("node:fs");
17766
- var import_node_os4 = require("node:os");
17767
- var import_node_path12 = require("node:path");
17667
+ var import_node_fs10 = require("node:fs");
17668
+ var import_node_os3 = require("node:os");
17669
+ var import_node_path11 = require("node:path");
17768
17670
  var CLI_PACKAGE = "@codacy/verity-cli";
17769
- var CLI_ENTRY = (0, import_node_path12.join)("node_modules", CLI_PACKAGE, "bin", "verity.js");
17671
+ var CLI_ENTRY = (0, import_node_path11.join)("node_modules", CLI_PACKAGE, "bin", "verity.js");
17770
17672
  function readJson(path) {
17771
17673
  try {
17772
- const parsed = JSON.parse((0, import_node_fs11.readFileSync)(path, "utf-8"));
17674
+ const parsed = JSON.parse((0, import_node_fs10.readFileSync)(path, "utf-8"));
17773
17675
  return parsed && typeof parsed === "object" ? parsed : null;
17774
17676
  } catch {
17775
17677
  return null;
17776
17678
  }
17777
17679
  }
17778
17680
  function versionUnder(base) {
17779
- const entry = (0, import_node_path12.join)(base, CLI_ENTRY);
17780
- if (!(0, import_node_fs11.existsSync)(entry)) return null;
17781
- const pkg = readJson((0, import_node_path12.join)(base, "node_modules", CLI_PACKAGE, "package.json"));
17681
+ const entry = (0, import_node_path11.join)(base, CLI_ENTRY);
17682
+ if (!(0, import_node_fs10.existsSync)(entry)) return null;
17683
+ const pkg = readJson((0, import_node_path11.join)(base, "node_modules", CLI_PACKAGE, "package.json"));
17782
17684
  return typeof pkg?.version === "string" ? pkg.version : null;
17783
17685
  }
17784
17686
  function versionForEntry(entry) {
17785
17687
  try {
17786
- const pkg = readJson((0, import_node_path12.join)((0, import_node_path12.dirname)((0, import_node_fs11.realpathSync)(entry)), "..", "package.json"));
17688
+ const pkg = readJson((0, import_node_path11.join)((0, import_node_path11.dirname)((0, import_node_fs10.realpathSync)(entry)), "..", "package.json"));
17787
17689
  return typeof pkg?.version === "string" ? pkg.version : null;
17788
17690
  } catch {
17789
17691
  return null;
@@ -17791,16 +17693,16 @@ function versionForEntry(entry) {
17791
17693
  }
17792
17694
  function resolveHooksCli(pluginRoot) {
17793
17695
  const override = process.env.VERITY_CLI_PATH;
17794
- if (override && (0, import_node_fs11.existsSync)(override)) {
17696
+ if (override && (0, import_node_fs10.existsSync)(override)) {
17795
17697
  return { version: versionForEntry(override), rung: "override" };
17796
17698
  }
17797
17699
  const fromPlugin = versionUnder(pluginRoot);
17798
17700
  if (fromPlugin !== null) return { version: fromPlugin, rung: "plugin" };
17799
- if ((0, import_node_fs11.existsSync)((0, import_node_path12.join)(pluginRoot, CLI_ENTRY))) return { version: null, rung: "plugin" };
17800
- const dataDir = process.env.CLAUDE_PLUGIN_DATA || (0, import_node_path12.join)((0, import_node_os4.homedir)(), ".verity", "plugin-cli");
17701
+ if ((0, import_node_fs10.existsSync)((0, import_node_path11.join)(pluginRoot, CLI_ENTRY))) return { version: null, rung: "plugin" };
17702
+ const dataDir = process.env.CLAUDE_PLUGIN_DATA || (0, import_node_path11.join)((0, import_node_os3.homedir)(), ".verity", "plugin-cli");
17801
17703
  const fromData = versionUnder(dataDir);
17802
17704
  if (fromData !== null) return { version: fromData, rung: "plugin-data" };
17803
- if ((0, import_node_fs11.existsSync)((0, import_node_path12.join)(dataDir, CLI_ENTRY))) return { version: null, rung: "plugin-data" };
17705
+ if ((0, import_node_fs10.existsSync)((0, import_node_path11.join)(dataDir, CLI_ENTRY))) return { version: null, rung: "plugin-data" };
17804
17706
  const global = globalVerityVersion();
17805
17707
  if (global !== null) return { version: global, rung: "global" };
17806
17708
  return null;
@@ -17902,7 +17804,7 @@ function pluginCliInvocation() {
17902
17804
  return resolverCommand(root);
17903
17805
  }
17904
17806
  function resolverCommand(root) {
17905
- return `node ${JSON.stringify((0, import_node_path12.join)(root, "scripts", "verity.mjs"))}`;
17807
+ return `node ${JSON.stringify((0, import_node_path11.join)(root, "scripts", "verity.mjs"))}`;
17906
17808
  }
17907
17809
 
17908
17810
  // src/commands/hooks.ts
@@ -18038,18 +17940,18 @@ function registerHooksCommands(program2) {
18038
17940
  }
18039
17941
 
18040
17942
  // src/commands/intent.ts
18041
- var import_node_crypto10 = require("node:crypto");
17943
+ var import_node_crypto9 = require("node:crypto");
18042
17944
 
18043
17945
  // src/lib/conversation-buffer.ts
18044
17946
  var import_promises5 = require("node:fs/promises");
18045
- var import_node_fs12 = require("node:fs");
17947
+ var import_node_fs11 = require("node:fs");
18046
17948
  var import_node_child_process6 = require("node:child_process");
18047
- var import_node_crypto2 = require("node:crypto");
17949
+ var import_node_crypto = require("node:crypto");
18048
17950
  function stripImageReferences(text) {
18049
17951
  return text.replace(/\[Image #\d+\]/g, "[screenshot \u2014 not available for review]");
18050
17952
  }
18051
17953
  function bufferTmpPath() {
18052
- return `${CONVERSATION_BUFFER_FILE}.${process.pid}.${(0, import_node_crypto2.randomBytes)(4).toString("hex")}.tmp`;
17954
+ return `${CONVERSATION_BUFFER_FILE}.${process.pid}.${(0, import_node_crypto.randomBytes)(4).toString("hex")}.tmp`;
18053
17955
  }
18054
17956
  async function appendToConversationBuffer(prompt, sessionId) {
18055
17957
  try {
@@ -18078,7 +17980,7 @@ async function appendToConversationBuffer(prompt, sessionId) {
18078
17980
  }
18079
17981
  async function readAndClearConversationBuffer(currentSessionId) {
18080
17982
  try {
18081
- if ((0, import_node_fs12.existsSync)(CONVERSATION_BUFFER_FILE)) {
17983
+ if ((0, import_node_fs11.existsSync)(CONVERSATION_BUFFER_FILE)) {
18082
17984
  const entries = await readBufferEntries();
18083
17985
  let mine = entries;
18084
17986
  let others = [];
@@ -18102,7 +18004,7 @@ async function readAndClearConversationBuffer(currentSessionId) {
18102
18004
  };
18103
18005
  }
18104
18006
  }
18105
- if ((0, import_node_fs12.existsSync)(INTENT_FILE)) {
18007
+ if ((0, import_node_fs11.existsSync)(INTENT_FILE)) {
18106
18008
  try {
18107
18009
  const content = await (0, import_promises5.readFile)(INTENT_FILE, "utf-8");
18108
18010
  await (0, import_promises5.unlink)(INTENT_FILE).catch(() => {
@@ -18393,6 +18295,83 @@ function isCommandOnlyTurn(input) {
18393
18295
  return commands.every(isNonAuthoringCommand);
18394
18296
  }
18395
18297
 
18298
+ // src/lib/context-identity.ts
18299
+ var import_node_crypto2 = require("node:crypto");
18300
+ var import_node_fs12 = require("node:fs");
18301
+ var import_node_os4 = require("node:os");
18302
+ var import_node_path12 = require("node:path");
18303
+ var SHARED_SENTINELS = /* @__PURE__ */ new Set([
18304
+ "",
18305
+ "-",
18306
+ "n/a",
18307
+ "na",
18308
+ "none",
18309
+ "null",
18310
+ "undefined",
18311
+ "unknown",
18312
+ "anon",
18313
+ "anonymous",
18314
+ "default",
18315
+ "_default"
18316
+ ]);
18317
+ function isSharedSentinel(value) {
18318
+ if (value == null) return true;
18319
+ return SHARED_SENTINELS.has(value.trim().toLowerCase());
18320
+ }
18321
+ var ephemeral = /* @__PURE__ */ new Map();
18322
+ function ephemeralId(slot, width) {
18323
+ let id = ephemeral.get(slot);
18324
+ if (!id) {
18325
+ id = `eph-${(0, import_node_crypto2.randomBytes)(Math.ceil(width / 2)).toString("hex").slice(0, width - 4)}`;
18326
+ ephemeral.set(slot, id);
18327
+ }
18328
+ return id;
18329
+ }
18330
+ function contextIdentity(input) {
18331
+ const tokenUsable = !isSharedSentinel(input.token ?? null);
18332
+ const sessionUsable = !isSharedSentinel(input.sessionId ?? null);
18333
+ const userKey = tokenUsable ? (0, import_node_crypto2.createHash)("sha256").update(String(input.token)).digest("hex").slice(0, 12) : ephemeralId("user", 12);
18334
+ const sessionKey2 = sessionUsable ? (0, import_node_crypto2.createHash)("sha256").update(String(input.sessionId)).digest("hex").slice(0, 16) : ephemeralId("session", 16);
18335
+ let treeKey = "no-tree";
18336
+ const rawTree = input.treeRoot;
18337
+ if (rawTree && !isSharedSentinel(rawTree)) {
18338
+ let resolved = rawTree;
18339
+ try {
18340
+ resolved = import_node_fs12.realpathSync.native(rawTree);
18341
+ } catch {
18342
+ }
18343
+ treeKey = (0, import_node_crypto2.createHash)("sha256").update(resolved).digest("hex").slice(0, 12);
18344
+ }
18345
+ return {
18346
+ userKey,
18347
+ treeKey,
18348
+ sessionKey: sessionKey2,
18349
+ userKeySource: tokenUsable ? "token" : "ephemeral",
18350
+ sessionKeySource: sessionUsable ? "session_id" : "ephemeral",
18351
+ ephemeral: !tokenUsable || !sessionUsable
18352
+ };
18353
+ }
18354
+ function verityHome() {
18355
+ const override = process.env.VERITY_HOME;
18356
+ return override && override.trim() ? (0, import_node_path12.resolve)(override) : (0, import_node_path12.join)((0, import_node_os4.homedir)(), ".verity");
18357
+ }
18358
+ function dossierDir(identity) {
18359
+ return (0, import_node_path12.join)(verityHome(), "sessions", identity.userKey, identity.treeKey, identity.sessionKey);
18360
+ }
18361
+ function treeDir(identity) {
18362
+ return (0, import_node_path12.join)(verityHome(), "sessions", identity.userKey, identity.treeKey);
18363
+ }
18364
+ function scopeIdentity(token, sessionId) {
18365
+ const t = (token ?? "").trim();
18366
+ const s = (sessionId ?? "").trim();
18367
+ const userKey = t.length > 0 ? (0, import_node_crypto2.createHash)("sha256").update(t).digest("hex").slice(0, 12) : "anon";
18368
+ const sessionKey2 = s.length > 0 ? (0, import_node_crypto2.createHash)("sha256").update(s).digest("hex").slice(0, 16) : "_default";
18369
+ return { userKey, sessionKey: sessionKey2, bucket: `${userKey}/${sessionKey2}` };
18370
+ }
18371
+ function sessionScopeKey(token, sessionId) {
18372
+ return scopeIdentity(token, sessionId).bucket;
18373
+ }
18374
+
18396
18375
  // src/lib/task-context-buffer.ts
18397
18376
  var import_promises6 = require("node:fs/promises");
18398
18377
  var import_node_fs13 = require("node:fs");
@@ -19476,8 +19455,8 @@ function ensureVerityGitignore() {
19476
19455
  }
19477
19456
  let text = next.join("\n");
19478
19457
  if (!hasMarker) {
19479
- const sep6 = text === "" ? "" : text.endsWith("\n") ? "\n" : "\n\n";
19480
- text = text + sep6 + VERITY_GITIGNORE_BLOCK;
19458
+ const sep5 = text === "" ? "" : text.endsWith("\n") ? "\n" : "\n\n";
19459
+ text = text + sep5 + VERITY_GITIGNORE_BLOCK;
19481
19460
  }
19482
19461
  if (text !== content) (0, import_node_fs19.writeFileSync)(".gitignore", text);
19483
19462
  return verified(
@@ -19507,8 +19486,8 @@ function writeFencedBlock() {
19507
19486
  lines = fenceMemoryLines(lines);
19508
19487
  let text = lines.join("\n");
19509
19488
  if (!hasMarker) {
19510
- const sep6 = text === "" ? "" : text.endsWith("\n") ? "\n" : "\n\n";
19511
- text = text + sep6 + VERITY_GITIGNORE_BLOCK;
19489
+ const sep5 = text === "" ? "" : text.endsWith("\n") ? "\n" : "\n\n";
19490
+ text = text + sep5 + VERITY_GITIGNORE_BLOCK;
19512
19491
  }
19513
19492
  try {
19514
19493
  (0, import_node_fs19.writeFileSync)(".gitignore", text);
@@ -19558,8 +19537,8 @@ function keepMemoryTracked() {
19558
19537
  }
19559
19538
  if (content.includes(MEMORY_OPT_OUT_MARKER)) return "already";
19560
19539
  try {
19561
- const sep6 = content === "" ? "" : content.endsWith("\n") ? "\n" : "\n\n";
19562
- (0, import_node_fs19.writeFileSync)(".gitignore", content + sep6 + MEMORY_OPT_OUT_STANZA);
19540
+ const sep5 = content === "" ? "" : content.endsWith("\n") ? "\n" : "\n\n";
19541
+ (0, import_node_fs19.writeFileSync)(".gitignore", content + sep5 + MEMORY_OPT_OUT_STANZA);
19563
19542
  } catch {
19564
19543
  return "failed";
19565
19544
  }
@@ -20058,97 +20037,6 @@ var LEGACY_MD_END = "<!-- gate-memory:end -->";
20058
20037
  var LEGACY_PRESERVE_START = "<!-- gate-memory:preserve -->";
20059
20038
  var LEGACY_PRESERVE_END = "<!-- /gate-memory:preserve -->";
20060
20039
  var CLAUDE_MD_PROSE = [
20061
- "## Project Memory",
20062
- "",
20063
- "This project has a knowledge graph maintained at `.verity/memory/`. Before starting",
20064
- "non-trivial work, scan `.verity/memory/index.md` for decisions, gotchas, and patterns",
20065
- "that may apply to the change you are about to make. Open specific node files via",
20066
- "the Read tool when the title or scope suggests relevance.",
20067
- "",
20068
- "The graph is auto-maintained by Verity. Files at `.verity/memory/_archive/` are",
20069
- "superseded \u2014 ignore them unless investigating history.",
20070
- "",
20071
- "Knowledge the organization's other repositories learned is mirrored outside the",
20072
- "repo at `~/.verity/orgs/<host>/<owner>/memory/` (`verity memory org` lists it).",
20073
- "Each claim says where it came from; one that is wrong here is demoted for",
20074
- 'everyone with `verity memory demote <id> --reason "\u2026"`.',
20075
- "",
20076
- "## Quality gate: accepted risks",
20077
- "",
20078
- "When the Verity pre-commit/pre-push gate FAILs, fix the findings \u2014 that is the",
20079
- 'default. Use `verity waive <pattern-id> --file <path> --reason "\u2026"` ONLY to relay',
20080
- "a risk a human has explicitly accepted: a named code-review finding, an ADR, or",
20081
- "the user saying so in this conversation. The --reason must cite that source.",
20082
- "",
20083
- "Never waive on your own judgment, to get past a block, or pre-emptively. A waive",
20084
- "binds to the file's current bytes and voids automatically when the file changes,",
20085
- "and every waive is recorded in the run ledger. For a pattern-level false positive",
20086
- "use `verity feedback finding <run-id> <pattern-id> false_positive` instead.",
20087
- "",
20088
- "## Post-task reflection",
20089
- "",
20090
- `When a task is complete (you've created a PR, the user says "done" or "ship it",`,
20091
- "or the work is clearly finished), **draft the reflection yourself** \u2014 1\u20133",
20092
- "concrete things worth remembering (a decision, a gotcha, or a pattern), each",
20093
- "cited with the files / PR / commands / error-signatures it came from. Skip",
20094
- "entirely if nothing non-obvious happened \u2014 that judgement is the ONLY filter,",
20095
- "because nothing reviews the reflection before it lands.",
20096
- "",
20097
- "Then record it straight away. There is no confirm step, in any environment:",
20098
- "",
20099
- "```bash",
20100
- "verity reflect --user-input - --kind <kind> <<'VERITY_EOF_<random>'",
20101
- "<your draft>",
20102
- "VERITY_EOF_<random>",
20103
- "```",
20104
- "",
20105
- 'The draft goes through the quoted heredoc, never inside `"\u2026"` on the command',
20106
- 'line, where a `"` or `$(\u2026)` in it would run in the shell. Replace `<random>`',
20107
- "with 8 random letters and digits that you pick for this call, the same at both",
20108
- "ends. Text written before you picked them cannot end the heredoc early.",
20109
- "",
20110
- "Add `--confirmed` ONLY when the user authored or dictated the words. Without",
20111
- "it the node is stored as `source: agent` \u2014 Verity thought this, nobody checked",
20112
- "it. With it, `source: user` at full confidence \u2014 a person stands behind this.",
20113
- "Never claim the second for your own draft, however good it is.",
20114
- "",
20115
- "**Name the files in the text.** Verity scopes the reflection to the paths it",
20116
- "cites, and a reflection that names no file in this repo is never retrieved for",
20117
- "a later review \u2014 it is recorded and then invisible. The command says so when it",
20118
- "happens; `--file-globs '<path or glob>'` is the fix when the prose cannot carry",
20119
- "the paths.",
20120
- "",
20121
- "Then tell the user, in one line, what you recorded and where: the command",
20122
- "prints the node id, the path under `.verity/memory/`, and a dashboard link.",
20123
- "They did not agree to it in advance, so say it happened \u2014 editing or deleting",
20124
- "that file is how they correct it.",
20125
- "",
20126
- "> Durable, hand-curated guidance goes in the preserve region below (it survives",
20127
- "> regeneration) or anywhere OUTSIDE these markers. Everything else between the",
20128
- "> markers is tool-owned and overwritten on each run.",
20129
- "",
20130
- "## Housekeeping Turns",
20131
- "",
20132
- "When a turn will be pure housekeeping \u2014 pulling, installing dependencies,",
20133
- "rebasing, a formatting sweep you are not authoring \u2014 declare it BEFORE doing it:",
20134
- "",
20135
- "```bash",
20136
- 'verity ignore --turn --agent --reason "pulling latest before starting"',
20137
- "```",
20138
- "",
20139
- "This skips the review for that turn, which saves the turn Verity would",
20140
- "otherwise spend saying it had nothing to say. Use `--for 30m` instead of",
20141
- "`--turn` when a single piece of housekeeping spans several turns.",
20142
- "",
20143
- "**It is a claim about the turn, not a way to silence review.** The declaration",
20144
- "is checked against what the turn actually did: if anything is authored \u2014 by you,",
20145
- "by a subagent, or by a shell command that can write files \u2014 it voids, the review",
20146
- "runs anyway, and the broken declaration is reported. So declare housekeeping you",
20147
- "are about to do, never work you have already done, and never as a way to get past",
20148
- "a finding. Declarations are budgeted per session and every one is recorded with",
20149
- "its reason."
20150
- ].join("\n");
20151
- var CLAUDE_MD_PROSE_PRE_STDIN = [
20152
20040
  "## Project Memory",
20153
20041
  "",
20154
20042
  "This project has a knowledge graph maintained at `.verity/memory/`. Before starting",
@@ -20590,7 +20478,6 @@ function stripKnownProse(interior) {
20590
20478
  const trimmed = interior.replace(/^\n+/, "");
20591
20479
  for (const prose of [
20592
20480
  CLAUDE_MD_PROSE,
20593
- CLAUDE_MD_PROSE_PRE_STDIN,
20594
20481
  CLAUDE_MD_PROSE_PRE_ORG,
20595
20482
  CLAUDE_MD_PROSE_PRE_AUTORECORD,
20596
20483
  CLAUDE_MD_PROSE_PRE_REFLECT,
@@ -20657,7 +20544,7 @@ Body content (\u22648KB). Use [[node-id]] wikilinks for cross-references.
20657
20544
 
20658
20545
  // src/lib/dossier-session.ts
20659
20546
  var import_node_fs26 = require("node:fs");
20660
- var import_node_crypto9 = require("node:crypto");
20547
+ var import_node_crypto8 = require("node:crypto");
20661
20548
  var import_node_path22 = require("node:path");
20662
20549
 
20663
20550
  // src/lib/pending-repeat.ts
@@ -20734,7 +20621,6 @@ function isRepeatOfAny(text, priorFingerprints, threshold = REPEAT_THRESHOLD) {
20734
20621
  }
20735
20622
 
20736
20623
  // src/lib/dossier/bounds.ts
20737
- var import_node_crypto5 = require("node:crypto");
20738
20624
  var MAX_LINE_BYTES = 4096;
20739
20625
  var MAX_GOAL_CHARS = 2e3;
20740
20626
  var GOAL_KEEP = 8;
@@ -20746,17 +20632,10 @@ var NOT_MINE_CAP = 300;
20746
20632
  var STATEMENTS_OPEN_CAP = 40;
20747
20633
  var COMMANDS_CAP = 12;
20748
20634
  var DIVERGENCE_CAP = 10;
20749
- var DIVERGENCE_BULK_AT = 300;
20750
- var DIVERGENCE_KEYS_PER_LINE = 200;
20635
+ var DIVERGENCE_SEEN_CAP = 300;
20751
20636
  function divergenceKey(path, hash) {
20752
20637
  return `${path}@${hash ?? "unknown"}`;
20753
20638
  }
20754
- function packedDivergenceDigest(key) {
20755
- return (0, import_node_crypto5.createHash)("sha256").update(key).digest("hex").slice(0, 12);
20756
- }
20757
- function packedDivergenceKey(digest) {
20758
- return `#${digest}`;
20759
- }
20760
20639
  var MARKS_CAP = 50;
20761
20640
  var ROTATE_BYTES = 1048576;
20762
20641
  var ROTATE_KEEP = 2;
@@ -20770,7 +20649,7 @@ function statementAnchorKey(file, patternId) {
20770
20649
  }
20771
20650
 
20772
20651
  // src/lib/dossier/log.ts
20773
- var import_node_crypto6 = require("node:crypto");
20652
+ var import_node_crypto5 = require("node:crypto");
20774
20653
  var import_node_fs22 = require("node:fs");
20775
20654
  var import_node_path20 = require("node:path");
20776
20655
  var CRC_TABLE = (() => {
@@ -20812,7 +20691,7 @@ function nextSeq() {
20812
20691
  function encodeEvent(ev) {
20813
20692
  const full = {
20814
20693
  v: 1,
20815
- id: (0, import_node_crypto6.randomBytes)(4).toString("hex"),
20694
+ id: (0, import_node_crypto5.randomBytes)(4).toString("hex"),
20816
20695
  ...ev
20817
20696
  };
20818
20697
  let body2 = JSON.stringify(full);
@@ -20883,7 +20762,7 @@ function rotateIfNeeded2(d) {
20883
20762
  }
20884
20763
 
20885
20764
  // src/lib/dossier/fold-dossier.ts
20886
- var import_node_crypto7 = require("node:crypto");
20765
+ var import_node_crypto6 = require("node:crypto");
20887
20766
  var import_node_fs23 = require("node:fs");
20888
20767
  var import_node_path21 = require("node:path");
20889
20768
  var EMPTY_CAPABILITIES = () => ({
@@ -20975,7 +20854,7 @@ function reduce(state, events, now) {
20975
20854
  state.meta.seq = Math.max(state.meta.seq, ev.seq);
20976
20855
  switch (ev.k) {
20977
20856
  case "goal": {
20978
- const hash = (0, import_node_crypto7.createHash)("sha256").update(ev.text).digest("hex").slice(0, 16);
20857
+ const hash = (0, import_node_crypto6.createHash)("sha256").update(ev.text).digest("hex").slice(0, 16);
20979
20858
  const prev = state.goal[state.goal.length - 1];
20980
20859
  if (prev && prev.hash === hash) {
20981
20860
  prev.repeats = (prev.repeats ?? 0) + 1;
@@ -21103,13 +20982,12 @@ function reduce(state, events, now) {
21103
20982
  break;
21104
20983
  }
21105
20984
  case "divergence": {
20985
+ state.divergence.counts[ev.kind] = (state.divergence.counts[ev.kind] ?? 0) + 1;
21106
20986
  state.divergence.events.push({ kind: ev.kind, path: ev.path, at: ev.at });
21107
- const keys = Array.isArray(ev.keys) ? ev.keys.filter((k) => typeof k === "string").map(packedDivergenceKey) : [divergenceKey(ev.path, ev.hash ?? null)];
21108
- for (const key of keys) {
21109
- if (seenDivergence.has(key)) continue;
20987
+ const key = divergenceKey(ev.path, ev.hash ?? null);
20988
+ if (!seenDivergence.has(key)) {
21110
20989
  seenDivergence.add(key);
21111
- state.divergence.seen.push(key);
21112
- state.divergence.counts[ev.kind] = (state.divergence.counts[ev.kind] ?? 0) + 1;
20990
+ if (state.divergence.seen.length < DIVERGENCE_SEEN_CAP) state.divergence.seen.push(key);
21113
20991
  }
21114
20992
  break;
21115
20993
  }
@@ -21416,14 +21294,14 @@ function assessContinuity(i2) {
21416
21294
  }
21417
21295
 
21418
21296
  // src/lib/dossier/reanchor.ts
21419
- var import_node_crypto8 = require("node:crypto");
21297
+ var import_node_crypto7 = require("node:crypto");
21420
21298
  var import_node_fs25 = require("node:fs");
21421
21299
  function lineSha(text) {
21422
- return (0, import_node_crypto8.createHash)("sha256").update(text.trim()).digest("hex").slice(0, HASH_WIDTH);
21300
+ return (0, import_node_crypto7.createHash)("sha256").update(text.trim()).digest("hex").slice(0, HASH_WIDTH);
21423
21301
  }
21424
21302
  function fileHash(path) {
21425
21303
  try {
21426
- return (0, import_node_crypto8.createHash)("sha256").update((0, import_node_fs25.readFileSync)(path)).digest("hex").slice(0, HASH_WIDTH);
21304
+ return (0, import_node_crypto7.createHash)("sha256").update((0, import_node_fs25.readFileSync)(path)).digest("hex").slice(0, HASH_WIDTH);
21427
21305
  } catch {
21428
21306
  return null;
21429
21307
  }
@@ -21920,7 +21798,7 @@ function recordTurn(d, t) {
21920
21798
  // Identity is the COMMAND, not its category — otherwise `npm test -- a` and
21921
21799
  // `npm test -- b` are one row and the streak counts two different commands
21922
21800
  // as a run of one.
21923
- cmd_hash: (0, import_node_crypto9.createHash)("sha256").update(c.head || c.class).digest("hex").slice(0, 12),
21801
+ cmd_hash: (0, import_node_crypto8.createHash)("sha256").update(c.head || c.class).digest("hex").slice(0, 12),
21924
21802
  head: c.head || c.class,
21925
21803
  status: toStatus(c.last_status)
21926
21804
  });
@@ -21938,23 +21816,10 @@ function recordTurn(d, t) {
21938
21816
  }
21939
21817
  }
21940
21818
  const seenDivergence = t.known?.divergence ?? /* @__PURE__ */ new Set();
21941
- const fresh = [];
21942
21819
  for (const u of t.unobserved) {
21943
21820
  const hash = fileHash((0, import_node_path22.join)(root, u.p));
21944
- const key = divergenceKey(u.p, hash);
21945
- const digest = packedDivergenceDigest(key);
21946
- if (seenDivergence.has(key) || seenDivergence.has(packedDivergenceKey(digest))) continue;
21947
- fresh.push({ path: u.p, hash, digest });
21948
- }
21949
- if (fresh.length > DIVERGENCE_BULK_AT) {
21950
- for (let i2 = 0; i2 < fresh.length; i2 += DIVERGENCE_KEYS_PER_LINE) {
21951
- const slice2 = fresh.slice(i2, i2 + DIVERGENCE_KEYS_PER_LINE);
21952
- appendEvent(d, { k: "divergence", kind: "external_mutation", path: slice2[0].path, keys: slice2.map((f) => f.digest) });
21953
- }
21954
- } else {
21955
- for (const f of fresh) {
21956
- appendEvent(d, { k: "divergence", kind: "external_mutation", path: f.path, hash: f.hash });
21957
- }
21821
+ if (seenDivergence.has(divergenceKey(u.p, hash))) continue;
21822
+ appendEvent(d, { k: "divergence", kind: "external_mutation", path: u.p, hash });
21958
21823
  }
21959
21824
  const newCompactions = (t.compactions ?? 0) - (t.known?.compactions ?? 0);
21960
21825
  for (let i2 = 0; i2 < newCompactions; i2++) {
@@ -22219,7 +22084,7 @@ async function fireClassify(prompt, sessionId, globals) {
22219
22084
  logEvent("classify_skipped", { reason: "no_service_url", detail: urlResult.error });
22220
22085
  return;
22221
22086
  }
22222
- const promptHash = (0, import_node_crypto10.createHash)("sha256").update(prompt).digest("hex");
22087
+ const promptHash = (0, import_node_crypto9.createHash)("sha256").update(prompt).digest("hex");
22223
22088
  const result = await apiRequest({
22224
22089
  method: "POST",
22225
22090
  path: "/classify-task",
@@ -22263,7 +22128,7 @@ var import_node_path26 = require("node:path");
22263
22128
  // src/lib/baseline.ts
22264
22129
  var import_node_fs28 = require("node:fs");
22265
22130
  var import_node_path25 = require("node:path");
22266
- var import_node_crypto11 = require("node:crypto");
22131
+ var import_node_crypto10 = require("node:crypto");
22267
22132
 
22268
22133
  // src/lib/snapshot.ts
22269
22134
  var import_node_fs27 = require("node:fs");
@@ -22532,7 +22397,7 @@ var MIRROR_MAX_BYTES = 2 * 1024 * 1024;
22532
22397
  var DEFAULT_SESSION_KEY = "_default";
22533
22398
  function sessionKey(sessionId) {
22534
22399
  if (!sessionId) return DEFAULT_SESSION_KEY;
22535
- return (0, import_node_crypto11.createHash)("sha256").update(sessionId).digest("hex").slice(0, 16);
22400
+ return (0, import_node_crypto10.createHash)("sha256").update(sessionId).digest("hex").slice(0, 16);
22536
22401
  }
22537
22402
  function sessionDir(key) {
22538
22403
  return (0, import_node_path25.join)(projectPath(BASELINE_DIR), key);
@@ -22994,17 +22859,17 @@ async function readHookStdin() {
22994
22859
  try {
22995
22860
  if (process.stdin.isTTY) return {};
22996
22861
  const chunks = [];
22997
- const timeout = new Promise((resolve9) => setTimeout(() => resolve9({}), 500));
22998
- const read2 = new Promise((resolve9) => {
22862
+ const timeout = new Promise((resolve8) => setTimeout(() => resolve8({}), 500));
22863
+ const read2 = new Promise((resolve8) => {
22999
22864
  process.stdin.on("data", (c) => chunks.push(c));
23000
22865
  process.stdin.on("end", () => {
23001
22866
  try {
23002
- resolve9(JSON.parse(Buffer.concat(chunks).toString("utf-8").trim() || "{}"));
22867
+ resolve8(JSON.parse(Buffer.concat(chunks).toString("utf-8").trim() || "{}"));
23003
22868
  } catch {
23004
- resolve9({});
22869
+ resolve8({});
23005
22870
  }
23006
22871
  });
23007
- process.stdin.on("error", () => resolve9({}));
22872
+ process.stdin.on("error", () => resolve8({}));
23008
22873
  process.stdin.resume();
23009
22874
  });
23010
22875
  return await Promise.race([read2, timeout]);
@@ -23100,7 +22965,7 @@ function isIgnored2(path) {
23100
22965
  }
23101
22966
  function listProjectFiles(root) {
23102
22967
  try {
23103
- const out2 = (0, import_node_child_process9.execSync)("git ls-files -z --cached --others --exclude-standard", {
22968
+ const out2 = (0, import_node_child_process9.execSync)("git ls-files -z", {
23104
22969
  cwd: root,
23105
22970
  encoding: "utf-8",
23106
22971
  maxBuffer: 32 * 1024 * 1024,
@@ -24452,10 +24317,10 @@ var import_node_fs38 = require("node:fs");
24452
24317
 
24453
24318
  // src/lib/debounce.ts
24454
24319
  var import_node_fs37 = require("node:fs");
24455
- var import_node_crypto12 = require("node:crypto");
24320
+ var import_node_crypto11 = require("node:crypto");
24456
24321
  function scopedFile(base, sessionId) {
24457
24322
  if (!sessionId) return base;
24458
- return `${base}.${(0, import_node_crypto12.createHash)("sha1").update(sessionId).digest("hex").slice(0, 12)}`;
24323
+ return `${base}.${(0, import_node_crypto11.createHash)("sha1").update(sessionId).digest("hex").slice(0, 12)}`;
24459
24324
  }
24460
24325
  function checkDebounce(debounceSeconds = DEBOUNCE_SECONDS, sessionId) {
24461
24326
  const file = scopedFile(DEBOUNCE_FILE, sessionId);
@@ -24496,7 +24361,7 @@ function checkMtime(files, bypassForRecentCommits, sessionId) {
24496
24361
  return "No files modified since last analysis";
24497
24362
  }
24498
24363
  function computeContentHash(files) {
24499
- const hash = (0, import_node_crypto12.createHash)("sha1");
24364
+ const hash = (0, import_node_crypto11.createHash)("sha1");
24500
24365
  const sorted = [...files].sort();
24501
24366
  for (const f of sorted) {
24502
24367
  const resolved = resolveFile(f) ?? f;
@@ -24952,56 +24817,20 @@ function registerStatusCommand(program2) {
24952
24817
  });
24953
24818
  }
24954
24819
 
24955
- // src/lib/text-input.ts
24956
- var import_node_fs39 = require("node:fs");
24957
- var MAX_STDIN_BYTES = 64 * 1024;
24958
- function readTextInput(value, flag, readStdin2 = () => (0, import_node_fs39.readFileSync)(0)) {
24959
- if (value !== "-") return { ok: true, text: value };
24960
- let raw;
24961
- try {
24962
- raw = readStdin2();
24963
- } catch (err2) {
24964
- return { ok: false, error: `Could not read ${flag} from stdin: ${err2.message}` };
24965
- }
24966
- if (raw.length > MAX_STDIN_BYTES) {
24967
- return { ok: false, error: `${flag} from stdin is ${raw.length} bytes; the limit is ${MAX_STDIN_BYTES}.` };
24968
- }
24969
- const text = raw.toString("utf8").replace(/\r?\n$/, "");
24970
- if (!text.trim()) return { ok: false, error: `${flag} from stdin is empty.` };
24971
- return { ok: true, text };
24972
- }
24973
-
24974
- // src/lib/terminal-text.ts
24975
- var CONTROL = /[\x00-\x08\x0b-\x1f\x7f-\x9f\u061c\u200e\u200f\u2028-\u202e\u2066-\u2069]/g;
24976
- function terminalText(value, max = 4e3) {
24977
- if (typeof value !== "string") return "";
24978
- const clean2 = value.replace(CONTROL, "");
24979
- return clean2.length > max ? `${clean2.slice(0, max - 1)}\u2026` : clean2;
24980
- }
24981
- function terminalUrl(value) {
24982
- const clean2 = terminalText(value, 2e3);
24983
- return /^https?:\/\/\S+$/.test(clean2) ? clean2 : "";
24984
- }
24985
-
24986
24820
  // src/commands/feedback.ts
24987
24821
  function registerFeedbackCommand(program2) {
24988
24822
  const feedbackCmd = program2.command("feedback").description("Send feedback to the Verity team");
24989
- 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 (text, opts) => {
24990
- await sendMessageArg(text, opts, program2.opts());
24823
+ feedbackCmd.command("message <text>").description("Send general feedback").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (message, opts) => {
24824
+ const globals = program2.opts();
24825
+ await sendGeneralFeedback(message, opts, globals);
24991
24826
  });
24992
- 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) => {
24827
+ feedbackCmd.command("finding <run-id> <pattern-id> <action> [note]").description("Submit per-finding feedback (false_positive, acknowledged, useful, etc.)").option("--file <path>", "File path the finding applies to").option("--line <n>", "Line number", parseInt).action(async (runId, patternId, action, note, opts) => {
24993
24828
  const globals = program2.opts();
24994
24829
  const validActions = ["false_positive", "acknowledged", "will_fix_later", "wrong_severity", "useful"];
24995
24830
  if (!validActions.includes(action)) {
24996
24831
  printError(`Invalid action "${action}". Must be one of: ${validActions.join(", ")}`);
24997
24832
  process.exit(1);
24998
24833
  }
24999
- const noteInput = readTextInput(inlineNote, "the note");
25000
- if (!noteInput.ok) {
25001
- printError(noteInput.error);
25002
- process.exit(1);
25003
- }
25004
- const note = noteInput.text;
25005
24834
  const tokenResult = await resolveToken(globals.token);
25006
24835
  if (!tokenResult.ok) {
25007
24836
  printError(tokenResult.error);
@@ -25037,28 +24866,21 @@ function registerFeedbackCommand(program2) {
25037
24866
  });
25038
24867
  feedbackCmd.argument("[message]", "Feedback message (for backwards compat)").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (message, opts) => {
25039
24868
  if (!message) return;
25040
- await sendMessageArg(message, opts, program2.opts());
24869
+ const globals = program2.opts();
24870
+ await sendGeneralFeedback(message, opts, globals);
25041
24871
  });
25042
24872
  }
25043
- async function sendMessageArg(arg, opts, globals) {
25044
- const input = readTextInput(arg, "the message");
25045
- if (!input.ok || !input.text) {
25046
- printError(input.ok ? "Nothing to send." : input.error);
25047
- process.exit(1);
25048
- }
25049
- await sendGeneralFeedback(input.text, opts, globals);
25050
- }
25051
24873
  async function sendGeneralFeedback(message, opts, globals) {
25052
24874
  const tokenResult = await resolveToken(globals.token);
25053
24875
  if (!tokenResult.ok) {
25054
24876
  printError(tokenResult.error);
25055
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24877
+ printInfo(`Your message: ${message}`);
25056
24878
  process.exit(1);
25057
24879
  }
25058
24880
  const urlResult = await resolveServiceUrl(globals.serviceUrl);
25059
24881
  if (!urlResult.ok) {
25060
24882
  printError(urlResult.error);
25061
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24883
+ printInfo(`Your message: ${message}`);
25062
24884
  process.exit(1);
25063
24885
  }
25064
24886
  const body2 = { message };
@@ -25076,7 +24898,7 @@ async function sendGeneralFeedback(message, opts, globals) {
25076
24898
  });
25077
24899
  if (!result.ok) {
25078
24900
  printError(`Couldn't send feedback: ${result.error}`);
25079
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24901
+ printInfo(`Your message: ${message}`);
25080
24902
  process.exit(1);
25081
24903
  }
25082
24904
  printInfo("Thanks, feedback sent!");
@@ -25161,8 +24983,7 @@ function createRun(opts, globals) {
25161
24983
  }
25162
24984
 
25163
24985
  // src/commands/analyze/index.ts
25164
- var import_node_fs53 = require("node:fs");
25165
- var import_node_path40 = require("node:path");
24986
+ var import_node_fs52 = require("node:fs");
25166
24987
 
25167
24988
  // src/lib/repo-context.ts
25168
24989
  var import_node_child_process11 = require("node:child_process");
@@ -26126,7 +25947,7 @@ function installRunEvidence(run4) {
26126
25947
  }
26127
25948
 
26128
25949
  // src/lib/git-frame.ts
26129
- var import_node_fs40 = require("node:fs");
25950
+ var import_node_fs39 = require("node:fs");
26130
25951
  var import_node_os6 = require("node:os");
26131
25952
  var import_node_path30 = require("node:path");
26132
25953
  var import_node_path31 = require("node:path");
@@ -26296,14 +26117,14 @@ function gitAt(dir, args2) {
26296
26117
  }
26297
26118
  function realpathOr2(p) {
26298
26119
  try {
26299
- return import_node_fs40.realpathSync.native(p);
26120
+ return import_node_fs39.realpathSync.native(p);
26300
26121
  } catch {
26301
26122
  return (0, import_node_path30.resolve)(p);
26302
26123
  }
26303
26124
  }
26304
26125
  function resolveFrame(input) {
26305
26126
  const found = findMomentSegment(input.command, input.on);
26306
- const hookDirUsable = !!input.hookCwd && (0, import_node_fs40.existsSync)(input.hookCwd);
26127
+ const hookDirUsable = !!input.hookCwd && (0, import_node_fs39.existsSync)(input.hookCwd);
26307
26128
  const baseDir = hookDirUsable ? input.hookCwd : process.cwd();
26308
26129
  let anchor = hookDirUsable ? "hook-cwd" : "process-cwd";
26309
26130
  const refuse = (refusal) => ({
@@ -26326,7 +26147,7 @@ function resolveFrame(input) {
26326
26147
  if (dirs.size > 1) return refuse(`target:multiple ${found.moment} targets in one command`);
26327
26148
  const targetDir = dirs.size === 1 ? [...dirs][0] : baseDir;
26328
26149
  if (targetDir !== baseDir) {
26329
- if (!(0, import_node_fs40.existsSync)(targetDir)) return refuse(`target:directory does not exist: ${targetDir}`);
26150
+ if (!(0, import_node_fs39.existsSync)(targetDir)) return refuse(`target:directory does not exist: ${targetDir}`);
26330
26151
  dir = targetDir;
26331
26152
  }
26332
26153
  }
@@ -26513,7 +26334,7 @@ function stagedRange(frame, command) {
26513
26334
  return { kind: "staged", base: "HEAD", head: "INDEX", via: "staged-in-command", refusal: plan.reason };
26514
26335
  }
26515
26336
  const mergeHead = frame.gitDir ? (0, import_node_path31.join)(frame.gitDir, "MERGE_HEAD") : null;
26516
- if (mergeHead && (0, import_node_fs40.existsSync)(mergeHead)) {
26337
+ if (mergeHead && (0, import_node_fs39.existsSync)(mergeHead)) {
26517
26338
  const vsHead = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "HEAD"]).split("\n").filter(Boolean));
26518
26339
  const vsMerge = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "MERGE_HEAD"]).split("\n").filter(Boolean));
26519
26340
  const resolutions = new Set([...vsHead].filter((f) => vsMerge.has(f) && !isVerityOwnedPath(f)));
@@ -26647,7 +26468,7 @@ function truthy(v) {
26647
26468
  }
26648
26469
 
26649
26470
  // src/lib/transcript.ts
26650
- var import_node_fs41 = require("node:fs");
26471
+ var import_node_fs40 = require("node:fs");
26651
26472
  var MAX_READ_BYTES = 256 * 1024;
26652
26473
  var SMALL_FILE_BYTES = 64 * 1024;
26653
26474
  var MAX_FILES_LIST = 20;
@@ -26674,7 +26495,7 @@ async function extractActionSummary(transcriptPath) {
26674
26495
  function readTurnLines(transcriptPath) {
26675
26496
  let size;
26676
26497
  try {
26677
- size = (0, import_node_fs41.statSync)(transcriptPath).size;
26498
+ size = (0, import_node_fs40.statSync)(transcriptPath).size;
26678
26499
  } catch {
26679
26500
  return null;
26680
26501
  }
@@ -26682,7 +26503,7 @@ function readTurnLines(transcriptPath) {
26682
26503
  let raw;
26683
26504
  let windowed = false;
26684
26505
  if (size <= SMALL_FILE_BYTES) {
26685
- raw = (0, import_node_fs41.readFileSync)(transcriptPath, "utf-8");
26506
+ raw = (0, import_node_fs40.readFileSync)(transcriptPath, "utf-8");
26686
26507
  } else {
26687
26508
  windowed = true;
26688
26509
  const buf = Buffer.alloc(Math.min(MAX_READ_BYTES, size));
@@ -26928,7 +26749,7 @@ function sanitizeCommandWithLoss(rawCmd) {
26928
26749
  const lost = lines.slice(1).some((l) => l.trim().length > 0);
26929
26750
  const first = lines[0];
26930
26751
  const cmd = sanitizeCommand(first);
26931
- const hadSeparator = SEPARATORS.some((sep6) => first.indexOf(sep6) > 0);
26752
+ const hadSeparator = SEPARATORS.some((sep5) => first.indexOf(sep5) > 0);
26932
26753
  return { cmd, lost: lost || !hadSeparator && first.length > MAX_COMMAND_CHARS };
26933
26754
  }
26934
26755
  var SEPARATORS = [" | ", " > ", " >> ", " 2>", " && ", " ; "];
@@ -26937,11 +26758,11 @@ function sanitizeCommand(rawCmd) {
26937
26758
  let cmd = rawCmd.split("\n")[0];
26938
26759
  let cut = -1;
26939
26760
  let marker = "";
26940
- for (const sep6 of SEPARATORS) {
26941
- const idx = cmd.indexOf(sep6);
26761
+ for (const sep5 of SEPARATORS) {
26762
+ const idx = cmd.indexOf(sep5);
26942
26763
  if (idx > 0 && (cut === -1 || idx < cut)) {
26943
26764
  cut = idx;
26944
- marker = sep6.trim();
26765
+ marker = sep5.trim();
26945
26766
  }
26946
26767
  }
26947
26768
  if (cut > -1) cmd = cmd.slice(0, cut);
@@ -26965,28 +26786,28 @@ async function readStopHookStdin() {
26965
26786
  try {
26966
26787
  if (process.stdin.isTTY) return empty;
26967
26788
  const chunks = [];
26968
- const timeout = new Promise((resolve9) => setTimeout(() => resolve9(empty), 500));
26969
- const read2 = new Promise((resolve9) => {
26789
+ const timeout = new Promise((resolve8) => setTimeout(() => resolve8(empty), 500));
26790
+ const read2 = new Promise((resolve8) => {
26970
26791
  process.stdin.on("data", (chunk) => chunks.push(chunk));
26971
26792
  process.stdin.on("end", () => {
26972
26793
  const raw = Buffer.concat(chunks).toString("utf-8").trim();
26973
26794
  if (!raw) {
26974
- resolve9(empty);
26795
+ resolve8(empty);
26975
26796
  return;
26976
26797
  }
26977
26798
  try {
26978
26799
  const data = JSON.parse(raw);
26979
- resolve9({
26800
+ resolve8({
26980
26801
  assistantMessage: typeof data.last_assistant_message === "string" ? data.last_assistant_message : null,
26981
26802
  stopReason: typeof data.stop_reason === "string" ? data.stop_reason : null,
26982
26803
  transcriptPath: typeof data.transcript_path === "string" ? data.transcript_path : null,
26983
26804
  sessionId: typeof data.session_id === "string" ? data.session_id : null
26984
26805
  });
26985
26806
  } catch {
26986
- resolve9(empty);
26807
+ resolve8(empty);
26987
26808
  }
26988
26809
  });
26989
- process.stdin.on("error", () => resolve9(empty));
26810
+ process.stdin.on("error", () => resolve8(empty));
26990
26811
  process.stdin.resume();
26991
26812
  });
26992
26813
  return await Promise.race([read2, timeout]);
@@ -27252,7 +27073,7 @@ function channelSilence(input) {
27252
27073
  // src/lib/cli-version.ts
27253
27074
  function cliVersion() {
27254
27075
  try {
27255
- return true ? "0.34.0-experimental.85ad809" : "dev";
27076
+ return true ? "0.34.0-experimental.9001e08" : "dev";
27256
27077
  } catch {
27257
27078
  return "dev";
27258
27079
  }
@@ -27293,171 +27114,7 @@ async function sendSkipBeacon(ctx, reason) {
27293
27114
 
27294
27115
  // src/lib/static-analysis.ts
27295
27116
  var import_node_child_process12 = require("node:child_process");
27296
- var import_node_fs42 = require("node:fs");
27297
-
27298
- // src/lib/environment-globals.ts
27299
- var NODE = [
27300
- "process",
27301
- "Buffer",
27302
- "global",
27303
- "require",
27304
- "module",
27305
- "exports",
27306
- "__dirname",
27307
- "__filename",
27308
- "console",
27309
- "setTimeout",
27310
- "clearTimeout",
27311
- "setInterval",
27312
- "clearInterval",
27313
- "setImmediate",
27314
- "clearImmediate",
27315
- "queueMicrotask",
27316
- "structuredClone",
27317
- "performance",
27318
- "fetch",
27319
- "Request",
27320
- "Response",
27321
- "Headers",
27322
- "FormData",
27323
- "Blob",
27324
- "File",
27325
- "URL",
27326
- "URLSearchParams",
27327
- "TextEncoder",
27328
- "TextDecoder",
27329
- "TextEncoderStream",
27330
- "TextDecoderStream",
27331
- "AbortController",
27332
- "AbortSignal",
27333
- "Event",
27334
- "EventTarget",
27335
- "CustomEvent",
27336
- "MessageChannel",
27337
- "MessagePort",
27338
- "MessageEvent",
27339
- "BroadcastChannel",
27340
- "WebSocket",
27341
- "WebAssembly",
27342
- "crypto",
27343
- "Crypto",
27344
- "CryptoKey",
27345
- "SubtleCrypto",
27346
- "atob",
27347
- "btoa",
27348
- "navigator",
27349
- "DOMException",
27350
- "ReadableStream",
27351
- "WritableStream",
27352
- "TransformStream",
27353
- "CompressionStream",
27354
- "DecompressionStream",
27355
- "ByteLengthQueuingStrategy",
27356
- "CountQueuingStrategy",
27357
- "PerformanceObserver",
27358
- "PerformanceEntry",
27359
- "PerformanceMark",
27360
- "PerformanceMeasure"
27361
- ];
27362
- var BROWSER = [
27363
- "window",
27364
- "self",
27365
- "document",
27366
- "location",
27367
- "history",
27368
- "localStorage",
27369
- "sessionStorage",
27370
- "screen",
27371
- "alert",
27372
- "confirm",
27373
- "prompt",
27374
- "requestAnimationFrame",
27375
- "cancelAnimationFrame",
27376
- "requestIdleCallback",
27377
- "cancelIdleCallback",
27378
- "getComputedStyle",
27379
- "matchMedia",
27380
- "getSelection",
27381
- "scrollTo",
27382
- "scrollBy",
27383
- "innerWidth",
27384
- "innerHeight",
27385
- "outerWidth",
27386
- "outerHeight",
27387
- "devicePixelRatio",
27388
- "visualViewport",
27389
- "postMessage",
27390
- "addEventListener",
27391
- "removeEventListener",
27392
- "dispatchEvent",
27393
- "customElements",
27394
- "indexedDB",
27395
- "IDBKeyRange",
27396
- "caches",
27397
- "XMLHttpRequest",
27398
- "EventSource",
27399
- "FileReader",
27400
- "Image",
27401
- "Audio",
27402
- "Worker",
27403
- "SharedWorker",
27404
- "Notification",
27405
- "MutationObserver",
27406
- "IntersectionObserver",
27407
- "ResizeObserver",
27408
- "DOMParser",
27409
- "XMLSerializer",
27410
- "Node",
27411
- "Element",
27412
- "HTMLElement",
27413
- "SVGElement",
27414
- "NodeList",
27415
- "HTMLCollection",
27416
- "DocumentFragment",
27417
- "ShadowRoot",
27418
- "Range",
27419
- "Selection",
27420
- "KeyboardEvent",
27421
- "MouseEvent",
27422
- "PointerEvent",
27423
- "FocusEvent",
27424
- "InputEvent",
27425
- "TouchEvent",
27426
- "UIEvent",
27427
- "ErrorEvent",
27428
- "ProgressEvent",
27429
- "StorageEvent",
27430
- "CloseEvent",
27431
- "CSS",
27432
- "CSSStyleSheet",
27433
- "FontFace",
27434
- "ImageData",
27435
- "ImageBitmap",
27436
- "createImageBitmap",
27437
- "OffscreenCanvas",
27438
- "Path2D",
27439
- "CanvasRenderingContext2D",
27440
- "AudioContext",
27441
- "MediaStream",
27442
- "MediaRecorder",
27443
- "RTCPeerConnection",
27444
- "ClipboardItem",
27445
- "isSecureContext",
27446
- "crossOriginIsolated",
27447
- "reportError",
27448
- "speechSynthesis"
27449
- ];
27450
- var ENVIRONMENT_GLOBALS = /* @__PURE__ */ new Set([...NODE, ...BROWSER]);
27451
- var NOT_DEFINED = /^'([^']+)' is not defined\.?$/;
27452
- var COMMONJS_ONLY = /* @__PURE__ */ new Set(["require", "module", "exports", "__dirname", "__filename"]);
27453
- function isEnvironmentGlobalNoUndef(ruleId, message, filePath = "") {
27454
- if (!/(^|_)no-undef$/.test(ruleId)) return false;
27455
- const name2 = message.trim().match(NOT_DEFINED)?.[1];
27456
- if (name2 === void 0 || !ENVIRONMENT_GLOBALS.has(name2)) return false;
27457
- return !(COMMONJS_ONLY.has(name2) && /\.m[jt]s$/.test(filePath));
27458
- }
27459
-
27460
- // src/lib/static-analysis.ts
27117
+ var import_node_fs41 = require("node:fs");
27461
27118
  var SEVERITY_ORDER = {
27462
27119
  Error: 0,
27463
27120
  Critical: 0,
@@ -27513,7 +27170,7 @@ function runCodacyAnalysis(files) {
27513
27170
  if (files.length === 0) return empty;
27514
27171
  const existingFiles = files.filter((f) => {
27515
27172
  try {
27516
- return (0, import_node_fs42.existsSync)(f);
27173
+ return (0, import_node_fs41.existsSync)(f);
27517
27174
  } catch {
27518
27175
  return false;
27519
27176
  }
@@ -27545,10 +27202,7 @@ function interpretAnalyzerRun(run4) {
27545
27202
  } catch {
27546
27203
  return withFailure("unparseable_output", output);
27547
27204
  }
27548
- const reported = parsed.issues ?? [];
27549
- const issues = reported.filter(
27550
- (i2) => !isEnvironmentGlobalNoUndef(i2.patternId ?? "", i2.message ?? "", i2.filePath ?? "")
27551
- );
27205
+ const issues = parsed.issues ?? [];
27552
27206
  const findings = issues.map((issue) => ({
27553
27207
  rule_id: issue.patternId ?? "",
27554
27208
  tool: issue.toolId ?? "",
@@ -27571,7 +27225,7 @@ function interpretAnalyzerRun(run4) {
27571
27225
  );
27572
27226
  const analyzerErrors = parsed.errors ?? [];
27573
27227
  let failure;
27574
- if (reported.length === 0) {
27228
+ if (findings.length === 0) {
27575
27229
  if (analyzerErrors.length > 0) {
27576
27230
  const first = analyzerErrors[0];
27577
27231
  failure = {
@@ -27785,7 +27439,7 @@ async function scope(run4) {
27785
27439
  }
27786
27440
 
27787
27441
  // src/lib/specs.ts
27788
- var import_node_fs43 = require("node:fs");
27442
+ var import_node_fs42 = require("node:fs");
27789
27443
  var import_node_path32 = require("node:path");
27790
27444
  var SPEC_CANDIDATES = [
27791
27445
  "CLAUDE.md",
@@ -27827,7 +27481,7 @@ function discoverSpecs(consulted = []) {
27827
27481
  const totalCap = relevant ? MAX_TOTAL_SPEC_BYTES : UNCONSULTED_TOTAL_BYTES;
27828
27482
  if (totalBytes >= totalCap) return false;
27829
27483
  if (seen.has(specPath)) return true;
27830
- if (!(0, import_node_fs43.existsSync)(specPath)) return true;
27484
+ if (!(0, import_node_fs42.existsSync)(specPath)) return true;
27831
27485
  seen.add(specPath);
27832
27486
  const remaining = totalCap - totalBytes;
27833
27487
  const fileCap = relevant ? MAX_SPEC_FILE_BYTES : UNCONSULTED_FILE_BYTES;
@@ -27850,7 +27504,7 @@ function discoverSpecs(consulted = []) {
27850
27504
  if (!addSpec(candidate)) break;
27851
27505
  }
27852
27506
  for (const dir of ["spec", "docs"]) {
27853
- if (!(0, import_node_fs43.existsSync)(dir)) continue;
27507
+ if (!(0, import_node_fs42.existsSync)(dir)) continue;
27854
27508
  try {
27855
27509
  const mdFiles = findMdFiles(dir, 2).sort();
27856
27510
  for (const mdFile of mdFiles) {
@@ -27865,7 +27519,7 @@ function findMdFiles(dir, maxDepth, depth = 0) {
27865
27519
  if (depth >= maxDepth) return [];
27866
27520
  const result = [];
27867
27521
  try {
27868
- const entries = (0, import_node_fs43.readdirSync)(dir, { withFileTypes: true });
27522
+ const entries = (0, import_node_fs42.readdirSync)(dir, { withFileTypes: true });
27869
27523
  for (const entry of entries) {
27870
27524
  const fullPath = (0, import_node_path32.join)(dir, entry.name);
27871
27525
  if (entry.isFile() && entry.name.endsWith(".md")) {
@@ -27885,13 +27539,13 @@ function discoverPlans() {
27885
27539
  if (isRealDirectoryChain(process.cwd(), [".claude", "plans"])) {
27886
27540
  sources.push({ root: process.cwd(), prefix: (0, import_node_path32.join)(".claude", "plans") });
27887
27541
  }
27888
- if (home && (0, import_node_fs43.existsSync)(homePlansDir)) sources.push({ root: homePlansDir, prefix: "" });
27542
+ if (home && (0, import_node_fs42.existsSync)(homePlansDir)) sources.push({ root: homePlansDir, prefix: "" });
27889
27543
  const candidates2 = [];
27890
27544
  const seen = /* @__PURE__ */ new Set();
27891
27545
  for (const source2 of sources) {
27892
27546
  let names2;
27893
27547
  try {
27894
- names2 = (0, import_node_fs43.readdirSync)(source2.prefix ? (0, import_node_path32.join)(source2.root, source2.prefix) : source2.root);
27548
+ names2 = (0, import_node_fs42.readdirSync)(source2.prefix ? (0, import_node_path32.join)(source2.root, source2.prefix) : source2.root);
27895
27549
  } catch {
27896
27550
  continue;
27897
27551
  }
@@ -27918,7 +27572,7 @@ function isRealDirectoryChain(root, parts2) {
27918
27572
  for (const part of parts2) {
27919
27573
  current = (0, import_node_path32.join)(current, part);
27920
27574
  try {
27921
- if (!(0, import_node_fs43.lstatSync)(current).isDirectory()) return false;
27575
+ if (!(0, import_node_fs42.lstatSync)(current).isDirectory()) return false;
27922
27576
  } catch {
27923
27577
  return false;
27924
27578
  }
@@ -27933,7 +27587,7 @@ function discoverGuardDocs(rangeFiles2) {
27933
27587
  if (result.length >= MAX_SPEC_FILES) break;
27934
27588
  if (!GUARD_DOC_EXT.test(path)) continue;
27935
27589
  if (path.startsWith("/") || path.includes("..")) continue;
27936
- if (!(0, import_node_fs43.existsSync)(path)) continue;
27590
+ if (!(0, import_node_fs42.existsSync)(path)) continue;
27937
27591
  const opened = openRegularInRoot(process.cwd(), path);
27938
27592
  if (!opened.ok) continue;
27939
27593
  if (opened.size > MAX_PLAN_FILE_BYTES || totalBytes + opened.size > MAX_TOTAL_SPEC_BYTES) {
@@ -28119,7 +27773,7 @@ async function mode(run4) {
28119
27773
  }
28120
27774
 
28121
27775
  // src/lib/fold.ts
28122
- var import_node_fs44 = require("node:fs");
27776
+ var import_node_fs43 = require("node:fs");
28123
27777
  var import_node_path33 = require("node:path");
28124
27778
  var KNOWN_RECORD_TYPES = /* @__PURE__ */ new Set([
28125
27779
  "user",
@@ -28257,7 +27911,7 @@ function candidateRoots(repoRoot2) {
28257
27911
  const norm2 = repoRoot2.replace(/\\/g, "/").replace(/\/+$/, "");
28258
27912
  const out2 = [norm2];
28259
27913
  try {
28260
- const real = import_node_fs44.realpathSync.native(norm2).replace(/\\/g, "/").replace(/\/+$/, "");
27914
+ const real = import_node_fs43.realpathSync.native(norm2).replace(/\\/g, "/").replace(/\/+$/, "");
28261
27915
  if (real !== norm2) out2.push(real);
28262
27916
  } catch {
28263
27917
  }
@@ -28345,8 +27999,8 @@ function fold(transcriptPath, opts = {}) {
28345
27999
  }
28346
28000
  };
28347
28001
  try {
28348
- if (!(0, import_node_fs44.existsSync)(transcriptPath)) return result;
28349
- ingest((0, import_node_fs44.readFileSync)(transcriptPath, "utf8"), "agent");
28002
+ if (!(0, import_node_fs43.existsSync)(transcriptPath)) return result;
28003
+ ingest((0, import_node_fs43.readFileSync)(transcriptPath, "utf8"), "agent");
28350
28004
  result.coverage.complete = true;
28351
28005
  } catch {
28352
28006
  return result;
@@ -28357,19 +28011,19 @@ function fold(transcriptPath, opts = {}) {
28357
28011
  (0, import_node_path33.basename)(transcriptPath).replace(/\.jsonl$/, ""),
28358
28012
  "subagents"
28359
28013
  );
28360
- if ((0, import_node_fs44.existsSync)(sidecarDir)) {
28014
+ if ((0, import_node_fs43.existsSync)(sidecarDir)) {
28361
28015
  const maxFiles = opts.maxSidecars ?? 200;
28362
28016
  const maxBytes = opts.maxSidecarBytes ?? 16 * 1024 * 1024;
28363
28017
  const found = [];
28364
28018
  const walk2 = (d, depth) => {
28365
28019
  if (depth > 4) return;
28366
- for (const e of (0, import_node_fs44.readdirSync)(d, { withFileTypes: true })) {
28020
+ for (const e of (0, import_node_fs43.readdirSync)(d, { withFileTypes: true })) {
28367
28021
  const p = (0, import_node_path33.join)(d, e.name);
28368
28022
  if (e.isDirectory()) {
28369
28023
  walk2(p, depth + 1);
28370
28024
  } else if (e.name.startsWith("agent-") && e.name.endsWith(".jsonl")) {
28371
28025
  try {
28372
- const st = (0, import_node_fs44.statSync)(p);
28026
+ const st = (0, import_node_fs43.statSync)(p);
28373
28027
  found.push({ path: p, size: st.size, mtimeMs: st.mtimeMs });
28374
28028
  } catch {
28375
28029
  result.coverage.malformed++;
@@ -28386,7 +28040,7 @@ function fold(transcriptPath, opts = {}) {
28386
28040
  continue;
28387
28041
  }
28388
28042
  try {
28389
- ingest((0, import_node_fs44.readFileSync)(f.path, "utf8"), "subagent");
28043
+ ingest((0, import_node_fs43.readFileSync)(f.path, "utf8"), "subagent");
28390
28044
  bytes += f.size;
28391
28045
  result.coverage.subagentFiles++;
28392
28046
  } catch {
@@ -28421,7 +28075,7 @@ function fold(transcriptPath, opts = {}) {
28421
28075
  }
28422
28076
  function classifyUnobserved(path) {
28423
28077
  try {
28424
- const st = (0, import_node_fs44.statSync)(path);
28078
+ const st = (0, import_node_fs43.statSync)(path);
28425
28079
  if (!st.isFile()) return "unreadable";
28426
28080
  } catch {
28427
28081
  return "unreadable";
@@ -28736,20 +28390,20 @@ async function evidence(run4) {
28736
28390
  }
28737
28391
 
28738
28392
  // src/lib/cache-cleanup.ts
28739
- var import_node_fs45 = require("node:fs");
28393
+ var import_node_fs44 = require("node:fs");
28740
28394
  var import_node_path34 = require("node:path");
28741
28395
  var CACHE_TTL_DAYS = 7;
28742
28396
  function pruneStaleCache() {
28743
28397
  try {
28744
28398
  const dir = projectPath(CACHE_DIR);
28745
28399
  const cutoff = Date.now() - CACHE_TTL_DAYS * 24 * 3600 * 1e3;
28746
- for (const entry of (0, import_node_fs45.readdirSync)(dir)) {
28400
+ for (const entry of (0, import_node_fs44.readdirSync)(dir)) {
28747
28401
  if (!entry.startsWith("pending-")) continue;
28748
28402
  const path = (0, import_node_path34.join)(dir, entry);
28749
28403
  try {
28750
- const stat3 = (0, import_node_fs45.statSync)(path);
28404
+ const stat3 = (0, import_node_fs44.statSync)(path);
28751
28405
  if (stat3.mtimeMs < cutoff) {
28752
- (0, import_node_fs45.unlinkSync)(path);
28406
+ (0, import_node_fs44.unlinkSync)(path);
28753
28407
  logEvent("cache_entry_pruned", {
28754
28408
  path: entry,
28755
28409
  age_days: Math.round((Date.now() - stat3.mtimeMs) / 864e5)
@@ -28763,7 +28417,7 @@ function pruneStaleCache() {
28763
28417
  }
28764
28418
 
28765
28419
  // src/lib/context-files.ts
28766
- var import_node_fs46 = require("node:fs");
28420
+ var import_node_fs45 = require("node:fs");
28767
28421
  var import_node_os7 = require("node:os");
28768
28422
  var MAX_CONTEXT_FILES = 10;
28769
28423
  var MAX_CONTEXT_FILE_BYTES = 10240;
@@ -28821,7 +28475,7 @@ function gatherContextFiles(contextPaths, deltaFiles, opts) {
28821
28475
  continue;
28822
28476
  }
28823
28477
  try {
28824
- const content = (0, import_node_fs46.readFileSync)(safePath, "utf8");
28478
+ const content = (0, import_node_fs45.readFileSync)(safePath, "utf8");
28825
28479
  const bytes = Buffer.byteLength(content);
28826
28480
  if (bytes > MAX_CONTEXT_FILE_BYTES) {
28827
28481
  logEvent("context_file_skipped", { path: filePath, reason: "too_large", bytes });
@@ -28887,7 +28541,7 @@ async function contextFiles(run4) {
28887
28541
  }
28888
28542
 
28889
28543
  // src/lib/code/index.ts
28890
- var import_node_crypto13 = require("node:crypto");
28544
+ var import_node_crypto12 = require("node:crypto");
28891
28545
 
28892
28546
  // src/lib/code/languages.ts
28893
28547
  var JS_LIKE = {
@@ -28979,7 +28633,7 @@ function languageOf2(path) {
28979
28633
  }
28980
28634
 
28981
28635
  // src/lib/code/runtime.ts
28982
- var import_node_fs47 = require("node:fs");
28636
+ var import_node_fs46 = require("node:fs");
28983
28637
  var import_node_path35 = require("node:path");
28984
28638
  var import_web_tree_sitter2 = __toESM2(require_web_tree_sitter2());
28985
28639
 
@@ -29051,7 +28705,7 @@ function grammarCandidates(file, pkg, env = process.env) {
29051
28705
  }
29052
28706
  function locateGrammar(id, env = process.env) {
29053
28707
  const g = grammars_default[id];
29054
- return grammarCandidates(g.file, g.package, env).find((p) => (0, import_node_fs47.existsSync)(p)) ?? null;
28708
+ return grammarCandidates(g.file, g.package, env).find((p) => (0, import_node_fs46.existsSync)(p)) ?? null;
29055
28709
  }
29056
28710
  var loading = null;
29057
28711
  function loadRuntime(env = process.env) {
@@ -30665,7 +30319,7 @@ function byPath(fns, name2) {
30665
30319
  function makeCodeMap(rt) {
30666
30320
  const cache = /* @__PURE__ */ new Map();
30667
30321
  const outline = (path, content, deadlineAt = Date.now() + DEFAULT_PARSE_MS) => {
30668
- const key = `${path}\0${(0, import_node_crypto13.createHash)("sha1").update(content).digest("hex")}`;
30322
+ const key = `${path}\0${(0, import_node_crypto12.createHash)("sha1").update(content).digest("hex")}`;
30669
30323
  const hit = cache.get(key);
30670
30324
  if (hit) return { source: "tree-sitter", value: hit, elapsedMs: 0 };
30671
30325
  let r;
@@ -31380,7 +31034,7 @@ async function repoContext(run4) {
31380
31034
 
31381
31035
  // src/lib/seed-runner.ts
31382
31036
  var import_promises15 = require("node:fs/promises");
31383
- var import_node_fs48 = require("node:fs");
31037
+ var import_node_fs47 = require("node:fs");
31384
31038
  var import_node_path36 = require("node:path");
31385
31039
  var import_yaml4 = __toESM2(require_dist());
31386
31040
 
@@ -31605,7 +31259,7 @@ async function localSeedTitles(memoryDir3 = MEMORY_DIR) {
31605
31259
  const titles = /* @__PURE__ */ new Set();
31606
31260
  for (const dir of NODE_DIRS) {
31607
31261
  const full = (0, import_node_path36.join)(memoryDir3, dir);
31608
- if (!(0, import_node_fs48.existsSync)(full)) continue;
31262
+ if (!(0, import_node_fs47.existsSync)(full)) continue;
31609
31263
  let files;
31610
31264
  try {
31611
31265
  files = await (0, import_promises15.readdir)(full);
@@ -31687,7 +31341,7 @@ function renderNodeMarkdown(candidate, nodeId, createdAt) {
31687
31341
  return fm;
31688
31342
  }
31689
31343
  async function runSeed(opts) {
31690
- if (!(0, import_node_fs48.existsSync)(STANDARD_FILE)) {
31344
+ if (!(0, import_node_fs47.existsSync)(STANDARD_FILE)) {
31691
31345
  return { created: 0, existing: 0, failed: 0, skipped: "no_standard", candidates: [] };
31692
31346
  }
31693
31347
  let standardDoc;
@@ -31699,7 +31353,7 @@ async function runSeed(opts) {
31699
31353
  }
31700
31354
  const knowledgeSpec = standardDoc.knowledge_spec ?? {};
31701
31355
  let readmeContent;
31702
- if ((0, import_node_fs48.existsSync)("README.md")) {
31356
+ if ((0, import_node_fs47.existsSync)("README.md")) {
31703
31357
  try {
31704
31358
  readmeContent = await (0, import_promises15.readFile)("README.md", "utf-8");
31705
31359
  } catch {
@@ -31707,7 +31361,7 @@ async function runSeed(opts) {
31707
31361
  }
31708
31362
  let claudeMdContent;
31709
31363
  for (const p of ["CLAUDE.md", ".claude/CLAUDE.md"]) {
31710
- if ((0, import_node_fs48.existsSync)(p)) {
31364
+ if ((0, import_node_fs47.existsSync)(p)) {
31711
31365
  try {
31712
31366
  claudeMdContent = await (0, import_promises15.readFile)(p, "utf-8");
31713
31367
  break;
@@ -31787,7 +31441,7 @@ async function runSeed(opts) {
31787
31441
  continue;
31788
31442
  }
31789
31443
  const deduplicated = res.data.deduplicated === true;
31790
- if (deduplicated && (0, import_node_fs48.existsSync)(targetPath)) {
31444
+ if (deduplicated && (0, import_node_fs47.existsSync)(targetPath)) {
31791
31445
  existing++;
31792
31446
  continue;
31793
31447
  }
@@ -31809,7 +31463,7 @@ async function runSeed(opts) {
31809
31463
  }
31810
31464
 
31811
31465
  // src/commands/analyze/phases/08-memory-manifest.ts
31812
- var import_node_fs49 = require("node:fs");
31466
+ var import_node_fs48 = require("node:fs");
31813
31467
  var import_node_path37 = require("node:path");
31814
31468
  async function memoryManifest(run4) {
31815
31469
  const { globals } = run4;
@@ -31821,8 +31475,8 @@ async function memoryManifest(run4) {
31821
31475
  try {
31822
31476
  await ensureMemoryDir();
31823
31477
  const seedMarker = (0, import_node_path37.join)(VERITY_DIR, ".seeded");
31824
- const hasStandard = (0, import_node_fs49.existsSync)(STANDARD_FILE);
31825
- const alreadyTried = (0, import_node_fs49.existsSync)(seedMarker);
31478
+ const hasStandard = (0, import_node_fs48.existsSync)(STANDARD_FILE);
31479
+ const alreadyTried = (0, import_node_fs48.existsSync)(seedMarker);
31826
31480
  if (hasStandard && !alreadyTried) {
31827
31481
  const preManifest = await buildManifest();
31828
31482
  if (preManifest.nodes.length === 0) {
@@ -31835,7 +31489,7 @@ async function memoryManifest(run4) {
31835
31489
  dryRun: false
31836
31490
  });
31837
31491
  if (seedResult.created > 0 || seedResult.existing > 0) {
31838
- (0, import_node_fs49.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created} existing=${seedResult.existing}
31492
+ (0, import_node_fs48.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created} existing=${seedResult.existing}
31839
31493
  `);
31840
31494
  if (seedResult.created > 0) {
31841
31495
  autoSeedNotice = `Seeded ${seedResult.created} knowledge node(s) from your existing Standard (one-time).`;
@@ -31846,7 +31500,7 @@ async function memoryManifest(run4) {
31846
31500
  failed: seedResult.failed
31847
31501
  });
31848
31502
  } else if (seedResult.skipped === "already_seeded") {
31849
- (0, import_node_fs49.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
31503
+ (0, import_node_fs48.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
31850
31504
  `);
31851
31505
  } else {
31852
31506
  logEvent("auto_seed_noop", {
@@ -32034,24 +31688,8 @@ async function workingMemory(run4) {
32034
31688
  Object.assign(run4, { incrementReport, memory: memory2, memorySession, reachability });
32035
31689
  }
32036
31690
 
32037
- // src/lib/payload-bounds.ts
32038
- var MAX_WIRE_PATHS = 500;
32039
- function boundPaths(paths, first, max = MAX_WIRE_PATHS) {
32040
- if (paths.length <= max) return [...paths];
32041
- const present = new Set(paths);
32042
- const kept = /* @__PURE__ */ new Set();
32043
- const out2 = [];
32044
- for (const p of [...first, ...paths]) {
32045
- if (out2.length >= max) break;
32046
- if (!present.has(p) || kept.has(p)) continue;
32047
- kept.add(p);
32048
- out2.push(p);
32049
- }
32050
- return out2;
32051
- }
32052
-
32053
31691
  // src/lib/note-budget.ts
32054
- var import_node_fs50 = require("node:fs");
31692
+ var import_node_fs49 = require("node:fs");
32055
31693
  var ADVISORY_BUDGET = { PASS: 1, WARN: 2 };
32056
31694
  var EPISODE_STALE_SECONDS = 30 * 60;
32057
31695
  var FRESH = { delivered: 0, tasksCompleted: 0, ts: 0 };
@@ -32073,9 +31711,9 @@ function advisoryBudgetSpent(episode, rawDecision) {
32073
31711
  }
32074
31712
  function readAdvisoryEpisode(sessionId) {
32075
31713
  const file = scopedFile(ADVISORY_EPISODE_FILE, sessionId);
32076
- if (!(0, import_node_fs50.existsSync)(file)) return null;
31714
+ if (!(0, import_node_fs49.existsSync)(file)) return null;
32077
31715
  try {
32078
- const o = JSON.parse((0, import_node_fs50.readFileSync)(file, "utf-8")) ?? {};
31716
+ const o = JSON.parse((0, import_node_fs49.readFileSync)(file, "utf-8")) ?? {};
32079
31717
  const delivered = typeof o.delivered === "number" ? o.delivered : NaN;
32080
31718
  if (isNaN(delivered)) return null;
32081
31719
  return {
@@ -32089,8 +31727,8 @@ function readAdvisoryEpisode(sessionId) {
32089
31727
  }
32090
31728
  function writeAdvisoryEpisode(episode, sessionId) {
32091
31729
  try {
32092
- (0, import_node_fs50.mkdirSync)(VERITY_DIR, { recursive: true });
32093
- (0, import_node_fs50.writeFileSync)(
31730
+ (0, import_node_fs49.mkdirSync)(VERITY_DIR, { recursive: true });
31731
+ (0, import_node_fs49.writeFileSync)(
32094
31732
  scopedFile(ADVISORY_EPISODE_FILE, sessionId),
32095
31733
  JSON.stringify({ v: 1, ...episode })
32096
31734
  );
@@ -32164,7 +31802,6 @@ async function buildRequest(run4) {
32164
31802
  (conversation?.prompts?.length ?? 0) > 0
32165
31803
  );
32166
31804
  const noteConfirmation = peekNoteOutcome();
32167
- const unobserved = foldResult?.unobserved ?? [];
32168
31805
  const excludedByReason = {};
32169
31806
  for (const e of codeDelta.excluded ?? []) {
32170
31807
  excludedByReason[e.reason] = (excludedByReason[e.reason] ?? 0) + 1;
@@ -32209,9 +31846,7 @@ async function buildRequest(run4) {
32209
31846
  coverage_telemetry: coverageTelemetry,
32210
31847
  static_results: staticResults,
32211
31848
  code_delta: codeDelta,
32212
- // Bounded, reviewed paths first — the server applies the same bound. The
32213
- // full count is `coverage_telemetry.for_review`. VRT-242.
32214
- changed_files: boundPaths(allForReview, codeDelta.files.map((f) => f.path)),
31849
+ changed_files: allForReview,
32215
31850
  standard_version: "latest",
32216
31851
  analysis_mode: analysisMode,
32217
31852
  plan_only: analysisMode === "plan",
@@ -32262,9 +31897,7 @@ async function buildRequest(run4) {
32262
31897
  // `hash_at_last_verdict` is frozen at each verdict and `hash_now` tracks
32263
31898
  // disk, so their inequality IS "changed since we last spoke".
32264
31899
  authored_since_verdict: memorySession ? foldDossier(memorySession.d).authored_all.filter((a) => a.hash_now !== a.hash_at_last_verdict).map((a) => a.path) : [],
32265
- // The server reads only how many; a bulk change sent every path. VRT-242.
32266
- unobserved: unobserved.slice(0, MAX_WIRE_PATHS),
32267
- ...unobserved.length > MAX_WIRE_PATHS && { unobserved_total: unobserved.length },
31900
+ unobserved: foldResult?.unobserved ?? [],
32268
31901
  commands: foldResult?.commands ?? [],
32269
31902
  tools: foldResult?.tools ?? [],
32270
31903
  tasks: foldResult?.tasks ?? [],
@@ -32427,14 +32060,14 @@ async function buildRequest(run4) {
32427
32060
  }
32428
32061
 
32429
32062
  // src/lib/offline.ts
32430
- var import_node_fs51 = require("node:fs");
32431
- var import_node_crypto14 = require("node:crypto");
32063
+ var import_node_fs50 = require("node:fs");
32064
+ var import_node_crypto13 = require("node:crypto");
32432
32065
  function cacheRequest(body2) {
32433
32066
  try {
32434
- (0, import_node_fs51.mkdirSync)(CACHE_DIR, { recursive: true });
32435
- const suffix = (0, import_node_crypto14.randomBytes)(4).toString("hex");
32067
+ (0, import_node_fs50.mkdirSync)(CACHE_DIR, { recursive: true });
32068
+ const suffix = (0, import_node_crypto13.randomBytes)(4).toString("hex");
32436
32069
  const filename = `pending-${Math.floor(Date.now() / 1e3)}-${suffix}.json`;
32437
- (0, import_node_fs51.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(redactRequest(body2)));
32070
+ (0, import_node_fs50.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(redactRequest(body2)));
32438
32071
  } catch {
32439
32072
  }
32440
32073
  }
@@ -32475,10 +32108,8 @@ function buildOfflineFallback(reason, staticResults) {
32475
32108
  }
32476
32109
 
32477
32110
  // src/lib/retry.ts
32478
- var WORKER_RESOURCE_LIMIT = 546;
32479
32111
  function shouldWarmRetryAnalyze(result) {
32480
32112
  if (result.ok) return false;
32481
- if (result.http_status === WORKER_RESOURCE_LIMIT) return false;
32482
32113
  if (result.category === "network" || result.category === "timeout") return true;
32483
32114
  if (result.category === "http_5xx") return true;
32484
32115
  if (result.category === "invalid_json" && (result.http_status ?? 0) >= 500) return true;
@@ -32488,7 +32119,7 @@ function shouldWarmRetryAnalyze(result) {
32488
32119
  // src/commands/analyze/phases/12-transmit.ts
32489
32120
  async function transmit(run4) {
32490
32121
  const { globals } = run4;
32491
- const { requestBody, serviceUrl, staticResults, token } = run4;
32122
+ const { codeDelta, requestBody, serviceUrl, staticResults, token } = run4;
32492
32123
  const ANALYZE_TIMEOUT_MS = 1e5;
32493
32124
  let result = await analyzeRequest({
32494
32125
  serviceUrl,
@@ -32525,12 +32156,11 @@ async function transmit(run4) {
32525
32156
  }
32526
32157
  if (!result.ok) {
32527
32158
  cacheRequest(requestBody);
32528
- const sentKb = () => Math.round(Buffer.byteLength(JSON.stringify(requestBody)) / 1024);
32529
32159
  let message;
32530
32160
  if (result.http_status === 413) {
32531
- message = `Verity: request rejected \u2014 payload too large (${sentKb()} KB sent: ${result.error}). Commit or stash pre-existing changes, or run with --mode skip if you didn't intend to submit code this turn.`;
32532
- } else if (result.http_status === WORKER_RESOURCE_LIMIT) {
32533
- message = `Verity: the service ran out of CPU or memory on this request (HTTP 546, ${sentKb()} KB sent). This is not a cold start: the same change fails the same way, so it was not retried. Commit or stash unrelated changes to shrink the request (local analysis this run).`;
32161
+ const totalBytes = codeDelta.files.reduce((sum, f) => sum + f.content.length, 0);
32162
+ const kb = Math.round(totalBytes / 1024);
32163
+ message = `Verity: request rejected \u2014 payload too large (${kb}KB over the 190KB cap). Commit or stash pre-existing changes, or run with --mode skip if you didn't intend to submit code this turn.`;
32534
32164
  } else if (result.category === "network" || result.category === "timeout") {
32535
32165
  message = `Verity offline \u2014 ${result.error}`;
32536
32166
  } else if (result.error.startsWith("STALE_VERIFICATION")) {
@@ -32556,7 +32186,7 @@ async function transmit(run4) {
32556
32186
  }
32557
32187
 
32558
32188
  // src/commands/analyze/phases/13-reconcile.ts
32559
- var import_node_fs52 = require("node:fs");
32189
+ var import_node_fs51 = require("node:fs");
32560
32190
  var import_node_path39 = require("node:path");
32561
32191
  async function reconcile(run4) {
32562
32192
  const { actionSummary, allChanged, analyzable, baseline, baselineSessionId, codeDelta, contentHash, conversation, decision, foldResult, memory: memory2, memorySession, response, reviewable, securityFiles, turnId } = run4;
@@ -32586,7 +32216,7 @@ async function reconcile(run4) {
32586
32216
  const st = foldDossier(memorySession.d);
32587
32217
  openElsewhere = openBlockingElsewhere(st.statements, sentPaths, (file, line2) => {
32588
32218
  try {
32589
- const src = (0, import_node_fs52.readFileSync)((0, import_node_path39.join)(repoRoot(), file), "utf8").split("\n");
32219
+ const src = (0, import_node_fs51.readFileSync)((0, import_node_path39.join)(repoRoot(), file), "utf8").split("\n");
32590
32220
  const at = src[line2 - 1];
32591
32221
  return at === void 0 ? null : lineSha(at);
32592
32222
  } catch {
@@ -33408,7 +33038,7 @@ function registerAnalyzeCommand(program2) {
33408
33038
  var tracing = () => process.env.VERITY_TRACE_PHASES === "1";
33409
33039
  async function runAnalyze(opts, globals) {
33410
33040
  if (!verityConfigured()) {
33411
- (0, import_node_fs53.writeSync)(2, isMachineStore((0, import_node_path40.join)(repoRoot(), VERITY_DIR)) ? "[verity] nothing to review in your home directory \u2014 run Verity inside a project.\n" : '[verity] not set up in this project \u2014 run "verity init" first.\n');
33041
+ (0, import_node_fs52.writeSync)(2, '[verity] not set up in this project \u2014 run "verity init" first.\n');
33412
33042
  process.exit(0);
33413
33043
  }
33414
33044
  const run4 = createRun(opts, globals);
@@ -33429,12 +33059,11 @@ async function runAnalyze(opts, globals) {
33429
33059
  }
33430
33060
 
33431
33061
  // src/commands/baseline.ts
33432
- var import_node_fs55 = require("node:fs");
33433
- var import_node_path42 = require("node:path");
33062
+ var import_node_fs54 = require("node:fs");
33434
33063
 
33435
33064
  // src/lib/project-skills.ts
33436
- var import_node_fs54 = require("node:fs");
33437
- var import_node_path41 = require("node:path");
33065
+ var import_node_fs53 = require("node:fs");
33066
+ var import_node_path40 = require("node:path");
33438
33067
  var PROJECT_SKILL_NAMES = [
33439
33068
  "verity-setup",
33440
33069
  "verity-analyze",
@@ -33460,14 +33089,14 @@ var LEGACY_SKILL_NAMES = [
33460
33089
  var ALL = [...PROJECT_SKILL_NAMES, ...LEGACY_SKILL_NAMES];
33461
33090
  function staleProjectSkills() {
33462
33091
  const root = projectPath(".claude/skills");
33463
- if (!(0, import_node_fs54.existsSync)(root)) return [];
33464
- return ALL.filter((name2) => (0, import_node_fs54.existsSync)((0, import_node_path41.join)(root, name2)));
33092
+ if (!(0, import_node_fs53.existsSync)(root)) return [];
33093
+ return ALL.filter((name2) => (0, import_node_fs53.existsSync)((0, import_node_path40.join)(root, name2)));
33465
33094
  }
33466
33095
  function removeProjectSkills() {
33467
33096
  const root = projectPath(".claude/skills");
33468
33097
  const removed = [];
33469
33098
  for (const name2 of staleProjectSkills()) {
33470
- (0, import_node_fs54.rmSync)((0, import_node_path41.join)(root, name2), { recursive: true, force: true });
33099
+ (0, import_node_fs53.rmSync)((0, import_node_path40.join)(root, name2), { recursive: true, force: true });
33471
33100
  removed.push(name2);
33472
33101
  }
33473
33102
  return removed;
@@ -33500,7 +33129,6 @@ function registerBaselineCommands(program2) {
33500
33129
  const skewMsg = skew ? `Verity: your global \`verity\` CLI is ${skew.global} but the hooks run ${skew.hooks}. Fix it before using \`verity\` in a terminal: ${skew.remedy}` : null;
33501
33130
  const skewNote = skew ? `Before anything else, including /verity:init's questions, tell the user their global \`verity\` is ${skew.global}, the hooks run ${skew.hooks}, and \`${skew.remedy}\` fixes it. Until they have, do not send them to run \`verity login\` in a terminal: that runs the global one, which can sign this machine in to a different server.` : null;
33502
33131
  if (!verityConfigured()) {
33503
- if (isMachineStore((0, import_node_path42.join)(repoRoot(), VERITY_DIR))) process.exit(0);
33504
33132
  const how = isPluginInvocation() ? "Tell the user to run /verity:init \u2014 they type it; you cannot invoke it." : "Tell the user to run `verity init` in their terminal.";
33505
33133
  const lines = [
33506
33134
  `Verity is installed but this project is not set up yet, so the quality gate will not review anything here. ${how}`
@@ -33533,13 +33161,13 @@ function registerBaselineCommands(program2) {
33533
33161
  let memoryMsg = null;
33534
33162
  let memoryAgentLine = null;
33535
33163
  const memoryNotice = projectPath(`${VERITY_DIR}/.memory-fence-notice`);
33536
- if (realStart && !(0, import_node_fs55.existsSync)(memoryNotice)) {
33164
+ if (realStart && !(0, import_node_fs54.existsSync)(memoryNotice)) {
33537
33165
  const trackedGraph = memoryOptOut() ? 0 : committedMemoryFiles().length;
33538
33166
  if (trackedGraph > 0) {
33539
33167
  memoryMsg = `Verity: this project commits its knowledge base (${trackedGraph} files under .verity/memory/), so Verity's generated notes show up in every diff and pull request. Run \`verity memory untrack\` to keep them on disk but out of git, or \`verity memory track\` to keep committing them on purpose.`;
33540
33168
  memoryAgentLine = `This project has ${trackedGraph} knowledge-graph files tracked in git under .verity/memory/. As of Verity 0.32.6 the graph is machine-local by default \u2014 it is rebuilt from the service, and committing it puts generated notes in every pull request. If the user wants that stopped, run \`verity memory untrack\` for them: it keeps every file on disk and stages their removal from the index, so they only need to commit \u2014 and their teammates' working copies will vanish on the next pull and re-sync from the service, which is expected. If they would rather keep committing it, \`verity memory track\` records that and nothing will offer again.`;
33541
33169
  try {
33542
- (0, import_node_fs55.writeFileSync)(memoryNotice, (/* @__PURE__ */ new Date()).toISOString() + "\n");
33170
+ (0, import_node_fs54.writeFileSync)(memoryNotice, (/* @__PURE__ */ new Date()).toISOString() + "\n");
33543
33171
  } catch {
33544
33172
  }
33545
33173
  }
@@ -33640,16 +33268,10 @@ function hookSource(value) {
33640
33268
  }
33641
33269
 
33642
33270
  // src/commands/review.ts
33643
- var import_node_fs56 = require("node:fs");
33271
+ var import_node_fs55 = require("node:fs");
33644
33272
  function registerReviewCommand(program2) {
33645
- program2.command("review").description("Run on-demand Verity analysis (advisory, never blocks)").requiredOption("--files <paths>", "Comma-separated file list").option("--changed <paths>", "Subset of --files that were modified").option("--intent <text>", "User intent description (max 2000 chars); - reads it from stdin, so the words never pass through shell quoting").option("--specs <paths>", "Comma-separated spec file paths").option("--json", "Output raw JSON response").action(async (opts) => {
33273
+ program2.command("review").description("Run on-demand Verity analysis (advisory, never blocks)").requiredOption("--files <paths>", "Comma-separated file list").option("--changed <paths>", "Subset of --files that were modified").option("--intent <text>", "User intent description (max 2000 chars)").option("--specs <paths>", "Comma-separated spec file paths").option("--json", "Output raw JSON response").action(async (opts) => {
33646
33274
  const globals = program2.opts();
33647
- const intent = readTextInput(opts.intent, "--intent");
33648
- if (!intent.ok) {
33649
- printError(intent.error);
33650
- process.exit(0);
33651
- }
33652
- opts.intent = intent.text;
33653
33275
  try {
33654
33276
  await runReview(opts, globals);
33655
33277
  } catch (err2) {
@@ -33663,7 +33285,7 @@ async function runReview(opts, globals) {
33663
33285
  const changedFiles = opts.changed ? opts.changed.split(",").map((f) => f.trim()).filter(Boolean) : allFiles;
33664
33286
  const analyzable = filterAnalyzable(allFiles);
33665
33287
  const securityFiles = filterSecurity(allFiles);
33666
- const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs56.existsSync)(f) || resolveFile(f) !== null);
33288
+ const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs55.existsSync)(f) || resolveFile(f) !== null);
33667
33289
  const staticResults = runCodacyAnalysisIfAvailable(scannable);
33668
33290
  const codeDelta = collectCodeDelta(allFiles);
33669
33291
  const tokenResult = await resolveToken(globals.token);
@@ -33729,40 +33351,19 @@ async function runReview(opts, globals) {
33729
33351
  }
33730
33352
 
33731
33353
  // src/commands/guard.ts
33732
- var import_node_fs61 = require("node:fs");
33733
- var import_node_path48 = require("node:path");
33354
+ var import_node_fs59 = require("node:fs");
33355
+ var import_node_path45 = require("node:path");
33734
33356
 
33735
- // src/lib/vendored.ts
33736
- var import_node_fs57 = require("node:fs");
33737
- var import_node_path43 = require("node:path");
33738
- var INSTALLED_SKILL = /^\.claude\/skills\/(verity-[a-z0-9-]+)\/(.+)$/;
33739
- function dataDirOrNull() {
33740
- try {
33741
- return resolveDataDir();
33742
- } catch {
33743
- return null;
33744
- }
33745
- }
33746
- function shippedSkillFile(path, dataDir = dataDirOrNull()) {
33747
- const m = path.replace(/\\/g, "/").match(INSTALLED_SKILL);
33748
- if (!m || !dataDir) return null;
33749
- const [, skill, rel] = m;
33750
- if (rel.split("/").some((seg) => seg === ".." || seg === ".")) return null;
33751
- try {
33752
- return (0, import_node_fs57.readFileSync)((0, import_node_path43.join)(dataDir, "skills", skill, rel), "utf8");
33753
- } catch {
33754
- return null;
33755
- }
33357
+ // src/lib/terminal-text.ts
33358
+ var CONTROL = /[\x00-\x08\x0b-\x1f\x7f-\x9f\u061c\u200e\u200f\u2028-\u202e\u2066-\u2069]/g;
33359
+ function terminalText(value, max = 4e3) {
33360
+ if (typeof value !== "string") return "";
33361
+ const clean2 = value.replace(CONTROL, "");
33362
+ return clean2.length > max ? `${clean2.slice(0, max - 1)}\u2026` : clean2;
33756
33363
  }
33757
- function partitionVendored(files, read2, dataDir = dataDirOrNull()) {
33758
- const review = [];
33759
- const vendored = [];
33760
- for (const f of files) {
33761
- const shipped = shippedSkillFile(f, dataDir);
33762
- if (shipped !== null && read2(f) === shipped) vendored.push(f);
33763
- else review.push(f);
33764
- }
33765
- return { review, vendored };
33364
+ function terminalUrl(value) {
33365
+ const clean2 = terminalText(value, 2e3);
33366
+ return /^https?:\/\/\S+$/.test(clean2) ? clean2 : "";
33766
33367
  }
33767
33368
 
33768
33369
  // src/lib/agent-driver.ts
@@ -33844,7 +33445,7 @@ async function runAgentReview(options) {
33844
33445
  }
33845
33446
  if (!settled) {
33846
33447
  const wait = Math.max(0, remaining() - FINISH_TIMEOUT_MS);
33847
- await Promise.race([oneShotDone, new Promise((resolve9) => setTimeout(resolve9, wait))]);
33448
+ await Promise.race([oneShotDone, new Promise((resolve8) => setTimeout(resolve8, wait))]);
33848
33449
  }
33849
33450
  const finished = await options.http.post(
33850
33451
  "/agent-review/finish",
@@ -33859,8 +33460,8 @@ async function runAgentReview(options) {
33859
33460
  }
33860
33461
 
33861
33462
  // src/lib/prove/auto.ts
33862
- var import_node_path47 = require("node:path");
33863
- var import_node_crypto19 = require("node:crypto");
33463
+ var import_node_path44 = require("node:path");
33464
+ var import_node_crypto18 = require("node:crypto");
33864
33465
 
33865
33466
  // src/lib/prove/signals.ts
33866
33467
  var DEFAULT_SINCE = "180 days ago";
@@ -35586,18 +35187,18 @@ function renderReplay(model, property, r) {
35586
35187
  // src/lib/prove/runner.ts
35587
35188
  var import_node_child_process15 = require("node:child_process");
35588
35189
  var import_node_os8 = require("node:os");
35589
- var import_node_fs60 = require("node:fs");
35190
+ var import_node_fs58 = require("node:fs");
35590
35191
  var import_node_os9 = require("node:os");
35591
- var import_node_path46 = require("node:path");
35192
+ var import_node_path43 = require("node:path");
35592
35193
 
35593
35194
  // src/lib/prove/scaffold.ts
35594
- var import_node_fs59 = require("node:fs");
35595
- var import_node_path45 = require("node:path");
35195
+ var import_node_fs57 = require("node:fs");
35196
+ var import_node_path42 = require("node:path");
35596
35197
 
35597
35198
  // src/lib/prove/safe-write.ts
35598
- var import_node_fs58 = require("node:fs");
35599
- var import_node_crypto15 = require("node:crypto");
35600
- var import_node_path44 = require("node:path");
35199
+ var import_node_fs56 = require("node:fs");
35200
+ var import_node_crypto14 = require("node:crypto");
35201
+ var import_node_path41 = require("node:path");
35601
35202
  var SafeWriteError = class extends Error {
35602
35203
  constructor(reason, path) {
35603
35204
  super(`refusing to write ${path}: ${reason}`);
@@ -35606,10 +35207,10 @@ var SafeWriteError = class extends Error {
35606
35207
  this.name = "SafeWriteError";
35607
35208
  }
35608
35209
  };
35609
- var FLAGS3 = import_node_fs58.constants;
35210
+ var FLAGS3 = import_node_fs56.constants;
35610
35211
  var NOFOLLOW2 = FLAGS3.O_NOFOLLOW ?? 0;
35611
35212
  function assertPlainRelative(rel) {
35612
- if (!rel || (0, import_node_path44.isAbsolute)(rel)) throw new SafeWriteError("bad-path", rel);
35213
+ if (!rel || (0, import_node_path41.isAbsolute)(rel)) throw new SafeWriteError("bad-path", rel);
35613
35214
  for (const part of rel.split(/[\\/]/)) {
35614
35215
  if (part === ".." || part === "" || part === ".") throw new SafeWriteError("bad-path", rel);
35615
35216
  }
@@ -35618,34 +35219,34 @@ function ensureDirsNoFollow(root, rel) {
35618
35219
  const parts2 = rel.split(/[\\/]/);
35619
35220
  let cur = root;
35620
35221
  for (const part of parts2.slice(0, -1)) {
35621
- cur = (0, import_node_path44.join)(cur, part);
35222
+ cur = (0, import_node_path41.join)(cur, part);
35622
35223
  let st;
35623
35224
  try {
35624
- st = (0, import_node_fs58.lstatSync)(cur);
35225
+ st = (0, import_node_fs56.lstatSync)(cur);
35625
35226
  } catch {
35626
- (0, import_node_fs58.mkdirSync)(cur);
35227
+ (0, import_node_fs56.mkdirSync)(cur);
35627
35228
  continue;
35628
35229
  }
35629
35230
  if (st.isSymbolicLink()) throw new SafeWriteError("symlink", cur);
35630
35231
  if (!st.isDirectory()) throw new SafeWriteError("not-regular", cur);
35631
35232
  }
35632
- return (0, import_node_path44.join)(root, rel);
35233
+ return (0, import_node_path41.join)(root, rel);
35633
35234
  }
35634
35235
  function insideRoot(realRoot, realPath) {
35635
- return realPath === realRoot || realPath.startsWith(realRoot.endsWith(import_node_path44.sep) ? realRoot : realRoot + import_node_path44.sep);
35236
+ return realPath === realRoot || realPath.startsWith(realRoot.endsWith(import_node_path41.sep) ? realRoot : realRoot + import_node_path41.sep);
35636
35237
  }
35637
35238
  function removeQuietly(path) {
35638
35239
  try {
35639
- (0, import_node_fs58.unlinkSync)(path);
35240
+ (0, import_node_fs56.unlinkSync)(path);
35640
35241
  } catch {
35641
35242
  }
35642
35243
  }
35643
35244
  function writeFileInRootNoFollow(root, rel, content) {
35644
35245
  assertPlainRelative(rel);
35645
35246
  const dest = ensureDirsNoFollow(root, rel);
35646
- const dir = (0, import_node_path44.dirname)(dest);
35247
+ const dir = (0, import_node_path41.dirname)(dest);
35647
35248
  try {
35648
- const st = (0, import_node_fs58.lstatSync)(dest);
35249
+ const st = (0, import_node_fs56.lstatSync)(dest);
35649
35250
  if (st.isSymbolicLink()) throw new SafeWriteError("symlink", dest);
35650
35251
  if (!st.isFile()) throw new SafeWriteError("not-regular", dest);
35651
35252
  } catch (err2) {
@@ -35653,41 +35254,41 @@ function writeFileInRootNoFollow(root, rel, content) {
35653
35254
  }
35654
35255
  let realRoot;
35655
35256
  try {
35656
- realRoot = (0, import_node_fs58.realpathSync)(root);
35257
+ realRoot = (0, import_node_fs56.realpathSync)(root);
35657
35258
  } catch {
35658
35259
  throw new SafeWriteError("unwritable", root);
35659
35260
  }
35660
- const tmp = (0, import_node_path44.join)(dir, `.${(0, import_node_path44.basename)(dest)}.${(0, import_node_crypto15.randomBytes)(6).toString("hex")}.tmp`);
35261
+ const tmp = (0, import_node_path41.join)(dir, `.${(0, import_node_path41.basename)(dest)}.${(0, import_node_crypto14.randomBytes)(6).toString("hex")}.tmp`);
35661
35262
  let fd;
35662
35263
  try {
35663
- fd = (0, import_node_fs58.openSync)(tmp, import_node_fs58.constants.O_WRONLY | import_node_fs58.constants.O_CREAT | import_node_fs58.constants.O_EXCL | NOFOLLOW2, 420);
35264
+ fd = (0, import_node_fs56.openSync)(tmp, import_node_fs56.constants.O_WRONLY | import_node_fs56.constants.O_CREAT | import_node_fs56.constants.O_EXCL | NOFOLLOW2, 420);
35664
35265
  } catch {
35665
35266
  throw new SafeWriteError("unwritable", tmp);
35666
35267
  }
35667
35268
  try {
35668
- const opened = (0, import_node_fs58.fstatSync)(fd, { bigint: true });
35269
+ const opened = (0, import_node_fs56.fstatSync)(fd, { bigint: true });
35669
35270
  let realTmp;
35670
35271
  try {
35671
- realTmp = (0, import_node_fs58.realpathSync)(tmp);
35272
+ realTmp = (0, import_node_fs56.realpathSync)(tmp);
35672
35273
  } catch {
35673
35274
  throw new SafeWriteError("escaped", tmp);
35674
35275
  }
35675
- const there = (0, import_node_fs58.lstatSync)(realTmp, { bigint: true });
35276
+ const there = (0, import_node_fs56.lstatSync)(realTmp, { bigint: true });
35676
35277
  if (!opened.isFile() || there.ino !== opened.ino || there.dev !== opened.dev || !insideRoot(realRoot, realTmp)) {
35677
35278
  throw new SafeWriteError("escaped", tmp);
35678
35279
  }
35679
35280
  const buf = Buffer.from(content, "utf-8");
35680
35281
  let off = 0;
35681
- while (off < buf.length) off += (0, import_node_fs58.writeSync)(fd, buf, off, buf.length - off);
35282
+ while (off < buf.length) off += (0, import_node_fs56.writeSync)(fd, buf, off, buf.length - off);
35682
35283
  } catch (err2) {
35683
- (0, import_node_fs58.closeSync)(fd);
35284
+ (0, import_node_fs56.closeSync)(fd);
35684
35285
  removeQuietly(tmp);
35685
35286
  throw err2 instanceof SafeWriteError ? err2 : new SafeWriteError("unwritable", tmp);
35686
35287
  }
35687
- (0, import_node_fs58.closeSync)(fd);
35288
+ (0, import_node_fs56.closeSync)(fd);
35688
35289
  try {
35689
- if (!insideRoot(realRoot, (0, import_node_fs58.realpathSync)(dir)) || (0, import_node_fs58.lstatSync)(dir).isSymbolicLink()) throw new SafeWriteError("escaped", dir);
35690
- (0, import_node_fs58.renameSync)(tmp, dest);
35290
+ if (!insideRoot(realRoot, (0, import_node_fs56.realpathSync)(dir)) || (0, import_node_fs56.lstatSync)(dir).isSymbolicLink()) throw new SafeWriteError("escaped", dir);
35291
+ (0, import_node_fs56.renameSync)(tmp, dest);
35691
35292
  } catch (err2) {
35692
35293
  removeQuietly(tmp);
35693
35294
  throw err2 instanceof SafeWriteError ? err2 : new SafeWriteError("unwritable", dest);
@@ -35701,9 +35302,9 @@ function pathHasNoLink(root, rel) {
35701
35302
  }
35702
35303
  let cur = root;
35703
35304
  for (const part of rel.split(/[\\/]/)) {
35704
- cur = cur + import_node_path44.sep + part;
35305
+ cur = cur + import_node_path41.sep + part;
35705
35306
  try {
35706
- if ((0, import_node_fs58.lstatSync)(cur).isSymbolicLink()) return false;
35307
+ if ((0, import_node_fs56.lstatSync)(cur).isSymbolicLink()) return false;
35707
35308
  } catch {
35708
35309
  return true;
35709
35310
  }
@@ -36013,20 +35614,20 @@ This directory is machine-local and gitignored (see ../.gitignore). Models are
36013
35614
  never committed; what reaches the team is the bug report and the fix.
36014
35615
  `;
36015
35616
  function scaffoldProofs(root) {
36016
- const proofsDir = (0, import_node_path45.join)(root, PROOFS_DIR);
35617
+ const proofsDir = (0, import_node_path42.join)(root, PROOFS_DIR);
36017
35618
  const written = [];
36018
35619
  const kept = [];
36019
35620
  for (const stray of ["lakefile.lean"]) {
36020
35621
  const rel = `${PROOFS_DIR}/${stray}`;
36021
- if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path45.join)(root, rel));
35622
+ if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
36022
35623
  try {
36023
- (0, import_node_fs59.rmSync)((0, import_node_path45.join)(root, rel), { force: true });
35624
+ (0, import_node_fs57.rmSync)((0, import_node_path42.join)(root, rel), { force: true });
36024
35625
  } catch {
36025
35626
  }
36026
35627
  }
36027
35628
  for (const f of PROOFS_TEMPLATE_FILES) {
36028
35629
  const rel = `${PROOFS_DIR}/${f.path}`;
36029
- if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path45.join)(root, rel));
35630
+ if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
36030
35631
  const current = readRegularFileInRoot(root, rel, 4 * 1024 * 1024);
36031
35632
  if (current.ok && current.content === f.content) {
36032
35633
  kept.push(rel);
@@ -36039,8 +35640,8 @@ function scaffoldProofs(root) {
36039
35640
  [`${PROOFS_DIR}/.gitignore`, LOCAL_GITIGNORE],
36040
35641
  [`${MODELS_DIR}/README.md`, MODELS_README]
36041
35642
  ]) {
36042
- if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path45.join)(root, rel));
36043
- if (existsNoFollow((0, import_node_path45.join)(root, rel))) {
35643
+ if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
35644
+ if (existsNoFollow((0, import_node_path42.join)(root, rel))) {
36044
35645
  kept.push(rel);
36045
35646
  continue;
36046
35647
  }
@@ -36051,7 +35652,7 @@ function scaffoldProofs(root) {
36051
35652
  }
36052
35653
  function existsNoFollow(abs) {
36053
35654
  try {
36054
- (0, import_node_fs59.lstatSync)(abs);
35655
+ (0, import_node_fs57.lstatSync)(abs);
36055
35656
  return true;
36056
35657
  } catch {
36057
35658
  return false;
@@ -36059,7 +35660,7 @@ function existsNoFollow(abs) {
36059
35660
  }
36060
35661
 
36061
35662
  // src/lib/prove/report.ts
36062
- var import_node_crypto16 = require("node:crypto");
35663
+ var import_node_crypto15 = require("node:crypto");
36063
35664
  var IDENT2 = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$/;
36064
35665
  var SHA256 = /^(sha256:)?[0-9a-f]{64}$/;
36065
35666
  var KINDS2 = /* @__PURE__ */ new Set(["structural", "intent"]);
@@ -36207,7 +35808,7 @@ function sha256InRoot(root, file) {
36207
35808
  const opened = openRegularInRoot(root, file);
36208
35809
  if (!opened.ok) return null;
36209
35810
  try {
36210
- return (0, import_node_crypto16.createHash)("sha256").update(readOpened(opened.fd, opened.size)).digest("hex");
35811
+ return (0, import_node_crypto15.createHash)("sha256").update(readOpened(opened.fd, opened.size)).digest("hex");
36211
35812
  } catch {
36212
35813
  return null;
36213
35814
  }
@@ -36309,17 +35910,17 @@ function renderReport(r) {
36309
35910
 
36310
35911
  // src/lib/prove/runner.ts
36311
35912
  function verityLeanHome(env = process.env) {
36312
- return env.VERITY_LEAN_HOME ?? (0, import_node_path46.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".verity", "lean");
35913
+ return env.VERITY_LEAN_HOME ?? (0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".verity", "lean");
36313
35914
  }
36314
35915
  function findToolchain(env = process.env) {
36315
- const managedBin = (0, import_node_path46.join)(verityLeanHome(env), LEAN_TOOLCHAIN.replace(/^leanprover\/lean4:/, ""), "bin");
36316
- const elanBin = (0, import_node_path46.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "bin");
36317
- const elanHas = (0, import_node_fs60.existsSync)((0, import_node_path46.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "toolchains", LEAN_TOOLCHAIN.replace("/", "--").replace(":", "---")));
36318
- const userPath = (env.PATH ?? "").split(import_node_path46.delimiter).filter((d) => d && (elanHas || (0, import_node_path46.resolve)(d) !== (0, import_node_path46.resolve)(elanBin)));
36319
- const path = [managedBin, ...elanHas ? [elanBin] : [], ...userPath].join(import_node_path46.delimiter);
35916
+ const managedBin = (0, import_node_path43.join)(verityLeanHome(env), LEAN_TOOLCHAIN.replace(/^leanprover\/lean4:/, ""), "bin");
35917
+ const elanBin = (0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "bin");
35918
+ const elanHas = (0, import_node_fs58.existsSync)((0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "toolchains", LEAN_TOOLCHAIN.replace("/", "--").replace(":", "---")));
35919
+ const userPath = (env.PATH ?? "").split(import_node_path43.delimiter).filter((d) => d && (elanHas || (0, import_node_path43.resolve)(d) !== (0, import_node_path43.resolve)(elanBin)));
35920
+ const path = [managedBin, ...elanHas ? [elanBin] : [], ...userPath].join(import_node_path43.delimiter);
36320
35921
  const merged = { ...env, PATH: path, ELAN_TOOLCHAIN: env.ELAN_TOOLCHAIN ?? LEAN_TOOLCHAIN };
36321
35922
  const exe = process.platform === "win32" ? "lake.exe" : "lake";
36322
- const candidates2 = [(0, import_node_path46.join)(managedBin, exe), ...elanHas ? [(0, import_node_path46.join)(elanBin, exe)] : [], exe];
35923
+ const candidates2 = [(0, import_node_path43.join)(managedBin, exe), ...elanHas ? [(0, import_node_path43.join)(elanBin, exe)] : [], exe];
36323
35924
  for (const candidate of candidates2) {
36324
35925
  try {
36325
35926
  (0, import_node_child_process15.execFileSync)(candidate, ["--version"], { env: merged, stdio: ["ignore", "pipe", "pipe"], timeout: 1e4 });
@@ -36357,7 +35958,7 @@ function run2(tc, cwd, args2, timeoutMs) {
36357
35958
  function runAsync(tc, cwd, args2, timeoutMs) {
36358
35959
  const started = Date.now();
36359
35960
  const MAX = 16 * 1024 * 1024;
36360
- return new Promise((resolve9) => {
35961
+ return new Promise((resolve8) => {
36361
35962
  const posix = (0, import_node_os8.platform)() !== "win32";
36362
35963
  const child = (0, import_node_child_process15.spawn)(tc.lake, args2, { cwd, env: tc.env, stdio: ["ignore", "pipe", "pipe"], detached: posix });
36363
35964
  let stdout = "";
@@ -36385,8 +35986,8 @@ function runAsync(tc, cwd, args2, timeoutMs) {
36385
35986
  if (settled) return;
36386
35987
  settled = true;
36387
35988
  clearTimeout(timer);
36388
- if (ok) resolve9({ ok: true, stdout, stderr: "", durationMs: Date.now() - started, timedOut: false });
36389
- else resolve9({ ok: false, stdout, stderr: stderr || message || "", durationMs: Date.now() - started, timedOut });
35989
+ if (ok) resolve8({ ok: true, stdout, stderr: "", durationMs: Date.now() - started, timedOut: false });
35990
+ else resolve8({ ok: false, stdout, stderr: stderr || message || "", durationMs: Date.now() - started, timedOut });
36390
35991
  };
36391
35992
  child.on("error", (err2) => finish(false, err2.message));
36392
35993
  child.on("close", (code) => finish(code === 0 && !timedOut));
@@ -36398,7 +35999,7 @@ function proofsWorkspaceProblem(root) {
36398
35999
  for (const rel of [".verity", PROOFS_DIR, `${PROOFS_DIR}/.lake`]) {
36399
36000
  let st;
36400
36001
  try {
36401
- st = (0, import_node_fs60.lstatSync)((0, import_node_path46.join)(root, rel));
36002
+ st = (0, import_node_fs58.lstatSync)((0, import_node_path43.join)(root, rel));
36402
36003
  } catch {
36403
36004
  break;
36404
36005
  }
@@ -36418,44 +36019,44 @@ function refused(problem) {
36418
36019
  function buildLibrary(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
36419
36020
  const problem = proofsWorkspaceProblem(root);
36420
36021
  if (problem) return refused(problem);
36421
- return run2(tc, (0, import_node_path46.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36022
+ return run2(tc, (0, import_node_path43.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36422
36023
  }
36423
36024
  async function buildLibraryAsync(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
36424
36025
  const problem = proofsWorkspaceProblem(root);
36425
36026
  if (problem) return refused(problem);
36426
- return runAsync(tc, (0, import_node_path46.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36027
+ return runAsync(tc, (0, import_node_path43.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36427
36028
  }
36428
36029
  function isModelInRoot(modelsAbs, rel) {
36429
- if (!rel.endsWith(".lean") || (0, import_node_path46.isAbsolute)(rel) || rel.startsWith("..")) return false;
36030
+ if (!rel.endsWith(".lean") || (0, import_node_path43.isAbsolute)(rel) || rel.startsWith("..")) return false;
36430
36031
  return statRegularInRoot(modelsAbs, rel).ok;
36431
36032
  }
36432
36033
  function resolveModelFile(root, arg) {
36433
- const modelsAbs = (0, import_node_path46.join)(root, MODELS_DIR);
36434
- const asPath = (0, import_node_path46.relative)(modelsAbs, (0, import_node_path46.isAbsolute)(arg) ? arg : (0, import_node_path46.resolve)(root, arg));
36034
+ const modelsAbs = (0, import_node_path43.join)(root, MODELS_DIR);
36035
+ const asPath = (0, import_node_path43.relative)(modelsAbs, (0, import_node_path43.isAbsolute)(arg) ? arg : (0, import_node_path43.resolve)(root, arg));
36435
36036
  const candidates2 = arg.includes("/") || arg.includes("\\") ? [asPath] : [arg, `${arg}.lean`];
36436
36037
  for (const rel of candidates2) {
36437
- if (isModelInRoot(modelsAbs, rel)) return (0, import_node_path46.join)(modelsAbs, rel);
36038
+ if (isModelInRoot(modelsAbs, rel)) return (0, import_node_path43.join)(modelsAbs, rel);
36438
36039
  }
36439
36040
  return null;
36440
36041
  }
36441
36042
  function listModelFiles(root) {
36442
- const modelsAbs = (0, import_node_path46.join)(root, MODELS_DIR);
36443
- if (!(0, import_node_fs60.existsSync)(modelsAbs)) return [];
36444
- return (0, import_node_fs60.readdirSync)(modelsAbs).filter((f) => isModelInRoot(modelsAbs, f)).sort().map((f) => (0, import_node_path46.join)(modelsAbs, f));
36043
+ const modelsAbs = (0, import_node_path43.join)(root, MODELS_DIR);
36044
+ if (!(0, import_node_fs58.existsSync)(modelsAbs)) return [];
36045
+ return (0, import_node_fs58.readdirSync)(modelsAbs).filter((f) => isModelInRoot(modelsAbs, f)).sort().map((f) => (0, import_node_path43.join)(modelsAbs, f));
36445
36046
  }
36446
36047
  function trimDiagnostics(text) {
36447
36048
  return text.split("\n").filter((l) => !l.startsWith("trace:")).join("\n").trim().slice(0, 4e3);
36448
36049
  }
36449
36050
  function checkModel(tc, root, modelFile, opts = {}) {
36450
- const proofsAbs = (0, import_node_path46.join)(root, PROOFS_DIR);
36451
- const rel = (0, import_node_path46.relative)(proofsAbs, modelFile);
36051
+ const proofsAbs = (0, import_node_path43.join)(root, PROOFS_DIR);
36052
+ const rel = (0, import_node_path43.relative)(proofsAbs, modelFile);
36452
36053
  const problem = proofsWorkspaceProblem(root);
36453
36054
  const res = problem ? refused(problem) : run2(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36454
36055
  return toReport(res, root, modelFile, opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36455
36056
  }
36456
36057
  async function checkModelAsync(tc, root, modelFile, opts = {}) {
36457
- const proofsAbs = (0, import_node_path46.join)(root, PROOFS_DIR);
36458
- const rel = (0, import_node_path46.relative)(proofsAbs, modelFile);
36058
+ const proofsAbs = (0, import_node_path43.join)(root, PROOFS_DIR);
36059
+ const rel = (0, import_node_path43.relative)(proofsAbs, modelFile);
36459
36060
  const problem = proofsWorkspaceProblem(root);
36460
36061
  const res = problem ? refused(problem) : await runAsync(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36461
36062
  return toReport(res, root, modelFile, opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
@@ -36464,10 +36065,10 @@ function toReport(res, root, modelFile, timeoutMs) {
36464
36065
  const parsed = parseVerityLines(res.stdout);
36465
36066
  const combined = `${res.stdout}
36466
36067
  ${res.stderr}`;
36467
- const name2 = parsed.header?.model ?? (0, import_node_path46.basename)(modelFile, ".lean");
36068
+ const name2 = parsed.header?.model ?? (0, import_node_path43.basename)(modelFile, ".lean");
36468
36069
  const report = {
36469
36070
  model: name2,
36470
- file: (0, import_node_path46.relative)(root, modelFile),
36071
+ file: (0, import_node_path43.relative)(root, modelFile),
36471
36072
  ok: res.ok,
36472
36073
  header: parsed.header,
36473
36074
  properties: parsed.properties,
@@ -36542,7 +36143,7 @@ function mergeFormalFindings(response, outcome, pushedFiles) {
36542
36143
  }
36543
36144
 
36544
36145
  // src/lib/prove/scalpel.ts
36545
- var import_node_crypto17 = require("node:crypto");
36146
+ var import_node_crypto16 = require("node:crypto");
36546
36147
  var ARITHMETIC = /Math\.(?:round|floor|ceil|trunc)\(|\bround\(|\bdivmod\(|[\w)\]]\s*(?:\*|\/(?!\/)|%)\s*[\w(]/;
36547
36148
  function functionHazard(numbered2) {
36548
36149
  const sites = effectSites(numbered2);
@@ -36572,7 +36173,7 @@ function semanticFingerprint(numbered2) {
36572
36173
  if (LOG_LINE.test(t)) continue;
36573
36174
  kept.push(t.replace(/\s+/g, " "));
36574
36175
  }
36575
- return (0, import_node_crypto17.createHash)("sha256").update(kept.join("\n")).digest("hex");
36176
+ return (0, import_node_crypto16.createHash)("sha256").update(kept.join("\n")).digest("hex");
36576
36177
  }
36577
36178
  function readVerified(root, now = Date.now()) {
36578
36179
  const read2 = readRegularFileInRoot(root, VERIFIED_FILE, 256 * 1024);
@@ -36595,9 +36196,9 @@ function recordVerified(root, rec, now = Date.now()) {
36595
36196
  }
36596
36197
 
36597
36198
  // src/lib/prove/context.ts
36598
- var import_node_crypto18 = require("node:crypto");
36199
+ var import_node_crypto17 = require("node:crypto");
36599
36200
  var CONTEXT_BUDGET_MS = 2e3;
36600
- var sha256 = (s) => (0, import_node_crypto18.createHash)("sha256").update(s).digest("hex");
36201
+ var sha256 = (s) => (0, import_node_crypto17.createHash)("sha256").update(s).digest("hex");
36601
36202
  var TEST_PATH4 = /(^|\/)(tests?|__tests__|spec)\/|\.(test|spec)\.[a-z]+$/;
36602
36203
  function slice(content, f, maxLines) {
36603
36204
  const all = content.split("\n");
@@ -36786,7 +36387,7 @@ function workingTreeReader(root) {
36786
36387
  };
36787
36388
  }
36788
36389
  function sha256Of(content) {
36789
- return (0, import_node_crypto19.createHash)("sha256").update(content).digest("hex");
36390
+ return (0, import_node_crypto18.createHash)("sha256").update(content).digest("hex");
36790
36391
  }
36791
36392
  function defaultDeps(opts) {
36792
36393
  const env = opts.env ?? process.env;
@@ -37037,7 +36638,7 @@ async function runFormalPhase(input) {
37037
36638
  modelName = gen.name;
37038
36639
  const rel = `${AUTO_MODELS_DIR}/${gen.name}.lean`;
37039
36640
  writeFileInRootNoFollow(root, rel, gen.source);
37040
- const abs = resolveModelFile(root, rel) ?? (0, import_node_path47.join)(root, rel);
36641
+ const abs = resolveModelFile(root, rel) ?? (0, import_node_path44.join)(root, rel);
37041
36642
  progress.model = { name: gen.name, file: rel, rounds: round };
37042
36643
  progress.step = "check";
37043
36644
  report = await deps.check(root, abs);
@@ -37098,11 +36699,11 @@ async function runFormalPhase(input) {
37098
36699
  const budget = Math.max(2e4, timeLeft() - 5e3);
37099
36700
  const byId = /* @__PURE__ */ new Map();
37100
36701
  let stoppedEarly = false;
37101
- await new Promise((resolve9) => {
36702
+ await new Promise((resolve8) => {
37102
36703
  let left = toReplay.length;
37103
- if (left === 0) return resolve9();
36704
+ if (left === 0) return resolve8();
37104
36705
  const settle = () => {
37105
- if (--left === 0) resolve9();
36706
+ if (--left === 0) resolve8();
37106
36707
  };
37107
36708
  for (const p of toReplay) {
37108
36709
  void (async () => {
@@ -37115,7 +36716,7 @@ async function runFormalPhase(input) {
37115
36716
  if (!stoppedEarly) byId.set(p.id, r);
37116
36717
  if (r.verdict === "reproduced" && !stoppedEarly && !isCrash(p)) {
37117
36718
  stoppedEarly = true;
37118
- resolve9();
36719
+ resolve8();
37119
36720
  }
37120
36721
  })().catch(() => {
37121
36722
  byId.set(p.id, null);
@@ -37159,7 +36760,7 @@ async function runFormalPhase(input) {
37159
36760
  return done({
37160
36761
  status: "checked",
37161
36762
  target,
37162
- model: { name: modelName, file: (0, import_node_path47.relative)(root, (0, import_node_path47.join)(root, modelFile)), rounds },
36763
+ model: { name: modelName, file: (0, import_node_path44.relative)(root, (0, import_node_path44.join)(root, modelFile)), rounds },
37163
36764
  properties: report.properties,
37164
36765
  findings
37165
36766
  });
@@ -37222,7 +36823,7 @@ async function generateAndCheck(root, req, opts) {
37222
36823
  }
37223
36824
  const rel = `${dir}/${gen.name}.lean`;
37224
36825
  writeFileInRootNoFollow(root, rel, gen.source);
37225
- const abs = resolveModelFile(root, rel) ?? (0, import_node_path47.join)(root, rel);
36826
+ const abs = resolveModelFile(root, rel) ?? (0, import_node_path44.join)(root, rel);
37226
36827
  const report = await opts.deps.check(root, abs);
37227
36828
  const abstracts = report.header?.abstracts ?? [];
37228
36829
  const stray = abstracts.find((a) => !headerFiles.has(a.file)) ?? (abstracts[0] && abstracts[0].file !== req.file ? abstracts[0] : void 0);
@@ -37310,10 +36911,10 @@ function runFormalPhaseWithin(input) {
37310
36911
  if (left <= 0) return Promise.resolve(skippedOutcome("deadline", "no time left"));
37311
36912
  const progress = input.progress ?? {};
37312
36913
  let timer = null;
37313
- const cutoff = new Promise((resolve9) => {
36914
+ const cutoff = new Promise((resolve8) => {
37314
36915
  timer = setTimeout(() => {
37315
36916
  progress.cancelled = true;
37316
- resolve9(cutOffOutcome(progress, `hard stop after ${Math.round(left / 1e3)} s during ${progress.step ?? "setup"}`, left));
36917
+ resolve8(cutOffOutcome(progress, `hard stop after ${Math.round(left / 1e3)} s during ${progress.step ?? "setup"}`, left));
37317
36918
  }, left);
37318
36919
  });
37319
36920
  return Promise.race([runFormalPhase({ ...input, progress }), cutoff]).finally(() => {
@@ -37350,14 +36951,13 @@ function describeFormalOutcome(o) {
37350
36951
  var EXCERPT_SOURCE_MAX_BYTES = 2 * 1024 * 1024;
37351
36952
  var WRITERS_BUDGET_MS = 1500;
37352
36953
  var EXCERPT_MAX_LINES2 = 30;
37353
- var VENDORED_READ_MAX_BYTES = 256 * 1024;
37354
36954
  var GUARD_BLOCK_CAP = 2;
37355
- var GUARD_ITER_FILE = (0, import_node_path48.join)(VERITY_DIR, ".guard-iteration");
36955
+ var GUARD_ITER_FILE = (0, import_node_path45.join)(VERITY_DIR, ".guard-iteration");
37356
36956
  function readPreToolUseStdin() {
37357
36957
  const empty = { command: "", cwd: null, sessionId: null };
37358
- return new Promise((resolve9) => {
36958
+ return new Promise((resolve8) => {
37359
36959
  try {
37360
- if (process.stdin.isTTY) return resolve9(empty);
36960
+ if (process.stdin.isTTY) return resolve8(empty);
37361
36961
  const chunks = [];
37362
36962
  let timer;
37363
36963
  let settled = false;
@@ -37370,7 +36970,7 @@ function readPreToolUseStdin() {
37370
36970
  process.stdin.removeListener("end", onEnd);
37371
36971
  process.stdin.removeListener("error", onError);
37372
36972
  process.stdin.pause();
37373
- resolve9(value);
36973
+ resolve8(value);
37374
36974
  };
37375
36975
  const onEnd = () => {
37376
36976
  try {
@@ -37391,13 +36991,13 @@ function readPreToolUseStdin() {
37391
36991
  process.stdin.on("error", onError);
37392
36992
  process.stdin.resume();
37393
36993
  } catch {
37394
- resolve9(empty);
36994
+ resolve8(empty);
37395
36995
  }
37396
36996
  });
37397
36997
  }
37398
36998
  function readIterMap() {
37399
36999
  try {
37400
- const raw = JSON.parse((0, import_node_fs61.readFileSync)(GUARD_ITER_FILE, "utf-8"));
37000
+ const raw = JSON.parse((0, import_node_fs59.readFileSync)(GUARD_ITER_FILE, "utf-8"));
37401
37001
  if (raw && typeof raw === "object") {
37402
37002
  if (typeof raw.moment === "string" && typeof raw.count === "number") {
37403
37003
  return { [raw.moment]: raw.count };
@@ -37417,10 +37017,10 @@ function readIter(moment) {
37417
37017
  }
37418
37018
  function writeIter(moment, count) {
37419
37019
  try {
37420
- (0, import_node_fs61.mkdirSync)(VERITY_DIR, { recursive: true });
37020
+ (0, import_node_fs59.mkdirSync)(VERITY_DIR, { recursive: true });
37421
37021
  const map = readIterMap();
37422
37022
  map[moment] = count;
37423
- (0, import_node_fs61.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37023
+ (0, import_node_fs59.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37424
37024
  } catch {
37425
37025
  }
37426
37026
  }
@@ -37430,10 +37030,10 @@ function resetIter(moment) {
37430
37030
  if (!(moment in map)) return;
37431
37031
  delete map[moment];
37432
37032
  if (Object.keys(map).length === 0) {
37433
- if ((0, import_node_fs61.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs61.unlinkSync)(GUARD_ITER_FILE);
37033
+ if ((0, import_node_fs59.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs59.unlinkSync)(GUARD_ITER_FILE);
37434
37034
  } else {
37435
- (0, import_node_fs61.mkdirSync)(VERITY_DIR, { recursive: true });
37436
- (0, import_node_fs61.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37035
+ (0, import_node_fs59.mkdirSync)(VERITY_DIR, { recursive: true });
37036
+ (0, import_node_fs59.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37437
37037
  }
37438
37038
  } catch {
37439
37039
  }
@@ -37503,7 +37103,7 @@ function hasBlockingFinding(response, sentFiles) {
37503
37103
  function buildGuardRequest(moment, files, codeDelta, iter, sessionId, statedIntent, coverageTelemetry) {
37504
37104
  const analyzable = filterAnalyzable(files);
37505
37105
  const securityFiles = filterSecurity(files);
37506
- const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).map((f) => (0, import_node_fs61.existsSync)(f) ? f : resolveFile(f)).filter((f) => f !== null);
37106
+ const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).map((f) => (0, import_node_fs59.existsSync)(f) ? f : resolveFile(f)).filter((f) => f !== null);
37507
37107
  const staticResults = runCodacyAnalysisIfAvailable(scannable);
37508
37108
  const trigger = moment === "pre-commit" ? "hook:pre-commit" : "hook:pre-push";
37509
37109
  const requestBody = {
@@ -37740,15 +37340,7 @@ async function runGuard(opts, globals) {
37740
37340
  `Verity ${moment}: this command stages files as it runs and the resulting set could not be resolved (${range.refusal}); the ${verb} was allowed WITHOUT a Verity review. Stage first (\`git add \u2026\`) and re-run the ${verb} to have it reviewed.`
37741
37341
  );
37742
37342
  }
37743
- const committed = revisionSource(
37744
- frame.worktreeRoot ?? process.cwd(),
37745
- range.kind === "push" && range.head !== "INDEX" ? range.head : null
37746
- );
37747
- const { review: files, vendored } = partitionVendored(rangeFiles(frame, range), (p) => {
37748
- const read2 = committed.read(p, VENDORED_READ_MAX_BYTES);
37749
- return read2.ok ? read2.content : null;
37750
- });
37751
- if (vendored.length > 0) logEvent("guard_vendored", { moment, n: vendored.length, paths: vendored.slice(0, 20) });
37343
+ const files = rangeFiles(frame, range);
37752
37344
  if (files.length === 0) process.exit(0);
37753
37345
  const tokenResult = await resolveToken(globals.token);
37754
37346
  const urlResult = await resolveServiceUrl(globals.serviceUrl);
@@ -38128,8 +37720,8 @@ function registerIgnoreCommand(program2) {
38128
37720
  }
38129
37721
 
38130
37722
  // src/commands/waive.ts
38131
- var import_node_crypto20 = require("node:crypto");
38132
- var import_node_fs62 = require("node:fs");
37723
+ var import_node_crypto19 = require("node:crypto");
37724
+ var import_node_fs60 = require("node:fs");
38133
37725
  function registerWaiveCommand(program2) {
38134
37726
  program2.command("waive <pattern-id>").description("Record an accepted-risk disposition for an open finding (voids when the file changes)").option("--file <path>", "File the finding is anchored to, REPO-RELATIVE (recommended \u2014 narrows the waive)").requiredOption("--reason <text>", "The human disposition this records (reviewer finding, ADR, \u2026)").action(async (patternId, opts) => {
38135
37727
  const globals = program2.opts();
@@ -38158,7 +37750,7 @@ function registerWaiveCommand(program2) {
38158
37750
  if (opts.file) {
38159
37751
  body2.file = opts.file;
38160
37752
  try {
38161
- body2.file_sha256 = (0, import_node_crypto20.createHash)("sha256").update((0, import_node_fs62.readFileSync)(opts.file)).digest("hex");
37753
+ body2.file_sha256 = (0, import_node_crypto19.createHash)("sha256").update((0, import_node_fs60.readFileSync)(opts.file)).digest("hex");
38162
37754
  } catch {
38163
37755
  printError(`Cannot read ${opts.file} \u2014 run from the repo root, or omit --file to waive by pattern.`);
38164
37756
  process.exit(1);
@@ -38183,11 +37775,10 @@ function registerWaiveCommand(program2) {
38183
37775
  }
38184
37776
 
38185
37777
  // src/commands/init.ts
38186
- var import_node_fs67 = require("node:fs");
37778
+ var import_node_fs65 = require("node:fs");
38187
37779
  var import_promises20 = require("node:fs/promises");
38188
37780
  var import_yaml6 = __toESM2(require_dist());
38189
- var import_node_path52 = require("node:path");
38190
- var import_node_os11 = require("node:os");
37781
+ var import_node_path49 = require("node:path");
38191
37782
  var import_node_child_process19 = require("node:child_process");
38192
37783
 
38193
37784
  // src/lib/banner.ts
@@ -38266,7 +37857,7 @@ function printPhase(n, of, title, subtitle) {
38266
37857
  }
38267
37858
 
38268
37859
  // src/commands/doctor.ts
38269
- var import_node_fs63 = require("node:fs");
37860
+ var import_node_fs61 = require("node:fs");
38270
37861
 
38271
37862
  // src/lib/prereqs.ts
38272
37863
  var import_node_child_process16 = require("node:child_process");
@@ -38327,13 +37918,13 @@ function checkAnalysisCli() {
38327
37918
  }
38328
37919
  var INSTALL_TIMEOUT_MS = 12e4;
38329
37920
  function run3(command, args2, opts = {}) {
38330
- return new Promise((resolve9) => {
37921
+ return new Promise((resolve8) => {
38331
37922
  const child = (0, import_node_child_process16.spawn)(command, args2, {
38332
37923
  stdio: opts.inherit ? "inherit" : "pipe",
38333
37924
  timeout: INSTALL_TIMEOUT_MS
38334
37925
  });
38335
- child.on("error", () => resolve9(false));
38336
- child.on("close", (code) => resolve9(code === 0));
37926
+ child.on("error", () => resolve8(false));
37927
+ child.on("close", (code) => resolve8(code === 0));
38337
37928
  });
38338
37929
  }
38339
37930
  async function installAnalysisCli() {
@@ -38474,11 +38065,11 @@ async function buildReport() {
38474
38065
  const hooks = wiring.status;
38475
38066
  const provenance = cliProvenance();
38476
38067
  const telemetry = await checkTelemetry();
38477
- const hasConfig = (0, import_node_fs63.existsSync)(projectPath(CODACY_CONFIG_FILE));
38068
+ const hasConfig = (0, import_node_fs61.existsSync)(projectPath(CODACY_CONFIG_FILE));
38478
38069
  const artifacts = {
38479
- standard: (0, import_node_fs63.existsSync)(projectPath(STANDARD_FILE)),
38070
+ standard: (0, import_node_fs61.existsSync)(projectPath(STANDARD_FILE)),
38480
38071
  analysisConfig: hasConfig,
38481
- verityMd: (0, import_node_fs63.existsSync)(projectPath(VERITY_MD_FILE)),
38072
+ verityMd: (0, import_node_fs61.existsSync)(projectPath(VERITY_MD_FILE)),
38482
38073
  analysisConfigIds: hasConfig ? validatePatternIds().status : "absent"
38483
38074
  };
38484
38075
  const next = [];
@@ -38637,8 +38228,8 @@ function registerDoctorCommand(program2) {
38637
38228
  }
38638
38229
 
38639
38230
  // src/commands/migrate.ts
38640
- var import_node_fs64 = require("node:fs");
38641
- var import_node_path49 = require("node:path");
38231
+ var import_node_fs62 = require("node:fs");
38232
+ var import_node_path46 = require("node:path");
38642
38233
  var import_node_child_process17 = require("node:child_process");
38643
38234
  var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
38644
38235
  function defaultNpmRemover(pkg) {
@@ -38675,12 +38266,12 @@ async function runMigration(opts = {}) {
38675
38266
  return { actions, migrated: actions.length > 0 };
38676
38267
  }
38677
38268
  function migrateProjectDir(root, actions) {
38678
- const gateDir = (0, import_node_path49.join)(root, ".gate");
38679
- const verityDir = (0, import_node_path49.join)(root, ".verity");
38680
- if ((0, import_node_fs64.existsSync)(gateDir) && !(0, import_node_fs64.existsSync)(verityDir)) {
38269
+ const gateDir = (0, import_node_path46.join)(root, ".gate");
38270
+ const verityDir = (0, import_node_path46.join)(root, ".verity");
38271
+ if ((0, import_node_fs62.existsSync)(gateDir) && !(0, import_node_fs62.existsSync)(verityDir)) {
38681
38272
  return migrateProjectDirRename(root, gateDir, verityDir, actions);
38682
38273
  }
38683
- if ((0, import_node_fs64.existsSync)(gateDir) && (0, import_node_fs64.existsSync)(verityDir)) {
38274
+ if ((0, import_node_fs62.existsSync)(gateDir) && (0, import_node_fs62.existsSync)(verityDir)) {
38684
38275
  return migrateProjectDirCarry(gateDir, verityDir, actions);
38685
38276
  }
38686
38277
  return false;
@@ -38701,13 +38292,13 @@ function migrateProjectDirRename(root, gateDir, verityDir, actions) {
38701
38292
  }
38702
38293
  }
38703
38294
  if (moved) {
38704
- if ((0, import_node_fs64.existsSync)(gateDir)) {
38295
+ if ((0, import_node_fs62.existsSync)(gateDir)) {
38705
38296
  const carried = carryLegacyContents(gateDir, verityDir);
38706
38297
  if (carried > 0) {
38707
38298
  actions.push(`Carried ${carried} untracked legacy file(s) from .gate/ into .verity/`);
38708
38299
  }
38709
38300
  try {
38710
- (0, import_node_fs64.rmSync)(gateDir, { recursive: true, force: true });
38301
+ (0, import_node_fs62.rmSync)(gateDir, { recursive: true, force: true });
38711
38302
  } catch {
38712
38303
  }
38713
38304
  }
@@ -38723,18 +38314,18 @@ function migrateProjectDirCarry(gateDir, verityDir, actions) {
38723
38314
  actions.push(`Carried ${carried} legacy file(s) from .gate/ into .verity/`);
38724
38315
  }
38725
38316
  try {
38726
- (0, import_node_fs64.rmSync)(gateDir, { recursive: true, force: true });
38317
+ (0, import_node_fs62.rmSync)(gateDir, { recursive: true, force: true });
38727
38318
  } catch {
38728
38319
  }
38729
38320
  return carried > 0;
38730
38321
  }
38731
38322
  function migrateGlobalCredentials(home, actions) {
38732
38323
  if (!home) return;
38733
- const gateCreds = (0, import_node_path49.join)(home, ".gate", "credentials");
38734
- const verityCreds = (0, import_node_path49.join)(home, ".verity", "credentials");
38735
- if (!(0, import_node_fs64.existsSync)(gateCreds)) return;
38736
- if (!(0, import_node_fs64.existsSync)(verityCreds)) {
38737
- (0, import_node_fs64.mkdirSync)((0, import_node_path49.join)(home, ".verity"), { recursive: true });
38324
+ const gateCreds = (0, import_node_path46.join)(home, ".gate", "credentials");
38325
+ const verityCreds = (0, import_node_path46.join)(home, ".verity", "credentials");
38326
+ if (!(0, import_node_fs62.existsSync)(gateCreds)) return;
38327
+ if (!(0, import_node_fs62.existsSync)(verityCreds)) {
38328
+ (0, import_node_fs62.mkdirSync)((0, import_node_path46.join)(home, ".verity"), { recursive: true });
38738
38329
  moveFile(gateCreds, verityCreds);
38739
38330
  actions.push("Moved ~/.gate/credentials \u2192 ~/.verity/credentials");
38740
38331
  return;
@@ -38756,8 +38347,8 @@ async function migrateLegacyHooks(root, actions) {
38756
38347
  }
38757
38348
  }
38758
38349
  async function migrateClaudeMd(root, actions) {
38759
- const claudeMd = (0, import_node_path49.join)(root, "CLAUDE.md");
38760
- const hadLegacyBlock = (0, import_node_fs64.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
38350
+ const claudeMd = (0, import_node_path46.join)(root, "CLAUDE.md");
38351
+ const hadLegacyBlock = (0, import_node_fs62.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
38761
38352
  if (!hadLegacyBlock) return;
38762
38353
  try {
38763
38354
  await ensureClaudeMdPointer(root);
@@ -38767,9 +38358,9 @@ async function migrateClaudeMd(root, actions) {
38767
38358
  }
38768
38359
  }
38769
38360
  function migrateStandardFile(root, actions) {
38770
- const gateMd = (0, import_node_path49.join)(root, "GATE.md");
38771
- const verityMd = (0, import_node_path49.join)(root, "VERITY.md");
38772
- if (!(0, import_node_fs64.existsSync)(gateMd) || (0, import_node_fs64.existsSync)(verityMd)) return;
38361
+ const gateMd = (0, import_node_path46.join)(root, "GATE.md");
38362
+ const verityMd = (0, import_node_path46.join)(root, "VERITY.md");
38363
+ if (!(0, import_node_fs62.existsSync)(gateMd) || (0, import_node_fs62.existsSync)(verityMd)) return;
38773
38364
  let moved = false;
38774
38365
  if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
38775
38366
  try {
@@ -38781,12 +38372,12 @@ function migrateStandardFile(root, actions) {
38781
38372
  if (!moved) moveFile(gateMd, verityMd);
38782
38373
  const content = readFileSyncSafe(verityMd);
38783
38374
  const refreshed = content.split("GATE.md").join("VERITY.md");
38784
- if (refreshed !== content) (0, import_node_fs64.writeFileSync)(verityMd, refreshed);
38375
+ if (refreshed !== content) (0, import_node_fs62.writeFileSync)(verityMd, refreshed);
38785
38376
  actions.push("Renamed GATE.md \u2192 VERITY.md");
38786
38377
  }
38787
38378
  async function migrateTelemetryHeaders(root, actions) {
38788
- const file = (0, import_node_path49.join)(root, ".claude", "settings.local.json");
38789
- if (!(0, import_node_fs64.existsSync)(file)) return;
38379
+ const file = (0, import_node_path46.join)(root, ".claude", "settings.local.json");
38380
+ if (!(0, import_node_fs62.existsSync)(file)) return;
38790
38381
  let settings;
38791
38382
  try {
38792
38383
  settings = JSON.parse(readFileSyncSafe(file) || "{}");
@@ -38833,15 +38424,15 @@ function mergeGlobalCredentials(gateCreds, verityCreds) {
38833
38424
  toAppend.push(line2.replace(/\r$/, ""));
38834
38425
  }
38835
38426
  if (toAppend.length > 0) {
38836
- const sep6 = verityContent.endsWith("\n") || verityContent === "" ? "" : "\n";
38837
- (0, import_node_fs64.writeFileSync)(verityCreds, verityContent + sep6 + toAppend.join("\n") + "\n");
38427
+ const sep5 = verityContent.endsWith("\n") || verityContent === "" ? "" : "\n";
38428
+ (0, import_node_fs62.writeFileSync)(verityCreds, verityContent + sep5 + toAppend.join("\n") + "\n");
38838
38429
  }
38839
- (0, import_node_fs64.rmSync)(gateCreds, { force: true });
38430
+ (0, import_node_fs62.rmSync)(gateCreds, { force: true });
38840
38431
  return toAppend.length;
38841
38432
  }
38842
38433
  function readFileSyncSafe(path) {
38843
38434
  try {
38844
- return (0, import_node_fs64.readFileSync)(path, "utf-8");
38435
+ return (0, import_node_fs62.readFileSync)(path, "utf-8");
38845
38436
  } catch {
38846
38437
  return "";
38847
38438
  }
@@ -38856,35 +38447,35 @@ function hasStagedChanges(root) {
38856
38447
  }
38857
38448
  function moveDir(from, to) {
38858
38449
  try {
38859
- (0, import_node_fs64.renameSync)(from, to);
38450
+ (0, import_node_fs62.renameSync)(from, to);
38860
38451
  } catch (err2) {
38861
38452
  if (err2.code !== "EXDEV") throw err2;
38862
- (0, import_node_fs64.cpSync)(from, to, { recursive: true });
38863
- (0, import_node_fs64.rmSync)(from, { recursive: true, force: true });
38453
+ (0, import_node_fs62.cpSync)(from, to, { recursive: true });
38454
+ (0, import_node_fs62.rmSync)(from, { recursive: true, force: true });
38864
38455
  }
38865
38456
  }
38866
38457
  function moveFile(from, to) {
38867
38458
  try {
38868
- (0, import_node_fs64.renameSync)(from, to);
38459
+ (0, import_node_fs62.renameSync)(from, to);
38869
38460
  } catch (err2) {
38870
38461
  if (err2.code !== "EXDEV") throw err2;
38871
- (0, import_node_fs64.cpSync)(from, to);
38872
- (0, import_node_fs64.rmSync)(from, { force: true });
38462
+ (0, import_node_fs62.cpSync)(from, to);
38463
+ (0, import_node_fs62.rmSync)(from, { force: true });
38873
38464
  }
38874
38465
  }
38875
38466
  function carryLegacyContents(gateDir, verityDir) {
38876
38467
  let copied = 0;
38877
38468
  const walk2 = (relDir) => {
38878
- const srcDir = (0, import_node_path49.join)(gateDir, relDir);
38879
- for (const entry of (0, import_node_fs64.readdirSync)(srcDir)) {
38880
- const rel = relDir ? (0, import_node_path49.join)(relDir, entry) : entry;
38881
- const src = (0, import_node_path49.join)(gateDir, rel);
38882
- const dest = (0, import_node_path49.join)(verityDir, rel);
38883
- if ((0, import_node_fs64.statSync)(src).isDirectory()) {
38469
+ const srcDir = (0, import_node_path46.join)(gateDir, relDir);
38470
+ for (const entry of (0, import_node_fs62.readdirSync)(srcDir)) {
38471
+ const rel = relDir ? (0, import_node_path46.join)(relDir, entry) : entry;
38472
+ const src = (0, import_node_path46.join)(gateDir, rel);
38473
+ const dest = (0, import_node_path46.join)(verityDir, rel);
38474
+ if ((0, import_node_fs62.statSync)(src).isDirectory()) {
38884
38475
  walk2(rel);
38885
- } else if (!(0, import_node_fs64.existsSync)(dest)) {
38886
- (0, import_node_fs64.mkdirSync)((0, import_node_path49.dirname)(dest), { recursive: true });
38887
- (0, import_node_fs64.cpSync)(src, dest);
38476
+ } else if (!(0, import_node_fs62.existsSync)(dest)) {
38477
+ (0, import_node_fs62.mkdirSync)((0, import_node_path46.dirname)(dest), { recursive: true });
38478
+ (0, import_node_fs62.cpSync)(src, dest);
38888
38479
  copied++;
38889
38480
  }
38890
38481
  }
@@ -38893,22 +38484,22 @@ function carryLegacyContents(gateDir, verityDir) {
38893
38484
  return copied;
38894
38485
  }
38895
38486
  async function needsMigration(root = repoRoot()) {
38896
- const gateDir = (0, import_node_path49.join)(root, ".gate");
38897
- const verityDir = (0, import_node_path49.join)(root, ".verity");
38898
- if ((0, import_node_fs64.existsSync)(gateDir) && !(0, import_node_fs64.existsSync)(verityDir)) return true;
38899
- if ((0, import_node_fs64.existsSync)(gateDir) && (0, import_node_fs64.existsSync)(verityDir)) {
38900
- if ((0, import_node_fs64.existsSync)((0, import_node_path49.join)(gateDir, "credentials")) && !(0, import_node_fs64.existsSync)((0, import_node_path49.join)(verityDir, "credentials"))) {
38487
+ const gateDir = (0, import_node_path46.join)(root, ".gate");
38488
+ const verityDir = (0, import_node_path46.join)(root, ".verity");
38489
+ if ((0, import_node_fs62.existsSync)(gateDir) && !(0, import_node_fs62.existsSync)(verityDir)) return true;
38490
+ if ((0, import_node_fs62.existsSync)(gateDir) && (0, import_node_fs62.existsSync)(verityDir)) {
38491
+ if ((0, import_node_fs62.existsSync)((0, import_node_path46.join)(gateDir, "credentials")) && !(0, import_node_fs62.existsSync)((0, import_node_path46.join)(verityDir, "credentials"))) {
38901
38492
  return true;
38902
38493
  }
38903
- if ((0, import_node_fs64.existsSync)((0, import_node_path49.join)(gateDir, "memory")) && !(0, import_node_fs64.existsSync)((0, import_node_path49.join)(verityDir, "memory"))) {
38494
+ if ((0, import_node_fs62.existsSync)((0, import_node_path46.join)(gateDir, "memory")) && !(0, import_node_fs62.existsSync)((0, import_node_path46.join)(verityDir, "memory"))) {
38904
38495
  return true;
38905
38496
  }
38906
38497
  }
38907
- const claudeMd = (0, import_node_path49.join)(root, "CLAUDE.md");
38908
- if ((0, import_node_fs64.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
38498
+ const claudeMd = (0, import_node_path46.join)(root, "CLAUDE.md");
38499
+ if ((0, import_node_fs62.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
38909
38500
  return true;
38910
38501
  }
38911
- if ((0, import_node_fs64.existsSync)((0, import_node_path49.join)(root, "GATE.md")) && !(0, import_node_fs64.existsSync)((0, import_node_path49.join)(root, "VERITY.md"))) {
38502
+ if ((0, import_node_fs62.existsSync)((0, import_node_path46.join)(root, "GATE.md")) && !(0, import_node_fs62.existsSync)((0, import_node_path46.join)(root, "VERITY.md"))) {
38912
38503
  return true;
38913
38504
  }
38914
38505
  if (await hasLegacyHooksAt(root)) return true;
@@ -39037,7 +38628,7 @@ function runSelect(opts) {
39037
38628
  cursor: initialIdx[0] ?? 0,
39038
38629
  chosen: new Set(mode2 === "single" ? [initialIdx[0] ?? 0] : initialIdx)
39039
38630
  };
39040
- return new Promise((resolve9) => {
38631
+ return new Promise((resolve8) => {
39041
38632
  let painted = 0;
39042
38633
  let settled = false;
39043
38634
  const draw = () => {
@@ -39085,7 +38676,7 @@ function runSelect(opts) {
39085
38676
  if (settled) return;
39086
38677
  settled = true;
39087
38678
  restore();
39088
- resolve9(value);
38679
+ resolve8(value);
39089
38680
  };
39090
38681
  readline2.emitKeypressEvents(input);
39091
38682
  input.setRawMode(true);
@@ -39106,9 +38697,9 @@ async function askLine(question, io = {}) {
39106
38697
  output: io.output ?? process.stdout
39107
38698
  });
39108
38699
  try {
39109
- return await new Promise((resolve9) => {
39110
- rl.question(question).then((a) => resolve9(a.trim())).catch(() => resolve9(null));
39111
- rl.once("close", () => setImmediate(() => resolve9(null)));
38700
+ return await new Promise((resolve8) => {
38701
+ rl.question(question).then((a) => resolve8(a.trim())).catch(() => resolve8(null));
38702
+ rl.once("close", () => setImmediate(() => resolve8(null)));
39112
38703
  });
39113
38704
  } finally {
39114
38705
  rl.close();
@@ -39189,11 +38780,11 @@ async function promptMultiSelect(question, choices, fallback) {
39189
38780
  }
39190
38781
 
39191
38782
  // src/lib/prove/lean-install.ts
39192
- var import_node_fs65 = require("node:fs");
39193
- var import_node_crypto21 = require("node:crypto");
38783
+ var import_node_fs63 = require("node:fs");
38784
+ var import_node_crypto20 = require("node:crypto");
39194
38785
  var import_node_child_process18 = require("node:child_process");
39195
38786
  var import_node_os10 = require("node:os");
39196
- var import_node_path50 = require("node:path");
38787
+ var import_node_path47 = require("node:path");
39197
38788
  var import_promises18 = require("node:stream/promises");
39198
38789
  var import_node_stream = require("node:stream");
39199
38790
  var RELEASES = "https://releases.lean-lang.org/lean4";
@@ -39204,10 +38795,10 @@ function freeBytes(dir) {
39204
38795
  let d = dir;
39205
38796
  for (let i2 = 0; i2 < 64; i2++) {
39206
38797
  try {
39207
- const st = (0, import_node_fs65.statfsSync)(d);
38798
+ const st = (0, import_node_fs63.statfsSync)(d);
39208
38799
  return Number(st.bavail) * Number(st.bsize);
39209
38800
  } catch {
39210
- const up = (0, import_node_path50.join)(d, "..");
38801
+ const up = (0, import_node_path47.join)(d, "..");
39211
38802
  if (up === d) return null;
39212
38803
  d = up;
39213
38804
  }
@@ -39227,9 +38818,9 @@ function expectedSha256(asset, version = pinnedVersion()) {
39227
38818
  return LEAN_ASSET_SHA256[version]?.[asset] ?? null;
39228
38819
  }
39229
38820
  function sha256File(path) {
39230
- return new Promise((resolve9, reject) => {
39231
- const hash = (0, import_node_crypto21.createHash)("sha256");
39232
- (0, import_node_fs65.createReadStream)(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
38821
+ return new Promise((resolve8, reject) => {
38822
+ const hash = (0, import_node_crypto20.createHash)("sha256");
38823
+ (0, import_node_fs63.createReadStream)(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve8(hash.digest("hex"))).on("error", reject);
39233
38824
  });
39234
38825
  }
39235
38826
  async function verifyDownload(zip, asset, version = pinnedVersion()) {
@@ -39249,7 +38840,7 @@ function leanAssetName(version = pinnedVersion()) {
39249
38840
  return suffix ? `lean-${v}-${suffix}.zip` : null;
39250
38841
  }
39251
38842
  function pinnedVersionDir(env = process.env) {
39252
- return (0, import_node_path50.join)(verityLeanHome(env), pinnedVersion());
38843
+ return (0, import_node_path47.join)(verityLeanHome(env), pinnedVersion());
39253
38844
  }
39254
38845
  function lakeBinary() {
39255
38846
  return (0, import_node_os10.platform)() === "win32" ? "lake.exe" : "lake";
@@ -39260,12 +38851,12 @@ function unzip(zip, dest) {
39260
38851
  for (const [cmd, args2] of attempts) {
39261
38852
  try {
39262
38853
  (0, import_node_child_process18.execFileSync)(cmd, args2, { stdio: ["ignore", "ignore", "pipe"], timeout: 15 * 6e4 });
39263
- if ((0, import_node_fs65.readdirSync)(dest).length > 0) return { ok: true, via: cmd };
38854
+ if ((0, import_node_fs63.readdirSync)(dest).length > 0) return { ok: true, via: cmd };
39264
38855
  errors.push(`${cmd}: produced nothing`);
39265
38856
  } catch (err2) {
39266
38857
  errors.push(`${cmd}: ${String(err2.message).split("\n")[0].slice(0, 120)}`);
39267
38858
  try {
39268
- for (const e of (0, import_node_fs65.readdirSync)(dest)) (0, import_node_fs65.rmSync)((0, import_node_path50.join)(dest, e), { recursive: true, force: true });
38859
+ for (const e of (0, import_node_fs63.readdirSync)(dest)) (0, import_node_fs63.rmSync)((0, import_node_path47.join)(dest, e), { recursive: true, force: true });
39269
38860
  } catch {
39270
38861
  }
39271
38862
  }
@@ -39291,7 +38882,7 @@ async function download(url, dest, onProgress, stallMs = DOWNLOAD_STALL_MS) {
39291
38882
  seen += chunk.length;
39292
38883
  onProgress(seen, total);
39293
38884
  });
39294
- await (0, import_promises18.pipeline)(stream, (0, import_node_fs65.createWriteStream)(dest), { signal: ctrl.signal });
38885
+ await (0, import_promises18.pipeline)(stream, (0, import_node_fs63.createWriteStream)(dest), { signal: ctrl.signal });
39295
38886
  } catch (err2) {
39296
38887
  if (ctrl.signal.aborted) throw new Error(`download stalled: nothing received for ${Math.round(stallMs / 1e3)} s`);
39297
38888
  throw err2;
@@ -39341,10 +38932,10 @@ async function installLean(opts = {}) {
39341
38932
  const gb = (n) => (n / 1024 ** 3).toFixed(1);
39342
38933
  return { ok: false, error: `not enough disk space for Lean: ${gb(free)} GB free where ${home} lives, needs about ${gb(needed)} GB` };
39343
38934
  }
39344
- const tmp = (0, import_node_path50.join)(home, ".tmp");
39345
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
39346
- (0, import_node_fs65.mkdirSync)(tmp, { recursive: true });
39347
- const zip = (0, import_node_path50.join)(tmp, asset);
38935
+ const tmp = (0, import_node_path47.join)(home, ".tmp");
38936
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
38937
+ (0, import_node_fs63.mkdirSync)(tmp, { recursive: true });
38938
+ const zip = (0, import_node_path47.join)(tmp, asset);
39348
38939
  say(`downloading ${url}`);
39349
38940
  let lastPct = -1;
39350
38941
  try {
@@ -39357,40 +38948,40 @@ async function installLean(opts = {}) {
39357
38948
  }
39358
38949
  });
39359
38950
  } catch (err2) {
39360
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38951
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39361
38952
  return { ok: false, error: err2.message };
39362
38953
  }
39363
38954
  say("verifying checksum");
39364
38955
  const verified = await verifyDownload(zip, asset);
39365
38956
  if (!verified.ok) {
39366
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38957
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39367
38958
  return { ok: false, error: verified.error };
39368
38959
  }
39369
38960
  say("unpacking (this takes a minute)");
39370
- const unpack = (0, import_node_path50.join)(tmp, "unpack");
39371
- (0, import_node_fs65.mkdirSync)(unpack);
38961
+ const unpack = (0, import_node_path47.join)(tmp, "unpack");
38962
+ (0, import_node_fs63.mkdirSync)(unpack);
39372
38963
  const unpacked = unzip(zip, unpack);
39373
38964
  if (!unpacked.ok) {
39374
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38965
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39375
38966
  return { ok: false, error: `unpack failed: ${unpacked.error}` };
39376
38967
  }
39377
- const entries = (0, import_node_fs65.readdirSync)(unpack);
39378
- const top = entries.length === 1 && (0, import_node_fs65.statSync)((0, import_node_path50.join)(unpack, entries[0])).isDirectory() ? (0, import_node_path50.join)(unpack, entries[0]) : unpack;
39379
- if (!(0, import_node_fs65.existsSync)((0, import_node_path50.join)(top, "bin", lakeBinary()))) {
39380
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38968
+ const entries = (0, import_node_fs63.readdirSync)(unpack);
38969
+ const top = entries.length === 1 && (0, import_node_fs63.statSync)((0, import_node_path47.join)(unpack, entries[0])).isDirectory() ? (0, import_node_path47.join)(unpack, entries[0]) : unpack;
38970
+ if (!(0, import_node_fs63.existsSync)((0, import_node_path47.join)(top, "bin", lakeBinary()))) {
38971
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39381
38972
  return { ok: false, error: "the archive did not contain bin/lake" };
39382
38973
  }
39383
- (0, import_node_fs65.rmSync)(dir, { recursive: true, force: true });
39384
- (0, import_node_fs65.mkdirSync)(home, { recursive: true });
39385
- (0, import_node_fs65.renameSync)(top, dir);
39386
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38974
+ (0, import_node_fs63.rmSync)(dir, { recursive: true, force: true });
38975
+ (0, import_node_fs63.mkdirSync)(home, { recursive: true });
38976
+ (0, import_node_fs63.renameSync)(top, dir);
38977
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39387
38978
  return { ok: true, dir };
39388
38979
  }
39389
38980
 
39390
38981
  // src/lib/remote-config.ts
39391
- var import_node_fs66 = require("node:fs");
38982
+ var import_node_fs64 = require("node:fs");
39392
38983
  var import_promises19 = require("node:fs/promises");
39393
- var import_node_path51 = require("node:path");
38984
+ var import_node_path48 = require("node:path");
39394
38985
  var import_yaml5 = __toESM2(require_dist());
39395
38986
  var IGNORE_RIDER = "verityignore";
39396
38987
  async function fetchRemoteSetup(opts) {
@@ -39435,7 +39026,7 @@ async function adoptRemoteSetup(found, opts) {
39435
39026
  written.push(STANDARD_FILE);
39436
39027
  if (rider !== null) {
39437
39028
  const localIgnore = projectPath(VERITYIGNORE_FILE);
39438
- if (!(0, import_node_fs66.existsSync)(localIgnore)) {
39029
+ if (!(0, import_node_fs64.existsSync)(localIgnore)) {
39439
39030
  await writeOut(VERITYIGNORE_FILE, rider);
39440
39031
  written.push(VERITYIGNORE_FILE);
39441
39032
  } else {
@@ -39468,7 +39059,7 @@ async function adoptRemoteSetup(found, opts) {
39468
39059
  }
39469
39060
  async function writeOut(relative6, body2) {
39470
39061
  const target = projectPath(relative6);
39471
- await (0, import_promises19.mkdir)((0, import_node_path51.dirname)(target), { recursive: true });
39062
+ await (0, import_promises19.mkdir)((0, import_node_path48.dirname)(target), { recursive: true });
39472
39063
  await (0, import_promises19.writeFile)(target, body2);
39473
39064
  }
39474
39065
  function describeRemote(found) {
@@ -39585,15 +39176,15 @@ async function runOptionalAuth(resolution, opts = {}) {
39585
39176
  }
39586
39177
  function resolveDataDir2() {
39587
39178
  const candidates2 = [
39588
- (0, import_node_path52.join)(__dirname, "..", "data"),
39179
+ (0, import_node_path49.join)(__dirname, "..", "data"),
39589
39180
  // installed: node_modules/@codacy/verity-cli/data
39590
- (0, import_node_path52.join)(__dirname, "..", "..", "data"),
39181
+ (0, import_node_path49.join)(__dirname, "..", "..", "data"),
39591
39182
  // edge case: nested resolution
39592
- (0, import_node_path52.join)(process.cwd(), "cli", "data")
39183
+ (0, import_node_path49.join)(process.cwd(), "cli", "data")
39593
39184
  // local dev: running from repo root
39594
39185
  ];
39595
39186
  for (const candidate of candidates2) {
39596
- if ((0, import_node_fs67.existsSync)((0, import_node_path52.join)(candidate, "skills"))) {
39187
+ if ((0, import_node_fs65.existsSync)((0, import_node_path49.join)(candidate, "skills"))) {
39597
39188
  return candidate;
39598
39189
  }
39599
39190
  }
@@ -39609,9 +39200,9 @@ async function skillIsCurrent(src, dest) {
39609
39200
  const list2 = (dir) => {
39610
39201
  const out2 = [];
39611
39202
  const walk2 = (d, prefix) => {
39612
- for (const e of (0, import_node_fs67.readdirSync)(d, { withFileTypes: true })) {
39203
+ for (const e of (0, import_node_fs65.readdirSync)(d, { withFileTypes: true })) {
39613
39204
  const rel = prefix ? `${prefix}/${e.name}` : e.name;
39614
- if (e.isDirectory()) walk2((0, import_node_path52.join)(d, e.name), rel);
39205
+ if (e.isDirectory()) walk2((0, import_node_path49.join)(d, e.name), rel);
39615
39206
  else if (e.isFile()) out2.push(rel);
39616
39207
  }
39617
39208
  };
@@ -39622,8 +39213,8 @@ async function skillIsCurrent(src, dest) {
39622
39213
  const shipped = list2(src);
39623
39214
  if (JSON.stringify(shipped) !== JSON.stringify(list2(dest))) return false;
39624
39215
  for (const rel of shipped) {
39625
- const a = await (0, import_promises20.readFile)((0, import_node_path52.join)(src, rel), "utf-8");
39626
- const b = await (0, import_promises20.readFile)((0, import_node_path52.join)(dest, rel), "utf-8");
39216
+ const a = await (0, import_promises20.readFile)((0, import_node_path49.join)(src, rel), "utf-8");
39217
+ const b = await (0, import_promises20.readFile)((0, import_node_path49.join)(dest, rel), "utf-8");
39627
39218
  if (a !== b) return false;
39628
39219
  }
39629
39220
  return true;
@@ -39826,7 +39417,7 @@ async function synthesizeLocally(opts) {
39826
39417
  async function healStaleAnalysisConfig(globals) {
39827
39418
  const configPath = projectPath(CODACY_CONFIG_FILE);
39828
39419
  const standardPath = projectPath(STANDARD_FILE);
39829
- if (!(0, import_node_fs67.existsSync)(configPath) || !(0, import_node_fs67.existsSync)(standardPath)) return;
39420
+ if (!(0, import_node_fs65.existsSync)(configPath) || !(0, import_node_fs65.existsSync)(standardPath)) return;
39830
39421
  const validation = validatePatternIds();
39831
39422
  if (validation.status !== "invalid") return;
39832
39423
  printWarn(" Your analysis config names pattern ids that no longer resolve \u2014 those tools were");
@@ -39923,17 +39514,17 @@ async function handoffToSetup(enabled, claudeInstalled) {
39923
39514
  async function installSkills(force, step) {
39924
39515
  step("Installing skills");
39925
39516
  const dataDir = resolveDataDir2();
39926
- const skillsSource = (0, import_node_path52.join)(dataDir, "skills");
39517
+ const skillsSource = (0, import_node_path49.join)(dataDir, "skills");
39927
39518
  const skillsDest = ".claude/skills";
39928
39519
  let skillsInstalled = 0;
39929
39520
  for (const skill of SKILLS) {
39930
- const src = (0, import_node_path52.join)(skillsSource, skill);
39931
- const dest = (0, import_node_path52.join)(skillsDest, skill);
39932
- if (!(0, import_node_fs67.existsSync)(src)) {
39521
+ const src = (0, import_node_path49.join)(skillsSource, skill);
39522
+ const dest = (0, import_node_path49.join)(skillsDest, skill);
39523
+ if (!(0, import_node_fs65.existsSync)(src)) {
39933
39524
  printWarn(` Skill data not found: ${skill}`);
39934
39525
  continue;
39935
39526
  }
39936
- if ((0, import_node_fs67.existsSync)(dest) && !force && await skillIsCurrent(src, dest)) {
39527
+ if ((0, import_node_fs65.existsSync)(dest) && !force && await skillIsCurrent(src, dest)) {
39937
39528
  skillsInstalled++;
39938
39529
  continue;
39939
39530
  }
@@ -40077,15 +39668,7 @@ async function offerFormalVerification(defaultsOnly, pluginMode) {
40077
39668
  console.log(" At push, Verity picks the riskiest changed function, checks a small model of");
40078
39669
  console.log(" it, and replays any counterexample on the real code (its source is sent to");
40079
39670
  console.log(" Verity for that). Only a reproduced bug can block; most pushes get no model.");
40080
- console.log(" Adds /verity-prove <worry> to check any code on demand, e.g.");
40081
- console.log(` ${DIM}/verity-prove can the webhook handler charge twice on a retried event?${NC}`);
40082
- if (!toolchain) {
40083
- const dir = pinnedVersionDir();
40084
- const home = (0, import_node_os11.homedir)();
40085
- const shown = dir.startsWith(home + import_node_path52.sep) ? `~${dir.slice(home.length)}` : dir;
40086
- console.log("");
40087
- console.log(` "yes" installs Lean 4 (${LEAN_DOWNLOAD_SIZE}) into ${shown}`);
40088
- }
39671
+ console.log(` Adds /verity-prove <worry> to check any code on demand.${toolchain ? "" : ` Needs to install Lean 4 (${LEAN_DOWNLOAD_SIZE}) on "yes".`}`);
40089
39672
  console.log("");
40090
39673
  const wants = await promptChoice("Formal verification at push?", FORMAL_CHOICES, "no");
40091
39674
  if (wants === "yes" && pluginMode) printInfo(" Plugin: the push check works now; /verity:verity-prove arrives with the plugin's next release.");
@@ -40141,7 +39724,7 @@ function registerInitCommand(program2) {
40141
39724
  const staleMarker = clearStalePluginMarker();
40142
39725
  const pluginMode = opts.plugin === false ? false : opts.pluginMode ?? pluginActiveHere();
40143
39726
  const projectMarkers = [".git", "package.json", "pyproject.toml", "go.mod", "Cargo.toml", "Gemfile", "pom.xml", "build.gradle"];
40144
- const isProject = projectMarkers.some((m) => (0, import_node_fs67.existsSync)(m));
39727
+ const isProject = projectMarkers.some((m) => (0, import_node_fs65.existsSync)(m));
40145
39728
  if (!isProject) {
40146
39729
  printError("No project detected in the current directory.");
40147
39730
  printInfo('Run "verity init" from your project root.');
@@ -40195,7 +39778,7 @@ function registerInitCommand(program2) {
40195
39778
  const claudeInstalled = await checkPrerequisites(step);
40196
39779
  console.log("");
40197
39780
  if (pluginMode) {
40198
- step("Skills already installed by the plugin, namespaced as /verity:<name>");
39781
+ printInfo("Skipping skills \u2014 the Verity plugin provides them, namespaced as /verity:<name>.");
40199
39782
  } else {
40200
39783
  await installSkills(force, step);
40201
39784
  }
@@ -40244,7 +39827,7 @@ function registerInitCommand(program2) {
40244
39827
  untrackMemory: opts.untrackMemory === true,
40245
39828
  untrackState: opts.untrackState === true
40246
39829
  });
40247
- const globalVerityDir = (0, import_node_path52.join)(process.env.HOME ?? "", ".verity");
39830
+ const globalVerityDir = (0, import_node_path49.join)(process.env.HOME ?? "", ".verity");
40248
39831
  await (0, import_promises20.mkdir)(globalVerityDir, { recursive: true });
40249
39832
  console.log("");
40250
39833
  step("Wiring Claude Code hooks");
@@ -40319,7 +39902,7 @@ function registerInitCommand(program2) {
40319
39902
  }
40320
39903
  step("Your project's Standard");
40321
39904
  let haveStandard = false;
40322
- if ((0, import_node_fs67.existsSync)(projectPath(STANDARD_FILE))) {
39905
+ if ((0, import_node_fs65.existsSync)(projectPath(STANDARD_FILE))) {
40323
39906
  printInfo(" This project already has .verity/standard.yaml \u2014 keeping it.");
40324
39907
  haveStandard = true;
40325
39908
  } else {
@@ -40349,7 +39932,7 @@ function registerInitCommand(program2) {
40349
39932
  ...telemetryChoice ? { telemetry: telemetryChoice } : {},
40350
39933
  init: {
40351
39934
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
40352
- cli_version: true ? "0.34.0-experimental.85ad809" : "dev"
39935
+ cli_version: true ? "0.34.0-experimental.9001e08" : "dev"
40353
39936
  }
40354
39937
  });
40355
39938
  } catch (err2) {
@@ -40399,8 +39982,8 @@ function registerInitCommand(program2) {
40399
39982
  }
40400
39983
 
40401
39984
  // src/commands/uninstall.ts
40402
- var import_node_fs68 = require("node:fs");
40403
- var import_node_path53 = require("node:path");
39985
+ var import_node_fs66 = require("node:fs");
39986
+ var import_node_path50 = require("node:path");
40404
39987
  function registerUninstallCommand(program2) {
40405
39988
  program2.command("uninstall").description("Remove Verity from this project (skills, hooks, .verity/, VERITY.md)").option("--dry-run", "Show what would be removed without doing it").option("--purge-global", "Also remove ~/.verity/ (deletes saved tokens \u2014 reconnect requires re-registration)").option("--keep-verity-md", "Keep the project root VERITY.md file").action(async (opts) => {
40406
39989
  const dryRun = opts.dryRun ?? false;
@@ -40409,11 +39992,11 @@ function registerUninstallCommand(program2) {
40409
39992
  const actions = [];
40410
39993
  const skillsRoot = projectPath(".claude/skills");
40411
39994
  for (const name2 of PROJECT_SKILL_NAMES) {
40412
- const dir = (0, import_node_path53.join)(skillsRoot, name2);
40413
- if ((0, import_node_fs68.existsSync)(dir)) {
39995
+ const dir = (0, import_node_path50.join)(skillsRoot, name2);
39996
+ if ((0, import_node_fs66.existsSync)(dir)) {
40414
39997
  actions.push({
40415
39998
  label: `Remove .claude/skills/${name2}/`,
40416
- apply: () => (0, import_node_fs68.rmSync)(dir, { recursive: true, force: true })
39999
+ apply: () => (0, import_node_fs66.rmSync)(dir, { recursive: true, force: true })
40417
40000
  });
40418
40001
  }
40419
40002
  }
@@ -40427,24 +40010,24 @@ function registerUninstallCommand(program2) {
40427
40010
  });
40428
40011
  }
40429
40012
  const verityDir = projectPath(VERITY_DIR);
40430
- if ((0, import_node_fs68.existsSync)(verityDir)) {
40013
+ if ((0, import_node_fs66.existsSync)(verityDir)) {
40431
40014
  actions.push({
40432
40015
  label: `Remove ${VERITY_DIR}/`,
40433
- apply: () => (0, import_node_fs68.rmSync)(verityDir, { recursive: true, force: true })
40016
+ apply: () => (0, import_node_fs66.rmSync)(verityDir, { recursive: true, force: true })
40434
40017
  });
40435
40018
  }
40436
40019
  if (!keepVerityMd) {
40437
40020
  const verityMd = projectPath(VERITY_MD_FILE);
40438
- if ((0, import_node_fs68.existsSync)(verityMd)) {
40021
+ if ((0, import_node_fs66.existsSync)(verityMd)) {
40439
40022
  actions.push({
40440
40023
  label: `Remove ${VERITY_MD_FILE}`,
40441
- apply: () => (0, import_node_fs68.rmSync)(verityMd, { force: true })
40024
+ apply: () => (0, import_node_fs66.rmSync)(verityMd, { force: true })
40442
40025
  });
40443
40026
  }
40444
40027
  }
40445
40028
  const cleanupEmptyDir = (path) => {
40446
- if ((0, import_node_fs68.existsSync)(path) && (0, import_node_fs68.statSync)(path).isDirectory() && (0, import_node_fs68.readdirSync)(path).length === 0) {
40447
- (0, import_node_fs68.rmdirSync)(path);
40029
+ if ((0, import_node_fs66.existsSync)(path) && (0, import_node_fs66.statSync)(path).isDirectory() && (0, import_node_fs66.readdirSync)(path).length === 0) {
40030
+ (0, import_node_fs66.rmdirSync)(path);
40448
40031
  }
40449
40032
  };
40450
40033
  actions.push({
@@ -40455,11 +40038,11 @@ function registerUninstallCommand(program2) {
40455
40038
  }
40456
40039
  });
40457
40040
  const home = process.env.HOME ?? "";
40458
- const globalVerityDir = (0, import_node_path53.join)(home, ".verity");
40459
- if (purgeGlobal && (0, import_node_fs68.existsSync)(globalVerityDir)) {
40041
+ const globalVerityDir = (0, import_node_path50.join)(home, ".verity");
40042
+ if (purgeGlobal && (0, import_node_fs66.existsSync)(globalVerityDir)) {
40460
40043
  actions.push({
40461
40044
  label: `Remove ~/.verity/ (global credentials \u2014 reconnect requires re-registration)`,
40462
- apply: () => (0, import_node_fs68.rmSync)(globalVerityDir, { recursive: true, force: true })
40045
+ apply: () => (0, import_node_fs66.rmSync)(globalVerityDir, { recursive: true, force: true })
40463
40046
  });
40464
40047
  }
40465
40048
  if (actions.length === 0) {
@@ -40653,8 +40236,8 @@ function registerTaskCommands(program2) {
40653
40236
  }
40654
40237
 
40655
40238
  // src/commands/reset.ts
40656
- var import_node_fs69 = require("node:fs");
40657
- var import_node_path54 = require("node:path");
40239
+ var import_node_fs67 = require("node:fs");
40240
+ var import_node_path51 = require("node:path");
40658
40241
  function registerResetCommand(program2) {
40659
40242
  program2.command("reset").description("Close the current task and clear transient state").option("--keep-task", "Only purge caches; leave the current task open").option("--all", "Also purge diagnostic logs (.verity/.logs/)").action(async (opts) => {
40660
40243
  const globals = program2.opts();
@@ -40691,11 +40274,11 @@ function registerResetCommand(program2) {
40691
40274
  }
40692
40275
  const cacheDir = projectPath(CACHE_DIR);
40693
40276
  let purged = 0;
40694
- if ((0, import_node_fs69.existsSync)(cacheDir)) {
40695
- for (const entry of (0, import_node_fs69.readdirSync)(cacheDir)) {
40277
+ if ((0, import_node_fs67.existsSync)(cacheDir)) {
40278
+ for (const entry of (0, import_node_fs67.readdirSync)(cacheDir)) {
40696
40279
  if (entry.startsWith("pending-")) {
40697
40280
  try {
40698
- (0, import_node_fs69.unlinkSync)((0, import_node_path54.join)(cacheDir, entry));
40281
+ (0, import_node_fs67.unlinkSync)((0, import_node_path51.join)(cacheDir, entry));
40699
40282
  purged++;
40700
40283
  } catch {
40701
40284
  }
@@ -40710,19 +40293,19 @@ function registerResetCommand(program2) {
40710
40293
  projectPath(`${VERITY_DIR}/.last-analysis`)
40711
40294
  ];
40712
40295
  for (const file of filesToClear) {
40713
- if ((0, import_node_fs69.existsSync)(file)) {
40296
+ if ((0, import_node_fs67.existsSync)(file)) {
40714
40297
  try {
40715
- (0, import_node_fs69.writeFileSync)(file, "");
40298
+ (0, import_node_fs67.writeFileSync)(file, "");
40716
40299
  } catch {
40717
40300
  }
40718
40301
  }
40719
40302
  }
40720
40303
  if (opts.all) {
40721
40304
  const logsDir = projectPath(`${VERITY_DIR}/.logs`);
40722
- if ((0, import_node_fs69.existsSync)(logsDir)) {
40723
- for (const entry of (0, import_node_fs69.readdirSync)(logsDir)) {
40305
+ if ((0, import_node_fs67.existsSync)(logsDir)) {
40306
+ for (const entry of (0, import_node_fs67.readdirSync)(logsDir)) {
40724
40307
  try {
40725
- (0, import_node_fs69.unlinkSync)((0, import_node_path54.join)(logsDir, entry));
40308
+ (0, import_node_fs67.unlinkSync)((0, import_node_path51.join)(logsDir, entry));
40726
40309
  } catch {
40727
40310
  }
40728
40311
  }
@@ -40734,7 +40317,7 @@ function registerResetCommand(program2) {
40734
40317
  }
40735
40318
 
40736
40319
  // src/commands/reflect.ts
40737
- var import_node_fs70 = require("node:fs");
40320
+ var import_node_fs68 = require("node:fs");
40738
40321
 
40739
40322
  // src/lib/reflection-globs.ts
40740
40323
  var MAX_GLOBS = 6;
@@ -40742,7 +40325,7 @@ var PATH_TOKEN = /[A-Za-z0-9_./-]*[A-Za-z0-9_-]\.[A-Za-z0-9]{1,8}(?::\d+(?::\d+)
40742
40325
  function clean(token) {
40743
40326
  return token.replace(/:\d+(?::\d+)?$/, "").replace(/^[`'"(\[]+/, "").replace(/[`'"),\].;!?]+$/, "").replace(/^\.\//, "");
40744
40327
  }
40745
- function resolve7(token, treePaths) {
40328
+ function resolve6(token, treePaths) {
40746
40329
  if (treePaths.includes(token)) return token;
40747
40330
  const suffix = token.startsWith("/") ? token : `/${token}`;
40748
40331
  const matches = treePaths.filter((p) => p.endsWith(suffix));
@@ -40755,7 +40338,7 @@ function deriveFileGlobs(text, treePaths) {
40755
40338
  for (const raw of text.match(PATH_TOKEN) ?? []) {
40756
40339
  const token = clean(raw);
40757
40340
  if (!token) continue;
40758
- const path = resolve7(token, treePaths);
40341
+ const path = resolve6(token, treePaths);
40759
40342
  if (!path || seen.has(path)) continue;
40760
40343
  seen.add(path);
40761
40344
  out2.push(path);
@@ -40772,19 +40355,14 @@ async function writeNodeToDisk(args2) {
40772
40355
  { treePaths: listTrackedFiles(), recordBaseline: false }
40773
40356
  );
40774
40357
  if (written === 0) return false;
40775
- return (0, import_node_fs70.existsSync)(projectPath(`${VERITY_DIR}/memory/${args2.filePath}`));
40358
+ return (0, import_node_fs68.existsSync)(projectPath(`${VERITY_DIR}/memory/${args2.filePath}`));
40776
40359
  } catch {
40777
40360
  return false;
40778
40361
  }
40779
40362
  }
40780
40363
  function registerReflectCommand(program2) {
40781
- program2.command("reflect").description("Capture learnings \u2014 auto-extract or record a reflection").option("--user-input <text>", "The reflection to record (the agent-drafted or user-dictated text); - reads it from stdin, so the words never pass through shell quoting").option("--kind <kind>", "Node kind (decision, gotcha, pattern, security, quality, intent, domain, integration)", "gotcha").option("--task-id <id>", "Task to reflect on (defaults to current task)").option("--confirmed", "The USER authored or confirmed these exact words \u2014 records as human-authored (source: user, confidence 1.0)").option("--file-globs <glob...>", "Files this reflection is about. Without any, the paths cited in the text are used; a reflection matching no file never surfaces in a review").option("--autonomous", "(deprecated, ignored) reflections are always recorded without a confirm step").action(async (opts) => {
40364
+ program2.command("reflect").description("Capture learnings \u2014 auto-extract or record a reflection").option("--user-input <text>", "The reflection to record (the agent-drafted or user-dictated text)").option("--kind <kind>", "Node kind (decision, gotcha, pattern, security, quality, intent, domain, integration)", "gotcha").option("--task-id <id>", "Task to reflect on (defaults to current task)").option("--confirmed", "The USER authored or confirmed these exact words \u2014 records as human-authored (source: user, confidence 1.0)").option("--file-globs <glob...>", "Files this reflection is about. Without any, the paths cited in the text are used; a reflection matching no file never surfaces in a review").option("--autonomous", "(deprecated, ignored) reflections are always recorded without a confirm step").action(async (opts) => {
40782
40365
  const globals = program2.opts();
40783
- const input = readTextInput(opts.userInput, "--user-input");
40784
- if (!input.ok) {
40785
- printError(input.error);
40786
- process.exit(1);
40787
- }
40788
40366
  await ensureMemoryDir();
40789
40367
  const tokenResult = await resolveToken(globals.token);
40790
40368
  if (!tokenResult.ok) {
@@ -40845,7 +40423,7 @@ function registerReflectCommand(program2) {
40845
40423
  taskResolution = "none";
40846
40424
  printWarn("No active task found \u2014 saving as an unattached reflection.");
40847
40425
  }
40848
- const userInput = input.text;
40426
+ const userInput = opts.userInput;
40849
40427
  if (userInput) {
40850
40428
  const validKinds = ["decision", "gotcha", "pattern", "security", "quality", "intent", "domain", "integration"];
40851
40429
  const kind = validKinds.includes(opts.kind) ? opts.kind : "gotcha";
@@ -41209,9 +40787,9 @@ function registerRunCommand(program2) {
41209
40787
  }
41210
40788
 
41211
40789
  // src/commands/telemetry.ts
41212
- var import_node_fs71 = require("node:fs");
40790
+ var import_node_fs69 = require("node:fs");
41213
40791
  async function recordTelemetryChoice(choice) {
41214
- if (!(0, import_node_fs71.existsSync)(projectPath(SETUP_STATE_FILE))) return;
40792
+ if (!(0, import_node_fs69.existsSync)(projectPath(SETUP_STATE_FILE))) return;
41215
40793
  try {
41216
40794
  if ((await readSetupState())?.telemetry === choice) return;
41217
40795
  await writeSetupState({ telemetry: choice });
@@ -41288,8 +40866,8 @@ function registerTelemetryCommands(program2) {
41288
40866
  }
41289
40867
 
41290
40868
  // src/commands/prove.ts
41291
- var import_node_fs72 = require("node:fs");
41292
- var import_node_path55 = require("node:path");
40869
+ var import_node_fs70 = require("node:fs");
40870
+ var import_node_path52 = require("node:path");
41293
40871
 
41294
40872
  // src/lib/prove/hint-pool.ts
41295
40873
  var STOP2 = /* @__PURE__ */ new Set([
@@ -41416,13 +40994,7 @@ async function proveAuth(program2) {
41416
40994
  }
41417
40995
  function registerProveCommand(program2) {
41418
40996
  const prove = program2.command("prove").description("Formal verification (Lean 4) of small, risky pieces of code \u2014 on demand");
41419
- prove.command("candidates [paths...]").description("Rank code worth a formal model, from git history and risk signals").option("--since <when>", `git --since window (default: "${DEFAULT_SINCE}")`).option("--limit <n>", "Candidates to show", "10").option("--rank <ranker>", "deterministic | luna | jev (luna and jev need an API key)", "deterministic").option("--hint <text>", "What the user wants checked, in their words (biases the rank; implies --rank luna); - reads it from stdin, so the words never pass through shell quoting").option("--json", "Machine-readable output").action(async (paths, opts) => {
41420
- const hint = readTextInput(opts.hint, "--hint");
41421
- if (!hint.ok) {
41422
- printError(hint.error);
41423
- process.exit(2);
41424
- }
41425
- opts.hint = hint.text;
40997
+ prove.command("candidates [paths...]").description("Rank code worth a formal model, from git history and risk signals").option("--since <when>", `git --since window (default: "${DEFAULT_SINCE}")`).option("--limit <n>", "Candidates to show", "10").option("--rank <ranker>", "deterministic | luna | jev (luna and jev need an API key)", "deterministic").option("--hint <text>", "What the user wants checked, in their words (biases the rank; implies --rank luna)").option("--json", "Machine-readable output").action(async (paths, opts) => {
41426
40998
  if (opts.hint && opts.rank === "deterministic") opts.rank = "luna";
41427
40999
  const root = repoRoot();
41428
41000
  const ranker = RANKERS[opts.rank];
@@ -41431,7 +41003,7 @@ function registerProveCommand(program2) {
41431
41003
  process.exit(2);
41432
41004
  }
41433
41005
  const limit = Math.max(1, Math.min(50, Number(opts.limit) || 10));
41434
- let signals = collectRiskSignals(root, { since: opts.since, limit, paths: paths.map((p) => (0, import_node_path55.relative)(root, (0, import_node_path55.resolve)(p)) || ".") });
41006
+ let signals = collectRiskSignals(root, { since: opts.since, limit, paths: paths.map((p) => (0, import_node_path52.relative)(root, (0, import_node_path52.resolve)(p)) || ".") });
41435
41007
  if (opts.hint && paths.length === 0) {
41436
41008
  const hit = hintMatches(root, opts.hint);
41437
41009
  if (hit.files.length > 0) {
@@ -41485,7 +41057,7 @@ function registerProveCommand(program2) {
41485
41057
  });
41486
41058
  prove.command("check [model]").description("Elaborate a model (or every model) with the local Lean toolchain and report each property").option("--timeout <ms>", "Per-model timeout in ms", "120000").option("--json", "Machine-readable output").action((model, opts) => {
41487
41059
  const root = repoRoot();
41488
- if (!(0, import_node_fs72.existsSync)((0, import_node_path55.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41060
+ if (!(0, import_node_fs70.existsSync)((0, import_node_path52.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41489
41061
  printError(`No ${PROOFS_DIR}/ project here. Run \`verity prove init\` first.`);
41490
41062
  process.exit(2);
41491
41063
  }
@@ -41509,7 +41081,7 @@ ${build.stderr.split("\n").filter((l) => !l.startsWith("trace:")).slice(0, 20).j
41509
41081
  const reports = [];
41510
41082
  for (const f of files) {
41511
41083
  const report = checkModel(tc, root, f, { timeoutMs: Math.max(1e3, Number(opts.timeout) || 12e4) });
41512
- report.file = (0, import_node_path55.relative)(root, f);
41084
+ report.file = (0, import_node_path52.relative)(root, f);
41513
41085
  reports.push(report);
41514
41086
  try {
41515
41087
  writeResult(root, report);
@@ -41547,7 +41119,7 @@ ${build.stderr.split("\n").filter((l) => !l.startsWith("trace:")).slice(0, 20).j
41547
41119
  printError("Not logged in \u2014 replays run on the Verity service. Run `verity login` first.");
41548
41120
  process.exit(2);
41549
41121
  }
41550
- if (!(0, import_node_fs72.existsSync)((0, import_node_path55.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41122
+ if (!(0, import_node_fs70.existsSync)((0, import_node_path52.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41551
41123
  printError(`No ${PROOFS_DIR}/ project here. Run \`verity prove init\` first.`);
41552
41124
  process.exit(2);
41553
41125
  }
@@ -41578,7 +41150,7 @@ ${report.error ?? ""}`);
41578
41150
  printInfo(opts.property ? `${model} ${opts.property} has no counterexample to replay` : `${model} has no counterexample to replay`);
41579
41151
  return;
41580
41152
  }
41581
- const modelSource = readRegularFileInRoot(root, (0, import_node_path55.relative)(root, file), 512 * 1024);
41153
+ const modelSource = readRegularFileInRoot(root, (0, import_node_path52.relative)(root, file), 512 * 1024);
41582
41154
  if (!opts.json) printInfo(`replaying ${targets.length} counterexample(s) of ${model} in network-less containers (${Math.min(targets.length, REPLAY_CONCURRENCY)} at a time)\u2026`);
41583
41155
  const outcomes = await mapPool(targets, REPLAY_CONCURRENCY, async (p) => {
41584
41156
  const brief = buildReplayBrief(root, report, p, modelSource.ok ? modelSource.content : "");
@@ -41598,7 +41170,7 @@ ${report.error ?? ""}`);
41598
41170
  });
41599
41171
  prove.command("auto [files...]").description("The formal phase the pre-push guard runs: select one risky symbol among changed files, generate a model, check it, replay counterexamples (default files: the commits ahead of upstream)").option("--deadline <ms>", "Budget for the whole phase", "170000").option("--json", "Machine-readable output").action(async (paths, opts) => {
41600
41172
  const root = repoRoot();
41601
- let files = paths.map((p) => (0, import_node_path55.relative)(root, (0, import_node_path55.resolve)(p)));
41173
+ let files = paths.map((p) => (0, import_node_path52.relative)(root, (0, import_node_path52.resolve)(p)));
41602
41174
  if (files.length === 0) {
41603
41175
  const ahead = runGitSync(root, ["diff", "--name-only", "@{upstream}...HEAD"]);
41604
41176
  const fallback = ahead.ok ? ahead : runGitSync(root, ["diff", "--name-only", "HEAD~1..HEAD"]);
@@ -41627,19 +41199,7 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41627
41199
  }
41628
41200
  process.exit(outcome.findings.some((f) => f.verdict === "reproduced") ? 1 : 0);
41629
41201
  });
41630
- prove.command("generate <target>").description("Have the Verity service write a Lean model of one symbol (file#symbol), lint it, and check it here \u2014 up to 3 rounds").option("--lines <a-b>", "Model a region of the file (1-based, inclusive) instead of a named symbol").option("--hint <text>", "The user's worry, in their words (may become an intent property); - reads it from stdin").option("--revise <model>", "Revise this existing model after a diverged replay (with --note)").option("--note <text>", "What the replay showed was different (with --revise); - reads it from stdin").option("--json", "Machine-readable output").action(async (targetArg, opts) => {
41631
- if (opts.hint === "-" && opts.note === "-") {
41632
- printError("Only one of --hint and --note can read stdin (-).");
41633
- process.exit(2);
41634
- }
41635
- for (const flag of ["hint", "note"]) {
41636
- const input = readTextInput(opts[flag], `--${flag}`);
41637
- if (!input.ok) {
41638
- printError(input.error);
41639
- process.exit(2);
41640
- }
41641
- opts[flag] = input.text;
41642
- }
41202
+ prove.command("generate <target>").description("Have the Verity service write a Lean model of one symbol (file#symbol), lint it, and check it here \u2014 up to 3 rounds").option("--lines <a-b>", "Model a region of the file (1-based, inclusive) instead of a named symbol").option("--hint <text>", "The user's worry, in their words (may become an intent property)").option("--revise <model>", "Revise this existing model after a diverged replay (with --note)").option("--note <text>", "What the replay showed was different (with --revise)").option("--json", "Machine-readable output").action(async (targetArg, opts) => {
41643
41203
  const root = repoRoot();
41644
41204
  const auth2 = await proveAuth(program2);
41645
41205
  if (!auth2 && !(process.env.VERITY_PROVE_DIRECT === "1" && process.env.OPENAI_API_KEY)) {
@@ -41670,9 +41230,9 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41670
41230
  let revise;
41671
41231
  if (opts.revise) {
41672
41232
  const existing = resolveModelFile(root, opts.revise);
41673
- const src = existing ? readRegularFileInRoot(root, (0, import_node_path55.relative)(root, existing), 64 * 1024) : null;
41233
+ const src = existing ? readRegularFileInRoot(root, (0, import_node_path52.relative)(root, existing), 64 * 1024) : null;
41674
41234
  if (!src || !src.ok || !opts.note) {
41675
- printError("--revise needs an existing model under Models/ and --note - with what the replay showed on stdin");
41235
+ printError('--revise needs an existing model under Models/ and --note "<what the replay showed>"');
41676
41236
  process.exit(2);
41677
41237
  }
41678
41238
  revise = { source: src.content, note: opts.note };
@@ -41709,8 +41269,8 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41709
41269
  });
41710
41270
  prove.command("waive <file>").description("Dismiss the remembered formal finding(s) on a file for its current bytes \u2014 the accepted-risk path for a formal block").requiredOption("--reason <text>", "The human disposition this records (reviewer finding, ADR, \u2026)").action((file, opts) => {
41711
41271
  const root = repoRoot();
41712
- const rel0 = (0, import_node_path55.relative)(root, (0, import_node_path55.isAbsolute)(file) ? file : (0, import_node_path55.join)(root, file)).replace(/\\/g, "/");
41713
- const rel = rel0.startsWith("..") || (0, import_node_path55.isAbsolute)(rel0) ? null : rel0;
41272
+ const rel0 = (0, import_node_path52.relative)(root, (0, import_node_path52.isAbsolute)(file) ? file : (0, import_node_path52.join)(root, file)).replace(/\\/g, "/");
41273
+ const rel = rel0.startsWith("..") || (0, import_node_path52.isAbsolute)(rel0) ? null : rel0;
41714
41274
  if (!rel) {
41715
41275
  printError(`${file} is not inside this repository`);
41716
41276
  process.exit(2);
@@ -41726,8 +41286,8 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41726
41286
  });
41727
41287
  prove.command("hash <file>").description("Print the sha256 of a file, for a model header (Verity.model \u2026 sha256). Path is REPO-relative, as in the header").action((file) => {
41728
41288
  const root = repoRoot();
41729
- const rel = (0, import_node_path55.relative)(root, (0, import_node_path55.isAbsolute)(file) ? file : (0, import_node_path55.join)(root, file));
41730
- const digest = rel.startsWith("..") || (0, import_node_path55.isAbsolute)(rel) ? null : sha256InRoot(root, rel);
41289
+ const rel = (0, import_node_path52.relative)(root, (0, import_node_path52.isAbsolute)(file) ? file : (0, import_node_path52.join)(root, file));
41290
+ const digest = rel.startsWith("..") || (0, import_node_path52.isAbsolute)(rel) ? null : sha256InRoot(root, rel);
41731
41291
  if (!digest) {
41732
41292
  printError(`Cannot hash ${file}: it must be a regular file inside this repository (not a symlink)`);
41733
41293
  process.exit(2);
@@ -41761,10 +41321,10 @@ function refreshScaffold(root) {
41761
41321
  }
41762
41322
 
41763
41323
  // src/commands/lean.ts
41764
- var import_node_fs73 = require("node:fs");
41324
+ var import_node_fs71 = require("node:fs");
41765
41325
  var import_node_child_process20 = require("node:child_process");
41766
- var import_node_os12 = require("node:os");
41767
- var import_node_path56 = require("node:path");
41326
+ var import_node_os11 = require("node:os");
41327
+ var import_node_path53 = require("node:path");
41768
41328
  function registerLeanCommand(program2) {
41769
41329
  const lean = program2.command("lean").description("The Lean 4 toolchain formal verification needs (managed download, pinned by this CLI)");
41770
41330
  lean.command("status").option("--json", "Machine-readable output").description("Which toolchain would run, and whether it matches the pinned version").action((opts) => {
@@ -41781,7 +41341,7 @@ function registerLeanCommand(program2) {
41781
41341
  const managed = pinnedVersionDir();
41782
41342
  const matches = version ? version.includes(pin) : false;
41783
41343
  if (opts.json) {
41784
- printJson({ pinned: LEAN_TOOLCHAIN, found: tc?.lake ?? null, version, matches_pin: matches, managed_dir: managed, managed_installed: (0, import_node_fs73.existsSync)((0, import_node_path56.join)(managed, "bin")), asset: leanAssetName() });
41344
+ printJson({ pinned: LEAN_TOOLCHAIN, found: tc?.lake ?? null, version, matches_pin: matches, managed_dir: managed, managed_installed: (0, import_node_fs71.existsSync)((0, import_node_path53.join)(managed, "bin")), asset: leanAssetName() });
41785
41345
  return;
41786
41346
  }
41787
41347
  printInfo(`pinned: ${LEAN_TOOLCHAIN}`);
@@ -41795,11 +41355,11 @@ function registerLeanCommand(program2) {
41795
41355
  lean.command("install").description("Download and unpack the pinned Lean 4 into ~/.verity/lean/<version> (official release, \u2248800 MB, 2.7 GB on disk)").option("--yes", "Do not ask").option("--force", "Reinstall even if present").action(async (opts) => {
41796
41356
  const asset = leanAssetName();
41797
41357
  if (!asset) {
41798
- printError(`no Lean release for ${(0, import_node_os12.platform)()}/${(0, import_node_os12.arch)()}`);
41358
+ printError(`no Lean release for ${(0, import_node_os11.platform)()}/${(0, import_node_os11.arch)()}`);
41799
41359
  process.exit(2);
41800
41360
  }
41801
41361
  const dir = pinnedVersionDir();
41802
- if ((0, import_node_fs73.existsSync)((0, import_node_path56.join)(dir, "bin", "lake")) && !opts.force) {
41362
+ if ((0, import_node_fs71.existsSync)((0, import_node_path53.join)(dir, "bin", "lake")) && !opts.force) {
41803
41363
  printInfo(`already installed at ${dir}`);
41804
41364
  return;
41805
41365
  }
@@ -41835,18 +41395,18 @@ function registerLeanCommand(program2) {
41835
41395
  });
41836
41396
  lean.command("remove").description("Delete the Verity-managed toolchain for the pinned version").action(() => {
41837
41397
  const dir = pinnedVersionDir();
41838
- if (!(0, import_node_fs73.existsSync)(dir)) {
41398
+ if (!(0, import_node_fs71.existsSync)(dir)) {
41839
41399
  printInfo("nothing to remove");
41840
41400
  return;
41841
41401
  }
41842
- (0, import_node_fs73.rmSync)(dir, { recursive: true, force: true });
41402
+ (0, import_node_fs71.rmSync)(dir, { recursive: true, force: true });
41843
41403
  printInfo(`removed ${dir}`);
41844
41404
  });
41845
41405
  }
41846
41406
 
41847
41407
  // src/cli.ts
41848
- program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.85ad809").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) => {
41849
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.85ad809");
41408
+ program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.9001e08").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) => {
41409
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.9001e08");
41850
41410
  setUserNamedServiceUrl(program.opts().serviceUrl);
41851
41411
  try {
41852
41412
  await foldLegacyLocalCredential();