@codacy/verity-cli 0.34.0-experimental.380b51f → 0.34.0-experimental.3d4888f

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
@@ -20058,97 +20058,6 @@ var LEGACY_MD_END = "<!-- gate-memory:end -->";
20058
20058
  var LEGACY_PRESERVE_START = "<!-- gate-memory:preserve -->";
20059
20059
  var LEGACY_PRESERVE_END = "<!-- /gate-memory:preserve -->";
20060
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 = [
20152
20061
  "## Project Memory",
20153
20062
  "",
20154
20063
  "This project has a knowledge graph maintained at `.verity/memory/`. Before starting",
@@ -20590,7 +20499,6 @@ function stripKnownProse(interior) {
20590
20499
  const trimmed = interior.replace(/^\n+/, "");
20591
20500
  for (const prose of [
20592
20501
  CLAUDE_MD_PROSE,
20593
- CLAUDE_MD_PROSE_PRE_STDIN,
20594
20502
  CLAUDE_MD_PROSE_PRE_ORG,
20595
20503
  CLAUDE_MD_PROSE_PRE_AUTORECORD,
20596
20504
  CLAUDE_MD_PROSE_PRE_REFLECT,
@@ -24952,56 +24860,20 @@ function registerStatusCommand(program2) {
24952
24860
  });
24953
24861
  }
24954
24862
 
24955
- // src/lib/text-input.ts
24956
- var import_node_fs39 = require("node:fs");
24957
- var MAX_STDIN_BYTES = 64 * 1024;
24958
- function readTextInput(value, flag, readStdin2 = () => (0, import_node_fs39.readFileSync)(0)) {
24959
- if (value !== "-") return { ok: true, text: value };
24960
- let raw;
24961
- try {
24962
- raw = readStdin2();
24963
- } catch (err2) {
24964
- return { ok: false, error: `Could not read ${flag} from stdin: ${err2.message}` };
24965
- }
24966
- if (raw.length > MAX_STDIN_BYTES) {
24967
- return { ok: false, error: `${flag} from stdin is ${raw.length} bytes; the limit is ${MAX_STDIN_BYTES}.` };
24968
- }
24969
- const text = raw.toString("utf8").replace(/\r?\n$/, "");
24970
- if (!text.trim()) return { ok: false, error: `${flag} from stdin is empty.` };
24971
- return { ok: true, text };
24972
- }
24973
-
24974
- // src/lib/terminal-text.ts
24975
- var CONTROL = /[\x00-\x08\x0b-\x1f\x7f-\x9f\u061c\u200e\u200f\u2028-\u202e\u2066-\u2069]/g;
24976
- function terminalText(value, max = 4e3) {
24977
- if (typeof value !== "string") return "";
24978
- const clean2 = value.replace(CONTROL, "");
24979
- return clean2.length > max ? `${clean2.slice(0, max - 1)}\u2026` : clean2;
24980
- }
24981
- function terminalUrl(value) {
24982
- const clean2 = terminalText(value, 2e3);
24983
- return /^https?:\/\/\S+$/.test(clean2) ? clean2 : "";
24984
- }
24985
-
24986
24863
  // src/commands/feedback.ts
24987
24864
  function registerFeedbackCommand(program2) {
24988
24865
  const feedbackCmd = program2.command("feedback").description("Send feedback to the Verity team");
24989
- feedbackCmd.command("message <text>").description("Send general feedback (- reads the message from stdin, so the words never pass through shell quoting)").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (text, opts) => {
24990
- await sendMessageArg(text, opts, program2.opts());
24866
+ feedbackCmd.command("message <text>").description("Send general feedback").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (message, opts) => {
24867
+ const globals = program2.opts();
24868
+ await sendGeneralFeedback(message, opts, globals);
24991
24869
  });
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) => {
24870
+ feedbackCmd.command("finding <run-id> <pattern-id> <action> [note]").description("Submit per-finding feedback (false_positive, acknowledged, useful, etc.)").option("--file <path>", "File path the finding applies to").option("--line <n>", "Line number", parseInt).action(async (runId, patternId, action, note, opts) => {
24993
24871
  const globals = program2.opts();
24994
24872
  const validActions = ["false_positive", "acknowledged", "will_fix_later", "wrong_severity", "useful"];
24995
24873
  if (!validActions.includes(action)) {
24996
24874
  printError(`Invalid action "${action}". Must be one of: ${validActions.join(", ")}`);
24997
24875
  process.exit(1);
24998
24876
  }
24999
- const noteInput = readTextInput(inlineNote, "the note");
25000
- if (!noteInput.ok) {
25001
- printError(noteInput.error);
25002
- process.exit(1);
25003
- }
25004
- const note = noteInput.text;
25005
24877
  const tokenResult = await resolveToken(globals.token);
25006
24878
  if (!tokenResult.ok) {
25007
24879
  printError(tokenResult.error);
@@ -25037,28 +24909,21 @@ function registerFeedbackCommand(program2) {
25037
24909
  });
25038
24910
  feedbackCmd.argument("[message]", "Feedback message (for backwards compat)").option("--session-id <id>", "Session identifier").option("--model <name>", "Agent model name").action(async (message, opts) => {
25039
24911
  if (!message) return;
25040
- await sendMessageArg(message, opts, program2.opts());
24912
+ const globals = program2.opts();
24913
+ await sendGeneralFeedback(message, opts, globals);
25041
24914
  });
25042
24915
  }
25043
- async function sendMessageArg(arg, opts, globals) {
25044
- const input = readTextInput(arg, "the message");
25045
- if (!input.ok || !input.text) {
25046
- printError(input.ok ? "Nothing to send." : input.error);
25047
- process.exit(1);
25048
- }
25049
- await sendGeneralFeedback(input.text, opts, globals);
25050
- }
25051
24916
  async function sendGeneralFeedback(message, opts, globals) {
25052
24917
  const tokenResult = await resolveToken(globals.token);
25053
24918
  if (!tokenResult.ok) {
25054
24919
  printError(tokenResult.error);
25055
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24920
+ printInfo(`Your message: ${message}`);
25056
24921
  process.exit(1);
25057
24922
  }
25058
24923
  const urlResult = await resolveServiceUrl(globals.serviceUrl);
25059
24924
  if (!urlResult.ok) {
25060
24925
  printError(urlResult.error);
25061
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24926
+ printInfo(`Your message: ${message}`);
25062
24927
  process.exit(1);
25063
24928
  }
25064
24929
  const body2 = { message };
@@ -25076,7 +24941,7 @@ async function sendGeneralFeedback(message, opts, globals) {
25076
24941
  });
25077
24942
  if (!result.ok) {
25078
24943
  printError(`Couldn't send feedback: ${result.error}`);
25079
- printInfo(`Your message: ${terminalText(message, message.length)}`);
24944
+ printInfo(`Your message: ${message}`);
25080
24945
  process.exit(1);
25081
24946
  }
25082
24947
  printInfo("Thanks, feedback sent!");
@@ -25161,7 +25026,7 @@ function createRun(opts, globals) {
25161
25026
  }
25162
25027
 
25163
25028
  // src/commands/analyze/index.ts
25164
- var import_node_fs53 = require("node:fs");
25029
+ var import_node_fs52 = require("node:fs");
25165
25030
  var import_node_path40 = require("node:path");
25166
25031
 
25167
25032
  // src/lib/repo-context.ts
@@ -26126,7 +25991,7 @@ function installRunEvidence(run4) {
26126
25991
  }
26127
25992
 
26128
25993
  // src/lib/git-frame.ts
26129
- var import_node_fs40 = require("node:fs");
25994
+ var import_node_fs39 = require("node:fs");
26130
25995
  var import_node_os6 = require("node:os");
26131
25996
  var import_node_path30 = require("node:path");
26132
25997
  var import_node_path31 = require("node:path");
@@ -26296,14 +26161,14 @@ function gitAt(dir, args2) {
26296
26161
  }
26297
26162
  function realpathOr2(p) {
26298
26163
  try {
26299
- return import_node_fs40.realpathSync.native(p);
26164
+ return import_node_fs39.realpathSync.native(p);
26300
26165
  } catch {
26301
26166
  return (0, import_node_path30.resolve)(p);
26302
26167
  }
26303
26168
  }
26304
26169
  function resolveFrame(input) {
26305
26170
  const found = findMomentSegment(input.command, input.on);
26306
- const hookDirUsable = !!input.hookCwd && (0, import_node_fs40.existsSync)(input.hookCwd);
26171
+ const hookDirUsable = !!input.hookCwd && (0, import_node_fs39.existsSync)(input.hookCwd);
26307
26172
  const baseDir = hookDirUsable ? input.hookCwd : process.cwd();
26308
26173
  let anchor = hookDirUsable ? "hook-cwd" : "process-cwd";
26309
26174
  const refuse = (refusal) => ({
@@ -26326,7 +26191,7 @@ function resolveFrame(input) {
26326
26191
  if (dirs.size > 1) return refuse(`target:multiple ${found.moment} targets in one command`);
26327
26192
  const targetDir = dirs.size === 1 ? [...dirs][0] : baseDir;
26328
26193
  if (targetDir !== baseDir) {
26329
- if (!(0, import_node_fs40.existsSync)(targetDir)) return refuse(`target:directory does not exist: ${targetDir}`);
26194
+ if (!(0, import_node_fs39.existsSync)(targetDir)) return refuse(`target:directory does not exist: ${targetDir}`);
26330
26195
  dir = targetDir;
26331
26196
  }
26332
26197
  }
@@ -26513,7 +26378,7 @@ function stagedRange(frame, command) {
26513
26378
  return { kind: "staged", base: "HEAD", head: "INDEX", via: "staged-in-command", refusal: plan.reason };
26514
26379
  }
26515
26380
  const mergeHead = frame.gitDir ? (0, import_node_path31.join)(frame.gitDir, "MERGE_HEAD") : null;
26516
- if (mergeHead && (0, import_node_fs40.existsSync)(mergeHead)) {
26381
+ if (mergeHead && (0, import_node_fs39.existsSync)(mergeHead)) {
26517
26382
  const vsHead = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "HEAD"]).split("\n").filter(Boolean));
26518
26383
  const vsMerge = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "MERGE_HEAD"]).split("\n").filter(Boolean));
26519
26384
  const resolutions = new Set([...vsHead].filter((f) => vsMerge.has(f) && !isVerityOwnedPath(f)));
@@ -26647,7 +26512,7 @@ function truthy(v) {
26647
26512
  }
26648
26513
 
26649
26514
  // src/lib/transcript.ts
26650
- var import_node_fs41 = require("node:fs");
26515
+ var import_node_fs40 = require("node:fs");
26651
26516
  var MAX_READ_BYTES = 256 * 1024;
26652
26517
  var SMALL_FILE_BYTES = 64 * 1024;
26653
26518
  var MAX_FILES_LIST = 20;
@@ -26674,7 +26539,7 @@ async function extractActionSummary(transcriptPath) {
26674
26539
  function readTurnLines(transcriptPath) {
26675
26540
  let size;
26676
26541
  try {
26677
- size = (0, import_node_fs41.statSync)(transcriptPath).size;
26542
+ size = (0, import_node_fs40.statSync)(transcriptPath).size;
26678
26543
  } catch {
26679
26544
  return null;
26680
26545
  }
@@ -26682,7 +26547,7 @@ function readTurnLines(transcriptPath) {
26682
26547
  let raw;
26683
26548
  let windowed = false;
26684
26549
  if (size <= SMALL_FILE_BYTES) {
26685
- raw = (0, import_node_fs41.readFileSync)(transcriptPath, "utf-8");
26550
+ raw = (0, import_node_fs40.readFileSync)(transcriptPath, "utf-8");
26686
26551
  } else {
26687
26552
  windowed = true;
26688
26553
  const buf = Buffer.alloc(Math.min(MAX_READ_BYTES, size));
@@ -27252,7 +27117,7 @@ function channelSilence(input) {
27252
27117
  // src/lib/cli-version.ts
27253
27118
  function cliVersion() {
27254
27119
  try {
27255
- return true ? "0.34.0-experimental.380b51f" : "dev";
27120
+ return true ? "0.34.0-experimental.3d4888f" : "dev";
27256
27121
  } catch {
27257
27122
  return "dev";
27258
27123
  }
@@ -27293,7 +27158,7 @@ async function sendSkipBeacon(ctx, reason) {
27293
27158
 
27294
27159
  // src/lib/static-analysis.ts
27295
27160
  var import_node_child_process12 = require("node:child_process");
27296
- var import_node_fs42 = require("node:fs");
27161
+ var import_node_fs41 = require("node:fs");
27297
27162
  var SEVERITY_ORDER = {
27298
27163
  Error: 0,
27299
27164
  Critical: 0,
@@ -27349,7 +27214,7 @@ function runCodacyAnalysis(files) {
27349
27214
  if (files.length === 0) return empty;
27350
27215
  const existingFiles = files.filter((f) => {
27351
27216
  try {
27352
- return (0, import_node_fs42.existsSync)(f);
27217
+ return (0, import_node_fs41.existsSync)(f);
27353
27218
  } catch {
27354
27219
  return false;
27355
27220
  }
@@ -27618,7 +27483,7 @@ async function scope(run4) {
27618
27483
  }
27619
27484
 
27620
27485
  // src/lib/specs.ts
27621
- var import_node_fs43 = require("node:fs");
27486
+ var import_node_fs42 = require("node:fs");
27622
27487
  var import_node_path32 = require("node:path");
27623
27488
  var SPEC_CANDIDATES = [
27624
27489
  "CLAUDE.md",
@@ -27660,7 +27525,7 @@ function discoverSpecs(consulted = []) {
27660
27525
  const totalCap = relevant ? MAX_TOTAL_SPEC_BYTES : UNCONSULTED_TOTAL_BYTES;
27661
27526
  if (totalBytes >= totalCap) return false;
27662
27527
  if (seen.has(specPath)) return true;
27663
- if (!(0, import_node_fs43.existsSync)(specPath)) return true;
27528
+ if (!(0, import_node_fs42.existsSync)(specPath)) return true;
27664
27529
  seen.add(specPath);
27665
27530
  const remaining = totalCap - totalBytes;
27666
27531
  const fileCap = relevant ? MAX_SPEC_FILE_BYTES : UNCONSULTED_FILE_BYTES;
@@ -27683,7 +27548,7 @@ function discoverSpecs(consulted = []) {
27683
27548
  if (!addSpec(candidate)) break;
27684
27549
  }
27685
27550
  for (const dir of ["spec", "docs"]) {
27686
- if (!(0, import_node_fs43.existsSync)(dir)) continue;
27551
+ if (!(0, import_node_fs42.existsSync)(dir)) continue;
27687
27552
  try {
27688
27553
  const mdFiles = findMdFiles(dir, 2).sort();
27689
27554
  for (const mdFile of mdFiles) {
@@ -27698,7 +27563,7 @@ function findMdFiles(dir, maxDepth, depth = 0) {
27698
27563
  if (depth >= maxDepth) return [];
27699
27564
  const result = [];
27700
27565
  try {
27701
- const entries = (0, import_node_fs43.readdirSync)(dir, { withFileTypes: true });
27566
+ const entries = (0, import_node_fs42.readdirSync)(dir, { withFileTypes: true });
27702
27567
  for (const entry of entries) {
27703
27568
  const fullPath = (0, import_node_path32.join)(dir, entry.name);
27704
27569
  if (entry.isFile() && entry.name.endsWith(".md")) {
@@ -27718,13 +27583,13 @@ function discoverPlans() {
27718
27583
  if (isRealDirectoryChain(process.cwd(), [".claude", "plans"])) {
27719
27584
  sources.push({ root: process.cwd(), prefix: (0, import_node_path32.join)(".claude", "plans") });
27720
27585
  }
27721
- if (home && (0, import_node_fs43.existsSync)(homePlansDir)) sources.push({ root: homePlansDir, prefix: "" });
27586
+ if (home && (0, import_node_fs42.existsSync)(homePlansDir)) sources.push({ root: homePlansDir, prefix: "" });
27722
27587
  const candidates2 = [];
27723
27588
  const seen = /* @__PURE__ */ new Set();
27724
27589
  for (const source2 of sources) {
27725
27590
  let names2;
27726
27591
  try {
27727
- names2 = (0, import_node_fs43.readdirSync)(source2.prefix ? (0, import_node_path32.join)(source2.root, source2.prefix) : source2.root);
27592
+ names2 = (0, import_node_fs42.readdirSync)(source2.prefix ? (0, import_node_path32.join)(source2.root, source2.prefix) : source2.root);
27728
27593
  } catch {
27729
27594
  continue;
27730
27595
  }
@@ -27751,7 +27616,7 @@ function isRealDirectoryChain(root, parts2) {
27751
27616
  for (const part of parts2) {
27752
27617
  current = (0, import_node_path32.join)(current, part);
27753
27618
  try {
27754
- if (!(0, import_node_fs43.lstatSync)(current).isDirectory()) return false;
27619
+ if (!(0, import_node_fs42.lstatSync)(current).isDirectory()) return false;
27755
27620
  } catch {
27756
27621
  return false;
27757
27622
  }
@@ -27766,7 +27631,7 @@ function discoverGuardDocs(rangeFiles2) {
27766
27631
  if (result.length >= MAX_SPEC_FILES) break;
27767
27632
  if (!GUARD_DOC_EXT.test(path)) continue;
27768
27633
  if (path.startsWith("/") || path.includes("..")) continue;
27769
- if (!(0, import_node_fs43.existsSync)(path)) continue;
27634
+ if (!(0, import_node_fs42.existsSync)(path)) continue;
27770
27635
  const opened = openRegularInRoot(process.cwd(), path);
27771
27636
  if (!opened.ok) continue;
27772
27637
  if (opened.size > MAX_PLAN_FILE_BYTES || totalBytes + opened.size > MAX_TOTAL_SPEC_BYTES) {
@@ -27952,7 +27817,7 @@ async function mode(run4) {
27952
27817
  }
27953
27818
 
27954
27819
  // src/lib/fold.ts
27955
- var import_node_fs44 = require("node:fs");
27820
+ var import_node_fs43 = require("node:fs");
27956
27821
  var import_node_path33 = require("node:path");
27957
27822
  var KNOWN_RECORD_TYPES = /* @__PURE__ */ new Set([
27958
27823
  "user",
@@ -28090,7 +27955,7 @@ function candidateRoots(repoRoot2) {
28090
27955
  const norm2 = repoRoot2.replace(/\\/g, "/").replace(/\/+$/, "");
28091
27956
  const out2 = [norm2];
28092
27957
  try {
28093
- const real = import_node_fs44.realpathSync.native(norm2).replace(/\\/g, "/").replace(/\/+$/, "");
27958
+ const real = import_node_fs43.realpathSync.native(norm2).replace(/\\/g, "/").replace(/\/+$/, "");
28094
27959
  if (real !== norm2) out2.push(real);
28095
27960
  } catch {
28096
27961
  }
@@ -28178,8 +28043,8 @@ function fold(transcriptPath, opts = {}) {
28178
28043
  }
28179
28044
  };
28180
28045
  try {
28181
- if (!(0, import_node_fs44.existsSync)(transcriptPath)) return result;
28182
- ingest((0, import_node_fs44.readFileSync)(transcriptPath, "utf8"), "agent");
28046
+ if (!(0, import_node_fs43.existsSync)(transcriptPath)) return result;
28047
+ ingest((0, import_node_fs43.readFileSync)(transcriptPath, "utf8"), "agent");
28183
28048
  result.coverage.complete = true;
28184
28049
  } catch {
28185
28050
  return result;
@@ -28190,19 +28055,19 @@ function fold(transcriptPath, opts = {}) {
28190
28055
  (0, import_node_path33.basename)(transcriptPath).replace(/\.jsonl$/, ""),
28191
28056
  "subagents"
28192
28057
  );
28193
- if ((0, import_node_fs44.existsSync)(sidecarDir)) {
28058
+ if ((0, import_node_fs43.existsSync)(sidecarDir)) {
28194
28059
  const maxFiles = opts.maxSidecars ?? 200;
28195
28060
  const maxBytes = opts.maxSidecarBytes ?? 16 * 1024 * 1024;
28196
28061
  const found = [];
28197
28062
  const walk2 = (d, depth) => {
28198
28063
  if (depth > 4) return;
28199
- for (const e of (0, import_node_fs44.readdirSync)(d, { withFileTypes: true })) {
28064
+ for (const e of (0, import_node_fs43.readdirSync)(d, { withFileTypes: true })) {
28200
28065
  const p = (0, import_node_path33.join)(d, e.name);
28201
28066
  if (e.isDirectory()) {
28202
28067
  walk2(p, depth + 1);
28203
28068
  } else if (e.name.startsWith("agent-") && e.name.endsWith(".jsonl")) {
28204
28069
  try {
28205
- const st = (0, import_node_fs44.statSync)(p);
28070
+ const st = (0, import_node_fs43.statSync)(p);
28206
28071
  found.push({ path: p, size: st.size, mtimeMs: st.mtimeMs });
28207
28072
  } catch {
28208
28073
  result.coverage.malformed++;
@@ -28219,7 +28084,7 @@ function fold(transcriptPath, opts = {}) {
28219
28084
  continue;
28220
28085
  }
28221
28086
  try {
28222
- ingest((0, import_node_fs44.readFileSync)(f.path, "utf8"), "subagent");
28087
+ ingest((0, import_node_fs43.readFileSync)(f.path, "utf8"), "subagent");
28223
28088
  bytes += f.size;
28224
28089
  result.coverage.subagentFiles++;
28225
28090
  } catch {
@@ -28254,7 +28119,7 @@ function fold(transcriptPath, opts = {}) {
28254
28119
  }
28255
28120
  function classifyUnobserved(path) {
28256
28121
  try {
28257
- const st = (0, import_node_fs44.statSync)(path);
28122
+ const st = (0, import_node_fs43.statSync)(path);
28258
28123
  if (!st.isFile()) return "unreadable";
28259
28124
  } catch {
28260
28125
  return "unreadable";
@@ -28569,20 +28434,20 @@ async function evidence(run4) {
28569
28434
  }
28570
28435
 
28571
28436
  // src/lib/cache-cleanup.ts
28572
- var import_node_fs45 = require("node:fs");
28437
+ var import_node_fs44 = require("node:fs");
28573
28438
  var import_node_path34 = require("node:path");
28574
28439
  var CACHE_TTL_DAYS = 7;
28575
28440
  function pruneStaleCache() {
28576
28441
  try {
28577
28442
  const dir = projectPath(CACHE_DIR);
28578
28443
  const cutoff = Date.now() - CACHE_TTL_DAYS * 24 * 3600 * 1e3;
28579
- for (const entry of (0, import_node_fs45.readdirSync)(dir)) {
28444
+ for (const entry of (0, import_node_fs44.readdirSync)(dir)) {
28580
28445
  if (!entry.startsWith("pending-")) continue;
28581
28446
  const path = (0, import_node_path34.join)(dir, entry);
28582
28447
  try {
28583
- const stat3 = (0, import_node_fs45.statSync)(path);
28448
+ const stat3 = (0, import_node_fs44.statSync)(path);
28584
28449
  if (stat3.mtimeMs < cutoff) {
28585
- (0, import_node_fs45.unlinkSync)(path);
28450
+ (0, import_node_fs44.unlinkSync)(path);
28586
28451
  logEvent("cache_entry_pruned", {
28587
28452
  path: entry,
28588
28453
  age_days: Math.round((Date.now() - stat3.mtimeMs) / 864e5)
@@ -28596,7 +28461,7 @@ function pruneStaleCache() {
28596
28461
  }
28597
28462
 
28598
28463
  // src/lib/context-files.ts
28599
- var import_node_fs46 = require("node:fs");
28464
+ var import_node_fs45 = require("node:fs");
28600
28465
  var import_node_os7 = require("node:os");
28601
28466
  var MAX_CONTEXT_FILES = 10;
28602
28467
  var MAX_CONTEXT_FILE_BYTES = 10240;
@@ -28654,7 +28519,7 @@ function gatherContextFiles(contextPaths, deltaFiles, opts) {
28654
28519
  continue;
28655
28520
  }
28656
28521
  try {
28657
- const content = (0, import_node_fs46.readFileSync)(safePath, "utf8");
28522
+ const content = (0, import_node_fs45.readFileSync)(safePath, "utf8");
28658
28523
  const bytes = Buffer.byteLength(content);
28659
28524
  if (bytes > MAX_CONTEXT_FILE_BYTES) {
28660
28525
  logEvent("context_file_skipped", { path: filePath, reason: "too_large", bytes });
@@ -28812,7 +28677,7 @@ function languageOf2(path) {
28812
28677
  }
28813
28678
 
28814
28679
  // src/lib/code/runtime.ts
28815
- var import_node_fs47 = require("node:fs");
28680
+ var import_node_fs46 = require("node:fs");
28816
28681
  var import_node_path35 = require("node:path");
28817
28682
  var import_web_tree_sitter2 = __toESM2(require_web_tree_sitter2());
28818
28683
 
@@ -28884,7 +28749,7 @@ function grammarCandidates(file, pkg, env = process.env) {
28884
28749
  }
28885
28750
  function locateGrammar(id, env = process.env) {
28886
28751
  const g = grammars_default[id];
28887
- return grammarCandidates(g.file, g.package, env).find((p) => (0, import_node_fs47.existsSync)(p)) ?? null;
28752
+ return grammarCandidates(g.file, g.package, env).find((p) => (0, import_node_fs46.existsSync)(p)) ?? null;
28888
28753
  }
28889
28754
  var loading = null;
28890
28755
  function loadRuntime(env = process.env) {
@@ -31213,7 +31078,7 @@ async function repoContext(run4) {
31213
31078
 
31214
31079
  // src/lib/seed-runner.ts
31215
31080
  var import_promises15 = require("node:fs/promises");
31216
- var import_node_fs48 = require("node:fs");
31081
+ var import_node_fs47 = require("node:fs");
31217
31082
  var import_node_path36 = require("node:path");
31218
31083
  var import_yaml4 = __toESM2(require_dist());
31219
31084
 
@@ -31438,7 +31303,7 @@ async function localSeedTitles(memoryDir3 = MEMORY_DIR) {
31438
31303
  const titles = /* @__PURE__ */ new Set();
31439
31304
  for (const dir of NODE_DIRS) {
31440
31305
  const full = (0, import_node_path36.join)(memoryDir3, dir);
31441
- if (!(0, import_node_fs48.existsSync)(full)) continue;
31306
+ if (!(0, import_node_fs47.existsSync)(full)) continue;
31442
31307
  let files;
31443
31308
  try {
31444
31309
  files = await (0, import_promises15.readdir)(full);
@@ -31520,7 +31385,7 @@ function renderNodeMarkdown(candidate, nodeId, createdAt) {
31520
31385
  return fm;
31521
31386
  }
31522
31387
  async function runSeed(opts) {
31523
- if (!(0, import_node_fs48.existsSync)(STANDARD_FILE)) {
31388
+ if (!(0, import_node_fs47.existsSync)(STANDARD_FILE)) {
31524
31389
  return { created: 0, existing: 0, failed: 0, skipped: "no_standard", candidates: [] };
31525
31390
  }
31526
31391
  let standardDoc;
@@ -31532,7 +31397,7 @@ async function runSeed(opts) {
31532
31397
  }
31533
31398
  const knowledgeSpec = standardDoc.knowledge_spec ?? {};
31534
31399
  let readmeContent;
31535
- if ((0, import_node_fs48.existsSync)("README.md")) {
31400
+ if ((0, import_node_fs47.existsSync)("README.md")) {
31536
31401
  try {
31537
31402
  readmeContent = await (0, import_promises15.readFile)("README.md", "utf-8");
31538
31403
  } catch {
@@ -31540,7 +31405,7 @@ async function runSeed(opts) {
31540
31405
  }
31541
31406
  let claudeMdContent;
31542
31407
  for (const p of ["CLAUDE.md", ".claude/CLAUDE.md"]) {
31543
- if ((0, import_node_fs48.existsSync)(p)) {
31408
+ if ((0, import_node_fs47.existsSync)(p)) {
31544
31409
  try {
31545
31410
  claudeMdContent = await (0, import_promises15.readFile)(p, "utf-8");
31546
31411
  break;
@@ -31620,7 +31485,7 @@ async function runSeed(opts) {
31620
31485
  continue;
31621
31486
  }
31622
31487
  const deduplicated = res.data.deduplicated === true;
31623
- if (deduplicated && (0, import_node_fs48.existsSync)(targetPath)) {
31488
+ if (deduplicated && (0, import_node_fs47.existsSync)(targetPath)) {
31624
31489
  existing++;
31625
31490
  continue;
31626
31491
  }
@@ -31642,7 +31507,7 @@ async function runSeed(opts) {
31642
31507
  }
31643
31508
 
31644
31509
  // src/commands/analyze/phases/08-memory-manifest.ts
31645
- var import_node_fs49 = require("node:fs");
31510
+ var import_node_fs48 = require("node:fs");
31646
31511
  var import_node_path37 = require("node:path");
31647
31512
  async function memoryManifest(run4) {
31648
31513
  const { globals } = run4;
@@ -31654,8 +31519,8 @@ async function memoryManifest(run4) {
31654
31519
  try {
31655
31520
  await ensureMemoryDir();
31656
31521
  const seedMarker = (0, import_node_path37.join)(VERITY_DIR, ".seeded");
31657
- const hasStandard = (0, import_node_fs49.existsSync)(STANDARD_FILE);
31658
- const alreadyTried = (0, import_node_fs49.existsSync)(seedMarker);
31522
+ const hasStandard = (0, import_node_fs48.existsSync)(STANDARD_FILE);
31523
+ const alreadyTried = (0, import_node_fs48.existsSync)(seedMarker);
31659
31524
  if (hasStandard && !alreadyTried) {
31660
31525
  const preManifest = await buildManifest();
31661
31526
  if (preManifest.nodes.length === 0) {
@@ -31668,7 +31533,7 @@ async function memoryManifest(run4) {
31668
31533
  dryRun: false
31669
31534
  });
31670
31535
  if (seedResult.created > 0 || seedResult.existing > 0) {
31671
- (0, import_node_fs49.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created} existing=${seedResult.existing}
31536
+ (0, import_node_fs48.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created} existing=${seedResult.existing}
31672
31537
  `);
31673
31538
  if (seedResult.created > 0) {
31674
31539
  autoSeedNotice = `Seeded ${seedResult.created} knowledge node(s) from your existing Standard (one-time).`;
@@ -31679,7 +31544,7 @@ async function memoryManifest(run4) {
31679
31544
  failed: seedResult.failed
31680
31545
  });
31681
31546
  } else if (seedResult.skipped === "already_seeded") {
31682
- (0, import_node_fs49.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
31547
+ (0, import_node_fs48.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
31683
31548
  `);
31684
31549
  } else {
31685
31550
  logEvent("auto_seed_noop", {
@@ -31884,7 +31749,7 @@ function boundPaths(paths, first, max = MAX_WIRE_PATHS) {
31884
31749
  }
31885
31750
 
31886
31751
  // src/lib/note-budget.ts
31887
- var import_node_fs50 = require("node:fs");
31752
+ var import_node_fs49 = require("node:fs");
31888
31753
  var ADVISORY_BUDGET = { PASS: 1, WARN: 2 };
31889
31754
  var EPISODE_STALE_SECONDS = 30 * 60;
31890
31755
  var FRESH = { delivered: 0, tasksCompleted: 0, ts: 0 };
@@ -31906,9 +31771,9 @@ function advisoryBudgetSpent(episode, rawDecision) {
31906
31771
  }
31907
31772
  function readAdvisoryEpisode(sessionId) {
31908
31773
  const file = scopedFile(ADVISORY_EPISODE_FILE, sessionId);
31909
- if (!(0, import_node_fs50.existsSync)(file)) return null;
31774
+ if (!(0, import_node_fs49.existsSync)(file)) return null;
31910
31775
  try {
31911
- const o = JSON.parse((0, import_node_fs50.readFileSync)(file, "utf-8")) ?? {};
31776
+ const o = JSON.parse((0, import_node_fs49.readFileSync)(file, "utf-8")) ?? {};
31912
31777
  const delivered = typeof o.delivered === "number" ? o.delivered : NaN;
31913
31778
  if (isNaN(delivered)) return null;
31914
31779
  return {
@@ -31922,8 +31787,8 @@ function readAdvisoryEpisode(sessionId) {
31922
31787
  }
31923
31788
  function writeAdvisoryEpisode(episode, sessionId) {
31924
31789
  try {
31925
- (0, import_node_fs50.mkdirSync)(VERITY_DIR, { recursive: true });
31926
- (0, import_node_fs50.writeFileSync)(
31790
+ (0, import_node_fs49.mkdirSync)(VERITY_DIR, { recursive: true });
31791
+ (0, import_node_fs49.writeFileSync)(
31927
31792
  scopedFile(ADVISORY_EPISODE_FILE, sessionId),
31928
31793
  JSON.stringify({ v: 1, ...episode })
31929
31794
  );
@@ -32260,14 +32125,14 @@ async function buildRequest(run4) {
32260
32125
  }
32261
32126
 
32262
32127
  // src/lib/offline.ts
32263
- var import_node_fs51 = require("node:fs");
32128
+ var import_node_fs50 = require("node:fs");
32264
32129
  var import_node_crypto14 = require("node:crypto");
32265
32130
  function cacheRequest(body2) {
32266
32131
  try {
32267
- (0, import_node_fs51.mkdirSync)(CACHE_DIR, { recursive: true });
32132
+ (0, import_node_fs50.mkdirSync)(CACHE_DIR, { recursive: true });
32268
32133
  const suffix = (0, import_node_crypto14.randomBytes)(4).toString("hex");
32269
32134
  const filename = `pending-${Math.floor(Date.now() / 1e3)}-${suffix}.json`;
32270
- (0, import_node_fs51.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(redactRequest(body2)));
32135
+ (0, import_node_fs50.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(redactRequest(body2)));
32271
32136
  } catch {
32272
32137
  }
32273
32138
  }
@@ -32389,7 +32254,7 @@ async function transmit(run4) {
32389
32254
  }
32390
32255
 
32391
32256
  // src/commands/analyze/phases/13-reconcile.ts
32392
- var import_node_fs52 = require("node:fs");
32257
+ var import_node_fs51 = require("node:fs");
32393
32258
  var import_node_path39 = require("node:path");
32394
32259
  async function reconcile(run4) {
32395
32260
  const { actionSummary, allChanged, analyzable, baseline, baselineSessionId, codeDelta, contentHash, conversation, decision, foldResult, memory: memory2, memorySession, response, reviewable, securityFiles, turnId } = run4;
@@ -32419,7 +32284,7 @@ async function reconcile(run4) {
32419
32284
  const st = foldDossier(memorySession.d);
32420
32285
  openElsewhere = openBlockingElsewhere(st.statements, sentPaths, (file, line2) => {
32421
32286
  try {
32422
- const src = (0, import_node_fs52.readFileSync)((0, import_node_path39.join)(repoRoot(), file), "utf8").split("\n");
32287
+ const src = (0, import_node_fs51.readFileSync)((0, import_node_path39.join)(repoRoot(), file), "utf8").split("\n");
32423
32288
  const at = src[line2 - 1];
32424
32289
  return at === void 0 ? null : lineSha(at);
32425
32290
  } catch {
@@ -33241,7 +33106,7 @@ function registerAnalyzeCommand(program2) {
33241
33106
  var tracing = () => process.env.VERITY_TRACE_PHASES === "1";
33242
33107
  async function runAnalyze(opts, globals) {
33243
33108
  if (!verityConfigured()) {
33244
- (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');
33109
+ (0, import_node_fs52.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');
33245
33110
  process.exit(0);
33246
33111
  }
33247
33112
  const run4 = createRun(opts, globals);
@@ -33262,11 +33127,11 @@ async function runAnalyze(opts, globals) {
33262
33127
  }
33263
33128
 
33264
33129
  // src/commands/baseline.ts
33265
- var import_node_fs55 = require("node:fs");
33130
+ var import_node_fs54 = require("node:fs");
33266
33131
  var import_node_path42 = require("node:path");
33267
33132
 
33268
33133
  // src/lib/project-skills.ts
33269
- var import_node_fs54 = require("node:fs");
33134
+ var import_node_fs53 = require("node:fs");
33270
33135
  var import_node_path41 = require("node:path");
33271
33136
  var PROJECT_SKILL_NAMES = [
33272
33137
  "verity-setup",
@@ -33293,14 +33158,14 @@ var LEGACY_SKILL_NAMES = [
33293
33158
  var ALL = [...PROJECT_SKILL_NAMES, ...LEGACY_SKILL_NAMES];
33294
33159
  function staleProjectSkills() {
33295
33160
  const root = projectPath(".claude/skills");
33296
- if (!(0, import_node_fs54.existsSync)(root)) return [];
33297
- return ALL.filter((name2) => (0, import_node_fs54.existsSync)((0, import_node_path41.join)(root, name2)));
33161
+ if (!(0, import_node_fs53.existsSync)(root)) return [];
33162
+ return ALL.filter((name2) => (0, import_node_fs53.existsSync)((0, import_node_path41.join)(root, name2)));
33298
33163
  }
33299
33164
  function removeProjectSkills() {
33300
33165
  const root = projectPath(".claude/skills");
33301
33166
  const removed = [];
33302
33167
  for (const name2 of staleProjectSkills()) {
33303
- (0, import_node_fs54.rmSync)((0, import_node_path41.join)(root, name2), { recursive: true, force: true });
33168
+ (0, import_node_fs53.rmSync)((0, import_node_path41.join)(root, name2), { recursive: true, force: true });
33304
33169
  removed.push(name2);
33305
33170
  }
33306
33171
  return removed;
@@ -33366,13 +33231,13 @@ function registerBaselineCommands(program2) {
33366
33231
  let memoryMsg = null;
33367
33232
  let memoryAgentLine = null;
33368
33233
  const memoryNotice = projectPath(`${VERITY_DIR}/.memory-fence-notice`);
33369
- if (realStart && !(0, import_node_fs55.existsSync)(memoryNotice)) {
33234
+ if (realStart && !(0, import_node_fs54.existsSync)(memoryNotice)) {
33370
33235
  const trackedGraph = memoryOptOut() ? 0 : committedMemoryFiles().length;
33371
33236
  if (trackedGraph > 0) {
33372
33237
  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.`;
33373
33238
  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.`;
33374
33239
  try {
33375
- (0, import_node_fs55.writeFileSync)(memoryNotice, (/* @__PURE__ */ new Date()).toISOString() + "\n");
33240
+ (0, import_node_fs54.writeFileSync)(memoryNotice, (/* @__PURE__ */ new Date()).toISOString() + "\n");
33376
33241
  } catch {
33377
33242
  }
33378
33243
  }
@@ -33473,16 +33338,10 @@ function hookSource(value) {
33473
33338
  }
33474
33339
 
33475
33340
  // src/commands/review.ts
33476
- var import_node_fs56 = require("node:fs");
33341
+ var import_node_fs55 = require("node:fs");
33477
33342
  function registerReviewCommand(program2) {
33478
- 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) => {
33343
+ 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) => {
33479
33344
  const globals = program2.opts();
33480
- const intent = readTextInput(opts.intent, "--intent");
33481
- if (!intent.ok) {
33482
- printError(intent.error);
33483
- process.exit(0);
33484
- }
33485
- opts.intent = intent.text;
33486
33345
  try {
33487
33346
  await runReview(opts, globals);
33488
33347
  } catch (err2) {
@@ -33496,7 +33355,7 @@ async function runReview(opts, globals) {
33496
33355
  const changedFiles = opts.changed ? opts.changed.split(",").map((f) => f.trim()).filter(Boolean) : allFiles;
33497
33356
  const analyzable = filterAnalyzable(allFiles);
33498
33357
  const securityFiles = filterSecurity(allFiles);
33499
- const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs56.existsSync)(f) || resolveFile(f) !== null);
33358
+ const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs55.existsSync)(f) || resolveFile(f) !== null);
33500
33359
  const staticResults = runCodacyAnalysisIfAvailable(scannable);
33501
33360
  const codeDelta = collectCodeDelta(allFiles);
33502
33361
  const tokenResult = await resolveToken(globals.token);
@@ -33562,9 +33421,21 @@ async function runReview(opts, globals) {
33562
33421
  }
33563
33422
 
33564
33423
  // src/commands/guard.ts
33565
- var import_node_fs60 = require("node:fs");
33424
+ var import_node_fs59 = require("node:fs");
33566
33425
  var import_node_path47 = require("node:path");
33567
33426
 
33427
+ // src/lib/terminal-text.ts
33428
+ var CONTROL = /[\x00-\x08\x0b-\x1f\x7f-\x9f\u061c\u200e\u200f\u2028-\u202e\u2066-\u2069]/g;
33429
+ function terminalText(value, max = 4e3) {
33430
+ if (typeof value !== "string") return "";
33431
+ const clean2 = value.replace(CONTROL, "");
33432
+ return clean2.length > max ? `${clean2.slice(0, max - 1)}\u2026` : clean2;
33433
+ }
33434
+ function terminalUrl(value) {
33435
+ const clean2 = terminalText(value, 2e3);
33436
+ return /^https?:\/\/\S+$/.test(clean2) ? clean2 : "";
33437
+ }
33438
+
33568
33439
  // src/lib/agent-driver.ts
33569
33440
  var AGENT_DEADLINE_MS = {
33570
33441
  "pre-commit": 9e4,
@@ -35386,16 +35257,16 @@ function renderReplay(model, property, r) {
35386
35257
  // src/lib/prove/runner.ts
35387
35258
  var import_node_child_process15 = require("node:child_process");
35388
35259
  var import_node_os8 = require("node:os");
35389
- var import_node_fs59 = require("node:fs");
35260
+ var import_node_fs58 = require("node:fs");
35390
35261
  var import_node_os9 = require("node:os");
35391
35262
  var import_node_path45 = require("node:path");
35392
35263
 
35393
35264
  // src/lib/prove/scaffold.ts
35394
- var import_node_fs58 = require("node:fs");
35265
+ var import_node_fs57 = require("node:fs");
35395
35266
  var import_node_path44 = require("node:path");
35396
35267
 
35397
35268
  // src/lib/prove/safe-write.ts
35398
- var import_node_fs57 = require("node:fs");
35269
+ var import_node_fs56 = require("node:fs");
35399
35270
  var import_node_crypto15 = require("node:crypto");
35400
35271
  var import_node_path43 = require("node:path");
35401
35272
  var SafeWriteError = class extends Error {
@@ -35406,7 +35277,7 @@ var SafeWriteError = class extends Error {
35406
35277
  this.name = "SafeWriteError";
35407
35278
  }
35408
35279
  };
35409
- var FLAGS3 = import_node_fs57.constants;
35280
+ var FLAGS3 = import_node_fs56.constants;
35410
35281
  var NOFOLLOW2 = FLAGS3.O_NOFOLLOW ?? 0;
35411
35282
  function assertPlainRelative(rel) {
35412
35283
  if (!rel || (0, import_node_path43.isAbsolute)(rel)) throw new SafeWriteError("bad-path", rel);
@@ -35421,9 +35292,9 @@ function ensureDirsNoFollow(root, rel) {
35421
35292
  cur = (0, import_node_path43.join)(cur, part);
35422
35293
  let st;
35423
35294
  try {
35424
- st = (0, import_node_fs57.lstatSync)(cur);
35295
+ st = (0, import_node_fs56.lstatSync)(cur);
35425
35296
  } catch {
35426
- (0, import_node_fs57.mkdirSync)(cur);
35297
+ (0, import_node_fs56.mkdirSync)(cur);
35427
35298
  continue;
35428
35299
  }
35429
35300
  if (st.isSymbolicLink()) throw new SafeWriteError("symlink", cur);
@@ -35436,7 +35307,7 @@ function insideRoot(realRoot, realPath) {
35436
35307
  }
35437
35308
  function removeQuietly(path) {
35438
35309
  try {
35439
- (0, import_node_fs57.unlinkSync)(path);
35310
+ (0, import_node_fs56.unlinkSync)(path);
35440
35311
  } catch {
35441
35312
  }
35442
35313
  }
@@ -35445,7 +35316,7 @@ function writeFileInRootNoFollow(root, rel, content) {
35445
35316
  const dest = ensureDirsNoFollow(root, rel);
35446
35317
  const dir = (0, import_node_path43.dirname)(dest);
35447
35318
  try {
35448
- const st = (0, import_node_fs57.lstatSync)(dest);
35319
+ const st = (0, import_node_fs56.lstatSync)(dest);
35449
35320
  if (st.isSymbolicLink()) throw new SafeWriteError("symlink", dest);
35450
35321
  if (!st.isFile()) throw new SafeWriteError("not-regular", dest);
35451
35322
  } catch (err2) {
@@ -35453,41 +35324,41 @@ function writeFileInRootNoFollow(root, rel, content) {
35453
35324
  }
35454
35325
  let realRoot;
35455
35326
  try {
35456
- realRoot = (0, import_node_fs57.realpathSync)(root);
35327
+ realRoot = (0, import_node_fs56.realpathSync)(root);
35457
35328
  } catch {
35458
35329
  throw new SafeWriteError("unwritable", root);
35459
35330
  }
35460
35331
  const tmp = (0, import_node_path43.join)(dir, `.${(0, import_node_path43.basename)(dest)}.${(0, import_node_crypto15.randomBytes)(6).toString("hex")}.tmp`);
35461
35332
  let fd;
35462
35333
  try {
35463
- fd = (0, import_node_fs57.openSync)(tmp, import_node_fs57.constants.O_WRONLY | import_node_fs57.constants.O_CREAT | import_node_fs57.constants.O_EXCL | NOFOLLOW2, 420);
35334
+ 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);
35464
35335
  } catch {
35465
35336
  throw new SafeWriteError("unwritable", tmp);
35466
35337
  }
35467
35338
  try {
35468
- const opened = (0, import_node_fs57.fstatSync)(fd, { bigint: true });
35339
+ const opened = (0, import_node_fs56.fstatSync)(fd, { bigint: true });
35469
35340
  let realTmp;
35470
35341
  try {
35471
- realTmp = (0, import_node_fs57.realpathSync)(tmp);
35342
+ realTmp = (0, import_node_fs56.realpathSync)(tmp);
35472
35343
  } catch {
35473
35344
  throw new SafeWriteError("escaped", tmp);
35474
35345
  }
35475
- const there = (0, import_node_fs57.lstatSync)(realTmp, { bigint: true });
35346
+ const there = (0, import_node_fs56.lstatSync)(realTmp, { bigint: true });
35476
35347
  if (!opened.isFile() || there.ino !== opened.ino || there.dev !== opened.dev || !insideRoot(realRoot, realTmp)) {
35477
35348
  throw new SafeWriteError("escaped", tmp);
35478
35349
  }
35479
35350
  const buf = Buffer.from(content, "utf-8");
35480
35351
  let off = 0;
35481
- while (off < buf.length) off += (0, import_node_fs57.writeSync)(fd, buf, off, buf.length - off);
35352
+ while (off < buf.length) off += (0, import_node_fs56.writeSync)(fd, buf, off, buf.length - off);
35482
35353
  } catch (err2) {
35483
- (0, import_node_fs57.closeSync)(fd);
35354
+ (0, import_node_fs56.closeSync)(fd);
35484
35355
  removeQuietly(tmp);
35485
35356
  throw err2 instanceof SafeWriteError ? err2 : new SafeWriteError("unwritable", tmp);
35486
35357
  }
35487
- (0, import_node_fs57.closeSync)(fd);
35358
+ (0, import_node_fs56.closeSync)(fd);
35488
35359
  try {
35489
- if (!insideRoot(realRoot, (0, import_node_fs57.realpathSync)(dir)) || (0, import_node_fs57.lstatSync)(dir).isSymbolicLink()) throw new SafeWriteError("escaped", dir);
35490
- (0, import_node_fs57.renameSync)(tmp, dest);
35360
+ if (!insideRoot(realRoot, (0, import_node_fs56.realpathSync)(dir)) || (0, import_node_fs56.lstatSync)(dir).isSymbolicLink()) throw new SafeWriteError("escaped", dir);
35361
+ (0, import_node_fs56.renameSync)(tmp, dest);
35491
35362
  } catch (err2) {
35492
35363
  removeQuietly(tmp);
35493
35364
  throw err2 instanceof SafeWriteError ? err2 : new SafeWriteError("unwritable", dest);
@@ -35503,7 +35374,7 @@ function pathHasNoLink(root, rel) {
35503
35374
  for (const part of rel.split(/[\\/]/)) {
35504
35375
  cur = cur + import_node_path43.sep + part;
35505
35376
  try {
35506
- if ((0, import_node_fs57.lstatSync)(cur).isSymbolicLink()) return false;
35377
+ if ((0, import_node_fs56.lstatSync)(cur).isSymbolicLink()) return false;
35507
35378
  } catch {
35508
35379
  return true;
35509
35380
  }
@@ -35820,7 +35691,7 @@ function scaffoldProofs(root) {
35820
35691
  const rel = `${PROOFS_DIR}/${stray}`;
35821
35692
  if (!pathHasNoLink(root, rel)) throw new SafeWriteError("symlink", (0, import_node_path44.join)(root, rel));
35822
35693
  try {
35823
- (0, import_node_fs58.rmSync)((0, import_node_path44.join)(root, rel), { force: true });
35694
+ (0, import_node_fs57.rmSync)((0, import_node_path44.join)(root, rel), { force: true });
35824
35695
  } catch {
35825
35696
  }
35826
35697
  }
@@ -35851,7 +35722,7 @@ function scaffoldProofs(root) {
35851
35722
  }
35852
35723
  function existsNoFollow(abs) {
35853
35724
  try {
35854
- (0, import_node_fs58.lstatSync)(abs);
35725
+ (0, import_node_fs57.lstatSync)(abs);
35855
35726
  return true;
35856
35727
  } catch {
35857
35728
  return false;
@@ -36114,7 +35985,7 @@ function verityLeanHome(env = process.env) {
36114
35985
  function findToolchain(env = process.env) {
36115
35986
  const managedBin = (0, import_node_path45.join)(verityLeanHome(env), LEAN_TOOLCHAIN.replace(/^leanprover\/lean4:/, ""), "bin");
36116
35987
  const elanBin = (0, import_node_path45.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "bin");
36117
- const elanHas = (0, import_node_fs59.existsSync)((0, import_node_path45.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "toolchains", LEAN_TOOLCHAIN.replace("/", "--").replace(":", "---")));
35988
+ const elanHas = (0, import_node_fs58.existsSync)((0, import_node_path45.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "toolchains", LEAN_TOOLCHAIN.replace("/", "--").replace(":", "---")));
36118
35989
  const userPath = (env.PATH ?? "").split(import_node_path45.delimiter).filter((d) => d && (elanHas || (0, import_node_path45.resolve)(d) !== (0, import_node_path45.resolve)(elanBin)));
36119
35990
  const path = [managedBin, ...elanHas ? [elanBin] : [], ...userPath].join(import_node_path45.delimiter);
36120
35991
  const merged = { ...env, PATH: path, ELAN_TOOLCHAIN: env.ELAN_TOOLCHAIN ?? LEAN_TOOLCHAIN };
@@ -36198,7 +36069,7 @@ function proofsWorkspaceProblem(root) {
36198
36069
  for (const rel of [".verity", PROOFS_DIR, `${PROOFS_DIR}/.lake`]) {
36199
36070
  let st;
36200
36071
  try {
36201
- st = (0, import_node_fs59.lstatSync)((0, import_node_path45.join)(root, rel));
36072
+ st = (0, import_node_fs58.lstatSync)((0, import_node_path45.join)(root, rel));
36202
36073
  } catch {
36203
36074
  break;
36204
36075
  }
@@ -36240,8 +36111,8 @@ function resolveModelFile(root, arg) {
36240
36111
  }
36241
36112
  function listModelFiles(root) {
36242
36113
  const modelsAbs = (0, import_node_path45.join)(root, MODELS_DIR);
36243
- if (!(0, import_node_fs59.existsSync)(modelsAbs)) return [];
36244
- return (0, import_node_fs59.readdirSync)(modelsAbs).filter((f) => isModelInRoot(modelsAbs, f)).sort().map((f) => (0, import_node_path45.join)(modelsAbs, f));
36114
+ if (!(0, import_node_fs58.existsSync)(modelsAbs)) return [];
36115
+ return (0, import_node_fs58.readdirSync)(modelsAbs).filter((f) => isModelInRoot(modelsAbs, f)).sort().map((f) => (0, import_node_path45.join)(modelsAbs, f));
36245
36116
  }
36246
36117
  function trimDiagnostics(text) {
36247
36118
  return text.split("\n").filter((l) => !l.startsWith("trace:")).join("\n").trim().slice(0, 4e3);
@@ -37196,7 +37067,7 @@ function readPreToolUseStdin() {
37196
37067
  }
37197
37068
  function readIterMap() {
37198
37069
  try {
37199
- const raw = JSON.parse((0, import_node_fs60.readFileSync)(GUARD_ITER_FILE, "utf-8"));
37070
+ const raw = JSON.parse((0, import_node_fs59.readFileSync)(GUARD_ITER_FILE, "utf-8"));
37200
37071
  if (raw && typeof raw === "object") {
37201
37072
  if (typeof raw.moment === "string" && typeof raw.count === "number") {
37202
37073
  return { [raw.moment]: raw.count };
@@ -37216,10 +37087,10 @@ function readIter(moment) {
37216
37087
  }
37217
37088
  function writeIter(moment, count) {
37218
37089
  try {
37219
- (0, import_node_fs60.mkdirSync)(VERITY_DIR, { recursive: true });
37090
+ (0, import_node_fs59.mkdirSync)(VERITY_DIR, { recursive: true });
37220
37091
  const map = readIterMap();
37221
37092
  map[moment] = count;
37222
- (0, import_node_fs60.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37093
+ (0, import_node_fs59.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37223
37094
  } catch {
37224
37095
  }
37225
37096
  }
@@ -37229,10 +37100,10 @@ function resetIter(moment) {
37229
37100
  if (!(moment in map)) return;
37230
37101
  delete map[moment];
37231
37102
  if (Object.keys(map).length === 0) {
37232
- if ((0, import_node_fs60.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs60.unlinkSync)(GUARD_ITER_FILE);
37103
+ if ((0, import_node_fs59.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs59.unlinkSync)(GUARD_ITER_FILE);
37233
37104
  } else {
37234
- (0, import_node_fs60.mkdirSync)(VERITY_DIR, { recursive: true });
37235
- (0, import_node_fs60.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37105
+ (0, import_node_fs59.mkdirSync)(VERITY_DIR, { recursive: true });
37106
+ (0, import_node_fs59.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
37236
37107
  }
37237
37108
  } catch {
37238
37109
  }
@@ -37302,7 +37173,7 @@ function hasBlockingFinding(response, sentFiles) {
37302
37173
  function buildGuardRequest(moment, files, codeDelta, iter, sessionId, statedIntent, coverageTelemetry) {
37303
37174
  const analyzable = filterAnalyzable(files);
37304
37175
  const securityFiles = filterSecurity(files);
37305
- const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).map((f) => (0, import_node_fs60.existsSync)(f) ? f : resolveFile(f)).filter((f) => f !== null);
37176
+ const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).map((f) => (0, import_node_fs59.existsSync)(f) ? f : resolveFile(f)).filter((f) => f !== null);
37306
37177
  const staticResults = runCodacyAnalysisIfAvailable(scannable);
37307
37178
  const trigger = moment === "pre-commit" ? "hook:pre-commit" : "hook:pre-push";
37308
37179
  const requestBody = {
@@ -37920,7 +37791,7 @@ function registerIgnoreCommand(program2) {
37920
37791
 
37921
37792
  // src/commands/waive.ts
37922
37793
  var import_node_crypto20 = require("node:crypto");
37923
- var import_node_fs61 = require("node:fs");
37794
+ var import_node_fs60 = require("node:fs");
37924
37795
  function registerWaiveCommand(program2) {
37925
37796
  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) => {
37926
37797
  const globals = program2.opts();
@@ -37949,7 +37820,7 @@ function registerWaiveCommand(program2) {
37949
37820
  if (opts.file) {
37950
37821
  body2.file = opts.file;
37951
37822
  try {
37952
- body2.file_sha256 = (0, import_node_crypto20.createHash)("sha256").update((0, import_node_fs61.readFileSync)(opts.file)).digest("hex");
37823
+ body2.file_sha256 = (0, import_node_crypto20.createHash)("sha256").update((0, import_node_fs60.readFileSync)(opts.file)).digest("hex");
37953
37824
  } catch {
37954
37825
  printError(`Cannot read ${opts.file} \u2014 run from the repo root, or omit --file to waive by pattern.`);
37955
37826
  process.exit(1);
@@ -37974,7 +37845,7 @@ function registerWaiveCommand(program2) {
37974
37845
  }
37975
37846
 
37976
37847
  // src/commands/init.ts
37977
- var import_node_fs66 = require("node:fs");
37848
+ var import_node_fs65 = require("node:fs");
37978
37849
  var import_promises20 = require("node:fs/promises");
37979
37850
  var import_yaml6 = __toESM2(require_dist());
37980
37851
  var import_node_path51 = require("node:path");
@@ -38056,7 +37927,7 @@ function printPhase(n, of, title, subtitle) {
38056
37927
  }
38057
37928
 
38058
37929
  // src/commands/doctor.ts
38059
- var import_node_fs62 = require("node:fs");
37930
+ var import_node_fs61 = require("node:fs");
38060
37931
 
38061
37932
  // src/lib/prereqs.ts
38062
37933
  var import_node_child_process16 = require("node:child_process");
@@ -38264,11 +38135,11 @@ async function buildReport() {
38264
38135
  const hooks = wiring.status;
38265
38136
  const provenance = cliProvenance();
38266
38137
  const telemetry = await checkTelemetry();
38267
- const hasConfig = (0, import_node_fs62.existsSync)(projectPath(CODACY_CONFIG_FILE));
38138
+ const hasConfig = (0, import_node_fs61.existsSync)(projectPath(CODACY_CONFIG_FILE));
38268
38139
  const artifacts = {
38269
- standard: (0, import_node_fs62.existsSync)(projectPath(STANDARD_FILE)),
38140
+ standard: (0, import_node_fs61.existsSync)(projectPath(STANDARD_FILE)),
38270
38141
  analysisConfig: hasConfig,
38271
- verityMd: (0, import_node_fs62.existsSync)(projectPath(VERITY_MD_FILE)),
38142
+ verityMd: (0, import_node_fs61.existsSync)(projectPath(VERITY_MD_FILE)),
38272
38143
  analysisConfigIds: hasConfig ? validatePatternIds().status : "absent"
38273
38144
  };
38274
38145
  const next = [];
@@ -38427,7 +38298,7 @@ function registerDoctorCommand(program2) {
38427
38298
  }
38428
38299
 
38429
38300
  // src/commands/migrate.ts
38430
- var import_node_fs63 = require("node:fs");
38301
+ var import_node_fs62 = require("node:fs");
38431
38302
  var import_node_path48 = require("node:path");
38432
38303
  var import_node_child_process17 = require("node:child_process");
38433
38304
  var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
@@ -38467,10 +38338,10 @@ async function runMigration(opts = {}) {
38467
38338
  function migrateProjectDir(root, actions) {
38468
38339
  const gateDir = (0, import_node_path48.join)(root, ".gate");
38469
38340
  const verityDir = (0, import_node_path48.join)(root, ".verity");
38470
- if ((0, import_node_fs63.existsSync)(gateDir) && !(0, import_node_fs63.existsSync)(verityDir)) {
38341
+ if ((0, import_node_fs62.existsSync)(gateDir) && !(0, import_node_fs62.existsSync)(verityDir)) {
38471
38342
  return migrateProjectDirRename(root, gateDir, verityDir, actions);
38472
38343
  }
38473
- if ((0, import_node_fs63.existsSync)(gateDir) && (0, import_node_fs63.existsSync)(verityDir)) {
38344
+ if ((0, import_node_fs62.existsSync)(gateDir) && (0, import_node_fs62.existsSync)(verityDir)) {
38474
38345
  return migrateProjectDirCarry(gateDir, verityDir, actions);
38475
38346
  }
38476
38347
  return false;
@@ -38491,13 +38362,13 @@ function migrateProjectDirRename(root, gateDir, verityDir, actions) {
38491
38362
  }
38492
38363
  }
38493
38364
  if (moved) {
38494
- if ((0, import_node_fs63.existsSync)(gateDir)) {
38365
+ if ((0, import_node_fs62.existsSync)(gateDir)) {
38495
38366
  const carried = carryLegacyContents(gateDir, verityDir);
38496
38367
  if (carried > 0) {
38497
38368
  actions.push(`Carried ${carried} untracked legacy file(s) from .gate/ into .verity/`);
38498
38369
  }
38499
38370
  try {
38500
- (0, import_node_fs63.rmSync)(gateDir, { recursive: true, force: true });
38371
+ (0, import_node_fs62.rmSync)(gateDir, { recursive: true, force: true });
38501
38372
  } catch {
38502
38373
  }
38503
38374
  }
@@ -38513,7 +38384,7 @@ function migrateProjectDirCarry(gateDir, verityDir, actions) {
38513
38384
  actions.push(`Carried ${carried} legacy file(s) from .gate/ into .verity/`);
38514
38385
  }
38515
38386
  try {
38516
- (0, import_node_fs63.rmSync)(gateDir, { recursive: true, force: true });
38387
+ (0, import_node_fs62.rmSync)(gateDir, { recursive: true, force: true });
38517
38388
  } catch {
38518
38389
  }
38519
38390
  return carried > 0;
@@ -38522,9 +38393,9 @@ function migrateGlobalCredentials(home, actions) {
38522
38393
  if (!home) return;
38523
38394
  const gateCreds = (0, import_node_path48.join)(home, ".gate", "credentials");
38524
38395
  const verityCreds = (0, import_node_path48.join)(home, ".verity", "credentials");
38525
- if (!(0, import_node_fs63.existsSync)(gateCreds)) return;
38526
- if (!(0, import_node_fs63.existsSync)(verityCreds)) {
38527
- (0, import_node_fs63.mkdirSync)((0, import_node_path48.join)(home, ".verity"), { recursive: true });
38396
+ if (!(0, import_node_fs62.existsSync)(gateCreds)) return;
38397
+ if (!(0, import_node_fs62.existsSync)(verityCreds)) {
38398
+ (0, import_node_fs62.mkdirSync)((0, import_node_path48.join)(home, ".verity"), { recursive: true });
38528
38399
  moveFile(gateCreds, verityCreds);
38529
38400
  actions.push("Moved ~/.gate/credentials \u2192 ~/.verity/credentials");
38530
38401
  return;
@@ -38547,7 +38418,7 @@ async function migrateLegacyHooks(root, actions) {
38547
38418
  }
38548
38419
  async function migrateClaudeMd(root, actions) {
38549
38420
  const claudeMd = (0, import_node_path48.join)(root, "CLAUDE.md");
38550
- const hadLegacyBlock = (0, import_node_fs63.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
38421
+ const hadLegacyBlock = (0, import_node_fs62.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
38551
38422
  if (!hadLegacyBlock) return;
38552
38423
  try {
38553
38424
  await ensureClaudeMdPointer(root);
@@ -38559,7 +38430,7 @@ async function migrateClaudeMd(root, actions) {
38559
38430
  function migrateStandardFile(root, actions) {
38560
38431
  const gateMd = (0, import_node_path48.join)(root, "GATE.md");
38561
38432
  const verityMd = (0, import_node_path48.join)(root, "VERITY.md");
38562
- if (!(0, import_node_fs63.existsSync)(gateMd) || (0, import_node_fs63.existsSync)(verityMd)) return;
38433
+ if (!(0, import_node_fs62.existsSync)(gateMd) || (0, import_node_fs62.existsSync)(verityMd)) return;
38563
38434
  let moved = false;
38564
38435
  if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
38565
38436
  try {
@@ -38571,12 +38442,12 @@ function migrateStandardFile(root, actions) {
38571
38442
  if (!moved) moveFile(gateMd, verityMd);
38572
38443
  const content = readFileSyncSafe(verityMd);
38573
38444
  const refreshed = content.split("GATE.md").join("VERITY.md");
38574
- if (refreshed !== content) (0, import_node_fs63.writeFileSync)(verityMd, refreshed);
38445
+ if (refreshed !== content) (0, import_node_fs62.writeFileSync)(verityMd, refreshed);
38575
38446
  actions.push("Renamed GATE.md \u2192 VERITY.md");
38576
38447
  }
38577
38448
  async function migrateTelemetryHeaders(root, actions) {
38578
38449
  const file = (0, import_node_path48.join)(root, ".claude", "settings.local.json");
38579
- if (!(0, import_node_fs63.existsSync)(file)) return;
38450
+ if (!(0, import_node_fs62.existsSync)(file)) return;
38580
38451
  let settings;
38581
38452
  try {
38582
38453
  settings = JSON.parse(readFileSyncSafe(file) || "{}");
@@ -38624,14 +38495,14 @@ function mergeGlobalCredentials(gateCreds, verityCreds) {
38624
38495
  }
38625
38496
  if (toAppend.length > 0) {
38626
38497
  const sep5 = verityContent.endsWith("\n") || verityContent === "" ? "" : "\n";
38627
- (0, import_node_fs63.writeFileSync)(verityCreds, verityContent + sep5 + toAppend.join("\n") + "\n");
38498
+ (0, import_node_fs62.writeFileSync)(verityCreds, verityContent + sep5 + toAppend.join("\n") + "\n");
38628
38499
  }
38629
- (0, import_node_fs63.rmSync)(gateCreds, { force: true });
38500
+ (0, import_node_fs62.rmSync)(gateCreds, { force: true });
38630
38501
  return toAppend.length;
38631
38502
  }
38632
38503
  function readFileSyncSafe(path) {
38633
38504
  try {
38634
- return (0, import_node_fs63.readFileSync)(path, "utf-8");
38505
+ return (0, import_node_fs62.readFileSync)(path, "utf-8");
38635
38506
  } catch {
38636
38507
  return "";
38637
38508
  }
@@ -38646,35 +38517,35 @@ function hasStagedChanges(root) {
38646
38517
  }
38647
38518
  function moveDir(from, to) {
38648
38519
  try {
38649
- (0, import_node_fs63.renameSync)(from, to);
38520
+ (0, import_node_fs62.renameSync)(from, to);
38650
38521
  } catch (err2) {
38651
38522
  if (err2.code !== "EXDEV") throw err2;
38652
- (0, import_node_fs63.cpSync)(from, to, { recursive: true });
38653
- (0, import_node_fs63.rmSync)(from, { recursive: true, force: true });
38523
+ (0, import_node_fs62.cpSync)(from, to, { recursive: true });
38524
+ (0, import_node_fs62.rmSync)(from, { recursive: true, force: true });
38654
38525
  }
38655
38526
  }
38656
38527
  function moveFile(from, to) {
38657
38528
  try {
38658
- (0, import_node_fs63.renameSync)(from, to);
38529
+ (0, import_node_fs62.renameSync)(from, to);
38659
38530
  } catch (err2) {
38660
38531
  if (err2.code !== "EXDEV") throw err2;
38661
- (0, import_node_fs63.cpSync)(from, to);
38662
- (0, import_node_fs63.rmSync)(from, { force: true });
38532
+ (0, import_node_fs62.cpSync)(from, to);
38533
+ (0, import_node_fs62.rmSync)(from, { force: true });
38663
38534
  }
38664
38535
  }
38665
38536
  function carryLegacyContents(gateDir, verityDir) {
38666
38537
  let copied = 0;
38667
38538
  const walk2 = (relDir) => {
38668
38539
  const srcDir = (0, import_node_path48.join)(gateDir, relDir);
38669
- for (const entry of (0, import_node_fs63.readdirSync)(srcDir)) {
38540
+ for (const entry of (0, import_node_fs62.readdirSync)(srcDir)) {
38670
38541
  const rel = relDir ? (0, import_node_path48.join)(relDir, entry) : entry;
38671
38542
  const src = (0, import_node_path48.join)(gateDir, rel);
38672
38543
  const dest = (0, import_node_path48.join)(verityDir, rel);
38673
- if ((0, import_node_fs63.statSync)(src).isDirectory()) {
38544
+ if ((0, import_node_fs62.statSync)(src).isDirectory()) {
38674
38545
  walk2(rel);
38675
- } else if (!(0, import_node_fs63.existsSync)(dest)) {
38676
- (0, import_node_fs63.mkdirSync)((0, import_node_path48.dirname)(dest), { recursive: true });
38677
- (0, import_node_fs63.cpSync)(src, dest);
38546
+ } else if (!(0, import_node_fs62.existsSync)(dest)) {
38547
+ (0, import_node_fs62.mkdirSync)((0, import_node_path48.dirname)(dest), { recursive: true });
38548
+ (0, import_node_fs62.cpSync)(src, dest);
38678
38549
  copied++;
38679
38550
  }
38680
38551
  }
@@ -38685,20 +38556,20 @@ function carryLegacyContents(gateDir, verityDir) {
38685
38556
  async function needsMigration(root = repoRoot()) {
38686
38557
  const gateDir = (0, import_node_path48.join)(root, ".gate");
38687
38558
  const verityDir = (0, import_node_path48.join)(root, ".verity");
38688
- if ((0, import_node_fs63.existsSync)(gateDir) && !(0, import_node_fs63.existsSync)(verityDir)) return true;
38689
- if ((0, import_node_fs63.existsSync)(gateDir) && (0, import_node_fs63.existsSync)(verityDir)) {
38690
- if ((0, import_node_fs63.existsSync)((0, import_node_path48.join)(gateDir, "credentials")) && !(0, import_node_fs63.existsSync)((0, import_node_path48.join)(verityDir, "credentials"))) {
38559
+ if ((0, import_node_fs62.existsSync)(gateDir) && !(0, import_node_fs62.existsSync)(verityDir)) return true;
38560
+ if ((0, import_node_fs62.existsSync)(gateDir) && (0, import_node_fs62.existsSync)(verityDir)) {
38561
+ if ((0, import_node_fs62.existsSync)((0, import_node_path48.join)(gateDir, "credentials")) && !(0, import_node_fs62.existsSync)((0, import_node_path48.join)(verityDir, "credentials"))) {
38691
38562
  return true;
38692
38563
  }
38693
- if ((0, import_node_fs63.existsSync)((0, import_node_path48.join)(gateDir, "memory")) && !(0, import_node_fs63.existsSync)((0, import_node_path48.join)(verityDir, "memory"))) {
38564
+ if ((0, import_node_fs62.existsSync)((0, import_node_path48.join)(gateDir, "memory")) && !(0, import_node_fs62.existsSync)((0, import_node_path48.join)(verityDir, "memory"))) {
38694
38565
  return true;
38695
38566
  }
38696
38567
  }
38697
38568
  const claudeMd = (0, import_node_path48.join)(root, "CLAUDE.md");
38698
- if ((0, import_node_fs63.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
38569
+ if ((0, import_node_fs62.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
38699
38570
  return true;
38700
38571
  }
38701
- if ((0, import_node_fs63.existsSync)((0, import_node_path48.join)(root, "GATE.md")) && !(0, import_node_fs63.existsSync)((0, import_node_path48.join)(root, "VERITY.md"))) {
38572
+ if ((0, import_node_fs62.existsSync)((0, import_node_path48.join)(root, "GATE.md")) && !(0, import_node_fs62.existsSync)((0, import_node_path48.join)(root, "VERITY.md"))) {
38702
38573
  return true;
38703
38574
  }
38704
38575
  if (await hasLegacyHooksAt(root)) return true;
@@ -38979,7 +38850,7 @@ async function promptMultiSelect(question, choices, fallback) {
38979
38850
  }
38980
38851
 
38981
38852
  // src/lib/prove/lean-install.ts
38982
- var import_node_fs64 = require("node:fs");
38853
+ var import_node_fs63 = require("node:fs");
38983
38854
  var import_node_crypto21 = require("node:crypto");
38984
38855
  var import_node_child_process18 = require("node:child_process");
38985
38856
  var import_node_os10 = require("node:os");
@@ -38994,7 +38865,7 @@ function freeBytes(dir) {
38994
38865
  let d = dir;
38995
38866
  for (let i2 = 0; i2 < 64; i2++) {
38996
38867
  try {
38997
- const st = (0, import_node_fs64.statfsSync)(d);
38868
+ const st = (0, import_node_fs63.statfsSync)(d);
38998
38869
  return Number(st.bavail) * Number(st.bsize);
38999
38870
  } catch {
39000
38871
  const up = (0, import_node_path49.join)(d, "..");
@@ -39019,7 +38890,7 @@ function expectedSha256(asset, version = pinnedVersion()) {
39019
38890
  function sha256File(path) {
39020
38891
  return new Promise((resolve9, reject) => {
39021
38892
  const hash = (0, import_node_crypto21.createHash)("sha256");
39022
- (0, import_node_fs64.createReadStream)(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
38893
+ (0, import_node_fs63.createReadStream)(path).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
39023
38894
  });
39024
38895
  }
39025
38896
  async function verifyDownload(zip, asset, version = pinnedVersion()) {
@@ -39050,12 +38921,12 @@ function unzip(zip, dest) {
39050
38921
  for (const [cmd, args2] of attempts) {
39051
38922
  try {
39052
38923
  (0, import_node_child_process18.execFileSync)(cmd, args2, { stdio: ["ignore", "ignore", "pipe"], timeout: 15 * 6e4 });
39053
- if ((0, import_node_fs64.readdirSync)(dest).length > 0) return { ok: true, via: cmd };
38924
+ if ((0, import_node_fs63.readdirSync)(dest).length > 0) return { ok: true, via: cmd };
39054
38925
  errors.push(`${cmd}: produced nothing`);
39055
38926
  } catch (err2) {
39056
38927
  errors.push(`${cmd}: ${String(err2.message).split("\n")[0].slice(0, 120)}`);
39057
38928
  try {
39058
- for (const e of (0, import_node_fs64.readdirSync)(dest)) (0, import_node_fs64.rmSync)((0, import_node_path49.join)(dest, e), { recursive: true, force: true });
38929
+ for (const e of (0, import_node_fs63.readdirSync)(dest)) (0, import_node_fs63.rmSync)((0, import_node_path49.join)(dest, e), { recursive: true, force: true });
39059
38930
  } catch {
39060
38931
  }
39061
38932
  }
@@ -39081,7 +38952,7 @@ async function download(url, dest, onProgress, stallMs = DOWNLOAD_STALL_MS) {
39081
38952
  seen += chunk.length;
39082
38953
  onProgress(seen, total);
39083
38954
  });
39084
- await (0, import_promises18.pipeline)(stream, (0, import_node_fs64.createWriteStream)(dest), { signal: ctrl.signal });
38955
+ await (0, import_promises18.pipeline)(stream, (0, import_node_fs63.createWriteStream)(dest), { signal: ctrl.signal });
39085
38956
  } catch (err2) {
39086
38957
  if (ctrl.signal.aborted) throw new Error(`download stalled: nothing received for ${Math.round(stallMs / 1e3)} s`);
39087
38958
  throw err2;
@@ -39132,8 +39003,8 @@ async function installLean(opts = {}) {
39132
39003
  return { ok: false, error: `not enough disk space for Lean: ${gb(free)} GB free where ${home} lives, needs about ${gb(needed)} GB` };
39133
39004
  }
39134
39005
  const tmp = (0, import_node_path49.join)(home, ".tmp");
39135
- (0, import_node_fs64.rmSync)(tmp, { recursive: true, force: true });
39136
- (0, import_node_fs64.mkdirSync)(tmp, { recursive: true });
39006
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39007
+ (0, import_node_fs63.mkdirSync)(tmp, { recursive: true });
39137
39008
  const zip = (0, import_node_path49.join)(tmp, asset);
39138
39009
  say(`downloading ${url}`);
39139
39010
  let lastPct = -1;
@@ -39147,38 +39018,38 @@ async function installLean(opts = {}) {
39147
39018
  }
39148
39019
  });
39149
39020
  } catch (err2) {
39150
- (0, import_node_fs64.rmSync)(tmp, { recursive: true, force: true });
39021
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39151
39022
  return { ok: false, error: err2.message };
39152
39023
  }
39153
39024
  say("verifying checksum");
39154
39025
  const verified = await verifyDownload(zip, asset);
39155
39026
  if (!verified.ok) {
39156
- (0, import_node_fs64.rmSync)(tmp, { recursive: true, force: true });
39027
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39157
39028
  return { ok: false, error: verified.error };
39158
39029
  }
39159
39030
  say("unpacking (this takes a minute)");
39160
39031
  const unpack = (0, import_node_path49.join)(tmp, "unpack");
39161
- (0, import_node_fs64.mkdirSync)(unpack);
39032
+ (0, import_node_fs63.mkdirSync)(unpack);
39162
39033
  const unpacked = unzip(zip, unpack);
39163
39034
  if (!unpacked.ok) {
39164
- (0, import_node_fs64.rmSync)(tmp, { recursive: true, force: true });
39035
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39165
39036
  return { ok: false, error: `unpack failed: ${unpacked.error}` };
39166
39037
  }
39167
- const entries = (0, import_node_fs64.readdirSync)(unpack);
39168
- const top = entries.length === 1 && (0, import_node_fs64.statSync)((0, import_node_path49.join)(unpack, entries[0])).isDirectory() ? (0, import_node_path49.join)(unpack, entries[0]) : unpack;
39169
- if (!(0, import_node_fs64.existsSync)((0, import_node_path49.join)(top, "bin", lakeBinary()))) {
39170
- (0, import_node_fs64.rmSync)(tmp, { recursive: true, force: true });
39038
+ const entries = (0, import_node_fs63.readdirSync)(unpack);
39039
+ const top = entries.length === 1 && (0, import_node_fs63.statSync)((0, import_node_path49.join)(unpack, entries[0])).isDirectory() ? (0, import_node_path49.join)(unpack, entries[0]) : unpack;
39040
+ if (!(0, import_node_fs63.existsSync)((0, import_node_path49.join)(top, "bin", lakeBinary()))) {
39041
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39171
39042
  return { ok: false, error: "the archive did not contain bin/lake" };
39172
39043
  }
39173
- (0, import_node_fs64.rmSync)(dir, { recursive: true, force: true });
39174
- (0, import_node_fs64.mkdirSync)(home, { recursive: true });
39175
- (0, import_node_fs64.renameSync)(top, dir);
39176
- (0, import_node_fs64.rmSync)(tmp, { recursive: true, force: true });
39044
+ (0, import_node_fs63.rmSync)(dir, { recursive: true, force: true });
39045
+ (0, import_node_fs63.mkdirSync)(home, { recursive: true });
39046
+ (0, import_node_fs63.renameSync)(top, dir);
39047
+ (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
39177
39048
  return { ok: true, dir };
39178
39049
  }
39179
39050
 
39180
39051
  // src/lib/remote-config.ts
39181
- var import_node_fs65 = require("node:fs");
39052
+ var import_node_fs64 = require("node:fs");
39182
39053
  var import_promises19 = require("node:fs/promises");
39183
39054
  var import_node_path50 = require("node:path");
39184
39055
  var import_yaml5 = __toESM2(require_dist());
@@ -39225,7 +39096,7 @@ async function adoptRemoteSetup(found, opts) {
39225
39096
  written.push(STANDARD_FILE);
39226
39097
  if (rider !== null) {
39227
39098
  const localIgnore = projectPath(VERITYIGNORE_FILE);
39228
- if (!(0, import_node_fs65.existsSync)(localIgnore)) {
39099
+ if (!(0, import_node_fs64.existsSync)(localIgnore)) {
39229
39100
  await writeOut(VERITYIGNORE_FILE, rider);
39230
39101
  written.push(VERITYIGNORE_FILE);
39231
39102
  } else {
@@ -39383,7 +39254,7 @@ function resolveDataDir2() {
39383
39254
  // local dev: running from repo root
39384
39255
  ];
39385
39256
  for (const candidate of candidates2) {
39386
- if ((0, import_node_fs66.existsSync)((0, import_node_path51.join)(candidate, "skills"))) {
39257
+ if ((0, import_node_fs65.existsSync)((0, import_node_path51.join)(candidate, "skills"))) {
39387
39258
  return candidate;
39388
39259
  }
39389
39260
  }
@@ -39399,7 +39270,7 @@ async function skillIsCurrent(src, dest) {
39399
39270
  const list2 = (dir) => {
39400
39271
  const out2 = [];
39401
39272
  const walk2 = (d, prefix) => {
39402
- for (const e of (0, import_node_fs66.readdirSync)(d, { withFileTypes: true })) {
39273
+ for (const e of (0, import_node_fs65.readdirSync)(d, { withFileTypes: true })) {
39403
39274
  const rel = prefix ? `${prefix}/${e.name}` : e.name;
39404
39275
  if (e.isDirectory()) walk2((0, import_node_path51.join)(d, e.name), rel);
39405
39276
  else if (e.isFile()) out2.push(rel);
@@ -39616,7 +39487,7 @@ async function synthesizeLocally(opts) {
39616
39487
  async function healStaleAnalysisConfig(globals) {
39617
39488
  const configPath = projectPath(CODACY_CONFIG_FILE);
39618
39489
  const standardPath = projectPath(STANDARD_FILE);
39619
- if (!(0, import_node_fs66.existsSync)(configPath) || !(0, import_node_fs66.existsSync)(standardPath)) return;
39490
+ if (!(0, import_node_fs65.existsSync)(configPath) || !(0, import_node_fs65.existsSync)(standardPath)) return;
39620
39491
  const validation = validatePatternIds();
39621
39492
  if (validation.status !== "invalid") return;
39622
39493
  printWarn(" Your analysis config names pattern ids that no longer resolve \u2014 those tools were");
@@ -39719,11 +39590,11 @@ async function installSkills(force, step) {
39719
39590
  for (const skill of SKILLS) {
39720
39591
  const src = (0, import_node_path51.join)(skillsSource, skill);
39721
39592
  const dest = (0, import_node_path51.join)(skillsDest, skill);
39722
- if (!(0, import_node_fs66.existsSync)(src)) {
39593
+ if (!(0, import_node_fs65.existsSync)(src)) {
39723
39594
  printWarn(` Skill data not found: ${skill}`);
39724
39595
  continue;
39725
39596
  }
39726
- if ((0, import_node_fs66.existsSync)(dest) && !force && await skillIsCurrent(src, dest)) {
39597
+ if ((0, import_node_fs65.existsSync)(dest) && !force && await skillIsCurrent(src, dest)) {
39727
39598
  skillsInstalled++;
39728
39599
  continue;
39729
39600
  }
@@ -39923,7 +39794,7 @@ function registerInitCommand(program2) {
39923
39794
  const staleMarker = clearStalePluginMarker();
39924
39795
  const pluginMode = opts.plugin === false ? false : opts.pluginMode ?? pluginActiveHere();
39925
39796
  const projectMarkers = [".git", "package.json", "pyproject.toml", "go.mod", "Cargo.toml", "Gemfile", "pom.xml", "build.gradle"];
39926
- const isProject = projectMarkers.some((m) => (0, import_node_fs66.existsSync)(m));
39797
+ const isProject = projectMarkers.some((m) => (0, import_node_fs65.existsSync)(m));
39927
39798
  if (!isProject) {
39928
39799
  printError("No project detected in the current directory.");
39929
39800
  printInfo('Run "verity init" from your project root.');
@@ -40101,7 +39972,7 @@ function registerInitCommand(program2) {
40101
39972
  }
40102
39973
  step("Your project's Standard");
40103
39974
  let haveStandard = false;
40104
- if ((0, import_node_fs66.existsSync)(projectPath(STANDARD_FILE))) {
39975
+ if ((0, import_node_fs65.existsSync)(projectPath(STANDARD_FILE))) {
40105
39976
  printInfo(" This project already has .verity/standard.yaml \u2014 keeping it.");
40106
39977
  haveStandard = true;
40107
39978
  } else {
@@ -40131,7 +40002,7 @@ function registerInitCommand(program2) {
40131
40002
  ...telemetryChoice ? { telemetry: telemetryChoice } : {},
40132
40003
  init: {
40133
40004
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
40134
- cli_version: true ? "0.34.0-experimental.380b51f" : "dev"
40005
+ cli_version: true ? "0.34.0-experimental.3d4888f" : "dev"
40135
40006
  }
40136
40007
  });
40137
40008
  } catch (err2) {
@@ -40181,7 +40052,7 @@ function registerInitCommand(program2) {
40181
40052
  }
40182
40053
 
40183
40054
  // src/commands/uninstall.ts
40184
- var import_node_fs67 = require("node:fs");
40055
+ var import_node_fs66 = require("node:fs");
40185
40056
  var import_node_path52 = require("node:path");
40186
40057
  function registerUninstallCommand(program2) {
40187
40058
  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) => {
@@ -40192,10 +40063,10 @@ function registerUninstallCommand(program2) {
40192
40063
  const skillsRoot = projectPath(".claude/skills");
40193
40064
  for (const name2 of PROJECT_SKILL_NAMES) {
40194
40065
  const dir = (0, import_node_path52.join)(skillsRoot, name2);
40195
- if ((0, import_node_fs67.existsSync)(dir)) {
40066
+ if ((0, import_node_fs66.existsSync)(dir)) {
40196
40067
  actions.push({
40197
40068
  label: `Remove .claude/skills/${name2}/`,
40198
- apply: () => (0, import_node_fs67.rmSync)(dir, { recursive: true, force: true })
40069
+ apply: () => (0, import_node_fs66.rmSync)(dir, { recursive: true, force: true })
40199
40070
  });
40200
40071
  }
40201
40072
  }
@@ -40209,24 +40080,24 @@ function registerUninstallCommand(program2) {
40209
40080
  });
40210
40081
  }
40211
40082
  const verityDir = projectPath(VERITY_DIR);
40212
- if ((0, import_node_fs67.existsSync)(verityDir)) {
40083
+ if ((0, import_node_fs66.existsSync)(verityDir)) {
40213
40084
  actions.push({
40214
40085
  label: `Remove ${VERITY_DIR}/`,
40215
- apply: () => (0, import_node_fs67.rmSync)(verityDir, { recursive: true, force: true })
40086
+ apply: () => (0, import_node_fs66.rmSync)(verityDir, { recursive: true, force: true })
40216
40087
  });
40217
40088
  }
40218
40089
  if (!keepVerityMd) {
40219
40090
  const verityMd = projectPath(VERITY_MD_FILE);
40220
- if ((0, import_node_fs67.existsSync)(verityMd)) {
40091
+ if ((0, import_node_fs66.existsSync)(verityMd)) {
40221
40092
  actions.push({
40222
40093
  label: `Remove ${VERITY_MD_FILE}`,
40223
- apply: () => (0, import_node_fs67.rmSync)(verityMd, { force: true })
40094
+ apply: () => (0, import_node_fs66.rmSync)(verityMd, { force: true })
40224
40095
  });
40225
40096
  }
40226
40097
  }
40227
40098
  const cleanupEmptyDir = (path) => {
40228
- if ((0, import_node_fs67.existsSync)(path) && (0, import_node_fs67.statSync)(path).isDirectory() && (0, import_node_fs67.readdirSync)(path).length === 0) {
40229
- (0, import_node_fs67.rmdirSync)(path);
40099
+ if ((0, import_node_fs66.existsSync)(path) && (0, import_node_fs66.statSync)(path).isDirectory() && (0, import_node_fs66.readdirSync)(path).length === 0) {
40100
+ (0, import_node_fs66.rmdirSync)(path);
40230
40101
  }
40231
40102
  };
40232
40103
  actions.push({
@@ -40238,10 +40109,10 @@ function registerUninstallCommand(program2) {
40238
40109
  });
40239
40110
  const home = process.env.HOME ?? "";
40240
40111
  const globalVerityDir = (0, import_node_path52.join)(home, ".verity");
40241
- if (purgeGlobal && (0, import_node_fs67.existsSync)(globalVerityDir)) {
40112
+ if (purgeGlobal && (0, import_node_fs66.existsSync)(globalVerityDir)) {
40242
40113
  actions.push({
40243
40114
  label: `Remove ~/.verity/ (global credentials \u2014 reconnect requires re-registration)`,
40244
- apply: () => (0, import_node_fs67.rmSync)(globalVerityDir, { recursive: true, force: true })
40115
+ apply: () => (0, import_node_fs66.rmSync)(globalVerityDir, { recursive: true, force: true })
40245
40116
  });
40246
40117
  }
40247
40118
  if (actions.length === 0) {
@@ -40435,7 +40306,7 @@ function registerTaskCommands(program2) {
40435
40306
  }
40436
40307
 
40437
40308
  // src/commands/reset.ts
40438
- var import_node_fs68 = require("node:fs");
40309
+ var import_node_fs67 = require("node:fs");
40439
40310
  var import_node_path53 = require("node:path");
40440
40311
  function registerResetCommand(program2) {
40441
40312
  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) => {
@@ -40473,11 +40344,11 @@ function registerResetCommand(program2) {
40473
40344
  }
40474
40345
  const cacheDir = projectPath(CACHE_DIR);
40475
40346
  let purged = 0;
40476
- if ((0, import_node_fs68.existsSync)(cacheDir)) {
40477
- for (const entry of (0, import_node_fs68.readdirSync)(cacheDir)) {
40347
+ if ((0, import_node_fs67.existsSync)(cacheDir)) {
40348
+ for (const entry of (0, import_node_fs67.readdirSync)(cacheDir)) {
40478
40349
  if (entry.startsWith("pending-")) {
40479
40350
  try {
40480
- (0, import_node_fs68.unlinkSync)((0, import_node_path53.join)(cacheDir, entry));
40351
+ (0, import_node_fs67.unlinkSync)((0, import_node_path53.join)(cacheDir, entry));
40481
40352
  purged++;
40482
40353
  } catch {
40483
40354
  }
@@ -40492,19 +40363,19 @@ function registerResetCommand(program2) {
40492
40363
  projectPath(`${VERITY_DIR}/.last-analysis`)
40493
40364
  ];
40494
40365
  for (const file of filesToClear) {
40495
- if ((0, import_node_fs68.existsSync)(file)) {
40366
+ if ((0, import_node_fs67.existsSync)(file)) {
40496
40367
  try {
40497
- (0, import_node_fs68.writeFileSync)(file, "");
40368
+ (0, import_node_fs67.writeFileSync)(file, "");
40498
40369
  } catch {
40499
40370
  }
40500
40371
  }
40501
40372
  }
40502
40373
  if (opts.all) {
40503
40374
  const logsDir = projectPath(`${VERITY_DIR}/.logs`);
40504
- if ((0, import_node_fs68.existsSync)(logsDir)) {
40505
- for (const entry of (0, import_node_fs68.readdirSync)(logsDir)) {
40375
+ if ((0, import_node_fs67.existsSync)(logsDir)) {
40376
+ for (const entry of (0, import_node_fs67.readdirSync)(logsDir)) {
40506
40377
  try {
40507
- (0, import_node_fs68.unlinkSync)((0, import_node_path53.join)(logsDir, entry));
40378
+ (0, import_node_fs67.unlinkSync)((0, import_node_path53.join)(logsDir, entry));
40508
40379
  } catch {
40509
40380
  }
40510
40381
  }
@@ -40516,7 +40387,7 @@ function registerResetCommand(program2) {
40516
40387
  }
40517
40388
 
40518
40389
  // src/commands/reflect.ts
40519
- var import_node_fs69 = require("node:fs");
40390
+ var import_node_fs68 = require("node:fs");
40520
40391
 
40521
40392
  // src/lib/reflection-globs.ts
40522
40393
  var MAX_GLOBS = 6;
@@ -40554,19 +40425,14 @@ async function writeNodeToDisk(args2) {
40554
40425
  { treePaths: listTrackedFiles(), recordBaseline: false }
40555
40426
  );
40556
40427
  if (written === 0) return false;
40557
- return (0, import_node_fs69.existsSync)(projectPath(`${VERITY_DIR}/memory/${args2.filePath}`));
40428
+ return (0, import_node_fs68.existsSync)(projectPath(`${VERITY_DIR}/memory/${args2.filePath}`));
40558
40429
  } catch {
40559
40430
  return false;
40560
40431
  }
40561
40432
  }
40562
40433
  function registerReflectCommand(program2) {
40563
- 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) => {
40434
+ 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) => {
40564
40435
  const globals = program2.opts();
40565
- const input = readTextInput(opts.userInput, "--user-input");
40566
- if (!input.ok) {
40567
- printError(input.error);
40568
- process.exit(1);
40569
- }
40570
40436
  await ensureMemoryDir();
40571
40437
  const tokenResult = await resolveToken(globals.token);
40572
40438
  if (!tokenResult.ok) {
@@ -40627,7 +40493,7 @@ function registerReflectCommand(program2) {
40627
40493
  taskResolution = "none";
40628
40494
  printWarn("No active task found \u2014 saving as an unattached reflection.");
40629
40495
  }
40630
- const userInput = input.text;
40496
+ const userInput = opts.userInput;
40631
40497
  if (userInput) {
40632
40498
  const validKinds = ["decision", "gotcha", "pattern", "security", "quality", "intent", "domain", "integration"];
40633
40499
  const kind = validKinds.includes(opts.kind) ? opts.kind : "gotcha";
@@ -40991,9 +40857,9 @@ function registerRunCommand(program2) {
40991
40857
  }
40992
40858
 
40993
40859
  // src/commands/telemetry.ts
40994
- var import_node_fs70 = require("node:fs");
40860
+ var import_node_fs69 = require("node:fs");
40995
40861
  async function recordTelemetryChoice(choice) {
40996
- if (!(0, import_node_fs70.existsSync)(projectPath(SETUP_STATE_FILE))) return;
40862
+ if (!(0, import_node_fs69.existsSync)(projectPath(SETUP_STATE_FILE))) return;
40997
40863
  try {
40998
40864
  if ((await readSetupState())?.telemetry === choice) return;
40999
40865
  await writeSetupState({ telemetry: choice });
@@ -41070,7 +40936,7 @@ function registerTelemetryCommands(program2) {
41070
40936
  }
41071
40937
 
41072
40938
  // src/commands/prove.ts
41073
- var import_node_fs71 = require("node:fs");
40939
+ var import_node_fs70 = require("node:fs");
41074
40940
  var import_node_path54 = require("node:path");
41075
40941
 
41076
40942
  // src/lib/prove/hint-pool.ts
@@ -41198,13 +41064,7 @@ async function proveAuth(program2) {
41198
41064
  }
41199
41065
  function registerProveCommand(program2) {
41200
41066
  const prove = program2.command("prove").description("Formal verification (Lean 4) of small, risky pieces of code \u2014 on demand");
41201
- 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) => {
41202
- const hint = readTextInput(opts.hint, "--hint");
41203
- if (!hint.ok) {
41204
- printError(hint.error);
41205
- process.exit(2);
41206
- }
41207
- opts.hint = hint.text;
41067
+ 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) => {
41208
41068
  if (opts.hint && opts.rank === "deterministic") opts.rank = "luna";
41209
41069
  const root = repoRoot();
41210
41070
  const ranker = RANKERS[opts.rank];
@@ -41267,7 +41127,7 @@ function registerProveCommand(program2) {
41267
41127
  });
41268
41128
  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) => {
41269
41129
  const root = repoRoot();
41270
- if (!(0, import_node_fs71.existsSync)((0, import_node_path54.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41130
+ if (!(0, import_node_fs70.existsSync)((0, import_node_path54.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41271
41131
  printError(`No ${PROOFS_DIR}/ project here. Run \`verity prove init\` first.`);
41272
41132
  process.exit(2);
41273
41133
  }
@@ -41329,7 +41189,7 @@ ${build.stderr.split("\n").filter((l) => !l.startsWith("trace:")).slice(0, 20).j
41329
41189
  printError("Not logged in \u2014 replays run on the Verity service. Run `verity login` first.");
41330
41190
  process.exit(2);
41331
41191
  }
41332
- if (!(0, import_node_fs71.existsSync)((0, import_node_path54.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41192
+ if (!(0, import_node_fs70.existsSync)((0, import_node_path54.join)(root, PROOFS_DIR, "lakefile.toml"))) {
41333
41193
  printError(`No ${PROOFS_DIR}/ project here. Run \`verity prove init\` first.`);
41334
41194
  process.exit(2);
41335
41195
  }
@@ -41409,19 +41269,7 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41409
41269
  }
41410
41270
  process.exit(outcome.findings.some((f) => f.verdict === "reproduced") ? 1 : 0);
41411
41271
  });
41412
- 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) => {
41413
- if (opts.hint === "-" && opts.note === "-") {
41414
- printError("Only one of --hint and --note can read stdin (-).");
41415
- process.exit(2);
41416
- }
41417
- for (const flag of ["hint", "note"]) {
41418
- const input = readTextInput(opts[flag], `--${flag}`);
41419
- if (!input.ok) {
41420
- printError(input.error);
41421
- process.exit(2);
41422
- }
41423
- opts[flag] = input.text;
41424
- }
41272
+ 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) => {
41425
41273
  const root = repoRoot();
41426
41274
  const auth2 = await proveAuth(program2);
41427
41275
  if (!auth2 && !(process.env.VERITY_PROVE_DIRECT === "1" && process.env.OPENAI_API_KEY)) {
@@ -41454,7 +41302,7 @@ ${f.reason ? ` ${terminalText(f.reason, 2e3)}
41454
41302
  const existing = resolveModelFile(root, opts.revise);
41455
41303
  const src = existing ? readRegularFileInRoot(root, (0, import_node_path54.relative)(root, existing), 64 * 1024) : null;
41456
41304
  if (!src || !src.ok || !opts.note) {
41457
- printError("--revise needs an existing model under Models/ and --note - with what the replay showed on stdin");
41305
+ printError('--revise needs an existing model under Models/ and --note "<what the replay showed>"');
41458
41306
  process.exit(2);
41459
41307
  }
41460
41308
  revise = { source: src.content, note: opts.note };
@@ -41543,7 +41391,7 @@ function refreshScaffold(root) {
41543
41391
  }
41544
41392
 
41545
41393
  // src/commands/lean.ts
41546
- var import_node_fs72 = require("node:fs");
41394
+ var import_node_fs71 = require("node:fs");
41547
41395
  var import_node_child_process20 = require("node:child_process");
41548
41396
  var import_node_os11 = require("node:os");
41549
41397
  var import_node_path55 = require("node:path");
@@ -41563,7 +41411,7 @@ function registerLeanCommand(program2) {
41563
41411
  const managed = pinnedVersionDir();
41564
41412
  const matches = version ? version.includes(pin) : false;
41565
41413
  if (opts.json) {
41566
- printJson({ pinned: LEAN_TOOLCHAIN, found: tc?.lake ?? null, version, matches_pin: matches, managed_dir: managed, managed_installed: (0, import_node_fs72.existsSync)((0, import_node_path55.join)(managed, "bin")), asset: leanAssetName() });
41414
+ 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_path55.join)(managed, "bin")), asset: leanAssetName() });
41567
41415
  return;
41568
41416
  }
41569
41417
  printInfo(`pinned: ${LEAN_TOOLCHAIN}`);
@@ -41581,7 +41429,7 @@ function registerLeanCommand(program2) {
41581
41429
  process.exit(2);
41582
41430
  }
41583
41431
  const dir = pinnedVersionDir();
41584
- if ((0, import_node_fs72.existsSync)((0, import_node_path55.join)(dir, "bin", "lake")) && !opts.force) {
41432
+ if ((0, import_node_fs71.existsSync)((0, import_node_path55.join)(dir, "bin", "lake")) && !opts.force) {
41585
41433
  printInfo(`already installed at ${dir}`);
41586
41434
  return;
41587
41435
  }
@@ -41617,18 +41465,18 @@ function registerLeanCommand(program2) {
41617
41465
  });
41618
41466
  lean.command("remove").description("Delete the Verity-managed toolchain for the pinned version").action(() => {
41619
41467
  const dir = pinnedVersionDir();
41620
- if (!(0, import_node_fs72.existsSync)(dir)) {
41468
+ if (!(0, import_node_fs71.existsSync)(dir)) {
41621
41469
  printInfo("nothing to remove");
41622
41470
  return;
41623
41471
  }
41624
- (0, import_node_fs72.rmSync)(dir, { recursive: true, force: true });
41472
+ (0, import_node_fs71.rmSync)(dir, { recursive: true, force: true });
41625
41473
  printInfo(`removed ${dir}`);
41626
41474
  });
41627
41475
  }
41628
41476
 
41629
41477
  // src/cli.ts
41630
- program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.380b51f").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) => {
41631
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.380b51f");
41478
+ program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.3d4888f").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) => {
41479
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.3d4888f");
41632
41480
  setUserNamedServiceUrl(program.opts().serviceUrl);
41633
41481
  try {
41634
41482
  await foldLegacyLocalCredential();