@codacy/verity-cli 0.24.0-experimental.9a9e918 → 0.24.0-experimental.b2914b9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/verity.js +164 -496
  2. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -10379,7 +10379,6 @@ var MAX_PLAN_FILES = 3;
10379
10379
  var MAX_PLAN_FILE_BYTES = 10240;
10380
10380
  var MAX_INTENT_CHARS = 2e3;
10381
10381
  var SNAPSHOT_DIR = `${VERITY_DIR}/.snapshot`;
10382
- var BASELINE_DIR = `${VERITY_DIR}/.baseline`;
10383
10382
  var CONVERSATION_BUFFER_FILE = `${VERITY_DIR}/.conversation-buffer`;
10384
10383
  var CONVERSATION_MAX_ENTRIES = 10;
10385
10384
  var CONVERSATION_WINDOW_MINUTES = 15;
@@ -10475,7 +10474,7 @@ var SECURITY_PATTERNS = [
10475
10474
  /Dockerfile/
10476
10475
  ];
10477
10476
  var PROD_SERVICE_URL = "https://ofcamwrjwrkazqvdchko.supabase.co/functions/v1";
10478
- var DEFAULT_SERVICE_URL = "https://yykkfdexzljmmkklpgyz.supabase.co/functions/v1".length > 0 ? "https://yykkfdexzljmmkklpgyz.supabase.co/functions/v1" : PROD_SERVICE_URL;
10477
+ var DEFAULT_SERVICE_URL = "https://yykkfdexzljmmkklpgyz.supabase.co".length > 0 ? "https://yykkfdexzljmmkklpgyz.supabase.co" : PROD_SERVICE_URL;
10479
10478
 
10480
10479
  // src/lib/auth.ts
10481
10480
  async function resolveToken(flagToken) {
@@ -10850,10 +10849,6 @@ var VERITY_INTENT_HOOK = {
10850
10849
  type: "command",
10851
10850
  command: "verity intent capture"
10852
10851
  };
10853
- var VERITY_BASELINE_HOOK = {
10854
- type: "command",
10855
- command: "verity baseline capture"
10856
- };
10857
10852
  var GUARD_TIMEOUT = 300;
10858
10853
  function buildGuardHook(on) {
10859
10854
  return {
@@ -10866,13 +10861,9 @@ function buildGuardHook(on) {
10866
10861
  var VERITY_STOP_RE = /(?:^|[\/\s"'])verity\s+analyze\b/;
10867
10862
  var VERITY_INTENT_RE = /(?:^|[\/\s"'])verity\s+intent\s+capture\b/;
10868
10863
  var VERITY_GUARD_RE = /(?:^|[\/\s"'])verity\s+guard\b/;
10869
- var VERITY_BASELINE_RE = /(?:^|[\/\s"'])verity\s+baseline\s+capture\b/;
10870
10864
  function isVerityGuardHook(entry) {
10871
10865
  return VERITY_GUARD_RE.test(entry.command ?? "");
10872
10866
  }
10873
- function isVerityBaselineHook(entry) {
10874
- return VERITY_BASELINE_RE.test(entry.command ?? "");
10875
- }
10876
10867
  var LEGACY_STOP_RE = /(?:^|[\/\s"'])gate\s+analyze\b/;
10877
10868
  var LEGACY_INTENT_RE = /(?:^|[\/\s"'])gate\s+intent\s+capture\b/;
10878
10869
  function isVerityStopHook(entry) {
@@ -10884,7 +10875,7 @@ function isVerityIntentHook(entry) {
10884
10875
  return VERITY_INTENT_RE.test(c) || LEGACY_INTENT_RE.test(c) || c.includes(".verity/hooks/capture-intent.sh") || c.includes(".gate/hooks/capture-intent.sh");
10885
10876
  }
10886
10877
  function isVerityHook(entry) {
10887
- return isVerityStopHook(entry) || isVerityIntentHook(entry) || isVerityGuardHook(entry) || isVerityBaselineHook(entry);
10878
+ return isVerityStopHook(entry) || isVerityIntentHook(entry) || isVerityGuardHook(entry);
10888
10879
  }
10889
10880
  function isCurrentVerityStopHook(entry) {
10890
10881
  const c = entry.command ?? "";
@@ -10895,7 +10886,7 @@ function isCurrentVerityIntentHook(entry) {
10895
10886
  return VERITY_INTENT_RE.test(c) || c.includes(".verity/hooks/capture-intent.sh");
10896
10887
  }
10897
10888
  function isCurrentVerityHook(entry) {
10898
- return isCurrentVerityStopHook(entry) || isCurrentVerityIntentHook(entry) || isVerityGuardHook(entry) || isVerityBaselineHook(entry);
10889
+ return isCurrentVerityStopHook(entry) || isCurrentVerityIntentHook(entry) || isVerityGuardHook(entry);
10899
10890
  }
10900
10891
  function settingsHasLegacyHook(settings) {
10901
10892
  for (const groups of Object.values(settings.hooks ?? {})) {
@@ -10937,18 +10928,16 @@ async function readAllSettings() {
10937
10928
  async function checkAllVerityHooks() {
10938
10929
  let stop = false;
10939
10930
  let intent = false;
10940
- let baseline = false;
10941
10931
  let guard = false;
10942
10932
  let guardOn = [];
10943
10933
  for (const settings of await readAllSettings()) {
10944
10934
  const r = checkVerityHooks(settings);
10945
10935
  stop = stop || r.stop;
10946
10936
  intent = intent || r.intent;
10947
- baseline = baseline || r.baseline;
10948
10937
  guard = guard || r.guard;
10949
10938
  if (r.guardOn.length > guardOn.length) guardOn = r.guardOn;
10950
10939
  }
10951
- return { stop, intent, baseline, guard, guardOn };
10940
+ return { stop, intent, guard, guardOn };
10952
10941
  }
10953
10942
  async function checkExternalVerityHooks() {
10954
10943
  let stop = false;
@@ -10971,14 +10960,12 @@ async function checkExternalVerityHooks() {
10971
10960
  async function checkAllVerityHooksDetailed() {
10972
10961
  let stop = false;
10973
10962
  let intent = false;
10974
- let baseline = false;
10975
10963
  let hasCurrent = false;
10976
10964
  let hasLegacy = false;
10977
10965
  for (const settings of await readAllSettings()) {
10978
10966
  const r = checkVerityHooks(settings);
10979
10967
  stop = stop || r.stop;
10980
10968
  intent = intent || r.intent;
10981
- baseline = baseline || r.baseline;
10982
10969
  for (const groups of Object.values(settings.hooks ?? {})) {
10983
10970
  for (const g of groups ?? []) {
10984
10971
  for (const h of g.hooks ?? []) {
@@ -10988,7 +10975,7 @@ async function checkAllVerityHooksDetailed() {
10988
10975
  }
10989
10976
  }
10990
10977
  }
10991
- return { stop, intent, baseline, current: hasCurrent, legacyOnly: hasLegacy && !hasCurrent };
10978
+ return { stop, intent, current: hasCurrent, legacyOnly: hasLegacy && !hasCurrent };
10992
10979
  }
10993
10980
  async function writeSettings(settings) {
10994
10981
  await (0, import_promises4.mkdir)((0, import_node_path3.dirname)(CLAUDE_SETTINGS_FILE), { recursive: true });
@@ -11031,10 +11018,6 @@ function checkVerityHooks(settings) {
11031
11018
  const hasIntent = intentGroups.some(
11032
11019
  (g) => g.hooks?.some((h) => isCurrentVerityIntentHook(h))
11033
11020
  );
11034
- const sessionStartGroups = hooks["SessionStart"] ?? [];
11035
- const hasBaseline = sessionStartGroups.some(
11036
- (g) => g.hooks?.some((h) => isVerityBaselineHook(h))
11037
- );
11038
11021
  let guard = false;
11039
11022
  let guardOn = [];
11040
11023
  for (const g of hooks["PreToolUse"] ?? []) {
@@ -11047,17 +11030,16 @@ function checkVerityHooks(settings) {
11047
11030
  }
11048
11031
  }
11049
11032
  }
11050
- return { stop: hasStop, intent: hasIntent, baseline: hasBaseline, guard, guardOn };
11033
+ return { stop: hasStop, intent: hasIntent, guard, guardOn };
11051
11034
  }
11052
- function installVerityHooks(settings, force, externalPresent = { stop: false, intent: false, baseline: false }) {
11035
+ function installVerityHooks(settings, force, externalPresent = { stop: false, intent: false }) {
11053
11036
  const local = checkVerityHooks(settings);
11054
11037
  const existing = {
11055
11038
  stop: local.stop || externalPresent.stop,
11056
- intent: local.intent || externalPresent.intent,
11057
- baseline: local.baseline || (externalPresent.baseline ?? false)
11039
+ intent: local.intent || externalPresent.intent
11058
11040
  };
11059
11041
  const hasLocalLegacy = settingsHasLegacyHook(settings);
11060
- if (existing.stop && existing.intent && existing.baseline && !force && !hasLocalLegacy) {
11042
+ if (existing.stop && existing.intent && !force && !hasLocalLegacy) {
11061
11043
  return { ok: false, error: "Verity hooks already installed. Use --force to overwrite." };
11062
11044
  }
11063
11045
  const newSettings = { ...settings };
@@ -11065,7 +11047,7 @@ function installVerityHooks(settings, force, externalPresent = { stop: false, in
11065
11047
  newSettings.hooks = {};
11066
11048
  }
11067
11049
  const shouldStrip = force ? isVerityHook : isLegacyHook;
11068
- for (const key of ["Stop", "UserPromptSubmit", "SessionStart"]) {
11050
+ for (const key of ["Stop", "UserPromptSubmit"]) {
11069
11051
  const groups = newSettings.hooks[key];
11070
11052
  if (groups) {
11071
11053
  newSettings.hooks[key] = groups.map((g) => ({
@@ -11092,15 +11074,6 @@ function installVerityHooks(settings, force, externalPresent = { stop: false, in
11092
11074
  if (!newSettings.hooks["UserPromptSubmit"]) newSettings.hooks["UserPromptSubmit"] = [];
11093
11075
  newSettings.hooks["UserPromptSubmit"].push({ hooks: [VERITY_INTENT_HOOK] });
11094
11076
  }
11095
- if (!existing.baseline) {
11096
- if (!newSettings.hooks["SessionStart"]) {
11097
- newSettings.hooks["SessionStart"] = [];
11098
- }
11099
- newSettings.hooks["SessionStart"].push({ hooks: [VERITY_BASELINE_HOOK] });
11100
- } else if (force && local.baseline) {
11101
- if (!newSettings.hooks["SessionStart"]) newSettings.hooks["SessionStart"] = [];
11102
- newSettings.hooks["SessionStart"].push({ hooks: [VERITY_BASELINE_HOOK] });
11103
- }
11104
11077
  return { ok: true, data: newSettings };
11105
11078
  }
11106
11079
  function removeVerityHooks(settings) {
@@ -11134,7 +11107,6 @@ function reconcileMomentHooks(settings, moments, externalPresent = {
11134
11107
  (s.hooks[event] ??= []).push(group);
11135
11108
  };
11136
11109
  if (!externalPresent.intent) push("UserPromptSubmit", { hooks: [VERITY_INTENT_HOOK] });
11137
- push("SessionStart", { hooks: [VERITY_BASELINE_HOOK] });
11138
11110
  if (moments.includes("stop") && !externalPresent.stop) {
11139
11111
  push("Stop", { hooks: [VERITY_STOP_HOOK] });
11140
11112
  }
@@ -11183,7 +11155,7 @@ function registerHooksCommands(program2) {
11183
11155
  return;
11184
11156
  }
11185
11157
  const detail = await checkAllVerityHooksDetailed();
11186
- const present = { stop: detail.stop, intent: detail.intent, baseline: detail.baseline };
11158
+ const present = { stop: detail.stop, intent: detail.intent };
11187
11159
  if (detail.legacyOnly) {
11188
11160
  printInfo("Found a legacy GATE.md hook \u2014 upgrading it to Verity...");
11189
11161
  const settings2 = removeVerityHooks(await readSettings());
@@ -11196,12 +11168,11 @@ function registerHooksCommands(program2) {
11196
11168
  printInfo("Verity hooks installed in .claude/settings.json (legacy hook removed)");
11197
11169
  printInfo(" Stop hook: verity analyze");
11198
11170
  printInfo(" UserPromptSubmit hook: verity intent capture");
11199
- printInfo(" SessionStart hook: verity baseline capture");
11200
11171
  return;
11201
11172
  }
11202
11173
  const settings = await readSettings();
11203
11174
  const hasLocalLegacy = settingsHasLegacyHook(settings);
11204
- if (!force && present.stop && present.intent && present.baseline && !hasLocalLegacy) {
11175
+ if (!force && present.stop && present.intent && !hasLocalLegacy) {
11205
11176
  printInfo("Verity hooks already installed (found in .claude/settings.json, settings.local.json, or your global settings).");
11206
11177
  printInfo("Use --force to rewrite the project settings.json copy.");
11207
11178
  return;
@@ -11215,13 +11186,11 @@ function registerHooksCommands(program2) {
11215
11186
  printInfo("Verity hooks installed in .claude/settings.json");
11216
11187
  printInfo(" Stop hook: verity analyze");
11217
11188
  printInfo(" UserPromptSubmit hook: verity intent capture");
11218
- printInfo(" SessionStart hook: verity baseline capture");
11219
11189
  });
11220
11190
  hooks.command("check").description("Check if Verity hooks are installed").action(async () => {
11221
11191
  const status = await checkAllVerityHooks();
11222
11192
  printInfo(`Stop hook (verity analyze): ${status.stop ? "installed" : "not installed"}`);
11223
11193
  printInfo(`Intent hook (verity intent capture): ${status.intent ? "installed" : "not installed"}`);
11224
- printInfo(`Baseline hook (verity baseline capture): ${status.baseline ? "installed" : "not installed"}`);
11225
11194
  const gates = status.guard ? status.guardOn.join(", ") : "none";
11226
11195
  printInfo(`Git-moment gate (verity guard): ${status.guard ? `installed [${gates}]` : "not installed"}`);
11227
11196
  if (!status.stop && !status.guard) {
@@ -11274,28 +11243,15 @@ async function appendToConversationBuffer(prompt, sessionId) {
11274
11243
  } catch {
11275
11244
  }
11276
11245
  }
11277
- async function readAndClearConversationBuffer(currentSessionId) {
11246
+ async function readAndClearConversationBuffer() {
11278
11247
  try {
11279
11248
  if ((0, import_node_fs2.existsSync)(CONVERSATION_BUFFER_FILE)) {
11280
11249
  const entries = await readBufferEntries();
11281
- let mine = entries;
11282
- let others = [];
11283
- if (currentSessionId) {
11284
- mine = entries.filter((e) => e.session_id === currentSessionId || !e.session_id);
11285
- others = entries.filter((e) => e.session_id && e.session_id !== currentSessionId);
11286
- }
11287
- if (others.length > 0) {
11288
- const remaining = others.map((e) => JSON.stringify(e)).join("\n") + "\n";
11289
- const tmpFile = `${CONVERSATION_BUFFER_FILE}.tmp`;
11290
- await (0, import_promises5.writeFile)(tmpFile, remaining);
11291
- await (0, import_promises5.rename)(tmpFile, CONVERSATION_BUFFER_FILE);
11292
- } else {
11293
- await (0, import_promises5.unlink)(CONVERSATION_BUFFER_FILE).catch(() => {
11294
- });
11295
- }
11296
- if (mine.length > 0) {
11250
+ await (0, import_promises5.unlink)(CONVERSATION_BUFFER_FILE).catch(() => {
11251
+ });
11252
+ if (entries.length > 0) {
11297
11253
  return {
11298
- prompts: mine,
11254
+ prompts: entries,
11299
11255
  recent_commits: getRecentCommitMessages()
11300
11256
  };
11301
11257
  }
@@ -12763,8 +12719,8 @@ async function sendGeneralFeedback(message, opts, globals) {
12763
12719
  }
12764
12720
 
12765
12721
  // src/commands/analyze.ts
12766
- var import_node_fs19 = require("node:fs");
12767
- var import_node_path14 = require("node:path");
12722
+ var import_node_fs18 = require("node:fs");
12723
+ var import_node_path13 = require("node:path");
12768
12724
 
12769
12725
  // src/lib/git.ts
12770
12726
  var import_node_child_process5 = require("node:child_process");
@@ -12856,26 +12812,6 @@ function getChangedFiles() {
12856
12812
  function getStagedFiles() {
12857
12813
  return splitLines(execGit("git diff --cached --name-only")).filter((f) => !f.startsWith(".verity/") && !f.startsWith(".verity\\"));
12858
12814
  }
12859
- function getDirtyFiles() {
12860
- const set = /* @__PURE__ */ new Set();
12861
- for (const f of splitLines(execGit("git diff --name-only HEAD"))) set.add(f);
12862
- for (const f of splitLines(execGit("git diff --name-only --cached"))) set.add(f);
12863
- for (const f of splitLines(execGit("git ls-files --others --exclude-standard"))) set.add(f);
12864
- return Array.from(set).filter((f) => !f.startsWith(".verity/") && !f.startsWith(".verity\\"));
12865
- }
12866
- function showContentAtRef(ref, repoRelPath) {
12867
- if (!ref || ref === "no-git") return null;
12868
- const normalizedPath = repoRelPath.replace(/\\/g, "/");
12869
- try {
12870
- return (0, import_node_child_process5.execFileSync)("git", ["show", `${ref}:${normalizedPath}`], {
12871
- encoding: "utf-8",
12872
- maxBuffer: 64 * 1024 * 1024,
12873
- stdio: ["pipe", "pipe", "pipe"]
12874
- });
12875
- } catch {
12876
- return null;
12877
- }
12878
- }
12879
12815
  function getPushRangeFiles() {
12880
12816
  const diff = (range) => splitLines(execGit(`git diff --name-only ${range}`)).filter((f) => !f.startsWith(".verity/") && !f.startsWith(".verity\\"));
12881
12817
  const resolvers = [
@@ -13528,207 +13464,15 @@ function cleanStaleSnapshots(dir, keepSet) {
13528
13464
  }
13529
13465
  }
13530
13466
 
13531
- // src/lib/baseline.ts
13467
+ // src/lib/offline.ts
13532
13468
  var import_node_fs13 = require("node:fs");
13533
- var import_node_path11 = require("node:path");
13534
13469
  var import_node_crypto4 = require("node:crypto");
13535
- var BASELINE_VERSION = 1;
13536
- var BASELINE_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
13537
- var MIRROR_MAX_BYTES = 2 * 1024 * 1024;
13538
- var DEFAULT_SESSION_KEY = "_default";
13539
- function sessionKey(sessionId) {
13540
- if (!sessionId) return DEFAULT_SESSION_KEY;
13541
- return (0, import_node_crypto4.createHash)("sha256").update(sessionId).digest("hex").slice(0, 16);
13542
- }
13543
- function sessionDir(key) {
13544
- return (0, import_node_path11.join)(projectPath(BASELINE_DIR), key);
13545
- }
13546
- function manifestPath(dir) {
13547
- return (0, import_node_path11.join)(dir, "manifest.json");
13548
- }
13549
- function mirrorPath(dir, repoRelPath) {
13550
- return (0, import_node_path11.join)(dir, "files", repoRelPath);
13551
- }
13552
- function captureBaseline(opts = {}) {
13553
- const key = sessionKey(opts.sessionId);
13554
- const dir = sessionDir(key);
13555
- const existing = readManifest(dir);
13556
- const freshStart = opts.source === "startup" || opts.source === "clear";
13557
- if (existing && !freshStart) {
13558
- return { baseline: existing, created: false };
13559
- }
13560
- const head_sha = getCurrentCommit();
13561
- const dirty = getDirtyFiles();
13562
- try {
13563
- (0, import_node_fs13.rmSync)(dir, { recursive: true, force: true });
13564
- } catch {
13565
- }
13566
- const filesDir = (0, import_node_path11.join)(dir, "files");
13567
- const mirrored = [];
13568
- try {
13569
- (0, import_node_fs13.mkdirSync)(filesDir, { recursive: true });
13570
- for (const p of dirty) {
13571
- if (p.includes("..")) continue;
13572
- const content = safeReadForMirror(projectPath(p));
13573
- if (content === null) continue;
13574
- const dest = mirrorPath(dir, p);
13575
- try {
13576
- (0, import_node_fs13.mkdirSync)((0, import_node_path11.dirname)(dest), { recursive: true });
13577
- (0, import_node_fs13.writeFileSync)(dest, content);
13578
- mirrored.push(p);
13579
- } catch {
13580
- }
13581
- }
13582
- } catch {
13583
- }
13584
- const baseline = {
13585
- session_id: opts.sessionId ?? "",
13586
- head_sha,
13587
- captured_at: Date.now(),
13588
- dirty_paths: mirrored,
13589
- version: BASELINE_VERSION
13590
- };
13591
- try {
13592
- (0, import_node_fs13.mkdirSync)(dir, { recursive: true });
13593
- (0, import_node_fs13.writeFileSync)(manifestPath(dir), JSON.stringify(baseline));
13594
- } catch {
13595
- }
13596
- pruneOldBaselines();
13597
- return { baseline, created: true };
13598
- }
13599
- function readBaseline(sessionId) {
13600
- return readManifest(sessionDir(sessionKey(sessionId)));
13601
- }
13602
- function readManifest(dir) {
13603
- const mp = manifestPath(dir);
13604
- if (!(0, import_node_fs13.existsSync)(mp)) return null;
13605
- try {
13606
- const parsed = JSON.parse((0, import_node_fs13.readFileSync)(mp, "utf-8"));
13607
- if (typeof parsed.head_sha !== "string" || typeof parsed.captured_at !== "number" || !Array.isArray(parsed.dirty_paths) || parsed.version !== BASELINE_VERSION) {
13608
- return null;
13609
- }
13610
- return {
13611
- session_id: typeof parsed.session_id === "string" ? parsed.session_id : "",
13612
- head_sha: parsed.head_sha,
13613
- captured_at: parsed.captured_at,
13614
- dirty_paths: parsed.dirty_paths.filter((p) => typeof p === "string"),
13615
- version: parsed.version
13616
- };
13617
- } catch {
13618
- return null;
13619
- }
13620
- }
13621
- var preImageCache = /* @__PURE__ */ new WeakMap();
13622
- function preImage(repoRelPath, baseline) {
13623
- let perBaseline = preImageCache.get(baseline);
13624
- if (!perBaseline) {
13625
- perBaseline = /* @__PURE__ */ new Map();
13626
- preImageCache.set(baseline, perBaseline);
13627
- }
13628
- const cached = perBaseline.get(repoRelPath);
13629
- if (cached) return cached;
13630
- const resolved = resolvePreImage(repoRelPath, baseline);
13631
- perBaseline.set(repoRelPath, resolved);
13632
- return resolved;
13633
- }
13634
- function resolvePreImage(repoRelPath, baseline) {
13635
- if (baseline.dirty_paths.includes(repoRelPath)) {
13636
- const mp = mirrorPath(sessionDir(sessionKey(baseline.session_id)), repoRelPath);
13637
- if ((0, import_node_fs13.existsSync)(mp)) {
13638
- try {
13639
- return { content: (0, import_node_fs13.readFileSync)(mp, "utf-8"), existed: true };
13640
- } catch {
13641
- }
13642
- }
13643
- }
13644
- const atHead = showContentAtRef(baseline.head_sha, repoRelPath);
13645
- if (atHead !== null) return { content: atHead, existed: true };
13646
- return { content: "", existed: false };
13647
- }
13648
- function generateBaselineDiffs(files, baseline) {
13649
- if (!baseline) return { diffs: [], has_baseline: false };
13650
- const diffs = [];
13651
- for (const file of files) {
13652
- const language = file.language ?? detectLanguage(file.path);
13653
- const pre = preImage(file.path, baseline);
13654
- if (pre.existed) {
13655
- if (pre.content === file.content) continue;
13656
- const diff = computeDiff(pre.content, file.content, file.path);
13657
- if (diff) diffs.push({ path: file.path, language, diff, status: "modified" });
13658
- } else {
13659
- const addedLines = file.content.split("\n").map((l) => `+${l}`).join("\n");
13660
- diffs.push({
13661
- path: file.path,
13662
- language,
13663
- diff: `--- /dev/null
13664
- +++ b/${file.path}
13665
- @@ -0,0 +1,${file.content.split("\n").length} @@
13666
- ${addedLines}`,
13667
- status: "added"
13668
- });
13669
- }
13670
- }
13671
- return { diffs, has_baseline: true };
13672
- }
13673
- function changedSinceBaseline(repoRelPath, baseline) {
13674
- const pre = preImage(repoRelPath, baseline);
13675
- let current;
13676
- try {
13677
- current = (0, import_node_fs13.readFileSync)(projectPath(repoRelPath), "utf-8");
13678
- } catch {
13679
- return pre.existed;
13680
- }
13681
- if (!pre.existed) return true;
13682
- return current !== pre.content;
13683
- }
13684
- function safeReadForMirror(absPath) {
13685
- try {
13686
- if ((0, import_node_fs13.statSync)(absPath).size > MIRROR_MAX_BYTES) return null;
13687
- const buf = (0, import_node_fs13.readFileSync)(absPath);
13688
- if (buf.includes(0)) return null;
13689
- return buf.toString("utf-8");
13690
- } catch {
13691
- return null;
13692
- }
13693
- }
13694
- function pruneOldBaselines() {
13695
- const root = projectPath(BASELINE_DIR);
13696
- let entries;
13697
- try {
13698
- entries = (0, import_node_fs13.readdirSync)(root);
13699
- } catch {
13700
- return;
13701
- }
13702
- const now = Date.now();
13703
- for (const name of entries) {
13704
- const dir = (0, import_node_path11.join)(root, name);
13705
- const manifest = readManifest(dir);
13706
- if (!manifest) {
13707
- try {
13708
- if (now - (0, import_node_fs13.statSync)(dir).mtimeMs > BASELINE_TTL_MS) {
13709
- (0, import_node_fs13.rmSync)(dir, { recursive: true, force: true });
13710
- }
13711
- } catch {
13712
- }
13713
- continue;
13714
- }
13715
- if (now - manifest.captured_at <= BASELINE_TTL_MS) continue;
13716
- try {
13717
- (0, import_node_fs13.rmSync)(dir, { recursive: true, force: true });
13718
- } catch {
13719
- }
13720
- }
13721
- }
13722
-
13723
- // src/lib/offline.ts
13724
- var import_node_fs14 = require("node:fs");
13725
- var import_node_crypto5 = require("node:crypto");
13726
13470
  function cacheRequest(body) {
13727
13471
  try {
13728
- (0, import_node_fs14.mkdirSync)(CACHE_DIR, { recursive: true });
13729
- const suffix = (0, import_node_crypto5.randomBytes)(4).toString("hex");
13472
+ (0, import_node_fs13.mkdirSync)(CACHE_DIR, { recursive: true });
13473
+ const suffix = (0, import_node_crypto4.randomBytes)(4).toString("hex");
13730
13474
  const filename = `pending-${Math.floor(Date.now() / 1e3)}-${suffix}.json`;
13731
- (0, import_node_fs14.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(body));
13475
+ (0, import_node_fs13.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(body));
13732
13476
  } catch {
13733
13477
  }
13734
13478
  }
@@ -13742,7 +13486,7 @@ function buildOfflineFallback(reason, staticResults) {
13742
13486
  }
13743
13487
 
13744
13488
  // src/lib/context-files.ts
13745
- var import_node_fs15 = require("node:fs");
13489
+ var import_node_fs14 = require("node:fs");
13746
13490
  var MAX_CONTEXT_FILES = 10;
13747
13491
  var MAX_CONTEXT_FILE_BYTES = 10240;
13748
13492
  var MAX_CONTEXT_TOTAL_BYTES = 51200;
@@ -13754,7 +13498,7 @@ function gatherContextFiles(contextPaths, deltaFiles) {
13754
13498
  if (result.length >= MAX_CONTEXT_FILES) break;
13755
13499
  if (deltaPaths.has(filePath)) continue;
13756
13500
  try {
13757
- const content = (0, import_node_fs15.readFileSync)(filePath, "utf8");
13501
+ const content = (0, import_node_fs14.readFileSync)(filePath, "utf8");
13758
13502
  const bytes = Buffer.byteLength(content);
13759
13503
  if (bytes > MAX_CONTEXT_FILE_BYTES) {
13760
13504
  logEvent("context_file_skipped", { path: filePath, reason: "too_large", bytes });
@@ -13799,20 +13543,20 @@ function gatherContextFiles(contextPaths, deltaFiles) {
13799
13543
  }
13800
13544
 
13801
13545
  // src/lib/cache-cleanup.ts
13802
- var import_node_fs16 = require("node:fs");
13803
- var import_node_path12 = require("node:path");
13546
+ var import_node_fs15 = require("node:fs");
13547
+ var import_node_path11 = require("node:path");
13804
13548
  var CACHE_TTL_DAYS = 7;
13805
13549
  function pruneStaleCache() {
13806
13550
  try {
13807
13551
  const dir = projectPath(CACHE_DIR);
13808
13552
  const cutoff = Date.now() - CACHE_TTL_DAYS * 24 * 3600 * 1e3;
13809
- for (const entry of (0, import_node_fs16.readdirSync)(dir)) {
13553
+ for (const entry of (0, import_node_fs15.readdirSync)(dir)) {
13810
13554
  if (!entry.startsWith("pending-")) continue;
13811
- const path = (0, import_node_path12.join)(dir, entry);
13555
+ const path = (0, import_node_path11.join)(dir, entry);
13812
13556
  try {
13813
- const stat3 = (0, import_node_fs16.statSync)(path);
13557
+ const stat3 = (0, import_node_fs15.statSync)(path);
13814
13558
  if (stat3.mtimeMs < cutoff) {
13815
- (0, import_node_fs16.unlinkSync)(path);
13559
+ (0, import_node_fs15.unlinkSync)(path);
13816
13560
  logEvent("cache_entry_pruned", {
13817
13561
  path: entry,
13818
13562
  age_days: Math.round((Date.now() - stat3.mtimeMs) / 864e5)
@@ -13884,11 +13628,10 @@ function reconcileAnalysisMode(predictedMode, signals) {
13884
13628
  signals.noFilesChanged,
13885
13629
  signals.assistantResponse,
13886
13630
  signals.conversationPrompts,
13887
- signals.actionSummary,
13888
- signals.sessionAuthoredCode
13631
+ signals.actionSummary
13889
13632
  );
13890
13633
  }
13891
- const agentAuthoredCode = !!(signals.actionSummary && (signals.actionSummary.files_edited.length > 0 || signals.actionSummary.files_created.length > 0)) || !!signals.sessionAuthoredCode;
13634
+ const agentAuthoredCode = !!(signals.actionSummary && (signals.actionSummary.files_edited.length > 0 || signals.actionSummary.files_created.length > 0));
13892
13635
  const agentInvestigated = didAgentInvestigate(signals.actionSummary);
13893
13636
  switch (predictedMode) {
13894
13637
  case "skip":
@@ -13913,8 +13656,8 @@ function didAgentInvestigate(summary) {
13913
13656
  function isValidMode(mode) {
13914
13657
  return mode === "standard" || mode === "plan" || mode === "debug" || mode === "skip";
13915
13658
  }
13916
- function detectAnalysisMode(noFilesChanged, assistantResponse, conversationPrompts, actionSummary, sessionAuthoredCode) {
13917
- const agentAuthoredCode = !!(actionSummary && (actionSummary.files_edited.length > 0 || actionSummary.files_created.length > 0)) || !!sessionAuthoredCode;
13659
+ function detectAnalysisMode(noFilesChanged, assistantResponse, conversationPrompts, actionSummary) {
13660
+ const agentAuthoredCode = !!(actionSummary && (actionSummary.files_edited.length > 0 || actionSummary.files_created.length > 0));
13918
13661
  if (conversationPrompts.length > 0 && conversationPrompts.every(isGitOnlyPrompt)) {
13919
13662
  if (!agentAuthoredCode) return "skip";
13920
13663
  }
@@ -13994,7 +13737,7 @@ function isMetaTaskLabel(label2) {
13994
13737
  }
13995
13738
 
13996
13739
  // src/lib/transcript.ts
13997
- var import_node_fs17 = require("node:fs");
13740
+ var import_node_fs16 = require("node:fs");
13998
13741
  var MAX_READ_BYTES = 256 * 1024;
13999
13742
  var SMALL_FILE_BYTES = 64 * 1024;
14000
13743
  var MAX_FILES_LIST = 20;
@@ -14016,14 +13759,14 @@ async function extractActionSummary(transcriptPath) {
14016
13759
  function readTurnLines(transcriptPath) {
14017
13760
  let size;
14018
13761
  try {
14019
- size = (0, import_node_fs17.statSync)(transcriptPath).size;
13762
+ size = (0, import_node_fs16.statSync)(transcriptPath).size;
14020
13763
  } catch {
14021
13764
  return null;
14022
13765
  }
14023
13766
  if (size === 0) return null;
14024
13767
  let raw;
14025
13768
  if (size <= SMALL_FILE_BYTES) {
14026
- raw = (0, import_node_fs17.readFileSync)(transcriptPath, "utf-8");
13769
+ raw = (0, import_node_fs16.readFileSync)(transcriptPath, "utf-8");
14027
13770
  } else {
14028
13771
  const buf = Buffer.alloc(Math.min(MAX_READ_BYTES, size));
14029
13772
  const fd = require("node:fs").openSync(transcriptPath, "r");
@@ -14111,12 +13854,6 @@ function buildSummary(lines) {
14111
13854
  case "Edit":
14112
13855
  addPath(filesEdited, input.file_path);
14113
13856
  break;
14114
- case "MultiEdit":
14115
- addPath(filesEdited, input.file_path);
14116
- break;
14117
- case "NotebookEdit":
14118
- addPath(filesEdited, input.notebook_path ?? input.file_path);
14119
- break;
14120
13857
  case "Write":
14121
13858
  addPath(filesCreated, input.file_path);
14122
13859
  addPath(filesEdited, input.file_path);
@@ -14200,8 +13937,8 @@ function capArray(set, max) {
14200
13937
 
14201
13938
  // src/lib/seed-runner.ts
14202
13939
  var import_promises11 = require("node:fs/promises");
14203
- var import_node_fs18 = require("node:fs");
14204
- var import_node_path13 = require("node:path");
13940
+ var import_node_fs17 = require("node:fs");
13941
+ var import_node_path12 = require("node:path");
14205
13942
  var import_yaml2 = __toESM(require_dist());
14206
13943
 
14207
13944
  // src/lib/seed.ts
@@ -14440,7 +14177,7 @@ function renderNodeMarkdown(candidate, nodeId, createdAt) {
14440
14177
  return fm;
14441
14178
  }
14442
14179
  async function runSeed(opts) {
14443
- if (!(0, import_node_fs18.existsSync)(STANDARD_FILE)) {
14180
+ if (!(0, import_node_fs17.existsSync)(STANDARD_FILE)) {
14444
14181
  return { created: 0, failed: 0, skipped: "no_standard", candidates: [] };
14445
14182
  }
14446
14183
  let standardDoc;
@@ -14452,7 +14189,7 @@ async function runSeed(opts) {
14452
14189
  }
14453
14190
  const knowledgeSpec = standardDoc.knowledge_spec ?? {};
14454
14191
  let readmeContent;
14455
- if ((0, import_node_fs18.existsSync)("README.md")) {
14192
+ if ((0, import_node_fs17.existsSync)("README.md")) {
14456
14193
  try {
14457
14194
  readmeContent = await (0, import_promises11.readFile)("README.md", "utf-8");
14458
14195
  } catch {
@@ -14460,7 +14197,7 @@ async function runSeed(opts) {
14460
14197
  }
14461
14198
  let claudeMdContent;
14462
14199
  for (const p of ["CLAUDE.md", ".claude/CLAUDE.md"]) {
14463
- if ((0, import_node_fs18.existsSync)(p)) {
14200
+ if ((0, import_node_fs17.existsSync)(p)) {
14464
14201
  try {
14465
14202
  claudeMdContent = await (0, import_promises11.readFile)(p, "utf-8");
14466
14203
  break;
@@ -14483,8 +14220,8 @@ async function runSeed(opts) {
14483
14220
  if (candidates.length === 0) {
14484
14221
  return { created: 0, failed: 0, skipped: "no_candidates", candidates: [] };
14485
14222
  }
14486
- const overviewPath = (0, import_node_path13.join)(MEMORY_DIR, "domain", "project-overview.md");
14487
- if ((0, import_node_fs18.existsSync)(overviewPath) && !opts.force) {
14223
+ const overviewPath = (0, import_node_path12.join)(MEMORY_DIR, "domain", "project-overview.md");
14224
+ if ((0, import_node_fs17.existsSync)(overviewPath) && !opts.force) {
14488
14225
  return { created: 0, failed: 0, skipped: "already_seeded", candidates };
14489
14226
  }
14490
14227
  if (opts.dryRun) {
@@ -14519,9 +14256,9 @@ async function runSeed(opts) {
14519
14256
  }
14520
14257
  const nodeId = res.data.node_id;
14521
14258
  const filePathRel = res.data.file_path;
14522
- const targetPath = (0, import_node_path13.join)(MEMORY_DIR, filePathRel);
14259
+ const targetPath = (0, import_node_path12.join)(MEMORY_DIR, filePathRel);
14523
14260
  try {
14524
- await (0, import_promises11.mkdir)((0, import_node_path13.dirname)(targetPath), { recursive: true });
14261
+ await (0, import_promises11.mkdir)((0, import_node_path12.dirname)(targetPath), { recursive: true });
14525
14262
  await (0, import_promises11.writeFile)(targetPath, renderNodeMarkdown(c, nodeId, createdAt));
14526
14263
  created++;
14527
14264
  opts.onCreated?.(nodeId, filePathRel, c);
@@ -14591,15 +14328,6 @@ async function runAnalyze(opts, globals) {
14591
14328
  }
14592
14329
  const { assistantMessage: assistantResponse, stopReason, transcriptPath, sessionId } = await readStopHookStdin();
14593
14330
  const actionSummary = transcriptPath ? await extractActionSummary(transcriptPath) : null;
14594
- const baselineSessionId = sessionId || process.env.CLAUDE_SESSION_ID || void 0;
14595
- const baseline = readBaseline(baselineSessionId);
14596
- if (baseline) {
14597
- logEvent("baseline_loaded", {
14598
- head: baseline.head_sha.slice(0, 12),
14599
- dirty_count: baseline.dirty_paths.length,
14600
- age_ms: Date.now() - baseline.captured_at
14601
- });
14602
- }
14603
14331
  const { files: allChanged, hasRecentCommitFiles } = getChangedFiles();
14604
14332
  const analyzable = filterAnalyzable(allChanged);
14605
14333
  const reviewable = filterReviewable(allChanged);
@@ -14609,7 +14337,7 @@ async function runAnalyze(opts, globals) {
14609
14337
  passAndExit("No analyzable files changed");
14610
14338
  }
14611
14339
  const allForReview = Array.from(/* @__PURE__ */ new Set([...analyzable, ...reviewable]));
14612
- const conversation = await readAndClearConversationBuffer(sessionId ?? void 0);
14340
+ const conversation = await readAndClearConversationBuffer();
14613
14341
  const specs = discoverSpecs();
14614
14342
  const plans = discoverPlans();
14615
14343
  const latestPrompt = conversation?.prompts?.[conversation.prompts.length - 1]?.prompt ?? "";
@@ -14659,14 +14387,13 @@ async function runAnalyze(opts, globals) {
14659
14387
  }
14660
14388
  const conversationPrompts = (conversation?.prompts ?? []).map((p) => p.prompt);
14661
14389
  let analysisMode;
14662
- const sessionAuthoredCode = !!baseline && allForReview.some((f) => changedSinceBaseline(f, baseline));
14663
14390
  const modeOverride = opts.mode;
14664
14391
  if (modeOverride && ["standard", "plan", "debug", "skip"].includes(modeOverride)) {
14665
14392
  analysisMode = modeOverride;
14666
14393
  } else {
14667
14394
  analysisMode = reconcileAnalysisMode(
14668
14395
  predictedMode,
14669
- { noFilesChanged, assistantResponse, actionSummary, conversationPrompts, sessionAuthoredCode }
14396
+ { noFilesChanged, assistantResponse, actionSummary, conversationPrompts }
14670
14397
  );
14671
14398
  }
14672
14399
  if (analysisMode === "skip") {
@@ -14724,16 +14451,10 @@ async function runAnalyze(opts, globals) {
14724
14451
  const baseForReview = agentNarrowed.length > 0 ? agentNarrowed : allForReview;
14725
14452
  const recentForReview = narrowToRecent(baseForReview);
14726
14453
  if (!opts.skipStatic && isCodacyAvailable()) {
14727
- let allScannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles]));
14728
- if (baseline) {
14729
- allScannable = allScannable.filter((f) => changedSinceBaseline(f, baseline));
14730
- }
14731
- if (allScannable.length > 0) {
14732
- staticResults = runCodacyAnalysis(allScannable);
14733
- }
14454
+ const allScannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles]));
14455
+ staticResults = runCodacyAnalysis(allScannable);
14734
14456
  }
14735
- const deltaSet = baseline ? recentForReview.filter((f) => changedSinceBaseline(f, baseline)) : recentForReview;
14736
- codeDelta = collectCodeDelta(deltaSet, {
14457
+ codeDelta = collectCodeDelta(recentForReview, {
14737
14458
  maxFiles: parseInt(opts.maxFiles, 10),
14738
14459
  maxFileBytes: parseInt(opts.maxFileSize, 10),
14739
14460
  maxTotalBytes: parseInt(opts.maxTotalSize, 10)
@@ -14748,12 +14469,7 @@ async function runAnalyze(opts, globals) {
14748
14469
  }
14749
14470
  }
14750
14471
  if (analysisMode !== "plan") {
14751
- if (baseline) {
14752
- const baselineDiffs = generateBaselineDiffs(codeDelta.files, baseline);
14753
- snapshotResult = { has_snapshots: baselineDiffs.diffs.length > 0, diffs: baselineDiffs.diffs };
14754
- } else {
14755
- snapshotResult = generateSnapshotDiffs(codeDelta.files);
14756
- }
14472
+ snapshotResult = generateSnapshotDiffs(codeDelta.files);
14757
14473
  currentCommit = getCurrentCommit();
14758
14474
  const maxIterations = parseInt(opts.maxIterations, 10);
14759
14475
  const iterResult = checkMaxIterations(currentCommit, maxIterations, contentHash ?? void 0);
@@ -14785,9 +14501,9 @@ async function runAnalyze(opts, globals) {
14785
14501
  let autoSeedNotice = null;
14786
14502
  try {
14787
14503
  await ensureMemoryDir();
14788
- const seedMarker = (0, import_node_path14.join)(VERITY_DIR, ".seeded");
14789
- const hasStandard = (0, import_node_fs19.existsSync)(STANDARD_FILE);
14790
- const alreadyTried = (0, import_node_fs19.existsSync)(seedMarker);
14504
+ const seedMarker = (0, import_node_path13.join)(VERITY_DIR, ".seeded");
14505
+ const hasStandard = (0, import_node_fs18.existsSync)(STANDARD_FILE);
14506
+ const alreadyTried = (0, import_node_fs18.existsSync)(seedMarker);
14791
14507
  if (hasStandard && !alreadyTried) {
14792
14508
  const preManifest = await buildManifest();
14793
14509
  if (preManifest.nodes.length === 0) {
@@ -14800,7 +14516,7 @@ async function runAnalyze(opts, globals) {
14800
14516
  dryRun: false
14801
14517
  });
14802
14518
  if (seedResult.created > 0) {
14803
- (0, import_node_fs19.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created}
14519
+ (0, import_node_fs18.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} created=${seedResult.created}
14804
14520
  `);
14805
14521
  autoSeedNotice = `Seeded ${seedResult.created} knowledge node(s) from your existing Standard (one-time).`;
14806
14522
  logEvent("auto_seed_ran", {
@@ -14808,7 +14524,7 @@ async function runAnalyze(opts, globals) {
14808
14524
  failed: seedResult.failed
14809
14525
  });
14810
14526
  } else if (seedResult.skipped === "already_seeded") {
14811
- (0, import_node_fs19.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
14527
+ (0, import_node_fs18.writeFileSync)(seedMarker, `${(/* @__PURE__ */ new Date()).toISOString()} skipped=already_seeded
14812
14528
  `);
14813
14529
  } else {
14814
14530
  logEvent("auto_seed_noop", {
@@ -15126,54 +14842,8 @@ async function runAnalyze(opts, globals) {
15126
14842
  }
15127
14843
  }
15128
14844
 
15129
- // src/commands/baseline.ts
15130
- var import_node_fs20 = require("node:fs");
15131
- function registerBaselineCommands(program2) {
15132
- const baseline = program2.command("baseline").description("Manage the task-start working-tree baseline");
15133
- baseline.command("capture").description("Snapshot the working tree at task start (used by SessionStart hook)").option("--session-id <id>", "Session id (overrides any value from stdin)").option("--source <source>", "Lifecycle hint: startup|resume|clear|compact").action(async (opts) => {
15134
- try {
15135
- try {
15136
- process.chdir(repoRoot());
15137
- } catch {
15138
- }
15139
- if (!(0, import_node_fs20.existsSync)(VERITY_DIR)) {
15140
- process.exit(0);
15141
- }
15142
- let sessionId = opts.sessionId;
15143
- let source = opts.source;
15144
- if (!process.stdin.isTTY) {
15145
- const input = (await readStdin()).trim();
15146
- if (input) {
15147
- try {
15148
- const event = JSON.parse(input);
15149
- sessionId = sessionId ?? event.session_id;
15150
- source = source ?? event.source;
15151
- } catch {
15152
- }
15153
- }
15154
- }
15155
- const result = captureBaseline({ sessionId, source });
15156
- logEvent("baseline_capture", {
15157
- created: result.created,
15158
- source: source ?? null,
15159
- dirty_count: result.baseline.dirty_paths.length,
15160
- head: result.baseline.head_sha.slice(0, 12)
15161
- });
15162
- } catch {
15163
- }
15164
- process.exit(0);
15165
- });
15166
- }
15167
- async function readStdin() {
15168
- const chunks = [];
15169
- for await (const chunk of process.stdin) {
15170
- chunks.push(chunk);
15171
- }
15172
- return Buffer.concat(chunks).toString("utf-8");
15173
- }
15174
-
15175
14845
  // src/commands/review.ts
15176
- var import_node_fs21 = require("node:fs");
14846
+ var import_node_fs19 = require("node:fs");
15177
14847
  function registerReviewCommand(program2) {
15178
14848
  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) => {
15179
14849
  const globals = program2.opts();
@@ -15192,7 +14862,7 @@ async function runReview(opts, globals) {
15192
14862
  const securityFiles = filterSecurity(allFiles);
15193
14863
  let staticResults;
15194
14864
  if (isCodacyAvailable()) {
15195
- const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs21.existsSync)(f) || resolveFile(f) !== null);
14865
+ const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).filter((f) => (0, import_node_fs19.existsSync)(f) || resolveFile(f) !== null);
15196
14866
  staticResults = runCodacyAnalysis(scannable);
15197
14867
  } else {
15198
14868
  staticResults = {
@@ -15217,10 +14887,10 @@ async function runReview(opts, globals) {
15217
14887
  const specPaths = opts.specs.split(",").map((f) => f.trim()).filter(Boolean);
15218
14888
  specs = [];
15219
14889
  for (const p of specPaths) {
15220
- if (!(0, import_node_fs21.existsSync)(p)) continue;
14890
+ if (!(0, import_node_fs19.existsSync)(p)) continue;
15221
14891
  try {
15222
- const { readFileSync: readFileSync12 } = await import("node:fs");
15223
- const content = readFileSync12(p, "utf-8");
14892
+ const { readFileSync: readFileSync11 } = await import("node:fs");
14893
+ const content = readFileSync11(p, "utf-8");
15224
14894
  specs.push({ path: p, content: content.slice(0, 10240) });
15225
14895
  } catch {
15226
14896
  }
@@ -15277,10 +14947,10 @@ async function runReview(opts, globals) {
15277
14947
  }
15278
14948
 
15279
14949
  // src/commands/guard.ts
15280
- var import_node_fs22 = require("node:fs");
15281
- var import_node_path15 = require("node:path");
14950
+ var import_node_fs20 = require("node:fs");
14951
+ var import_node_path14 = require("node:path");
15282
14952
  var GUARD_BLOCK_CAP = 2;
15283
- var GUARD_ITER_FILE = (0, import_node_path15.join)(VERITY_DIR, ".guard-iteration");
14953
+ var GUARD_ITER_FILE = (0, import_node_path14.join)(VERITY_DIR, ".guard-iteration");
15284
14954
  function readPreToolUseStdin() {
15285
14955
  const empty = { command: "", cwd: null, sessionId: null };
15286
14956
  return new Promise((resolve) => {
@@ -15344,7 +15014,7 @@ function classifyCommand(command, on) {
15344
15014
  }
15345
15015
  function readIterMap() {
15346
15016
  try {
15347
- const raw = JSON.parse((0, import_node_fs22.readFileSync)(GUARD_ITER_FILE, "utf-8"));
15017
+ const raw = JSON.parse((0, import_node_fs20.readFileSync)(GUARD_ITER_FILE, "utf-8"));
15348
15018
  if (raw && typeof raw === "object") {
15349
15019
  if (typeof raw.moment === "string" && typeof raw.count === "number") {
15350
15020
  return { [raw.moment]: raw.count };
@@ -15364,10 +15034,10 @@ function readIter(moment) {
15364
15034
  }
15365
15035
  function writeIter(moment, count) {
15366
15036
  try {
15367
- (0, import_node_fs22.mkdirSync)(VERITY_DIR, { recursive: true });
15037
+ (0, import_node_fs20.mkdirSync)(VERITY_DIR, { recursive: true });
15368
15038
  const map = readIterMap();
15369
15039
  map[moment] = count;
15370
- (0, import_node_fs22.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
15040
+ (0, import_node_fs20.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
15371
15041
  } catch {
15372
15042
  }
15373
15043
  }
@@ -15377,10 +15047,10 @@ function resetIter(moment) {
15377
15047
  if (!(moment in map)) return;
15378
15048
  delete map[moment];
15379
15049
  if (Object.keys(map).length === 0) {
15380
- if ((0, import_node_fs22.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs22.unlinkSync)(GUARD_ITER_FILE);
15050
+ if ((0, import_node_fs20.existsSync)(GUARD_ITER_FILE)) (0, import_node_fs20.unlinkSync)(GUARD_ITER_FILE);
15381
15051
  } else {
15382
- (0, import_node_fs22.mkdirSync)(VERITY_DIR, { recursive: true });
15383
- (0, import_node_fs22.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
15052
+ (0, import_node_fs20.mkdirSync)(VERITY_DIR, { recursive: true });
15053
+ (0, import_node_fs20.writeFileSync)(GUARD_ITER_FILE, JSON.stringify(map));
15384
15054
  }
15385
15055
  } catch {
15386
15056
  }
@@ -15444,7 +15114,7 @@ function buildGuardRequest(moment, files, iter, sessionId, command) {
15444
15114
  const securityFiles = filterSecurity(files);
15445
15115
  let staticResults;
15446
15116
  if (isCodacyAvailable()) {
15447
- const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).map((f) => (0, import_node_fs22.existsSync)(f) ? f : resolveFile(f)).filter((f) => f !== null);
15117
+ const scannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles])).map((f) => (0, import_node_fs20.existsSync)(f) ? f : resolveFile(f)).filter((f) => f !== null);
15448
15118
  staticResults = runCodacyAnalysis(scannable);
15449
15119
  } else {
15450
15120
  staticResults = { tool: "@codacy/analysis-cli", findings: [], summary: { total_findings: 0, by_severity: {}, tools_run: [] } };
@@ -15489,7 +15159,7 @@ function emitAllowNotice(userMsg, agentMsg) {
15489
15159
  async function runGuard(opts, globals) {
15490
15160
  const on = opts.on.split(",").map((s) => s.trim()).filter((s) => s === "commit" || s === "push");
15491
15161
  const { command, cwd, sessionId } = await readPreToolUseStdin();
15492
- if (cwd && (0, import_node_fs22.existsSync)(cwd)) {
15162
+ if (cwd && (0, import_node_fs20.existsSync)(cwd)) {
15493
15163
  try {
15494
15164
  process.chdir(cwd);
15495
15165
  } catch {
@@ -15594,14 +15264,14 @@ function writeBlockMessage(moment, response) {
15594
15264
  }
15595
15265
 
15596
15266
  // src/commands/init.ts
15597
- var import_node_fs24 = require("node:fs");
15267
+ var import_node_fs22 = require("node:fs");
15598
15268
  var import_promises12 = require("node:fs/promises");
15599
- var import_node_path17 = require("node:path");
15269
+ var import_node_path16 = require("node:path");
15600
15270
  var import_node_child_process9 = require("node:child_process");
15601
15271
 
15602
15272
  // src/commands/migrate.ts
15603
- var import_node_fs23 = require("node:fs");
15604
- var import_node_path16 = require("node:path");
15273
+ var import_node_fs21 = require("node:fs");
15274
+ var import_node_path15 = require("node:path");
15605
15275
  var import_node_child_process8 = require("node:child_process");
15606
15276
  var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
15607
15277
  function defaultNpmRemover(pkg) {
@@ -15637,12 +15307,12 @@ async function runMigration(opts = {}) {
15637
15307
  return { actions, migrated: actions.length > 0 };
15638
15308
  }
15639
15309
  function migrateProjectDir(root, actions) {
15640
- const gateDir = (0, import_node_path16.join)(root, ".gate");
15641
- const verityDir = (0, import_node_path16.join)(root, ".verity");
15642
- if ((0, import_node_fs23.existsSync)(gateDir) && !(0, import_node_fs23.existsSync)(verityDir)) {
15310
+ const gateDir = (0, import_node_path15.join)(root, ".gate");
15311
+ const verityDir = (0, import_node_path15.join)(root, ".verity");
15312
+ if ((0, import_node_fs21.existsSync)(gateDir) && !(0, import_node_fs21.existsSync)(verityDir)) {
15643
15313
  return migrateProjectDirRename(root, gateDir, verityDir, actions);
15644
15314
  }
15645
- if ((0, import_node_fs23.existsSync)(gateDir) && (0, import_node_fs23.existsSync)(verityDir)) {
15315
+ if ((0, import_node_fs21.existsSync)(gateDir) && (0, import_node_fs21.existsSync)(verityDir)) {
15646
15316
  return migrateProjectDirCarry(gateDir, verityDir, actions);
15647
15317
  }
15648
15318
  return false;
@@ -15663,13 +15333,13 @@ function migrateProjectDirRename(root, gateDir, verityDir, actions) {
15663
15333
  }
15664
15334
  }
15665
15335
  if (moved) {
15666
- if ((0, import_node_fs23.existsSync)(gateDir)) {
15336
+ if ((0, import_node_fs21.existsSync)(gateDir)) {
15667
15337
  const carried = carryLegacyContents(gateDir, verityDir);
15668
15338
  if (carried > 0) {
15669
15339
  actions.push(`Carried ${carried} untracked legacy file(s) from .gate/ into .verity/`);
15670
15340
  }
15671
15341
  try {
15672
- (0, import_node_fs23.rmSync)(gateDir, { recursive: true, force: true });
15342
+ (0, import_node_fs21.rmSync)(gateDir, { recursive: true, force: true });
15673
15343
  } catch {
15674
15344
  }
15675
15345
  }
@@ -15685,18 +15355,18 @@ function migrateProjectDirCarry(gateDir, verityDir, actions) {
15685
15355
  actions.push(`Carried ${carried} legacy file(s) from .gate/ into .verity/`);
15686
15356
  }
15687
15357
  try {
15688
- (0, import_node_fs23.rmSync)(gateDir, { recursive: true, force: true });
15358
+ (0, import_node_fs21.rmSync)(gateDir, { recursive: true, force: true });
15689
15359
  } catch {
15690
15360
  }
15691
15361
  return carried > 0;
15692
15362
  }
15693
15363
  function migrateGlobalCredentials(home, actions) {
15694
15364
  if (!home) return;
15695
- const gateCreds = (0, import_node_path16.join)(home, ".gate", "credentials");
15696
- const verityCreds = (0, import_node_path16.join)(home, ".verity", "credentials");
15697
- if (!(0, import_node_fs23.existsSync)(gateCreds)) return;
15698
- if (!(0, import_node_fs23.existsSync)(verityCreds)) {
15699
- (0, import_node_fs23.mkdirSync)((0, import_node_path16.join)(home, ".verity"), { recursive: true });
15365
+ const gateCreds = (0, import_node_path15.join)(home, ".gate", "credentials");
15366
+ const verityCreds = (0, import_node_path15.join)(home, ".verity", "credentials");
15367
+ if (!(0, import_node_fs21.existsSync)(gateCreds)) return;
15368
+ if (!(0, import_node_fs21.existsSync)(verityCreds)) {
15369
+ (0, import_node_fs21.mkdirSync)((0, import_node_path15.join)(home, ".verity"), { recursive: true });
15700
15370
  moveFile(gateCreds, verityCreds);
15701
15371
  actions.push("Moved ~/.gate/credentials \u2192 ~/.verity/credentials");
15702
15372
  return;
@@ -15718,8 +15388,8 @@ async function migrateLegacyHooks(root, actions) {
15718
15388
  }
15719
15389
  }
15720
15390
  async function migrateClaudeMd(root, actions) {
15721
- const claudeMd = (0, import_node_path16.join)(root, "CLAUDE.md");
15722
- const hadLegacyBlock = (0, import_node_fs23.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
15391
+ const claudeMd = (0, import_node_path15.join)(root, "CLAUDE.md");
15392
+ const hadLegacyBlock = (0, import_node_fs21.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
15723
15393
  if (!hadLegacyBlock) return;
15724
15394
  try {
15725
15395
  await ensureClaudeMdPointer(root);
@@ -15729,9 +15399,9 @@ async function migrateClaudeMd(root, actions) {
15729
15399
  }
15730
15400
  }
15731
15401
  function migrateStandardFile(root, actions) {
15732
- const gateMd = (0, import_node_path16.join)(root, "GATE.md");
15733
- const verityMd = (0, import_node_path16.join)(root, "VERITY.md");
15734
- if (!(0, import_node_fs23.existsSync)(gateMd) || (0, import_node_fs23.existsSync)(verityMd)) return;
15402
+ const gateMd = (0, import_node_path15.join)(root, "GATE.md");
15403
+ const verityMd = (0, import_node_path15.join)(root, "VERITY.md");
15404
+ if (!(0, import_node_fs21.existsSync)(gateMd) || (0, import_node_fs21.existsSync)(verityMd)) return;
15735
15405
  let moved = false;
15736
15406
  if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
15737
15407
  try {
@@ -15743,7 +15413,7 @@ function migrateStandardFile(root, actions) {
15743
15413
  if (!moved) moveFile(gateMd, verityMd);
15744
15414
  const content = readFileSyncSafe(verityMd);
15745
15415
  const refreshed = content.split("GATE.md").join("VERITY.md");
15746
- if (refreshed !== content) (0, import_node_fs23.writeFileSync)(verityMd, refreshed);
15416
+ if (refreshed !== content) (0, import_node_fs21.writeFileSync)(verityMd, refreshed);
15747
15417
  actions.push("Renamed GATE.md \u2192 VERITY.md");
15748
15418
  }
15749
15419
  function removeLegacyPackage(movedProjectDir, npmRemover, actions) {
@@ -15777,14 +15447,14 @@ function mergeGlobalCredentials(gateCreds, verityCreds) {
15777
15447
  }
15778
15448
  if (toAppend.length > 0) {
15779
15449
  const sep = verityContent.endsWith("\n") || verityContent === "" ? "" : "\n";
15780
- (0, import_node_fs23.writeFileSync)(verityCreds, verityContent + sep + toAppend.join("\n") + "\n");
15450
+ (0, import_node_fs21.writeFileSync)(verityCreds, verityContent + sep + toAppend.join("\n") + "\n");
15781
15451
  }
15782
- (0, import_node_fs23.rmSync)(gateCreds, { force: true });
15452
+ (0, import_node_fs21.rmSync)(gateCreds, { force: true });
15783
15453
  return toAppend.length;
15784
15454
  }
15785
15455
  function readFileSyncSafe(path) {
15786
15456
  try {
15787
- return (0, import_node_fs23.readFileSync)(path, "utf-8");
15457
+ return (0, import_node_fs21.readFileSync)(path, "utf-8");
15788
15458
  } catch {
15789
15459
  return "";
15790
15460
  }
@@ -15799,35 +15469,35 @@ function hasStagedChanges(root) {
15799
15469
  }
15800
15470
  function moveDir(from, to) {
15801
15471
  try {
15802
- (0, import_node_fs23.renameSync)(from, to);
15472
+ (0, import_node_fs21.renameSync)(from, to);
15803
15473
  } catch (err) {
15804
15474
  if (err.code !== "EXDEV") throw err;
15805
- (0, import_node_fs23.cpSync)(from, to, { recursive: true });
15806
- (0, import_node_fs23.rmSync)(from, { recursive: true, force: true });
15475
+ (0, import_node_fs21.cpSync)(from, to, { recursive: true });
15476
+ (0, import_node_fs21.rmSync)(from, { recursive: true, force: true });
15807
15477
  }
15808
15478
  }
15809
15479
  function moveFile(from, to) {
15810
15480
  try {
15811
- (0, import_node_fs23.renameSync)(from, to);
15481
+ (0, import_node_fs21.renameSync)(from, to);
15812
15482
  } catch (err) {
15813
15483
  if (err.code !== "EXDEV") throw err;
15814
- (0, import_node_fs23.cpSync)(from, to);
15815
- (0, import_node_fs23.rmSync)(from, { force: true });
15484
+ (0, import_node_fs21.cpSync)(from, to);
15485
+ (0, import_node_fs21.rmSync)(from, { force: true });
15816
15486
  }
15817
15487
  }
15818
15488
  function carryLegacyContents(gateDir, verityDir) {
15819
15489
  let copied = 0;
15820
15490
  const walk = (relDir) => {
15821
- const srcDir = (0, import_node_path16.join)(gateDir, relDir);
15822
- for (const entry of (0, import_node_fs23.readdirSync)(srcDir)) {
15823
- const rel = relDir ? (0, import_node_path16.join)(relDir, entry) : entry;
15824
- const src = (0, import_node_path16.join)(gateDir, rel);
15825
- const dest = (0, import_node_path16.join)(verityDir, rel);
15826
- if ((0, import_node_fs23.statSync)(src).isDirectory()) {
15491
+ const srcDir = (0, import_node_path15.join)(gateDir, relDir);
15492
+ for (const entry of (0, import_node_fs21.readdirSync)(srcDir)) {
15493
+ const rel = relDir ? (0, import_node_path15.join)(relDir, entry) : entry;
15494
+ const src = (0, import_node_path15.join)(gateDir, rel);
15495
+ const dest = (0, import_node_path15.join)(verityDir, rel);
15496
+ if ((0, import_node_fs21.statSync)(src).isDirectory()) {
15827
15497
  walk(rel);
15828
- } else if (!(0, import_node_fs23.existsSync)(dest)) {
15829
- (0, import_node_fs23.mkdirSync)((0, import_node_path16.dirname)(dest), { recursive: true });
15830
- (0, import_node_fs23.cpSync)(src, dest);
15498
+ } else if (!(0, import_node_fs21.existsSync)(dest)) {
15499
+ (0, import_node_fs21.mkdirSync)((0, import_node_path15.dirname)(dest), { recursive: true });
15500
+ (0, import_node_fs21.cpSync)(src, dest);
15831
15501
  copied++;
15832
15502
  }
15833
15503
  }
@@ -15836,22 +15506,22 @@ function carryLegacyContents(gateDir, verityDir) {
15836
15506
  return copied;
15837
15507
  }
15838
15508
  async function needsMigration(root = repoRoot()) {
15839
- const gateDir = (0, import_node_path16.join)(root, ".gate");
15840
- const verityDir = (0, import_node_path16.join)(root, ".verity");
15841
- if ((0, import_node_fs23.existsSync)(gateDir) && !(0, import_node_fs23.existsSync)(verityDir)) return true;
15842
- if ((0, import_node_fs23.existsSync)(gateDir) && (0, import_node_fs23.existsSync)(verityDir)) {
15843
- if ((0, import_node_fs23.existsSync)((0, import_node_path16.join)(gateDir, "credentials")) && !(0, import_node_fs23.existsSync)((0, import_node_path16.join)(verityDir, "credentials"))) {
15509
+ const gateDir = (0, import_node_path15.join)(root, ".gate");
15510
+ const verityDir = (0, import_node_path15.join)(root, ".verity");
15511
+ if ((0, import_node_fs21.existsSync)(gateDir) && !(0, import_node_fs21.existsSync)(verityDir)) return true;
15512
+ if ((0, import_node_fs21.existsSync)(gateDir) && (0, import_node_fs21.existsSync)(verityDir)) {
15513
+ if ((0, import_node_fs21.existsSync)((0, import_node_path15.join)(gateDir, "credentials")) && !(0, import_node_fs21.existsSync)((0, import_node_path15.join)(verityDir, "credentials"))) {
15844
15514
  return true;
15845
15515
  }
15846
- if ((0, import_node_fs23.existsSync)((0, import_node_path16.join)(gateDir, "memory")) && !(0, import_node_fs23.existsSync)((0, import_node_path16.join)(verityDir, "memory"))) {
15516
+ if ((0, import_node_fs21.existsSync)((0, import_node_path15.join)(gateDir, "memory")) && !(0, import_node_fs21.existsSync)((0, import_node_path15.join)(verityDir, "memory"))) {
15847
15517
  return true;
15848
15518
  }
15849
15519
  }
15850
- const claudeMd = (0, import_node_path16.join)(root, "CLAUDE.md");
15851
- if ((0, import_node_fs23.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
15520
+ const claudeMd = (0, import_node_path15.join)(root, "CLAUDE.md");
15521
+ if ((0, import_node_fs21.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
15852
15522
  return true;
15853
15523
  }
15854
- if ((0, import_node_fs23.existsSync)((0, import_node_path16.join)(root, "GATE.md")) && !(0, import_node_fs23.existsSync)((0, import_node_path16.join)(root, "VERITY.md"))) {
15524
+ if ((0, import_node_fs21.existsSync)((0, import_node_path15.join)(root, "GATE.md")) && !(0, import_node_fs21.existsSync)((0, import_node_path15.join)(root, "VERITY.md"))) {
15855
15525
  return true;
15856
15526
  }
15857
15527
  if (await hasLegacyHooksAt(root)) return true;
@@ -15879,15 +15549,15 @@ function registerMigrateCommand(program2) {
15879
15549
  // src/commands/init.ts
15880
15550
  function resolveDataDir() {
15881
15551
  const candidates = [
15882
- (0, import_node_path17.join)(__dirname, "..", "data"),
15552
+ (0, import_node_path16.join)(__dirname, "..", "data"),
15883
15553
  // installed: node_modules/@codacy/verity-cli/data
15884
- (0, import_node_path17.join)(__dirname, "..", "..", "data"),
15554
+ (0, import_node_path16.join)(__dirname, "..", "..", "data"),
15885
15555
  // edge case: nested resolution
15886
- (0, import_node_path17.join)(process.cwd(), "cli", "data")
15556
+ (0, import_node_path16.join)(process.cwd(), "cli", "data")
15887
15557
  // local dev: running from repo root
15888
15558
  ];
15889
15559
  for (const candidate of candidates) {
15890
- if ((0, import_node_fs24.existsSync)((0, import_node_path17.join)(candidate, "skills"))) {
15560
+ if ((0, import_node_fs22.existsSync)((0, import_node_path16.join)(candidate, "skills"))) {
15891
15561
  return candidate;
15892
15562
  }
15893
15563
  }
@@ -15903,7 +15573,7 @@ function registerInitCommand(program2) {
15903
15573
  program2.command("init").description("Initialize Verity in the current project").option("--force", "Overwrite existing skills and hooks").action(async (opts) => {
15904
15574
  const force = opts.force ?? false;
15905
15575
  const projectMarkers = [".git", "package.json", "pyproject.toml", "go.mod", "Cargo.toml", "Gemfile", "pom.xml", "build.gradle"];
15906
- const isProject = projectMarkers.some((m) => (0, import_node_fs24.existsSync)(m));
15576
+ const isProject = projectMarkers.some((m) => (0, import_node_fs22.existsSync)(m));
15907
15577
  if (!isProject) {
15908
15578
  printError("No project detected in the current directory.");
15909
15579
  printInfo('Run "verity init" from your project root.');
@@ -15966,21 +15636,21 @@ function registerInitCommand(program2) {
15966
15636
  console.log("");
15967
15637
  printInfo("Installing skills...");
15968
15638
  const dataDir = resolveDataDir();
15969
- const skillsSource = (0, import_node_path17.join)(dataDir, "skills");
15639
+ const skillsSource = (0, import_node_path16.join)(dataDir, "skills");
15970
15640
  const skillsDest = ".claude/skills";
15971
15641
  const skills = ["verity-setup", "verity-analyze", "verity-status", "verity-feedback", "verity-learn", "verity-memory", "verity-insights", "verity-reflect"];
15972
15642
  let skillsInstalled = 0;
15973
15643
  for (const skill of skills) {
15974
- const src = (0, import_node_path17.join)(skillsSource, skill);
15975
- const dest = (0, import_node_path17.join)(skillsDest, skill);
15976
- if (!(0, import_node_fs24.existsSync)(src)) {
15644
+ const src = (0, import_node_path16.join)(skillsSource, skill);
15645
+ const dest = (0, import_node_path16.join)(skillsDest, skill);
15646
+ if (!(0, import_node_fs22.existsSync)(src)) {
15977
15647
  printWarn(` Skill data not found: ${skill}`);
15978
15648
  continue;
15979
15649
  }
15980
- if ((0, import_node_fs24.existsSync)(dest) && !force) {
15981
- const srcSkill = (0, import_node_path17.join)(src, "SKILL.md");
15982
- const destSkill = (0, import_node_path17.join)(dest, "SKILL.md");
15983
- if ((0, import_node_fs24.existsSync)(destSkill)) {
15650
+ if ((0, import_node_fs22.existsSync)(dest) && !force) {
15651
+ const srcSkill = (0, import_node_path16.join)(src, "SKILL.md");
15652
+ const destSkill = (0, import_node_path16.join)(dest, "SKILL.md");
15653
+ if ((0, import_node_fs22.existsSync)(destSkill)) {
15984
15654
  try {
15985
15655
  const srcContent = await (0, import_promises12.readFile)(srcSkill, "utf-8");
15986
15656
  const destContent = await (0, import_promises12.readFile)(destSkill, "utf-8");
@@ -16004,7 +15674,6 @@ function registerInitCommand(program2) {
16004
15674
  await writeSettings(hookResult.data);
16005
15675
  printInfo(" Stop hook: verity analyze \u2713");
16006
15676
  printInfo(" Intent hook: verity intent capture \u2713");
16007
- printInfo(" Baseline hook: verity baseline capture \u2713");
16008
15677
  } else {
16009
15678
  printWarn(` ${hookResult.error}`);
16010
15679
  printInfo(' Run "verity hooks install --force" to overwrite.');
@@ -16017,7 +15686,7 @@ function registerInitCommand(program2) {
16017
15686
  } catch (err) {
16018
15687
  printWarn(` Could not update CLAUDE.md: ${err.message}`);
16019
15688
  }
16020
- const globalVerityDir = (0, import_node_path17.join)(process.env.HOME ?? "", ".verity");
15689
+ const globalVerityDir = (0, import_node_path16.join)(process.env.HOME ?? "", ".verity");
16021
15690
  await (0, import_promises12.mkdir)(globalVerityDir, { recursive: true });
16022
15691
  console.log("");
16023
15692
  printInfo("Verity initialized!");
@@ -16040,8 +15709,8 @@ function registerInitCommand(program2) {
16040
15709
  }
16041
15710
 
16042
15711
  // src/commands/uninstall.ts
16043
- var import_node_fs25 = require("node:fs");
16044
- var import_node_path18 = require("node:path");
15712
+ var import_node_fs23 = require("node:fs");
15713
+ var import_node_path17 = require("node:path");
16045
15714
  var SKILL_NAMES = [
16046
15715
  "verity-setup",
16047
15716
  "verity-analyze",
@@ -16060,11 +15729,11 @@ function registerUninstallCommand(program2) {
16060
15729
  const actions = [];
16061
15730
  const skillsRoot = projectPath(".claude/skills");
16062
15731
  for (const name of SKILL_NAMES) {
16063
- const dir = (0, import_node_path18.join)(skillsRoot, name);
16064
- if ((0, import_node_fs25.existsSync)(dir)) {
15732
+ const dir = (0, import_node_path17.join)(skillsRoot, name);
15733
+ if ((0, import_node_fs23.existsSync)(dir)) {
16065
15734
  actions.push({
16066
15735
  label: `Remove .claude/skills/${name}/`,
16067
- apply: () => (0, import_node_fs25.rmSync)(dir, { recursive: true, force: true })
15736
+ apply: () => (0, import_node_fs23.rmSync)(dir, { recursive: true, force: true })
16068
15737
  });
16069
15738
  }
16070
15739
  }
@@ -16078,24 +15747,24 @@ function registerUninstallCommand(program2) {
16078
15747
  });
16079
15748
  }
16080
15749
  const verityDir = projectPath(VERITY_DIR);
16081
- if ((0, import_node_fs25.existsSync)(verityDir)) {
15750
+ if ((0, import_node_fs23.existsSync)(verityDir)) {
16082
15751
  actions.push({
16083
15752
  label: `Remove ${VERITY_DIR}/`,
16084
- apply: () => (0, import_node_fs25.rmSync)(verityDir, { recursive: true, force: true })
15753
+ apply: () => (0, import_node_fs23.rmSync)(verityDir, { recursive: true, force: true })
16085
15754
  });
16086
15755
  }
16087
15756
  if (!keepVerityMd) {
16088
15757
  const verityMd = projectPath(VERITY_MD_FILE);
16089
- if ((0, import_node_fs25.existsSync)(verityMd)) {
15758
+ if ((0, import_node_fs23.existsSync)(verityMd)) {
16090
15759
  actions.push({
16091
15760
  label: `Remove ${VERITY_MD_FILE}`,
16092
- apply: () => (0, import_node_fs25.rmSync)(verityMd, { force: true })
15761
+ apply: () => (0, import_node_fs23.rmSync)(verityMd, { force: true })
16093
15762
  });
16094
15763
  }
16095
15764
  }
16096
15765
  const cleanupEmptyDir = (path) => {
16097
- if ((0, import_node_fs25.existsSync)(path) && (0, import_node_fs25.statSync)(path).isDirectory() && (0, import_node_fs25.readdirSync)(path).length === 0) {
16098
- (0, import_node_fs25.rmdirSync)(path);
15766
+ if ((0, import_node_fs23.existsSync)(path) && (0, import_node_fs23.statSync)(path).isDirectory() && (0, import_node_fs23.readdirSync)(path).length === 0) {
15767
+ (0, import_node_fs23.rmdirSync)(path);
16099
15768
  }
16100
15769
  };
16101
15770
  actions.push({
@@ -16106,11 +15775,11 @@ function registerUninstallCommand(program2) {
16106
15775
  }
16107
15776
  });
16108
15777
  const home = process.env.HOME ?? "";
16109
- const globalVerityDir = (0, import_node_path18.join)(home, ".verity");
16110
- if (purgeGlobal && (0, import_node_fs25.existsSync)(globalVerityDir)) {
15778
+ const globalVerityDir = (0, import_node_path17.join)(home, ".verity");
15779
+ if (purgeGlobal && (0, import_node_fs23.existsSync)(globalVerityDir)) {
16111
15780
  actions.push({
16112
15781
  label: `Remove ~/.verity/ (global credentials \u2014 reconnect requires re-registration)`,
16113
- apply: () => (0, import_node_fs25.rmSync)(globalVerityDir, { recursive: true, force: true })
15782
+ apply: () => (0, import_node_fs23.rmSync)(globalVerityDir, { recursive: true, force: true })
16114
15783
  });
16115
15784
  }
16116
15785
  if (actions.length === 0) {
@@ -16304,8 +15973,8 @@ function registerTaskCommands(program2) {
16304
15973
  }
16305
15974
 
16306
15975
  // src/commands/reset.ts
16307
- var import_node_fs26 = require("node:fs");
16308
- var import_node_path19 = require("node:path");
15976
+ var import_node_fs24 = require("node:fs");
15977
+ var import_node_path18 = require("node:path");
16309
15978
  function registerResetCommand(program2) {
16310
15979
  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) => {
16311
15980
  const globals = program2.opts();
@@ -16342,11 +16011,11 @@ function registerResetCommand(program2) {
16342
16011
  }
16343
16012
  const cacheDir = projectPath(CACHE_DIR);
16344
16013
  let purged = 0;
16345
- if ((0, import_node_fs26.existsSync)(cacheDir)) {
16346
- for (const entry of (0, import_node_fs26.readdirSync)(cacheDir)) {
16014
+ if ((0, import_node_fs24.existsSync)(cacheDir)) {
16015
+ for (const entry of (0, import_node_fs24.readdirSync)(cacheDir)) {
16347
16016
  if (entry.startsWith("pending-")) {
16348
16017
  try {
16349
- (0, import_node_fs26.unlinkSync)((0, import_node_path19.join)(cacheDir, entry));
16018
+ (0, import_node_fs24.unlinkSync)((0, import_node_path18.join)(cacheDir, entry));
16350
16019
  purged++;
16351
16020
  } catch {
16352
16021
  }
@@ -16361,19 +16030,19 @@ function registerResetCommand(program2) {
16361
16030
  projectPath(`${VERITY_DIR}/.last-analysis`)
16362
16031
  ];
16363
16032
  for (const file of filesToClear) {
16364
- if ((0, import_node_fs26.existsSync)(file)) {
16033
+ if ((0, import_node_fs24.existsSync)(file)) {
16365
16034
  try {
16366
- (0, import_node_fs26.writeFileSync)(file, "");
16035
+ (0, import_node_fs24.writeFileSync)(file, "");
16367
16036
  } catch {
16368
16037
  }
16369
16038
  }
16370
16039
  }
16371
16040
  if (opts.all) {
16372
16041
  const logsDir = projectPath(`${VERITY_DIR}/.logs`);
16373
- if ((0, import_node_fs26.existsSync)(logsDir)) {
16374
- for (const entry of (0, import_node_fs26.readdirSync)(logsDir)) {
16042
+ if ((0, import_node_fs24.existsSync)(logsDir)) {
16043
+ for (const entry of (0, import_node_fs24.readdirSync)(logsDir)) {
16375
16044
  try {
16376
- (0, import_node_fs26.unlinkSync)((0, import_node_path19.join)(logsDir, entry));
16045
+ (0, import_node_fs24.unlinkSync)((0, import_node_path18.join)(logsDir, entry));
16377
16046
  } catch {
16378
16047
  }
16379
16048
  }
@@ -16632,7 +16301,7 @@ function registerRunCommand(program2) {
16632
16301
 
16633
16302
  // src/lib/telemetry.ts
16634
16303
  var import_promises13 = require("node:fs/promises");
16635
- var import_node_path20 = require("node:path");
16304
+ var import_node_path19 = require("node:path");
16636
16305
  var SETTINGS_LOCAL_FILE2 = ".claude/settings.local.json";
16637
16306
  var GITIGNORE_FILE = ".gitignore";
16638
16307
  var GITIGNORE_ENTRY = ".claude/settings.local.json";
@@ -16670,7 +16339,7 @@ async function readSettingsLocal() {
16670
16339
  }
16671
16340
  async function writeSettingsLocal(settings) {
16672
16341
  const file = projectPath(SETTINGS_LOCAL_FILE2);
16673
- await (0, import_promises13.mkdir)((0, import_node_path20.dirname)(file), { recursive: true });
16342
+ await (0, import_promises13.mkdir)((0, import_node_path19.dirname)(file), { recursive: true });
16674
16343
  await (0, import_promises13.writeFile)(file, JSON.stringify(settings, null, 2) + "\n");
16675
16344
  }
16676
16345
  async function ensureGitignore() {
@@ -16766,7 +16435,7 @@ function registerTelemetryCommands(program2) {
16766
16435
  }
16767
16436
 
16768
16437
  // src/cli.ts
16769
- program.name("verity").description("CLI for Verity quality gate service").version("0.24.0-experimental.9a9e918").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
16438
+ program.name("verity").description("CLI for Verity quality gate service").version("0.24.0-experimental.b2914b9").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
16770
16439
  registerAuthCommands(program);
16771
16440
  registerHooksCommands(program);
16772
16441
  registerIntentCommands(program);
@@ -16775,7 +16444,6 @@ registerConfigCommands(program);
16775
16444
  registerStatusCommand(program);
16776
16445
  registerFeedbackCommand(program);
16777
16446
  registerAnalyzeCommand(program);
16778
- registerBaselineCommands(program);
16779
16447
  registerReviewCommand(program);
16780
16448
  registerGuardCommand(program);
16781
16449
  registerInitCommand(program);