@codacy/verity-cli 0.34.0-experimental.421a631 → 0.34.0-experimental.53caba1

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
@@ -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((resolve8, reject) => {
10438
+ return new Promise((resolve9, 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
- resolve8(xhr.response);
10444
+ resolve9(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((resolve8, reject) => {
10637
+ return new Promise((resolve9, reject) => {
10638
10638
  Module["instantiateWasm"](info2, (mod, inst) => {
10639
- resolve8(receiveInstance(mod, inst));
10639
+ resolve9(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((resolve8, reject) => {
11973
- readyPromiseResolve = resolve8;
11972
+ moduleRtn = new Promise((resolve9, reject) => {
11973
+ readyPromiseResolve = resolve9;
11974
11974
  readyPromiseReject = reject;
11975
11975
  });
11976
11976
  }
@@ -14447,8 +14447,87 @@ 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");
14450
14455
  var import_node_fs = require("node:fs");
14456
+ var import_node_os = require("node:os");
14451
14457
  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
14452
14531
  var _repoRoot = null;
14453
14532
  function repoRoot() {
14454
14533
  if (_repoRoot === null) {
@@ -14476,17 +14555,36 @@ function mainWorktreeRoot() {
14476
14555
  _mainRoot = null;
14477
14556
  return _mainRoot;
14478
14557
  }
14479
- const abs = common.startsWith("/") ? common : (0, import_node_path.join)(repoRoot(), common);
14480
- _mainRoot = (0, import_node_path.dirname)(abs);
14558
+ const abs = common.startsWith("/") ? common : (0, import_node_path2.join)(repoRoot(), common);
14559
+ _mainRoot = (0, import_node_path2.dirname)(abs);
14481
14560
  } catch {
14482
14561
  _mainRoot = null;
14483
14562
  }
14484
14563
  return _mainRoot;
14485
14564
  }
14486
14565
  function verityConfigured() {
14487
- if ((0, import_node_fs.existsSync)((0, import_node_path.join)(repoRoot(), VERITY_DIR))) return true;
14566
+ if (isProjectVerityDir((0, import_node_path2.join)(repoRoot(), VERITY_DIR))) return true;
14488
14567
  const main = mainWorktreeRoot();
14489
- return !!main && (0, import_node_fs.existsSync)((0, import_node_path.join)(main, VERITY_DIR));
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
+ }
14490
14588
  }
14491
14589
  var VERITY_DIR = ".verity";
14492
14590
  var CREDENTIALS_FILE = `${VERITY_DIR}/credentials`;
@@ -14507,7 +14605,7 @@ var MEMORY_DIR = `${VERITY_DIR}/memory`;
14507
14605
  var CODACY_CONFIG_FILE = ".codacy/codacy.config.json";
14508
14606
  var VERITYIGNORE_FILE = ".verityignore";
14509
14607
  function projectPath(relativePath) {
14510
- return (0, import_node_path.join)(repoRoot(), relativePath);
14608
+ return (0, import_node_path2.join)(repoRoot(), relativePath);
14511
14609
  }
14512
14610
  var MAX_DELTA_BYTES = 194560;
14513
14611
  var MAX_FILES = 40;
@@ -14681,7 +14779,7 @@ function printVerbose(msg, verbose) {
14681
14779
  }
14682
14780
 
14683
14781
  // src/lib/debug-log.ts
14684
- var import_node_fs2 = require("node:fs");
14782
+ var import_node_fs3 = require("node:fs");
14685
14783
  function isDebugEnabled() {
14686
14784
  const v = process.env.VERITY_DEBUG;
14687
14785
  if (v === "0" || v === "false" || v === "off") return false;
@@ -14699,24 +14797,24 @@ function writeLine(obj) {
14699
14797
  try {
14700
14798
  const dir = projectPath(DEBUG_LOG_DIR);
14701
14799
  const file = projectPath(DEBUG_LOG_FILE);
14702
- (0, import_node_fs2.mkdirSync)(dir, { recursive: true });
14800
+ (0, import_node_fs3.mkdirSync)(dir, { recursive: true });
14703
14801
  rotateIfNeeded(file);
14704
- (0, import_node_fs2.appendFileSync)(file, JSON.stringify(obj) + "\n");
14802
+ (0, import_node_fs3.appendFileSync)(file, JSON.stringify(obj) + "\n");
14705
14803
  } catch {
14706
14804
  }
14707
14805
  }
14708
14806
  function rotateIfNeeded(file) {
14709
14807
  try {
14710
- const s = (0, import_node_fs2.statSync)(file);
14808
+ const s = (0, import_node_fs3.statSync)(file);
14711
14809
  if (s.size < DEBUG_LOG_MAX_BYTES) return;
14712
- (0, import_node_fs2.renameSync)(file, `${file}.1`);
14810
+ (0, import_node_fs3.renameSync)(file, `${file}.1`);
14713
14811
  } catch {
14714
14812
  }
14715
14813
  }
14716
14814
 
14717
14815
  // src/lib/credentials.ts
14718
14816
  var import_promises = require("node:fs/promises");
14719
- var import_node_path2 = require("node:path");
14817
+ var import_node_path3 = require("node:path");
14720
14818
  var import_node_child_process2 = require("node:child_process");
14721
14819
  function globalCredentialsPath() {
14722
14820
  return `${process.env.HOME}/.verity/credentials`;
@@ -14791,7 +14889,7 @@ async function readGlobalCredential(remote) {
14791
14889
  }
14792
14890
  async function upsertGlobalCredential(remote, rec) {
14793
14891
  const path = globalCredentialsPath();
14794
- await (0, import_promises.mkdir)((0, import_node_path2.dirname)(path), { recursive: true });
14892
+ await (0, import_promises.mkdir)((0, import_node_path3.dirname)(path), { recursive: true });
14795
14893
  let content = "";
14796
14894
  try {
14797
14895
  content = await (0, import_promises.readFile)(path, "utf-8");
@@ -14935,10 +15033,10 @@ async function foldLegacyLocalCredential(remoteArg) {
14935
15033
 
14936
15034
  // src/lib/git.ts
14937
15035
  var import_node_child_process3 = require("node:child_process");
14938
- var import_node_fs3 = require("node:fs");
14939
- var import_node_path3 = require("node:path");
15036
+ var import_node_fs4 = require("node:fs");
15037
+ var import_node_path4 = require("node:path");
14940
15038
  function resolveFile(relpath) {
14941
- return (0, import_node_fs3.existsSync)(relpath) ? relpath : null;
15039
+ return (0, import_node_fs4.existsSync)(relpath) ? relpath : null;
14942
15040
  }
14943
15041
  function execGit(cmd) {
14944
15042
  try {
@@ -14956,7 +15054,7 @@ function readBaselineSha() {
14956
15054
  if (sha === null) return null;
14957
15055
  if (!commitResolves(sha)) {
14958
15056
  try {
14959
- (0, import_node_fs3.unlinkSync)(BASELINE_SHA_FILE);
15057
+ (0, import_node_fs4.unlinkSync)(BASELINE_SHA_FILE);
14960
15058
  } catch {
14961
15059
  }
14962
15060
  return null;
@@ -14964,10 +15062,10 @@ function readBaselineSha() {
14964
15062
  return sha;
14965
15063
  }
14966
15064
  function readRawBaselineSha() {
14967
- if (!(0, import_node_fs3.existsSync)(BASELINE_SHA_FILE)) return null;
15065
+ if (!(0, import_node_fs4.existsSync)(BASELINE_SHA_FILE)) return null;
14968
15066
  let sha;
14969
15067
  try {
14970
- sha = (0, import_node_fs3.readFileSync)(BASELINE_SHA_FILE, "utf-8").trim();
15068
+ sha = (0, import_node_fs4.readFileSync)(BASELINE_SHA_FILE, "utf-8").trim();
14971
15069
  } catch {
14972
15070
  return null;
14973
15071
  }
@@ -14976,8 +15074,8 @@ function readRawBaselineSha() {
14976
15074
  function writeBaselineSha(sha) {
14977
15075
  if (!SHA_RE.test(sha)) return;
14978
15076
  try {
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);
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);
14981
15079
  } catch {
14982
15080
  }
14983
15081
  }
@@ -15065,17 +15163,17 @@ function showContentAtRef(ref, repoRelPath) {
15065
15163
  }
15066
15164
  function filterAnalyzable(files) {
15067
15165
  return files.filter((f) => {
15068
- const ext = (0, import_node_path3.extname)(f).slice(1);
15166
+ const ext = (0, import_node_path4.extname)(f).slice(1);
15069
15167
  return ANALYZABLE_EXTENSIONS.has(ext);
15070
15168
  });
15071
15169
  }
15072
15170
  function filterReviewable(files) {
15073
15171
  return files.filter((f) => {
15074
- const ext = (0, import_node_path3.extname)(f).slice(1);
15172
+ const ext = (0, import_node_path4.extname)(f).slice(1);
15075
15173
  if (ANALYZABLE_EXTENSIONS.has(ext)) return false;
15076
15174
  if (REVIEWABLE_EXTENSIONS.has(ext)) return true;
15077
- const basename8 = f.split("/").pop() ?? "";
15078
- if (REVIEWABLE_FILENAMES.has(basename8)) return true;
15175
+ const basename9 = f.split("/").pop() ?? "";
15176
+ if (REVIEWABLE_FILENAMES.has(basename9)) return true;
15079
15177
  if (REVIEWABLE_PATH_PATTERNS.some((p) => p.test(f))) return true;
15080
15178
  return false;
15081
15179
  });
@@ -15550,7 +15648,7 @@ async function maybeHealServiceUrl(resolution, verbose) {
15550
15648
 
15551
15649
  // src/lib/register.ts
15552
15650
  var readline = __toESM2(require("node:readline/promises"));
15553
- var import_node_os = require("node:os");
15651
+ var import_node_os2 = require("node:os");
15554
15652
 
15555
15653
  // src/lib/spinner.ts
15556
15654
  var FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -15638,7 +15736,7 @@ function startSpinner(label2, opts = {}) {
15638
15736
  }
15639
15737
 
15640
15738
  // src/lib/provider-auth.ts
15641
- var sleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
15739
+ var sleep = (ms) => new Promise((resolve9) => setTimeout(resolve9, ms));
15642
15740
  var form = (fields) => new URLSearchParams(fields).toString();
15643
15741
  async function githubAccountId(owner) {
15644
15742
  try {
@@ -15903,7 +16001,7 @@ function deviceLabel() {
15903
16001
  const override = process.env.VERITY_DEVICE_LABEL?.trim();
15904
16002
  if (override) return override;
15905
16003
  try {
15906
- return (0, import_node_os.hostname)() || void 0;
16004
+ return (0, import_node_os2.hostname)() || void 0;
15907
16005
  } catch {
15908
16006
  return void 0;
15909
16007
  }
@@ -16061,8 +16159,8 @@ function registerAuthCommands(program2) {
16061
16159
  }
16062
16160
 
16063
16161
  // src/lib/pending-login.ts
16064
- var import_node_fs4 = require("node:fs");
16065
- var import_node_path4 = require("node:path");
16162
+ var import_node_fs5 = require("node:fs");
16163
+ var import_node_path5 = require("node:path");
16066
16164
  function pendingLoginPath() {
16067
16165
  return `${process.env.HOME}/.verity/pending-login.json`;
16068
16166
  }
@@ -16078,26 +16176,26 @@ function savePendingLogin(dc, serviceUrl, now = Date.now()) {
16078
16176
  created_at: new Date(now).toISOString()
16079
16177
  };
16080
16178
  const path = pendingLoginPath();
16081
- (0, import_node_fs4.mkdirSync)((0, import_node_path4.dirname)(path), { recursive: true });
16179
+ (0, import_node_fs5.mkdirSync)((0, import_node_path5.dirname)(path), { recursive: true });
16082
16180
  clearPendingLogin();
16083
- (0, import_node_fs4.writeFileSync)(path, JSON.stringify(record, null, 2) + "\n", { mode: 384, flag: "wx" });
16181
+ (0, import_node_fs5.writeFileSync)(path, JSON.stringify(record, null, 2) + "\n", { mode: 384, flag: "wx" });
16084
16182
  try {
16085
- (0, import_node_fs4.chmodSync)(path, 384);
16183
+ (0, import_node_fs5.chmodSync)(path, 384);
16086
16184
  } catch {
16087
16185
  }
16088
16186
  return record;
16089
16187
  }
16090
16188
  function readPendingLogin(now = Date.now()) {
16091
16189
  const path = pendingLoginPath();
16092
- if (!(0, import_node_fs4.existsSync)(path)) return { status: "none" };
16190
+ if (!(0, import_node_fs5.existsSync)(path)) return { status: "none" };
16093
16191
  try {
16094
- if ((0, import_node_fs4.lstatSync)(path).isSymbolicLink()) return { status: "invalid", reason: "it is a symlink" };
16192
+ if ((0, import_node_fs5.lstatSync)(path).isSymbolicLink()) return { status: "invalid", reason: "it is a symlink" };
16095
16193
  } catch {
16096
16194
  return { status: "none" };
16097
16195
  }
16098
16196
  let parsed;
16099
16197
  try {
16100
- parsed = JSON.parse((0, import_node_fs4.readFileSync)(path, "utf-8"));
16198
+ parsed = JSON.parse((0, import_node_fs5.readFileSync)(path, "utf-8"));
16101
16199
  } catch {
16102
16200
  return { status: "invalid", reason: "it is not valid JSON" };
16103
16201
  }
@@ -16118,7 +16216,7 @@ function readPendingLogin(now = Date.now()) {
16118
16216
  }
16119
16217
  function clearPendingLogin() {
16120
16218
  try {
16121
- (0, import_node_fs4.unlinkSync)(pendingLoginPath());
16219
+ (0, import_node_fs5.unlinkSync)(pendingLoginPath());
16122
16220
  return true;
16123
16221
  } catch {
16124
16222
  return false;
@@ -16674,11 +16772,11 @@ function registerLogoutCommand(program2) {
16674
16772
 
16675
16773
  // src/lib/hooks.ts
16676
16774
  var import_promises4 = require("node:fs/promises");
16677
- var import_node_path6 = require("node:path");
16775
+ var import_node_path7 = require("node:path");
16678
16776
 
16679
16777
  // src/lib/json-file.ts
16680
16778
  var import_promises3 = require("node:fs/promises");
16681
- var import_node_path5 = require("node:path");
16779
+ var import_node_path6 = require("node:path");
16682
16780
  function jsonSemanticEqual(a, b) {
16683
16781
  if (a === b) return true;
16684
16782
  if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
@@ -16724,7 +16822,7 @@ async function writeJsonFilePreservingStyle(file, value) {
16724
16822
  const indent = currentRaw !== null ? detectJsonIndent(currentRaw) : 2;
16725
16823
  const next = JSON.stringify(value, null, indent) + "\n";
16726
16824
  if (next === currentRaw) return false;
16727
- await (0, import_promises3.mkdir)((0, import_node_path5.dirname)(file), { recursive: true });
16825
+ await (0, import_promises3.mkdir)((0, import_node_path6.dirname)(file), { recursive: true });
16728
16826
  await (0, import_promises3.writeFile)(file, next);
16729
16827
  return true;
16730
16828
  }
@@ -16909,13 +17007,13 @@ async function writeSettings(settings) {
16909
17007
  }
16910
17008
  async function readSettingsAt(root) {
16911
17009
  try {
16912
- return JSON.parse(await (0, import_promises4.readFile)((0, import_node_path6.join)(root, CLAUDE_SETTINGS_FILE), "utf-8"));
17010
+ return JSON.parse(await (0, import_promises4.readFile)((0, import_node_path7.join)(root, CLAUDE_SETTINGS_FILE), "utf-8"));
16913
17011
  } catch {
16914
17012
  return {};
16915
17013
  }
16916
17014
  }
16917
17015
  async function writeSettingsAt(root, settings) {
16918
- await writeJsonFilePreservingStyle((0, import_node_path6.join)(root, CLAUDE_SETTINGS_FILE), settings);
17016
+ await writeJsonFilePreservingStyle((0, import_node_path7.join)(root, CLAUDE_SETTINGS_FILE), settings);
16919
17017
  }
16920
17018
  async function hasLegacyHooksAt(root) {
16921
17019
  const settings = await readSettingsAt(root);
@@ -17104,12 +17202,12 @@ async function applyMomentSelection(moments) {
17104
17202
  }
17105
17203
 
17106
17204
  // src/lib/project-config.ts
17107
- var import_node_fs6 = require("node:fs");
17108
- var import_node_path8 = require("node:path");
17205
+ var import_node_fs7 = require("node:fs");
17206
+ var import_node_path9 = require("node:path");
17109
17207
 
17110
17208
  // src/lib/repo-controlled.ts
17111
- var import_node_fs5 = require("node:fs");
17112
- var import_node_path7 = require("node:path");
17209
+ var import_node_fs6 = require("node:fs");
17210
+ var import_node_path8 = require("node:path");
17113
17211
 
17114
17212
  // src/lib/hardened-git.ts
17115
17213
  var import_node_child_process5 = require("node:child_process");
@@ -17190,7 +17288,7 @@ function repoControlled(worktree, rel) {
17190
17288
  for (let i2 = 1; i2 <= parts2.length; i2++) {
17191
17289
  let st;
17192
17290
  try {
17193
- st = (0, import_node_fs5.lstatSync)((0, import_node_path7.join)(worktree, ...parts2.slice(0, i2)));
17291
+ st = (0, import_node_fs6.lstatSync)((0, import_node_path8.join)(worktree, ...parts2.slice(0, i2)));
17194
17292
  } catch (err2) {
17195
17293
  const code = err2?.code;
17196
17294
  if (code === "ENOENT" || code === "ENOTDIR") return null;
@@ -17214,14 +17312,14 @@ function parseMoments(raw) {
17214
17312
  }
17215
17313
  function readConfigFile(path) {
17216
17314
  try {
17217
- if (!(0, import_node_fs6.existsSync)(path)) return null;
17218
- const raw = JSON.parse((0, import_node_fs6.readFileSync)(path, "utf-8"));
17315
+ if (!(0, import_node_fs7.existsSync)(path)) return null;
17316
+ const raw = JSON.parse((0, import_node_fs7.readFileSync)(path, "utf-8"));
17219
17317
  const moments = Array.isArray(raw.git_moments) ? raw.git_moments.filter(isMoment) : [];
17220
17318
  const source2 = raw.git_moments_source === "user" || raw.git_moments_source === "init" ? raw.git_moments_source : void 0;
17221
17319
  return {
17222
17320
  git_moments: [...new Set(moments)],
17223
17321
  ...source2 ? { git_moments_source: source2 } : {},
17224
- ...raw.formal === "push" ? { formal: "push" } : {}
17322
+ ...raw.formal === "push" || raw.formal === "off" ? { formal: raw.formal } : {}
17225
17323
  };
17226
17324
  } catch {
17227
17325
  return DEFAULTS;
@@ -17232,13 +17330,13 @@ function candidates() {
17232
17330
  const out2 = [{ path: local, source: "local" }];
17233
17331
  const main = mainWorktreeRoot();
17234
17332
  if (main) {
17235
- const inherited = (0, import_node_path8.join)(main, PROJECT_CONFIG_FILE);
17333
+ const inherited = (0, import_node_path9.join)(main, PROJECT_CONFIG_FILE);
17236
17334
  if (inherited !== local) out2.push({ path: inherited, source: "main-worktree" });
17237
17335
  }
17238
17336
  return out2;
17239
17337
  }
17240
17338
  function formalRefusal(path) {
17241
- return repoControlled((0, import_node_path8.dirname)((0, import_node_path8.dirname)(path)), PROJECT_CONFIG_FILE);
17339
+ return repoControlled((0, import_node_path9.dirname)((0, import_node_path9.dirname)(path)), PROJECT_CONFIG_FILE);
17242
17340
  }
17243
17341
  function readProjectConfigRaw() {
17244
17342
  for (const { path, source: source2 } of candidates()) {
@@ -17250,10 +17348,10 @@ function readProjectConfigRaw() {
17250
17348
  function readProjectConfig() {
17251
17349
  const cfg = readProjectConfigRaw();
17252
17350
  if (cfg.formal !== "push" || !cfg.path) return cfg;
17253
- const refused = formalRefusal(cfg.path);
17254
- if (!refused) return cfg;
17351
+ const refused2 = formalRefusal(cfg.path);
17352
+ if (!refused2) return cfg;
17255
17353
  const { formal: _dropped, ...rest } = cfg;
17256
- return { ...rest, formal_refused: refused };
17354
+ return { ...rest, formal_refused: refused2 };
17257
17355
  }
17258
17356
  function formalRefusalMessage(reason) {
17259
17357
  switch (reason) {
@@ -17274,8 +17372,8 @@ function writeProjectConfig(patch) {
17274
17372
  ...patch
17275
17373
  };
17276
17374
  const target = projectPath(PROJECT_CONFIG_FILE);
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");
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");
17279
17377
  return next;
17280
17378
  }
17281
17379
  function resolveGuardMoments(explicit) {
@@ -17284,11 +17382,11 @@ function resolveGuardMoments(explicit) {
17284
17382
  }
17285
17383
 
17286
17384
  // src/lib/plugin-ownership.ts
17287
- var import_node_fs9 = require("node:fs");
17385
+ var import_node_fs10 = require("node:fs");
17288
17386
 
17289
17387
  // src/lib/which.ts
17290
- var import_node_fs7 = require("node:fs");
17291
- var import_node_path9 = require("node:path");
17388
+ var import_node_fs8 = require("node:fs");
17389
+ var import_node_path10 = require("node:path");
17292
17390
  function executableExtensions(platform4, pathext) {
17293
17391
  if (platform4 !== "win32") return [""];
17294
17392
  const raw = (pathext ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean);
@@ -17306,14 +17404,14 @@ function whichSync(bin, opts = {}) {
17306
17404
  if (!rawPath) return null;
17307
17405
  const exts = executableExtensions(platform4, opts.pathext ?? process.env.PATHEXT);
17308
17406
  const real = opts.real ?? true;
17309
- for (const dir of rawPath.split(import_node_path9.delimiter)) {
17407
+ for (const dir of rawPath.split(import_node_path10.delimiter)) {
17310
17408
  if (!dir) continue;
17311
17409
  for (const ext of exts) {
17312
- const candidate = (0, import_node_path9.join)(dir, bin + ext);
17410
+ const candidate = (0, import_node_path10.join)(dir, bin + ext);
17313
17411
  try {
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;
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;
17317
17415
  } catch {
17318
17416
  continue;
17319
17417
  }
@@ -17323,11 +17421,11 @@ function whichSync(bin, opts = {}) {
17323
17421
  }
17324
17422
 
17325
17423
  // src/lib/plugin-ownership.ts
17326
- var import_node_os2 = require("node:os");
17327
- var import_node_path10 = require("node:path");
17424
+ var import_node_os3 = require("node:os");
17425
+ var import_node_path11 = require("node:path");
17328
17426
 
17329
17427
  // src/lib/stderr-log.ts
17330
- var import_node_fs8 = require("node:fs");
17428
+ var import_node_fs9 = require("node:fs");
17331
17429
  var TOKEN_RE2 = /verity_[0-9a-f]{16,}/g;
17332
17430
  var ANSI_RE = /\u001b\[[0-?]*[ -/]*[@-~]/g;
17333
17431
  function scrub(s) {
@@ -17340,9 +17438,9 @@ function append(text) {
17340
17438
  try {
17341
17439
  const dir = projectPath(DEBUG_LOG_DIR);
17342
17440
  const file = projectPath(STDERR_LOG_FILE);
17343
- (0, import_node_fs8.mkdirSync)(dir, { recursive: true });
17441
+ (0, import_node_fs9.mkdirSync)(dir, { recursive: true });
17344
17442
  rotateIfNeeded(file);
17345
- (0, import_node_fs8.appendFileSync)(file, text);
17443
+ (0, import_node_fs9.appendFileSync)(file, text);
17346
17444
  } catch {
17347
17445
  }
17348
17446
  }
@@ -17390,8 +17488,8 @@ function markerPath() {
17390
17488
  }
17391
17489
  function readMarker() {
17392
17490
  try {
17393
- if (!(0, import_node_fs9.existsSync)(markerPath())) return null;
17394
- const raw = JSON.parse((0, import_node_fs9.readFileSync)(markerPath(), "utf-8"));
17491
+ if (!(0, import_node_fs10.existsSync)(markerPath())) return null;
17492
+ const raw = JSON.parse((0, import_node_fs10.readFileSync)(markerPath(), "utf-8"));
17395
17493
  const pluginRoot = typeof raw.plugin_root === "string" ? raw.plugin_root : "";
17396
17494
  if (!pluginRoot || CONTROL_CHARS2.test(pluginRoot)) return null;
17397
17495
  const version = typeof raw.version === "string" && !CONTROL_CHARS2.test(raw.version) ? raw.version : null;
@@ -17409,23 +17507,23 @@ function recordPluginOwnership(sessionId) {
17409
17507
  const pluginRoot = process.env.VERITY_PLUGIN_ROOT;
17410
17508
  if (!pluginRoot) return;
17411
17509
  try {
17412
- (0, import_node_fs9.mkdirSync)(projectPath(VERITY_DIR), { recursive: true });
17510
+ (0, import_node_fs10.mkdirSync)(projectPath(VERITY_DIR), { recursive: true });
17413
17511
  const marker = {
17414
17512
  session_id: sessionId,
17415
17513
  plugin_root: pluginRoot,
17416
17514
  version: process.env.VERITY_PLUGIN_VERSION || null,
17417
17515
  ts: Math.floor(Date.now() / 1e3)
17418
17516
  };
17419
- (0, import_node_fs9.writeFileSync)(markerPath(), JSON.stringify(marker));
17517
+ (0, import_node_fs10.writeFileSync)(markerPath(), JSON.stringify(marker));
17420
17518
  } catch {
17421
17519
  }
17422
17520
  }
17423
17521
  function claudeConfigDir() {
17424
- return process.env.CLAUDE_CONFIG_DIR || (0, import_node_path10.join)((0, import_node_os2.homedir)(), ".claude");
17522
+ return process.env.CLAUDE_CONFIG_DIR || (0, import_node_path11.join)((0, import_node_os3.homedir)(), ".claude");
17425
17523
  }
17426
17524
  function readJsonFile(path) {
17427
17525
  try {
17428
- const parsed = JSON.parse((0, import_node_fs9.readFileSync)(path, "utf-8"));
17526
+ const parsed = JSON.parse((0, import_node_fs10.readFileSync)(path, "utf-8"));
17429
17527
  return parsed && typeof parsed === "object" ? parsed : null;
17430
17528
  } catch {
17431
17529
  return null;
@@ -17433,9 +17531,9 @@ function readJsonFile(path) {
17433
17531
  }
17434
17532
  function enabledPluginSetting(key) {
17435
17533
  const files = [
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")
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")
17439
17537
  ];
17440
17538
  for (const file of files) {
17441
17539
  const map = readJsonFile(file)?.enabledPlugins;
@@ -17447,11 +17545,11 @@ function enabledPluginSetting(key) {
17447
17545
  }
17448
17546
  function marketplaceLocations() {
17449
17547
  const out2 = /* @__PURE__ */ new Map();
17450
- const known = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "known_marketplaces.json"));
17548
+ const known = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "known_marketplaces.json"));
17451
17549
  if (!known) return out2;
17452
17550
  for (const [name2, entry] of Object.entries(known)) {
17453
17551
  const loc2 = entry?.installLocation;
17454
- if (typeof loc2 === "string" && loc2) out2.set(name2, (0, import_node_path10.resolve)(loc2));
17552
+ if (typeof loc2 === "string" && loc2) out2.set(name2, (0, import_node_path11.resolve)(loc2));
17455
17553
  }
17456
17554
  return out2;
17457
17555
  }
@@ -17465,7 +17563,7 @@ function globalVerityVersion() {
17465
17563
  const entry = verityPathEntry();
17466
17564
  if (!entry) return null;
17467
17565
  try {
17468
- const pkg = readJsonFile((0, import_node_path10.join)((0, import_node_path10.dirname)((0, import_node_fs9.realpathSync)(entry)), "..", "package.json"));
17566
+ const pkg = readJsonFile((0, import_node_path11.join)((0, import_node_path11.dirname)((0, import_node_fs10.realpathSync)(entry)), "..", "package.json"));
17469
17567
  if (pkg?.name !== "@codacy/verity-cli" || typeof pkg.version !== "string") return null;
17470
17568
  return pkg.version;
17471
17569
  } catch {
@@ -17482,7 +17580,7 @@ var VERITY_MARKETPLACE_REPO = "codacy/verity";
17482
17580
  function marketplaceConflict() {
17483
17581
  const wanted = VERITY_MARKETPLACE;
17484
17582
  for (const file of ["settings.json", "settings.local.json"]) {
17485
- const path = (0, import_node_path10.join)(claudeConfigDir(), file);
17583
+ const path = (0, import_node_path11.join)(claudeConfigDir(), file);
17486
17584
  const declared = readJsonFile(path)?.extraKnownMarketplaces ?? null;
17487
17585
  const entry2 = declared && typeof declared === "object" ? declared[wanted] : void 0;
17488
17586
  if (entry2 && typeof entry2 === "object") {
@@ -17492,7 +17590,7 @@ function marketplaceConflict() {
17492
17590
  }
17493
17591
  }
17494
17592
  }
17495
- const known = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "known_marketplaces.json"));
17593
+ const known = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "known_marketplaces.json"));
17496
17594
  const entry = known?.[wanted];
17497
17595
  if (entry && typeof entry === "object" && !pointsAtVerity(entry.source)) {
17498
17596
  return { name: wanted, declaredAs: describeSource(entry.source) };
@@ -17513,7 +17611,7 @@ function describeSource(src) {
17513
17611
  return target ? `${kind} \u2192 ${target}` : kind;
17514
17612
  }
17515
17613
  function legacyMarketplaceInstall() {
17516
- const plugins = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17614
+ const plugins = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17517
17615
  if (!plugins || typeof plugins !== "object") return null;
17518
17616
  for (const key of Object.keys(plugins)) {
17519
17617
  const at = key.lastIndexOf("@");
@@ -17525,13 +17623,13 @@ function legacyMarketplaceInstall() {
17525
17623
  }
17526
17624
  function realpathOr(p) {
17527
17625
  try {
17528
- return import_node_fs9.realpathSync.native(p);
17626
+ return import_node_fs10.realpathSync.native(p);
17529
17627
  } catch {
17530
- return (0, import_node_path10.resolve)(p);
17628
+ return (0, import_node_path11.resolve)(p);
17531
17629
  }
17532
17630
  }
17533
17631
  function isWithin(want, dir) {
17534
- return want === dir || want.startsWith(dir + import_node_path10.sep);
17632
+ return want === dir || want.startsWith(dir + import_node_path11.sep);
17535
17633
  }
17536
17634
  function entryAppliesHere(entry, here) {
17537
17635
  const e = entry;
@@ -17541,9 +17639,9 @@ function entryAppliesHere(entry, here) {
17541
17639
  return forProject === here;
17542
17640
  }
17543
17641
  function registrySays(pluginRoot) {
17544
- const plugins = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17642
+ const plugins = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17545
17643
  if (!plugins || typeof plugins !== "object") return "unverified";
17546
- const want = (0, import_node_path10.resolve)(pluginRoot);
17644
+ const want = (0, import_node_path11.resolve)(pluginRoot);
17547
17645
  const here = realpathOr(repoRoot());
17548
17646
  const markets = marketplaceLocations();
17549
17647
  for (const [key, value] of Object.entries(plugins)) {
@@ -17552,15 +17650,15 @@ function registrySays(pluginRoot) {
17552
17650
  const applicable = (Array.isArray(value) ? value : []).filter((entry) => entryAppliesHere(entry, here));
17553
17651
  const claims = applicable.some((entry) => {
17554
17652
  const installPath = entry?.installPath;
17555
- return typeof installPath === "string" && (0, import_node_path10.resolve)(installPath) === want;
17653
+ return typeof installPath === "string" && (0, import_node_path11.resolve)(installPath) === want;
17556
17654
  }) || source2 !== void 0 && applicable.length > 0 && isWithin(want, source2);
17557
17655
  if (claims) {
17558
17656
  if (enabledPluginSetting(key) === false) return "gone";
17559
- return (0, import_node_fs9.existsSync)(pluginRoot) ? "live" : "gone";
17657
+ return (0, import_node_fs10.existsSync)(pluginRoot) ? "live" : "gone";
17560
17658
  }
17561
17659
  }
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";
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";
17564
17662
  }
17565
17663
  var _live = /* @__PURE__ */ new Map();
17566
17664
  function pluginLiveness(pluginRoot) {
@@ -17574,7 +17672,7 @@ function clearStalePluginMarker() {
17574
17672
  const marker = readMarker();
17575
17673
  if (!marker || pluginLiveness(marker.plugin_root) !== "gone") return null;
17576
17674
  try {
17577
- (0, import_node_fs9.rmSync)(markerPath(), { force: true });
17675
+ (0, import_node_fs10.rmSync)(markerPath(), { force: true });
17578
17676
  } catch {
17579
17677
  return null;
17580
17678
  }
@@ -17602,7 +17700,7 @@ function pluginActiveHere() {
17602
17700
  return activePluginInstall() !== null;
17603
17701
  }
17604
17702
  function registeredVerityPlugin() {
17605
- const plugins = readJsonFile((0, import_node_path10.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17703
+ const plugins = readJsonFile((0, import_node_path11.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
17606
17704
  if (!plugins || typeof plugins !== "object") return null;
17607
17705
  const here = realpathOr(repoRoot());
17608
17706
  for (const [key, value] of Object.entries(plugins)) {
@@ -17612,7 +17710,7 @@ function registeredVerityPlugin() {
17612
17710
  for (const entry of Array.isArray(value) ? value : []) {
17613
17711
  const e = entry;
17614
17712
  const installPath = typeof e.installPath === "string" ? e.installPath : "";
17615
- if (!installPath || !(0, import_node_fs9.existsSync)(installPath)) continue;
17713
+ if (!installPath || !(0, import_node_fs10.existsSync)(installPath)) continue;
17616
17714
  if (!entryAppliesHere(entry, here)) continue;
17617
17715
  return { pluginRoot: installPath, version: typeof e.version === "string" ? e.version : null };
17618
17716
  }
@@ -17664,28 +17762,28 @@ async function resolveHookWiring() {
17664
17762
  }
17665
17763
 
17666
17764
  // src/lib/cli-provenance.ts
17667
- var import_node_fs10 = require("node:fs");
17668
- var import_node_os3 = require("node:os");
17669
- var import_node_path11 = require("node:path");
17765
+ var import_node_fs11 = require("node:fs");
17766
+ var import_node_os4 = require("node:os");
17767
+ var import_node_path12 = require("node:path");
17670
17768
  var CLI_PACKAGE = "@codacy/verity-cli";
17671
- var CLI_ENTRY = (0, import_node_path11.join)("node_modules", CLI_PACKAGE, "bin", "verity.js");
17769
+ var CLI_ENTRY = (0, import_node_path12.join)("node_modules", CLI_PACKAGE, "bin", "verity.js");
17672
17770
  function readJson(path) {
17673
17771
  try {
17674
- const parsed = JSON.parse((0, import_node_fs10.readFileSync)(path, "utf-8"));
17772
+ const parsed = JSON.parse((0, import_node_fs11.readFileSync)(path, "utf-8"));
17675
17773
  return parsed && typeof parsed === "object" ? parsed : null;
17676
17774
  } catch {
17677
17775
  return null;
17678
17776
  }
17679
17777
  }
17680
17778
  function versionUnder(base) {
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"));
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"));
17684
17782
  return typeof pkg?.version === "string" ? pkg.version : null;
17685
17783
  }
17686
17784
  function versionForEntry(entry) {
17687
17785
  try {
17688
- const pkg = readJson((0, import_node_path11.join)((0, import_node_path11.dirname)((0, import_node_fs10.realpathSync)(entry)), "..", "package.json"));
17786
+ const pkg = readJson((0, import_node_path12.join)((0, import_node_path12.dirname)((0, import_node_fs11.realpathSync)(entry)), "..", "package.json"));
17689
17787
  return typeof pkg?.version === "string" ? pkg.version : null;
17690
17788
  } catch {
17691
17789
  return null;
@@ -17693,16 +17791,16 @@ function versionForEntry(entry) {
17693
17791
  }
17694
17792
  function resolveHooksCli(pluginRoot) {
17695
17793
  const override = process.env.VERITY_CLI_PATH;
17696
- if (override && (0, import_node_fs10.existsSync)(override)) {
17794
+ if (override && (0, import_node_fs11.existsSync)(override)) {
17697
17795
  return { version: versionForEntry(override), rung: "override" };
17698
17796
  }
17699
17797
  const fromPlugin = versionUnder(pluginRoot);
17700
17798
  if (fromPlugin !== null) return { version: fromPlugin, rung: "plugin" };
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");
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");
17703
17801
  const fromData = versionUnder(dataDir);
17704
17802
  if (fromData !== null) return { version: fromData, rung: "plugin-data" };
17705
- if ((0, import_node_fs10.existsSync)((0, import_node_path11.join)(dataDir, CLI_ENTRY))) return { version: null, rung: "plugin-data" };
17803
+ if ((0, import_node_fs11.existsSync)((0, import_node_path12.join)(dataDir, CLI_ENTRY))) return { version: null, rung: "plugin-data" };
17706
17804
  const global = globalVerityVersion();
17707
17805
  if (global !== null) return { version: global, rung: "global" };
17708
17806
  return null;
@@ -17804,7 +17902,7 @@ function pluginCliInvocation() {
17804
17902
  return resolverCommand(root);
17805
17903
  }
17806
17904
  function resolverCommand(root) {
17807
- return `node ${JSON.stringify((0, import_node_path11.join)(root, "scripts", "verity.mjs"))}`;
17905
+ return `node ${JSON.stringify((0, import_node_path12.join)(root, "scripts", "verity.mjs"))}`;
17808
17906
  }
17809
17907
 
17810
17908
  // src/commands/hooks.ts
@@ -17940,18 +18038,18 @@ function registerHooksCommands(program2) {
17940
18038
  }
17941
18039
 
17942
18040
  // src/commands/intent.ts
17943
- var import_node_crypto9 = require("node:crypto");
18041
+ var import_node_crypto10 = require("node:crypto");
17944
18042
 
17945
18043
  // src/lib/conversation-buffer.ts
17946
18044
  var import_promises5 = require("node:fs/promises");
17947
- var import_node_fs11 = require("node:fs");
18045
+ var import_node_fs12 = require("node:fs");
17948
18046
  var import_node_child_process6 = require("node:child_process");
17949
- var import_node_crypto = require("node:crypto");
18047
+ var import_node_crypto2 = require("node:crypto");
17950
18048
  function stripImageReferences(text) {
17951
18049
  return text.replace(/\[Image #\d+\]/g, "[screenshot \u2014 not available for review]");
17952
18050
  }
17953
18051
  function bufferTmpPath() {
17954
- return `${CONVERSATION_BUFFER_FILE}.${process.pid}.${(0, import_node_crypto.randomBytes)(4).toString("hex")}.tmp`;
18052
+ return `${CONVERSATION_BUFFER_FILE}.${process.pid}.${(0, import_node_crypto2.randomBytes)(4).toString("hex")}.tmp`;
17955
18053
  }
17956
18054
  async function appendToConversationBuffer(prompt, sessionId) {
17957
18055
  try {
@@ -17980,7 +18078,7 @@ async function appendToConversationBuffer(prompt, sessionId) {
17980
18078
  }
17981
18079
  async function readAndClearConversationBuffer(currentSessionId) {
17982
18080
  try {
17983
- if ((0, import_node_fs11.existsSync)(CONVERSATION_BUFFER_FILE)) {
18081
+ if ((0, import_node_fs12.existsSync)(CONVERSATION_BUFFER_FILE)) {
17984
18082
  const entries = await readBufferEntries();
17985
18083
  let mine = entries;
17986
18084
  let others = [];
@@ -18004,7 +18102,7 @@ async function readAndClearConversationBuffer(currentSessionId) {
18004
18102
  };
18005
18103
  }
18006
18104
  }
18007
- if ((0, import_node_fs11.existsSync)(INTENT_FILE)) {
18105
+ if ((0, import_node_fs12.existsSync)(INTENT_FILE)) {
18008
18106
  try {
18009
18107
  const content = await (0, import_promises5.readFile)(INTENT_FILE, "utf-8");
18010
18108
  await (0, import_promises5.unlink)(INTENT_FILE).catch(() => {
@@ -18295,83 +18393,6 @@ function isCommandOnlyTurn(input) {
18295
18393
  return commands.every(isNonAuthoringCommand);
18296
18394
  }
18297
18395
 
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
-
18375
18396
  // src/lib/task-context-buffer.ts
18376
18397
  var import_promises6 = require("node:fs/promises");
18377
18398
  var import_node_fs13 = require("node:fs");
@@ -20037,6 +20058,97 @@ var LEGACY_MD_END = "<!-- gate-memory:end -->";
20037
20058
  var LEGACY_PRESERVE_START = "<!-- gate-memory:preserve -->";
20038
20059
  var LEGACY_PRESERVE_END = "<!-- /gate-memory:preserve -->";
20039
20060
  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 = [
20040
20152
  "## Project Memory",
20041
20153
  "",
20042
20154
  "This project has a knowledge graph maintained at `.verity/memory/`. Before starting",
@@ -20478,6 +20590,7 @@ function stripKnownProse(interior) {
20478
20590
  const trimmed = interior.replace(/^\n+/, "");
20479
20591
  for (const prose of [
20480
20592
  CLAUDE_MD_PROSE,
20593
+ CLAUDE_MD_PROSE_PRE_STDIN,
20481
20594
  CLAUDE_MD_PROSE_PRE_ORG,
20482
20595
  CLAUDE_MD_PROSE_PRE_AUTORECORD,
20483
20596
  CLAUDE_MD_PROSE_PRE_REFLECT,
@@ -20544,7 +20657,7 @@ Body content (\u22648KB). Use [[node-id]] wikilinks for cross-references.
20544
20657
 
20545
20658
  // src/lib/dossier-session.ts
20546
20659
  var import_node_fs26 = require("node:fs");
20547
- var import_node_crypto8 = require("node:crypto");
20660
+ var import_node_crypto9 = require("node:crypto");
20548
20661
  var import_node_path22 = require("node:path");
20549
20662
 
20550
20663
  // src/lib/pending-repeat.ts
@@ -20621,6 +20734,7 @@ function isRepeatOfAny(text, priorFingerprints, threshold = REPEAT_THRESHOLD) {
20621
20734
  }
20622
20735
 
20623
20736
  // src/lib/dossier/bounds.ts
20737
+ var import_node_crypto5 = require("node:crypto");
20624
20738
  var MAX_LINE_BYTES = 4096;
20625
20739
  var MAX_GOAL_CHARS = 2e3;
20626
20740
  var GOAL_KEEP = 8;
@@ -20632,10 +20746,17 @@ var NOT_MINE_CAP = 300;
20632
20746
  var STATEMENTS_OPEN_CAP = 40;
20633
20747
  var COMMANDS_CAP = 12;
20634
20748
  var DIVERGENCE_CAP = 10;
20635
- var DIVERGENCE_SEEN_CAP = 300;
20749
+ var DIVERGENCE_BULK_AT = 300;
20750
+ var DIVERGENCE_KEYS_PER_LINE = 200;
20636
20751
  function divergenceKey(path, hash) {
20637
20752
  return `${path}@${hash ?? "unknown"}`;
20638
20753
  }
20754
+ function packedDivergenceDigest(key) {
20755
+ return (0, import_node_crypto5.createHash)("sha256").update(key).digest("hex").slice(0, 12);
20756
+ }
20757
+ function packedDivergenceKey(digest) {
20758
+ return `#${digest}`;
20759
+ }
20639
20760
  var MARKS_CAP = 50;
20640
20761
  var ROTATE_BYTES = 1048576;
20641
20762
  var ROTATE_KEEP = 2;
@@ -20649,7 +20770,7 @@ function statementAnchorKey(file, patternId) {
20649
20770
  }
20650
20771
 
20651
20772
  // src/lib/dossier/log.ts
20652
- var import_node_crypto5 = require("node:crypto");
20773
+ var import_node_crypto6 = require("node:crypto");
20653
20774
  var import_node_fs22 = require("node:fs");
20654
20775
  var import_node_path20 = require("node:path");
20655
20776
  var CRC_TABLE = (() => {
@@ -20691,7 +20812,7 @@ function nextSeq() {
20691
20812
  function encodeEvent(ev) {
20692
20813
  const full = {
20693
20814
  v: 1,
20694
- id: (0, import_node_crypto5.randomBytes)(4).toString("hex"),
20815
+ id: (0, import_node_crypto6.randomBytes)(4).toString("hex"),
20695
20816
  ...ev
20696
20817
  };
20697
20818
  let body2 = JSON.stringify(full);
@@ -20762,7 +20883,7 @@ function rotateIfNeeded2(d) {
20762
20883
  }
20763
20884
 
20764
20885
  // src/lib/dossier/fold-dossier.ts
20765
- var import_node_crypto6 = require("node:crypto");
20886
+ var import_node_crypto7 = require("node:crypto");
20766
20887
  var import_node_fs23 = require("node:fs");
20767
20888
  var import_node_path21 = require("node:path");
20768
20889
  var EMPTY_CAPABILITIES = () => ({
@@ -20854,7 +20975,7 @@ function reduce(state, events, now) {
20854
20975
  state.meta.seq = Math.max(state.meta.seq, ev.seq);
20855
20976
  switch (ev.k) {
20856
20977
  case "goal": {
20857
- const hash = (0, import_node_crypto6.createHash)("sha256").update(ev.text).digest("hex").slice(0, 16);
20978
+ const hash = (0, import_node_crypto7.createHash)("sha256").update(ev.text).digest("hex").slice(0, 16);
20858
20979
  const prev = state.goal[state.goal.length - 1];
20859
20980
  if (prev && prev.hash === hash) {
20860
20981
  prev.repeats = (prev.repeats ?? 0) + 1;
@@ -20982,12 +21103,13 @@ function reduce(state, events, now) {
20982
21103
  break;
20983
21104
  }
20984
21105
  case "divergence": {
20985
- state.divergence.counts[ev.kind] = (state.divergence.counts[ev.kind] ?? 0) + 1;
20986
21106
  state.divergence.events.push({ kind: ev.kind, path: ev.path, at: ev.at });
20987
- const key = divergenceKey(ev.path, ev.hash ?? null);
20988
- if (!seenDivergence.has(key)) {
21107
+ const keys = Array.isArray(ev.keys) ? ev.keys.filter((k) => typeof k === "string").map(packedDivergenceKey) : [divergenceKey(ev.path, ev.hash ?? null)];
21108
+ for (const key of keys) {
21109
+ if (seenDivergence.has(key)) continue;
20989
21110
  seenDivergence.add(key);
20990
- if (state.divergence.seen.length < DIVERGENCE_SEEN_CAP) state.divergence.seen.push(key);
21111
+ state.divergence.seen.push(key);
21112
+ state.divergence.counts[ev.kind] = (state.divergence.counts[ev.kind] ?? 0) + 1;
20991
21113
  }
20992
21114
  break;
20993
21115
  }
@@ -21294,14 +21416,14 @@ function assessContinuity(i2) {
21294
21416
  }
21295
21417
 
21296
21418
  // src/lib/dossier/reanchor.ts
21297
- var import_node_crypto7 = require("node:crypto");
21419
+ var import_node_crypto8 = require("node:crypto");
21298
21420
  var import_node_fs25 = require("node:fs");
21299
21421
  function lineSha(text) {
21300
- return (0, import_node_crypto7.createHash)("sha256").update(text.trim()).digest("hex").slice(0, HASH_WIDTH);
21422
+ return (0, import_node_crypto8.createHash)("sha256").update(text.trim()).digest("hex").slice(0, HASH_WIDTH);
21301
21423
  }
21302
21424
  function fileHash(path) {
21303
21425
  try {
21304
- return (0, import_node_crypto7.createHash)("sha256").update((0, import_node_fs25.readFileSync)(path)).digest("hex").slice(0, HASH_WIDTH);
21426
+ return (0, import_node_crypto8.createHash)("sha256").update((0, import_node_fs25.readFileSync)(path)).digest("hex").slice(0, HASH_WIDTH);
21305
21427
  } catch {
21306
21428
  return null;
21307
21429
  }
@@ -21798,7 +21920,7 @@ function recordTurn(d, t) {
21798
21920
  // Identity is the COMMAND, not its category — otherwise `npm test -- a` and
21799
21921
  // `npm test -- b` are one row and the streak counts two different commands
21800
21922
  // as a run of one.
21801
- cmd_hash: (0, import_node_crypto8.createHash)("sha256").update(c.head || c.class).digest("hex").slice(0, 12),
21923
+ cmd_hash: (0, import_node_crypto9.createHash)("sha256").update(c.head || c.class).digest("hex").slice(0, 12),
21802
21924
  head: c.head || c.class,
21803
21925
  status: toStatus(c.last_status)
21804
21926
  });
@@ -21816,10 +21938,23 @@ function recordTurn(d, t) {
21816
21938
  }
21817
21939
  }
21818
21940
  const seenDivergence = t.known?.divergence ?? /* @__PURE__ */ new Set();
21941
+ const fresh = [];
21819
21942
  for (const u of t.unobserved) {
21820
21943
  const hash = fileHash((0, import_node_path22.join)(root, u.p));
21821
- if (seenDivergence.has(divergenceKey(u.p, hash))) continue;
21822
- appendEvent(d, { k: "divergence", kind: "external_mutation", path: u.p, hash });
21944
+ const key = divergenceKey(u.p, hash);
21945
+ const digest = packedDivergenceDigest(key);
21946
+ if (seenDivergence.has(key) || seenDivergence.has(packedDivergenceKey(digest))) continue;
21947
+ fresh.push({ path: u.p, hash, digest });
21948
+ }
21949
+ if (fresh.length > DIVERGENCE_BULK_AT) {
21950
+ for (let i2 = 0; i2 < fresh.length; i2 += DIVERGENCE_KEYS_PER_LINE) {
21951
+ const slice2 = fresh.slice(i2, i2 + DIVERGENCE_KEYS_PER_LINE);
21952
+ appendEvent(d, { k: "divergence", kind: "external_mutation", path: slice2[0].path, keys: slice2.map((f) => f.digest) });
21953
+ }
21954
+ } else {
21955
+ for (const f of fresh) {
21956
+ appendEvent(d, { k: "divergence", kind: "external_mutation", path: f.path, hash: f.hash });
21957
+ }
21823
21958
  }
21824
21959
  const newCompactions = (t.compactions ?? 0) - (t.known?.compactions ?? 0);
21825
21960
  for (let i2 = 0; i2 < newCompactions; i2++) {
@@ -22084,7 +22219,7 @@ async function fireClassify(prompt, sessionId, globals) {
22084
22219
  logEvent("classify_skipped", { reason: "no_service_url", detail: urlResult.error });
22085
22220
  return;
22086
22221
  }
22087
- const promptHash = (0, import_node_crypto9.createHash)("sha256").update(prompt).digest("hex");
22222
+ const promptHash = (0, import_node_crypto10.createHash)("sha256").update(prompt).digest("hex");
22088
22223
  const result = await apiRequest({
22089
22224
  method: "POST",
22090
22225
  path: "/classify-task",
@@ -22128,7 +22263,7 @@ var import_node_path26 = require("node:path");
22128
22263
  // src/lib/baseline.ts
22129
22264
  var import_node_fs28 = require("node:fs");
22130
22265
  var import_node_path25 = require("node:path");
22131
- var import_node_crypto10 = require("node:crypto");
22266
+ var import_node_crypto11 = require("node:crypto");
22132
22267
 
22133
22268
  // src/lib/snapshot.ts
22134
22269
  var import_node_fs27 = require("node:fs");
@@ -22397,7 +22532,7 @@ var MIRROR_MAX_BYTES = 2 * 1024 * 1024;
22397
22532
  var DEFAULT_SESSION_KEY = "_default";
22398
22533
  function sessionKey(sessionId) {
22399
22534
  if (!sessionId) return DEFAULT_SESSION_KEY;
22400
- return (0, import_node_crypto10.createHash)("sha256").update(sessionId).digest("hex").slice(0, 16);
22535
+ return (0, import_node_crypto11.createHash)("sha256").update(sessionId).digest("hex").slice(0, 16);
22401
22536
  }
22402
22537
  function sessionDir(key) {
22403
22538
  return (0, import_node_path25.join)(projectPath(BASELINE_DIR), key);
@@ -22859,17 +22994,17 @@ async function readHookStdin() {
22859
22994
  try {
22860
22995
  if (process.stdin.isTTY) return {};
22861
22996
  const chunks = [];
22862
- const timeout = new Promise((resolve8) => setTimeout(() => resolve8({}), 500));
22863
- const read2 = new Promise((resolve8) => {
22997
+ const timeout = new Promise((resolve9) => setTimeout(() => resolve9({}), 500));
22998
+ const read2 = new Promise((resolve9) => {
22864
22999
  process.stdin.on("data", (c) => chunks.push(c));
22865
23000
  process.stdin.on("end", () => {
22866
23001
  try {
22867
- resolve8(JSON.parse(Buffer.concat(chunks).toString("utf-8").trim() || "{}"));
23002
+ resolve9(JSON.parse(Buffer.concat(chunks).toString("utf-8").trim() || "{}"));
22868
23003
  } catch {
22869
- resolve8({});
23004
+ resolve9({});
22870
23005
  }
22871
23006
  });
22872
- process.stdin.on("error", () => resolve8({}));
23007
+ process.stdin.on("error", () => resolve9({}));
22873
23008
  process.stdin.resume();
22874
23009
  });
22875
23010
  return await Promise.race([read2, timeout]);
@@ -22965,7 +23100,7 @@ function isIgnored2(path) {
22965
23100
  }
22966
23101
  function listProjectFiles(root) {
22967
23102
  try {
22968
- const out2 = (0, import_node_child_process9.execSync)("git ls-files -z", {
23103
+ const out2 = (0, import_node_child_process9.execSync)("git ls-files -z --cached --others --exclude-standard", {
22969
23104
  cwd: root,
22970
23105
  encoding: "utf-8",
22971
23106
  maxBuffer: 32 * 1024 * 1024,
@@ -24152,7 +24287,7 @@ function registerConfigCommands(program2) {
24152
24287
  config.command("formal [state]").description('Get or set formal verification at push: "push" or "off" (needs Lean \u2014 verity lean status)').action((state) => {
24153
24288
  if (state === void 0) {
24154
24289
  const cfg = readProjectConfig();
24155
- process.stdout.write((cfg.formal ?? "off") + "\n");
24290
+ process.stdout.write((cfg.formal === "push" ? "push" : "off") + "\n");
24156
24291
  if (cfg.formal_refused) printWarn(formalRefusalMessage(cfg.formal_refused));
24157
24292
  return;
24158
24293
  }
@@ -24160,10 +24295,10 @@ function registerConfigCommands(program2) {
24160
24295
  printError(`Unrecognised state: ${state}. Use "push" or "off".`);
24161
24296
  process.exit(1);
24162
24297
  }
24163
- writeProjectConfig({ formal: state === "push" ? "push" : void 0 });
24164
- const refused = state === "push" ? readProjectConfig().formal_refused : void 0;
24165
- if (refused) {
24166
- printWarn(`Formal verification at push: still off \u2014 ${formalRefusalMessage(refused)}`);
24298
+ writeProjectConfig({ formal: state === "push" ? "push" : "off" });
24299
+ const refused2 = state === "push" ? readProjectConfig().formal_refused : void 0;
24300
+ if (refused2) {
24301
+ printWarn(`Formal verification at push: still off \u2014 ${formalRefusalMessage(refused2)}`);
24167
24302
  return;
24168
24303
  }
24169
24304
  printInfo(state === "push" ? "Formal verification at push: on for this checkout (Lean must be installed \u2014 verity lean status)" : "Formal verification at push: off");
@@ -24317,10 +24452,10 @@ var import_node_fs38 = require("node:fs");
24317
24452
 
24318
24453
  // src/lib/debounce.ts
24319
24454
  var import_node_fs37 = require("node:fs");
24320
- var import_node_crypto11 = require("node:crypto");
24455
+ var import_node_crypto12 = require("node:crypto");
24321
24456
  function scopedFile(base, sessionId) {
24322
24457
  if (!sessionId) return base;
24323
- return `${base}.${(0, import_node_crypto11.createHash)("sha1").update(sessionId).digest("hex").slice(0, 12)}`;
24458
+ return `${base}.${(0, import_node_crypto12.createHash)("sha1").update(sessionId).digest("hex").slice(0, 12)}`;
24324
24459
  }
24325
24460
  function checkDebounce(debounceSeconds = DEBOUNCE_SECONDS, sessionId) {
24326
24461
  const file = scopedFile(DEBOUNCE_FILE, sessionId);
@@ -24361,7 +24496,7 @@ function checkMtime(files, bypassForRecentCommits, sessionId) {
24361
24496
  return "No files modified since last analysis";
24362
24497
  }
24363
24498
  function computeContentHash(files) {
24364
- const hash = (0, import_node_crypto11.createHash)("sha1");
24499
+ const hash = (0, import_node_crypto12.createHash)("sha1");
24365
24500
  const sorted = [...files].sort();
24366
24501
  for (const f of sorted) {
24367
24502
  const resolved = resolveFile(f) ?? f;
@@ -24817,20 +24952,56 @@ function registerStatusCommand(program2) {
24817
24952
  });
24818
24953
  }
24819
24954
 
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
+
24820
24986
  // src/commands/feedback.ts
24821
24987
  function registerFeedbackCommand(program2) {
24822
24988
  const feedbackCmd = program2.command("feedback").description("Send feedback to the Verity team");
24823
- feedbackCmd.command("message <text>").description("Send general feedback").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (message, opts) => {
24824
- const globals = program2.opts();
24825
- await sendGeneralFeedback(message, opts, globals);
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());
24826
24991
  });
24827
- feedbackCmd.command("finding <run-id> <pattern-id> <action> [note]").description("Submit per-finding feedback (false_positive, acknowledged, useful, etc.)").option("--file <path>", "File path the finding applies to").option("--line <n>", "Line number", parseInt).action(async (runId, patternId, action, note, opts) => {
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) => {
24828
24993
  const globals = program2.opts();
24829
24994
  const validActions = ["false_positive", "acknowledged", "will_fix_later", "wrong_severity", "useful"];
24830
24995
  if (!validActions.includes(action)) {
24831
24996
  printError(`Invalid action "${action}". Must be one of: ${validActions.join(", ")}`);
24832
24997
  process.exit(1);
24833
24998
  }
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;
24834
25005
  const tokenResult = await resolveToken(globals.token);
24835
25006
  if (!tokenResult.ok) {
24836
25007
  printError(tokenResult.error);
@@ -24866,21 +25037,28 @@ function registerFeedbackCommand(program2) {
24866
25037
  });
24867
25038
  feedbackCmd.argument("[message]", "Feedback message (for backwards compat)").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (message, opts) => {
24868
25039
  if (!message) return;
24869
- const globals = program2.opts();
24870
- await sendGeneralFeedback(message, opts, globals);
25040
+ await sendMessageArg(message, opts, program2.opts());
24871
25041
  });
24872
25042
  }
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
+ }
24873
25051
  async function sendGeneralFeedback(message, opts, globals) {
24874
25052
  const tokenResult = await resolveToken(globals.token);
24875
25053
  if (!tokenResult.ok) {
24876
25054
  printError(tokenResult.error);
24877
- printInfo(`Your message: ${message}`);
25055
+ printInfo(`Your message: ${terminalText(message, message.length)}`);
24878
25056
  process.exit(1);
24879
25057
  }
24880
25058
  const urlResult = await resolveServiceUrl(globals.serviceUrl);
24881
25059
  if (!urlResult.ok) {
24882
25060
  printError(urlResult.error);
24883
- printInfo(`Your message: ${message}`);
25061
+ printInfo(`Your message: ${terminalText(message, message.length)}`);
24884
25062
  process.exit(1);
24885
25063
  }
24886
25064
  const body2 = { message };
@@ -24898,7 +25076,7 @@ async function sendGeneralFeedback(message, opts, globals) {
24898
25076
  });
24899
25077
  if (!result.ok) {
24900
25078
  printError(`Couldn't send feedback: ${result.error}`);
24901
- printInfo(`Your message: ${message}`);
25079
+ printInfo(`Your message: ${terminalText(message, message.length)}`);
24902
25080
  process.exit(1);
24903
25081
  }
24904
25082
  printInfo("Thanks, feedback sent!");
@@ -24983,7 +25161,8 @@ function createRun(opts, globals) {
24983
25161
  }
24984
25162
 
24985
25163
  // src/commands/analyze/index.ts
24986
- var import_node_fs52 = require("node:fs");
25164
+ var import_node_fs53 = require("node:fs");
25165
+ var import_node_path40 = require("node:path");
24987
25166
 
24988
25167
  // src/lib/repo-context.ts
24989
25168
  var import_node_child_process11 = require("node:child_process");
@@ -25947,7 +26126,7 @@ function installRunEvidence(run4) {
25947
26126
  }
25948
26127
 
25949
26128
  // src/lib/git-frame.ts
25950
- var import_node_fs39 = require("node:fs");
26129
+ var import_node_fs40 = require("node:fs");
25951
26130
  var import_node_os6 = require("node:os");
25952
26131
  var import_node_path30 = require("node:path");
25953
26132
  var import_node_path31 = require("node:path");
@@ -26117,14 +26296,14 @@ function gitAt(dir, args2) {
26117
26296
  }
26118
26297
  function realpathOr2(p) {
26119
26298
  try {
26120
- return import_node_fs39.realpathSync.native(p);
26299
+ return import_node_fs40.realpathSync.native(p);
26121
26300
  } catch {
26122
26301
  return (0, import_node_path30.resolve)(p);
26123
26302
  }
26124
26303
  }
26125
26304
  function resolveFrame(input) {
26126
26305
  const found = findMomentSegment(input.command, input.on);
26127
- const hookDirUsable = !!input.hookCwd && (0, import_node_fs39.existsSync)(input.hookCwd);
26306
+ const hookDirUsable = !!input.hookCwd && (0, import_node_fs40.existsSync)(input.hookCwd);
26128
26307
  const baseDir = hookDirUsable ? input.hookCwd : process.cwd();
26129
26308
  let anchor = hookDirUsable ? "hook-cwd" : "process-cwd";
26130
26309
  const refuse = (refusal) => ({
@@ -26147,7 +26326,7 @@ function resolveFrame(input) {
26147
26326
  if (dirs.size > 1) return refuse(`target:multiple ${found.moment} targets in one command`);
26148
26327
  const targetDir = dirs.size === 1 ? [...dirs][0] : baseDir;
26149
26328
  if (targetDir !== baseDir) {
26150
- if (!(0, import_node_fs39.existsSync)(targetDir)) return refuse(`target:directory does not exist: ${targetDir}`);
26329
+ if (!(0, import_node_fs40.existsSync)(targetDir)) return refuse(`target:directory does not exist: ${targetDir}`);
26151
26330
  dir = targetDir;
26152
26331
  }
26153
26332
  }
@@ -26334,7 +26513,7 @@ function stagedRange(frame, command) {
26334
26513
  return { kind: "staged", base: "HEAD", head: "INDEX", via: "staged-in-command", refusal: plan.reason };
26335
26514
  }
26336
26515
  const mergeHead = frame.gitDir ? (0, import_node_path31.join)(frame.gitDir, "MERGE_HEAD") : null;
26337
- if (mergeHead && (0, import_node_fs39.existsSync)(mergeHead)) {
26516
+ if (mergeHead && (0, import_node_fs40.existsSync)(mergeHead)) {
26338
26517
  const vsHead = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "HEAD"]).split("\n").filter(Boolean));
26339
26518
  const vsMerge = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "MERGE_HEAD"]).split("\n").filter(Boolean));
26340
26519
  const resolutions = new Set([...vsHead].filter((f) => vsMerge.has(f) && !isVerityOwnedPath(f)));
@@ -26468,7 +26647,7 @@ function truthy(v) {
26468
26647
  }
26469
26648
 
26470
26649
  // src/lib/transcript.ts
26471
- var import_node_fs40 = require("node:fs");
26650
+ var import_node_fs41 = require("node:fs");
26472
26651
  var MAX_READ_BYTES = 256 * 1024;
26473
26652
  var SMALL_FILE_BYTES = 64 * 1024;
26474
26653
  var MAX_FILES_LIST = 20;
@@ -26495,7 +26674,7 @@ async function extractActionSummary(transcriptPath) {
26495
26674
  function readTurnLines(transcriptPath) {
26496
26675
  let size;
26497
26676
  try {
26498
- size = (0, import_node_fs40.statSync)(transcriptPath).size;
26677
+ size = (0, import_node_fs41.statSync)(transcriptPath).size;
26499
26678
  } catch {
26500
26679
  return null;
26501
26680
  }
@@ -26503,7 +26682,7 @@ function readTurnLines(transcriptPath) {
26503
26682
  let raw;
26504
26683
  let windowed = false;
26505
26684
  if (size <= SMALL_FILE_BYTES) {
26506
- raw = (0, import_node_fs40.readFileSync)(transcriptPath, "utf-8");
26685
+ raw = (0, import_node_fs41.readFileSync)(transcriptPath, "utf-8");
26507
26686
  } else {
26508
26687
  windowed = true;
26509
26688
  const buf = Buffer.alloc(Math.min(MAX_READ_BYTES, size));
@@ -26786,28 +26965,28 @@ async function readStopHookStdin() {
26786
26965
  try {
26787
26966
  if (process.stdin.isTTY) return empty;
26788
26967
  const chunks = [];
26789
- const timeout = new Promise((resolve8) => setTimeout(() => resolve8(empty), 500));
26790
- const read2 = new Promise((resolve8) => {
26968
+ const timeout = new Promise((resolve9) => setTimeout(() => resolve9(empty), 500));
26969
+ const read2 = new Promise((resolve9) => {
26791
26970
  process.stdin.on("data", (chunk) => chunks.push(chunk));
26792
26971
  process.stdin.on("end", () => {
26793
26972
  const raw = Buffer.concat(chunks).toString("utf-8").trim();
26794
26973
  if (!raw) {
26795
- resolve8(empty);
26974
+ resolve9(empty);
26796
26975
  return;
26797
26976
  }
26798
26977
  try {
26799
26978
  const data = JSON.parse(raw);
26800
- resolve8({
26979
+ resolve9({
26801
26980
  assistantMessage: typeof data.last_assistant_message === "string" ? data.last_assistant_message : null,
26802
26981
  stopReason: typeof data.stop_reason === "string" ? data.stop_reason : null,
26803
26982
  transcriptPath: typeof data.transcript_path === "string" ? data.transcript_path : null,
26804
26983
  sessionId: typeof data.session_id === "string" ? data.session_id : null
26805
26984
  });
26806
26985
  } catch {
26807
- resolve8(empty);
26986
+ resolve9(empty);
26808
26987
  }
26809
26988
  });
26810
- process.stdin.on("error", () => resolve8(empty));
26989
+ process.stdin.on("error", () => resolve9(empty));
26811
26990
  process.stdin.resume();
26812
26991
  });
26813
26992
  return await Promise.race([read2, timeout]);
@@ -27073,7 +27252,7 @@ function channelSilence(input) {
27073
27252
  // src/lib/cli-version.ts
27074
27253
  function cliVersion() {
27075
27254
  try {
27076
- return true ? "0.34.0-experimental.421a631" : "dev";
27255
+ return true ? "0.34.0-experimental.53caba1" : "dev";
27077
27256
  } catch {
27078
27257
  return "dev";
27079
27258
  }
@@ -27114,7 +27293,171 @@ async function sendSkipBeacon(ctx, reason) {
27114
27293
 
27115
27294
  // src/lib/static-analysis.ts
27116
27295
  var import_node_child_process12 = require("node:child_process");
27117
- var import_node_fs41 = require("node:fs");
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
27118
27461
  var SEVERITY_ORDER = {
27119
27462
  Error: 0,
27120
27463
  Critical: 0,
@@ -27170,7 +27513,7 @@ function runCodacyAnalysis(files) {
27170
27513
  if (files.length === 0) return empty;
27171
27514
  const existingFiles = files.filter((f) => {
27172
27515
  try {
27173
- return (0, import_node_fs41.existsSync)(f);
27516
+ return (0, import_node_fs42.existsSync)(f);
27174
27517
  } catch {
27175
27518
  return false;
27176
27519
  }
@@ -27202,7 +27545,10 @@ function interpretAnalyzerRun(run4) {
27202
27545
  } catch {
27203
27546
  return withFailure("unparseable_output", output);
27204
27547
  }
27205
- const issues = parsed.issues ?? [];
27548
+ const reported = parsed.issues ?? [];
27549
+ const issues = reported.filter(
27550
+ (i2) => !isEnvironmentGlobalNoUndef(i2.patternId ?? "", i2.message ?? "", i2.filePath ?? "")
27551
+ );
27206
27552
  const findings = issues.map((issue) => ({
27207
27553
  rule_id: issue.patternId ?? "",
27208
27554
  tool: issue.toolId ?? "",
@@ -27225,7 +27571,7 @@ function interpretAnalyzerRun(run4) {
27225
27571
  );
27226
27572
  const analyzerErrors = parsed.errors ?? [];
27227
27573
  let failure;
27228
- if (findings.length === 0) {
27574
+ if (reported.length === 0) {
27229
27575
  if (analyzerErrors.length > 0) {
27230
27576
  const first = analyzerErrors[0];
27231
27577
  failure = {
@@ -27439,7 +27785,7 @@ async function scope(run4) {
27439
27785
  }
27440
27786
 
27441
27787
  // src/lib/specs.ts
27442
- var import_node_fs42 = require("node:fs");
27788
+ var import_node_fs43 = require("node:fs");
27443
27789
  var import_node_path32 = require("node:path");
27444
27790
  var SPEC_CANDIDATES = [
27445
27791
  "CLAUDE.md",
@@ -27481,7 +27827,7 @@ function discoverSpecs(consulted = []) {
27481
27827
  const totalCap = relevant ? MAX_TOTAL_SPEC_BYTES : UNCONSULTED_TOTAL_BYTES;
27482
27828
  if (totalBytes >= totalCap) return false;
27483
27829
  if (seen.has(specPath)) return true;
27484
- if (!(0, import_node_fs42.existsSync)(specPath)) return true;
27830
+ if (!(0, import_node_fs43.existsSync)(specPath)) return true;
27485
27831
  seen.add(specPath);
27486
27832
  const remaining = totalCap - totalBytes;
27487
27833
  const fileCap = relevant ? MAX_SPEC_FILE_BYTES : UNCONSULTED_FILE_BYTES;
@@ -27504,7 +27850,7 @@ function discoverSpecs(consulted = []) {
27504
27850
  if (!addSpec(candidate)) break;
27505
27851
  }
27506
27852
  for (const dir of ["spec", "docs"]) {
27507
- if (!(0, import_node_fs42.existsSync)(dir)) continue;
27853
+ if (!(0, import_node_fs43.existsSync)(dir)) continue;
27508
27854
  try {
27509
27855
  const mdFiles = findMdFiles(dir, 2).sort();
27510
27856
  for (const mdFile of mdFiles) {
@@ -27519,7 +27865,7 @@ function findMdFiles(dir, maxDepth, depth = 0) {
27519
27865
  if (depth >= maxDepth) return [];
27520
27866
  const result = [];
27521
27867
  try {
27522
- const entries = (0, import_node_fs42.readdirSync)(dir, { withFileTypes: true });
27868
+ const entries = (0, import_node_fs43.readdirSync)(dir, { withFileTypes: true });
27523
27869
  for (const entry of entries) {
27524
27870
  const fullPath = (0, import_node_path32.join)(dir, entry.name);
27525
27871
  if (entry.isFile() && entry.name.endsWith(".md")) {
@@ -27539,13 +27885,13 @@ function discoverPlans() {
27539
27885
  if (isRealDirectoryChain(process.cwd(), [".claude", "plans"])) {
27540
27886
  sources.push({ root: process.cwd(), prefix: (0, import_node_path32.join)(".claude", "plans") });
27541
27887
  }
27542
- if (home && (0, import_node_fs42.existsSync)(homePlansDir)) sources.push({ root: homePlansDir, prefix: "" });
27888
+ if (home && (0, import_node_fs43.existsSync)(homePlansDir)) sources.push({ root: homePlansDir, prefix: "" });
27543
27889
  const candidates2 = [];
27544
27890
  const seen = /* @__PURE__ */ new Set();
27545
27891
  for (const source2 of sources) {
27546
27892
  let names2;
27547
27893
  try {
27548
- names2 = (0, import_node_fs42.readdirSync)(source2.prefix ? (0, import_node_path32.join)(source2.root, source2.prefix) : source2.root);
27894
+ names2 = (0, import_node_fs43.readdirSync)(source2.prefix ? (0, import_node_path32.join)(source2.root, source2.prefix) : source2.root);
27549
27895
  } catch {
27550
27896
  continue;
27551
27897
  }
@@ -27572,7 +27918,7 @@ function isRealDirectoryChain(root, parts2) {
27572
27918
  for (const part of parts2) {
27573
27919
  current = (0, import_node_path32.join)(current, part);
27574
27920
  try {
27575
- if (!(0, import_node_fs42.lstatSync)(current).isDirectory()) return false;
27921
+ if (!(0, import_node_fs43.lstatSync)(current).isDirectory()) return false;
27576
27922
  } catch {
27577
27923
  return false;
27578
27924
  }
@@ -27587,7 +27933,7 @@ function discoverGuardDocs(rangeFiles2) {
27587
27933
  if (result.length >= MAX_SPEC_FILES) break;
27588
27934
  if (!GUARD_DOC_EXT.test(path)) continue;
27589
27935
  if (path.startsWith("/") || path.includes("..")) continue;
27590
- if (!(0, import_node_fs42.existsSync)(path)) continue;
27936
+ if (!(0, import_node_fs43.existsSync)(path)) continue;
27591
27937
  const opened = openRegularInRoot(process.cwd(), path);
27592
27938
  if (!opened.ok) continue;
27593
27939
  if (opened.size > MAX_PLAN_FILE_BYTES || totalBytes + opened.size > MAX_TOTAL_SPEC_BYTES) {
@@ -27773,7 +28119,7 @@ async function mode(run4) {
27773
28119
  }
27774
28120
 
27775
28121
  // src/lib/fold.ts
27776
- var import_node_fs43 = require("node:fs");
28122
+ var import_node_fs44 = require("node:fs");
27777
28123
  var import_node_path33 = require("node:path");
27778
28124
  var KNOWN_RECORD_TYPES = /* @__PURE__ */ new Set([
27779
28125
  "user",
@@ -27911,7 +28257,7 @@ function candidateRoots(repoRoot2) {
27911
28257
  const norm2 = repoRoot2.replace(/\\/g, "/").replace(/\/+$/, "");
27912
28258
  const out2 = [norm2];
27913
28259
  try {
27914
- const real = import_node_fs43.realpathSync.native(norm2).replace(/\\/g, "/").replace(/\/+$/, "");
28260
+ const real = import_node_fs44.realpathSync.native(norm2).replace(/\\/g, "/").replace(/\/+$/, "");
27915
28261
  if (real !== norm2) out2.push(real);
27916
28262
  } catch {
27917
28263
  }
@@ -27999,8 +28345,8 @@ function fold(transcriptPath, opts = {}) {
27999
28345
  }
28000
28346
  };
28001
28347
  try {
28002
- if (!(0, import_node_fs43.existsSync)(transcriptPath)) return result;
28003
- ingest((0, import_node_fs43.readFileSync)(transcriptPath, "utf8"), "agent");
28348
+ if (!(0, import_node_fs44.existsSync)(transcriptPath)) return result;
28349
+ ingest((0, import_node_fs44.readFileSync)(transcriptPath, "utf8"), "agent");
28004
28350
  result.coverage.complete = true;
28005
28351
  } catch {
28006
28352
  return result;
@@ -28011,19 +28357,19 @@ function fold(transcriptPath, opts = {}) {
28011
28357
  (0, import_node_path33.basename)(transcriptPath).replace(/\.jsonl$/, ""),
28012
28358
  "subagents"
28013
28359
  );
28014
- if ((0, import_node_fs43.existsSync)(sidecarDir)) {
28360
+ if ((0, import_node_fs44.existsSync)(sidecarDir)) {
28015
28361
  const maxFiles = opts.maxSidecars ?? 200;
28016
28362
  const maxBytes = opts.maxSidecarBytes ?? 16 * 1024 * 1024;
28017
28363
  const found = [];
28018
28364
  const walk2 = (d, depth) => {
28019
28365
  if (depth > 4) return;
28020
- for (const e of (0, import_node_fs43.readdirSync)(d, { withFileTypes: true })) {
28366
+ for (const e of (0, import_node_fs44.readdirSync)(d, { withFileTypes: true })) {
28021
28367
  const p = (0, import_node_path33.join)(d, e.name);
28022
28368
  if (e.isDirectory()) {
28023
28369
  walk2(p, depth + 1);
28024
28370
  } else if (e.name.startsWith("agent-") && e.name.endsWith(".jsonl")) {
28025
28371
  try {
28026
- const st = (0, import_node_fs43.statSync)(p);
28372
+ const st = (0, import_node_fs44.statSync)(p);
28027
28373
  found.push({ path: p, size: st.size, mtimeMs: st.mtimeMs });
28028
28374
  } catch {
28029
28375
  result.coverage.malformed++;
@@ -28040,7 +28386,7 @@ function fold(transcriptPath, opts = {}) {
28040
28386
  continue;
28041
28387
  }
28042
28388
  try {
28043
- ingest((0, import_node_fs43.readFileSync)(f.path, "utf8"), "subagent");
28389
+ ingest((0, import_node_fs44.readFileSync)(f.path, "utf8"), "subagent");
28044
28390
  bytes += f.size;
28045
28391
  result.coverage.subagentFiles++;
28046
28392
  } catch {
@@ -28075,7 +28421,7 @@ function fold(transcriptPath, opts = {}) {
28075
28421
  }
28076
28422
  function classifyUnobserved(path) {
28077
28423
  try {
28078
- const st = (0, import_node_fs43.statSync)(path);
28424
+ const st = (0, import_node_fs44.statSync)(path);
28079
28425
  if (!st.isFile()) return "unreadable";
28080
28426
  } catch {
28081
28427
  return "unreadable";
@@ -28390,20 +28736,20 @@ async function evidence(run4) {
28390
28736
  }
28391
28737
 
28392
28738
  // src/lib/cache-cleanup.ts
28393
- var import_node_fs44 = require("node:fs");
28739
+ var import_node_fs45 = require("node:fs");
28394
28740
  var import_node_path34 = require("node:path");
28395
28741
  var CACHE_TTL_DAYS = 7;
28396
28742
  function pruneStaleCache() {
28397
28743
  try {
28398
28744
  const dir = projectPath(CACHE_DIR);
28399
28745
  const cutoff = Date.now() - CACHE_TTL_DAYS * 24 * 3600 * 1e3;
28400
- for (const entry of (0, import_node_fs44.readdirSync)(dir)) {
28746
+ for (const entry of (0, import_node_fs45.readdirSync)(dir)) {
28401
28747
  if (!entry.startsWith("pending-")) continue;
28402
28748
  const path = (0, import_node_path34.join)(dir, entry);
28403
28749
  try {
28404
- const stat3 = (0, import_node_fs44.statSync)(path);
28750
+ const stat3 = (0, import_node_fs45.statSync)(path);
28405
28751
  if (stat3.mtimeMs < cutoff) {
28406
- (0, import_node_fs44.unlinkSync)(path);
28752
+ (0, import_node_fs45.unlinkSync)(path);
28407
28753
  logEvent("cache_entry_pruned", {
28408
28754
  path: entry,
28409
28755
  age_days: Math.round((Date.now() - stat3.mtimeMs) / 864e5)
@@ -28417,7 +28763,7 @@ function pruneStaleCache() {
28417
28763
  }
28418
28764
 
28419
28765
  // src/lib/context-files.ts
28420
- var import_node_fs45 = require("node:fs");
28766
+ var import_node_fs46 = require("node:fs");
28421
28767
  var import_node_os7 = require("node:os");
28422
28768
  var MAX_CONTEXT_FILES = 10;
28423
28769
  var MAX_CONTEXT_FILE_BYTES = 10240;
@@ -28475,7 +28821,7 @@ function gatherContextFiles(contextPaths, deltaFiles, opts) {
28475
28821
  continue;
28476
28822
  }
28477
28823
  try {
28478
- const content = (0, import_node_fs45.readFileSync)(safePath, "utf8");
28824
+ const content = (0, import_node_fs46.readFileSync)(safePath, "utf8");
28479
28825
  const bytes = Buffer.byteLength(content);
28480
28826
  if (bytes > MAX_CONTEXT_FILE_BYTES) {
28481
28827
  logEvent("context_file_skipped", { path: filePath, reason: "too_large", bytes });
@@ -28541,7 +28887,7 @@ async function contextFiles(run4) {
28541
28887
  }
28542
28888
 
28543
28889
  // src/lib/code/index.ts
28544
- var import_node_crypto12 = require("node:crypto");
28890
+ var import_node_crypto13 = require("node:crypto");
28545
28891
 
28546
28892
  // src/lib/code/languages.ts
28547
28893
  var JS_LIKE = {
@@ -28633,7 +28979,7 @@ function languageOf2(path) {
28633
28979
  }
28634
28980
 
28635
28981
  // src/lib/code/runtime.ts
28636
- var import_node_fs46 = require("node:fs");
28982
+ var import_node_fs47 = require("node:fs");
28637
28983
  var import_node_path35 = require("node:path");
28638
28984
  var import_web_tree_sitter2 = __toESM2(require_web_tree_sitter2());
28639
28985
 
@@ -28705,7 +29051,7 @@ function grammarCandidates(file, pkg, env = process.env) {
28705
29051
  }
28706
29052
  function locateGrammar(id, env = process.env) {
28707
29053
  const g = grammars_default[id];
28708
- return grammarCandidates(g.file, g.package, env).find((p) => (0, import_node_fs46.existsSync)(p)) ?? null;
29054
+ return grammarCandidates(g.file, g.package, env).find((p) => (0, import_node_fs47.existsSync)(p)) ?? null;
28709
29055
  }
28710
29056
  var loading = null;
28711
29057
  function loadRuntime(env = process.env) {
@@ -30319,7 +30665,7 @@ function byPath(fns, name2) {
30319
30665
  function makeCodeMap(rt) {
30320
30666
  const cache = /* @__PURE__ */ new Map();
30321
30667
  const outline = (path, content, deadlineAt = Date.now() + DEFAULT_PARSE_MS) => {
30322
- const key = `${path}\0${(0, import_node_crypto12.createHash)("sha1").update(content).digest("hex")}`;
30668
+ const key = `${path}\0${(0, import_node_crypto13.createHash)("sha1").update(content).digest("hex")}`;
30323
30669
  const hit = cache.get(key);
30324
30670
  if (hit) return { source: "tree-sitter", value: hit, elapsedMs: 0 };
30325
30671
  let r;
@@ -31034,7 +31380,7 @@ async function repoContext(run4) {
31034
31380
 
31035
31381
  // src/lib/seed-runner.ts
31036
31382
  var import_promises15 = require("node:fs/promises");
31037
- var import_node_fs47 = require("node:fs");
31383
+ var import_node_fs48 = require("node:fs");
31038
31384
  var import_node_path36 = require("node:path");
31039
31385
  var import_yaml4 = __toESM2(require_dist());
31040
31386
 
@@ -31259,7 +31605,7 @@ async function localSeedTitles(memoryDir3 = MEMORY_DIR) {
31259
31605
  const titles = /* @__PURE__ */ new Set();
31260
31606
  for (const dir of NODE_DIRS) {
31261
31607
  const full = (0, import_node_path36.join)(memoryDir3, dir);
31262
- if (!(0, import_node_fs47.existsSync)(full)) continue;
31608
+ if (!(0, import_node_fs48.existsSync)(full)) continue;
31263
31609
  let files;
31264
31610
  try {
31265
31611
  files = await (0, import_promises15.readdir)(full);
@@ -31341,7 +31687,7 @@ function renderNodeMarkdown(candidate, nodeId, createdAt) {
31341
31687
  return fm;
31342
31688
  }
31343
31689
  async function runSeed(opts) {
31344
- if (!(0, import_node_fs47.existsSync)(STANDARD_FILE)) {
31690
+ if (!(0, import_node_fs48.existsSync)(STANDARD_FILE)) {
31345
31691
  return { created: 0, existing: 0, failed: 0, skipped: "no_standard", candidates: [] };
31346
31692
  }
31347
31693
  let standardDoc;
@@ -31353,7 +31699,7 @@ async function runSeed(opts) {
31353
31699
  }
31354
31700
  const knowledgeSpec = standardDoc.knowledge_spec ?? {};
31355
31701
  let readmeContent;
31356
- if ((0, import_node_fs47.existsSync)("README.md")) {
31702
+ if ((0, import_node_fs48.existsSync)("README.md")) {
31357
31703
  try {
31358
31704
  readmeContent = await (0, import_promises15.readFile)("README.md", "utf-8");
31359
31705
  } catch {
@@ -31361,7 +31707,7 @@ async function runSeed(opts) {
31361
31707
  }
31362
31708
  let claudeMdContent;
31363
31709
  for (const p of ["CLAUDE.md", ".claude/CLAUDE.md"]) {
31364
- if ((0, import_node_fs47.existsSync)(p)) {
31710
+ if ((0, import_node_fs48.existsSync)(p)) {
31365
31711
  try {
31366
31712
  claudeMdContent = await (0, import_promises15.readFile)(p, "utf-8");
31367
31713
  break;
@@ -31441,7 +31787,7 @@ async function runSeed(opts) {
31441
31787
  continue;
31442
31788
  }
31443
31789
  const deduplicated = res.data.deduplicated === true;
31444
- if (deduplicated && (0, import_node_fs47.existsSync)(targetPath)) {
31790
+ if (deduplicated && (0, import_node_fs48.existsSync)(targetPath)) {
31445
31791
  existing++;
31446
31792
  continue;
31447
31793
  }
@@ -31463,7 +31809,7 @@ async function runSeed(opts) {
31463
31809
  }
31464
31810
 
31465
31811
  // src/commands/analyze/phases/08-memory-manifest.ts
31466
- var import_node_fs48 = require("node:fs");
31812
+ var import_node_fs49 = require("node:fs");
31467
31813
  var import_node_path37 = require("node:path");
31468
31814
  async function memoryManifest(run4) {
31469
31815
  const { globals } = run4;
@@ -31475,8 +31821,8 @@ async function memoryManifest(run4) {
31475
31821
  try {
31476
31822
  await ensureMemoryDir();
31477
31823
  const seedMarker = (0, import_node_path37.join)(VERITY_DIR, ".seeded");
31478
- const hasStandard = (0, import_node_fs48.existsSync)(STANDARD_FILE);
31479
- const alreadyTried = (0, import_node_fs48.existsSync)(seedMarker);
31824
+ const hasStandard = (0, import_node_fs49.existsSync)(STANDARD_FILE);
31825
+ const alreadyTried = (0, import_node_fs49.existsSync)(seedMarker);
31480
31826
  if (hasStandard && !alreadyTried) {
31481
31827
  const preManifest = await buildManifest();
31482
31828
  if (preManifest.nodes.length === 0) {
@@ -31489,7 +31835,7 @@ async function memoryManifest(run4) {
31489
31835
  dryRun: false
31490
31836
  });
31491
31837
  if (seedResult.created > 0 || seedResult.existing > 0) {
31492
- (0, import_node_fs48.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created} existing=${seedResult.existing}
31838
+ (0, import_node_fs49.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created} existing=${seedResult.existing}
31493
31839
  `);
31494
31840
  if (seedResult.created > 0) {
31495
31841
  autoSeedNotice = `Seeded ${seedResult.created} knowledge node(s) from your existing Standard (one-time).`;
@@ -31500,7 +31846,7 @@ async function memoryManifest(run4) {
31500
31846
  failed: seedResult.failed
31501
31847
  });
31502
31848
  } else if (seedResult.skipped === "already_seeded") {
31503
- (0, import_node_fs48.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
31849
+ (0, import_node_fs49.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
31504
31850
  `);
31505
31851
  } else {
31506
31852
  logEvent("auto_seed_noop", {
@@ -31688,8 +32034,24 @@ async function workingMemory(run4) {
31688
32034
  Object.assign(run4, { incrementReport, memory: memory2, memorySession, reachability });
31689
32035
  }
31690
32036
 
32037
+ // src/lib/payload-bounds.ts
32038
+ var MAX_WIRE_PATHS = 500;
32039
+ function boundPaths(paths, first, max = MAX_WIRE_PATHS) {
32040
+ if (paths.length <= max) return [...paths];
32041
+ const present = new Set(paths);
32042
+ const kept = /* @__PURE__ */ new Set();
32043
+ const out2 = [];
32044
+ for (const p of [...first, ...paths]) {
32045
+ if (out2.length >= max) break;
32046
+ if (!present.has(p) || kept.has(p)) continue;
32047
+ kept.add(p);
32048
+ out2.push(p);
32049
+ }
32050
+ return out2;
32051
+ }
32052
+
31691
32053
  // src/lib/note-budget.ts
31692
- var import_node_fs49 = require("node:fs");
32054
+ var import_node_fs50 = require("node:fs");
31693
32055
  var ADVISORY_BUDGET = { PASS: 1, WARN: 2 };
31694
32056
  var EPISODE_STALE_SECONDS = 30 * 60;
31695
32057
  var FRESH = { delivered: 0, tasksCompleted: 0, ts: 0 };
@@ -31711,9 +32073,9 @@ function advisoryBudgetSpent(episode, rawDecision) {
31711
32073
  }
31712
32074
  function readAdvisoryEpisode(sessionId) {
31713
32075
  const file = scopedFile(ADVISORY_EPISODE_FILE, sessionId);
31714
- if (!(0, import_node_fs49.existsSync)(file)) return null;
32076
+ if (!(0, import_node_fs50.existsSync)(file)) return null;
31715
32077
  try {
31716
- const o = JSON.parse((0, import_node_fs49.readFileSync)(file, "utf-8")) ?? {};
32078
+ const o = JSON.parse((0, import_node_fs50.readFileSync)(file, "utf-8")) ?? {};
31717
32079
  const delivered = typeof o.delivered === "number" ? o.delivered : NaN;
31718
32080
  if (isNaN(delivered)) return null;
31719
32081
  return {
@@ -31727,8 +32089,8 @@ function readAdvisoryEpisode(sessionId) {
31727
32089
  }
31728
32090
  function writeAdvisoryEpisode(episode, sessionId) {
31729
32091
  try {
31730
- (0, import_node_fs49.mkdirSync)(VERITY_DIR, { recursive: true });
31731
- (0, import_node_fs49.writeFileSync)(
32092
+ (0, import_node_fs50.mkdirSync)(VERITY_DIR, { recursive: true });
32093
+ (0, import_node_fs50.writeFileSync)(
31732
32094
  scopedFile(ADVISORY_EPISODE_FILE, sessionId),
31733
32095
  JSON.stringify({ v: 1, ...episode })
31734
32096
  );
@@ -31802,6 +32164,7 @@ async function buildRequest(run4) {
31802
32164
  (conversation?.prompts?.length ?? 0) > 0
31803
32165
  );
31804
32166
  const noteConfirmation = peekNoteOutcome();
32167
+ const unobserved = foldResult?.unobserved ?? [];
31805
32168
  const excludedByReason = {};
31806
32169
  for (const e of codeDelta.excluded ?? []) {
31807
32170
  excludedByReason[e.reason] = (excludedByReason[e.reason] ?? 0) + 1;
@@ -31846,7 +32209,9 @@ async function buildRequest(run4) {
31846
32209
  coverage_telemetry: coverageTelemetry,
31847
32210
  static_results: staticResults,
31848
32211
  code_delta: codeDelta,
31849
- changed_files: allForReview,
32212
+ // Bounded, reviewed paths first — the server applies the same bound. The
32213
+ // full count is `coverage_telemetry.for_review`. VRT-242.
32214
+ changed_files: boundPaths(allForReview, codeDelta.files.map((f) => f.path)),
31850
32215
  standard_version: "latest",
31851
32216
  analysis_mode: analysisMode,
31852
32217
  plan_only: analysisMode === "plan",
@@ -31897,7 +32262,9 @@ async function buildRequest(run4) {
31897
32262
  // `hash_at_last_verdict` is frozen at each verdict and `hash_now` tracks
31898
32263
  // disk, so their inequality IS "changed since we last spoke".
31899
32264
  authored_since_verdict: memorySession ? foldDossier(memorySession.d).authored_all.filter((a) => a.hash_now !== a.hash_at_last_verdict).map((a) => a.path) : [],
31900
- unobserved: foldResult?.unobserved ?? [],
32265
+ // The server reads only how many; a bulk change sent every path. VRT-242.
32266
+ unobserved: unobserved.slice(0, MAX_WIRE_PATHS),
32267
+ ...unobserved.length > MAX_WIRE_PATHS && { unobserved_total: unobserved.length },
31901
32268
  commands: foldResult?.commands ?? [],
31902
32269
  tools: foldResult?.tools ?? [],
31903
32270
  tasks: foldResult?.tasks ?? [],
@@ -32060,14 +32427,14 @@ async function buildRequest(run4) {
32060
32427
  }
32061
32428
 
32062
32429
  // src/lib/offline.ts
32063
- var import_node_fs50 = require("node:fs");
32064
- var import_node_crypto13 = require("node:crypto");
32430
+ var import_node_fs51 = require("node:fs");
32431
+ var import_node_crypto14 = require("node:crypto");
32065
32432
  function cacheRequest(body2) {
32066
32433
  try {
32067
- (0, import_node_fs50.mkdirSync)(CACHE_DIR, { recursive: true });
32068
- const suffix = (0, import_node_crypto13.randomBytes)(4).toString("hex");
32434
+ (0, import_node_fs51.mkdirSync)(CACHE_DIR, { recursive: true });
32435
+ const suffix = (0, import_node_crypto14.randomBytes)(4).toString("hex");
32069
32436
  const filename = `pending-${Math.floor(Date.now() / 1e3)}-${suffix}.json`;
32070
- (0, import_node_fs50.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(redactRequest(body2)));
32437
+ (0, import_node_fs51.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(redactRequest(body2)));
32071
32438
  } catch {
32072
32439
  }
32073
32440
  }
@@ -32108,8 +32475,10 @@ function buildOfflineFallback(reason, staticResults) {
32108
32475
  }
32109
32476
 
32110
32477
  // src/lib/retry.ts
32478
+ var WORKER_RESOURCE_LIMIT = 546;
32111
32479
  function shouldWarmRetryAnalyze(result) {
32112
32480
  if (result.ok) return false;
32481
+ if (result.http_status === WORKER_RESOURCE_LIMIT) return false;
32113
32482
  if (result.category === "network" || result.category === "timeout") return true;
32114
32483
  if (result.category === "http_5xx") return true;
32115
32484
  if (result.category === "invalid_json" && (result.http_status ?? 0) >= 500) return true;
@@ -32119,7 +32488,7 @@ function shouldWarmRetryAnalyze(result) {
32119
32488
  // src/commands/analyze/phases/12-transmit.ts
32120
32489
  async function transmit(run4) {
32121
32490
  const { globals } = run4;
32122
- const { codeDelta, requestBody, serviceUrl, staticResults, token } = run4;
32491
+ const { requestBody, serviceUrl, staticResults, token } = run4;
32123
32492
  const ANALYZE_TIMEOUT_MS = 1e5;
32124
32493
  let result = await analyzeRequest({
32125
32494
  serviceUrl,
@@ -32156,11 +32525,12 @@ async function transmit(run4) {
32156
32525
  }
32157
32526
  if (!result.ok) {
32158
32527
  cacheRequest(requestBody);
32528
+ const sentKb = () => Math.round(Buffer.byteLength(JSON.stringify(requestBody)) / 1024);
32159
32529
  let message;
32160
32530
  if (result.http_status === 413) {
32161
- const totalBytes = codeDelta.files.reduce((sum, f) => sum + f.content.length, 0);
32162
- const kb = Math.round(totalBytes / 1024);
32163
- message = `Verity: request rejected \u2014 payload too large (${kb}KB over the 190KB cap). Commit or stash pre-existing changes, or run with --mode skip if you didn't intend to submit code this turn.`;
32531
+ message = `Verity: request rejected \u2014 payload too large (${sentKb()} KB sent: ${result.error}). Commit or stash pre-existing changes, or run with --mode skip if you didn't intend to submit code this turn.`;
32532
+ } else if (result.http_status === WORKER_RESOURCE_LIMIT) {
32533
+ message = `Verity: the service ran out of CPU or memory on this request (HTTP 546, ${sentKb()} KB sent). This is not a cold start: the same change fails the same way, so it was not retried. Commit or stash unrelated changes to shrink the request (local analysis this run).`;
32164
32534
  } else if (result.category === "network" || result.category === "timeout") {
32165
32535
  message = `Verity offline \u2014 ${result.error}`;
32166
32536
  } else if (result.error.startsWith("STALE_VERIFICATION")) {
@@ -32186,7 +32556,7 @@ async function transmit(run4) {
32186
32556
  }
32187
32557
 
32188
32558
  // src/commands/analyze/phases/13-reconcile.ts
32189
- var import_node_fs51 = require("node:fs");
32559
+ var import_node_fs52 = require("node:fs");
32190
32560
  var import_node_path39 = require("node:path");
32191
32561
  async function reconcile(run4) {
32192
32562
  const { actionSummary, allChanged, analyzable, baseline, baselineSessionId, codeDelta, contentHash, conversation, decision, foldResult, memory: memory2, memorySession, response, reviewable, securityFiles, turnId } = run4;
@@ -32216,7 +32586,7 @@ async function reconcile(run4) {
32216
32586
  const st = foldDossier(memorySession.d);
32217
32587
  openElsewhere = openBlockingElsewhere(st.statements, sentPaths, (file, line2) => {
32218
32588
  try {
32219
- const src = (0, import_node_fs51.readFileSync)((0, import_node_path39.join)(repoRoot(), file), "utf8").split("\n");
32589
+ const src = (0, import_node_fs52.readFileSync)((0, import_node_path39.join)(repoRoot(), file), "utf8").split("\n");
32220
32590
  const at = src[line2 - 1];
32221
32591
  return at === void 0 ? null : lineSha(at);
32222
32592
  } catch {
@@ -33038,7 +33408,7 @@ function registerAnalyzeCommand(program2) {
33038
33408
  var tracing = () => process.env.VERITY_TRACE_PHASES === "1";
33039
33409
  async function runAnalyze(opts, globals) {
33040
33410
  if (!verityConfigured()) {
33041
- (0, import_node_fs52.writeSync)(2, '[verity] not set up in this project \u2014 run "verity init" first.\n');
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');
33042
33412
  process.exit(0);
33043
33413
  }
33044
33414
  const run4 = createRun(opts, globals);
@@ -33059,11 +33429,12 @@ async function runAnalyze(opts, globals) {
33059
33429
  }
33060
33430
 
33061
33431
  // src/commands/baseline.ts
33062
- var import_node_fs54 = require("node:fs");
33432
+ var import_node_fs55 = require("node:fs");
33433
+ var import_node_path42 = require("node:path");
33063
33434
 
33064
33435
  // src/lib/project-skills.ts
33065
- var import_node_fs53 = require("node:fs");
33066
- var import_node_path40 = require("node:path");
33436
+ var import_node_fs54 = require("node:fs");
33437
+ var import_node_path41 = require("node:path");
33067
33438
  var PROJECT_SKILL_NAMES = [
33068
33439
  "verity-setup",
33069
33440
  "verity-analyze",
@@ -33089,14 +33460,14 @@ var LEGACY_SKILL_NAMES = [
33089
33460
  var ALL = [...PROJECT_SKILL_NAMES, ...LEGACY_SKILL_NAMES];
33090
33461
  function staleProjectSkills() {
33091
33462
  const root = projectPath(".claude/skills");
33092
- if (!(0, import_node_fs53.existsSync)(root)) return [];
33093
- return ALL.filter((name2) => (0, import_node_fs53.existsSync)((0, import_node_path40.join)(root, name2)));
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)));
33094
33465
  }
33095
33466
  function removeProjectSkills() {
33096
33467
  const root = projectPath(".claude/skills");
33097
33468
  const removed = [];
33098
33469
  for (const name2 of staleProjectSkills()) {
33099
- (0, import_node_fs53.rmSync)((0, import_node_path40.join)(root, name2), { recursive: true, force: true });
33470
+ (0, import_node_fs54.rmSync)((0, import_node_path41.join)(root, name2), { recursive: true, force: true });
33100
33471
  removed.push(name2);
33101
33472
  }
33102
33473
  return removed;
@@ -33129,6 +33500,7 @@ function registerBaselineCommands(program2) {
33129
33500
  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;
33130
33501
  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;
33131
33502
  if (!verityConfigured()) {
33503
+ if (isMachineStore((0, import_node_path42.join)(repoRoot(), VERITY_DIR))) process.exit(0);
33132
33504
  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.";
33133
33505
  const lines = [
33134
33506
  `Verity is installed but this project is not set up yet, so the quality gate will not review anything here. ${how}`
@@ -33161,13 +33533,13 @@ function registerBaselineCommands(program2) {
33161
33533
  let memoryMsg = null;
33162
33534
  let memoryAgentLine = null;
33163
33535
  const memoryNotice = projectPath(`${VERITY_DIR}/.memory-fence-notice`);
33164
- if (realStart && !(0, import_node_fs54.existsSync)(memoryNotice)) {
33536
+ if (realStart && !(0, import_node_fs55.existsSync)(memoryNotice)) {
33165
33537
  const trackedGraph = memoryOptOut() ? 0 : committedMemoryFiles().length;
33166
33538
  if (trackedGraph > 0) {
33167
33539
  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.`;
33168
33540
  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.`;
33169
33541
  try {
33170
- (0, import_node_fs54.writeFileSync)(memoryNotice, (/* @__PURE__ */ new Date()).toISOString() + "\n");
33542
+ (0, import_node_fs55.writeFileSync)(memoryNotice, (/* @__PURE__ */ new Date()).toISOString() + "\n");
33171
33543
  } catch {
33172
33544
  }
33173
33545
  }
@@ -33268,10 +33640,16 @@ function hookSource(value) {
33268
33640
  }
33269
33641
 
33270
33642
  // src/commands/review.ts
33271
- var import_node_fs55 = require("node:fs");
33643
+ var import_node_fs56 = require("node:fs");
33272
33644
  function registerReviewCommand(program2) {
33273
- program2.command("review").description("Run on-demand Verity analysis (advisory, never blocks)").requiredOption("--files <paths>", "Comma-separated file list").option("--changed <paths>", "Subset of --files that were modified").option("--intent <text>", "User intent description (max 2000 chars)").option("--specs <paths>", "Comma-separated spec file paths").option("--json", "Output raw JSON response").action(async (opts) => {
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) => {
33274
33646
  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;
33275
33653
  try {
33276
33654
  await runReview(opts, globals);
33277
33655
  } catch (err2) {
@@ -33285,7 +33663,7 @@ async function runReview(opts, globals) {
33285
33663
  const changedFiles = opts.changed ? opts.changed.split(",").map((f) => f.trim()).filter(Boolean) : allFiles;
33286
33664
  const analyzable = filterAnalyzable(allFiles);
33287
33665
  const securityFiles = filterSecurity(allFiles);
33288
- const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs55.existsSync)(f) || resolveFile(f) !== null);
33666
+ const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs56.existsSync)(f) || resolveFile(f) !== null);
33289
33667
  const staticResults = runCodacyAnalysisIfAvailable(scannable);
33290
33668
  const codeDelta = collectCodeDelta(allFiles);
33291
33669
  const tokenResult = await resolveToken(globals.token);
@@ -33351,19 +33729,40 @@ async function runReview(opts, globals) {
33351
33729
  }
33352
33730
 
33353
33731
  // src/commands/guard.ts
33354
- var import_node_fs59 = require("node:fs");
33355
- var import_node_path45 = require("node:path");
33732
+ var import_node_fs61 = require("node:fs");
33733
+ var import_node_path48 = require("node:path");
33356
33734
 
33357
- // src/lib/terminal-text.ts
33358
- var CONTROL = /[\x00-\x08\x0b-\x1f\x7f-\x9f\u061c\u200e\u200f\u2028-\u202e\u2066-\u2069]/g;
33359
- function terminalText(value, max = 4e3) {
33360
- if (typeof value !== "string") return "";
33361
- const clean2 = value.replace(CONTROL, "");
33362
- return clean2.length > max ? `${clean2.slice(0, max - 1)}\u2026` : clean2;
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
+ }
33363
33745
  }
33364
- function terminalUrl(value) {
33365
- const clean2 = terminalText(value, 2e3);
33366
- return /^https?:\/\/\S+$/.test(clean2) ? clean2 : "";
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
+ }
33756
+ }
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 };
33367
33766
  }
33368
33767
 
33369
33768
  // src/lib/agent-driver.ts
@@ -33445,7 +33844,7 @@ async function runAgentReview(options) {
33445
33844
  }
33446
33845
  if (!settled) {
33447
33846
  const wait = Math.max(0, remaining() - FINISH_TIMEOUT_MS);
33448
- await Promise.race([oneShotDone, new Promise((resolve8) => setTimeout(resolve8, wait))]);
33847
+ await Promise.race([oneShotDone, new Promise((resolve9) => setTimeout(resolve9, wait))]);
33449
33848
  }
33450
33849
  const finished = await options.http.post(
33451
33850
  "/agent-review/finish",
@@ -33460,8 +33859,8 @@ async function runAgentReview(options) {
33460
33859
  }
33461
33860
 
33462
33861
  // src/lib/prove/auto.ts
33463
- var import_node_path44 = require("node:path");
33464
- var import_node_crypto18 = require("node:crypto");
33862
+ var import_node_path47 = require("node:path");
33863
+ var import_node_crypto19 = require("node:crypto");
33465
33864
 
33466
33865
  // src/lib/prove/signals.ts
33467
33866
  var DEFAULT_SINCE = "180 days ago";
@@ -33869,6 +34268,11 @@ async function rankViaServer(candidates2, ctx, auth2) {
33869
34268
  cmd: "prove-rank"
33870
34269
  });
33871
34270
  if (!res.ok) return { ok: false, ranker: "luna", error: res.error, ranked: fallback };
34271
+ const off = res.data;
34272
+ if (off?.enabled === false) {
34273
+ const why = typeof off.reason === "string" ? off.reason.slice(0, 40) : "disabled";
34274
+ return { ok: false, ranker: "luna", error: `formal is off for this project (${why})`, ranked: fallback, disabled: why };
34275
+ }
33872
34276
  const items = Array.isArray(res.data?.items) ? res.data.items : [];
33873
34277
  return { ok: true, ranker: "luna", ranked: applyAnnotations(candidates2, items), costUsd: typeof res.data?.cost_usd === "number" ? res.data.cost_usd : null };
33874
34278
  }
@@ -34593,6 +34997,8 @@ async function generateModel(target, opts) {
34593
34997
  });
34594
34998
  if (!res.ok) return { ok: false, error: res.error };
34595
34999
  const d = res.data ?? {};
35000
+ const off = d;
35001
+ if (off.enabled === false) return { ok: false, error: `formal is off for this project (${typeof off.reason === "string" ? off.reason.slice(0, 40) : "disabled"})` };
34596
35002
  if (d.error && typeof d.error === "object") return { ok: false, error: `${d.error.code ?? "SERVICE_ERROR"}: ${d.error.message ?? "the service failed"}` };
34597
35003
  const usage2 = d.usage && typeof d.usage === "object" ? { inputTokens: Number(d.usage.inputTokens ?? 0), outputTokens: Number(d.usage.outputTokens ?? 0) } : null;
34598
35004
  return acceptAnswer(d, usage2, typeof d.cost_usd === "number" ? d.cost_usd : null);
@@ -34772,8 +35178,7 @@ Rules:
34772
35178
  5. Write the harness as ONE file and run it in the SAME shell call that writes it (a heredoc followed by the run). TypeScript: node --experimental-strip-types harness.ts (detect runtimes only if that fails: node --version, python3 --version); if strip-types is unavailable, remove type annotations ONLY on lines that are not part of the function under test's logic, and say so. Python: python3 harness.py.
34773
35179
  6. Nothing you run can reach the network. Do not try.
34774
35180
  7. Keep it under about eight shell calls. Output tokens are time.
34775
- 8. Answer with the JSON object only: verdict (reproduced | diverged | unreplayable), reason (2-4 sentences: what you ran, what the real code did, and how that compares to the trace's final state), harness_files (every file you wrote: path and its line count \u2014 do NOT paste contents, your shell calls already carry them), executed_output (the last relevant stdout, at most 2000 characters), impact (one word, below).
34776
- 9. impact \u2014 AFTER the verdict, and never a reason to change it: what the violation you ran costs a user of this code, the most serious one the run showed. money: a balance, charge, refund, price or stock is wrong. access: someone gets access they should not have, or an auth check is bypassed. data: a user's records are lost, corrupted or wrongly duplicated. external: an effect outside the system happens twice or never (a charge, an email, a shipment, a webhook). count: a counter, metric or statistic is off. cache: a cached or derived value is stale until it refreshes. internal: the program's own bookkeeping is off, with no effect a user would see. none: the verdict is not reproduced.
35181
+ 8. Answer with the JSON object only: verdict (reproduced | diverged | unreplayable), reason (2-4 sentences: what you ran, what the real code did, and how that compares to the trace's final state), harness_files (every file you wrote: path and its line count \u2014 do NOT paste contents, your shell calls already carry them), executed_output (the last relevant stdout, at most 2000 characters).
34777
35182
 
34778
35183
  "reproduced" means the real code, driven by the trace, reached the property violation the model describes. "diverged" means it did not \u2014 the model is wrong about the code, which is a useful answer. "unreplayable" means you could not run the real function faithfully; say why.`;
34779
35184
  var REPLAY_SCHEMA = {
@@ -34791,10 +35196,9 @@ var REPLAY_SCHEMA = {
34791
35196
  required: ["path", "lines"]
34792
35197
  }
34793
35198
  },
34794
- executed_output: { type: "string" },
34795
- impact: { type: "string", enum: ["money", "access", "data", "external", "count", "cache", "internal", "none"] }
35199
+ executed_output: { type: "string" }
34796
35200
  },
34797
- required: ["verdict", "reason", "harness_files", "executed_output", "impact"]
35201
+ required: ["verdict", "reason", "harness_files", "executed_output"]
34798
35202
  };
34799
35203
  function renderBriefInput(brief) {
34800
35204
  const p = brief.property;
@@ -34821,8 +35225,6 @@ function renderBriefInput(brief) {
34821
35225
  }
34822
35226
  return parts2.join("\n");
34823
35227
  }
34824
- var IMPACTS = ["money", "access", "data", "external", "count", "cache", "internal", "none"];
34825
- var isImpact = (v) => typeof v === "string" && IMPACTS.includes(v);
34826
35228
  function stringsIn(value, out2 = [], depth = 0) {
34827
35229
  if (depth > 8) return out2;
34828
35230
  if (typeof value === "string") out2.push(value);
@@ -34864,8 +35266,7 @@ function parseReplayOutput(output) {
34864
35266
  verdict,
34865
35267
  reason: typeof o.reason === "string" ? o.reason.slice(0, 2e3) : "",
34866
35268
  harness_files: Array.isArray(o.harness_files) ? o.harness_files.filter((f) => typeof f.path === "string").map((f) => ({ path: String(f.path).slice(0, 200), lines: Number.isInteger(f.lines) ? f.lines : 0 })) : [],
34867
- executed_output: typeof o.executed_output === "string" ? o.executed_output.slice(0, 2e3) : "",
34868
- impact: isImpact(o.impact) ? o.impact : "none"
35269
+ executed_output: typeof o.executed_output === "string" ? o.executed_output.slice(0, 2e3) : ""
34869
35270
  };
34870
35271
  }
34871
35272
  } catch {
@@ -34873,10 +35274,10 @@ function parseReplayOutput(output) {
34873
35274
  }
34874
35275
  return { claim, shellCalls, executedCalls, shellTexts, outputTexts };
34875
35276
  }
34876
- var RESULT_LINE = /REPLAY_RESULT=(reproduced|diverged)\b/;
35277
+ var RESULT_LINE = /REPLAY_RESULT=(reproduced|diverged)\b/g;
34877
35278
  function printedResult(outputTexts) {
34878
35279
  let last = null;
34879
- for (const t of outputTexts) for (const m of t.matchAll(new RegExp(RESULT_LINE.source, "g"))) last = m[1];
35280
+ for (const t of outputTexts) for (const m of t.matchAll(RESULT_LINE)) last = m[1];
34880
35281
  return last;
34881
35282
  }
34882
35283
  var RESULT_MISSING = "the harness never printed REPLAY_RESULT=reproduced on its own stdout \u2014 the verdict was the model's word, not the run's";
@@ -35066,7 +35467,6 @@ async function runReplayInContainer(brief, opts) {
35066
35467
  ...judged,
35067
35468
  executedCalls,
35068
35469
  shellCalls,
35069
- ...judged.verdict === "reproduced" && parsed.claim ? { impact: parsed.claim.impact } : {},
35070
35470
  executedOutput: parsed.claim?.executed_output ?? "",
35071
35471
  harnessFiles: parsed.claim?.harness_files ?? [],
35072
35472
  usage,
@@ -35113,6 +35513,11 @@ async function runReplayViaServer(brief, auth2, budgetMs = 24e4) {
35113
35513
  return { claimed: null, verdict: "unverified", reason: "", downgrade: res.error, executedCalls: 0, shellCalls: 0, verbatim: none, executedOutput: "", harnessFiles: [], usage: null, durationMs: Date.now() - started, containerId: null, error: res.error };
35114
35514
  }
35115
35515
  const d = res.data ?? {};
35516
+ if (d.enabled === false) {
35517
+ const why = d.reason;
35518
+ const msg = `formal is off for this project (${typeof why === "string" ? why.slice(0, 40) : "disabled"})`;
35519
+ return { claimed: null, verdict: "unverified", reason: "", downgrade: msg, executedCalls: 0, shellCalls: 0, verbatim: none, executedOutput: "", harnessFiles: [], usage: null, durationMs: Date.now() - started, containerId: null, error: msg };
35520
+ }
35116
35521
  if (d.error && typeof d.error === "object") {
35117
35522
  const e = d.error;
35118
35523
  const msg = `${e.code ?? "SERVICE_ERROR"}: ${e.message ?? "the service failed"}`;
@@ -35125,7 +35530,6 @@ async function runReplayViaServer(brief, auth2, budgetMs = 24e4) {
35125
35530
  verdict: verdict === "reproduced" || verdict === "diverged" || verdict === "unreplayable" ? verdict : "unverified",
35126
35531
  reason: typeof d.reason === "string" ? d.reason : "",
35127
35532
  downgrade: typeof d.downgrade === "string" ? d.downgrade : null,
35128
- ...isImpact(d.impact) ? { impact: d.impact } : {},
35129
35533
  executedCalls: Number(d.executed_calls ?? 0),
35130
35534
  shellCalls: Number(d.shell_calls ?? 0),
35131
35535
  verbatim: { covered: Number(v.covered ?? 0), total: Number(v.total ?? 0), ratio: Number(v.ratio ?? 0), basis: v.basis === "symbol" || v.basis === "file" ? v.basis : "none" },
@@ -35182,18 +35586,18 @@ function renderReplay(model, property, r) {
35182
35586
  // src/lib/prove/runner.ts
35183
35587
  var import_node_child_process15 = require("node:child_process");
35184
35588
  var import_node_os8 = require("node:os");
35185
- var import_node_fs58 = require("node:fs");
35589
+ var import_node_fs60 = require("node:fs");
35186
35590
  var import_node_os9 = require("node:os");
35187
- var import_node_path43 = require("node:path");
35591
+ var import_node_path46 = require("node:path");
35188
35592
 
35189
35593
  // src/lib/prove/scaffold.ts
35190
- var import_node_fs57 = require("node:fs");
35191
- var import_node_path42 = require("node:path");
35594
+ var import_node_fs59 = require("node:fs");
35595
+ var import_node_path45 = require("node:path");
35192
35596
 
35193
35597
  // src/lib/prove/safe-write.ts
35194
- var import_node_fs56 = require("node:fs");
35195
- var import_node_crypto14 = require("node:crypto");
35196
- var import_node_path41 = require("node:path");
35598
+ var import_node_fs58 = require("node:fs");
35599
+ var import_node_crypto15 = require("node:crypto");
35600
+ var import_node_path44 = require("node:path");
35197
35601
  var SafeWriteError = class extends Error {
35198
35602
  constructor(reason, path) {
35199
35603
  super(`refusing to write ${path}: ${reason}`);
@@ -35202,10 +35606,10 @@ var SafeWriteError = class extends Error {
35202
35606
  this.name = "SafeWriteError";
35203
35607
  }
35204
35608
  };
35205
- var FLAGS3 = import_node_fs56.constants;
35609
+ var FLAGS3 = import_node_fs58.constants;
35206
35610
  var NOFOLLOW2 = FLAGS3.O_NOFOLLOW ?? 0;
35207
35611
  function assertPlainRelative(rel) {
35208
- if (!rel || (0, import_node_path41.isAbsolute)(rel)) throw new SafeWriteError("bad-path", rel);
35612
+ if (!rel || (0, import_node_path44.isAbsolute)(rel)) throw new SafeWriteError("bad-path", rel);
35209
35613
  for (const part of rel.split(/[\\/]/)) {
35210
35614
  if (part === ".." || part === "" || part === ".") throw new SafeWriteError("bad-path", rel);
35211
35615
  }
@@ -35214,34 +35618,34 @@ function ensureDirsNoFollow(root, rel) {
35214
35618
  const parts2 = rel.split(/[\\/]/);
35215
35619
  let cur = root;
35216
35620
  for (const part of parts2.slice(0, -1)) {
35217
- cur = (0, import_node_path41.join)(cur, part);
35621
+ cur = (0, import_node_path44.join)(cur, part);
35218
35622
  let st;
35219
35623
  try {
35220
- st = (0, import_node_fs56.lstatSync)(cur);
35624
+ st = (0, import_node_fs58.lstatSync)(cur);
35221
35625
  } catch {
35222
- (0, import_node_fs56.mkdirSync)(cur);
35626
+ (0, import_node_fs58.mkdirSync)(cur);
35223
35627
  continue;
35224
35628
  }
35225
35629
  if (st.isSymbolicLink()) throw new SafeWriteError("symlink", cur);
35226
35630
  if (!st.isDirectory()) throw new SafeWriteError("not-regular", cur);
35227
35631
  }
35228
- return (0, import_node_path41.join)(root, rel);
35632
+ return (0, import_node_path44.join)(root, rel);
35229
35633
  }
35230
35634
  function insideRoot(realRoot, realPath) {
35231
- return realPath === realRoot || realPath.startsWith(realRoot.endsWith(import_node_path41.sep) ? realRoot : realRoot + import_node_path41.sep);
35635
+ return realPath === realRoot || realPath.startsWith(realRoot.endsWith(import_node_path44.sep) ? realRoot : realRoot + import_node_path44.sep);
35232
35636
  }
35233
35637
  function removeQuietly(path) {
35234
35638
  try {
35235
- (0, import_node_fs56.unlinkSync)(path);
35639
+ (0, import_node_fs58.unlinkSync)(path);
35236
35640
  } catch {
35237
35641
  }
35238
35642
  }
35239
35643
  function writeFileInRootNoFollow(root, rel, content) {
35240
35644
  assertPlainRelative(rel);
35241
35645
  const dest = ensureDirsNoFollow(root, rel);
35242
- const dir = (0, import_node_path41.dirname)(dest);
35646
+ const dir = (0, import_node_path44.dirname)(dest);
35243
35647
  try {
35244
- const st = (0, import_node_fs56.lstatSync)(dest);
35648
+ const st = (0, import_node_fs58.lstatSync)(dest);
35245
35649
  if (st.isSymbolicLink()) throw new SafeWriteError("symlink", dest);
35246
35650
  if (!st.isFile()) throw new SafeWriteError("not-regular", dest);
35247
35651
  } catch (err2) {
@@ -35249,41 +35653,41 @@ function writeFileInRootNoFollow(root, rel, content) {
35249
35653
  }
35250
35654
  let realRoot;
35251
35655
  try {
35252
- realRoot = (0, import_node_fs56.realpathSync)(root);
35656
+ realRoot = (0, import_node_fs58.realpathSync)(root);
35253
35657
  } catch {
35254
35658
  throw new SafeWriteError("unwritable", root);
35255
35659
  }
35256
- const tmp = (0, import_node_path41.join)(dir, `.${(0, import_node_path41.basename)(dest)}.${(0, import_node_crypto14.randomBytes)(6).toString("hex")}.tmp`);
35660
+ const tmp = (0, import_node_path44.join)(dir, `.${(0, import_node_path44.basename)(dest)}.${(0, import_node_crypto15.randomBytes)(6).toString("hex")}.tmp`);
35257
35661
  let fd;
35258
35662
  try {
35259
- 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);
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);
35260
35664
  } catch {
35261
35665
  throw new SafeWriteError("unwritable", tmp);
35262
35666
  }
35263
35667
  try {
35264
- const opened = (0, import_node_fs56.fstatSync)(fd, { bigint: true });
35668
+ const opened = (0, import_node_fs58.fstatSync)(fd, { bigint: true });
35265
35669
  let realTmp;
35266
35670
  try {
35267
- realTmp = (0, import_node_fs56.realpathSync)(tmp);
35671
+ realTmp = (0, import_node_fs58.realpathSync)(tmp);
35268
35672
  } catch {
35269
35673
  throw new SafeWriteError("escaped", tmp);
35270
35674
  }
35271
- const there = (0, import_node_fs56.lstatSync)(realTmp, { bigint: true });
35675
+ const there = (0, import_node_fs58.lstatSync)(realTmp, { bigint: true });
35272
35676
  if (!opened.isFile() || there.ino !== opened.ino || there.dev !== opened.dev || !insideRoot(realRoot, realTmp)) {
35273
35677
  throw new SafeWriteError("escaped", tmp);
35274
35678
  }
35275
35679
  const buf = Buffer.from(content, "utf-8");
35276
35680
  let off = 0;
35277
- while (off < buf.length) off += (0, import_node_fs56.writeSync)(fd, buf, off, buf.length - off);
35681
+ while (off < buf.length) off += (0, import_node_fs58.writeSync)(fd, buf, off, buf.length - off);
35278
35682
  } catch (err2) {
35279
- (0, import_node_fs56.closeSync)(fd);
35683
+ (0, import_node_fs58.closeSync)(fd);
35280
35684
  removeQuietly(tmp);
35281
35685
  throw err2 instanceof SafeWriteError ? err2 : new SafeWriteError("unwritable", tmp);
35282
35686
  }
35283
- (0, import_node_fs56.closeSync)(fd);
35687
+ (0, import_node_fs58.closeSync)(fd);
35284
35688
  try {
35285
- if (!insideRoot(realRoot, (0, import_node_fs56.realpathSync)(dir)) || (0, import_node_fs56.lstatSync)(dir).isSymbolicLink()) throw new SafeWriteError("escaped", dir);
35286
- (0, import_node_fs56.renameSync)(tmp, dest);
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);
35287
35691
  } catch (err2) {
35288
35692
  removeQuietly(tmp);
35289
35693
  throw err2 instanceof SafeWriteError ? err2 : new SafeWriteError("unwritable", dest);
@@ -35297,9 +35701,9 @@ function pathHasNoLink(root, rel) {
35297
35701
  }
35298
35702
  let cur = root;
35299
35703
  for (const part of rel.split(/[\\/]/)) {
35300
- cur = cur + import_node_path41.sep + part;
35704
+ cur = cur + import_node_path44.sep + part;
35301
35705
  try {
35302
- if ((0, import_node_fs56.lstatSync)(cur).isSymbolicLink()) return false;
35706
+ if ((0, import_node_fs58.lstatSync)(cur).isSymbolicLink()) return false;
35303
35707
  } catch {
35304
35708
  return true;
35305
35709
  }
@@ -35609,20 +36013,20 @@ This directory is machine-local and gitignored (see ../.gitignore). Models are
35609
36013
  never committed; what reaches the team is the bug report and the fix.
35610
36014
  `;
35611
36015
  function scaffoldProofs(root) {
35612
- const proofsDir = (0, import_node_path42.join)(root, PROOFS_DIR);
36016
+ const proofsDir = (0, import_node_path45.join)(root, PROOFS_DIR);
35613
36017
  const written = [];
35614
36018
  const kept = [];
35615
36019
  for (const stray of ["lakefile.lean"]) {
35616
36020
  const rel = `${PROOFS_DIR}/${stray}`;
35617
- if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
36021
+ if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path45.join)(root, rel));
35618
36022
  try {
35619
- (0, import_node_fs57.rmSync)((0, import_node_path42.join)(root, rel), { force: true });
36023
+ (0, import_node_fs59.rmSync)((0, import_node_path45.join)(root, rel), { force: true });
35620
36024
  } catch {
35621
36025
  }
35622
36026
  }
35623
36027
  for (const f of PROOFS_TEMPLATE_FILES) {
35624
36028
  const rel = `${PROOFS_DIR}/${f.path}`;
35625
- if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
36029
+ if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path45.join)(root, rel));
35626
36030
  const current = readRegularFileInRoot(root, rel, 4 * 1024 * 1024);
35627
36031
  if (current.ok && current.content === f.content) {
35628
36032
  kept.push(rel);
@@ -35635,8 +36039,8 @@ function scaffoldProofs(root) {
35635
36039
  [`${PROOFS_DIR}/.gitignore`, LOCAL_GITIGNORE],
35636
36040
  [`${MODELS_DIR}/README.md`, MODELS_README]
35637
36041
  ]) {
35638
- if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path42.join)(root, rel));
35639
- if (existsNoFollow((0, import_node_path42.join)(root, rel))) {
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))) {
35640
36044
  kept.push(rel);
35641
36045
  continue;
35642
36046
  }
@@ -35647,7 +36051,7 @@ function scaffoldProofs(root) {
35647
36051
  }
35648
36052
  function existsNoFollow(abs) {
35649
36053
  try {
35650
- (0, import_node_fs57.lstatSync)(abs);
36054
+ (0, import_node_fs59.lstatSync)(abs);
35651
36055
  return true;
35652
36056
  } catch {
35653
36057
  return false;
@@ -35655,7 +36059,7 @@ function existsNoFollow(abs) {
35655
36059
  }
35656
36060
 
35657
36061
  // src/lib/prove/report.ts
35658
- var import_node_crypto15 = require("node:crypto");
36062
+ var import_node_crypto16 = require("node:crypto");
35659
36063
  var IDENT2 = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$/;
35660
36064
  var SHA256 = /^(sha256:)?[0-9a-f]{64}$/;
35661
36065
  var KINDS2 = /* @__PURE__ */ new Set(["structural", "intent"]);
@@ -35803,7 +36207,7 @@ function sha256InRoot(root, file) {
35803
36207
  const opened = openRegularInRoot(root, file);
35804
36208
  if (!opened.ok) return null;
35805
36209
  try {
35806
- return (0, import_node_crypto15.createHash)("sha256").update(readOpened(opened.fd, opened.size)).digest("hex");
36210
+ return (0, import_node_crypto16.createHash)("sha256").update(readOpened(opened.fd, opened.size)).digest("hex");
35807
36211
  } catch {
35808
36212
  return null;
35809
36213
  }
@@ -35905,16 +36309,17 @@ function renderReport(r) {
35905
36309
 
35906
36310
  // src/lib/prove/runner.ts
35907
36311
  function verityLeanHome(env = process.env) {
35908
- return env.VERITY_LEAN_HOME ?? (0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".verity", "lean");
36312
+ return env.VERITY_LEAN_HOME ?? (0, import_node_path46.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".verity", "lean");
35909
36313
  }
35910
36314
  function findToolchain(env = process.env) {
35911
- const managedBin = (0, import_node_path43.join)(verityLeanHome(env), LEAN_TOOLCHAIN.replace(/^leanprover\/lean4:/, ""), "bin");
35912
- const elanBin = (0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "bin");
35913
- const path = [managedBin, elanBin, env.PATH ?? ""].filter(Boolean).join(import_node_path43.delimiter);
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);
35914
36320
  const merged = { ...env, PATH: path, ELAN_TOOLCHAIN: env.ELAN_TOOLCHAIN ?? LEAN_TOOLCHAIN };
35915
- 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(":", "---")));
35916
36321
  const exe = process.platform === "win32" ? "lake.exe" : "lake";
35917
- const candidates2 = [(0, import_node_path43.join)(managedBin, exe), ...elanHas ? [(0, import_node_path43.join)(elanBin, exe)] : [], exe];
36322
+ const candidates2 = [(0, import_node_path46.join)(managedBin, exe), ...elanHas ? [(0, import_node_path46.join)(elanBin, exe)] : [], exe];
35918
36323
  for (const candidate of candidates2) {
35919
36324
  try {
35920
36325
  (0, import_node_child_process15.execFileSync)(candidate, ["--version"], { env: merged, stdio: ["ignore", "pipe", "pipe"], timeout: 1e4 });
@@ -35952,7 +36357,7 @@ function run2(tc, cwd, args2, timeoutMs) {
35952
36357
  function runAsync(tc, cwd, args2, timeoutMs) {
35953
36358
  const started = Date.now();
35954
36359
  const MAX = 16 * 1024 * 1024;
35955
- return new Promise((resolve8) => {
36360
+ return new Promise((resolve9) => {
35956
36361
  const posix = (0, import_node_os8.platform)() !== "win32";
35957
36362
  const child = (0, import_node_child_process15.spawn)(tc.lake, args2, { cwd, env: tc.env, stdio: ["ignore", "pipe", "pipe"], detached: posix });
35958
36363
  let stdout = "";
@@ -35980,8 +36385,8 @@ function runAsync(tc, cwd, args2, timeoutMs) {
35980
36385
  if (settled) return;
35981
36386
  settled = true;
35982
36387
  clearTimeout(timer);
35983
- if (ok) resolve8({ ok: true, stdout, stderr: "", durationMs: Date.now() - started, timedOut: false });
35984
- else resolve8({ ok: false, stdout, stderr: stderr || message || "", durationMs: Date.now() - started, timedOut });
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 });
35985
36390
  };
35986
36391
  child.on("error", (err2) => finish(false, err2.message));
35987
36392
  child.on("close", (code) => finish(code === 0 && !timedOut));
@@ -35989,53 +36394,80 @@ function runAsync(tc, cwd, args2, timeoutMs) {
35989
36394
  }
35990
36395
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 6e4;
35991
36396
  var DEFAULT_CHECK_TIMEOUT_MS = 12e4;
36397
+ function proofsWorkspaceProblem(root) {
36398
+ for (const rel of [".verity", PROOFS_DIR, `${PROOFS_DIR}/.lake`]) {
36399
+ let st;
36400
+ try {
36401
+ st = (0, import_node_fs60.lstatSync)((0, import_node_path46.join)(root, rel));
36402
+ } catch {
36403
+ break;
36404
+ }
36405
+ if (st.isSymbolicLink()) return `${rel} is a symlink; Lean is not run through it`;
36406
+ }
36407
+ const r = runGitSync(root, ["ls-files", "-z", "--", PROOFS_DIR], { timeoutMs: 5e3 });
36408
+ if (!r.ok) return `could not confirm with git that ${PROOFS_DIR} holds no committed files; Lean is not run`;
36409
+ const tracked = r.stdout.split("\0").filter(Boolean);
36410
+ if (tracked.length > 0) {
36411
+ return `${tracked.length} file(s) under ${PROOFS_DIR} are tracked in git (e.g. ${tracked[0]}); Lean is not run on a workspace the repository supplies \u2014 untrack them with: git rm -r --cached ${PROOFS_DIR}`;
36412
+ }
36413
+ return null;
36414
+ }
36415
+ function refused(problem) {
36416
+ return { ok: false, stdout: "", stderr: problem, durationMs: 0, timedOut: false };
36417
+ }
35992
36418
  function buildLibrary(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
35993
- return run2(tc, (0, import_node_path43.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36419
+ const problem = proofsWorkspaceProblem(root);
36420
+ if (problem) return refused(problem);
36421
+ return run2(tc, (0, import_node_path46.join)(root, PROOFS_DIR), ["build"], timeoutMs);
35994
36422
  }
35995
- function buildLibraryAsync(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
35996
- return runAsync(tc, (0, import_node_path43.join)(root, PROOFS_DIR), ["build"], timeoutMs);
36423
+ async function buildLibraryAsync(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
36424
+ const problem = proofsWorkspaceProblem(root);
36425
+ if (problem) return refused(problem);
36426
+ return runAsync(tc, (0, import_node_path46.join)(root, PROOFS_DIR), ["build"], timeoutMs);
35997
36427
  }
35998
36428
  function isModelInRoot(modelsAbs, rel) {
35999
- if (!rel.endsWith(".lean") || (0, import_node_path43.isAbsolute)(rel) || rel.startsWith("..")) return false;
36429
+ if (!rel.endsWith(".lean") || (0, import_node_path46.isAbsolute)(rel) || rel.startsWith("..")) return false;
36000
36430
  return statRegularInRoot(modelsAbs, rel).ok;
36001
36431
  }
36002
36432
  function resolveModelFile(root, arg) {
36003
- const modelsAbs = (0, import_node_path43.join)(root, MODELS_DIR);
36004
- const asPath = (0, import_node_path43.relative)(modelsAbs, (0, import_node_path43.isAbsolute)(arg) ? arg : (0, import_node_path43.resolve)(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));
36005
36435
  const candidates2 = arg.includes("/") || arg.includes("\\") ? [asPath] : [arg, `${arg}.lean`];
36006
36436
  for (const rel of candidates2) {
36007
- if (isModelInRoot(modelsAbs, rel)) return (0, import_node_path43.join)(modelsAbs, rel);
36437
+ if (isModelInRoot(modelsAbs, rel)) return (0, import_node_path46.join)(modelsAbs, rel);
36008
36438
  }
36009
36439
  return null;
36010
36440
  }
36011
36441
  function listModelFiles(root) {
36012
- const modelsAbs = (0, import_node_path43.join)(root, MODELS_DIR);
36013
- if (!(0, import_node_fs58.existsSync)(modelsAbs)) return [];
36014
- return (0, import_node_fs58.readdirSync)(modelsAbs).filter((f) => isModelInRoot(modelsAbs, f)).sort().map((f) => (0, import_node_path43.join)(modelsAbs, f));
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));
36015
36445
  }
36016
36446
  function trimDiagnostics(text) {
36017
36447
  return text.split("\n").filter((l) => !l.startsWith("trace:")).join("\n").trim().slice(0, 4e3);
36018
36448
  }
36019
36449
  function checkModel(tc, root, modelFile, opts = {}) {
36020
- const proofsAbs = (0, import_node_path43.join)(root, PROOFS_DIR);
36021
- const rel = (0, import_node_path43.relative)(proofsAbs, modelFile);
36022
- const res = run2(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36450
+ const proofsAbs = (0, import_node_path46.join)(root, PROOFS_DIR);
36451
+ const rel = (0, import_node_path46.relative)(proofsAbs, modelFile);
36452
+ const problem = proofsWorkspaceProblem(root);
36453
+ const res = problem ? refused(problem) : run2(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36023
36454
  return toReport(res, root, modelFile, opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36024
36455
  }
36025
36456
  async function checkModelAsync(tc, root, modelFile, opts = {}) {
36026
- const proofsAbs = (0, import_node_path43.join)(root, PROOFS_DIR);
36027
- const rel = (0, import_node_path43.relative)(proofsAbs, modelFile);
36028
- const res = await runAsync(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36457
+ const proofsAbs = (0, import_node_path46.join)(root, PROOFS_DIR);
36458
+ const rel = (0, import_node_path46.relative)(proofsAbs, modelFile);
36459
+ const problem = proofsWorkspaceProblem(root);
36460
+ const res = problem ? refused(problem) : await runAsync(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36029
36461
  return toReport(res, root, modelFile, opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36030
36462
  }
36031
36463
  function toReport(res, root, modelFile, timeoutMs) {
36032
36464
  const parsed = parseVerityLines(res.stdout);
36033
36465
  const combined = `${res.stdout}
36034
36466
  ${res.stderr}`;
36035
- const name2 = parsed.header?.model ?? (0, import_node_path43.basename)(modelFile, ".lean");
36467
+ const name2 = parsed.header?.model ?? (0, import_node_path46.basename)(modelFile, ".lean");
36036
36468
  const report = {
36037
36469
  model: name2,
36038
- file: (0, import_node_path43.relative)(root, modelFile),
36470
+ file: (0, import_node_path46.relative)(root, modelFile),
36039
36471
  ok: res.ok,
36040
36472
  header: parsed.header,
36041
36473
  properties: parsed.properties,
@@ -36080,33 +36512,18 @@ function writeResult(root, report) {
36080
36512
  function isCrashTrace(trace) {
36081
36513
  return trace.some((s) => /\b(crash\w*|kill\w*|restart\w*|interrupt\w*|power|abort\w*|process (dies|exit\w*)|lost (reply|response))\b/i.test(s));
36082
36514
  }
36083
- var SEVERITY_BY_IMPACT = {
36084
- money: "high",
36085
- access: "high",
36086
- data: "high",
36087
- external: "high",
36088
- count: "medium",
36089
- cache: "medium",
36090
- internal: "medium",
36091
- // A reproduced finding always has a real code; 'none' here is a malformed answer, so it blocks.
36092
- none: "high"
36093
- };
36094
- function formalSeverity(f) {
36095
- return f.impact && SEVERITY_BY_IMPACT[f.impact] || "high";
36096
- }
36097
36515
  function mergeFormalFindings(response, outcome, pushedFiles) {
36098
- if (!outcome) return { blocking: 0, warning: 0 };
36516
+ if (!outcome) return { blocking: 0 };
36099
36517
  const norm2 = (p) => p.replace(/\\/g, "/");
36100
36518
  const pushed = new Set(pushedFiles.map(norm2));
36101
- const reproduced = outcome.findings.filter((f) => f.verdict === "reproduced" && !f.waived && pushed.has(norm2(f.file)));
36102
- if (reproduced.length === 0) return { blocking: 0, warning: 0 };
36103
- const blocking = reproduced.filter((f) => formalSeverity(f) === "high");
36519
+ const blocking = outcome.findings.filter((f) => f.verdict === "reproduced" && !f.waived && pushed.has(norm2(f.file)));
36520
+ if (blocking.length === 0) return { blocking: 0 };
36104
36521
  const existing = Array.isArray(response.findings) ? response.findings : [];
36105
36522
  response.findings = [
36106
36523
  ...existing,
36107
- ...reproduced.map((f) => ({
36524
+ ...blocking.map((f) => ({
36108
36525
  pattern_id: "formal-counterexample",
36109
- severity: formalSeverity(f),
36526
+ severity: "high",
36110
36527
  scope: "change",
36111
36528
  file: f.file,
36112
36529
  line: outcome.target?.lines?.from ?? null,
@@ -36114,19 +36531,18 @@ function mergeFormalFindings(response, outcome, pushedFiles) {
36114
36531
  // as a title it read backwards (e2e, 2026-09-26). A trace that needs a
36115
36532
  // crash between two writes is labelled: reproducing it means injecting
36116
36533
  // the crash, so it is a crash-consistency finding, not a race.
36117
- title: `Formal: ${terminalText(f.symbol, 128)} breaks "${terminalText(f.desc, 280)}"${isCrashTrace(f.trace) ? " after a crash (crash consistency)" : ""} \u2014 reproduced on the real code${f.impact && f.impact !== "none" ? ` (impact: ${f.impact})` : ""}`,
36534
+ title: `Formal: ${terminalText(f.symbol, 128)} breaks "${terminalText(f.desc, 280)}"${isCrashTrace(f.trace) ? " after a crash (crash consistency)" : ""} \u2014 reproduced on the real code`,
36118
36535
  description: terminalText(f.reason ?? "", 2e3),
36119
36536
  fix: { description: `Trace: ${terminalText(f.trace.join(" \u2192 ") || "(initial state)", 2e3)}. Replay: ${terminalText(f.reason ?? "reproduced in the container", 2e3)}` },
36120
36537
  source: "formal"
36121
36538
  }))
36122
36539
  ];
36123
- if (blocking.length > 0) response.gate_decision = "FAIL";
36124
- else if (response.gate_decision === "PASS" || response.gate_decision == null) response.gate_decision = "WARN";
36125
- return { blocking: blocking.length, warning: reproduced.length - blocking.length };
36540
+ if (response.gate_decision !== "FAIL") response.gate_decision = "FAIL";
36541
+ return { blocking: blocking.length };
36126
36542
  }
36127
36543
 
36128
36544
  // src/lib/prove/scalpel.ts
36129
- var import_node_crypto16 = require("node:crypto");
36545
+ var import_node_crypto17 = require("node:crypto");
36130
36546
  var ARITHMETIC = /Math\.(?:round|floor|ceil|trunc)\(|\bround\(|\bdivmod\(|[\w)\]]\s*(?:\*|\/(?!\/)|%)\s*[\w(]/;
36131
36547
  function functionHazard(numbered2) {
36132
36548
  const sites = effectSites(numbered2);
@@ -36156,7 +36572,7 @@ function semanticFingerprint(numbered2) {
36156
36572
  if (LOG_LINE.test(t)) continue;
36157
36573
  kept.push(t.replace(/\s+/g, " "));
36158
36574
  }
36159
- return (0, import_node_crypto16.createHash)("sha256").update(kept.join("\n")).digest("hex");
36575
+ return (0, import_node_crypto17.createHash)("sha256").update(kept.join("\n")).digest("hex");
36160
36576
  }
36161
36577
  function readVerified(root, now = Date.now()) {
36162
36578
  const read2 = readRegularFileInRoot(root, VERIFIED_FILE, 256 * 1024);
@@ -36179,9 +36595,9 @@ function recordVerified(root, rec, now = Date.now()) {
36179
36595
  }
36180
36596
 
36181
36597
  // src/lib/prove/context.ts
36182
- var import_node_crypto17 = require("node:crypto");
36598
+ var import_node_crypto18 = require("node:crypto");
36183
36599
  var CONTEXT_BUDGET_MS = 2e3;
36184
- var sha256 = (s) => (0, import_node_crypto17.createHash)("sha256").update(s).digest("hex");
36600
+ var sha256 = (s) => (0, import_node_crypto18.createHash)("sha256").update(s).digest("hex");
36185
36601
  var TEST_PATH4 = /(^|\/)(tests?|__tests__|spec)\/|\.(test|spec)\.[a-z]+$/;
36186
36602
  function slice(content, f, maxLines) {
36187
36603
  const all = content.split("\n");
@@ -36370,7 +36786,7 @@ function workingTreeReader(root) {
36370
36786
  };
36371
36787
  }
36372
36788
  function sha256Of(content) {
36373
- return (0, import_node_crypto18.createHash)("sha256").update(content).digest("hex");
36789
+ return (0, import_node_crypto19.createHash)("sha256").update(content).digest("hex");
36374
36790
  }
36375
36791
  function defaultDeps(opts) {
36376
36792
  const env = opts.env ?? process.env;
@@ -36441,9 +36857,7 @@ async function runFormalPhase(input) {
36441
36857
  symbol: f.symbol,
36442
36858
  verdict: "reproduced",
36443
36859
  reason: f.waived ? `waived ${f.waived.at.slice(0, 10)}: ${f.waived.reason} (standing since ${f.at.slice(0, 10)}; the file has not changed)` : `${f.reason ?? "reproduced on the real code"} (standing since ${f.at.slice(0, 10)}; the file has not changed)`,
36444
- ...f.waived ? { waived: true } : {},
36445
- // A hand-edited file cannot invent a code: unknown values read as absent (HIGH).
36446
- ...isImpact(f.impact) ? { impact: f.impact } : {}
36860
+ ...f.waived ? { waived: true } : {}
36447
36861
  });
36448
36862
  }
36449
36863
  }
@@ -36482,6 +36896,7 @@ async function runFormalPhase(input) {
36482
36896
  return done({ status: "skipped", skip: "not-eligible", detail: `${best.file}: ${isEligible(best, largePush).why}` });
36483
36897
  }
36484
36898
  const ranked = await deps.rank(eligible, root, input.changedLines);
36899
+ if (!ranked.ok && ranked.disabled) return done({ status: "skipped", skip: "disabled-by-server", detail: ranked.error });
36485
36900
  if (ranked.ok) spend(ranked);
36486
36901
  candidates2 = ranked.ranked.slice(0, 5).map((c) => ({ file: c.file, symbol: c.ai?.symbol ?? null, score: c.ai?.score ?? null, criteria: c.ai?.criteria ?? null, reasked: !!c.ai?.reasked, reasons: (c.ai?.reasons ?? []).map((r) => r.slice(0, 200)) }));
36487
36902
  if (cancelled()) return done({ status: "skipped", skip: "deadline", detail: "cut off after ranking" });
@@ -36622,7 +37037,7 @@ async function runFormalPhase(input) {
36622
37037
  modelName = gen.name;
36623
37038
  const rel = `${AUTO_MODELS_DIR}/${gen.name}.lean`;
36624
37039
  writeFileInRootNoFollow(root, rel, gen.source);
36625
- const abs = resolveModelFile(root, rel) ?? (0, import_node_path44.join)(root, rel);
37040
+ const abs = resolveModelFile(root, rel) ?? (0, import_node_path47.join)(root, rel);
36626
37041
  progress.model = { name: gen.name, file: rel, rounds: round };
36627
37042
  progress.step = "check";
36628
37043
  report = await deps.check(root, abs);
@@ -36683,11 +37098,11 @@ async function runFormalPhase(input) {
36683
37098
  const budget = Math.max(2e4, timeLeft() - 5e3);
36684
37099
  const byId = /* @__PURE__ */ new Map();
36685
37100
  let stoppedEarly = false;
36686
- await new Promise((resolve8) => {
37101
+ await new Promise((resolve9) => {
36687
37102
  let left = toReplay.length;
36688
- if (left === 0) return resolve8();
37103
+ if (left === 0) return resolve9();
36689
37104
  const settle = () => {
36690
- if (--left === 0) resolve8();
37105
+ if (--left === 0) resolve9();
36691
37106
  };
36692
37107
  for (const p of toReplay) {
36693
37108
  void (async () => {
@@ -36700,7 +37115,7 @@ async function runFormalPhase(input) {
36700
37115
  if (!stoppedEarly) byId.set(p.id, r);
36701
37116
  if (r.verdict === "reproduced" && !stoppedEarly && !isCrash(p)) {
36702
37117
  stoppedEarly = true;
36703
- resolve8();
37118
+ resolve9();
36704
37119
  }
36705
37120
  })().catch(() => {
36706
37121
  byId.set(p.id, null);
@@ -36716,7 +37131,7 @@ async function runFormalPhase(input) {
36716
37131
  continue;
36717
37132
  }
36718
37133
  const verdict = r.verdict === "reproduced" ? "reproduced" : r.verdict === "diverged" ? "diverged" : r.verdict === "unreplayable" ? "model-only" : "unverified";
36719
- findings.push({ ...baseOf(p), verdict, reason: r.reason || r.downgrade || void 0, ...verdict === "reproduced" && r.impact ? { impact: r.impact } : {} });
37134
+ findings.push({ ...baseOf(p), verdict, reason: r.reason || r.downgrade || void 0 });
36720
37135
  }
36721
37136
  const reproduced = findings.filter((f) => f.verdict === "reproduced");
36722
37137
  if (reproduced.length > 0 && !cancelled()) {
@@ -36724,7 +37139,7 @@ async function runFormalPhase(input) {
36724
37139
  const others = readPersistedFindings(root).filter((f) => f.file !== top.file);
36725
37140
  writePersistedFindings(root, [
36726
37141
  ...others,
36727
- ...reproduced.map((f) => ({ file: f.file, symbol: f.symbol, sha256: sha2562, property: f.property, desc: f.desc, kind: f.kind, trace: f.trace, model: modelName, reason: f.reason, ...f.impact ? { impact: f.impact } : {}, ...lines ? { lines } : {}, at: now }))
37142
+ ...reproduced.map((f) => ({ file: f.file, symbol: f.symbol, sha256: sha2562, property: f.property, desc: f.desc, kind: f.kind, trace: f.trace, model: modelName, reason: f.reason, ...lines ? { lines } : {}, at: now }))
36728
37143
  ]);
36729
37144
  }
36730
37145
  const clean2 = findings.every((f) => f.verdict === "diverged");
@@ -36744,7 +37159,7 @@ async function runFormalPhase(input) {
36744
37159
  return done({
36745
37160
  status: "checked",
36746
37161
  target,
36747
- model: { name: modelName, file: (0, import_node_path44.relative)(root, (0, import_node_path44.join)(root, modelFile)), rounds },
37162
+ model: { name: modelName, file: (0, import_node_path47.relative)(root, (0, import_node_path47.join)(root, modelFile)), rounds },
36748
37163
  properties: report.properties,
36749
37164
  findings
36750
37165
  });
@@ -36807,7 +37222,7 @@ async function generateAndCheck(root, req, opts) {
36807
37222
  }
36808
37223
  const rel = `${dir}/${gen.name}.lean`;
36809
37224
  writeFileInRootNoFollow(root, rel, gen.source);
36810
- const abs = resolveModelFile(root, rel) ?? (0, import_node_path44.join)(root, rel);
37225
+ const abs = resolveModelFile(root, rel) ?? (0, import_node_path47.join)(root, rel);
36811
37226
  const report = await opts.deps.check(root, abs);
36812
37227
  const abstracts = report.header?.abstracts ?? [];
36813
37228
  const stray = abstracts.find((a) => !headerFiles.has(a.file)) ?? (abstracts[0] && abstracts[0].file !== req.file ? abstracts[0] : void 0);
@@ -36845,6 +37260,8 @@ async function prepareFormalPhase(root, env = process.env, auth2, readSource, co
36845
37260
  const apiKey = direct ? env.OPENAI_API_KEY : void 0;
36846
37261
  const toolchain = findToolchain(env);
36847
37262
  if (!toolchain) return { ok: false, skip: "no-toolchain" };
37263
+ const untrusted = proofsWorkspaceProblem(root);
37264
+ if (untrusted) return { ok: false, skip: "workspace-untrusted", detail: untrusted.slice(0, 200) };
36848
37265
  try {
36849
37266
  scaffoldProofs(root);
36850
37267
  } catch (err2) {
@@ -36893,10 +37310,10 @@ function runFormalPhaseWithin(input) {
36893
37310
  if (left <= 0) return Promise.resolve(skippedOutcome("deadline", "no time left"));
36894
37311
  const progress = input.progress ?? {};
36895
37312
  let timer = null;
36896
- const cutoff = new Promise((resolve8) => {
37313
+ const cutoff = new Promise((resolve9) => {
36897
37314
  timer = setTimeout(() => {
36898
37315
  progress.cancelled = true;
36899
- resolve8(cutOffOutcome(progress, `hard stop after ${Math.round(left / 1e3)} s during ${progress.step ?? "setup"}`, left));
37316
+ resolve9(cutOffOutcome(progress, `hard stop after ${Math.round(left / 1e3)} s during ${progress.step ?? "setup"}`, left));
36900
37317
  }, left);
36901
37318
  });
36902
37319
  return Promise.race([runFormalPhase({ ...input, progress }), cutoff]).finally(() => {
@@ -36933,13 +37350,14 @@ function describeFormalOutcome(o) {
36933
37350
  var EXCERPT_SOURCE_MAX_BYTES = 2 * 1024 * 1024;
36934
37351
  var WRITERS_BUDGET_MS = 1500;
36935
37352
  var EXCERPT_MAX_LINES2 = 30;
37353
+ var VENDORED_READ_MAX_BYTES = 256 * 1024;
36936
37354
  var GUARD_BLOCK_CAP = 2;
36937
- var GUARD_ITER_FILE = (0, import_node_path45.join)(VERITY_DIR, ".guard-iteration");
37355
+ var GUARD_ITER_FILE = (0, import_node_path48.join)(VERITY_DIR, ".guard-iteration");
36938
37356
  function readPreToolUseStdin() {
36939
37357
  const empty = { command: "", cwd: null, sessionId: null };
36940
- return new Promise((resolve8) => {
37358
+ return new Promise((resolve9) => {
36941
37359
  try {
36942
- if (process.stdin.isTTY) return resolve8(empty);
37360
+ if (process.stdin.isTTY) return resolve9(empty);
36943
37361
  const chunks = [];
36944
37362
  let timer;
36945
37363
  let settled = false;
@@ -36952,7 +37370,7 @@ function readPreToolUseStdin() {
36952
37370
  process.stdin.removeListener("end", onEnd);
36953
37371
  process.stdin.removeListener("error", onError);
36954
37372
  process.stdin.pause();
36955
- resolve8(value);
37373
+ resolve9(value);
36956
37374
  };
36957
37375
  const onEnd = () => {
36958
37376
  try {
@@ -36973,13 +37391,13 @@ function readPreToolUseStdin() {
36973
37391
  process.stdin.on("error", onError);
36974
37392
  process.stdin.resume();
36975
37393
  } catch {
36976
- resolve8(empty);
37394
+ resolve9(empty);
36977
37395
  }
36978
37396
  });
36979
37397
  }
36980
37398
  function readIterMap() {
36981
37399
  try {
36982
- const raw = JSON.parse((0, import_node_fs59.readFileSync)(GUARD_ITER_FILE, "utf-8"));
37400
+ const raw = JSON.parse((0, import_node_fs61.readFileSync)(GUARD_ITER_FILE, "utf-8"));
36983
37401
  if (raw && typeof raw === "object") {
36984
37402
  if (typeof raw.moment === "string" && typeof raw.count === "number") {
36985
37403
  return { [raw.moment]: raw.count };
@@ -36999,10 +37417,10 @@ function readIter(moment) {
36999
37417
  }
37000
37418
  function writeIter(moment, count) {
37001
37419
  try {
37002
- (0, import_node_fs59.mkdirSync)(VERITY_DIR, { recursive: true });
37420
+ (0, import_node_fs61.mkdirSync)(VERITY_DIR, { recursive: true });
37003
37421
  const map = readIterMap();
37004
37422
  map[moment] = count;
37005
- (0, import_node_fs59.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37423
+ (0, import_node_fs61.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37006
37424
  } catch {
37007
37425
  }
37008
37426
  }
@@ -37012,10 +37430,10 @@ function resetIter(moment) {
37012
37430
  if (!(moment in map)) return;
37013
37431
  delete map[moment];
37014
37432
  if (Object.keys(map).length === 0) {
37015
- if ((0, import_node_fs59.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs59.unlinkSync)(GUARD_ITER_FILE);
37433
+ if ((0, import_node_fs61.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs61.unlinkSync)(GUARD_ITER_FILE);
37016
37434
  } else {
37017
- (0, import_node_fs59.mkdirSync)(VERITY_DIR, { recursive: true });
37018
- (0, import_node_fs59.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37435
+ (0, import_node_fs61.mkdirSync)(VERITY_DIR, { recursive: true });
37436
+ (0, import_node_fs61.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37019
37437
  }
37020
37438
  } catch {
37021
37439
  }
@@ -37085,7 +37503,7 @@ function hasBlockingFinding(response, sentFiles) {
37085
37503
  function buildGuardRequest(moment, files, codeDelta, iter, sessionId, statedIntent, coverageTelemetry) {
37086
37504
  const analyzable = filterAnalyzable(files);
37087
37505
  const securityFiles = filterSecurity(files);
37088
- const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).map((f) => (0, import_node_fs59.existsSync)(f) ? f : resolveFile(f)).filter((f) => f !== null);
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);
37089
37507
  const staticResults = runCodacyAnalysisIfAvailable(scannable);
37090
37508
  const trigger = moment === "pre-commit" ? "hook:pre-commit" : "hook:pre-push";
37091
37509
  const requestBody = {
@@ -37322,7 +37740,15 @@ async function runGuard(opts, globals) {
37322
37740
  `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.`
37323
37741
  );
37324
37742
  }
37325
- const files = rangeFiles(frame, range);
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) });
37326
37752
  if (files.length === 0) process.exit(0);
37327
37753
  const tokenResult = await resolveToken(globals.token);
37328
37754
  const urlResult = await resolveServiceUrl(globals.serviceUrl);
@@ -37462,8 +37888,6 @@ async function runGuard(opts, globals) {
37462
37888
  rounds: formalOutcome.model?.rounds ?? null,
37463
37889
  properties: formalOutcome.properties?.map((p) => `${p.id}:${p.result}`) ?? [],
37464
37890
  findings: formalOutcome.findings.map((f) => `${f.property}:${f.verdict}`),
37465
- // Decision 82: the replay's impact code per reproduced finding; count/cache/internal warn, the rest block.
37466
- impacts: formalOutcome.findings.filter((f) => f.impact).map((f) => `${f.property}:${f.impact}`),
37467
37891
  // Decision 81: what each property rests on (a rule, or "line"), what was
37468
37892
  // sent back or dropped as ungrounded, and which counterexamples lack their
37469
37893
  // property's trigger (shadow). Ids and rule names only, never code.
@@ -37704,8 +38128,8 @@ function registerIgnoreCommand(program2) {
37704
38128
  }
37705
38129
 
37706
38130
  // src/commands/waive.ts
37707
- var import_node_crypto19 = require("node:crypto");
37708
- var import_node_fs60 = require("node:fs");
38131
+ var import_node_crypto20 = require("node:crypto");
38132
+ var import_node_fs62 = require("node:fs");
37709
38133
  function registerWaiveCommand(program2) {
37710
38134
  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) => {
37711
38135
  const globals = program2.opts();
@@ -37734,7 +38158,7 @@ function registerWaiveCommand(program2) {
37734
38158
  if (opts.file) {
37735
38159
  body2.file = opts.file;
37736
38160
  try {
37737
- body2.file_sha256 = (0, import_node_crypto19.createHash)("sha256").update((0, import_node_fs60.readFileSync)(opts.file)).digest("hex");
38161
+ body2.file_sha256 = (0, import_node_crypto20.createHash)("sha256").update((0, import_node_fs62.readFileSync)(opts.file)).digest("hex");
37738
38162
  } catch {
37739
38163
  printError(`Cannot read ${opts.file} \u2014 run from the repo root, or omit --file to waive by pattern.`);
37740
38164
  process.exit(1);
@@ -37759,10 +38183,10 @@ function registerWaiveCommand(program2) {
37759
38183
  }
37760
38184
 
37761
38185
  // src/commands/init.ts
37762
- var import_node_fs65 = require("node:fs");
38186
+ var import_node_fs67 = require("node:fs");
37763
38187
  var import_promises20 = require("node:fs/promises");
37764
38188
  var import_yaml6 = __toESM2(require_dist());
37765
- var import_node_path49 = require("node:path");
38189
+ var import_node_path52 = require("node:path");
37766
38190
  var import_node_child_process19 = require("node:child_process");
37767
38191
 
37768
38192
  // src/lib/banner.ts
@@ -37841,7 +38265,7 @@ function printPhase(n, of, title, subtitle) {
37841
38265
  }
37842
38266
 
37843
38267
  // src/commands/doctor.ts
37844
- var import_node_fs61 = require("node:fs");
38268
+ var import_node_fs63 = require("node:fs");
37845
38269
 
37846
38270
  // src/lib/prereqs.ts
37847
38271
  var import_node_child_process16 = require("node:child_process");
@@ -37902,13 +38326,13 @@ function checkAnalysisCli() {
37902
38326
  }
37903
38327
  var INSTALL_TIMEOUT_MS = 12e4;
37904
38328
  function run3(command, args2, opts = {}) {
37905
- return new Promise((resolve8) => {
38329
+ return new Promise((resolve9) => {
37906
38330
  const child = (0, import_node_child_process16.spawn)(command, args2, {
37907
38331
  stdio: opts.inherit ? "inherit" : "pipe",
37908
38332
  timeout: INSTALL_TIMEOUT_MS
37909
38333
  });
37910
- child.on("error", () => resolve8(false));
37911
- child.on("close", (code) => resolve8(code === 0));
38334
+ child.on("error", () => resolve9(false));
38335
+ child.on("close", (code) => resolve9(code === 0));
37912
38336
  });
37913
38337
  }
37914
38338
  async function installAnalysisCli() {
@@ -38049,11 +38473,11 @@ async function buildReport() {
38049
38473
  const hooks = wiring.status;
38050
38474
  const provenance = cliProvenance();
38051
38475
  const telemetry = await checkTelemetry();
38052
- const hasConfig = (0, import_node_fs61.existsSync)(projectPath(CODACY_CONFIG_FILE));
38476
+ const hasConfig = (0, import_node_fs63.existsSync)(projectPath(CODACY_CONFIG_FILE));
38053
38477
  const artifacts = {
38054
- standard: (0, import_node_fs61.existsSync)(projectPath(STANDARD_FILE)),
38478
+ standard: (0, import_node_fs63.existsSync)(projectPath(STANDARD_FILE)),
38055
38479
  analysisConfig: hasConfig,
38056
- verityMd: (0, import_node_fs61.existsSync)(projectPath(VERITY_MD_FILE)),
38480
+ verityMd: (0, import_node_fs63.existsSync)(projectPath(VERITY_MD_FILE)),
38057
38481
  analysisConfigIds: hasConfig ? validatePatternIds().status : "absent"
38058
38482
  };
38059
38483
  const next = [];
@@ -38212,8 +38636,8 @@ function registerDoctorCommand(program2) {
38212
38636
  }
38213
38637
 
38214
38638
  // src/commands/migrate.ts
38215
- var import_node_fs62 = require("node:fs");
38216
- var import_node_path46 = require("node:path");
38639
+ var import_node_fs64 = require("node:fs");
38640
+ var import_node_path49 = require("node:path");
38217
38641
  var import_node_child_process17 = require("node:child_process");
38218
38642
  var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
38219
38643
  function defaultNpmRemover(pkg) {
@@ -38250,12 +38674,12 @@ async function runMigration(opts = {}) {
38250
38674
  return { actions, migrated: actions.length > 0 };
38251
38675
  }
38252
38676
  function migrateProjectDir(root, actions) {
38253
- const gateDir = (0, import_node_path46.join)(root, ".gate");
38254
- const verityDir = (0, import_node_path46.join)(root, ".verity");
38255
- if ((0, import_node_fs62.existsSync)(gateDir) && !(0, import_node_fs62.existsSync)(verityDir)) {
38677
+ const gateDir = (0, import_node_path49.join)(root, ".gate");
38678
+ const verityDir = (0, import_node_path49.join)(root, ".verity");
38679
+ if ((0, import_node_fs64.existsSync)(gateDir) && !(0, import_node_fs64.existsSync)(verityDir)) {
38256
38680
  return migrateProjectDirRename(root, gateDir, verityDir, actions);
38257
38681
  }
38258
- if ((0, import_node_fs62.existsSync)(gateDir) && (0, import_node_fs62.existsSync)(verityDir)) {
38682
+ if ((0, import_node_fs64.existsSync)(gateDir) && (0, import_node_fs64.existsSync)(verityDir)) {
38259
38683
  return migrateProjectDirCarry(gateDir, verityDir, actions);
38260
38684
  }
38261
38685
  return false;
@@ -38276,13 +38700,13 @@ function migrateProjectDirRename(root, gateDir, verityDir, actions) {
38276
38700
  }
38277
38701
  }
38278
38702
  if (moved) {
38279
- if ((0, import_node_fs62.existsSync)(gateDir)) {
38703
+ if ((0, import_node_fs64.existsSync)(gateDir)) {
38280
38704
  const carried = carryLegacyContents(gateDir, verityDir);
38281
38705
  if (carried > 0) {
38282
38706
  actions.push(`Carried ${carried} untracked legacy file(s) from .gate/ into .verity/`);
38283
38707
  }
38284
38708
  try {
38285
- (0, import_node_fs62.rmSync)(gateDir, { recursive: true, force: true });
38709
+ (0, import_node_fs64.rmSync)(gateDir, { recursive: true, force: true });
38286
38710
  } catch {
38287
38711
  }
38288
38712
  }
@@ -38298,18 +38722,18 @@ function migrateProjectDirCarry(gateDir, verityDir, actions) {
38298
38722
  actions.push(`Carried ${carried} legacy file(s) from .gate/ into .verity/`);
38299
38723
  }
38300
38724
  try {
38301
- (0, import_node_fs62.rmSync)(gateDir, { recursive: true, force: true });
38725
+ (0, import_node_fs64.rmSync)(gateDir, { recursive: true, force: true });
38302
38726
  } catch {
38303
38727
  }
38304
38728
  return carried > 0;
38305
38729
  }
38306
38730
  function migrateGlobalCredentials(home, actions) {
38307
38731
  if (!home) return;
38308
- const gateCreds = (0, import_node_path46.join)(home, ".gate", "credentials");
38309
- const verityCreds = (0, import_node_path46.join)(home, ".verity", "credentials");
38310
- if (!(0, import_node_fs62.existsSync)(gateCreds)) return;
38311
- if (!(0, import_node_fs62.existsSync)(verityCreds)) {
38312
- (0, import_node_fs62.mkdirSync)((0, import_node_path46.join)(home, ".verity"), { recursive: true });
38732
+ const gateCreds = (0, import_node_path49.join)(home, ".gate", "credentials");
38733
+ const verityCreds = (0, import_node_path49.join)(home, ".verity", "credentials");
38734
+ if (!(0, import_node_fs64.existsSync)(gateCreds)) return;
38735
+ if (!(0, import_node_fs64.existsSync)(verityCreds)) {
38736
+ (0, import_node_fs64.mkdirSync)((0, import_node_path49.join)(home, ".verity"), { recursive: true });
38313
38737
  moveFile(gateCreds, verityCreds);
38314
38738
  actions.push("Moved ~/.gate/credentials \u2192 ~/.verity/credentials");
38315
38739
  return;
@@ -38331,8 +38755,8 @@ async function migrateLegacyHooks(root, actions) {
38331
38755
  }
38332
38756
  }
38333
38757
  async function migrateClaudeMd(root, actions) {
38334
- const claudeMd = (0, import_node_path46.join)(root, "CLAUDE.md");
38335
- const hadLegacyBlock = (0, import_node_fs62.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
38758
+ const claudeMd = (0, import_node_path49.join)(root, "CLAUDE.md");
38759
+ const hadLegacyBlock = (0, import_node_fs64.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
38336
38760
  if (!hadLegacyBlock) return;
38337
38761
  try {
38338
38762
  await ensureClaudeMdPointer(root);
@@ -38342,9 +38766,9 @@ async function migrateClaudeMd(root, actions) {
38342
38766
  }
38343
38767
  }
38344
38768
  function migrateStandardFile(root, actions) {
38345
- const gateMd = (0, import_node_path46.join)(root, "GATE.md");
38346
- const verityMd = (0, import_node_path46.join)(root, "VERITY.md");
38347
- if (!(0, import_node_fs62.existsSync)(gateMd) || (0, import_node_fs62.existsSync)(verityMd)) return;
38769
+ const gateMd = (0, import_node_path49.join)(root, "GATE.md");
38770
+ const verityMd = (0, import_node_path49.join)(root, "VERITY.md");
38771
+ if (!(0, import_node_fs64.existsSync)(gateMd) || (0, import_node_fs64.existsSync)(verityMd)) return;
38348
38772
  let moved = false;
38349
38773
  if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
38350
38774
  try {
@@ -38356,12 +38780,12 @@ function migrateStandardFile(root, actions) {
38356
38780
  if (!moved) moveFile(gateMd, verityMd);
38357
38781
  const content = readFileSyncSafe(verityMd);
38358
38782
  const refreshed = content.split("GATE.md").join("VERITY.md");
38359
- if (refreshed !== content) (0, import_node_fs62.writeFileSync)(verityMd, refreshed);
38783
+ if (refreshed !== content) (0, import_node_fs64.writeFileSync)(verityMd, refreshed);
38360
38784
  actions.push("Renamed GATE.md \u2192 VERITY.md");
38361
38785
  }
38362
38786
  async function migrateTelemetryHeaders(root, actions) {
38363
- const file = (0, import_node_path46.join)(root, ".claude", "settings.local.json");
38364
- if (!(0, import_node_fs62.existsSync)(file)) return;
38787
+ const file = (0, import_node_path49.join)(root, ".claude", "settings.local.json");
38788
+ if (!(0, import_node_fs64.existsSync)(file)) return;
38365
38789
  let settings;
38366
38790
  try {
38367
38791
  settings = JSON.parse(readFileSyncSafe(file) || "{}");
@@ -38409,14 +38833,14 @@ function mergeGlobalCredentials(gateCreds, verityCreds) {
38409
38833
  }
38410
38834
  if (toAppend.length > 0) {
38411
38835
  const sep5 = verityContent.endsWith("\n") || verityContent === "" ? "" : "\n";
38412
- (0, import_node_fs62.writeFileSync)(verityCreds, verityContent + sep5 + toAppend.join("\n") + "\n");
38836
+ (0, import_node_fs64.writeFileSync)(verityCreds, verityContent + sep5 + toAppend.join("\n") + "\n");
38413
38837
  }
38414
- (0, import_node_fs62.rmSync)(gateCreds, { force: true });
38838
+ (0, import_node_fs64.rmSync)(gateCreds, { force: true });
38415
38839
  return toAppend.length;
38416
38840
  }
38417
38841
  function readFileSyncSafe(path) {
38418
38842
  try {
38419
- return (0, import_node_fs62.readFileSync)(path, "utf-8");
38843
+ return (0, import_node_fs64.readFileSync)(path, "utf-8");
38420
38844
  } catch {
38421
38845
  return "";
38422
38846
  }
@@ -38431,35 +38855,35 @@ function hasStagedChanges(root) {
38431
38855
  }
38432
38856
  function moveDir(from, to) {
38433
38857
  try {
38434
- (0, import_node_fs62.renameSync)(from, to);
38858
+ (0, import_node_fs64.renameSync)(from, to);
38435
38859
  } catch (err2) {
38436
38860
  if (err2.code !== "EXDEV") throw err2;
38437
- (0, import_node_fs62.cpSync)(from, to, { recursive: true });
38438
- (0, import_node_fs62.rmSync)(from, { recursive: true, force: true });
38861
+ (0, import_node_fs64.cpSync)(from, to, { recursive: true });
38862
+ (0, import_node_fs64.rmSync)(from, { recursive: true, force: true });
38439
38863
  }
38440
38864
  }
38441
38865
  function moveFile(from, to) {
38442
38866
  try {
38443
- (0, import_node_fs62.renameSync)(from, to);
38867
+ (0, import_node_fs64.renameSync)(from, to);
38444
38868
  } catch (err2) {
38445
38869
  if (err2.code !== "EXDEV") throw err2;
38446
- (0, import_node_fs62.cpSync)(from, to);
38447
- (0, import_node_fs62.rmSync)(from, { force: true });
38870
+ (0, import_node_fs64.cpSync)(from, to);
38871
+ (0, import_node_fs64.rmSync)(from, { force: true });
38448
38872
  }
38449
38873
  }
38450
38874
  function carryLegacyContents(gateDir, verityDir) {
38451
38875
  let copied = 0;
38452
38876
  const walk2 = (relDir) => {
38453
- const srcDir = (0, import_node_path46.join)(gateDir, relDir);
38454
- for (const entry of (0, import_node_fs62.readdirSync)(srcDir)) {
38455
- const rel = relDir ? (0, import_node_path46.join)(relDir, entry) : entry;
38456
- const src = (0, import_node_path46.join)(gateDir, rel);
38457
- const dest = (0, import_node_path46.join)(verityDir, rel);
38458
- if ((0, import_node_fs62.statSync)(src).isDirectory()) {
38877
+ const srcDir = (0, import_node_path49.join)(gateDir, relDir);
38878
+ for (const entry of (0, import_node_fs64.readdirSync)(srcDir)) {
38879
+ const rel = relDir ? (0, import_node_path49.join)(relDir, entry) : entry;
38880
+ const src = (0, import_node_path49.join)(gateDir, rel);
38881
+ const dest = (0, import_node_path49.join)(verityDir, rel);
38882
+ if ((0, import_node_fs64.statSync)(src).isDirectory()) {
38459
38883
  walk2(rel);
38460
- } else if (!(0, import_node_fs62.existsSync)(dest)) {
38461
- (0, import_node_fs62.mkdirSync)((0, import_node_path46.dirname)(dest), { recursive: true });
38462
- (0, import_node_fs62.cpSync)(src, dest);
38884
+ } else if (!(0, import_node_fs64.existsSync)(dest)) {
38885
+ (0, import_node_fs64.mkdirSync)((0, import_node_path49.dirname)(dest), { recursive: true });
38886
+ (0, import_node_fs64.cpSync)(src, dest);
38463
38887
  copied++;
38464
38888
  }
38465
38889
  }
@@ -38468,22 +38892,22 @@ function carryLegacyContents(gateDir, verityDir) {
38468
38892
  return copied;
38469
38893
  }
38470
38894
  async function needsMigration(root = repoRoot()) {
38471
- const gateDir = (0, import_node_path46.join)(root, ".gate");
38472
- const verityDir = (0, import_node_path46.join)(root, ".verity");
38473
- if ((0, import_node_fs62.existsSync)(gateDir) && !(0, import_node_fs62.existsSync)(verityDir)) return true;
38474
- if ((0, import_node_fs62.existsSync)(gateDir) && (0, import_node_fs62.existsSync)(verityDir)) {
38475
- 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"))) {
38895
+ const gateDir = (0, import_node_path49.join)(root, ".gate");
38896
+ const verityDir = (0, import_node_path49.join)(root, ".verity");
38897
+ if ((0, import_node_fs64.existsSync)(gateDir) && !(0, import_node_fs64.existsSync)(verityDir)) return true;
38898
+ if ((0, import_node_fs64.existsSync)(gateDir) && (0, import_node_fs64.existsSync)(verityDir)) {
38899
+ 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"))) {
38476
38900
  return true;
38477
38901
  }
38478
- 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"))) {
38902
+ 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"))) {
38479
38903
  return true;
38480
38904
  }
38481
38905
  }
38482
- const claudeMd = (0, import_node_path46.join)(root, "CLAUDE.md");
38483
- if ((0, import_node_fs62.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
38906
+ const claudeMd = (0, import_node_path49.join)(root, "CLAUDE.md");
38907
+ if ((0, import_node_fs64.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
38484
38908
  return true;
38485
38909
  }
38486
- 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"))) {
38910
+ 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"))) {
38487
38911
  return true;
38488
38912
  }
38489
38913
  if (await hasLegacyHooksAt(root)) return true;
@@ -38612,7 +39036,7 @@ function runSelect(opts) {
38612
39036
  cursor: initialIdx[0] ?? 0,
38613
39037
  chosen: new Set(mode2 === "single" ? [initialIdx[0] ?? 0] : initialIdx)
38614
39038
  };
38615
- return new Promise((resolve8) => {
39039
+ return new Promise((resolve9) => {
38616
39040
  let painted = 0;
38617
39041
  let settled = false;
38618
39042
  const draw = () => {
@@ -38660,7 +39084,7 @@ function runSelect(opts) {
38660
39084
  if (settled) return;
38661
39085
  settled = true;
38662
39086
  restore();
38663
- resolve8(value);
39087
+ resolve9(value);
38664
39088
  };
38665
39089
  readline2.emitKeypressEvents(input);
38666
39090
  input.setRawMode(true);
@@ -38681,9 +39105,9 @@ async function askLine(question, io = {}) {
38681
39105
  output: io.output ?? process.stdout
38682
39106
  });
38683
39107
  try {
38684
- return await new Promise((resolve8) => {
38685
- rl.question(question).then((a) => resolve8(a.trim())).catch(() => resolve8(null));
38686
- rl.once("close", () => setImmediate(() => resolve8(null)));
39108
+ return await new Promise((resolve9) => {
39109
+ rl.question(question).then((a) => resolve9(a.trim())).catch(() => resolve9(null));
39110
+ rl.once("close", () => setImmediate(() => resolve9(null)));
38687
39111
  });
38688
39112
  } finally {
38689
39113
  rl.close();
@@ -38764,15 +39188,31 @@ async function promptMultiSelect(question, choices, fallback) {
38764
39188
  }
38765
39189
 
38766
39190
  // src/lib/prove/lean-install.ts
38767
- var import_node_fs63 = require("node:fs");
38768
- var import_node_crypto20 = require("node:crypto");
39191
+ var import_node_fs65 = require("node:fs");
39192
+ var import_node_crypto21 = require("node:crypto");
38769
39193
  var import_node_child_process18 = require("node:child_process");
38770
39194
  var import_node_os10 = require("node:os");
38771
- var import_node_path47 = require("node:path");
39195
+ var import_node_path50 = require("node:path");
38772
39196
  var import_promises18 = require("node:stream/promises");
38773
39197
  var import_node_stream = require("node:stream");
38774
39198
  var RELEASES = "https://releases.lean-lang.org/lean4";
38775
39199
  var LEAN_DOWNLOAD_SIZE = "\u2248800 MB download, 2.7 GB on disk";
39200
+ var DOWNLOAD_STALL_MS = 6e4;
39201
+ var LEAN_DISK_NEEDED_BYTES = 3.75 * 1024 ** 3;
39202
+ function freeBytes(dir) {
39203
+ let d = dir;
39204
+ for (let i2 = 0; i2 < 64; i2++) {
39205
+ try {
39206
+ const st = (0, import_node_fs65.statfsSync)(d);
39207
+ return Number(st.bavail) * Number(st.bsize);
39208
+ } catch {
39209
+ const up = (0, import_node_path50.join)(d, "..");
39210
+ if (up === d) return null;
39211
+ d = up;
39212
+ }
39213
+ }
39214
+ return null;
39215
+ }
38776
39216
  var LEAN_ASSET_SHA256 = {
38777
39217
  "v4.34.0": {
38778
39218
  "lean-4.34.0-darwin.zip": "75a2a4b8e3d35680e8f51fae5a42c79702f463dd73ee1520fb61e5a9143e336c",
@@ -38786,9 +39226,9 @@ function expectedSha256(asset, version = pinnedVersion()) {
38786
39226
  return LEAN_ASSET_SHA256[version]?.[asset] ?? null;
38787
39227
  }
38788
39228
  function sha256File(path) {
38789
- return new Promise((resolve8, reject) => {
38790
- const hash = (0, import_node_crypto20.createHash)("sha256");
38791
- (0, import_node_fs63.createReadStream)(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve8(hash.digest("hex"))).on("error", reject);
39229
+ return new Promise((resolve9, reject) => {
39230
+ const hash = (0, import_node_crypto21.createHash)("sha256");
39231
+ (0, import_node_fs65.createReadStream)(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
38792
39232
  });
38793
39233
  }
38794
39234
  async function verifyDownload(zip, asset, version = pinnedVersion()) {
@@ -38808,7 +39248,7 @@ function leanAssetName(version = pinnedVersion()) {
38808
39248
  return suffix ? `lean-${v}-${suffix}.zip` : null;
38809
39249
  }
38810
39250
  function pinnedVersionDir(env = process.env) {
38811
- return (0, import_node_path47.join)(verityLeanHome(env), pinnedVersion());
39251
+ return (0, import_node_path50.join)(verityLeanHome(env), pinnedVersion());
38812
39252
  }
38813
39253
  function lakeBinary() {
38814
39254
  return (0, import_node_os10.platform)() === "win32" ? "lake.exe" : "lake";
@@ -38819,29 +39259,44 @@ function unzip(zip, dest) {
38819
39259
  for (const [cmd, args2] of attempts) {
38820
39260
  try {
38821
39261
  (0, import_node_child_process18.execFileSync)(cmd, args2, { stdio: ["ignore", "ignore", "pipe"], timeout: 15 * 6e4 });
38822
- if ((0, import_node_fs63.readdirSync)(dest).length > 0) return { ok: true, via: cmd };
39262
+ if ((0, import_node_fs65.readdirSync)(dest).length > 0) return { ok: true, via: cmd };
38823
39263
  errors.push(`${cmd}: produced nothing`);
38824
39264
  } catch (err2) {
38825
39265
  errors.push(`${cmd}: ${String(err2.message).split("\n")[0].slice(0, 120)}`);
38826
39266
  try {
38827
- 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 });
39267
+ 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 });
38828
39268
  } catch {
38829
39269
  }
38830
39270
  }
38831
39271
  }
38832
39272
  return { ok: false, error: errors.join("; ") };
38833
39273
  }
38834
- async function download(url, dest, onProgress) {
38835
- const res = await fetch(url, { redirect: "follow" });
38836
- if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status}`);
38837
- const total = Number(res.headers.get("content-length")) || null;
38838
- let seen = 0;
38839
- const stream = import_node_stream.Readable.fromWeb(res.body);
38840
- stream.on("data", (chunk) => {
38841
- seen += chunk.length;
38842
- onProgress(seen, total);
38843
- });
38844
- await (0, import_promises18.pipeline)(stream, (0, import_node_fs63.createWriteStream)(dest));
39274
+ async function download(url, dest, onProgress, stallMs = DOWNLOAD_STALL_MS) {
39275
+ const ctrl = new AbortController();
39276
+ let timer;
39277
+ const arm = () => {
39278
+ clearTimeout(timer);
39279
+ timer = setTimeout(() => ctrl.abort(), stallMs);
39280
+ };
39281
+ arm();
39282
+ try {
39283
+ const res = await fetch(url, { redirect: "follow", signal: ctrl.signal });
39284
+ if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status}`);
39285
+ const total = Number(res.headers.get("content-length")) || null;
39286
+ let seen = 0;
39287
+ const stream = import_node_stream.Readable.fromWeb(res.body);
39288
+ stream.on("data", (chunk) => {
39289
+ arm();
39290
+ seen += chunk.length;
39291
+ onProgress(seen, total);
39292
+ });
39293
+ await (0, import_promises18.pipeline)(stream, (0, import_node_fs65.createWriteStream)(dest), { signal: ctrl.signal });
39294
+ } catch (err2) {
39295
+ if (ctrl.signal.aborted) throw new Error(`download stalled: nothing received for ${Math.round(stallMs / 1e3)} s`);
39296
+ throw err2;
39297
+ } finally {
39298
+ clearTimeout(timer);
39299
+ }
38845
39300
  }
38846
39301
  function inPlaceProgress(label2, write = (s) => process.stderr.write(s)) {
38847
39302
  let active = false;
@@ -38879,10 +39334,16 @@ async function installLean(opts = {}) {
38879
39334
  const dir = pinnedVersionDir(env);
38880
39335
  const url = `${RELEASES}/${pinnedVersion()}/${asset}`;
38881
39336
  const home = verityLeanHome(env);
38882
- const tmp = (0, import_node_path47.join)(home, ".tmp");
38883
- (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
38884
- (0, import_node_fs63.mkdirSync)(tmp, { recursive: true });
38885
- const zip = (0, import_node_path47.join)(tmp, asset);
39337
+ const free = freeBytes(home);
39338
+ const needed = opts.minFreeBytes ?? LEAN_DISK_NEEDED_BYTES;
39339
+ if (free !== null && free < needed) {
39340
+ const gb = (n) => (n / 1024 ** 3).toFixed(1);
39341
+ return { ok: false, error: `not enough disk space for Lean: ${gb(free)} GB free where ${home} lives, needs about ${gb(needed)} GB` };
39342
+ }
39343
+ const tmp = (0, import_node_path50.join)(home, ".tmp");
39344
+ (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
39345
+ (0, import_node_fs65.mkdirSync)(tmp, { recursive: true });
39346
+ const zip = (0, import_node_path50.join)(tmp, asset);
38886
39347
  say(`downloading ${url}`);
38887
39348
  let lastPct = -1;
38888
39349
  try {
@@ -38895,40 +39356,40 @@ async function installLean(opts = {}) {
38895
39356
  }
38896
39357
  });
38897
39358
  } catch (err2) {
38898
- (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39359
+ (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38899
39360
  return { ok: false, error: err2.message };
38900
39361
  }
38901
39362
  say("verifying checksum");
38902
39363
  const verified = await verifyDownload(zip, asset);
38903
39364
  if (!verified.ok) {
38904
- (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39365
+ (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38905
39366
  return { ok: false, error: verified.error };
38906
39367
  }
38907
39368
  say("unpacking (this takes a minute)");
38908
- const unpack = (0, import_node_path47.join)(tmp, "unpack");
38909
- (0, import_node_fs63.mkdirSync)(unpack);
39369
+ const unpack = (0, import_node_path50.join)(tmp, "unpack");
39370
+ (0, import_node_fs65.mkdirSync)(unpack);
38910
39371
  const unpacked = unzip(zip, unpack);
38911
39372
  if (!unpacked.ok) {
38912
- (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39373
+ (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38913
39374
  return { ok: false, error: `unpack failed: ${unpacked.error}` };
38914
39375
  }
38915
- const entries = (0, import_node_fs63.readdirSync)(unpack);
38916
- 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;
38917
- if (!(0, import_node_fs63.existsSync)((0, import_node_path47.join)(top, "bin", lakeBinary()))) {
38918
- (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39376
+ const entries = (0, import_node_fs65.readdirSync)(unpack);
39377
+ 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;
39378
+ if (!(0, import_node_fs65.existsSync)((0, import_node_path50.join)(top, "bin", lakeBinary()))) {
39379
+ (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38919
39380
  return { ok: false, error: "the archive did not contain bin/lake" };
38920
39381
  }
38921
- (0, import_node_fs63.rmSync)(dir, { recursive: true, force: true });
38922
- (0, import_node_fs63.mkdirSync)(home, { recursive: true });
38923
- (0, import_node_fs63.renameSync)(top, dir);
38924
- (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39382
+ (0, import_node_fs65.rmSync)(dir, { recursive: true, force: true });
39383
+ (0, import_node_fs65.mkdirSync)(home, { recursive: true });
39384
+ (0, import_node_fs65.renameSync)(top, dir);
39385
+ (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
38925
39386
  return { ok: true, dir };
38926
39387
  }
38927
39388
 
38928
39389
  // src/lib/remote-config.ts
38929
- var import_node_fs64 = require("node:fs");
39390
+ var import_node_fs66 = require("node:fs");
38930
39391
  var import_promises19 = require("node:fs/promises");
38931
- var import_node_path48 = require("node:path");
39392
+ var import_node_path51 = require("node:path");
38932
39393
  var import_yaml5 = __toESM2(require_dist());
38933
39394
  var IGNORE_RIDER = "verityignore";
38934
39395
  async function fetchRemoteSetup(opts) {
@@ -38973,7 +39434,7 @@ async function adoptRemoteSetup(found, opts) {
38973
39434
  written.push(STANDARD_FILE);
38974
39435
  if (rider !== null) {
38975
39436
  const localIgnore = projectPath(VERITYIGNORE_FILE);
38976
- if (!(0, import_node_fs64.existsSync)(localIgnore)) {
39437
+ if (!(0, import_node_fs66.existsSync)(localIgnore)) {
38977
39438
  await writeOut(VERITYIGNORE_FILE, rider);
38978
39439
  written.push(VERITYIGNORE_FILE);
38979
39440
  } else {
@@ -39006,7 +39467,7 @@ async function adoptRemoteSetup(found, opts) {
39006
39467
  }
39007
39468
  async function writeOut(relative6, body2) {
39008
39469
  const target = projectPath(relative6);
39009
- await (0, import_promises19.mkdir)((0, import_node_path48.dirname)(target), { recursive: true });
39470
+ await (0, import_promises19.mkdir)((0, import_node_path51.dirname)(target), { recursive: true });
39010
39471
  await (0, import_promises19.writeFile)(target, body2);
39011
39472
  }
39012
39473
  function describeRemote(found) {
@@ -39123,15 +39584,15 @@ async function runOptionalAuth(resolution, opts = {}) {
39123
39584
  }
39124
39585
  function resolveDataDir2() {
39125
39586
  const candidates2 = [
39126
- (0, import_node_path49.join)(__dirname, "..", "data"),
39587
+ (0, import_node_path52.join)(__dirname, "..", "data"),
39127
39588
  // installed: node_modules/@codacy/verity-cli/data
39128
- (0, import_node_path49.join)(__dirname, "..", "..", "data"),
39589
+ (0, import_node_path52.join)(__dirname, "..", "..", "data"),
39129
39590
  // edge case: nested resolution
39130
- (0, import_node_path49.join)(process.cwd(), "cli", "data")
39591
+ (0, import_node_path52.join)(process.cwd(), "cli", "data")
39131
39592
  // local dev: running from repo root
39132
39593
  ];
39133
39594
  for (const candidate of candidates2) {
39134
- if ((0, import_node_fs65.existsSync)((0, import_node_path49.join)(candidate, "skills"))) {
39595
+ if ((0, import_node_fs67.existsSync)((0, import_node_path52.join)(candidate, "skills"))) {
39135
39596
  return candidate;
39136
39597
  }
39137
39598
  }
@@ -39147,9 +39608,9 @@ async function skillIsCurrent(src, dest) {
39147
39608
  const list2 = (dir) => {
39148
39609
  const out2 = [];
39149
39610
  const walk2 = (d, prefix) => {
39150
- for (const e of (0, import_node_fs65.readdirSync)(d, { withFileTypes: true })) {
39611
+ for (const e of (0, import_node_fs67.readdirSync)(d, { withFileTypes: true })) {
39151
39612
  const rel = prefix ? `${prefix}/${e.name}` : e.name;
39152
- if (e.isDirectory()) walk2((0, import_node_path49.join)(d, e.name), rel);
39613
+ if (e.isDirectory()) walk2((0, import_node_path52.join)(d, e.name), rel);
39153
39614
  else if (e.isFile()) out2.push(rel);
39154
39615
  }
39155
39616
  };
@@ -39160,8 +39621,8 @@ async function skillIsCurrent(src, dest) {
39160
39621
  const shipped = list2(src);
39161
39622
  if (JSON.stringify(shipped) !== JSON.stringify(list2(dest))) return false;
39162
39623
  for (const rel of shipped) {
39163
- const a = await (0, import_promises20.readFile)((0, import_node_path49.join)(src, rel), "utf-8");
39164
- const b = await (0, import_promises20.readFile)((0, import_node_path49.join)(dest, rel), "utf-8");
39624
+ const a = await (0, import_promises20.readFile)((0, import_node_path52.join)(src, rel), "utf-8");
39625
+ const b = await (0, import_promises20.readFile)((0, import_node_path52.join)(dest, rel), "utf-8");
39165
39626
  if (a !== b) return false;
39166
39627
  }
39167
39628
  return true;
@@ -39187,8 +39648,10 @@ var INTENSITY_CHOICES = [
39187
39648
  { id: "thorough", label: "thorough", hint: "all tools, all rules (~15s)" }
39188
39649
  ];
39189
39650
  var FORMAL_CHOICES = [
39190
- { id: "yes", label: "yes", hint: "a Lean model of the riskiest changed function; blocks only on a REPRODUCED counterexample", recommended: true },
39191
- { id: "no", label: "no", hint: "enable later with: verity config formal push" }
39651
+ { id: "yes", label: "yes", hint: "a Lean model of the riskiest changed function; blocks only on a REPRODUCED counterexample" },
39652
+ // No is the default (review of #255): "yes" downloads ≈800 MB and unpacks
39653
+ // 2.7 GB, and a bare Enter must never do that.
39654
+ { id: "no", label: "no", hint: "enable later with: verity config formal push", recommended: true }
39192
39655
  ];
39193
39656
  var MOMENT_CHOICES = [
39194
39657
  { id: "stop", label: "On stop", hint: "after every agent turn \u2014 fast feedback while you work", recommended: true },
@@ -39362,7 +39825,7 @@ async function synthesizeLocally(opts) {
39362
39825
  async function healStaleAnalysisConfig(globals) {
39363
39826
  const configPath = projectPath(CODACY_CONFIG_FILE);
39364
39827
  const standardPath = projectPath(STANDARD_FILE);
39365
- if (!(0, import_node_fs65.existsSync)(configPath) || !(0, import_node_fs65.existsSync)(standardPath)) return;
39828
+ if (!(0, import_node_fs67.existsSync)(configPath) || !(0, import_node_fs67.existsSync)(standardPath)) return;
39366
39829
  const validation = validatePatternIds();
39367
39830
  if (validation.status !== "invalid") return;
39368
39831
  printWarn(" Your analysis config names pattern ids that no longer resolve \u2014 those tools were");
@@ -39459,17 +39922,17 @@ async function handoffToSetup(enabled, claudeInstalled) {
39459
39922
  async function installSkills(force, step) {
39460
39923
  step("Installing skills");
39461
39924
  const dataDir = resolveDataDir2();
39462
- const skillsSource = (0, import_node_path49.join)(dataDir, "skills");
39925
+ const skillsSource = (0, import_node_path52.join)(dataDir, "skills");
39463
39926
  const skillsDest = ".claude/skills";
39464
39927
  let skillsInstalled = 0;
39465
39928
  for (const skill of SKILLS) {
39466
- const src = (0, import_node_path49.join)(skillsSource, skill);
39467
- const dest = (0, import_node_path49.join)(skillsDest, skill);
39468
- if (!(0, import_node_fs65.existsSync)(src)) {
39929
+ const src = (0, import_node_path52.join)(skillsSource, skill);
39930
+ const dest = (0, import_node_path52.join)(skillsDest, skill);
39931
+ if (!(0, import_node_fs67.existsSync)(src)) {
39469
39932
  printWarn(` Skill data not found: ${skill}`);
39470
39933
  continue;
39471
39934
  }
39472
- if ((0, import_node_fs65.existsSync)(dest) && !force && await skillIsCurrent(src, dest)) {
39935
+ if ((0, import_node_fs67.existsSync)(dest) && !force && await skillIsCurrent(src, dest)) {
39473
39936
  skillsInstalled++;
39474
39937
  continue;
39475
39938
  }
@@ -39594,16 +40057,20 @@ async function offerFormalVerification(defaultsOnly, pluginMode) {
39594
40057
  printWarn(` Formal verification: off \u2014 ${formalRefusalMessage(cfg.formal_refused)}`);
39595
40058
  return;
39596
40059
  }
39597
- const toolchain = findToolchain();
39598
40060
  if (cfg.formal === "push") {
39599
- if (toolchain) printInfo(" Formal verification at push \u2713");
40061
+ if (findToolchain()) printInfo(" Formal verification at push \u2713");
39600
40062
  else printWarn(" Formal verification is on but Lean is missing \u2014 run: verity lean install");
39601
40063
  return;
39602
40064
  }
40065
+ if (cfg.formal === "off") {
40066
+ printInfo(" Formal verification: off (enable with: verity config formal push)");
40067
+ return;
40068
+ }
39603
40069
  if (defaultsOnly || !interactive()) {
39604
40070
  printInfo(" Formal verification (a model-based bug finder at push): off \u2014 enable with: verity config formal push");
39605
40071
  return;
39606
40072
  }
40073
+ const toolchain = findToolchain();
39607
40074
  console.log("");
39608
40075
  console.log(" Formal verification review \u2014 a model-based bug finder for your riskiest code.");
39609
40076
  console.log(" At push, Verity picks the riskiest changed function, checks a small model of");
@@ -39611,9 +40078,10 @@ async function offerFormalVerification(defaultsOnly, pluginMode) {
39611
40078
  console.log(" Verity for that). Only a reproduced bug can block; most pushes get no model.");
39612
40079
  console.log(` Adds /verity-prove <worry> to check any code on demand.${toolchain ? "" : ` Needs to install Lean 4 (${LEAN_DOWNLOAD_SIZE}) on "yes".`}`);
39613
40080
  console.log("");
39614
- const wants = await promptChoice("Formal verification at push?", FORMAL_CHOICES, "yes");
40081
+ const wants = await promptChoice("Formal verification at push?", FORMAL_CHOICES, "no");
39615
40082
  if (wants === "yes" && pluginMode) printInfo(" Plugin: the push check works now; /verity:verity-prove arrives with the plugin's next release.");
39616
40083
  if (wants !== "yes") {
40084
+ writeProjectConfig({ formal: "off" });
39617
40085
  printInfo(" Formal verification: off (enable later with: verity config formal push)");
39618
40086
  return;
39619
40087
  }
@@ -39664,7 +40132,7 @@ function registerInitCommand(program2) {
39664
40132
  const staleMarker = clearStalePluginMarker();
39665
40133
  const pluginMode = opts.plugin === false ? false : opts.pluginMode ?? pluginActiveHere();
39666
40134
  const projectMarkers = [".git", "package.json", "pyproject.toml", "go.mod", "Cargo.toml", "Gemfile", "pom.xml", "build.gradle"];
39667
- const isProject = projectMarkers.some((m) => (0, import_node_fs65.existsSync)(m));
40135
+ const isProject = projectMarkers.some((m) => (0, import_node_fs67.existsSync)(m));
39668
40136
  if (!isProject) {
39669
40137
  printError("No project detected in the current directory.");
39670
40138
  printInfo('Run "verity init" from your project root.');
@@ -39767,7 +40235,7 @@ function registerInitCommand(program2) {
39767
40235
  untrackMemory: opts.untrackMemory === true,
39768
40236
  untrackState: opts.untrackState === true
39769
40237
  });
39770
- const globalVerityDir = (0, import_node_path49.join)(process.env.HOME ?? "", ".verity");
40238
+ const globalVerityDir = (0, import_node_path52.join)(process.env.HOME ?? "", ".verity");
39771
40239
  await (0, import_promises20.mkdir)(globalVerityDir, { recursive: true });
39772
40240
  console.log("");
39773
40241
  step("Wiring Claude Code hooks");
@@ -39842,7 +40310,7 @@ function registerInitCommand(program2) {
39842
40310
  }
39843
40311
  step("Your project's Standard");
39844
40312
  let haveStandard = false;
39845
- if ((0, import_node_fs65.existsSync)(projectPath(STANDARD_FILE))) {
40313
+ if ((0, import_node_fs67.existsSync)(projectPath(STANDARD_FILE))) {
39846
40314
  printInfo(" This project already has .verity/standard.yaml \u2014 keeping it.");
39847
40315
  haveStandard = true;
39848
40316
  } else {
@@ -39872,7 +40340,7 @@ function registerInitCommand(program2) {
39872
40340
  ...telemetryChoice ? { telemetry: telemetryChoice } : {},
39873
40341
  init: {
39874
40342
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
39875
- cli_version: true ? "0.34.0-experimental.421a631" : "dev"
40343
+ cli_version: true ? "0.34.0-experimental.53caba1" : "dev"
39876
40344
  }
39877
40345
  });
39878
40346
  } catch (err2) {
@@ -39922,8 +40390,8 @@ function registerInitCommand(program2) {
39922
40390
  }
39923
40391
 
39924
40392
  // src/commands/uninstall.ts
39925
- var import_node_fs66 = require("node:fs");
39926
- var import_node_path50 = require("node:path");
40393
+ var import_node_fs68 = require("node:fs");
40394
+ var import_node_path53 = require("node:path");
39927
40395
  function registerUninstallCommand(program2) {
39928
40396
  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) => {
39929
40397
  const dryRun = opts.dryRun ?? false;
@@ -39932,11 +40400,11 @@ function registerUninstallCommand(program2) {
39932
40400
  const actions = [];
39933
40401
  const skillsRoot = projectPath(".claude/skills");
39934
40402
  for (const name2 of PROJECT_SKILL_NAMES) {
39935
- const dir = (0, import_node_path50.join)(skillsRoot, name2);
39936
- if ((0, import_node_fs66.existsSync)(dir)) {
40403
+ const dir = (0, import_node_path53.join)(skillsRoot, name2);
40404
+ if ((0, import_node_fs68.existsSync)(dir)) {
39937
40405
  actions.push({
39938
40406
  label: `Remove .claude/skills/${name2}/`,
39939
- apply: () => (0, import_node_fs66.rmSync)(dir, { recursive: true, force: true })
40407
+ apply: () => (0, import_node_fs68.rmSync)(dir, { recursive: true, force: true })
39940
40408
  });
39941
40409
  }
39942
40410
  }
@@ -39950,24 +40418,24 @@ function registerUninstallCommand(program2) {
39950
40418
  });
39951
40419
  }
39952
40420
  const verityDir = projectPath(VERITY_DIR);
39953
- if ((0, import_node_fs66.existsSync)(verityDir)) {
40421
+ if ((0, import_node_fs68.existsSync)(verityDir)) {
39954
40422
  actions.push({
39955
40423
  label: `Remove ${VERITY_DIR}/`,
39956
- apply: () => (0, import_node_fs66.rmSync)(verityDir, { recursive: true, force: true })
40424
+ apply: () => (0, import_node_fs68.rmSync)(verityDir, { recursive: true, force: true })
39957
40425
  });
39958
40426
  }
39959
40427
  if (!keepVerityMd) {
39960
40428
  const verityMd = projectPath(VERITY_MD_FILE);
39961
- if ((0, import_node_fs66.existsSync)(verityMd)) {
40429
+ if ((0, import_node_fs68.existsSync)(verityMd)) {
39962
40430
  actions.push({
39963
40431
  label: `Remove ${VERITY_MD_FILE}`,
39964
- apply: () => (0, import_node_fs66.rmSync)(verityMd, { force: true })
40432
+ apply: () => (0, import_node_fs68.rmSync)(verityMd, { force: true })
39965
40433
  });
39966
40434
  }
39967
40435
  }
39968
40436
  const cleanupEmptyDir = (path) => {
39969
- if ((0, import_node_fs66.existsSync)(path) && (0, import_node_fs66.statSync)(path).isDirectory() && (0, import_node_fs66.readdirSync)(path).length === 0) {
39970
- (0, import_node_fs66.rmdirSync)(path);
40437
+ if ((0, import_node_fs68.existsSync)(path) && (0, import_node_fs68.statSync)(path).isDirectory() && (0, import_node_fs68.readdirSync)(path).length === 0) {
40438
+ (0, import_node_fs68.rmdirSync)(path);
39971
40439
  }
39972
40440
  };
39973
40441
  actions.push({
@@ -39978,11 +40446,11 @@ function registerUninstallCommand(program2) {
39978
40446
  }
39979
40447
  });
39980
40448
  const home = process.env.HOME ?? "";
39981
- const globalVerityDir = (0, import_node_path50.join)(home, ".verity");
39982
- if (purgeGlobal && (0, import_node_fs66.existsSync)(globalVerityDir)) {
40449
+ const globalVerityDir = (0, import_node_path53.join)(home, ".verity");
40450
+ if (purgeGlobal && (0, import_node_fs68.existsSync)(globalVerityDir)) {
39983
40451
  actions.push({
39984
40452
  label: `Remove ~/.verity/ (global credentials \u2014 reconnect requires re-registration)`,
39985
- apply: () => (0, import_node_fs66.rmSync)(globalVerityDir, { recursive: true, force: true })
40453
+ apply: () => (0, import_node_fs68.rmSync)(globalVerityDir, { recursive: true, force: true })
39986
40454
  });
39987
40455
  }
39988
40456
  if (actions.length === 0) {
@@ -40176,8 +40644,8 @@ function registerTaskCommands(program2) {
40176
40644
  }
40177
40645
 
40178
40646
  // src/commands/reset.ts
40179
- var import_node_fs67 = require("node:fs");
40180
- var import_node_path51 = require("node:path");
40647
+ var import_node_fs69 = require("node:fs");
40648
+ var import_node_path54 = require("node:path");
40181
40649
  function registerResetCommand(program2) {
40182
40650
  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) => {
40183
40651
  const globals = program2.opts();
@@ -40214,11 +40682,11 @@ function registerResetCommand(program2) {
40214
40682
  }
40215
40683
  const cacheDir = projectPath(CACHE_DIR);
40216
40684
  let purged = 0;
40217
- if ((0, import_node_fs67.existsSync)(cacheDir)) {
40218
- for (const entry of (0, import_node_fs67.readdirSync)(cacheDir)) {
40685
+ if ((0, import_node_fs69.existsSync)(cacheDir)) {
40686
+ for (const entry of (0, import_node_fs69.readdirSync)(cacheDir)) {
40219
40687
  if (entry.startsWith("pending-")) {
40220
40688
  try {
40221
- (0, import_node_fs67.unlinkSync)((0, import_node_path51.join)(cacheDir, entry));
40689
+ (0, import_node_fs69.unlinkSync)((0, import_node_path54.join)(cacheDir, entry));
40222
40690
  purged++;
40223
40691
  } catch {
40224
40692
  }
@@ -40233,19 +40701,19 @@ function registerResetCommand(program2) {
40233
40701
  projectPath(`${VERITY_DIR}/.last-analysis`)
40234
40702
  ];
40235
40703
  for (const file of filesToClear) {
40236
- if ((0, import_node_fs67.existsSync)(file)) {
40704
+ if ((0, import_node_fs69.existsSync)(file)) {
40237
40705
  try {
40238
- (0, import_node_fs67.writeFileSync)(file, "");
40706
+ (0, import_node_fs69.writeFileSync)(file, "");
40239
40707
  } catch {
40240
40708
  }
40241
40709
  }
40242
40710
  }
40243
40711
  if (opts.all) {
40244
40712
  const logsDir = projectPath(`${VERITY_DIR}/.logs`);
40245
- if ((0, import_node_fs67.existsSync)(logsDir)) {
40246
- for (const entry of (0, import_node_fs67.readdirSync)(logsDir)) {
40713
+ if ((0, import_node_fs69.existsSync)(logsDir)) {
40714
+ for (const entry of (0, import_node_fs69.readdirSync)(logsDir)) {
40247
40715
  try {
40248
- (0, import_node_fs67.unlinkSync)((0, import_node_path51.join)(logsDir, entry));
40716
+ (0, import_node_fs69.unlinkSync)((0, import_node_path54.join)(logsDir, entry));
40249
40717
  } catch {
40250
40718
  }
40251
40719
  }
@@ -40257,7 +40725,7 @@ function registerResetCommand(program2) {
40257
40725
  }
40258
40726
 
40259
40727
  // src/commands/reflect.ts
40260
- var import_node_fs68 = require("node:fs");
40728
+ var import_node_fs70 = require("node:fs");
40261
40729
 
40262
40730
  // src/lib/reflection-globs.ts
40263
40731
  var MAX_GLOBS = 6;
@@ -40265,7 +40733,7 @@ var PATH_TOKEN = /[A-Za-z0-9_./-]*[A-Za-z0-9_-]\.[A-Za-z0-9]{1,8}(?::\d+(?::\d+)
40265
40733
  function clean(token) {
40266
40734
  return token.replace(/:\d+(?::\d+)?$/, "").replace(/^[`'"(\[]+/, "").replace(/[`'"),\].;!?]+$/, "").replace(/^\.\//, "");
40267
40735
  }
40268
- function resolve6(token, treePaths) {
40736
+ function resolve7(token, treePaths) {
40269
40737
  if (treePaths.includes(token)) return token;
40270
40738
  const suffix = token.startsWith("/") ? token : `/${token}`;
40271
40739
  const matches = treePaths.filter((p) => p.endsWith(suffix));
@@ -40278,7 +40746,7 @@ function deriveFileGlobs(text, treePaths) {
40278
40746
  for (const raw of text.match(PATH_TOKEN) ?? []) {
40279
40747
  const token = clean(raw);
40280
40748
  if (!token) continue;
40281
- const path = resolve6(token, treePaths);
40749
+ const path = resolve7(token, treePaths);
40282
40750
  if (!path || seen.has(path)) continue;
40283
40751
  seen.add(path);
40284
40752
  out2.push(path);
@@ -40295,14 +40763,19 @@ async function writeNodeToDisk(args2) {
40295
40763
  { treePaths: listTrackedFiles(), recordBaseline: false }
40296
40764
  );
40297
40765
  if (written === 0) return false;
40298
- return (0, import_node_fs68.existsSync)(projectPath(`${VERITY_DIR}/memory/${args2.filePath}`));
40766
+ return (0, import_node_fs70.existsSync)(projectPath(`${VERITY_DIR}/memory/${args2.filePath}`));
40299
40767
  } catch {
40300
40768
  return false;
40301
40769
  }
40302
40770
  }
40303
40771
  function registerReflectCommand(program2) {
40304
- 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) => {
40772
+ 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) => {
40305
40773
  const globals = program2.opts();
40774
+ const input = readTextInput(opts.userInput, "--user-input");
40775
+ if (!input.ok) {
40776
+ printError(input.error);
40777
+ process.exit(1);
40778
+ }
40306
40779
  await ensureMemoryDir();
40307
40780
  const tokenResult = await resolveToken(globals.token);
40308
40781
  if (!tokenResult.ok) {
@@ -40363,7 +40836,7 @@ function registerReflectCommand(program2) {
40363
40836
  taskResolution = "none";
40364
40837
  printWarn("No active task found \u2014 saving as an unattached reflection.");
40365
40838
  }
40366
- const userInput = opts.userInput;
40839
+ const userInput = input.text;
40367
40840
  if (userInput) {
40368
40841
  const validKinds = ["decision", "gotcha", "pattern", "security", "quality", "intent", "domain", "integration"];
40369
40842
  const kind = validKinds.includes(opts.kind) ? opts.kind : "gotcha";
@@ -40727,9 +41200,9 @@ function registerRunCommand(program2) {
40727
41200
  }
40728
41201
 
40729
41202
  // src/commands/telemetry.ts
40730
- var import_node_fs69 = require("node:fs");
41203
+ var import_node_fs71 = require("node:fs");
40731
41204
  async function recordTelemetryChoice(choice) {
40732
- if (!(0, import_node_fs69.existsSync)(projectPath(SETUP_STATE_FILE))) return;
41205
+ if (!(0, import_node_fs71.existsSync)(projectPath(SETUP_STATE_FILE))) return;
40733
41206
  try {
40734
41207
  if ((await readSetupState())?.telemetry === choice) return;
40735
41208
  await writeSetupState({ telemetry: choice });
@@ -40806,8 +41279,8 @@ function registerTelemetryCommands(program2) {
40806
41279
  }
40807
41280
 
40808
41281
  // src/commands/prove.ts
40809
- var import_node_fs70 = require("node:fs");
40810
- var import_node_path52 = require("node:path");
41282
+ var import_node_fs72 = require("node:fs");
41283
+ var import_node_path55 = require("node:path");
40811
41284
 
40812
41285
  // src/lib/prove/hint-pool.ts
40813
41286
  var STOP2 = /* @__PURE__ */ new Set([
@@ -40934,7 +41407,13 @@ async function proveAuth(program2) {
40934
41407
  }
40935
41408
  function registerProveCommand(program2) {
40936
41409
  const prove = program2.command("prove").description("Formal verification (Lean 4) of small, risky pieces of code \u2014 on demand");
40937
- 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) => {
41410
+ 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) => {
41411
+ const hint = readTextInput(opts.hint, "--hint");
41412
+ if (!hint.ok) {
41413
+ printError(hint.error);
41414
+ process.exit(2);
41415
+ }
41416
+ opts.hint = hint.text;
40938
41417
  if (opts.hint && opts.rank === "deterministic") opts.rank = "luna";
40939
41418
  const root = repoRoot();
40940
41419
  const ranker = RANKERS[opts.rank];
@@ -40943,7 +41422,7 @@ function registerProveCommand(program2) {
40943
41422
  process.exit(2);
40944
41423
  }
40945
41424
  const limit = Math.max(1, Math.min(50, Number(opts.limit) || 10));
40946
- let signals = collectRiskSignals(root, { since: opts.since, limit, paths: paths.map((p) => (0, import_node_path52.relative)(root, (0, import_node_path52.resolve)(p)) || ".") });
41425
+ let signals = collectRiskSignals(root, { since: opts.since, limit, paths: paths.map((p) => (0, import_node_path55.relative)(root, (0, import_node_path55.resolve)(p)) || ".") });
40947
41426
  if (opts.hint && paths.length === 0) {
40948
41427
  const hit = hintMatches(root, opts.hint);
40949
41428
  if (hit.files.length > 0) {
@@ -40997,7 +41476,7 @@ function registerProveCommand(program2) {
40997
41476
  });
40998
41477
  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) => {
40999
41478
  const root = repoRoot();
41000
- if (!(0, import_node_fs70.existsSync)((0, import_node_path52.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41479
+ if (!(0, import_node_fs72.existsSync)((0, import_node_path55.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41001
41480
  printError(`No ${PROOFS_DIR}/ project here. Run \`verity prove init\` first.`);
41002
41481
  process.exit(2);
41003
41482
  }
@@ -41021,7 +41500,7 @@ ${build.stderr.split("\n").filter((l) => !l.startsWith("trace:")).slice(0, 20).j
41021
41500
  const reports = [];
41022
41501
  for (const f of files) {
41023
41502
  const report = checkModel(tc, root, f, { timeoutMs: Math.max(1e3, Number(opts.timeout) || 12e4) });
41024
- report.file = (0, import_node_path52.relative)(root, f);
41503
+ report.file = (0, import_node_path55.relative)(root, f);
41025
41504
  reports.push(report);
41026
41505
  try {
41027
41506
  writeResult(root, report);
@@ -41059,7 +41538,7 @@ ${build.stderr.split("\n").filter((l) => !l.startsWith("trace:")).slice(0, 20).j
41059
41538
  printError("Not logged in \u2014 replays run on the Verity service. Run `verity login` first.");
41060
41539
  process.exit(2);
41061
41540
  }
41062
- if (!(0, import_node_fs70.existsSync)((0, import_node_path52.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41541
+ if (!(0, import_node_fs72.existsSync)((0, import_node_path55.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41063
41542
  printError(`No ${PROOFS_DIR}/ project here. Run \`verity prove init\` first.`);
41064
41543
  process.exit(2);
41065
41544
  }
@@ -41090,7 +41569,7 @@ ${report.error ?? ""}`);
41090
41569
  printInfo(opts.property ? `${model} ${opts.property} has no counterexample to replay` : `${model} has no counterexample to replay`);
41091
41570
  return;
41092
41571
  }
41093
- const modelSource = readRegularFileInRoot(root, (0, import_node_path52.relative)(root, file), 512 * 1024);
41572
+ const modelSource = readRegularFileInRoot(root, (0, import_node_path55.relative)(root, file), 512 * 1024);
41094
41573
  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`);
41095
41574
  const outcomes = await mapPool(targets, REPLAY_CONCURRENCY, async (p) => {
41096
41575
  const brief = buildReplayBrief(root, report, p, modelSource.ok ? modelSource.content : "");
@@ -41110,7 +41589,7 @@ ${report.error ?? ""}`);
41110
41589
  });
41111
41590
  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) => {
41112
41591
  const root = repoRoot();
41113
- let files = paths.map((p) => (0, import_node_path52.relative)(root, (0, import_node_path52.resolve)(p)));
41592
+ let files = paths.map((p) => (0, import_node_path55.relative)(root, (0, import_node_path55.resolve)(p)));
41114
41593
  if (files.length === 0) {
41115
41594
  const ahead = runGitSync(root, ["diff", "--name-only", "@{upstream}...HEAD"]);
41116
41595
  const fallback = ahead.ok ? ahead : runGitSync(root, ["diff", "--name-only", "HEAD~1..HEAD"]);
@@ -41139,7 +41618,19 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41139
41618
  }
41140
41619
  process.exit(outcome.findings.some((f) => f.verdict === "reproduced") ? 1 : 0);
41141
41620
  });
41142
- 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) => {
41621
+ 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) => {
41622
+ if (opts.hint === "-" && opts.note === "-") {
41623
+ printError("Only one of --hint and --note can read stdin (-).");
41624
+ process.exit(2);
41625
+ }
41626
+ for (const flag of ["hint", "note"]) {
41627
+ const input = readTextInput(opts[flag], `--${flag}`);
41628
+ if (!input.ok) {
41629
+ printError(input.error);
41630
+ process.exit(2);
41631
+ }
41632
+ opts[flag] = input.text;
41633
+ }
41143
41634
  const root = repoRoot();
41144
41635
  const auth2 = await proveAuth(program2);
41145
41636
  if (!auth2 && !(process.env.VERITY_PROVE_DIRECT === "1" && process.env.OPENAI_API_KEY)) {
@@ -41170,9 +41661,9 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41170
41661
  let revise;
41171
41662
  if (opts.revise) {
41172
41663
  const existing = resolveModelFile(root, opts.revise);
41173
- const src = existing ? readRegularFileInRoot(root, (0, import_node_path52.relative)(root, existing), 64 * 1024) : null;
41664
+ const src = existing ? readRegularFileInRoot(root, (0, import_node_path55.relative)(root, existing), 64 * 1024) : null;
41174
41665
  if (!src || !src.ok || !opts.note) {
41175
- printError('--revise needs an existing model under Models/ and --note "<what the replay showed>"');
41666
+ printError("--revise needs an existing model under Models/ and --note - with what the replay showed on stdin");
41176
41667
  process.exit(2);
41177
41668
  }
41178
41669
  revise = { source: src.content, note: opts.note };
@@ -41209,8 +41700,8 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41209
41700
  });
41210
41701
  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) => {
41211
41702
  const root = repoRoot();
41212
- const rel0 = (0, import_node_path52.relative)(root, (0, import_node_path52.isAbsolute)(file) ? file : (0, import_node_path52.join)(root, file)).replace(/\\/g, "/");
41213
- const rel = rel0.startsWith("..") || (0, import_node_path52.isAbsolute)(rel0) ? null : rel0;
41703
+ const rel0 = (0, import_node_path55.relative)(root, (0, import_node_path55.isAbsolute)(file) ? file : (0, import_node_path55.join)(root, file)).replace(/\\/g, "/");
41704
+ const rel = rel0.startsWith("..") || (0, import_node_path55.isAbsolute)(rel0) ? null : rel0;
41214
41705
  if (!rel) {
41215
41706
  printError(`${file} is not inside this repository`);
41216
41707
  process.exit(2);
@@ -41226,8 +41717,8 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41226
41717
  });
41227
41718
  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) => {
41228
41719
  const root = repoRoot();
41229
- const rel = (0, import_node_path52.relative)(root, (0, import_node_path52.isAbsolute)(file) ? file : (0, import_node_path52.join)(root, file));
41230
- const digest = rel.startsWith("..") || (0, import_node_path52.isAbsolute)(rel) ? null : sha256InRoot(root, rel);
41720
+ const rel = (0, import_node_path55.relative)(root, (0, import_node_path55.isAbsolute)(file) ? file : (0, import_node_path55.join)(root, file));
41721
+ const digest = rel.startsWith("..") || (0, import_node_path55.isAbsolute)(rel) ? null : sha256InRoot(root, rel);
41231
41722
  if (!digest) {
41232
41723
  printError(`Cannot hash ${file}: it must be a regular file inside this repository (not a symlink)`);
41233
41724
  process.exit(2);
@@ -41261,10 +41752,10 @@ function refreshScaffold(root) {
41261
41752
  }
41262
41753
 
41263
41754
  // src/commands/lean.ts
41264
- var import_node_fs71 = require("node:fs");
41755
+ var import_node_fs73 = require("node:fs");
41265
41756
  var import_node_child_process20 = require("node:child_process");
41266
41757
  var import_node_os11 = require("node:os");
41267
- var import_node_path53 = require("node:path");
41758
+ var import_node_path56 = require("node:path");
41268
41759
  function registerLeanCommand(program2) {
41269
41760
  const lean = program2.command("lean").description("The Lean 4 toolchain formal verification needs (managed download, pinned by this CLI)");
41270
41761
  lean.command("status").option("--json", "Machine-readable output").description("Which toolchain would run, and whether it matches the pinned version").action((opts) => {
@@ -41281,7 +41772,7 @@ function registerLeanCommand(program2) {
41281
41772
  const managed = pinnedVersionDir();
41282
41773
  const matches = version ? version.includes(pin) : false;
41283
41774
  if (opts.json) {
41284
- 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() });
41775
+ 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() });
41285
41776
  return;
41286
41777
  }
41287
41778
  printInfo(`pinned: ${LEAN_TOOLCHAIN}`);
@@ -41299,7 +41790,7 @@ function registerLeanCommand(program2) {
41299
41790
  process.exit(2);
41300
41791
  }
41301
41792
  const dir = pinnedVersionDir();
41302
- if ((0, import_node_fs71.existsSync)((0, import_node_path53.join)(dir, "bin", "lake")) && !opts.force) {
41793
+ if ((0, import_node_fs73.existsSync)((0, import_node_path56.join)(dir, "bin", "lake")) && !opts.force) {
41303
41794
  printInfo(`already installed at ${dir}`);
41304
41795
  return;
41305
41796
  }
@@ -41335,18 +41826,18 @@ function registerLeanCommand(program2) {
41335
41826
  });
41336
41827
  lean.command("remove").description("Delete the Verity-managed toolchain for the pinned version").action(() => {
41337
41828
  const dir = pinnedVersionDir();
41338
- if (!(0, import_node_fs71.existsSync)(dir)) {
41829
+ if (!(0, import_node_fs73.existsSync)(dir)) {
41339
41830
  printInfo("nothing to remove");
41340
41831
  return;
41341
41832
  }
41342
- (0, import_node_fs71.rmSync)(dir, { recursive: true, force: true });
41833
+ (0, import_node_fs73.rmSync)(dir, { recursive: true, force: true });
41343
41834
  printInfo(`removed ${dir}`);
41344
41835
  });
41345
41836
  }
41346
41837
 
41347
41838
  // src/cli.ts
41348
- program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.421a631").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) => {
41349
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.421a631");
41839
+ program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.53caba1").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) => {
41840
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.53caba1");
41350
41841
  setUserNamedServiceUrl(program.opts().serviceUrl);
41351
41842
  try {
41352
41843
  await foldLegacyLocalCredential();