@codacy/verity-cli 0.34.0-experimental.85ad809 → 0.34.0-experimental.8b93a3c

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
@@ -18042,14 +17944,14 @@ var import_node_crypto10 = 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,
@@ -22994,17 +22881,17 @@ async function readHookStdin() {
22994
22881
  try {
22995
22882
  if (process.stdin.isTTY) return {};
22996
22883
  const chunks = [];
22997
- const timeout = new Promise((resolve9) => setTimeout(() => resolve9({}), 500));
22998
- const read2 = new Promise((resolve9) => {
22884
+ const timeout = new Promise((resolve8) => setTimeout(() => resolve8({}), 500));
22885
+ const read2 = new Promise((resolve8) => {
22999
22886
  process.stdin.on("data", (c) => chunks.push(c));
23000
22887
  process.stdin.on("end", () => {
23001
22888
  try {
23002
- resolve9(JSON.parse(Buffer.concat(chunks).toString("utf-8").trim() || "{}"));
22889
+ resolve8(JSON.parse(Buffer.concat(chunks).toString("utf-8").trim() || "{}"));
23003
22890
  } catch {
23004
- resolve9({});
22891
+ resolve8({});
23005
22892
  }
23006
22893
  });
23007
- process.stdin.on("error", () => resolve9({}));
22894
+ process.stdin.on("error", () => resolve8({}));
23008
22895
  process.stdin.resume();
23009
22896
  });
23010
22897
  return await Promise.race([read2, timeout]);
@@ -23100,7 +22987,7 @@ function isIgnored2(path) {
23100
22987
  }
23101
22988
  function listProjectFiles(root) {
23102
22989
  try {
23103
- const out2 = (0, import_node_child_process9.execSync)("git ls-files -z --cached --others --exclude-standard", {
22990
+ const out2 = (0, import_node_child_process9.execSync)("git ls-files -z", {
23104
22991
  cwd: root,
23105
22992
  encoding: "utf-8",
23106
22993
  maxBuffer: 32 * 1024 * 1024,
@@ -24952,56 +24839,20 @@ function registerStatusCommand(program2) {
24952
24839
  });
24953
24840
  }
24954
24841
 
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
24842
  // src/commands/feedback.ts
24987
24843
  function registerFeedbackCommand(program2) {
24988
24844
  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());
24845
+ feedbackCmd.command("message <text>").description("Send general feedback").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (message, opts) => {
24846
+ const globals = program2.opts();
24847
+ await sendGeneralFeedback(message, opts, globals);
24991
24848
  });
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) => {
24849
+ 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
24850
  const globals = program2.opts();
24994
24851
  const validActions = ["false_positive", "acknowledged", "will_fix_later", "wrong_severity", "useful"];
24995
24852
  if (!validActions.includes(action)) {
24996
24853
  printError(`Invalid action "${action}". Must be one of: ${validActions.join(", ")}`);
24997
24854
  process.exit(1);
24998
24855
  }
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
24856
  const tokenResult = await resolveToken(globals.token);
25006
24857
  if (!tokenResult.ok) {
25007
24858
  printError(tokenResult.error);
@@ -25037,28 +24888,21 @@ function registerFeedbackCommand(program2) {
25037
24888
  });
25038
24889
  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
24890
  if (!message) return;
25040
- await sendMessageArg(message, opts, program2.opts());
24891
+ const globals = program2.opts();
24892
+ await sendGeneralFeedback(message, opts, globals);
25041
24893
  });
25042
24894
  }
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
24895
  async function sendGeneralFeedback(message, opts, globals) {
25052
24896
  const tokenResult = await resolveToken(globals.token);
25053
24897
  if (!tokenResult.ok) {
25054
24898
  printError(tokenResult.error);
25055
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24899
+ printInfo(`Your message: ${message}`);
25056
24900
  process.exit(1);
25057
24901
  }
25058
24902
  const urlResult = await resolveServiceUrl(globals.serviceUrl);
25059
24903
  if (!urlResult.ok) {
25060
24904
  printError(urlResult.error);
25061
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24905
+ printInfo(`Your message: ${message}`);
25062
24906
  process.exit(1);
25063
24907
  }
25064
24908
  const body2 = { message };
@@ -25076,7 +24920,7 @@ async function sendGeneralFeedback(message, opts, globals) {
25076
24920
  });
25077
24921
  if (!result.ok) {
25078
24922
  printError(`Couldn't send feedback: ${result.error}`);
25079
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24923
+ printInfo(`Your message: ${message}`);
25080
24924
  process.exit(1);
25081
24925
  }
25082
24926
  printInfo("Thanks, feedback sent!");
@@ -25161,8 +25005,7 @@ function createRun(opts, globals) {
25161
25005
  }
25162
25006
 
25163
25007
  // src/commands/analyze/index.ts
25164
- var import_node_fs53 = require("node:fs");
25165
- var import_node_path40 = require("node:path");
25008
+ var import_node_fs52 = require("node:fs");
25166
25009
 
25167
25010
  // src/lib/repo-context.ts
25168
25011
  var import_node_child_process11 = require("node:child_process");
@@ -26126,7 +25969,7 @@ function installRunEvidence(run4) {
26126
25969
  }
26127
25970
 
26128
25971
  // src/lib/git-frame.ts
26129
- var import_node_fs40 = require("node:fs");
25972
+ var import_node_fs39 = require("node:fs");
26130
25973
  var import_node_os6 = require("node:os");
26131
25974
  var import_node_path30 = require("node:path");
26132
25975
  var import_node_path31 = require("node:path");
@@ -26296,14 +26139,14 @@ function gitAt(dir, args2) {
26296
26139
  }
26297
26140
  function realpathOr2(p) {
26298
26141
  try {
26299
- return import_node_fs40.realpathSync.native(p);
26142
+ return import_node_fs39.realpathSync.native(p);
26300
26143
  } catch {
26301
26144
  return (0, import_node_path30.resolve)(p);
26302
26145
  }
26303
26146
  }
26304
26147
  function resolveFrame(input) {
26305
26148
  const found = findMomentSegment(input.command, input.on);
26306
- const hookDirUsable = !!input.hookCwd && (0, import_node_fs40.existsSync)(input.hookCwd);
26149
+ const hookDirUsable = !!input.hookCwd && (0, import_node_fs39.existsSync)(input.hookCwd);
26307
26150
  const baseDir = hookDirUsable ? input.hookCwd : process.cwd();
26308
26151
  let anchor = hookDirUsable ? "hook-cwd" : "process-cwd";
26309
26152
  const refuse = (refusal) => ({
@@ -26326,7 +26169,7 @@ function resolveFrame(input) {
26326
26169
  if (dirs.size > 1) return refuse(`target:multiple ${found.moment} targets in one command`);
26327
26170
  const targetDir = dirs.size === 1 ? [...dirs][0] : baseDir;
26328
26171
  if (targetDir !== baseDir) {
26329
- if (!(0, import_node_fs40.existsSync)(targetDir)) return refuse(`target:directory does not exist: ${targetDir}`);
26172
+ if (!(0, import_node_fs39.existsSync)(targetDir)) return refuse(`target:directory does not exist: ${targetDir}`);
26330
26173
  dir = targetDir;
26331
26174
  }
26332
26175
  }
@@ -26513,7 +26356,7 @@ function stagedRange(frame, command) {
26513
26356
  return { kind: "staged", base: "HEAD", head: "INDEX", via: "staged-in-command", refusal: plan.reason };
26514
26357
  }
26515
26358
  const mergeHead = frame.gitDir ? (0, import_node_path31.join)(frame.gitDir, "MERGE_HEAD") : null;
26516
- if (mergeHead && (0, import_node_fs40.existsSync)(mergeHead)) {
26359
+ if (mergeHead && (0, import_node_fs39.existsSync)(mergeHead)) {
26517
26360
  const vsHead = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "HEAD"]).split("\n").filter(Boolean));
26518
26361
  const vsMerge = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "MERGE_HEAD"]).split("\n").filter(Boolean));
26519
26362
  const resolutions = new Set([...vsHead].filter((f) => vsMerge.has(f) && !isVerityOwnedPath(f)));
@@ -26647,7 +26490,7 @@ function truthy(v) {
26647
26490
  }
26648
26491
 
26649
26492
  // src/lib/transcript.ts
26650
- var import_node_fs41 = require("node:fs");
26493
+ var import_node_fs40 = require("node:fs");
26651
26494
  var MAX_READ_BYTES = 256 * 1024;
26652
26495
  var SMALL_FILE_BYTES = 64 * 1024;
26653
26496
  var MAX_FILES_LIST = 20;
@@ -26674,7 +26517,7 @@ async function extractActionSummary(transcriptPath) {
26674
26517
  function readTurnLines(transcriptPath) {
26675
26518
  let size;
26676
26519
  try {
26677
- size = (0, import_node_fs41.statSync)(transcriptPath).size;
26520
+ size = (0, import_node_fs40.statSync)(transcriptPath).size;
26678
26521
  } catch {
26679
26522
  return null;
26680
26523
  }
@@ -26682,7 +26525,7 @@ function readTurnLines(transcriptPath) {
26682
26525
  let raw;
26683
26526
  let windowed = false;
26684
26527
  if (size <= SMALL_FILE_BYTES) {
26685
- raw = (0, import_node_fs41.readFileSync)(transcriptPath, "utf-8");
26528
+ raw = (0, import_node_fs40.readFileSync)(transcriptPath, "utf-8");
26686
26529
  } else {
26687
26530
  windowed = true;
26688
26531
  const buf = Buffer.alloc(Math.min(MAX_READ_BYTES, size));
@@ -26928,7 +26771,7 @@ function sanitizeCommandWithLoss(rawCmd) {
26928
26771
  const lost = lines.slice(1).some((l) => l.trim().length > 0);
26929
26772
  const first = lines[0];
26930
26773
  const cmd = sanitizeCommand(first);
26931
- const hadSeparator = SEPARATORS.some((sep6) => first.indexOf(sep6) > 0);
26774
+ const hadSeparator = SEPARATORS.some((sep5) => first.indexOf(sep5) > 0);
26932
26775
  return { cmd, lost: lost || !hadSeparator && first.length > MAX_COMMAND_CHARS };
26933
26776
  }
26934
26777
  var SEPARATORS = [" | ", " > ", " >> ", " 2>", " && ", " ; "];
@@ -26937,11 +26780,11 @@ function sanitizeCommand(rawCmd) {
26937
26780
  let cmd = rawCmd.split("\n")[0];
26938
26781
  let cut = -1;
26939
26782
  let marker = "";
26940
- for (const sep6 of SEPARATORS) {
26941
- const idx = cmd.indexOf(sep6);
26783
+ for (const sep5 of SEPARATORS) {
26784
+ const idx = cmd.indexOf(sep5);
26942
26785
  if (idx > 0 && (cut === -1 || idx < cut)) {
26943
26786
  cut = idx;
26944
- marker = sep6.trim();
26787
+ marker = sep5.trim();
26945
26788
  }
26946
26789
  }
26947
26790
  if (cut > -1) cmd = cmd.slice(0, cut);
@@ -26965,28 +26808,28 @@ async function readStopHookStdin() {
26965
26808
  try {
26966
26809
  if (process.stdin.isTTY) return empty;
26967
26810
  const chunks = [];
26968
- const timeout = new Promise((resolve9) => setTimeout(() => resolve9(empty), 500));
26969
- const read2 = new Promise((resolve9) => {
26811
+ const timeout = new Promise((resolve8) => setTimeout(() => resolve8(empty), 500));
26812
+ const read2 = new Promise((resolve8) => {
26970
26813
  process.stdin.on("data", (chunk) => chunks.push(chunk));
26971
26814
  process.stdin.on("end", () => {
26972
26815
  const raw = Buffer.concat(chunks).toString("utf-8").trim();
26973
26816
  if (!raw) {
26974
- resolve9(empty);
26817
+ resolve8(empty);
26975
26818
  return;
26976
26819
  }
26977
26820
  try {
26978
26821
  const data = JSON.parse(raw);
26979
- resolve9({
26822
+ resolve8({
26980
26823
  assistantMessage: typeof data.last_assistant_message === "string" ? data.last_assistant_message : null,
26981
26824
  stopReason: typeof data.stop_reason === "string" ? data.stop_reason : null,
26982
26825
  transcriptPath: typeof data.transcript_path === "string" ? data.transcript_path : null,
26983
26826
  sessionId: typeof data.session_id === "string" ? data.session_id : null
26984
26827
  });
26985
26828
  } catch {
26986
- resolve9(empty);
26829
+ resolve8(empty);
26987
26830
  }
26988
26831
  });
26989
- process.stdin.on("error", () => resolve9(empty));
26832
+ process.stdin.on("error", () => resolve8(empty));
26990
26833
  process.stdin.resume();
26991
26834
  });
26992
26835
  return await Promise.race([read2, timeout]);
@@ -27252,7 +27095,7 @@ function channelSilence(input) {
27252
27095
  // src/lib/cli-version.ts
27253
27096
  function cliVersion() {
27254
27097
  try {
27255
- return true ? "0.34.0-experimental.85ad809" : "dev";
27098
+ return true ? "0.34.0-experimental.8b93a3c" : "dev";
27256
27099
  } catch {
27257
27100
  return "dev";
27258
27101
  }
@@ -27293,171 +27136,7 @@ async function sendSkipBeacon(ctx, reason) {
27293
27136
 
27294
27137
  // src/lib/static-analysis.ts
27295
27138
  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
27139
+ var import_node_fs41 = require("node:fs");
27461
27140
  var SEVERITY_ORDER = {
27462
27141
  Error: 0,
27463
27142
  Critical: 0,
@@ -27513,7 +27192,7 @@ function runCodacyAnalysis(files) {
27513
27192
  if (files.length === 0) return empty;
27514
27193
  const existingFiles = files.filter((f) => {
27515
27194
  try {
27516
- return (0, import_node_fs42.existsSync)(f);
27195
+ return (0, import_node_fs41.existsSync)(f);
27517
27196
  } catch {
27518
27197
  return false;
27519
27198
  }
@@ -27545,10 +27224,7 @@ function interpretAnalyzerRun(run4) {
27545
27224
  } catch {
27546
27225
  return withFailure("unparseable_output", output);
27547
27226
  }
27548
- const reported = parsed.issues ?? [];
27549
- const issues = reported.filter(
27550
- (i2) => !isEnvironmentGlobalNoUndef(i2.patternId ?? "", i2.message ?? "", i2.filePath ?? "")
27551
- );
27227
+ const issues = parsed.issues ?? [];
27552
27228
  const findings = issues.map((issue) => ({
27553
27229
  rule_id: issue.patternId ?? "",
27554
27230
  tool: issue.toolId ?? "",
@@ -27571,7 +27247,7 @@ function interpretAnalyzerRun(run4) {
27571
27247
  );
27572
27248
  const analyzerErrors = parsed.errors ?? [];
27573
27249
  let failure;
27574
- if (reported.length === 0) {
27250
+ if (findings.length === 0) {
27575
27251
  if (analyzerErrors.length > 0) {
27576
27252
  const first = analyzerErrors[0];
27577
27253
  failure = {
@@ -27785,7 +27461,7 @@ async function scope(run4) {
27785
27461
  }
27786
27462
 
27787
27463
  // src/lib/specs.ts
27788
- var import_node_fs43 = require("node:fs");
27464
+ var import_node_fs42 = require("node:fs");
27789
27465
  var import_node_path32 = require("node:path");
27790
27466
  var SPEC_CANDIDATES = [
27791
27467
  "CLAUDE.md",
@@ -27827,7 +27503,7 @@ function discoverSpecs(consulted = []) {
27827
27503
  const totalCap = relevant ? MAX_TOTAL_SPEC_BYTES : UNCONSULTED_TOTAL_BYTES;
27828
27504
  if (totalBytes >= totalCap) return false;
27829
27505
  if (seen.has(specPath)) return true;
27830
- if (!(0, import_node_fs43.existsSync)(specPath)) return true;
27506
+ if (!(0, import_node_fs42.existsSync)(specPath)) return true;
27831
27507
  seen.add(specPath);
27832
27508
  const remaining = totalCap - totalBytes;
27833
27509
  const fileCap = relevant ? MAX_SPEC_FILE_BYTES : UNCONSULTED_FILE_BYTES;
@@ -27850,7 +27526,7 @@ function discoverSpecs(consulted = []) {
27850
27526
  if (!addSpec(candidate)) break;
27851
27527
  }
27852
27528
  for (const dir of ["spec", "docs"]) {
27853
- if (!(0, import_node_fs43.existsSync)(dir)) continue;
27529
+ if (!(0, import_node_fs42.existsSync)(dir)) continue;
27854
27530
  try {
27855
27531
  const mdFiles = findMdFiles(dir, 2).sort();
27856
27532
  for (const mdFile of mdFiles) {
@@ -27865,7 +27541,7 @@ function findMdFiles(dir, maxDepth, depth = 0) {
27865
27541
  if (depth >= maxDepth) return [];
27866
27542
  const result = [];
27867
27543
  try {
27868
- const entries = (0, import_node_fs43.readdirSync)(dir, { withFileTypes: true });
27544
+ const entries = (0, import_node_fs42.readdirSync)(dir, { withFileTypes: true });
27869
27545
  for (const entry of entries) {
27870
27546
  const fullPath = (0, import_node_path32.join)(dir, entry.name);
27871
27547
  if (entry.isFile() && entry.name.endsWith(".md")) {
@@ -27885,13 +27561,13 @@ function discoverPlans() {
27885
27561
  if (isRealDirectoryChain(process.cwd(), [".claude", "plans"])) {
27886
27562
  sources.push({ root: process.cwd(), prefix: (0, import_node_path32.join)(".claude", "plans") });
27887
27563
  }
27888
- if (home && (0, import_node_fs43.existsSync)(homePlansDir)) sources.push({ root: homePlansDir, prefix: "" });
27564
+ if (home && (0, import_node_fs42.existsSync)(homePlansDir)) sources.push({ root: homePlansDir, prefix: "" });
27889
27565
  const candidates2 = [];
27890
27566
  const seen = /* @__PURE__ */ new Set();
27891
27567
  for (const source2 of sources) {
27892
27568
  let names2;
27893
27569
  try {
27894
- names2 = (0, import_node_fs43.readdirSync)(source2.prefix ? (0, import_node_path32.join)(source2.root, source2.prefix) : source2.root);
27570
+ names2 = (0, import_node_fs42.readdirSync)(source2.prefix ? (0, import_node_path32.join)(source2.root, source2.prefix) : source2.root);
27895
27571
  } catch {
27896
27572
  continue;
27897
27573
  }
@@ -27918,7 +27594,7 @@ function isRealDirectoryChain(root, parts2) {
27918
27594
  for (const part of parts2) {
27919
27595
  current = (0, import_node_path32.join)(current, part);
27920
27596
  try {
27921
- if (!(0, import_node_fs43.lstatSync)(current).isDirectory()) return false;
27597
+ if (!(0, import_node_fs42.lstatSync)(current).isDirectory()) return false;
27922
27598
  } catch {
27923
27599
  return false;
27924
27600
  }
@@ -27933,7 +27609,7 @@ function discoverGuardDocs(rangeFiles2) {
27933
27609
  if (result.length >= MAX_SPEC_FILES) break;
27934
27610
  if (!GUARD_DOC_EXT.test(path)) continue;
27935
27611
  if (path.startsWith("/") || path.includes("..")) continue;
27936
- if (!(0, import_node_fs43.existsSync)(path)) continue;
27612
+ if (!(0, import_node_fs42.existsSync)(path)) continue;
27937
27613
  const opened = openRegularInRoot(process.cwd(), path);
27938
27614
  if (!opened.ok) continue;
27939
27615
  if (opened.size > MAX_PLAN_FILE_BYTES || totalBytes + opened.size > MAX_TOTAL_SPEC_BYTES) {
@@ -28119,7 +27795,7 @@ async function mode(run4) {
28119
27795
  }
28120
27796
 
28121
27797
  // src/lib/fold.ts
28122
- var import_node_fs44 = require("node:fs");
27798
+ var import_node_fs43 = require("node:fs");
28123
27799
  var import_node_path33 = require("node:path");
28124
27800
  var KNOWN_RECORD_TYPES = /* @__PURE__ */ new Set([
28125
27801
  "user",
@@ -28257,7 +27933,7 @@ function candidateRoots(repoRoot2) {
28257
27933
  const norm2 = repoRoot2.replace(/\\/g, "/").replace(/\/+$/, "");
28258
27934
  const out2 = [norm2];
28259
27935
  try {
28260
- const real = import_node_fs44.realpathSync.native(norm2).replace(/\\/g, "/").replace(/\/+$/, "");
27936
+ const real = import_node_fs43.realpathSync.native(norm2).replace(/\\/g, "/").replace(/\/+$/, "");
28261
27937
  if (real !== norm2) out2.push(real);
28262
27938
  } catch {
28263
27939
  }
@@ -28345,8 +28021,8 @@ function fold(transcriptPath, opts = {}) {
28345
28021
  }
28346
28022
  };
28347
28023
  try {
28348
- if (!(0, import_node_fs44.existsSync)(transcriptPath)) return result;
28349
- ingest((0, import_node_fs44.readFileSync)(transcriptPath, "utf8"), "agent");
28024
+ if (!(0, import_node_fs43.existsSync)(transcriptPath)) return result;
28025
+ ingest((0, import_node_fs43.readFileSync)(transcriptPath, "utf8"), "agent");
28350
28026
  result.coverage.complete = true;
28351
28027
  } catch {
28352
28028
  return result;
@@ -28357,19 +28033,19 @@ function fold(transcriptPath, opts = {}) {
28357
28033
  (0, import_node_path33.basename)(transcriptPath).replace(/\.jsonl$/, ""),
28358
28034
  "subagents"
28359
28035
  );
28360
- if ((0, import_node_fs44.existsSync)(sidecarDir)) {
28036
+ if ((0, import_node_fs43.existsSync)(sidecarDir)) {
28361
28037
  const maxFiles = opts.maxSidecars ?? 200;
28362
28038
  const maxBytes = opts.maxSidecarBytes ?? 16 * 1024 * 1024;
28363
28039
  const found = [];
28364
28040
  const walk2 = (d, depth) => {
28365
28041
  if (depth > 4) return;
28366
- for (const e of (0, import_node_fs44.readdirSync)(d, { withFileTypes: true })) {
28042
+ for (const e of (0, import_node_fs43.readdirSync)(d, { withFileTypes: true })) {
28367
28043
  const p = (0, import_node_path33.join)(d, e.name);
28368
28044
  if (e.isDirectory()) {
28369
28045
  walk2(p, depth + 1);
28370
28046
  } else if (e.name.startsWith("agent-") && e.name.endsWith(".jsonl")) {
28371
28047
  try {
28372
- const st = (0, import_node_fs44.statSync)(p);
28048
+ const st = (0, import_node_fs43.statSync)(p);
28373
28049
  found.push({ path: p, size: st.size, mtimeMs: st.mtimeMs });
28374
28050
  } catch {
28375
28051
  result.coverage.malformed++;
@@ -28386,7 +28062,7 @@ function fold(transcriptPath, opts = {}) {
28386
28062
  continue;
28387
28063
  }
28388
28064
  try {
28389
- ingest((0, import_node_fs44.readFileSync)(f.path, "utf8"), "subagent");
28065
+ ingest((0, import_node_fs43.readFileSync)(f.path, "utf8"), "subagent");
28390
28066
  bytes += f.size;
28391
28067
  result.coverage.subagentFiles++;
28392
28068
  } catch {
@@ -28421,7 +28097,7 @@ function fold(transcriptPath, opts = {}) {
28421
28097
  }
28422
28098
  function classifyUnobserved(path) {
28423
28099
  try {
28424
- const st = (0, import_node_fs44.statSync)(path);
28100
+ const st = (0, import_node_fs43.statSync)(path);
28425
28101
  if (!st.isFile()) return "unreadable";
28426
28102
  } catch {
28427
28103
  return "unreadable";
@@ -28736,20 +28412,20 @@ async function evidence(run4) {
28736
28412
  }
28737
28413
 
28738
28414
  // src/lib/cache-cleanup.ts
28739
- var import_node_fs45 = require("node:fs");
28415
+ var import_node_fs44 = require("node:fs");
28740
28416
  var import_node_path34 = require("node:path");
28741
28417
  var CACHE_TTL_DAYS = 7;
28742
28418
  function pruneStaleCache() {
28743
28419
  try {
28744
28420
  const dir = projectPath(CACHE_DIR);
28745
28421
  const cutoff = Date.now() - CACHE_TTL_DAYS * 24 * 3600 * 1e3;
28746
- for (const entry of (0, import_node_fs45.readdirSync)(dir)) {
28422
+ for (const entry of (0, import_node_fs44.readdirSync)(dir)) {
28747
28423
  if (!entry.startsWith("pending-")) continue;
28748
28424
  const path = (0, import_node_path34.join)(dir, entry);
28749
28425
  try {
28750
- const stat3 = (0, import_node_fs45.statSync)(path);
28426
+ const stat3 = (0, import_node_fs44.statSync)(path);
28751
28427
  if (stat3.mtimeMs < cutoff) {
28752
- (0, import_node_fs45.unlinkSync)(path);
28428
+ (0, import_node_fs44.unlinkSync)(path);
28753
28429
  logEvent("cache_entry_pruned", {
28754
28430
  path: entry,
28755
28431
  age_days: Math.round((Date.now() - stat3.mtimeMs) / 864e5)
@@ -28763,7 +28439,7 @@ function pruneStaleCache() {
28763
28439
  }
28764
28440
 
28765
28441
  // src/lib/context-files.ts
28766
- var import_node_fs46 = require("node:fs");
28442
+ var import_node_fs45 = require("node:fs");
28767
28443
  var import_node_os7 = require("node:os");
28768
28444
  var MAX_CONTEXT_FILES = 10;
28769
28445
  var MAX_CONTEXT_FILE_BYTES = 10240;
@@ -28821,7 +28497,7 @@ function gatherContextFiles(contextPaths, deltaFiles, opts) {
28821
28497
  continue;
28822
28498
  }
28823
28499
  try {
28824
- const content = (0, import_node_fs46.readFileSync)(safePath, "utf8");
28500
+ const content = (0, import_node_fs45.readFileSync)(safePath, "utf8");
28825
28501
  const bytes = Buffer.byteLength(content);
28826
28502
  if (bytes > MAX_CONTEXT_FILE_BYTES) {
28827
28503
  logEvent("context_file_skipped", { path: filePath, reason: "too_large", bytes });
@@ -28979,7 +28655,7 @@ function languageOf2(path) {
28979
28655
  }
28980
28656
 
28981
28657
  // src/lib/code/runtime.ts
28982
- var import_node_fs47 = require("node:fs");
28658
+ var import_node_fs46 = require("node:fs");
28983
28659
  var import_node_path35 = require("node:path");
28984
28660
  var import_web_tree_sitter2 = __toESM2(require_web_tree_sitter2());
28985
28661
 
@@ -29051,7 +28727,7 @@ function grammarCandidates(file, pkg, env = process.env) {
29051
28727
  }
29052
28728
  function locateGrammar(id, env = process.env) {
29053
28729
  const g = grammars_default[id];
29054
- return grammarCandidates(g.file, g.package, env).find((p) => (0, import_node_fs47.existsSync)(p)) ?? null;
28730
+ return grammarCandidates(g.file, g.package, env).find((p) => (0, import_node_fs46.existsSync)(p)) ?? null;
29055
28731
  }
29056
28732
  var loading = null;
29057
28733
  function loadRuntime(env = process.env) {
@@ -31380,7 +31056,7 @@ async function repoContext(run4) {
31380
31056
 
31381
31057
  // src/lib/seed-runner.ts
31382
31058
  var import_promises15 = require("node:fs/promises");
31383
- var import_node_fs48 = require("node:fs");
31059
+ var import_node_fs47 = require("node:fs");
31384
31060
  var import_node_path36 = require("node:path");
31385
31061
  var import_yaml4 = __toESM2(require_dist());
31386
31062
 
@@ -31605,7 +31281,7 @@ async function localSeedTitles(memoryDir3 = MEMORY_DIR) {
31605
31281
  const titles = /* @__PURE__ */ new Set();
31606
31282
  for (const dir of NODE_DIRS) {
31607
31283
  const full = (0, import_node_path36.join)(memoryDir3, dir);
31608
- if (!(0, import_node_fs48.existsSync)(full)) continue;
31284
+ if (!(0, import_node_fs47.existsSync)(full)) continue;
31609
31285
  let files;
31610
31286
  try {
31611
31287
  files = await (0, import_promises15.readdir)(full);
@@ -31687,7 +31363,7 @@ function renderNodeMarkdown(candidate, nodeId, createdAt) {
31687
31363
  return fm;
31688
31364
  }
31689
31365
  async function runSeed(opts) {
31690
- if (!(0, import_node_fs48.existsSync)(STANDARD_FILE)) {
31366
+ if (!(0, import_node_fs47.existsSync)(STANDARD_FILE)) {
31691
31367
  return { created: 0, existing: 0, failed: 0, skipped: "no_standard", candidates: [] };
31692
31368
  }
31693
31369
  let standardDoc;
@@ -31699,7 +31375,7 @@ async function runSeed(opts) {
31699
31375
  }
31700
31376
  const knowledgeSpec = standardDoc.knowledge_spec ?? {};
31701
31377
  let readmeContent;
31702
- if ((0, import_node_fs48.existsSync)("README.md")) {
31378
+ if ((0, import_node_fs47.existsSync)("README.md")) {
31703
31379
  try {
31704
31380
  readmeContent = await (0, import_promises15.readFile)("README.md", "utf-8");
31705
31381
  } catch {
@@ -31707,7 +31383,7 @@ async function runSeed(opts) {
31707
31383
  }
31708
31384
  let claudeMdContent;
31709
31385
  for (const p of ["CLAUDE.md", ".claude/CLAUDE.md"]) {
31710
- if ((0, import_node_fs48.existsSync)(p)) {
31386
+ if ((0, import_node_fs47.existsSync)(p)) {
31711
31387
  try {
31712
31388
  claudeMdContent = await (0, import_promises15.readFile)(p, "utf-8");
31713
31389
  break;
@@ -31787,7 +31463,7 @@ async function runSeed(opts) {
31787
31463
  continue;
31788
31464
  }
31789
31465
  const deduplicated = res.data.deduplicated === true;
31790
- if (deduplicated && (0, import_node_fs48.existsSync)(targetPath)) {
31466
+ if (deduplicated && (0, import_node_fs47.existsSync)(targetPath)) {
31791
31467
  existing++;
31792
31468
  continue;
31793
31469
  }
@@ -31809,7 +31485,7 @@ async function runSeed(opts) {
31809
31485
  }
31810
31486
 
31811
31487
  // src/commands/analyze/phases/08-memory-manifest.ts
31812
- var import_node_fs49 = require("node:fs");
31488
+ var import_node_fs48 = require("node:fs");
31813
31489
  var import_node_path37 = require("node:path");
31814
31490
  async function memoryManifest(run4) {
31815
31491
  const { globals } = run4;
@@ -31821,8 +31497,8 @@ async function memoryManifest(run4) {
31821
31497
  try {
31822
31498
  await ensureMemoryDir();
31823
31499
  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);
31500
+ const hasStandard = (0, import_node_fs48.existsSync)(STANDARD_FILE);
31501
+ const alreadyTried = (0, import_node_fs48.existsSync)(seedMarker);
31826
31502
  if (hasStandard && !alreadyTried) {
31827
31503
  const preManifest = await buildManifest();
31828
31504
  if (preManifest.nodes.length === 0) {
@@ -31835,7 +31511,7 @@ async function memoryManifest(run4) {
31835
31511
  dryRun: false
31836
31512
  });
31837
31513
  if (seedResult.created > 0 || seedResult.existing > 0) {
31838
- (0, import_node_fs49.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created} existing=${seedResult.existing}
31514
+ (0, import_node_fs48.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created} existing=${seedResult.existing}
31839
31515
  `);
31840
31516
  if (seedResult.created > 0) {
31841
31517
  autoSeedNotice = `Seeded ${seedResult.created} knowledge node(s) from your existing Standard (one-time).`;
@@ -31846,7 +31522,7 @@ async function memoryManifest(run4) {
31846
31522
  failed: seedResult.failed
31847
31523
  });
31848
31524
  } else if (seedResult.skipped === "already_seeded") {
31849
- (0, import_node_fs49.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
31525
+ (0, import_node_fs48.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
31850
31526
  `);
31851
31527
  } else {
31852
31528
  logEvent("auto_seed_noop", {
@@ -32051,7 +31727,7 @@ function boundPaths(paths, first, max = MAX_WIRE_PATHS) {
32051
31727
  }
32052
31728
 
32053
31729
  // src/lib/note-budget.ts
32054
- var import_node_fs50 = require("node:fs");
31730
+ var import_node_fs49 = require("node:fs");
32055
31731
  var ADVISORY_BUDGET = { PASS: 1, WARN: 2 };
32056
31732
  var EPISODE_STALE_SECONDS = 30 * 60;
32057
31733
  var FRESH = { delivered: 0, tasksCompleted: 0, ts: 0 };
@@ -32073,9 +31749,9 @@ function advisoryBudgetSpent(episode, rawDecision) {
32073
31749
  }
32074
31750
  function readAdvisoryEpisode(sessionId) {
32075
31751
  const file = scopedFile(ADVISORY_EPISODE_FILE, sessionId);
32076
- if (!(0, import_node_fs50.existsSync)(file)) return null;
31752
+ if (!(0, import_node_fs49.existsSync)(file)) return null;
32077
31753
  try {
32078
- const o = JSON.parse((0, import_node_fs50.readFileSync)(file, "utf-8")) ?? {};
31754
+ const o = JSON.parse((0, import_node_fs49.readFileSync)(file, "utf-8")) ?? {};
32079
31755
  const delivered = typeof o.delivered === "number" ? o.delivered : NaN;
32080
31756
  if (isNaN(delivered)) return null;
32081
31757
  return {
@@ -32089,8 +31765,8 @@ function readAdvisoryEpisode(sessionId) {
32089
31765
  }
32090
31766
  function writeAdvisoryEpisode(episode, sessionId) {
32091
31767
  try {
32092
- (0, import_node_fs50.mkdirSync)(VERITY_DIR, { recursive: true });
32093
- (0, import_node_fs50.writeFileSync)(
31768
+ (0, import_node_fs49.mkdirSync)(VERITY_DIR, { recursive: true });
31769
+ (0, import_node_fs49.writeFileSync)(
32094
31770
  scopedFile(ADVISORY_EPISODE_FILE, sessionId),
32095
31771
  JSON.stringify({ v: 1, ...episode })
32096
31772
  );
@@ -32427,14 +32103,14 @@ async function buildRequest(run4) {
32427
32103
  }
32428
32104
 
32429
32105
  // src/lib/offline.ts
32430
- var import_node_fs51 = require("node:fs");
32106
+ var import_node_fs50 = require("node:fs");
32431
32107
  var import_node_crypto14 = require("node:crypto");
32432
32108
  function cacheRequest(body2) {
32433
32109
  try {
32434
- (0, import_node_fs51.mkdirSync)(CACHE_DIR, { recursive: true });
32110
+ (0, import_node_fs50.mkdirSync)(CACHE_DIR, { recursive: true });
32435
32111
  const suffix = (0, import_node_crypto14.randomBytes)(4).toString("hex");
32436
32112
  const filename = `pending-${Math.floor(Date.now() / 1e3)}-${suffix}.json`;
32437
- (0, import_node_fs51.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(redactRequest(body2)));
32113
+ (0, import_node_fs50.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(redactRequest(body2)));
32438
32114
  } catch {
32439
32115
  }
32440
32116
  }
@@ -32556,7 +32232,7 @@ async function transmit(run4) {
32556
32232
  }
32557
32233
 
32558
32234
  // src/commands/analyze/phases/13-reconcile.ts
32559
- var import_node_fs52 = require("node:fs");
32235
+ var import_node_fs51 = require("node:fs");
32560
32236
  var import_node_path39 = require("node:path");
32561
32237
  async function reconcile(run4) {
32562
32238
  const { actionSummary, allChanged, analyzable, baseline, baselineSessionId, codeDelta, contentHash, conversation, decision, foldResult, memory: memory2, memorySession, response, reviewable, securityFiles, turnId } = run4;
@@ -32586,7 +32262,7 @@ async function reconcile(run4) {
32586
32262
  const st = foldDossier(memorySession.d);
32587
32263
  openElsewhere = openBlockingElsewhere(st.statements, sentPaths, (file, line2) => {
32588
32264
  try {
32589
- const src = (0, import_node_fs52.readFileSync)((0, import_node_path39.join)(repoRoot(), file), "utf8").split("\n");
32265
+ const src = (0, import_node_fs51.readFileSync)((0, import_node_path39.join)(repoRoot(), file), "utf8").split("\n");
32590
32266
  const at = src[line2 - 1];
32591
32267
  return at === void 0 ? null : lineSha(at);
32592
32268
  } catch {
@@ -33408,7 +33084,7 @@ function registerAnalyzeCommand(program2) {
33408
33084
  var tracing = () => process.env.VERITY_TRACE_PHASES === "1";
33409
33085
  async function runAnalyze(opts, globals) {
33410
33086
  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');
33087
+ (0, import_node_fs52.writeSync)(2, '[verity] not set up in this project \u2014 run "verity init" first.\n');
33412
33088
  process.exit(0);
33413
33089
  }
33414
33090
  const run4 = createRun(opts, globals);
@@ -33429,12 +33105,11 @@ async function runAnalyze(opts, globals) {
33429
33105
  }
33430
33106
 
33431
33107
  // src/commands/baseline.ts
33432
- var import_node_fs55 = require("node:fs");
33433
- var import_node_path42 = require("node:path");
33108
+ var import_node_fs54 = require("node:fs");
33434
33109
 
33435
33110
  // src/lib/project-skills.ts
33436
- var import_node_fs54 = require("node:fs");
33437
- var import_node_path41 = require("node:path");
33111
+ var import_node_fs53 = require("node:fs");
33112
+ var import_node_path40 = require("node:path");
33438
33113
  var PROJECT_SKILL_NAMES = [
33439
33114
  "verity-setup",
33440
33115
  "verity-analyze",
@@ -33460,14 +33135,14 @@ var LEGACY_SKILL_NAMES = [
33460
33135
  var ALL = [...PROJECT_SKILL_NAMES, ...LEGACY_SKILL_NAMES];
33461
33136
  function staleProjectSkills() {
33462
33137
  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)));
33138
+ if (!(0, import_node_fs53.existsSync)(root)) return [];
33139
+ return ALL.filter((name2) => (0, import_node_fs53.existsSync)((0, import_node_path40.join)(root, name2)));
33465
33140
  }
33466
33141
  function removeProjectSkills() {
33467
33142
  const root = projectPath(".claude/skills");
33468
33143
  const removed = [];
33469
33144
  for (const name2 of staleProjectSkills()) {
33470
- (0, import_node_fs54.rmSync)((0, import_node_path41.join)(root, name2), { recursive: true, force: true });
33145
+ (0, import_node_fs53.rmSync)((0, import_node_path40.join)(root, name2), { recursive: true, force: true });
33471
33146
  removed.push(name2);
33472
33147
  }
33473
33148
  return removed;
@@ -33500,7 +33175,6 @@ function registerBaselineCommands(program2) {
33500
33175
  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
33176
  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
33177
  if (!verityConfigured()) {
33503
- if (isMachineStore((0, import_node_path42.join)(repoRoot(), VERITY_DIR))) process.exit(0);
33504
33178
  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
33179
  const lines = [
33506
33180
  `Verity is installed but this project is not set up yet, so the quality gate will not review anything here. ${how}`
@@ -33533,13 +33207,13 @@ function registerBaselineCommands(program2) {
33533
33207
  let memoryMsg = null;
33534
33208
  let memoryAgentLine = null;
33535
33209
  const memoryNotice = projectPath(`${VERITY_DIR}/.memory-fence-notice`);
33536
- if (realStart && !(0, import_node_fs55.existsSync)(memoryNotice)) {
33210
+ if (realStart && !(0, import_node_fs54.existsSync)(memoryNotice)) {
33537
33211
  const trackedGraph = memoryOptOut() ? 0 : committedMemoryFiles().length;
33538
33212
  if (trackedGraph > 0) {
33539
33213
  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
33214
  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
33215
  try {
33542
- (0, import_node_fs55.writeFileSync)(memoryNotice, (/* @__PURE__ */ new Date()).toISOString() + "\n");
33216
+ (0, import_node_fs54.writeFileSync)(memoryNotice, (/* @__PURE__ */ new Date()).toISOString() + "\n");
33543
33217
  } catch {
33544
33218
  }
33545
33219
  }
@@ -33640,16 +33314,10 @@ function hookSource(value) {
33640
33314
  }
33641
33315
 
33642
33316
  // src/commands/review.ts
33643
- var import_node_fs56 = require("node:fs");
33317
+ var import_node_fs55 = require("node:fs");
33644
33318
  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) => {
33319
+ 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
33320
  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
33321
  try {
33654
33322
  await runReview(opts, globals);
33655
33323
  } catch (err2) {
@@ -33663,7 +33331,7 @@ async function runReview(opts, globals) {
33663
33331
  const changedFiles = opts.changed ? opts.changed.split(",").map((f) => f.trim()).filter(Boolean) : allFiles;
33664
33332
  const analyzable = filterAnalyzable(allFiles);
33665
33333
  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);
33334
+ const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs55.existsSync)(f) || resolveFile(f) !== null);
33667
33335
  const staticResults = runCodacyAnalysisIfAvailable(scannable);
33668
33336
  const codeDelta = collectCodeDelta(allFiles);
33669
33337
  const tokenResult = await resolveToken(globals.token);
@@ -33729,40 +33397,19 @@ async function runReview(opts, globals) {
33729
33397
  }
33730
33398
 
33731
33399
  // src/commands/guard.ts
33732
- var import_node_fs61 = require("node:fs");
33733
- var import_node_path48 = require("node:path");
33400
+ var import_node_fs59 = require("node:fs");
33401
+ var import_node_path45 = require("node:path");
33734
33402
 
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
- }
33403
+ // src/lib/terminal-text.ts
33404
+ var CONTROL = /[\x00-\x08\x0b-\x1f\x7f-\x9f\u061c\u200e\u200f\u2028-\u202e\u2066-\u2069]/g;
33405
+ function terminalText(value, max = 4e3) {
33406
+ if (typeof value !== "string") return "";
33407
+ const clean2 = value.replace(CONTROL, "");
33408
+ return clean2.length > max ? `${clean2.slice(0, max - 1)}\u2026` : clean2;
33756
33409
  }
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 };
33410
+ function terminalUrl(value) {
33411
+ const clean2 = terminalText(value, 2e3);
33412
+ return /^https?:\/\/\S+$/.test(clean2) ? clean2 : "";
33766
33413
  }
33767
33414
 
33768
33415
  // src/lib/agent-driver.ts
@@ -33844,7 +33491,7 @@ async function runAgentReview(options) {
33844
33491
  }
33845
33492
  if (!settled) {
33846
33493
  const wait = Math.max(0, remaining() - FINISH_TIMEOUT_MS);
33847
- await Promise.race([oneShotDone, new Promise((resolve9) => setTimeout(resolve9, wait))]);
33494
+ await Promise.race([oneShotDone, new Promise((resolve8) => setTimeout(resolve8, wait))]);
33848
33495
  }
33849
33496
  const finished = await options.http.post(
33850
33497
  "/agent-review/finish",
@@ -33859,7 +33506,7 @@ async function runAgentReview(options) {
33859
33506
  }
33860
33507
 
33861
33508
  // src/lib/prove/auto.ts
33862
- var import_node_path47 = require("node:path");
33509
+ var import_node_path44 = require("node:path");
33863
33510
  var import_node_crypto19 = require("node:crypto");
33864
33511
 
33865
33512
  // src/lib/prove/signals.ts
@@ -35586,18 +35233,18 @@ function renderReplay(model, property, r) {
35586
35233
  // src/lib/prove/runner.ts
35587
35234
  var import_node_child_process15 = require("node:child_process");
35588
35235
  var import_node_os8 = require("node:os");
35589
- var import_node_fs60 = require("node:fs");
35236
+ var import_node_fs58 = require("node:fs");
35590
35237
  var import_node_os9 = require("node:os");
35591
- var import_node_path46 = require("node:path");
35238
+ var import_node_path43 = require("node:path");
35592
35239
 
35593
35240
  // src/lib/prove/scaffold.ts
35594
- var import_node_fs59 = require("node:fs");
35595
- var import_node_path45 = require("node:path");
35241
+ var import_node_fs57 = require("node:fs");
35242
+ var import_node_path42 = require("node:path");
35596
35243
 
35597
35244
  // src/lib/prove/safe-write.ts
35598
- var import_node_fs58 = require("node:fs");
35245
+ var import_node_fs56 = require("node:fs");
35599
35246
  var import_node_crypto15 = require("node:crypto");
35600
- var import_node_path44 = require("node:path");
35247
+ var import_node_path41 = require("node:path");
35601
35248
  var SafeWriteError = class extends Error {
35602
35249
  constructor(reason, path) {
35603
35250
  super(`refusing to write ${path}: ${reason}`);
@@ -35606,10 +35253,10 @@ var SafeWriteError = class extends Error {
35606
35253
  this.name = "SafeWriteError";
35607
35254
  }
35608
35255
  };
35609
- var FLAGS3 = import_node_fs58.constants;
35256
+ var FLAGS3 = import_node_fs56.constants;
35610
35257
  var NOFOLLOW2 = FLAGS3.O_NOFOLLOW ?? 0;
35611
35258
  function assertPlainRelative(rel) {
35612
- if (!rel || (0, import_node_path44.isAbsolute)(rel)) throw new SafeWriteError("bad-path", rel);
35259
+ if (!rel || (0, import_node_path41.isAbsolute)(rel)) throw new SafeWriteError("bad-path", rel);
35613
35260
  for (const part of rel.split(/[\\/]/)) {
35614
35261
  if (part === ".." || part === "" || part === ".") throw new SafeWriteError("bad-path", rel);
35615
35262
  }
@@ -35618,34 +35265,34 @@ function ensureDirsNoFollow(root, rel) {
35618
35265
  const parts2 = rel.split(/[\\/]/);
35619
35266
  let cur = root;
35620
35267
  for (const part of parts2.slice(0, -1)) {
35621
- cur = (0, import_node_path44.join)(cur, part);
35268
+ cur = (0, import_node_path41.join)(cur, part);
35622
35269
  let st;
35623
35270
  try {
35624
- st = (0, import_node_fs58.lstatSync)(cur);
35271
+ st = (0, import_node_fs56.lstatSync)(cur);
35625
35272
  } catch {
35626
- (0, import_node_fs58.mkdirSync)(cur);
35273
+ (0, import_node_fs56.mkdirSync)(cur);
35627
35274
  continue;
35628
35275
  }
35629
35276
  if (st.isSymbolicLink()) throw new SafeWriteError("symlink", cur);
35630
35277
  if (!st.isDirectory()) throw new SafeWriteError("not-regular", cur);
35631
35278
  }
35632
- return (0, import_node_path44.join)(root, rel);
35279
+ return (0, import_node_path41.join)(root, rel);
35633
35280
  }
35634
35281
  function insideRoot(realRoot, realPath) {
35635
- return realPath === realRoot || realPath.startsWith(realRoot.endsWith(import_node_path44.sep) ? realRoot : realRoot + import_node_path44.sep);
35282
+ return realPath === realRoot || realPath.startsWith(realRoot.endsWith(import_node_path41.sep) ? realRoot : realRoot + import_node_path41.sep);
35636
35283
  }
35637
35284
  function removeQuietly(path) {
35638
35285
  try {
35639
- (0, import_node_fs58.unlinkSync)(path);
35286
+ (0, import_node_fs56.unlinkSync)(path);
35640
35287
  } catch {
35641
35288
  }
35642
35289
  }
35643
35290
  function writeFileInRootNoFollow(root, rel, content) {
35644
35291
  assertPlainRelative(rel);
35645
35292
  const dest = ensureDirsNoFollow(root, rel);
35646
- const dir = (0, import_node_path44.dirname)(dest);
35293
+ const dir = (0, import_node_path41.dirname)(dest);
35647
35294
  try {
35648
- const st = (0, import_node_fs58.lstatSync)(dest);
35295
+ const st = (0, import_node_fs56.lstatSync)(dest);
35649
35296
  if (st.isSymbolicLink()) throw new SafeWriteError("symlink", dest);
35650
35297
  if (!st.isFile()) throw new SafeWriteError("not-regular", dest);
35651
35298
  } catch (err2) {
@@ -35653,41 +35300,41 @@ function writeFileInRootNoFollow(root, rel, content) {
35653
35300
  }
35654
35301
  let realRoot;
35655
35302
  try {
35656
- realRoot = (0, import_node_fs58.realpathSync)(root);
35303
+ realRoot = (0, import_node_fs56.realpathSync)(root);
35657
35304
  } catch {
35658
35305
  throw new SafeWriteError("unwritable", root);
35659
35306
  }
35660
- const tmp = (0, import_node_path44.join)(dir, `.${(0, import_node_path44.basename)(dest)}.${(0, import_node_crypto15.randomBytes)(6).toString("hex")}.tmp`);
35307
+ const tmp = (0, import_node_path41.join)(dir, `.${(0, import_node_path41.basename)(dest)}.${(0, import_node_crypto15.randomBytes)(6).toString("hex")}.tmp`);
35661
35308
  let fd;
35662
35309
  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);
35310
+ 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
35311
  } catch {
35665
35312
  throw new SafeWriteError("unwritable", tmp);
35666
35313
  }
35667
35314
  try {
35668
- const opened = (0, import_node_fs58.fstatSync)(fd, { bigint: true });
35315
+ const opened = (0, import_node_fs56.fstatSync)(fd, { bigint: true });
35669
35316
  let realTmp;
35670
35317
  try {
35671
- realTmp = (0, import_node_fs58.realpathSync)(tmp);
35318
+ realTmp = (0, import_node_fs56.realpathSync)(tmp);
35672
35319
  } catch {
35673
35320
  throw new SafeWriteError("escaped", tmp);
35674
35321
  }
35675
- const there = (0, import_node_fs58.lstatSync)(realTmp, { bigint: true });
35322
+ const there = (0, import_node_fs56.lstatSync)(realTmp, { bigint: true });
35676
35323
  if (!opened.isFile() || there.ino !== opened.ino || there.dev !== opened.dev || !insideRoot(realRoot, realTmp)) {
35677
35324
  throw new SafeWriteError("escaped", tmp);
35678
35325
  }
35679
35326
  const buf = Buffer.from(content, "utf-8");
35680
35327
  let off = 0;
35681
- while (off < buf.length) off += (0, import_node_fs58.writeSync)(fd, buf, off, buf.length - off);
35328
+ while (off < buf.length) off += (0, import_node_fs56.writeSync)(fd, buf, off, buf.length - off);
35682
35329
  } catch (err2) {
35683
- (0, import_node_fs58.closeSync)(fd);
35330
+ (0, import_node_fs56.closeSync)(fd);
35684
35331
  removeQuietly(tmp);
35685
35332
  throw err2 instanceof SafeWriteError ? err2 : new SafeWriteError("unwritable", tmp);
35686
35333
  }
35687
- (0, import_node_fs58.closeSync)(fd);
35334
+ (0, import_node_fs56.closeSync)(fd);
35688
35335
  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);
35336
+ if (!insideRoot(realRoot, (0, import_node_fs56.realpathSync)(dir)) || (0, import_node_fs56.lstatSync)(dir).isSymbolicLink()) throw new SafeWriteError("escaped", dir);
35337
+ (0, import_node_fs56.renameSync)(tmp, dest);
35691
35338
  } catch (err2) {
35692
35339
  removeQuietly(tmp);
35693
35340
  throw err2 instanceof SafeWriteError ? err2 : new SafeWriteError("unwritable", dest);
@@ -35701,9 +35348,9 @@ function pathHasNoLink(root, rel) {
35701
35348
  }
35702
35349
  let cur = root;
35703
35350
  for (const part of rel.split(/[\\/]/)) {
35704
- cur = cur + import_node_path44.sep + part;
35351
+ cur = cur + import_node_path41.sep + part;
35705
35352
  try {
35706
- if ((0, import_node_fs58.lstatSync)(cur).isSymbolicLink()) return false;
35353
+ if ((0, import_node_fs56.lstatSync)(cur).isSymbolicLink()) return false;
35707
35354
  } catch {
35708
35355
  return true;
35709
35356
  }
@@ -36013,20 +35660,20 @@ This directory is machine-local and gitignored (see ../.gitignore). Models are
36013
35660
  never committed; what reaches the team is the bug report and the fix.
36014
35661
  `;
36015
35662
  function scaffoldProofs(root) {
36016
- const proofsDir = (0, import_node_path45.join)(root, PROOFS_DIR);
35663
+ const proofsDir = (0, import_node_path42.join)(root, PROOFS_DIR);
36017
35664
  const written = [];
36018
35665
  const kept = [];
36019
35666
  for (const stray of ["lakefile.lean"]) {
36020
35667
  const rel = `${PROOFS_DIR}/${stray}`;
36021
- if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path45.join)(root, rel));
35668
+ if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
36022
35669
  try {
36023
- (0, import_node_fs59.rmSync)((0, import_node_path45.join)(root, rel), { force: true });
35670
+ (0, import_node_fs57.rmSync)((0, import_node_path42.join)(root, rel), { force: true });
36024
35671
  } catch {
36025
35672
  }
36026
35673
  }
36027
35674
  for (const f of PROOFS_TEMPLATE_FILES) {
36028
35675
  const rel = `${PROOFS_DIR}/${f.path}`;
36029
- if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path45.join)(root, rel));
35676
+ if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
36030
35677
  const current = readRegularFileInRoot(root, rel, 4 * 1024 * 1024);
36031
35678
  if (current.ok && current.content === f.content) {
36032
35679
  kept.push(rel);
@@ -36039,8 +35686,8 @@ function scaffoldProofs(root) {
36039
35686
  [`${PROOFS_DIR}/.gitignore`, LOCAL_GITIGNORE],
36040
35687
  [`${MODELS_DIR}/README.md`, MODELS_README]
36041
35688
  ]) {
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))) {
35689
+ if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
35690
+ if (existsNoFollow((0, import_node_path42.join)(root, rel))) {
36044
35691
  kept.push(rel);
36045
35692
  continue;
36046
35693
  }
@@ -36051,7 +35698,7 @@ function scaffoldProofs(root) {
36051
35698
  }
36052
35699
  function existsNoFollow(abs) {
36053
35700
  try {
36054
- (0, import_node_fs59.lstatSync)(abs);
35701
+ (0, import_node_fs57.lstatSync)(abs);
36055
35702
  return true;
36056
35703
  } catch {
36057
35704
  return false;
@@ -36309,17 +35956,17 @@ function renderReport(r) {
36309
35956
 
36310
35957
  // src/lib/prove/runner.ts
36311
35958
  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");
35959
+ return env.VERITY_LEAN_HOME ?? (0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".verity", "lean");
36313
35960
  }
36314
35961
  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);
35962
+ const managedBin = (0, import_node_path43.join)(verityLeanHome(env), LEAN_TOOLCHAIN.replace(/^leanprover\/lean4:/, ""), "bin");
35963
+ const elanBin = (0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "bin");
35964
+ 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(":", "---")));
35965
+ 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)));
35966
+ const path = [managedBin, ...elanHas ? [elanBin] : [], ...userPath].join(import_node_path43.delimiter);
36320
35967
  const merged = { ...env, PATH: path, ELAN_TOOLCHAIN: env.ELAN_TOOLCHAIN ?? LEAN_TOOLCHAIN };
36321
35968
  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];
35969
+ const candidates2 = [(0, import_node_path43.join)(managedBin, exe), ...elanHas ? [(0, import_node_path43.join)(elanBin, exe)] : [], exe];
36323
35970
  for (const candidate of candidates2) {
36324
35971
  try {
36325
35972
  (0, import_node_child_process15.execFileSync)(candidate, ["--version"], { env: merged, stdio: ["ignore", "pipe", "pipe"], timeout: 1e4 });
@@ -36357,7 +36004,7 @@ function run2(tc, cwd, args2, timeoutMs) {
36357
36004
  function runAsync(tc, cwd, args2, timeoutMs) {
36358
36005
  const started = Date.now();
36359
36006
  const MAX = 16 * 1024 * 1024;
36360
- return new Promise((resolve9) => {
36007
+ return new Promise((resolve8) => {
36361
36008
  const posix = (0, import_node_os8.platform)() !== "win32";
36362
36009
  const child = (0, import_node_child_process15.spawn)(tc.lake, args2, { cwd, env: tc.env, stdio: ["ignore", "pipe", "pipe"], detached: posix });
36363
36010
  let stdout = "";
@@ -36385,8 +36032,8 @@ function runAsync(tc, cwd, args2, timeoutMs) {
36385
36032
  if (settled) return;
36386
36033
  settled = true;
36387
36034
  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 });
36035
+ if (ok) resolve8({ ok: true, stdout, stderr: "", durationMs: Date.now() - started, timedOut: false });
36036
+ else resolve8({ ok: false, stdout, stderr: stderr || message || "", durationMs: Date.now() - started, timedOut });
36390
36037
  };
36391
36038
  child.on("error", (err2) => finish(false, err2.message));
36392
36039
  child.on("close", (code) => finish(code === 0 && !timedOut));
@@ -36398,7 +36045,7 @@ function proofsWorkspaceProblem(root) {
36398
36045
  for (const rel of [".verity", PROOFS_DIR, `${PROOFS_DIR}/.lake`]) {
36399
36046
  let st;
36400
36047
  try {
36401
- st = (0, import_node_fs60.lstatSync)((0, import_node_path46.join)(root, rel));
36048
+ st = (0, import_node_fs58.lstatSync)((0, import_node_path43.join)(root, rel));
36402
36049
  } catch {
36403
36050
  break;
36404
36051
  }
@@ -36418,44 +36065,44 @@ function refused(problem) {
36418
36065
  function buildLibrary(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
36419
36066
  const problem = proofsWorkspaceProblem(root);
36420
36067
  if (problem) return refused(problem);
36421
- return run2(tc, (0, import_node_path46.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36068
+ return run2(tc, (0, import_node_path43.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36422
36069
  }
36423
36070
  async function buildLibraryAsync(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
36424
36071
  const problem = proofsWorkspaceProblem(root);
36425
36072
  if (problem) return refused(problem);
36426
- return runAsync(tc, (0, import_node_path46.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36073
+ return runAsync(tc, (0, import_node_path43.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36427
36074
  }
36428
36075
  function isModelInRoot(modelsAbs, rel) {
36429
- if (!rel.endsWith(".lean") || (0, import_node_path46.isAbsolute)(rel) || rel.startsWith("..")) return false;
36076
+ if (!rel.endsWith(".lean") || (0, import_node_path43.isAbsolute)(rel) || rel.startsWith("..")) return false;
36430
36077
  return statRegularInRoot(modelsAbs, rel).ok;
36431
36078
  }
36432
36079
  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));
36080
+ const modelsAbs = (0, import_node_path43.join)(root, MODELS_DIR);
36081
+ const asPath = (0, import_node_path43.relative)(modelsAbs, (0, import_node_path43.isAbsolute)(arg) ? arg : (0, import_node_path43.resolve)(root, arg));
36435
36082
  const candidates2 = arg.includes("/") || arg.includes("\\") ? [asPath] : [arg, `${arg}.lean`];
36436
36083
  for (const rel of candidates2) {
36437
- if (isModelInRoot(modelsAbs, rel)) return (0, import_node_path46.join)(modelsAbs, rel);
36084
+ if (isModelInRoot(modelsAbs, rel)) return (0, import_node_path43.join)(modelsAbs, rel);
36438
36085
  }
36439
36086
  return null;
36440
36087
  }
36441
36088
  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));
36089
+ const modelsAbs = (0, import_node_path43.join)(root, MODELS_DIR);
36090
+ if (!(0, import_node_fs58.existsSync)(modelsAbs)) return [];
36091
+ return (0, import_node_fs58.readdirSync)(modelsAbs).filter((f) => isModelInRoot(modelsAbs, f)).sort().map((f) => (0, import_node_path43.join)(modelsAbs, f));
36445
36092
  }
36446
36093
  function trimDiagnostics(text) {
36447
36094
  return text.split("\n").filter((l) => !l.startsWith("trace:")).join("\n").trim().slice(0, 4e3);
36448
36095
  }
36449
36096
  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);
36097
+ const proofsAbs = (0, import_node_path43.join)(root, PROOFS_DIR);
36098
+ const rel = (0, import_node_path43.relative)(proofsAbs, modelFile);
36452
36099
  const problem = proofsWorkspaceProblem(root);
36453
36100
  const res = problem ? refused(problem) : run2(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36454
36101
  return toReport(res, root, modelFile, opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36455
36102
  }
36456
36103
  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);
36104
+ const proofsAbs = (0, import_node_path43.join)(root, PROOFS_DIR);
36105
+ const rel = (0, import_node_path43.relative)(proofsAbs, modelFile);
36459
36106
  const problem = proofsWorkspaceProblem(root);
36460
36107
  const res = problem ? refused(problem) : await runAsync(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36461
36108
  return toReport(res, root, modelFile, opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
@@ -36464,10 +36111,10 @@ function toReport(res, root, modelFile, timeoutMs) {
36464
36111
  const parsed = parseVerityLines(res.stdout);
36465
36112
  const combined = `${res.stdout}
36466
36113
  ${res.stderr}`;
36467
- const name2 = parsed.header?.model ?? (0, import_node_path46.basename)(modelFile, ".lean");
36114
+ const name2 = parsed.header?.model ?? (0, import_node_path43.basename)(modelFile, ".lean");
36468
36115
  const report = {
36469
36116
  model: name2,
36470
- file: (0, import_node_path46.relative)(root, modelFile),
36117
+ file: (0, import_node_path43.relative)(root, modelFile),
36471
36118
  ok: res.ok,
36472
36119
  header: parsed.header,
36473
36120
  properties: parsed.properties,
@@ -37037,7 +36684,7 @@ async function runFormalPhase(input) {
37037
36684
  modelName = gen.name;
37038
36685
  const rel = `${AUTO_MODELS_DIR}/${gen.name}.lean`;
37039
36686
  writeFileInRootNoFollow(root, rel, gen.source);
37040
- const abs = resolveModelFile(root, rel) ?? (0, import_node_path47.join)(root, rel);
36687
+ const abs = resolveModelFile(root, rel) ?? (0, import_node_path44.join)(root, rel);
37041
36688
  progress.model = { name: gen.name, file: rel, rounds: round };
37042
36689
  progress.step = "check";
37043
36690
  report = await deps.check(root, abs);
@@ -37098,11 +36745,11 @@ async function runFormalPhase(input) {
37098
36745
  const budget = Math.max(2e4, timeLeft() - 5e3);
37099
36746
  const byId = /* @__PURE__ */ new Map();
37100
36747
  let stoppedEarly = false;
37101
- await new Promise((resolve9) => {
36748
+ await new Promise((resolve8) => {
37102
36749
  let left = toReplay.length;
37103
- if (left === 0) return resolve9();
36750
+ if (left === 0) return resolve8();
37104
36751
  const settle = () => {
37105
- if (--left === 0) resolve9();
36752
+ if (--left === 0) resolve8();
37106
36753
  };
37107
36754
  for (const p of toReplay) {
37108
36755
  void (async () => {
@@ -37115,7 +36762,7 @@ async function runFormalPhase(input) {
37115
36762
  if (!stoppedEarly) byId.set(p.id, r);
37116
36763
  if (r.verdict === "reproduced" && !stoppedEarly && !isCrash(p)) {
37117
36764
  stoppedEarly = true;
37118
- resolve9();
36765
+ resolve8();
37119
36766
  }
37120
36767
  })().catch(() => {
37121
36768
  byId.set(p.id, null);
@@ -37159,7 +36806,7 @@ async function runFormalPhase(input) {
37159
36806
  return done({
37160
36807
  status: "checked",
37161
36808
  target,
37162
- model: { name: modelName, file: (0, import_node_path47.relative)(root, (0, import_node_path47.join)(root, modelFile)), rounds },
36809
+ model: { name: modelName, file: (0, import_node_path44.relative)(root, (0, import_node_path44.join)(root, modelFile)), rounds },
37163
36810
  properties: report.properties,
37164
36811
  findings
37165
36812
  });
@@ -37222,7 +36869,7 @@ async function generateAndCheck(root, req, opts) {
37222
36869
  }
37223
36870
  const rel = `${dir}/${gen.name}.lean`;
37224
36871
  writeFileInRootNoFollow(root, rel, gen.source);
37225
- const abs = resolveModelFile(root, rel) ?? (0, import_node_path47.join)(root, rel);
36872
+ const abs = resolveModelFile(root, rel) ?? (0, import_node_path44.join)(root, rel);
37226
36873
  const report = await opts.deps.check(root, abs);
37227
36874
  const abstracts = report.header?.abstracts ?? [];
37228
36875
  const stray = abstracts.find((a) => !headerFiles.has(a.file)) ?? (abstracts[0] && abstracts[0].file !== req.file ? abstracts[0] : void 0);
@@ -37310,10 +36957,10 @@ function runFormalPhaseWithin(input) {
37310
36957
  if (left <= 0) return Promise.resolve(skippedOutcome("deadline", "no time left"));
37311
36958
  const progress = input.progress ?? {};
37312
36959
  let timer = null;
37313
- const cutoff = new Promise((resolve9) => {
36960
+ const cutoff = new Promise((resolve8) => {
37314
36961
  timer = setTimeout(() => {
37315
36962
  progress.cancelled = true;
37316
- resolve9(cutOffOutcome(progress, `hard stop after ${Math.round(left / 1e3)} s during ${progress.step ?? "setup"}`, left));
36963
+ resolve8(cutOffOutcome(progress, `hard stop after ${Math.round(left / 1e3)} s during ${progress.step ?? "setup"}`, left));
37317
36964
  }, left);
37318
36965
  });
37319
36966
  return Promise.race([runFormalPhase({ ...input, progress }), cutoff]).finally(() => {
@@ -37350,14 +36997,13 @@ function describeFormalOutcome(o) {
37350
36997
  var EXCERPT_SOURCE_MAX_BYTES = 2 * 1024 * 1024;
37351
36998
  var WRITERS_BUDGET_MS = 1500;
37352
36999
  var EXCERPT_MAX_LINES2 = 30;
37353
- var VENDORED_READ_MAX_BYTES = 256 * 1024;
37354
37000
  var GUARD_BLOCK_CAP = 2;
37355
- var GUARD_ITER_FILE = (0, import_node_path48.join)(VERITY_DIR, ".guard-iteration");
37001
+ var GUARD_ITER_FILE = (0, import_node_path45.join)(VERITY_DIR, ".guard-iteration");
37356
37002
  function readPreToolUseStdin() {
37357
37003
  const empty = { command: "", cwd: null, sessionId: null };
37358
- return new Promise((resolve9) => {
37004
+ return new Promise((resolve8) => {
37359
37005
  try {
37360
- if (process.stdin.isTTY) return resolve9(empty);
37006
+ if (process.stdin.isTTY) return resolve8(empty);
37361
37007
  const chunks = [];
37362
37008
  let timer;
37363
37009
  let settled = false;
@@ -37370,7 +37016,7 @@ function readPreToolUseStdin() {
37370
37016
  process.stdin.removeListener("end", onEnd);
37371
37017
  process.stdin.removeListener("error", onError);
37372
37018
  process.stdin.pause();
37373
- resolve9(value);
37019
+ resolve8(value);
37374
37020
  };
37375
37021
  const onEnd = () => {
37376
37022
  try {
@@ -37391,13 +37037,13 @@ function readPreToolUseStdin() {
37391
37037
  process.stdin.on("error", onError);
37392
37038
  process.stdin.resume();
37393
37039
  } catch {
37394
- resolve9(empty);
37040
+ resolve8(empty);
37395
37041
  }
37396
37042
  });
37397
37043
  }
37398
37044
  function readIterMap() {
37399
37045
  try {
37400
- const raw = JSON.parse((0, import_node_fs61.readFileSync)(GUARD_ITER_FILE, "utf-8"));
37046
+ const raw = JSON.parse((0, import_node_fs59.readFileSync)(GUARD_ITER_FILE, "utf-8"));
37401
37047
  if (raw && typeof raw === "object") {
37402
37048
  if (typeof raw.moment === "string" && typeof raw.count === "number") {
37403
37049
  return { [raw.moment]: raw.count };
@@ -37417,10 +37063,10 @@ function readIter(moment) {
37417
37063
  }
37418
37064
  function writeIter(moment, count) {
37419
37065
  try {
37420
- (0, import_node_fs61.mkdirSync)(VERITY_DIR, { recursive: true });
37066
+ (0, import_node_fs59.mkdirSync)(VERITY_DIR, { recursive: true });
37421
37067
  const map = readIterMap();
37422
37068
  map[moment] = count;
37423
- (0, import_node_fs61.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37069
+ (0, import_node_fs59.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37424
37070
  } catch {
37425
37071
  }
37426
37072
  }
@@ -37430,10 +37076,10 @@ function resetIter(moment) {
37430
37076
  if (!(moment in map)) return;
37431
37077
  delete map[moment];
37432
37078
  if (Object.keys(map).length === 0) {
37433
- if ((0, import_node_fs61.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs61.unlinkSync)(GUARD_ITER_FILE);
37079
+ if ((0, import_node_fs59.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs59.unlinkSync)(GUARD_ITER_FILE);
37434
37080
  } else {
37435
- (0, import_node_fs61.mkdirSync)(VERITY_DIR, { recursive: true });
37436
- (0, import_node_fs61.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37081
+ (0, import_node_fs59.mkdirSync)(VERITY_DIR, { recursive: true });
37082
+ (0, import_node_fs59.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37437
37083
  }
37438
37084
  } catch {
37439
37085
  }
@@ -37503,7 +37149,7 @@ function hasBlockingFinding(response, sentFiles) {
37503
37149
  function buildGuardRequest(moment, files, codeDelta, iter, sessionId, statedIntent, coverageTelemetry) {
37504
37150
  const analyzable = filterAnalyzable(files);
37505
37151
  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);
37152
+ 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
37153
  const staticResults = runCodacyAnalysisIfAvailable(scannable);
37508
37154
  const trigger = moment === "pre-commit" ? "hook:pre-commit" : "hook:pre-push";
37509
37155
  const requestBody = {
@@ -37740,15 +37386,7 @@ async function runGuard(opts, globals) {
37740
37386
  `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
37387
  );
37742
37388
  }
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) });
37389
+ const files = rangeFiles(frame, range);
37752
37390
  if (files.length === 0) process.exit(0);
37753
37391
  const tokenResult = await resolveToken(globals.token);
37754
37392
  const urlResult = await resolveServiceUrl(globals.serviceUrl);
@@ -38129,7 +37767,7 @@ function registerIgnoreCommand(program2) {
38129
37767
 
38130
37768
  // src/commands/waive.ts
38131
37769
  var import_node_crypto20 = require("node:crypto");
38132
- var import_node_fs62 = require("node:fs");
37770
+ var import_node_fs60 = require("node:fs");
38133
37771
  function registerWaiveCommand(program2) {
38134
37772
  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
37773
  const globals = program2.opts();
@@ -38158,7 +37796,7 @@ function registerWaiveCommand(program2) {
38158
37796
  if (opts.file) {
38159
37797
  body2.file = opts.file;
38160
37798
  try {
38161
- body2.file_sha256 = (0, import_node_crypto20.createHash)("sha256").update((0, import_node_fs62.readFileSync)(opts.file)).digest("hex");
37799
+ body2.file_sha256 = (0, import_node_crypto20.createHash)("sha256").update((0, import_node_fs60.readFileSync)(opts.file)).digest("hex");
38162
37800
  } catch {
38163
37801
  printError(`Cannot read ${opts.file} \u2014 run from the repo root, or omit --file to waive by pattern.`);
38164
37802
  process.exit(1);
@@ -38183,11 +37821,10 @@ function registerWaiveCommand(program2) {
38183
37821
  }
38184
37822
 
38185
37823
  // src/commands/init.ts
38186
- var import_node_fs67 = require("node:fs");
37824
+ var import_node_fs65 = require("node:fs");
38187
37825
  var import_promises20 = require("node:fs/promises");
38188
37826
  var import_yaml6 = __toESM2(require_dist());
38189
- var import_node_path52 = require("node:path");
38190
- var import_node_os11 = require("node:os");
37827
+ var import_node_path49 = require("node:path");
38191
37828
  var import_node_child_process19 = require("node:child_process");
38192
37829
 
38193
37830
  // src/lib/banner.ts
@@ -38266,7 +37903,7 @@ function printPhase(n, of, title, subtitle) {
38266
37903
  }
38267
37904
 
38268
37905
  // src/commands/doctor.ts
38269
- var import_node_fs63 = require("node:fs");
37906
+ var import_node_fs61 = require("node:fs");
38270
37907
 
38271
37908
  // src/lib/prereqs.ts
38272
37909
  var import_node_child_process16 = require("node:child_process");
@@ -38327,13 +37964,13 @@ function checkAnalysisCli() {
38327
37964
  }
38328
37965
  var INSTALL_TIMEOUT_MS = 12e4;
38329
37966
  function run3(command, args2, opts = {}) {
38330
- return new Promise((resolve9) => {
37967
+ return new Promise((resolve8) => {
38331
37968
  const child = (0, import_node_child_process16.spawn)(command, args2, {
38332
37969
  stdio: opts.inherit ? "inherit" : "pipe",
38333
37970
  timeout: INSTALL_TIMEOUT_MS
38334
37971
  });
38335
- child.on("error", () => resolve9(false));
38336
- child.on("close", (code) => resolve9(code === 0));
37972
+ child.on("error", () => resolve8(false));
37973
+ child.on("close", (code) => resolve8(code === 0));
38337
37974
  });
38338
37975
  }
38339
37976
  async function installAnalysisCli() {
@@ -38474,11 +38111,11 @@ async function buildReport() {
38474
38111
  const hooks = wiring.status;
38475
38112
  const provenance = cliProvenance();
38476
38113
  const telemetry = await checkTelemetry();
38477
- const hasConfig = (0, import_node_fs63.existsSync)(projectPath(CODACY_CONFIG_FILE));
38114
+ const hasConfig = (0, import_node_fs61.existsSync)(projectPath(CODACY_CONFIG_FILE));
38478
38115
  const artifacts = {
38479
- standard: (0, import_node_fs63.existsSync)(projectPath(STANDARD_FILE)),
38116
+ standard: (0, import_node_fs61.existsSync)(projectPath(STANDARD_FILE)),
38480
38117
  analysisConfig: hasConfig,
38481
- verityMd: (0, import_node_fs63.existsSync)(projectPath(VERITY_MD_FILE)),
38118
+ verityMd: (0, import_node_fs61.existsSync)(projectPath(VERITY_MD_FILE)),
38482
38119
  analysisConfigIds: hasConfig ? validatePatternIds().status : "absent"
38483
38120
  };
38484
38121
  const next = [];
@@ -38637,8 +38274,8 @@ function registerDoctorCommand(program2) {
38637
38274
  }
38638
38275
 
38639
38276
  // src/commands/migrate.ts
38640
- var import_node_fs64 = require("node:fs");
38641
- var import_node_path49 = require("node:path");
38277
+ var import_node_fs62 = require("node:fs");
38278
+ var import_node_path46 = require("node:path");
38642
38279
  var import_node_child_process17 = require("node:child_process");
38643
38280
  var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
38644
38281
  function defaultNpmRemover(pkg) {
@@ -38675,12 +38312,12 @@ async function runMigration(opts = {}) {
38675
38312
  return { actions, migrated: actions.length > 0 };
38676
38313
  }
38677
38314
  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)) {
38315
+ const gateDir = (0, import_node_path46.join)(root, ".gate");
38316
+ const verityDir = (0, import_node_path46.join)(root, ".verity");
38317
+ if ((0, import_node_fs62.existsSync)(gateDir) && !(0, import_node_fs62.existsSync)(verityDir)) {
38681
38318
  return migrateProjectDirRename(root, gateDir, verityDir, actions);
38682
38319
  }
38683
- if ((0, import_node_fs64.existsSync)(gateDir) && (0, import_node_fs64.existsSync)(verityDir)) {
38320
+ if ((0, import_node_fs62.existsSync)(gateDir) && (0, import_node_fs62.existsSync)(verityDir)) {
38684
38321
  return migrateProjectDirCarry(gateDir, verityDir, actions);
38685
38322
  }
38686
38323
  return false;
@@ -38701,13 +38338,13 @@ function migrateProjectDirRename(root, gateDir, verityDir, actions) {
38701
38338
  }
38702
38339
  }
38703
38340
  if (moved) {
38704
- if ((0, import_node_fs64.existsSync)(gateDir)) {
38341
+ if ((0, import_node_fs62.existsSync)(gateDir)) {
38705
38342
  const carried = carryLegacyContents(gateDir, verityDir);
38706
38343
  if (carried > 0) {
38707
38344
  actions.push(`Carried ${carried} untracked legacy file(s) from .gate/ into .verity/`);
38708
38345
  }
38709
38346
  try {
38710
- (0, import_node_fs64.rmSync)(gateDir, { recursive: true, force: true });
38347
+ (0, import_node_fs62.rmSync)(gateDir, { recursive: true, force: true });
38711
38348
  } catch {
38712
38349
  }
38713
38350
  }
@@ -38723,18 +38360,18 @@ function migrateProjectDirCarry(gateDir, verityDir, actions) {
38723
38360
  actions.push(`Carried ${carried} legacy file(s) from .gate/ into .verity/`);
38724
38361
  }
38725
38362
  try {
38726
- (0, import_node_fs64.rmSync)(gateDir, { recursive: true, force: true });
38363
+ (0, import_node_fs62.rmSync)(gateDir, { recursive: true, force: true });
38727
38364
  } catch {
38728
38365
  }
38729
38366
  return carried > 0;
38730
38367
  }
38731
38368
  function migrateGlobalCredentials(home, actions) {
38732
38369
  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 });
38370
+ const gateCreds = (0, import_node_path46.join)(home, ".gate", "credentials");
38371
+ const verityCreds = (0, import_node_path46.join)(home, ".verity", "credentials");
38372
+ if (!(0, import_node_fs62.existsSync)(gateCreds)) return;
38373
+ if (!(0, import_node_fs62.existsSync)(verityCreds)) {
38374
+ (0, import_node_fs62.mkdirSync)((0, import_node_path46.join)(home, ".verity"), { recursive: true });
38738
38375
  moveFile(gateCreds, verityCreds);
38739
38376
  actions.push("Moved ~/.gate/credentials \u2192 ~/.verity/credentials");
38740
38377
  return;
@@ -38756,8 +38393,8 @@ async function migrateLegacyHooks(root, actions) {
38756
38393
  }
38757
38394
  }
38758
38395
  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));
38396
+ const claudeMd = (0, import_node_path46.join)(root, "CLAUDE.md");
38397
+ const hadLegacyBlock = (0, import_node_fs62.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
38761
38398
  if (!hadLegacyBlock) return;
38762
38399
  try {
38763
38400
  await ensureClaudeMdPointer(root);
@@ -38767,9 +38404,9 @@ async function migrateClaudeMd(root, actions) {
38767
38404
  }
38768
38405
  }
38769
38406
  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;
38407
+ const gateMd = (0, import_node_path46.join)(root, "GATE.md");
38408
+ const verityMd = (0, import_node_path46.join)(root, "VERITY.md");
38409
+ if (!(0, import_node_fs62.existsSync)(gateMd) || (0, import_node_fs62.existsSync)(verityMd)) return;
38773
38410
  let moved = false;
38774
38411
  if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
38775
38412
  try {
@@ -38781,12 +38418,12 @@ function migrateStandardFile(root, actions) {
38781
38418
  if (!moved) moveFile(gateMd, verityMd);
38782
38419
  const content = readFileSyncSafe(verityMd);
38783
38420
  const refreshed = content.split("GATE.md").join("VERITY.md");
38784
- if (refreshed !== content) (0, import_node_fs64.writeFileSync)(verityMd, refreshed);
38421
+ if (refreshed !== content) (0, import_node_fs62.writeFileSync)(verityMd, refreshed);
38785
38422
  actions.push("Renamed GATE.md \u2192 VERITY.md");
38786
38423
  }
38787
38424
  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;
38425
+ const file = (0, import_node_path46.join)(root, ".claude", "settings.local.json");
38426
+ if (!(0, import_node_fs62.existsSync)(file)) return;
38790
38427
  let settings;
38791
38428
  try {
38792
38429
  settings = JSON.parse(readFileSyncSafe(file) || "{}");
@@ -38833,15 +38470,15 @@ function mergeGlobalCredentials(gateCreds, verityCreds) {
38833
38470
  toAppend.push(line2.replace(/\r$/, ""));
38834
38471
  }
38835
38472
  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");
38473
+ const sep5 = verityContent.endsWith("\n") || verityContent === "" ? "" : "\n";
38474
+ (0, import_node_fs62.writeFileSync)(verityCreds, verityContent + sep5 + toAppend.join("\n") + "\n");
38838
38475
  }
38839
- (0, import_node_fs64.rmSync)(gateCreds, { force: true });
38476
+ (0, import_node_fs62.rmSync)(gateCreds, { force: true });
38840
38477
  return toAppend.length;
38841
38478
  }
38842
38479
  function readFileSyncSafe(path) {
38843
38480
  try {
38844
- return (0, import_node_fs64.readFileSync)(path, "utf-8");
38481
+ return (0, import_node_fs62.readFileSync)(path, "utf-8");
38845
38482
  } catch {
38846
38483
  return "";
38847
38484
  }
@@ -38856,35 +38493,35 @@ function hasStagedChanges(root) {
38856
38493
  }
38857
38494
  function moveDir(from, to) {
38858
38495
  try {
38859
- (0, import_node_fs64.renameSync)(from, to);
38496
+ (0, import_node_fs62.renameSync)(from, to);
38860
38497
  } catch (err2) {
38861
38498
  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 });
38499
+ (0, import_node_fs62.cpSync)(from, to, { recursive: true });
38500
+ (0, import_node_fs62.rmSync)(from, { recursive: true, force: true });
38864
38501
  }
38865
38502
  }
38866
38503
  function moveFile(from, to) {
38867
38504
  try {
38868
- (0, import_node_fs64.renameSync)(from, to);
38505
+ (0, import_node_fs62.renameSync)(from, to);
38869
38506
  } catch (err2) {
38870
38507
  if (err2.code !== "EXDEV") throw err2;
38871
- (0, import_node_fs64.cpSync)(from, to);
38872
- (0, import_node_fs64.rmSync)(from, { force: true });
38508
+ (0, import_node_fs62.cpSync)(from, to);
38509
+ (0, import_node_fs62.rmSync)(from, { force: true });
38873
38510
  }
38874
38511
  }
38875
38512
  function carryLegacyContents(gateDir, verityDir) {
38876
38513
  let copied = 0;
38877
38514
  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()) {
38515
+ const srcDir = (0, import_node_path46.join)(gateDir, relDir);
38516
+ for (const entry of (0, import_node_fs62.readdirSync)(srcDir)) {
38517
+ const rel = relDir ? (0, import_node_path46.join)(relDir, entry) : entry;
38518
+ const src = (0, import_node_path46.join)(gateDir, rel);
38519
+ const dest = (0, import_node_path46.join)(verityDir, rel);
38520
+ if ((0, import_node_fs62.statSync)(src).isDirectory()) {
38884
38521
  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);
38522
+ } else if (!(0, import_node_fs62.existsSync)(dest)) {
38523
+ (0, import_node_fs62.mkdirSync)((0, import_node_path46.dirname)(dest), { recursive: true });
38524
+ (0, import_node_fs62.cpSync)(src, dest);
38888
38525
  copied++;
38889
38526
  }
38890
38527
  }
@@ -38893,22 +38530,22 @@ function carryLegacyContents(gateDir, verityDir) {
38893
38530
  return copied;
38894
38531
  }
38895
38532
  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"))) {
38533
+ const gateDir = (0, import_node_path46.join)(root, ".gate");
38534
+ const verityDir = (0, import_node_path46.join)(root, ".verity");
38535
+ if ((0, import_node_fs62.existsSync)(gateDir) && !(0, import_node_fs62.existsSync)(verityDir)) return true;
38536
+ if ((0, import_node_fs62.existsSync)(gateDir) && (0, import_node_fs62.existsSync)(verityDir)) {
38537
+ 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
38538
  return true;
38902
38539
  }
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"))) {
38540
+ 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
38541
  return true;
38905
38542
  }
38906
38543
  }
38907
- const claudeMd = (0, import_node_path49.join)(root, "CLAUDE.md");
38908
- if ((0, import_node_fs64.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
38544
+ const claudeMd = (0, import_node_path46.join)(root, "CLAUDE.md");
38545
+ if ((0, import_node_fs62.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
38909
38546
  return true;
38910
38547
  }
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"))) {
38548
+ 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
38549
  return true;
38913
38550
  }
38914
38551
  if (await hasLegacyHooksAt(root)) return true;
@@ -39037,7 +38674,7 @@ function runSelect(opts) {
39037
38674
  cursor: initialIdx[0] ?? 0,
39038
38675
  chosen: new Set(mode2 === "single" ? [initialIdx[0] ?? 0] : initialIdx)
39039
38676
  };
39040
- return new Promise((resolve9) => {
38677
+ return new Promise((resolve8) => {
39041
38678
  let painted = 0;
39042
38679
  let settled = false;
39043
38680
  const draw = () => {
@@ -39085,7 +38722,7 @@ function runSelect(opts) {
39085
38722
  if (settled) return;
39086
38723
  settled = true;
39087
38724
  restore();
39088
- resolve9(value);
38725
+ resolve8(value);
39089
38726
  };
39090
38727
  readline2.emitKeypressEvents(input);
39091
38728
  input.setRawMode(true);
@@ -39106,9 +38743,9 @@ async function askLine(question, io = {}) {
39106
38743
  output: io.output ?? process.stdout
39107
38744
  });
39108
38745
  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)));
38746
+ return await new Promise((resolve8) => {
38747
+ rl.question(question).then((a) => resolve8(a.trim())).catch(() => resolve8(null));
38748
+ rl.once("close", () => setImmediate(() => resolve8(null)));
39112
38749
  });
39113
38750
  } finally {
39114
38751
  rl.close();
@@ -39189,11 +38826,11 @@ async function promptMultiSelect(question, choices, fallback) {
39189
38826
  }
39190
38827
 
39191
38828
  // src/lib/prove/lean-install.ts
39192
- var import_node_fs65 = require("node:fs");
38829
+ var import_node_fs63 = require("node:fs");
39193
38830
  var import_node_crypto21 = require("node:crypto");
39194
38831
  var import_node_child_process18 = require("node:child_process");
39195
38832
  var import_node_os10 = require("node:os");
39196
- var import_node_path50 = require("node:path");
38833
+ var import_node_path47 = require("node:path");
39197
38834
  var import_promises18 = require("node:stream/promises");
39198
38835
  var import_node_stream = require("node:stream");
39199
38836
  var RELEASES = "https://releases.lean-lang.org/lean4";
@@ -39204,10 +38841,10 @@ function freeBytes(dir) {
39204
38841
  let d = dir;
39205
38842
  for (let i2 = 0; i2 < 64; i2++) {
39206
38843
  try {
39207
- const st = (0, import_node_fs65.statfsSync)(d);
38844
+ const st = (0, import_node_fs63.statfsSync)(d);
39208
38845
  return Number(st.bavail) * Number(st.bsize);
39209
38846
  } catch {
39210
- const up = (0, import_node_path50.join)(d, "..");
38847
+ const up = (0, import_node_path47.join)(d, "..");
39211
38848
  if (up === d) return null;
39212
38849
  d = up;
39213
38850
  }
@@ -39227,9 +38864,9 @@ function expectedSha256(asset, version = pinnedVersion()) {
39227
38864
  return LEAN_ASSET_SHA256[version]?.[asset] ?? null;
39228
38865
  }
39229
38866
  function sha256File(path) {
39230
- return new Promise((resolve9, reject) => {
38867
+ return new Promise((resolve8, reject) => {
39231
38868
  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);
38869
+ (0, import_node_fs63.createReadStream)(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve8(hash.digest("hex"))).on("error", reject);
39233
38870
  });
39234
38871
  }
39235
38872
  async function verifyDownload(zip, asset, version = pinnedVersion()) {
@@ -39249,7 +38886,7 @@ function leanAssetName(version = pinnedVersion()) {
39249
38886
  return suffix ? `lean-${v}-${suffix}.zip` : null;
39250
38887
  }
39251
38888
  function pinnedVersionDir(env = process.env) {
39252
- return (0, import_node_path50.join)(verityLeanHome(env), pinnedVersion());
38889
+ return (0, import_node_path47.join)(verityLeanHome(env), pinnedVersion());
39253
38890
  }
39254
38891
  function lakeBinary() {
39255
38892
  return (0, import_node_os10.platform)() === "win32" ? "lake.exe" : "lake";
@@ -39260,12 +38897,12 @@ function unzip(zip, dest) {
39260
38897
  for (const [cmd, args2] of attempts) {
39261
38898
  try {
39262
38899
  (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 };
38900
+ if ((0, import_node_fs63.readdirSync)(dest).length > 0) return { ok: true, via: cmd };
39264
38901
  errors.push(`${cmd}: produced nothing`);
39265
38902
  } catch (err2) {
39266
38903
  errors.push(`${cmd}: ${String(err2.message).split("\n")[0].slice(0, 120)}`);
39267
38904
  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 });
38905
+ 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
38906
  } catch {
39270
38907
  }
39271
38908
  }
@@ -39291,7 +38928,7 @@ async function download(url, dest, onProgress, stallMs = DOWNLOAD_STALL_MS) {
39291
38928
  seen += chunk.length;
39292
38929
  onProgress(seen, total);
39293
38930
  });
39294
- await (0, import_promises18.pipeline)(stream, (0, import_node_fs65.createWriteStream)(dest), { signal: ctrl.signal });
38931
+ await (0, import_promises18.pipeline)(stream, (0, import_node_fs63.createWriteStream)(dest), { signal: ctrl.signal });
39295
38932
  } catch (err2) {
39296
38933
  if (ctrl.signal.aborted) throw new Error(`download stalled: nothing received for ${Math.round(stallMs / 1e3)} s`);
39297
38934
  throw err2;
@@ -39341,10 +38978,10 @@ async function installLean(opts = {}) {
39341
38978
  const gb = (n) => (n / 1024 ** 3).toFixed(1);
39342
38979
  return { ok: false, error: `not enough disk space for Lean: ${gb(free)} GB free where ${home} lives, needs about ${gb(needed)} GB` };
39343
38980
  }
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);
38981
+ const tmp = (0, import_node_path47.join)(home, ".tmp");
38982
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
38983
+ (0, import_node_fs63.mkdirSync)(tmp, { recursive: true });
38984
+ const zip = (0, import_node_path47.join)(tmp, asset);
39348
38985
  say(`downloading ${url}`);
39349
38986
  let lastPct = -1;
39350
38987
  try {
@@ -39357,40 +38994,40 @@ async function installLean(opts = {}) {
39357
38994
  }
39358
38995
  });
39359
38996
  } catch (err2) {
39360
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38997
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39361
38998
  return { ok: false, error: err2.message };
39362
38999
  }
39363
39000
  say("verifying checksum");
39364
39001
  const verified = await verifyDownload(zip, asset);
39365
39002
  if (!verified.ok) {
39366
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
39003
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39367
39004
  return { ok: false, error: verified.error };
39368
39005
  }
39369
39006
  say("unpacking (this takes a minute)");
39370
- const unpack = (0, import_node_path50.join)(tmp, "unpack");
39371
- (0, import_node_fs65.mkdirSync)(unpack);
39007
+ const unpack = (0, import_node_path47.join)(tmp, "unpack");
39008
+ (0, import_node_fs63.mkdirSync)(unpack);
39372
39009
  const unpacked = unzip(zip, unpack);
39373
39010
  if (!unpacked.ok) {
39374
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
39011
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39375
39012
  return { ok: false, error: `unpack failed: ${unpacked.error}` };
39376
39013
  }
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 });
39014
+ const entries = (0, import_node_fs63.readdirSync)(unpack);
39015
+ 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;
39016
+ if (!(0, import_node_fs63.existsSync)((0, import_node_path47.join)(top, "bin", lakeBinary()))) {
39017
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39381
39018
  return { ok: false, error: "the archive did not contain bin/lake" };
39382
39019
  }
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 });
39020
+ (0, import_node_fs63.rmSync)(dir, { recursive: true, force: true });
39021
+ (0, import_node_fs63.mkdirSync)(home, { recursive: true });
39022
+ (0, import_node_fs63.renameSync)(top, dir);
39023
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39387
39024
  return { ok: true, dir };
39388
39025
  }
39389
39026
 
39390
39027
  // src/lib/remote-config.ts
39391
- var import_node_fs66 = require("node:fs");
39028
+ var import_node_fs64 = require("node:fs");
39392
39029
  var import_promises19 = require("node:fs/promises");
39393
- var import_node_path51 = require("node:path");
39030
+ var import_node_path48 = require("node:path");
39394
39031
  var import_yaml5 = __toESM2(require_dist());
39395
39032
  var IGNORE_RIDER = "verityignore";
39396
39033
  async function fetchRemoteSetup(opts) {
@@ -39435,7 +39072,7 @@ async function adoptRemoteSetup(found, opts) {
39435
39072
  written.push(STANDARD_FILE);
39436
39073
  if (rider !== null) {
39437
39074
  const localIgnore = projectPath(VERITYIGNORE_FILE);
39438
- if (!(0, import_node_fs66.existsSync)(localIgnore)) {
39075
+ if (!(0, import_node_fs64.existsSync)(localIgnore)) {
39439
39076
  await writeOut(VERITYIGNORE_FILE, rider);
39440
39077
  written.push(VERITYIGNORE_FILE);
39441
39078
  } else {
@@ -39468,7 +39105,7 @@ async function adoptRemoteSetup(found, opts) {
39468
39105
  }
39469
39106
  async function writeOut(relative6, body2) {
39470
39107
  const target = projectPath(relative6);
39471
- await (0, import_promises19.mkdir)((0, import_node_path51.dirname)(target), { recursive: true });
39108
+ await (0, import_promises19.mkdir)((0, import_node_path48.dirname)(target), { recursive: true });
39472
39109
  await (0, import_promises19.writeFile)(target, body2);
39473
39110
  }
39474
39111
  function describeRemote(found) {
@@ -39585,15 +39222,15 @@ async function runOptionalAuth(resolution, opts = {}) {
39585
39222
  }
39586
39223
  function resolveDataDir2() {
39587
39224
  const candidates2 = [
39588
- (0, import_node_path52.join)(__dirname, "..", "data"),
39225
+ (0, import_node_path49.join)(__dirname, "..", "data"),
39589
39226
  // installed: node_modules/@codacy/verity-cli/data
39590
- (0, import_node_path52.join)(__dirname, "..", "..", "data"),
39227
+ (0, import_node_path49.join)(__dirname, "..", "..", "data"),
39591
39228
  // edge case: nested resolution
39592
- (0, import_node_path52.join)(process.cwd(), "cli", "data")
39229
+ (0, import_node_path49.join)(process.cwd(), "cli", "data")
39593
39230
  // local dev: running from repo root
39594
39231
  ];
39595
39232
  for (const candidate of candidates2) {
39596
- if ((0, import_node_fs67.existsSync)((0, import_node_path52.join)(candidate, "skills"))) {
39233
+ if ((0, import_node_fs65.existsSync)((0, import_node_path49.join)(candidate, "skills"))) {
39597
39234
  return candidate;
39598
39235
  }
39599
39236
  }
@@ -39609,9 +39246,9 @@ async function skillIsCurrent(src, dest) {
39609
39246
  const list2 = (dir) => {
39610
39247
  const out2 = [];
39611
39248
  const walk2 = (d, prefix) => {
39612
- for (const e of (0, import_node_fs67.readdirSync)(d, { withFileTypes: true })) {
39249
+ for (const e of (0, import_node_fs65.readdirSync)(d, { withFileTypes: true })) {
39613
39250
  const rel = prefix ? `${prefix}/${e.name}` : e.name;
39614
- if (e.isDirectory()) walk2((0, import_node_path52.join)(d, e.name), rel);
39251
+ if (e.isDirectory()) walk2((0, import_node_path49.join)(d, e.name), rel);
39615
39252
  else if (e.isFile()) out2.push(rel);
39616
39253
  }
39617
39254
  };
@@ -39622,8 +39259,8 @@ async function skillIsCurrent(src, dest) {
39622
39259
  const shipped = list2(src);
39623
39260
  if (JSON.stringify(shipped) !== JSON.stringify(list2(dest))) return false;
39624
39261
  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");
39262
+ const a = await (0, import_promises20.readFile)((0, import_node_path49.join)(src, rel), "utf-8");
39263
+ const b = await (0, import_promises20.readFile)((0, import_node_path49.join)(dest, rel), "utf-8");
39627
39264
  if (a !== b) return false;
39628
39265
  }
39629
39266
  return true;
@@ -39826,7 +39463,7 @@ async function synthesizeLocally(opts) {
39826
39463
  async function healStaleAnalysisConfig(globals) {
39827
39464
  const configPath = projectPath(CODACY_CONFIG_FILE);
39828
39465
  const standardPath = projectPath(STANDARD_FILE);
39829
- if (!(0, import_node_fs67.existsSync)(configPath) || !(0, import_node_fs67.existsSync)(standardPath)) return;
39466
+ if (!(0, import_node_fs65.existsSync)(configPath) || !(0, import_node_fs65.existsSync)(standardPath)) return;
39830
39467
  const validation = validatePatternIds();
39831
39468
  if (validation.status !== "invalid") return;
39832
39469
  printWarn(" Your analysis config names pattern ids that no longer resolve \u2014 those tools were");
@@ -39923,17 +39560,17 @@ async function handoffToSetup(enabled, claudeInstalled) {
39923
39560
  async function installSkills(force, step) {
39924
39561
  step("Installing skills");
39925
39562
  const dataDir = resolveDataDir2();
39926
- const skillsSource = (0, import_node_path52.join)(dataDir, "skills");
39563
+ const skillsSource = (0, import_node_path49.join)(dataDir, "skills");
39927
39564
  const skillsDest = ".claude/skills";
39928
39565
  let skillsInstalled = 0;
39929
39566
  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)) {
39567
+ const src = (0, import_node_path49.join)(skillsSource, skill);
39568
+ const dest = (0, import_node_path49.join)(skillsDest, skill);
39569
+ if (!(0, import_node_fs65.existsSync)(src)) {
39933
39570
  printWarn(` Skill data not found: ${skill}`);
39934
39571
  continue;
39935
39572
  }
39936
- if ((0, import_node_fs67.existsSync)(dest) && !force && await skillIsCurrent(src, dest)) {
39573
+ if ((0, import_node_fs65.existsSync)(dest) && !force && await skillIsCurrent(src, dest)) {
39937
39574
  skillsInstalled++;
39938
39575
  continue;
39939
39576
  }
@@ -40077,15 +39714,7 @@ async function offerFormalVerification(defaultsOnly, pluginMode) {
40077
39714
  console.log(" At push, Verity picks the riskiest changed function, checks a small model of");
40078
39715
  console.log(" it, and replays any counterexample on the real code (its source is sent to");
40079
39716
  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
- }
39717
+ console.log(` Adds /verity-prove <worry> to check any code on demand.${toolchain ? "" : ` Needs to install Lean 4 (${LEAN_DOWNLOAD_SIZE}) on "yes".`}`);
40089
39718
  console.log("");
40090
39719
  const wants = await promptChoice("Formal verification at push?", FORMAL_CHOICES, "no");
40091
39720
  if (wants === "yes" && pluginMode) printInfo(" Plugin: the push check works now; /verity:verity-prove arrives with the plugin's next release.");
@@ -40141,7 +39770,7 @@ function registerInitCommand(program2) {
40141
39770
  const staleMarker = clearStalePluginMarker();
40142
39771
  const pluginMode = opts.plugin === false ? false : opts.pluginMode ?? pluginActiveHere();
40143
39772
  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));
39773
+ const isProject = projectMarkers.some((m) => (0, import_node_fs65.existsSync)(m));
40145
39774
  if (!isProject) {
40146
39775
  printError("No project detected in the current directory.");
40147
39776
  printInfo('Run "verity init" from your project root.');
@@ -40195,7 +39824,7 @@ function registerInitCommand(program2) {
40195
39824
  const claudeInstalled = await checkPrerequisites(step);
40196
39825
  console.log("");
40197
39826
  if (pluginMode) {
40198
- step("Skills already installed by the plugin, namespaced as /verity:<name>");
39827
+ printInfo("Skipping skills \u2014 the Verity plugin provides them, namespaced as /verity:<name>.");
40199
39828
  } else {
40200
39829
  await installSkills(force, step);
40201
39830
  }
@@ -40244,7 +39873,7 @@ function registerInitCommand(program2) {
40244
39873
  untrackMemory: opts.untrackMemory === true,
40245
39874
  untrackState: opts.untrackState === true
40246
39875
  });
40247
- const globalVerityDir = (0, import_node_path52.join)(process.env.HOME ?? "", ".verity");
39876
+ const globalVerityDir = (0, import_node_path49.join)(process.env.HOME ?? "", ".verity");
40248
39877
  await (0, import_promises20.mkdir)(globalVerityDir, { recursive: true });
40249
39878
  console.log("");
40250
39879
  step("Wiring Claude Code hooks");
@@ -40319,7 +39948,7 @@ function registerInitCommand(program2) {
40319
39948
  }
40320
39949
  step("Your project's Standard");
40321
39950
  let haveStandard = false;
40322
- if ((0, import_node_fs67.existsSync)(projectPath(STANDARD_FILE))) {
39951
+ if ((0, import_node_fs65.existsSync)(projectPath(STANDARD_FILE))) {
40323
39952
  printInfo(" This project already has .verity/standard.yaml \u2014 keeping it.");
40324
39953
  haveStandard = true;
40325
39954
  } else {
@@ -40349,7 +39978,7 @@ function registerInitCommand(program2) {
40349
39978
  ...telemetryChoice ? { telemetry: telemetryChoice } : {},
40350
39979
  init: {
40351
39980
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
40352
- cli_version: true ? "0.34.0-experimental.85ad809" : "dev"
39981
+ cli_version: true ? "0.34.0-experimental.8b93a3c" : "dev"
40353
39982
  }
40354
39983
  });
40355
39984
  } catch (err2) {
@@ -40399,8 +40028,8 @@ function registerInitCommand(program2) {
40399
40028
  }
40400
40029
 
40401
40030
  // src/commands/uninstall.ts
40402
- var import_node_fs68 = require("node:fs");
40403
- var import_node_path53 = require("node:path");
40031
+ var import_node_fs66 = require("node:fs");
40032
+ var import_node_path50 = require("node:path");
40404
40033
  function registerUninstallCommand(program2) {
40405
40034
  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
40035
  const dryRun = opts.dryRun ?? false;
@@ -40409,11 +40038,11 @@ function registerUninstallCommand(program2) {
40409
40038
  const actions = [];
40410
40039
  const skillsRoot = projectPath(".claude/skills");
40411
40040
  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)) {
40041
+ const dir = (0, import_node_path50.join)(skillsRoot, name2);
40042
+ if ((0, import_node_fs66.existsSync)(dir)) {
40414
40043
  actions.push({
40415
40044
  label: `Remove .claude/skills/${name2}/`,
40416
- apply: () => (0, import_node_fs68.rmSync)(dir, { recursive: true, force: true })
40045
+ apply: () => (0, import_node_fs66.rmSync)(dir, { recursive: true, force: true })
40417
40046
  });
40418
40047
  }
40419
40048
  }
@@ -40427,24 +40056,24 @@ function registerUninstallCommand(program2) {
40427
40056
  });
40428
40057
  }
40429
40058
  const verityDir = projectPath(VERITY_DIR);
40430
- if ((0, import_node_fs68.existsSync)(verityDir)) {
40059
+ if ((0, import_node_fs66.existsSync)(verityDir)) {
40431
40060
  actions.push({
40432
40061
  label: `Remove ${VERITY_DIR}/`,
40433
- apply: () => (0, import_node_fs68.rmSync)(verityDir, { recursive: true, force: true })
40062
+ apply: () => (0, import_node_fs66.rmSync)(verityDir, { recursive: true, force: true })
40434
40063
  });
40435
40064
  }
40436
40065
  if (!keepVerityMd) {
40437
40066
  const verityMd = projectPath(VERITY_MD_FILE);
40438
- if ((0, import_node_fs68.existsSync)(verityMd)) {
40067
+ if ((0, import_node_fs66.existsSync)(verityMd)) {
40439
40068
  actions.push({
40440
40069
  label: `Remove ${VERITY_MD_FILE}`,
40441
- apply: () => (0, import_node_fs68.rmSync)(verityMd, { force: true })
40070
+ apply: () => (0, import_node_fs66.rmSync)(verityMd, { force: true })
40442
40071
  });
40443
40072
  }
40444
40073
  }
40445
40074
  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);
40075
+ if ((0, import_node_fs66.existsSync)(path) && (0, import_node_fs66.statSync)(path).isDirectory() && (0, import_node_fs66.readdirSync)(path).length === 0) {
40076
+ (0, import_node_fs66.rmdirSync)(path);
40448
40077
  }
40449
40078
  };
40450
40079
  actions.push({
@@ -40455,11 +40084,11 @@ function registerUninstallCommand(program2) {
40455
40084
  }
40456
40085
  });
40457
40086
  const home = process.env.HOME ?? "";
40458
- const globalVerityDir = (0, import_node_path53.join)(home, ".verity");
40459
- if (purgeGlobal && (0, import_node_fs68.existsSync)(globalVerityDir)) {
40087
+ const globalVerityDir = (0, import_node_path50.join)(home, ".verity");
40088
+ if (purgeGlobal && (0, import_node_fs66.existsSync)(globalVerityDir)) {
40460
40089
  actions.push({
40461
40090
  label: `Remove ~/.verity/ (global credentials \u2014 reconnect requires re-registration)`,
40462
- apply: () => (0, import_node_fs68.rmSync)(globalVerityDir, { recursive: true, force: true })
40091
+ apply: () => (0, import_node_fs66.rmSync)(globalVerityDir, { recursive: true, force: true })
40463
40092
  });
40464
40093
  }
40465
40094
  if (actions.length === 0) {
@@ -40653,8 +40282,8 @@ function registerTaskCommands(program2) {
40653
40282
  }
40654
40283
 
40655
40284
  // src/commands/reset.ts
40656
- var import_node_fs69 = require("node:fs");
40657
- var import_node_path54 = require("node:path");
40285
+ var import_node_fs67 = require("node:fs");
40286
+ var import_node_path51 = require("node:path");
40658
40287
  function registerResetCommand(program2) {
40659
40288
  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
40289
  const globals = program2.opts();
@@ -40691,11 +40320,11 @@ function registerResetCommand(program2) {
40691
40320
  }
40692
40321
  const cacheDir = projectPath(CACHE_DIR);
40693
40322
  let purged = 0;
40694
- if ((0, import_node_fs69.existsSync)(cacheDir)) {
40695
- for (const entry of (0, import_node_fs69.readdirSync)(cacheDir)) {
40323
+ if ((0, import_node_fs67.existsSync)(cacheDir)) {
40324
+ for (const entry of (0, import_node_fs67.readdirSync)(cacheDir)) {
40696
40325
  if (entry.startsWith("pending-")) {
40697
40326
  try {
40698
- (0, import_node_fs69.unlinkSync)((0, import_node_path54.join)(cacheDir, entry));
40327
+ (0, import_node_fs67.unlinkSync)((0, import_node_path51.join)(cacheDir, entry));
40699
40328
  purged++;
40700
40329
  } catch {
40701
40330
  }
@@ -40710,19 +40339,19 @@ function registerResetCommand(program2) {
40710
40339
  projectPath(`${VERITY_DIR}/.last-analysis`)
40711
40340
  ];
40712
40341
  for (const file of filesToClear) {
40713
- if ((0, import_node_fs69.existsSync)(file)) {
40342
+ if ((0, import_node_fs67.existsSync)(file)) {
40714
40343
  try {
40715
- (0, import_node_fs69.writeFileSync)(file, "");
40344
+ (0, import_node_fs67.writeFileSync)(file, "");
40716
40345
  } catch {
40717
40346
  }
40718
40347
  }
40719
40348
  }
40720
40349
  if (opts.all) {
40721
40350
  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)) {
40351
+ if ((0, import_node_fs67.existsSync)(logsDir)) {
40352
+ for (const entry of (0, import_node_fs67.readdirSync)(logsDir)) {
40724
40353
  try {
40725
- (0, import_node_fs69.unlinkSync)((0, import_node_path54.join)(logsDir, entry));
40354
+ (0, import_node_fs67.unlinkSync)((0, import_node_path51.join)(logsDir, entry));
40726
40355
  } catch {
40727
40356
  }
40728
40357
  }
@@ -40734,7 +40363,7 @@ function registerResetCommand(program2) {
40734
40363
  }
40735
40364
 
40736
40365
  // src/commands/reflect.ts
40737
- var import_node_fs70 = require("node:fs");
40366
+ var import_node_fs68 = require("node:fs");
40738
40367
 
40739
40368
  // src/lib/reflection-globs.ts
40740
40369
  var MAX_GLOBS = 6;
@@ -40742,7 +40371,7 @@ var PATH_TOKEN = /[A-Za-z0-9_./-]*[A-Za-z0-9_-]\.[A-Za-z0-9]{1,8}(?::\d+(?::\d+)
40742
40371
  function clean(token) {
40743
40372
  return token.replace(/:\d+(?::\d+)?$/, "").replace(/^[`'"(\[]+/, "").replace(/[`'"),\].;!?]+$/, "").replace(/^\.\//, "");
40744
40373
  }
40745
- function resolve7(token, treePaths) {
40374
+ function resolve6(token, treePaths) {
40746
40375
  if (treePaths.includes(token)) return token;
40747
40376
  const suffix = token.startsWith("/") ? token : `/${token}`;
40748
40377
  const matches = treePaths.filter((p) => p.endsWith(suffix));
@@ -40755,7 +40384,7 @@ function deriveFileGlobs(text, treePaths) {
40755
40384
  for (const raw of text.match(PATH_TOKEN) ?? []) {
40756
40385
  const token = clean(raw);
40757
40386
  if (!token) continue;
40758
- const path = resolve7(token, treePaths);
40387
+ const path = resolve6(token, treePaths);
40759
40388
  if (!path || seen.has(path)) continue;
40760
40389
  seen.add(path);
40761
40390
  out2.push(path);
@@ -40772,19 +40401,14 @@ async function writeNodeToDisk(args2) {
40772
40401
  { treePaths: listTrackedFiles(), recordBaseline: false }
40773
40402
  );
40774
40403
  if (written === 0) return false;
40775
- return (0, import_node_fs70.existsSync)(projectPath(`${VERITY_DIR}/memory/${args2.filePath}`));
40404
+ return (0, import_node_fs68.existsSync)(projectPath(`${VERITY_DIR}/memory/${args2.filePath}`));
40776
40405
  } catch {
40777
40406
  return false;
40778
40407
  }
40779
40408
  }
40780
40409
  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) => {
40410
+ 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
40411
  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
40412
  await ensureMemoryDir();
40789
40413
  const tokenResult = await resolveToken(globals.token);
40790
40414
  if (!tokenResult.ok) {
@@ -40845,7 +40469,7 @@ function registerReflectCommand(program2) {
40845
40469
  taskResolution = "none";
40846
40470
  printWarn("No active task found \u2014 saving as an unattached reflection.");
40847
40471
  }
40848
- const userInput = input.text;
40472
+ const userInput = opts.userInput;
40849
40473
  if (userInput) {
40850
40474
  const validKinds = ["decision", "gotcha", "pattern", "security", "quality", "intent", "domain", "integration"];
40851
40475
  const kind = validKinds.includes(opts.kind) ? opts.kind : "gotcha";
@@ -41209,9 +40833,9 @@ function registerRunCommand(program2) {
41209
40833
  }
41210
40834
 
41211
40835
  // src/commands/telemetry.ts
41212
- var import_node_fs71 = require("node:fs");
40836
+ var import_node_fs69 = require("node:fs");
41213
40837
  async function recordTelemetryChoice(choice) {
41214
- if (!(0, import_node_fs71.existsSync)(projectPath(SETUP_STATE_FILE))) return;
40838
+ if (!(0, import_node_fs69.existsSync)(projectPath(SETUP_STATE_FILE))) return;
41215
40839
  try {
41216
40840
  if ((await readSetupState())?.telemetry === choice) return;
41217
40841
  await writeSetupState({ telemetry: choice });
@@ -41288,8 +40912,8 @@ function registerTelemetryCommands(program2) {
41288
40912
  }
41289
40913
 
41290
40914
  // src/commands/prove.ts
41291
- var import_node_fs72 = require("node:fs");
41292
- var import_node_path55 = require("node:path");
40915
+ var import_node_fs70 = require("node:fs");
40916
+ var import_node_path52 = require("node:path");
41293
40917
 
41294
40918
  // src/lib/prove/hint-pool.ts
41295
40919
  var STOP2 = /* @__PURE__ */ new Set([
@@ -41416,13 +41040,7 @@ async function proveAuth(program2) {
41416
41040
  }
41417
41041
  function registerProveCommand(program2) {
41418
41042
  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;
41043
+ 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
41044
  if (opts.hint && opts.rank === "deterministic") opts.rank = "luna";
41427
41045
  const root = repoRoot();
41428
41046
  const ranker = RANKERS[opts.rank];
@@ -41431,7 +41049,7 @@ function registerProveCommand(program2) {
41431
41049
  process.exit(2);
41432
41050
  }
41433
41051
  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)) || ".") });
41052
+ 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
41053
  if (opts.hint && paths.length === 0) {
41436
41054
  const hit = hintMatches(root, opts.hint);
41437
41055
  if (hit.files.length > 0) {
@@ -41485,7 +41103,7 @@ function registerProveCommand(program2) {
41485
41103
  });
41486
41104
  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
41105
  const root = repoRoot();
41488
- if (!(0, import_node_fs72.existsSync)((0, import_node_path55.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41106
+ if (!(0, import_node_fs70.existsSync)((0, import_node_path52.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41489
41107
  printError(`No ${PROOFS_DIR}/ project here. Run \`verity prove init\` first.`);
41490
41108
  process.exit(2);
41491
41109
  }
@@ -41509,7 +41127,7 @@ ${build.stderr.split("\n").filter((l) => !l.startsWith("trace:")).slice(0, 20).j
41509
41127
  const reports = [];
41510
41128
  for (const f of files) {
41511
41129
  const report = checkModel(tc, root, f, { timeoutMs: Math.max(1e3, Number(opts.timeout) || 12e4) });
41512
- report.file = (0, import_node_path55.relative)(root, f);
41130
+ report.file = (0, import_node_path52.relative)(root, f);
41513
41131
  reports.push(report);
41514
41132
  try {
41515
41133
  writeResult(root, report);
@@ -41547,7 +41165,7 @@ ${build.stderr.split("\n").filter((l) => !l.startsWith("trace:")).slice(0, 20).j
41547
41165
  printError("Not logged in \u2014 replays run on the Verity service. Run `verity login` first.");
41548
41166
  process.exit(2);
41549
41167
  }
41550
- if (!(0, import_node_fs72.existsSync)((0, import_node_path55.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41168
+ if (!(0, import_node_fs70.existsSync)((0, import_node_path52.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41551
41169
  printError(`No ${PROOFS_DIR}/ project here. Run \`verity prove init\` first.`);
41552
41170
  process.exit(2);
41553
41171
  }
@@ -41578,7 +41196,7 @@ ${report.error ?? ""}`);
41578
41196
  printInfo(opts.property ? `${model} ${opts.property} has no counterexample to replay` : `${model} has no counterexample to replay`);
41579
41197
  return;
41580
41198
  }
41581
- const modelSource = readRegularFileInRoot(root, (0, import_node_path55.relative)(root, file), 512 * 1024);
41199
+ const modelSource = readRegularFileInRoot(root, (0, import_node_path52.relative)(root, file), 512 * 1024);
41582
41200
  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
41201
  const outcomes = await mapPool(targets, REPLAY_CONCURRENCY, async (p) => {
41584
41202
  const brief = buildReplayBrief(root, report, p, modelSource.ok ? modelSource.content : "");
@@ -41598,7 +41216,7 @@ ${report.error ?? ""}`);
41598
41216
  });
41599
41217
  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
41218
  const root = repoRoot();
41601
- let files = paths.map((p) => (0, import_node_path55.relative)(root, (0, import_node_path55.resolve)(p)));
41219
+ let files = paths.map((p) => (0, import_node_path52.relative)(root, (0, import_node_path52.resolve)(p)));
41602
41220
  if (files.length === 0) {
41603
41221
  const ahead = runGitSync(root, ["diff", "--name-only", "@{upstream}...HEAD"]);
41604
41222
  const fallback = ahead.ok ? ahead : runGitSync(root, ["diff", "--name-only", "HEAD~1..HEAD"]);
@@ -41627,19 +41245,7 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41627
41245
  }
41628
41246
  process.exit(outcome.findings.some((f) => f.verdict === "reproduced") ? 1 : 0);
41629
41247
  });
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
- }
41248
+ 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
41249
  const root = repoRoot();
41644
41250
  const auth2 = await proveAuth(program2);
41645
41251
  if (!auth2 && !(process.env.VERITY_PROVE_DIRECT === "1" && process.env.OPENAI_API_KEY)) {
@@ -41670,9 +41276,9 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41670
41276
  let revise;
41671
41277
  if (opts.revise) {
41672
41278
  const existing = resolveModelFile(root, opts.revise);
41673
- const src = existing ? readRegularFileInRoot(root, (0, import_node_path55.relative)(root, existing), 64 * 1024) : null;
41279
+ const src = existing ? readRegularFileInRoot(root, (0, import_node_path52.relative)(root, existing), 64 * 1024) : null;
41674
41280
  if (!src || !src.ok || !opts.note) {
41675
- printError("--revise needs an existing model under Models/ and --note - with what the replay showed on stdin");
41281
+ printError('--revise needs an existing model under Models/ and --note "<what the replay showed>"');
41676
41282
  process.exit(2);
41677
41283
  }
41678
41284
  revise = { source: src.content, note: opts.note };
@@ -41709,8 +41315,8 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41709
41315
  });
41710
41316
  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
41317
  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;
41318
+ const rel0 = (0, import_node_path52.relative)(root, (0, import_node_path52.isAbsolute)(file) ? file : (0, import_node_path52.join)(root, file)).replace(/\\/g, "/");
41319
+ const rel = rel0.startsWith("..") || (0, import_node_path52.isAbsolute)(rel0) ? null : rel0;
41714
41320
  if (!rel) {
41715
41321
  printError(`${file} is not inside this repository`);
41716
41322
  process.exit(2);
@@ -41726,8 +41332,8 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41726
41332
  });
41727
41333
  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
41334
  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);
41335
+ const rel = (0, import_node_path52.relative)(root, (0, import_node_path52.isAbsolute)(file) ? file : (0, import_node_path52.join)(root, file));
41336
+ const digest = rel.startsWith("..") || (0, import_node_path52.isAbsolute)(rel) ? null : sha256InRoot(root, rel);
41731
41337
  if (!digest) {
41732
41338
  printError(`Cannot hash ${file}: it must be a regular file inside this repository (not a symlink)`);
41733
41339
  process.exit(2);
@@ -41761,10 +41367,10 @@ function refreshScaffold(root) {
41761
41367
  }
41762
41368
 
41763
41369
  // src/commands/lean.ts
41764
- var import_node_fs73 = require("node:fs");
41370
+ var import_node_fs71 = require("node:fs");
41765
41371
  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");
41372
+ var import_node_os11 = require("node:os");
41373
+ var import_node_path53 = require("node:path");
41768
41374
  function registerLeanCommand(program2) {
41769
41375
  const lean = program2.command("lean").description("The Lean 4 toolchain formal verification needs (managed download, pinned by this CLI)");
41770
41376
  lean.command("status").option("--json", "Machine-readable output").description("Which toolchain would run, and whether it matches the pinned version").action((opts) => {
@@ -41781,7 +41387,7 @@ function registerLeanCommand(program2) {
41781
41387
  const managed = pinnedVersionDir();
41782
41388
  const matches = version ? version.includes(pin) : false;
41783
41389
  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() });
41390
+ 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
41391
  return;
41786
41392
  }
41787
41393
  printInfo(`pinned: ${LEAN_TOOLCHAIN}`);
@@ -41795,11 +41401,11 @@ function registerLeanCommand(program2) {
41795
41401
  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
41402
  const asset = leanAssetName();
41797
41403
  if (!asset) {
41798
- printError(`no Lean release for ${(0, import_node_os12.platform)()}/${(0, import_node_os12.arch)()}`);
41404
+ printError(`no Lean release for ${(0, import_node_os11.platform)()}/${(0, import_node_os11.arch)()}`);
41799
41405
  process.exit(2);
41800
41406
  }
41801
41407
  const dir = pinnedVersionDir();
41802
- if ((0, import_node_fs73.existsSync)((0, import_node_path56.join)(dir, "bin", "lake")) && !opts.force) {
41408
+ if ((0, import_node_fs71.existsSync)((0, import_node_path53.join)(dir, "bin", "lake")) && !opts.force) {
41803
41409
  printInfo(`already installed at ${dir}`);
41804
41410
  return;
41805
41411
  }
@@ -41835,18 +41441,18 @@ function registerLeanCommand(program2) {
41835
41441
  });
41836
41442
  lean.command("remove").description("Delete the Verity-managed toolchain for the pinned version").action(() => {
41837
41443
  const dir = pinnedVersionDir();
41838
- if (!(0, import_node_fs73.existsSync)(dir)) {
41444
+ if (!(0, import_node_fs71.existsSync)(dir)) {
41839
41445
  printInfo("nothing to remove");
41840
41446
  return;
41841
41447
  }
41842
- (0, import_node_fs73.rmSync)(dir, { recursive: true, force: true });
41448
+ (0, import_node_fs71.rmSync)(dir, { recursive: true, force: true });
41843
41449
  printInfo(`removed ${dir}`);
41844
41450
  });
41845
41451
  }
41846
41452
 
41847
41453
  // 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");
41454
+ program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.8b93a3c").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) => {
41455
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.8b93a3c");
41850
41456
  setUserNamedServiceUrl(program.opts().serviceUrl);
41851
41457
  try {
41852
41458
  await foldLegacyLocalCredential();