@codacy/verity-cli 0.25.0 → 0.26.0

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 +227 -178
  2. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -10838,8 +10838,63 @@ service_url: ${service_url}
10838
10838
  }
10839
10839
 
10840
10840
  // src/lib/hooks.ts
10841
+ var import_promises5 = require("node:fs/promises");
10842
+ var import_node_path4 = require("node:path");
10843
+
10844
+ // src/lib/json-file.ts
10841
10845
  var import_promises4 = require("node:fs/promises");
10842
10846
  var import_node_path3 = require("node:path");
10847
+ function jsonSemanticEqual(a, b) {
10848
+ if (a === b) return true;
10849
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
10850
+ return a === b;
10851
+ }
10852
+ const aIsArr = Array.isArray(a);
10853
+ const bIsArr = Array.isArray(b);
10854
+ if (aIsArr || bIsArr) {
10855
+ if (!aIsArr || !bIsArr || a.length !== b.length) return false;
10856
+ for (let i = 0; i < a.length; i++) {
10857
+ if (!jsonSemanticEqual(a[i], b[i])) return false;
10858
+ }
10859
+ return true;
10860
+ }
10861
+ const ao = a;
10862
+ const bo = b;
10863
+ const aKeys = Object.keys(ao).filter((k) => ao[k] !== void 0);
10864
+ const bKeys = Object.keys(bo).filter((k) => bo[k] !== void 0);
10865
+ if (aKeys.length !== bKeys.length) return false;
10866
+ for (const k of aKeys) {
10867
+ if (bo[k] === void 0) return false;
10868
+ if (!jsonSemanticEqual(ao[k], bo[k])) return false;
10869
+ }
10870
+ return true;
10871
+ }
10872
+ function detectJsonIndent(raw) {
10873
+ const m = raw.match(/\n([ \t]+)\S/);
10874
+ return m ? m[1] : 2;
10875
+ }
10876
+ async function writeJsonFilePreservingStyle(file, value) {
10877
+ let currentRaw = null;
10878
+ try {
10879
+ currentRaw = await (0, import_promises4.readFile)(file, "utf-8");
10880
+ } catch {
10881
+ currentRaw = null;
10882
+ }
10883
+ if (currentRaw !== null) {
10884
+ try {
10885
+ if (jsonSemanticEqual(JSON.parse(currentRaw), value)) return false;
10886
+ } catch {
10887
+ }
10888
+ }
10889
+ const indent = currentRaw !== null ? detectJsonIndent(currentRaw) : 2;
10890
+ const next = JSON.stringify(value, null, indent) + "\n";
10891
+ if (next === currentRaw) return false;
10892
+ await (0, import_promises4.mkdir)((0, import_node_path3.dirname)(file), { recursive: true });
10893
+ await (0, import_promises4.writeFile)(file, next);
10894
+ return true;
10895
+ }
10896
+
10897
+ // src/lib/hooks.ts
10843
10898
  var VERITY_STOP_HOOK = {
10844
10899
  type: "command",
10845
10900
  command: "verity analyze",
@@ -10917,7 +10972,7 @@ function globalSettingsFile() {
10917
10972
  }
10918
10973
  async function readSettings() {
10919
10974
  try {
10920
- const content = await (0, import_promises4.readFile)(CLAUDE_SETTINGS_FILE, "utf-8");
10975
+ const content = await (0, import_promises5.readFile)(CLAUDE_SETTINGS_FILE, "utf-8");
10921
10976
  return JSON.parse(content);
10922
10977
  } catch {
10923
10978
  return {};
@@ -10928,7 +10983,7 @@ async function readAllSettings() {
10928
10983
  const out = [];
10929
10984
  for (const f of files) {
10930
10985
  try {
10931
- out.push(JSON.parse(await (0, import_promises4.readFile)(f, "utf-8")));
10986
+ out.push(JSON.parse(await (0, import_promises5.readFile)(f, "utf-8")));
10932
10987
  } catch {
10933
10988
  }
10934
10989
  }
@@ -10957,7 +11012,7 @@ async function checkExternalVerityHooks() {
10957
11012
  for (const f of [SETTINGS_LOCAL_FILE, globalSettingsFile()]) {
10958
11013
  let settings;
10959
11014
  try {
10960
- settings = JSON.parse(await (0, import_promises4.readFile)(f, "utf-8"));
11015
+ settings = JSON.parse(await (0, import_promises5.readFile)(f, "utf-8"));
10961
11016
  } catch {
10962
11017
  continue;
10963
11018
  }
@@ -10991,20 +11046,17 @@ async function checkAllVerityHooksDetailed() {
10991
11046
  return { stop, intent, baseline, current: hasCurrent, legacyOnly: hasLegacy && !hasCurrent };
10992
11047
  }
10993
11048
  async function writeSettings(settings) {
10994
- await (0, import_promises4.mkdir)((0, import_node_path3.dirname)(CLAUDE_SETTINGS_FILE), { recursive: true });
10995
- await (0, import_promises4.writeFile)(CLAUDE_SETTINGS_FILE, JSON.stringify(settings, null, 2) + "\n");
11049
+ await writeJsonFilePreservingStyle(CLAUDE_SETTINGS_FILE, settings);
10996
11050
  }
10997
11051
  async function readSettingsAt(root) {
10998
11052
  try {
10999
- return JSON.parse(await (0, import_promises4.readFile)((0, import_node_path3.join)(root, CLAUDE_SETTINGS_FILE), "utf-8"));
11053
+ return JSON.parse(await (0, import_promises5.readFile)((0, import_node_path4.join)(root, CLAUDE_SETTINGS_FILE), "utf-8"));
11000
11054
  } catch {
11001
11055
  return {};
11002
11056
  }
11003
11057
  }
11004
11058
  async function writeSettingsAt(root, settings) {
11005
- const file = (0, import_node_path3.join)(root, CLAUDE_SETTINGS_FILE);
11006
- await (0, import_promises4.mkdir)((0, import_node_path3.dirname)(file), { recursive: true });
11007
- await (0, import_promises4.writeFile)(file, JSON.stringify(settings, null, 2) + "\n");
11059
+ await writeJsonFilePreservingStyle((0, import_node_path4.join)(root, CLAUDE_SETTINGS_FILE), settings);
11008
11060
  }
11009
11061
  async function hasLegacyHooksAt(root) {
11010
11062
  const settings = await readSettingsAt(root);
@@ -11243,7 +11295,7 @@ function registerHooksCommands(program2) {
11243
11295
  var import_node_crypto3 = require("node:crypto");
11244
11296
 
11245
11297
  // src/lib/conversation-buffer.ts
11246
- var import_promises5 = require("node:fs/promises");
11298
+ var import_promises6 = require("node:fs/promises");
11247
11299
  var import_node_fs2 = require("node:fs");
11248
11300
  var import_node_child_process4 = require("node:child_process");
11249
11301
  var import_node_crypto = require("node:crypto");
@@ -11255,7 +11307,7 @@ function bufferTmpPath() {
11255
11307
  }
11256
11308
  async function appendToConversationBuffer(prompt, sessionId) {
11257
11309
  try {
11258
- await (0, import_promises5.mkdir)(VERITY_DIR, { recursive: true });
11310
+ await (0, import_promises6.mkdir)(VERITY_DIR, { recursive: true });
11259
11311
  let sanitized = prompt.length > MAX_INTENT_CHARS ? prompt.slice(0, MAX_INTENT_CHARS) : prompt;
11260
11312
  sanitized = stripImageReferences(sanitized);
11261
11313
  const entry = {
@@ -11273,8 +11325,8 @@ async function appendToConversationBuffer(prompt, sessionId) {
11273
11325
  const capped = recent.slice(-CONVERSATION_MAX_ENTRIES);
11274
11326
  const content = capped.map((e) => JSON.stringify(e)).join("\n") + "\n";
11275
11327
  const tmpFile = bufferTmpPath();
11276
- await (0, import_promises5.writeFile)(tmpFile, content);
11277
- await (0, import_promises5.rename)(tmpFile, CONVERSATION_BUFFER_FILE);
11328
+ await (0, import_promises6.writeFile)(tmpFile, content);
11329
+ await (0, import_promises6.rename)(tmpFile, CONVERSATION_BUFFER_FILE);
11278
11330
  } catch {
11279
11331
  }
11280
11332
  }
@@ -11291,10 +11343,10 @@ async function readAndClearConversationBuffer(currentSessionId) {
11291
11343
  if (others.length > 0) {
11292
11344
  const remaining = others.map((e) => JSON.stringify(e)).join("\n") + "\n";
11293
11345
  const tmpFile = bufferTmpPath();
11294
- await (0, import_promises5.writeFile)(tmpFile, remaining);
11295
- await (0, import_promises5.rename)(tmpFile, CONVERSATION_BUFFER_FILE);
11346
+ await (0, import_promises6.writeFile)(tmpFile, remaining);
11347
+ await (0, import_promises6.rename)(tmpFile, CONVERSATION_BUFFER_FILE);
11296
11348
  } else {
11297
- await (0, import_promises5.unlink)(CONVERSATION_BUFFER_FILE).catch(() => {
11349
+ await (0, import_promises6.unlink)(CONVERSATION_BUFFER_FILE).catch(() => {
11298
11350
  });
11299
11351
  }
11300
11352
  if (mine.length > 0) {
@@ -11306,8 +11358,8 @@ async function readAndClearConversationBuffer(currentSessionId) {
11306
11358
  }
11307
11359
  if ((0, import_node_fs2.existsSync)(INTENT_FILE)) {
11308
11360
  try {
11309
- const content = await (0, import_promises5.readFile)(INTENT_FILE, "utf-8");
11310
- await (0, import_promises5.unlink)(INTENT_FILE).catch(() => {
11361
+ const content = await (0, import_promises6.readFile)(INTENT_FILE, "utf-8");
11362
+ await (0, import_promises6.unlink)(INTENT_FILE).catch(() => {
11311
11363
  });
11312
11364
  const data = JSON.parse(content);
11313
11365
  if (data.prompt) {
@@ -11330,7 +11382,7 @@ async function readAndClearConversationBuffer(currentSessionId) {
11330
11382
  }
11331
11383
  async function readBufferEntries() {
11332
11384
  try {
11333
- const content = await (0, import_promises5.readFile)(CONVERSATION_BUFFER_FILE, "utf-8");
11385
+ const content = await (0, import_promises6.readFile)(CONVERSATION_BUFFER_FILE, "utf-8");
11334
11386
  const entries = [];
11335
11387
  for (const line of content.split("\n")) {
11336
11388
  const trimmed = line.trim();
@@ -11360,9 +11412,9 @@ function getRecentCommitMessages() {
11360
11412
  }
11361
11413
 
11362
11414
  // src/lib/task-context-buffer.ts
11363
- var import_promises6 = require("node:fs/promises");
11415
+ var import_promises7 = require("node:fs/promises");
11364
11416
  var import_node_fs3 = require("node:fs");
11365
- var import_node_path4 = require("node:path");
11417
+ var import_node_path5 = require("node:path");
11366
11418
  var TASK_CONTEXT_DIR = `${VERITY_DIR}/.task-context`;
11367
11419
  var MAX_BUFFER_BYTES = 500 * 1024;
11368
11420
  var MAX_PROMPT_CHARS = 2e3;
@@ -11403,7 +11455,7 @@ async function readTaskContextBuffer(taskId) {
11403
11455
  const filePath = bufferPath(taskId);
11404
11456
  if (!(0, import_node_fs3.existsSync)(filePath)) return null;
11405
11457
  try {
11406
- const content = await (0, import_promises6.readFile)(filePath, "utf-8");
11458
+ const content = await (0, import_promises7.readFile)(filePath, "utf-8");
11407
11459
  if (!content.trim()) return null;
11408
11460
  const lines = content.split("\n").filter((l) => l.trim());
11409
11461
  const formatted = [];
@@ -11436,15 +11488,15 @@ async function readTaskContextBuffer(taskId) {
11436
11488
  async function cleanupTaskContextBuffers() {
11437
11489
  try {
11438
11490
  if (!(0, import_node_fs3.existsSync)(TASK_CONTEXT_DIR)) return;
11439
- const files = await (0, import_promises6.readdir)(TASK_CONTEXT_DIR);
11491
+ const files = await (0, import_promises7.readdir)(TASK_CONTEXT_DIR);
11440
11492
  const cutoffMs = Date.now() - RETENTION_DAYS * 24 * 60 * 60 * 1e3;
11441
11493
  for (const file of files) {
11442
11494
  if (!file.endsWith(".jsonl")) continue;
11443
- const filePath = (0, import_node_path4.join)(TASK_CONTEXT_DIR, file);
11495
+ const filePath = (0, import_node_path5.join)(TASK_CONTEXT_DIR, file);
11444
11496
  try {
11445
- const stats = await (0, import_promises6.stat)(filePath);
11497
+ const stats = await (0, import_promises7.stat)(filePath);
11446
11498
  if (stats.mtimeMs < cutoffMs) {
11447
- await (0, import_promises6.unlink)(filePath);
11499
+ await (0, import_promises7.unlink)(filePath);
11448
11500
  }
11449
11501
  } catch {
11450
11502
  }
@@ -11454,33 +11506,33 @@ async function cleanupTaskContextBuffers() {
11454
11506
  }
11455
11507
  function bufferPath(taskId) {
11456
11508
  const safe = taskId.replace(/[^a-zA-Z0-9_-]/g, "");
11457
- return (0, import_node_path4.join)(TASK_CONTEXT_DIR, `${safe}.jsonl`);
11509
+ return (0, import_node_path5.join)(TASK_CONTEXT_DIR, `${safe}.jsonl`);
11458
11510
  }
11459
11511
  async function appendEntry(taskId, entry) {
11460
11512
  try {
11461
- await (0, import_promises6.mkdir)(TASK_CONTEXT_DIR, { recursive: true });
11513
+ await (0, import_promises7.mkdir)(TASK_CONTEXT_DIR, { recursive: true });
11462
11514
  const filePath = bufferPath(taskId);
11463
11515
  if ((0, import_node_fs3.existsSync)(filePath)) {
11464
- const stats = await (0, import_promises6.stat)(filePath);
11516
+ const stats = await (0, import_promises7.stat)(filePath);
11465
11517
  if (stats.size >= MAX_BUFFER_BYTES) {
11466
- const content = await (0, import_promises6.readFile)(filePath, "utf-8");
11518
+ const content = await (0, import_promises7.readFile)(filePath, "utf-8");
11467
11519
  const lines = content.split("\n").filter((l) => l.trim());
11468
11520
  const keepFrom = Math.floor(lines.length * 0.25);
11469
11521
  const pruned = lines.slice(keepFrom).join("\n") + "\n";
11470
- await (0, import_promises6.writeFile)(filePath, pruned);
11522
+ await (0, import_promises7.writeFile)(filePath, pruned);
11471
11523
  }
11472
11524
  }
11473
11525
  const line = JSON.stringify(entry) + "\n";
11474
- const existing = (0, import_node_fs3.existsSync)(filePath) ? await (0, import_promises6.readFile)(filePath, "utf-8") : "";
11475
- await (0, import_promises6.writeFile)(filePath, existing + line);
11526
+ const existing = (0, import_node_fs3.existsSync)(filePath) ? await (0, import_promises7.readFile)(filePath, "utf-8") : "";
11527
+ await (0, import_promises7.writeFile)(filePath, existing + line);
11476
11528
  } catch {
11477
11529
  }
11478
11530
  }
11479
11531
 
11480
11532
  // src/lib/memory-retrieval.ts
11481
- var import_promises7 = require("node:fs/promises");
11533
+ var import_promises8 = require("node:fs/promises");
11482
11534
  var import_node_fs4 = require("node:fs");
11483
- var import_node_path5 = require("node:path");
11535
+ var import_node_path6 = require("node:path");
11484
11536
  var memoryDir = () => projectPath(`${VERITY_DIR}/memory`);
11485
11537
  var DOMAINS = ["decisions", "quality", "security", "intent", "gotchas", "patterns", "domain", "integrations"];
11486
11538
  var DEFAULT_BUDGET_TOKENS = 2e3;
@@ -11578,14 +11630,14 @@ async function retrieveForInjection(promptText, taskFiles = [], budgetTokens = D
11578
11630
  const promptTokens = tokenize(promptText);
11579
11631
  const nodes = [];
11580
11632
  for (const domain of DOMAINS) {
11581
- const domainDir = (0, import_node_path5.join)(memoryDir(), domain);
11633
+ const domainDir = (0, import_node_path6.join)(memoryDir(), domain);
11582
11634
  if (!(0, import_node_fs4.existsSync)(domainDir)) continue;
11583
11635
  try {
11584
- const files = await (0, import_promises7.readdir)(domainDir);
11636
+ const files = await (0, import_promises8.readdir)(domainDir);
11585
11637
  for (const file of files) {
11586
11638
  if (!file.endsWith(".md")) continue;
11587
11639
  try {
11588
- const content = await (0, import_promises7.readFile)((0, import_node_path5.join)(domainDir, file), "utf-8");
11640
+ const content = await (0, import_promises8.readFile)((0, import_node_path6.join)(domainDir, file), "utf-8");
11589
11641
  const { fm, body } = parseFrontmatter(content);
11590
11642
  if (fm.status && fm.status !== "active") continue;
11591
11643
  nodes.push({
@@ -11643,9 +11695,9 @@ async function retrieveForInjection(promptText, taskFiles = [], budgetTokens = D
11643
11695
  }
11644
11696
 
11645
11697
  // src/lib/memory-sync.ts
11646
- var import_promises8 = require("node:fs/promises");
11698
+ var import_promises9 = require("node:fs/promises");
11647
11699
  var import_node_fs5 = require("node:fs");
11648
- var import_node_path6 = require("node:path");
11700
+ var import_node_path7 = require("node:path");
11649
11701
  var import_node_crypto2 = require("node:crypto");
11650
11702
 
11651
11703
  // src/lib/glob-match.ts
@@ -11714,18 +11766,18 @@ var memoryDir2 = () => projectPath(`${VERITY_DIR}/memory`);
11714
11766
  var DOMAINS2 = ["decisions", "quality", "security", "intent", "gotchas", "patterns", "domain", "integrations", "_archive"];
11715
11767
  var syncStateFile = () => projectPath(`${VERITY_DIR}/.memory-sync-state.json`);
11716
11768
  async function ensureMemoryDir() {
11717
- await (0, import_promises8.mkdir)(memoryDir2(), { recursive: true });
11769
+ await (0, import_promises9.mkdir)(memoryDir2(), { recursive: true });
11718
11770
  for (const domain of DOMAINS2) {
11719
- await (0, import_promises8.mkdir)((0, import_node_path6.join)(memoryDir2(), domain), { recursive: true });
11771
+ await (0, import_promises9.mkdir)((0, import_node_path7.join)(memoryDir2(), domain), { recursive: true });
11720
11772
  }
11721
- if (!(0, import_node_fs5.existsSync)((0, import_node_path6.join)(memoryDir2(), "SCHEMA.md"))) {
11722
- await (0, import_promises8.writeFile)((0, import_node_path6.join)(memoryDir2(), "SCHEMA.md"), SCHEMA_TEMPLATE);
11773
+ if (!(0, import_node_fs5.existsSync)((0, import_node_path7.join)(memoryDir2(), "SCHEMA.md"))) {
11774
+ await (0, import_promises9.writeFile)((0, import_node_path7.join)(memoryDir2(), "SCHEMA.md"), SCHEMA_TEMPLATE);
11723
11775
  }
11724
- if (!(0, import_node_fs5.existsSync)((0, import_node_path6.join)(memoryDir2(), "index.md"))) {
11725
- await (0, import_promises8.writeFile)((0, import_node_path6.join)(memoryDir2(), "index.md"), "# Project Memory Index\n\nNo nodes yet. Run an analysis to start building the knowledge graph.\n");
11776
+ if (!(0, import_node_fs5.existsSync)((0, import_node_path7.join)(memoryDir2(), "index.md"))) {
11777
+ await (0, import_promises9.writeFile)((0, import_node_path7.join)(memoryDir2(), "index.md"), "# Project Memory Index\n\nNo nodes yet. Run an analysis to start building the knowledge graph.\n");
11726
11778
  }
11727
- if (!(0, import_node_fs5.existsSync)((0, import_node_path6.join)(memoryDir2(), "log.md"))) {
11728
- await (0, import_promises8.writeFile)((0, import_node_path6.join)(memoryDir2(), "log.md"), "# Memory Log\n\n");
11779
+ if (!(0, import_node_fs5.existsSync)((0, import_node_path7.join)(memoryDir2(), "log.md"))) {
11780
+ await (0, import_promises9.writeFile)((0, import_node_path7.join)(memoryDir2(), "log.md"), "# Memory Log\n\n");
11729
11781
  }
11730
11782
  }
11731
11783
  async function buildManifest() {
@@ -11734,16 +11786,16 @@ async function buildManifest() {
11734
11786
  }
11735
11787
  const nodes = [];
11736
11788
  for (const domain of DOMAINS2) {
11737
- const domainDir = (0, import_node_path6.join)(memoryDir2(), domain);
11789
+ const domainDir = (0, import_node_path7.join)(memoryDir2(), domain);
11738
11790
  if (!(0, import_node_fs5.existsSync)(domainDir)) continue;
11739
11791
  try {
11740
- const files = await (0, import_promises8.readdir)(domainDir);
11792
+ const files = await (0, import_promises9.readdir)(domainDir);
11741
11793
  for (const file of files) {
11742
11794
  if (!file.endsWith(".md")) continue;
11743
11795
  const filePath = `${domain}/${file}`;
11744
- const fullPath = (0, import_node_path6.join)(memoryDir2(), filePath);
11796
+ const fullPath = (0, import_node_path7.join)(memoryDir2(), filePath);
11745
11797
  try {
11746
- const content = await (0, import_promises8.readFile)(fullPath, "utf-8");
11798
+ const content = await (0, import_promises9.readFile)(fullPath, "utf-8");
11747
11799
  const hash = (0, import_node_crypto2.createHash)("sha256").update(content).digest("hex").slice(0, 16);
11748
11800
  nodes.push({ path: filePath, content_hash: `sha256:${hash}` });
11749
11801
  } catch {
@@ -11754,13 +11806,13 @@ async function buildManifest() {
11754
11806
  }
11755
11807
  let indexHash = null;
11756
11808
  try {
11757
- const indexContent = await (0, import_promises8.readFile)((0, import_node_path6.join)(memoryDir2(), "index.md"), "utf-8");
11809
+ const indexContent = await (0, import_promises9.readFile)((0, import_node_path7.join)(memoryDir2(), "index.md"), "utf-8");
11758
11810
  indexHash = `sha256:${(0, import_node_crypto2.createHash)("sha256").update(indexContent).digest("hex").slice(0, 16)}`;
11759
11811
  } catch {
11760
11812
  }
11761
11813
  let logLength = 0;
11762
11814
  try {
11763
- const logContent = await (0, import_promises8.readFile)((0, import_node_path6.join)(memoryDir2(), "log.md"), "utf-8");
11815
+ const logContent = await (0, import_promises9.readFile)((0, import_node_path7.join)(memoryDir2(), "log.md"), "utf-8");
11764
11816
  logLength = logContent.split("\n").length;
11765
11817
  } catch {
11766
11818
  }
@@ -11773,13 +11825,13 @@ async function readOnDiskNodes() {
11773
11825
  const out = /* @__PURE__ */ new Map();
11774
11826
  if (!(0, import_node_fs5.existsSync)(memoryDir2())) return out;
11775
11827
  for (const domain of DOMAINS2) {
11776
- const domainDir = (0, import_node_path6.join)(memoryDir2(), domain);
11828
+ const domainDir = (0, import_node_path7.join)(memoryDir2(), domain);
11777
11829
  if (!(0, import_node_fs5.existsSync)(domainDir)) continue;
11778
11830
  try {
11779
- for (const file of await (0, import_promises8.readdir)(domainDir)) {
11831
+ for (const file of await (0, import_promises9.readdir)(domainDir)) {
11780
11832
  if (!file.endsWith(".md")) continue;
11781
11833
  try {
11782
- out.set(`${domain}/${file}`, hashContent(await (0, import_promises8.readFile)((0, import_node_path6.join)(domainDir, file), "utf-8")));
11834
+ out.set(`${domain}/${file}`, hashContent(await (0, import_promises9.readFile)((0, import_node_path7.join)(domainDir, file), "utf-8")));
11783
11835
  } catch {
11784
11836
  }
11785
11837
  }
@@ -11791,7 +11843,7 @@ async function readOnDiskNodes() {
11791
11843
  async function readSyncBaseline() {
11792
11844
  const out = /* @__PURE__ */ new Map();
11793
11845
  try {
11794
- const parsed = JSON.parse(await (0, import_promises8.readFile)(syncStateFile(), "utf-8"));
11846
+ const parsed = JSON.parse(await (0, import_promises9.readFile)(syncStateFile(), "utf-8"));
11795
11847
  if (Array.isArray(parsed?.nodes)) {
11796
11848
  for (const n of parsed.nodes) if (n?.path) out.set(n.path, n.hash ?? null);
11797
11849
  } else if (Array.isArray(parsed?.paths)) {
@@ -11807,12 +11859,12 @@ async function recordSyncedNodePaths() {
11807
11859
  const next = JSON.stringify({ schema: 2, nodes }) + "\n";
11808
11860
  let existing = "";
11809
11861
  try {
11810
- existing = await (0, import_promises8.readFile)(syncStateFile(), "utf-8");
11862
+ existing = await (0, import_promises9.readFile)(syncStateFile(), "utf-8");
11811
11863
  } catch {
11812
11864
  }
11813
11865
  if (existing === next) return;
11814
- await (0, import_promises8.mkdir)(projectPath(VERITY_DIR), { recursive: true });
11815
- await (0, import_promises8.writeFile)(syncStateFile(), next);
11866
+ await (0, import_promises9.mkdir)(projectPath(VERITY_DIR), { recursive: true });
11867
+ await (0, import_promises9.writeFile)(syncStateFile(), next);
11816
11868
  } catch {
11817
11869
  }
11818
11870
  }
@@ -11825,11 +11877,11 @@ async function computeEditedNodeUploads() {
11825
11877
  const uploads = [];
11826
11878
  for (const [path, prevHash] of prev) {
11827
11879
  if (prevHash == null) continue;
11828
- const full = (0, import_node_path6.join)(memoryDir2(), path);
11880
+ const full = (0, import_node_path7.join)(memoryDir2(), path);
11829
11881
  if (!(0, import_node_fs5.existsSync)(full)) continue;
11830
11882
  let content;
11831
11883
  try {
11832
- content = await (0, import_promises8.readFile)(full, "utf-8");
11884
+ content = await (0, import_promises9.readFile)(full, "utf-8");
11833
11885
  } catch {
11834
11886
  continue;
11835
11887
  }
@@ -11862,15 +11914,15 @@ async function applyMemoryWrites(writes, opts = {}) {
11862
11914
  const logLines = [`- ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 16)} \u2014 Applied ${count} write(s) from server`];
11863
11915
  for (const n of notes) logLines.push(` - ${n}`);
11864
11916
  try {
11865
- const existing = (0, import_node_fs5.existsSync)((0, import_node_path6.join)(memoryDir2(), "log.md")) ? await (0, import_promises8.readFile)((0, import_node_path6.join)(memoryDir2(), "log.md"), "utf-8") : "# Memory Log\n\n";
11866
- await (0, import_promises8.writeFile)((0, import_node_path6.join)(memoryDir2(), "log.md"), existing + logLines.join("\n") + "\n");
11917
+ const existing = (0, import_node_fs5.existsSync)((0, import_node_path7.join)(memoryDir2(), "log.md")) ? await (0, import_promises9.readFile)((0, import_node_path7.join)(memoryDir2(), "log.md"), "utf-8") : "# Memory Log\n\n";
11918
+ await (0, import_promises9.writeFile)((0, import_node_path7.join)(memoryDir2(), "log.md"), existing + logLines.join("\n") + "\n");
11867
11919
  } catch {
11868
11920
  }
11869
11921
  await recordSyncedNodePaths();
11870
11922
  return count;
11871
11923
  }
11872
11924
  async function applyOneWrite(write, treePaths) {
11873
- const fullPath = (0, import_node_path6.join)(memoryDir2(), write.path);
11925
+ const fullPath = (0, import_node_path7.join)(memoryDir2(), write.path);
11874
11926
  const notes = [];
11875
11927
  let content = write.content;
11876
11928
  if (treePaths && treePaths.length > 0) {
@@ -11883,7 +11935,7 @@ async function applyOneWrite(write, treePaths) {
11883
11935
  if ((0, import_node_fs5.existsSync)(fullPath)) {
11884
11936
  let existing = "";
11885
11937
  try {
11886
- existing = await (0, import_promises8.readFile)(fullPath, "utf-8");
11938
+ existing = await (0, import_promises9.readFile)(fullPath, "utf-8");
11887
11939
  } catch {
11888
11940
  }
11889
11941
  if (existing === content) return { written: false, notes };
@@ -11892,8 +11944,8 @@ async function applyOneWrite(write, treePaths) {
11892
11944
  return { written: false, notes };
11893
11945
  }
11894
11946
  }
11895
- await (0, import_promises8.mkdir)((0, import_node_path6.dirname)(fullPath), { recursive: true });
11896
- await (0, import_promises8.writeFile)(fullPath, content);
11947
+ await (0, import_promises9.mkdir)((0, import_node_path7.dirname)(fullPath), { recursive: true });
11948
+ await (0, import_promises9.writeFile)(fullPath, content);
11897
11949
  return { written: true, notes };
11898
11950
  }
11899
11951
  function groundFileGlobs(content, treePaths) {
@@ -11933,10 +11985,10 @@ async function regenerateIndex() {
11933
11985
  ];
11934
11986
  let totalNodes = 0;
11935
11987
  for (const domain of DOMAINS2.filter((d) => d !== "_archive")) {
11936
- const domainDir = (0, import_node_path6.join)(memoryDir2(), domain);
11988
+ const domainDir = (0, import_node_path7.join)(memoryDir2(), domain);
11937
11989
  if (!(0, import_node_fs5.existsSync)(domainDir)) continue;
11938
11990
  try {
11939
- const files = await (0, import_promises8.readdir)(domainDir);
11991
+ const files = await (0, import_promises9.readdir)(domainDir);
11940
11992
  const mdFiles = files.filter((f) => f.endsWith(".md"));
11941
11993
  if (mdFiles.length === 0) continue;
11942
11994
  lines.push(`## ${domain}/ (${mdFiles.length})`);
@@ -11944,7 +11996,7 @@ async function regenerateIndex() {
11944
11996
  for (const file of mdFiles.sort()) {
11945
11997
  const slug = file.replace(/\.md$/, "");
11946
11998
  try {
11947
- const content = await (0, import_promises8.readFile)((0, import_node_path6.join)(domainDir, file), "utf-8");
11999
+ const content = await (0, import_promises9.readFile)((0, import_node_path7.join)(domainDir, file), "utf-8");
11948
12000
  const title = pickFrontmatter(content, "title") ?? slug;
11949
12001
  const kind = pickFrontmatter(content, "kind") ?? "-";
11950
12002
  const confidence = pickFrontmatter(content, "confidence");
@@ -11968,14 +12020,14 @@ async function regenerateIndex() {
11968
12020
  lines.push("No nodes yet. Run an analysis to start building the knowledge graph.");
11969
12021
  }
11970
12022
  const next = lines.join("\n") + "\n";
11971
- const indexPath = (0, import_node_path6.join)(memoryDir2(), "index.md");
12023
+ const indexPath = (0, import_node_path7.join)(memoryDir2(), "index.md");
11972
12024
  let existing = null;
11973
12025
  try {
11974
- existing = await (0, import_promises8.readFile)(indexPath, "utf-8");
12026
+ existing = await (0, import_promises9.readFile)(indexPath, "utf-8");
11975
12027
  } catch {
11976
12028
  }
11977
12029
  if (existing === next) return;
11978
- await (0, import_promises8.writeFile)(indexPath, next);
12030
+ await (0, import_promises9.writeFile)(indexPath, next);
11979
12031
  }
11980
12032
  function pickFrontmatter(content, key) {
11981
12033
  const re = new RegExp(`^${key}:\\s*"?([^"\\n]+?)"?\\s*$`, "m");
@@ -12050,10 +12102,10 @@ function hasLegacyMemoryBlock(text) {
12050
12102
  return findMarker(text, LEGACY_MD_START) !== -1;
12051
12103
  }
12052
12104
  async function ensureClaudeMdPointer(cwd = repoRoot()) {
12053
- const claudeMdPath = (0, import_node_path6.join)(cwd, "CLAUDE.md");
12105
+ const claudeMdPath = (0, import_node_path7.join)(cwd, "CLAUDE.md");
12054
12106
  let existing = "";
12055
12107
  if ((0, import_node_fs5.existsSync)(claudeMdPath)) {
12056
- existing = await (0, import_promises8.readFile)(claudeMdPath, "utf-8");
12108
+ existing = await (0, import_promises9.readFile)(claudeMdPath, "utf-8");
12057
12109
  }
12058
12110
  let startTag = CLAUDE_MD_START;
12059
12111
  let endTag = CLAUDE_MD_END;
@@ -12109,7 +12161,7 @@ async function ensureClaudeMdPointer(cwd = repoRoot()) {
12109
12161
  next = existing.replace(/\n*$/, "") + "\n\n" + block + "\n";
12110
12162
  }
12111
12163
  if (next === existing) return;
12112
- await (0, import_promises8.writeFile)(claudeMdPath, next);
12164
+ await (0, import_promises9.writeFile)(claudeMdPath, next);
12113
12165
  }
12114
12166
  function extractPreserveContent(interior) {
12115
12167
  for (const [start, end] of [
@@ -12292,7 +12344,7 @@ async function fireClassify(prompt, sessionId) {
12292
12344
  }
12293
12345
 
12294
12346
  // src/commands/standard.ts
12295
- var import_promises9 = require("node:fs/promises");
12347
+ var import_promises10 = require("node:fs/promises");
12296
12348
  var import_yaml = __toESM(require_dist());
12297
12349
  function registerStandardCommands(program2) {
12298
12350
  const standard = program2.command("standard").description("Manage the project Standard");
@@ -12310,7 +12362,7 @@ function registerStandardCommands(program2) {
12310
12362
  }
12311
12363
  let yamlContent;
12312
12364
  try {
12313
- yamlContent = await (0, import_promises9.readFile)(opts.file, "utf-8");
12365
+ yamlContent = await (0, import_promises10.readFile)(opts.file, "utf-8");
12314
12366
  } catch {
12315
12367
  printError(`Cannot read ${opts.file}`);
12316
12368
  process.exit(1);
@@ -12401,7 +12453,7 @@ function registerStandardCommands(program2) {
12401
12453
  }
12402
12454
 
12403
12455
  // src/commands/config.ts
12404
- var import_promises10 = require("node:fs/promises");
12456
+ var import_promises11 = require("node:fs/promises");
12405
12457
  function registerConfigCommands(program2) {
12406
12458
  const config = program2.command("config").description("Manage analysis configuration");
12407
12459
  config.command("push").description("Upload the analysis config to the service").option("--file <path>", "Path to config file", CODACY_CONFIG_FILE).action(async (opts) => {
@@ -12418,7 +12470,7 @@ function registerConfigCommands(program2) {
12418
12470
  }
12419
12471
  let content;
12420
12472
  try {
12421
- const raw = await (0, import_promises10.readFile)(opts.file, "utf-8");
12473
+ const raw = await (0, import_promises11.readFile)(opts.file, "utf-8");
12422
12474
  content = JSON.parse(raw);
12423
12475
  } catch {
12424
12476
  printError(`Cannot read or parse ${opts.file}`);
@@ -12768,12 +12820,12 @@ async function sendGeneralFeedback(message, opts, globals) {
12768
12820
 
12769
12821
  // src/commands/analyze.ts
12770
12822
  var import_node_fs19 = require("node:fs");
12771
- var import_node_path14 = require("node:path");
12823
+ var import_node_path15 = require("node:path");
12772
12824
 
12773
12825
  // src/lib/git.ts
12774
12826
  var import_node_child_process5 = require("node:child_process");
12775
12827
  var import_node_fs7 = require("node:fs");
12776
- var import_node_path7 = require("node:path");
12828
+ var import_node_path8 = require("node:path");
12777
12829
  function resolveFile(relpath) {
12778
12830
  if ((0, import_node_fs7.existsSync)(relpath)) return relpath;
12779
12831
  if ((0, import_node_fs7.existsSync)(".claude/worktrees")) {
@@ -12781,7 +12833,7 @@ function resolveFile(relpath) {
12781
12833
  const entries = (0, import_node_fs7.readdirSync)(".claude/worktrees", { withFileTypes: true });
12782
12834
  for (const entry of entries) {
12783
12835
  if (!entry.isDirectory()) continue;
12784
- const candidate = (0, import_node_path7.join)(".claude/worktrees", entry.name, relpath);
12836
+ const candidate = (0, import_node_path8.join)(".claude/worktrees", entry.name, relpath);
12785
12837
  if ((0, import_node_fs7.existsSync)(candidate)) return candidate;
12786
12838
  }
12787
12839
  } catch {
@@ -12822,7 +12874,7 @@ function readBaselineSha() {
12822
12874
  function writeBaselineSha(sha) {
12823
12875
  if (!SHA_RE.test(sha)) return;
12824
12876
  try {
12825
- (0, import_node_fs7.mkdirSync)((0, import_node_path7.dirname)(BASELINE_SHA_FILE), { recursive: true });
12877
+ (0, import_node_fs7.mkdirSync)((0, import_node_path8.dirname)(BASELINE_SHA_FILE), { recursive: true });
12826
12878
  (0, import_node_fs7.writeFileSync)(BASELINE_SHA_FILE, sha);
12827
12879
  } catch {
12828
12880
  }
@@ -12916,7 +12968,7 @@ function getWorktreeFiles() {
12916
12968
  const entries = (0, import_node_fs7.readdirSync)(worktreeDir, { withFileTypes: true });
12917
12969
  for (const entry of entries) {
12918
12970
  if (!entry.isDirectory()) continue;
12919
- const wtDir = (0, import_node_path7.join)(worktreeDir, entry.name);
12971
+ const wtDir = (0, import_node_path8.join)(worktreeDir, entry.name);
12920
12972
  scanDir(wtDir, wtDir, fiveMinAgo, result);
12921
12973
  }
12922
12974
  } catch {
@@ -12927,12 +12979,12 @@ function scanDir(baseDir, dir, minMtime, result) {
12927
12979
  try {
12928
12980
  const entries = (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true });
12929
12981
  for (const entry of entries) {
12930
- const fullPath = (0, import_node_path7.join)(dir, entry.name);
12982
+ const fullPath = (0, import_node_path8.join)(dir, entry.name);
12931
12983
  if (entry.isDirectory()) {
12932
12984
  if (entry.name === "node_modules" || entry.name === ".git") continue;
12933
12985
  scanDir(baseDir, fullPath, minMtime, result);
12934
12986
  } else if (entry.isFile()) {
12935
- const ext = (0, import_node_path7.extname)(entry.name).slice(1);
12987
+ const ext = (0, import_node_path8.extname)(entry.name).slice(1);
12936
12988
  if (!ANALYZABLE_EXTENSIONS.has(ext)) continue;
12937
12989
  try {
12938
12990
  const stat3 = (0, import_node_fs7.statSync)(fullPath);
@@ -12949,13 +13001,13 @@ function scanDir(baseDir, dir, minMtime, result) {
12949
13001
  }
12950
13002
  function filterAnalyzable(files) {
12951
13003
  return files.filter((f) => {
12952
- const ext = (0, import_node_path7.extname)(f).slice(1);
13004
+ const ext = (0, import_node_path8.extname)(f).slice(1);
12953
13005
  return ANALYZABLE_EXTENSIONS.has(ext);
12954
13006
  });
12955
13007
  }
12956
13008
  function filterReviewable(files) {
12957
13009
  return files.filter((f) => {
12958
- const ext = (0, import_node_path7.extname)(f).slice(1);
13010
+ const ext = (0, import_node_path8.extname)(f).slice(1);
12959
13011
  if (ANALYZABLE_EXTENSIONS.has(ext)) return false;
12960
13012
  if (REVIEWABLE_EXTENSIONS.has(ext)) return true;
12961
13013
  const basename2 = f.split("/").pop() ?? "";
@@ -12981,7 +13033,7 @@ function listTrackedFiles() {
12981
13033
 
12982
13034
  // src/lib/files.ts
12983
13035
  var import_node_fs8 = require("node:fs");
12984
- var import_node_path8 = require("node:path");
13036
+ var import_node_path9 = require("node:path");
12985
13037
  var LANG_MAP = {
12986
13038
  // Analyzable (static analysis + Gemini)
12987
13039
  ts: "typescript",
@@ -13049,7 +13101,7 @@ var LANG_MAP = {
13049
13101
  mk: "make"
13050
13102
  };
13051
13103
  function detectLanguage(filepath) {
13052
- const ext = (0, import_node_path8.extname)(filepath).slice(1);
13104
+ const ext = (0, import_node_path9.extname)(filepath).slice(1);
13053
13105
  return LANG_MAP[ext] ?? ext;
13054
13106
  }
13055
13107
  function sortByMtime(files) {
@@ -13335,7 +13387,7 @@ function runCodacyAnalysis(files) {
13335
13387
 
13336
13388
  // src/lib/specs.ts
13337
13389
  var import_node_fs11 = require("node:fs");
13338
- var import_node_path9 = require("node:path");
13390
+ var import_node_path10 = require("node:path");
13339
13391
  var SPEC_CANDIDATES = [
13340
13392
  "CLAUDE.md",
13341
13393
  "AGENTS.md",
@@ -13397,7 +13449,7 @@ function findMdFiles(dir, maxDepth, depth = 0) {
13397
13449
  try {
13398
13450
  const entries = (0, import_node_fs11.readdirSync)(dir, { withFileTypes: true });
13399
13451
  for (const entry of entries) {
13400
- const fullPath = (0, import_node_path9.join)(dir, entry.name);
13452
+ const fullPath = (0, import_node_path10.join)(dir, entry.name);
13401
13453
  if (entry.isFile() && entry.name.endsWith(".md")) {
13402
13454
  result.push(fullPath);
13403
13455
  } else if (entry.isDirectory() && depth < maxDepth - 1) {
@@ -13409,7 +13461,7 @@ function findMdFiles(dir, maxDepth, depth = 0) {
13409
13461
  return result;
13410
13462
  }
13411
13463
  function discoverPlans() {
13412
- const homePlansDir = (0, import_node_path9.join)(process.env.HOME ?? "", ".claude", "plans");
13464
+ const homePlansDir = (0, import_node_path10.join)(process.env.HOME ?? "", ".claude", "plans");
13413
13465
  const localPlansDir = ".claude/plans";
13414
13466
  const candidates = [];
13415
13467
  const seen = /* @__PURE__ */ new Set();
@@ -13419,7 +13471,7 @@ function discoverPlans() {
13419
13471
  for (const f of (0, import_node_fs11.readdirSync)(plansDir)) {
13420
13472
  if (!f.endsWith(".md") || seen.has(f)) continue;
13421
13473
  seen.add(f);
13422
- const fullPath = (0, import_node_path9.join)(plansDir, f);
13474
+ const fullPath = (0, import_node_path10.join)(plansDir, f);
13423
13475
  try {
13424
13476
  const stat3 = (0, import_node_fs11.statSync)(fullPath);
13425
13477
  candidates.push({ name: f, path: fullPath, mtime: stat3.mtimeMs, size: stat3.size });
@@ -13444,7 +13496,7 @@ function discoverPlans() {
13444
13496
 
13445
13497
  // src/lib/snapshot.ts
13446
13498
  var import_node_fs12 = require("node:fs");
13447
- var import_node_path10 = require("node:path");
13499
+ var import_node_path11 = require("node:path");
13448
13500
  var import_node_child_process7 = require("node:child_process");
13449
13501
  function generateSnapshotDiffs(files) {
13450
13502
  if (!(0, import_node_fs12.existsSync)(SNAPSHOT_DIR)) {
@@ -13452,7 +13504,7 @@ function generateSnapshotDiffs(files) {
13452
13504
  }
13453
13505
  const diffs = [];
13454
13506
  for (const file of files) {
13455
- const snapshotPath = (0, import_node_path10.join)(SNAPSHOT_DIR, file.path);
13507
+ const snapshotPath = (0, import_node_path11.join)(SNAPSHOT_DIR, file.path);
13456
13508
  const language = file.language ?? detectLanguage(file.path);
13457
13509
  if ((0, import_node_fs12.existsSync)(snapshotPath)) {
13458
13510
  const oldContent = (0, import_node_fs12.readFileSync)(snapshotPath, "utf-8");
@@ -13479,16 +13531,16 @@ ${addedLines}`,
13479
13531
  function saveSnapshots(files) {
13480
13532
  const snapshotPaths = /* @__PURE__ */ new Set();
13481
13533
  for (const file of files) {
13482
- const snapshotPath = (0, import_node_path10.join)(SNAPSHOT_DIR, file.path);
13534
+ const snapshotPath = (0, import_node_path11.join)(SNAPSHOT_DIR, file.path);
13483
13535
  snapshotPaths.add(snapshotPath);
13484
- (0, import_node_fs12.mkdirSync)((0, import_node_path10.dirname)(snapshotPath), { recursive: true });
13536
+ (0, import_node_fs12.mkdirSync)((0, import_node_path11.dirname)(snapshotPath), { recursive: true });
13485
13537
  (0, import_node_fs12.writeFileSync)(snapshotPath, file.content);
13486
13538
  }
13487
13539
  cleanStaleSnapshots(SNAPSHOT_DIR, snapshotPaths);
13488
13540
  }
13489
13541
  function computeDiff(oldContent, newContent, filePath) {
13490
- const tmpOld = (0, import_node_path10.join)(SNAPSHOT_DIR, ".diff-old.tmp");
13491
- const tmpNew = (0, import_node_path10.join)(SNAPSHOT_DIR, ".diff-new.tmp");
13542
+ const tmpOld = (0, import_node_path11.join)(SNAPSHOT_DIR, ".diff-old.tmp");
13543
+ const tmpNew = (0, import_node_path11.join)(SNAPSHOT_DIR, ".diff-new.tmp");
13492
13544
  try {
13493
13545
  (0, import_node_fs12.mkdirSync)(SNAPSHOT_DIR, { recursive: true });
13494
13546
  (0, import_node_fs12.writeFileSync)(tmpOld, oldContent);
@@ -13521,7 +13573,7 @@ function cleanStaleSnapshots(dir, keepSet) {
13521
13573
  const entries = (0, import_node_fs12.readdirSync)(dir, { withFileTypes: true });
13522
13574
  for (const entry of entries) {
13523
13575
  if (entry.name.startsWith(".")) continue;
13524
- const fullPath = (0, import_node_path10.join)(dir, entry.name);
13576
+ const fullPath = (0, import_node_path11.join)(dir, entry.name);
13525
13577
  if (entry.isDirectory()) {
13526
13578
  cleanStaleSnapshots(fullPath, keepSet);
13527
13579
  try {
@@ -13542,7 +13594,7 @@ function cleanStaleSnapshots(dir, keepSet) {
13542
13594
 
13543
13595
  // src/lib/baseline.ts
13544
13596
  var import_node_fs13 = require("node:fs");
13545
- var import_node_path11 = require("node:path");
13597
+ var import_node_path12 = require("node:path");
13546
13598
  var import_node_crypto5 = require("node:crypto");
13547
13599
  var BASELINE_VERSION = 1;
13548
13600
  var BASELINE_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
@@ -13553,13 +13605,13 @@ function sessionKey(sessionId) {
13553
13605
  return (0, import_node_crypto5.createHash)("sha256").update(sessionId).digest("hex").slice(0, 16);
13554
13606
  }
13555
13607
  function sessionDir(key) {
13556
- return (0, import_node_path11.join)(projectPath(BASELINE_DIR), key);
13608
+ return (0, import_node_path12.join)(projectPath(BASELINE_DIR), key);
13557
13609
  }
13558
13610
  function manifestPath(dir) {
13559
- return (0, import_node_path11.join)(dir, "manifest.json");
13611
+ return (0, import_node_path12.join)(dir, "manifest.json");
13560
13612
  }
13561
13613
  function mirrorPath(dir, repoRelPath) {
13562
- return (0, import_node_path11.join)(dir, "files", repoRelPath);
13614
+ return (0, import_node_path12.join)(dir, "files", repoRelPath);
13563
13615
  }
13564
13616
  function captureBaseline(opts = {}) {
13565
13617
  const key = sessionKey(opts.sessionId);
@@ -13575,7 +13627,7 @@ function captureBaseline(opts = {}) {
13575
13627
  (0, import_node_fs13.rmSync)(dir, { recursive: true, force: true });
13576
13628
  } catch {
13577
13629
  }
13578
- const filesDir = (0, import_node_path11.join)(dir, "files");
13630
+ const filesDir = (0, import_node_path12.join)(dir, "files");
13579
13631
  const mirrored = [];
13580
13632
  try {
13581
13633
  (0, import_node_fs13.mkdirSync)(filesDir, { recursive: true });
@@ -13585,7 +13637,7 @@ function captureBaseline(opts = {}) {
13585
13637
  if (content === null) continue;
13586
13638
  const dest = mirrorPath(dir, p);
13587
13639
  try {
13588
- (0, import_node_fs13.mkdirSync)((0, import_node_path11.dirname)(dest), { recursive: true });
13640
+ (0, import_node_fs13.mkdirSync)((0, import_node_path12.dirname)(dest), { recursive: true });
13589
13641
  (0, import_node_fs13.writeFileSync)(dest, content);
13590
13642
  mirrored.push(p);
13591
13643
  } catch {
@@ -13713,7 +13765,7 @@ function pruneOldBaselines() {
13713
13765
  }
13714
13766
  const now = Date.now();
13715
13767
  for (const name of entries) {
13716
- const dir = (0, import_node_path11.join)(root, name);
13768
+ const dir = (0, import_node_path12.join)(root, name);
13717
13769
  const manifest = readManifest(dir);
13718
13770
  if (!manifest) {
13719
13771
  try {
@@ -13812,7 +13864,7 @@ function gatherContextFiles(contextPaths, deltaFiles) {
13812
13864
 
13813
13865
  // src/lib/cache-cleanup.ts
13814
13866
  var import_node_fs16 = require("node:fs");
13815
- var import_node_path12 = require("node:path");
13867
+ var import_node_path13 = require("node:path");
13816
13868
  var CACHE_TTL_DAYS = 7;
13817
13869
  function pruneStaleCache() {
13818
13870
  try {
@@ -13820,7 +13872,7 @@ function pruneStaleCache() {
13820
13872
  const cutoff = Date.now() - CACHE_TTL_DAYS * 24 * 3600 * 1e3;
13821
13873
  for (const entry of (0, import_node_fs16.readdirSync)(dir)) {
13822
13874
  if (!entry.startsWith("pending-")) continue;
13823
- const path = (0, import_node_path12.join)(dir, entry);
13875
+ const path = (0, import_node_path13.join)(dir, entry);
13824
13876
  try {
13825
13877
  const stat3 = (0, import_node_fs16.statSync)(path);
13826
13878
  if (stat3.mtimeMs < cutoff) {
@@ -14211,9 +14263,9 @@ function capArray(set, max) {
14211
14263
  }
14212
14264
 
14213
14265
  // src/lib/seed-runner.ts
14214
- var import_promises11 = require("node:fs/promises");
14266
+ var import_promises12 = require("node:fs/promises");
14215
14267
  var import_node_fs18 = require("node:fs");
14216
- var import_node_path13 = require("node:path");
14268
+ var import_node_path14 = require("node:path");
14217
14269
  var import_yaml2 = __toESM(require_dist());
14218
14270
 
14219
14271
  // src/lib/seed.ts
@@ -14457,7 +14509,7 @@ async function runSeed(opts) {
14457
14509
  }
14458
14510
  let standardDoc;
14459
14511
  try {
14460
- const raw = await (0, import_promises11.readFile)(STANDARD_FILE, "utf-8");
14512
+ const raw = await (0, import_promises12.readFile)(STANDARD_FILE, "utf-8");
14461
14513
  standardDoc = (0, import_yaml2.parse)(raw);
14462
14514
  } catch {
14463
14515
  return { created: 0, failed: 0, skipped: "no_standard", candidates: [] };
@@ -14466,7 +14518,7 @@ async function runSeed(opts) {
14466
14518
  let readmeContent;
14467
14519
  if ((0, import_node_fs18.existsSync)("README.md")) {
14468
14520
  try {
14469
- readmeContent = await (0, import_promises11.readFile)("README.md", "utf-8");
14521
+ readmeContent = await (0, import_promises12.readFile)("README.md", "utf-8");
14470
14522
  } catch {
14471
14523
  }
14472
14524
  }
@@ -14474,7 +14526,7 @@ async function runSeed(opts) {
14474
14526
  for (const p of ["CLAUDE.md", ".claude/CLAUDE.md"]) {
14475
14527
  if ((0, import_node_fs18.existsSync)(p)) {
14476
14528
  try {
14477
- claudeMdContent = await (0, import_promises11.readFile)(p, "utf-8");
14529
+ claudeMdContent = await (0, import_promises12.readFile)(p, "utf-8");
14478
14530
  break;
14479
14531
  } catch {
14480
14532
  }
@@ -14495,7 +14547,7 @@ async function runSeed(opts) {
14495
14547
  if (candidates.length === 0) {
14496
14548
  return { created: 0, failed: 0, skipped: "no_candidates", candidates: [] };
14497
14549
  }
14498
- const overviewPath = (0, import_node_path13.join)(MEMORY_DIR, "domain", "project-overview.md");
14550
+ const overviewPath = (0, import_node_path14.join)(MEMORY_DIR, "domain", "project-overview.md");
14499
14551
  if ((0, import_node_fs18.existsSync)(overviewPath) && !opts.force) {
14500
14552
  return { created: 0, failed: 0, skipped: "already_seeded", candidates };
14501
14553
  }
@@ -14531,10 +14583,10 @@ async function runSeed(opts) {
14531
14583
  }
14532
14584
  const nodeId = res.data.node_id;
14533
14585
  const filePathRel = res.data.file_path;
14534
- const targetPath = (0, import_node_path13.join)(MEMORY_DIR, filePathRel);
14586
+ const targetPath = (0, import_node_path14.join)(MEMORY_DIR, filePathRel);
14535
14587
  try {
14536
- await (0, import_promises11.mkdir)((0, import_node_path13.dirname)(targetPath), { recursive: true });
14537
- await (0, import_promises11.writeFile)(targetPath, renderNodeMarkdown(c, nodeId, createdAt));
14588
+ await (0, import_promises12.mkdir)((0, import_node_path14.dirname)(targetPath), { recursive: true });
14589
+ await (0, import_promises12.writeFile)(targetPath, renderNodeMarkdown(c, nodeId, createdAt));
14538
14590
  created++;
14539
14591
  opts.onCreated?.(nodeId, filePathRel, c);
14540
14592
  } catch (err) {
@@ -14797,7 +14849,7 @@ async function runAnalyze(opts, globals) {
14797
14849
  let autoSeedNotice = null;
14798
14850
  try {
14799
14851
  await ensureMemoryDir();
14800
- const seedMarker = (0, import_node_path14.join)(VERITY_DIR, ".seeded");
14852
+ const seedMarker = (0, import_node_path15.join)(VERITY_DIR, ".seeded");
14801
14853
  const hasStandard = (0, import_node_fs19.existsSync)(STANDARD_FILE);
14802
14854
  const alreadyTried = (0, import_node_fs19.existsSync)(seedMarker);
14803
14855
  if (hasStandard && !alreadyTried) {
@@ -15290,9 +15342,9 @@ async function runReview(opts, globals) {
15290
15342
 
15291
15343
  // src/commands/guard.ts
15292
15344
  var import_node_fs22 = require("node:fs");
15293
- var import_node_path15 = require("node:path");
15345
+ var import_node_path16 = require("node:path");
15294
15346
  var GUARD_BLOCK_CAP = 2;
15295
- var GUARD_ITER_FILE = (0, import_node_path15.join)(VERITY_DIR, ".guard-iteration");
15347
+ var GUARD_ITER_FILE = (0, import_node_path16.join)(VERITY_DIR, ".guard-iteration");
15296
15348
  function readPreToolUseStdin() {
15297
15349
  const empty = { command: "", cwd: null, sessionId: null };
15298
15350
  return new Promise((resolve) => {
@@ -15607,13 +15659,13 @@ function writeBlockMessage(moment, response) {
15607
15659
 
15608
15660
  // src/commands/init.ts
15609
15661
  var import_node_fs24 = require("node:fs");
15610
- var import_promises12 = require("node:fs/promises");
15611
- var import_node_path17 = require("node:path");
15662
+ var import_promises13 = require("node:fs/promises");
15663
+ var import_node_path18 = require("node:path");
15612
15664
  var import_node_child_process9 = require("node:child_process");
15613
15665
 
15614
15666
  // src/commands/migrate.ts
15615
15667
  var import_node_fs23 = require("node:fs");
15616
- var import_node_path16 = require("node:path");
15668
+ var import_node_path17 = require("node:path");
15617
15669
  var import_node_child_process8 = require("node:child_process");
15618
15670
  var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
15619
15671
  function defaultNpmRemover(pkg) {
@@ -15649,8 +15701,8 @@ async function runMigration(opts = {}) {
15649
15701
  return { actions, migrated: actions.length > 0 };
15650
15702
  }
15651
15703
  function migrateProjectDir(root, actions) {
15652
- const gateDir = (0, import_node_path16.join)(root, ".gate");
15653
- const verityDir = (0, import_node_path16.join)(root, ".verity");
15704
+ const gateDir = (0, import_node_path17.join)(root, ".gate");
15705
+ const verityDir = (0, import_node_path17.join)(root, ".verity");
15654
15706
  if ((0, import_node_fs23.existsSync)(gateDir) && !(0, import_node_fs23.existsSync)(verityDir)) {
15655
15707
  return migrateProjectDirRename(root, gateDir, verityDir, actions);
15656
15708
  }
@@ -15704,11 +15756,11 @@ function migrateProjectDirCarry(gateDir, verityDir, actions) {
15704
15756
  }
15705
15757
  function migrateGlobalCredentials(home, actions) {
15706
15758
  if (!home) return;
15707
- const gateCreds = (0, import_node_path16.join)(home, ".gate", "credentials");
15708
- const verityCreds = (0, import_node_path16.join)(home, ".verity", "credentials");
15759
+ const gateCreds = (0, import_node_path17.join)(home, ".gate", "credentials");
15760
+ const verityCreds = (0, import_node_path17.join)(home, ".verity", "credentials");
15709
15761
  if (!(0, import_node_fs23.existsSync)(gateCreds)) return;
15710
15762
  if (!(0, import_node_fs23.existsSync)(verityCreds)) {
15711
- (0, import_node_fs23.mkdirSync)((0, import_node_path16.join)(home, ".verity"), { recursive: true });
15763
+ (0, import_node_fs23.mkdirSync)((0, import_node_path17.join)(home, ".verity"), { recursive: true });
15712
15764
  moveFile(gateCreds, verityCreds);
15713
15765
  actions.push("Moved ~/.gate/credentials \u2192 ~/.verity/credentials");
15714
15766
  return;
@@ -15730,7 +15782,7 @@ async function migrateLegacyHooks(root, actions) {
15730
15782
  }
15731
15783
  }
15732
15784
  async function migrateClaudeMd(root, actions) {
15733
- const claudeMd = (0, import_node_path16.join)(root, "CLAUDE.md");
15785
+ const claudeMd = (0, import_node_path17.join)(root, "CLAUDE.md");
15734
15786
  const hadLegacyBlock = (0, import_node_fs23.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
15735
15787
  if (!hadLegacyBlock) return;
15736
15788
  try {
@@ -15741,8 +15793,8 @@ async function migrateClaudeMd(root, actions) {
15741
15793
  }
15742
15794
  }
15743
15795
  function migrateStandardFile(root, actions) {
15744
- const gateMd = (0, import_node_path16.join)(root, "GATE.md");
15745
- const verityMd = (0, import_node_path16.join)(root, "VERITY.md");
15796
+ const gateMd = (0, import_node_path17.join)(root, "GATE.md");
15797
+ const verityMd = (0, import_node_path17.join)(root, "VERITY.md");
15746
15798
  if (!(0, import_node_fs23.existsSync)(gateMd) || (0, import_node_fs23.existsSync)(verityMd)) return;
15747
15799
  let moved = false;
15748
15800
  if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
@@ -15830,15 +15882,15 @@ function moveFile(from, to) {
15830
15882
  function carryLegacyContents(gateDir, verityDir) {
15831
15883
  let copied = 0;
15832
15884
  const walk = (relDir) => {
15833
- const srcDir = (0, import_node_path16.join)(gateDir, relDir);
15885
+ const srcDir = (0, import_node_path17.join)(gateDir, relDir);
15834
15886
  for (const entry of (0, import_node_fs23.readdirSync)(srcDir)) {
15835
- const rel = relDir ? (0, import_node_path16.join)(relDir, entry) : entry;
15836
- const src = (0, import_node_path16.join)(gateDir, rel);
15837
- const dest = (0, import_node_path16.join)(verityDir, rel);
15887
+ const rel = relDir ? (0, import_node_path17.join)(relDir, entry) : entry;
15888
+ const src = (0, import_node_path17.join)(gateDir, rel);
15889
+ const dest = (0, import_node_path17.join)(verityDir, rel);
15838
15890
  if ((0, import_node_fs23.statSync)(src).isDirectory()) {
15839
15891
  walk(rel);
15840
15892
  } else if (!(0, import_node_fs23.existsSync)(dest)) {
15841
- (0, import_node_fs23.mkdirSync)((0, import_node_path16.dirname)(dest), { recursive: true });
15893
+ (0, import_node_fs23.mkdirSync)((0, import_node_path17.dirname)(dest), { recursive: true });
15842
15894
  (0, import_node_fs23.cpSync)(src, dest);
15843
15895
  copied++;
15844
15896
  }
@@ -15848,22 +15900,22 @@ function carryLegacyContents(gateDir, verityDir) {
15848
15900
  return copied;
15849
15901
  }
15850
15902
  async function needsMigration(root = repoRoot()) {
15851
- const gateDir = (0, import_node_path16.join)(root, ".gate");
15852
- const verityDir = (0, import_node_path16.join)(root, ".verity");
15903
+ const gateDir = (0, import_node_path17.join)(root, ".gate");
15904
+ const verityDir = (0, import_node_path17.join)(root, ".verity");
15853
15905
  if ((0, import_node_fs23.existsSync)(gateDir) && !(0, import_node_fs23.existsSync)(verityDir)) return true;
15854
15906
  if ((0, import_node_fs23.existsSync)(gateDir) && (0, import_node_fs23.existsSync)(verityDir)) {
15855
- 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"))) {
15907
+ if ((0, import_node_fs23.existsSync)((0, import_node_path17.join)(gateDir, "credentials")) && !(0, import_node_fs23.existsSync)((0, import_node_path17.join)(verityDir, "credentials"))) {
15856
15908
  return true;
15857
15909
  }
15858
- 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"))) {
15910
+ if ((0, import_node_fs23.existsSync)((0, import_node_path17.join)(gateDir, "memory")) && !(0, import_node_fs23.existsSync)((0, import_node_path17.join)(verityDir, "memory"))) {
15859
15911
  return true;
15860
15912
  }
15861
15913
  }
15862
- const claudeMd = (0, import_node_path16.join)(root, "CLAUDE.md");
15914
+ const claudeMd = (0, import_node_path17.join)(root, "CLAUDE.md");
15863
15915
  if ((0, import_node_fs23.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
15864
15916
  return true;
15865
15917
  }
15866
- 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"))) {
15918
+ if ((0, import_node_fs23.existsSync)((0, import_node_path17.join)(root, "GATE.md")) && !(0, import_node_fs23.existsSync)((0, import_node_path17.join)(root, "VERITY.md"))) {
15867
15919
  return true;
15868
15920
  }
15869
15921
  if (await hasLegacyHooksAt(root)) return true;
@@ -15891,15 +15943,15 @@ function registerMigrateCommand(program2) {
15891
15943
  // src/commands/init.ts
15892
15944
  function resolveDataDir() {
15893
15945
  const candidates = [
15894
- (0, import_node_path17.join)(__dirname, "..", "data"),
15946
+ (0, import_node_path18.join)(__dirname, "..", "data"),
15895
15947
  // installed: node_modules/@codacy/verity-cli/data
15896
- (0, import_node_path17.join)(__dirname, "..", "..", "data"),
15948
+ (0, import_node_path18.join)(__dirname, "..", "..", "data"),
15897
15949
  // edge case: nested resolution
15898
- (0, import_node_path17.join)(process.cwd(), "cli", "data")
15950
+ (0, import_node_path18.join)(process.cwd(), "cli", "data")
15899
15951
  // local dev: running from repo root
15900
15952
  ];
15901
15953
  for (const candidate of candidates) {
15902
- if ((0, import_node_fs24.existsSync)((0, import_node_path17.join)(candidate, "skills"))) {
15954
+ if ((0, import_node_fs24.existsSync)((0, import_node_path18.join)(candidate, "skills"))) {
15903
15955
  return candidate;
15904
15956
  }
15905
15957
  }
@@ -15908,8 +15960,8 @@ function resolveDataDir() {
15908
15960
  );
15909
15961
  }
15910
15962
  async function copyDir(src, dest) {
15911
- await (0, import_promises12.mkdir)(dest, { recursive: true });
15912
- await (0, import_promises12.cp)(src, dest, { recursive: true, force: true });
15963
+ await (0, import_promises13.mkdir)(dest, { recursive: true });
15964
+ await (0, import_promises13.cp)(src, dest, { recursive: true, force: true });
15913
15965
  }
15914
15966
  function registerInitCommand(program2) {
15915
15967
  program2.command("init").description("Initialize Verity in the current project").option("--force", "Overwrite existing skills and hooks").action(async (opts) => {
@@ -15978,24 +16030,24 @@ function registerInitCommand(program2) {
15978
16030
  console.log("");
15979
16031
  printInfo("Installing skills...");
15980
16032
  const dataDir = resolveDataDir();
15981
- const skillsSource = (0, import_node_path17.join)(dataDir, "skills");
16033
+ const skillsSource = (0, import_node_path18.join)(dataDir, "skills");
15982
16034
  const skillsDest = ".claude/skills";
15983
16035
  const skills = ["verity-setup", "verity-analyze", "verity-status", "verity-feedback", "verity-learn", "verity-memory", "verity-insights", "verity-reflect"];
15984
16036
  let skillsInstalled = 0;
15985
16037
  for (const skill of skills) {
15986
- const src = (0, import_node_path17.join)(skillsSource, skill);
15987
- const dest = (0, import_node_path17.join)(skillsDest, skill);
16038
+ const src = (0, import_node_path18.join)(skillsSource, skill);
16039
+ const dest = (0, import_node_path18.join)(skillsDest, skill);
15988
16040
  if (!(0, import_node_fs24.existsSync)(src)) {
15989
16041
  printWarn(` Skill data not found: ${skill}`);
15990
16042
  continue;
15991
16043
  }
15992
16044
  if ((0, import_node_fs24.existsSync)(dest) && !force) {
15993
- const srcSkill = (0, import_node_path17.join)(src, "SKILL.md");
15994
- const destSkill = (0, import_node_path17.join)(dest, "SKILL.md");
16045
+ const srcSkill = (0, import_node_path18.join)(src, "SKILL.md");
16046
+ const destSkill = (0, import_node_path18.join)(dest, "SKILL.md");
15995
16047
  if ((0, import_node_fs24.existsSync)(destSkill)) {
15996
16048
  try {
15997
- const srcContent = await (0, import_promises12.readFile)(srcSkill, "utf-8");
15998
- const destContent = await (0, import_promises12.readFile)(destSkill, "utf-8");
16049
+ const srcContent = await (0, import_promises13.readFile)(srcSkill, "utf-8");
16050
+ const destContent = await (0, import_promises13.readFile)(destSkill, "utf-8");
15999
16051
  if (srcContent === destContent) {
16000
16052
  skillsInstalled++;
16001
16053
  continue;
@@ -16021,7 +16073,7 @@ function registerInitCommand(program2) {
16021
16073
  printWarn(` ${hookResult.error}`);
16022
16074
  printInfo(' Run "verity hooks install --force" to overwrite.');
16023
16075
  }
16024
- await (0, import_promises12.mkdir)(VERITY_DIR, { recursive: true });
16076
+ await (0, import_promises13.mkdir)(VERITY_DIR, { recursive: true });
16025
16077
  await ensureMemoryDir();
16026
16078
  try {
16027
16079
  await ensureClaudeMdPointer();
@@ -16029,8 +16081,8 @@ function registerInitCommand(program2) {
16029
16081
  } catch (err) {
16030
16082
  printWarn(` Could not update CLAUDE.md: ${err.message}`);
16031
16083
  }
16032
- const globalVerityDir = (0, import_node_path17.join)(process.env.HOME ?? "", ".verity");
16033
- await (0, import_promises12.mkdir)(globalVerityDir, { recursive: true });
16084
+ const globalVerityDir = (0, import_node_path18.join)(process.env.HOME ?? "", ".verity");
16085
+ await (0, import_promises13.mkdir)(globalVerityDir, { recursive: true });
16034
16086
  console.log("");
16035
16087
  printInfo("Verity initialized!");
16036
16088
  console.log("");
@@ -16053,7 +16105,7 @@ function registerInitCommand(program2) {
16053
16105
 
16054
16106
  // src/commands/uninstall.ts
16055
16107
  var import_node_fs25 = require("node:fs");
16056
- var import_node_path18 = require("node:path");
16108
+ var import_node_path19 = require("node:path");
16057
16109
  var SKILL_NAMES = [
16058
16110
  "verity-setup",
16059
16111
  "verity-analyze",
@@ -16072,7 +16124,7 @@ function registerUninstallCommand(program2) {
16072
16124
  const actions = [];
16073
16125
  const skillsRoot = projectPath(".claude/skills");
16074
16126
  for (const name of SKILL_NAMES) {
16075
- const dir = (0, import_node_path18.join)(skillsRoot, name);
16127
+ const dir = (0, import_node_path19.join)(skillsRoot, name);
16076
16128
  if ((0, import_node_fs25.existsSync)(dir)) {
16077
16129
  actions.push({
16078
16130
  label: `Remove .claude/skills/${name}/`,
@@ -16118,7 +16170,7 @@ function registerUninstallCommand(program2) {
16118
16170
  }
16119
16171
  });
16120
16172
  const home = process.env.HOME ?? "";
16121
- const globalVerityDir = (0, import_node_path18.join)(home, ".verity");
16173
+ const globalVerityDir = (0, import_node_path19.join)(home, ".verity");
16122
16174
  if (purgeGlobal && (0, import_node_fs25.existsSync)(globalVerityDir)) {
16123
16175
  actions.push({
16124
16176
  label: `Remove ~/.verity/ (global credentials \u2014 reconnect requires re-registration)`,
@@ -16317,7 +16369,7 @@ function registerTaskCommands(program2) {
16317
16369
 
16318
16370
  // src/commands/reset.ts
16319
16371
  var import_node_fs26 = require("node:fs");
16320
- var import_node_path19 = require("node:path");
16372
+ var import_node_path20 = require("node:path");
16321
16373
  function registerResetCommand(program2) {
16322
16374
  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) => {
16323
16375
  const globals = program2.opts();
@@ -16358,7 +16410,7 @@ function registerResetCommand(program2) {
16358
16410
  for (const entry of (0, import_node_fs26.readdirSync)(cacheDir)) {
16359
16411
  if (entry.startsWith("pending-")) {
16360
16412
  try {
16361
- (0, import_node_fs26.unlinkSync)((0, import_node_path19.join)(cacheDir, entry));
16413
+ (0, import_node_fs26.unlinkSync)((0, import_node_path20.join)(cacheDir, entry));
16362
16414
  purged++;
16363
16415
  } catch {
16364
16416
  }
@@ -16385,7 +16437,7 @@ function registerResetCommand(program2) {
16385
16437
  if ((0, import_node_fs26.existsSync)(logsDir)) {
16386
16438
  for (const entry of (0, import_node_fs26.readdirSync)(logsDir)) {
16387
16439
  try {
16388
- (0, import_node_fs26.unlinkSync)((0, import_node_path19.join)(logsDir, entry));
16440
+ (0, import_node_fs26.unlinkSync)((0, import_node_path20.join)(logsDir, entry));
16389
16441
  } catch {
16390
16442
  }
16391
16443
  }
@@ -16643,8 +16695,7 @@ function registerRunCommand(program2) {
16643
16695
  }
16644
16696
 
16645
16697
  // src/lib/telemetry.ts
16646
- var import_promises13 = require("node:fs/promises");
16647
- var import_node_path20 = require("node:path");
16698
+ var import_promises14 = require("node:fs/promises");
16648
16699
  var SETTINGS_LOCAL_FILE2 = ".claude/settings.local.json";
16649
16700
  var GITIGNORE_FILE = ".gitignore";
16650
16701
  var GITIGNORE_ENTRY = ".claude/settings.local.json";
@@ -16675,21 +16726,19 @@ function buildTelemetryEnv(serviceUrl, token) {
16675
16726
  var VERITY_TELEMETRY_KEYS = Object.keys(buildTelemetryEnv("", ""));
16676
16727
  async function readSettingsLocal() {
16677
16728
  try {
16678
- return JSON.parse(await (0, import_promises13.readFile)(projectPath(SETTINGS_LOCAL_FILE2), "utf-8"));
16729
+ return JSON.parse(await (0, import_promises14.readFile)(projectPath(SETTINGS_LOCAL_FILE2), "utf-8"));
16679
16730
  } catch {
16680
16731
  return {};
16681
16732
  }
16682
16733
  }
16683
16734
  async function writeSettingsLocal(settings) {
16684
- const file = projectPath(SETTINGS_LOCAL_FILE2);
16685
- await (0, import_promises13.mkdir)((0, import_node_path20.dirname)(file), { recursive: true });
16686
- await (0, import_promises13.writeFile)(file, JSON.stringify(settings, null, 2) + "\n");
16735
+ await writeJsonFilePreservingStyle(projectPath(SETTINGS_LOCAL_FILE2), settings);
16687
16736
  }
16688
16737
  async function ensureGitignore() {
16689
16738
  const file = projectPath(GITIGNORE_FILE);
16690
16739
  let content = "";
16691
16740
  try {
16692
- content = await (0, import_promises13.readFile)(file, "utf-8");
16741
+ content = await (0, import_promises14.readFile)(file, "utf-8");
16693
16742
  } catch {
16694
16743
  }
16695
16744
  const lines = content.split("\n").map((l) => l.trim());
@@ -16698,7 +16747,7 @@ async function ensureGitignore() {
16698
16747
  }
16699
16748
  const block = "# Verity telemetry \u2014 holds your project token\n" + GITIGNORE_ENTRY + "\n";
16700
16749
  const next = content ? content + (content.endsWith("\n") ? "" : "\n") + "\n" + block : block;
16701
- await (0, import_promises13.writeFile)(file, next);
16750
+ await (0, import_promises14.writeFile)(file, next);
16702
16751
  }
16703
16752
  async function installTelemetry(serviceUrl, token) {
16704
16753
  const env = buildTelemetryEnv(serviceUrl, token);
@@ -16778,7 +16827,7 @@ function registerTelemetryCommands(program2) {
16778
16827
  }
16779
16828
 
16780
16829
  // src/cli.ts
16781
- program.name("verity").description("CLI for Verity quality gate service").version("0.25.0").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
16830
+ program.name("verity").description("CLI for Verity quality gate service").version("0.26.0").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
16782
16831
  registerAuthCommands(program);
16783
16832
  registerHooksCommands(program);
16784
16833
  registerIntentCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "homepage": "https://verity.md",
6
6
  "repository": {