@codacy/verity-cli 0.32.0-experimental.cc76941 → 0.32.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 (3) hide show
  1. package/CHANGELOG.md +0 -46
  2. package/bin/verity.js +346 -703
  3. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -911,18 +911,18 @@ var require_suggestSimilar = __commonJS({
911
911
  }
912
912
  return d[a.length][b.length];
913
913
  }
914
- function suggestSimilar(word, candidates2) {
915
- if (!candidates2 || candidates2.length === 0) return "";
916
- candidates2 = Array.from(new Set(candidates2));
914
+ function suggestSimilar(word, candidates) {
915
+ if (!candidates || candidates.length === 0) return "";
916
+ candidates = Array.from(new Set(candidates));
917
917
  const searchingOptions = word.startsWith("--");
918
918
  if (searchingOptions) {
919
919
  word = word.slice(2);
920
- candidates2 = candidates2.map((candidate) => candidate.slice(2));
920
+ candidates = candidates.map((candidate) => candidate.slice(2));
921
921
  }
922
922
  let similar = [];
923
923
  let bestDistance = maxDistance;
924
924
  const minSimilarity = 0.4;
925
- candidates2.forEach((candidate) => {
925
+ candidates.forEach((candidate) => {
926
926
  if (candidate.length <= 1) return;
927
927
  const distance = editDistance(word, candidate);
928
928
  const length = Math.max(word.length, candidate.length);
@@ -6974,10 +6974,10 @@ var require_resolve_block_map = __commonJS({
6974
6974
  let offset = bm.offset;
6975
6975
  let commentEnd = null;
6976
6976
  for (const collItem of bm.items) {
6977
- const { start, key, sep: sep3, value } = collItem;
6977
+ const { start, key, sep: sep2, value } = collItem;
6978
6978
  const keyProps = resolveProps.resolveProps(start, {
6979
6979
  indicator: "explicit-key-ind",
6980
- next: key ?? sep3?.[0],
6980
+ next: key ?? sep2?.[0],
6981
6981
  offset,
6982
6982
  onError,
6983
6983
  parentIndent: bm.indent,
@@ -6991,7 +6991,7 @@ var require_resolve_block_map = __commonJS({
6991
6991
  else if ("indent" in key && key.indent !== bm.indent)
6992
6992
  onError(offset, "BAD_INDENT", startColMsg);
6993
6993
  }
6994
- if (!keyProps.anchor && !keyProps.tag && !sep3) {
6994
+ if (!keyProps.anchor && !keyProps.tag && !sep2) {
6995
6995
  commentEnd = keyProps.end;
6996
6996
  if (keyProps.comment) {
6997
6997
  if (map.comment)
@@ -7015,7 +7015,7 @@ var require_resolve_block_map = __commonJS({
7015
7015
  ctx.atKey = false;
7016
7016
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
7017
7017
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
7018
- const valueProps = resolveProps.resolveProps(sep3 ?? [], {
7018
+ const valueProps = resolveProps.resolveProps(sep2 ?? [], {
7019
7019
  indicator: "map-value-ind",
7020
7020
  next: value,
7021
7021
  offset: keyNode.range[2],
@@ -7031,7 +7031,7 @@ var require_resolve_block_map = __commonJS({
7031
7031
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
7032
7032
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
7033
7033
  }
7034
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep3, null, valueProps, onError);
7034
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep2, null, valueProps, onError);
7035
7035
  if (ctx.schema.compat)
7036
7036
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
7037
7037
  offset = valueNode.range[2];
@@ -7122,7 +7122,7 @@ var require_resolve_end = __commonJS({
7122
7122
  let comment = "";
7123
7123
  if (end) {
7124
7124
  let hasSpace = false;
7125
- let sep3 = "";
7125
+ let sep2 = "";
7126
7126
  for (const token of end) {
7127
7127
  const { source, type } = token;
7128
7128
  switch (type) {
@@ -7136,13 +7136,13 @@ var require_resolve_end = __commonJS({
7136
7136
  if (!comment)
7137
7137
  comment = cb;
7138
7138
  else
7139
- comment += sep3 + cb;
7140
- sep3 = "";
7139
+ comment += sep2 + cb;
7140
+ sep2 = "";
7141
7141
  break;
7142
7142
  }
7143
7143
  case "newline":
7144
7144
  if (comment)
7145
- sep3 += source;
7145
+ sep2 += source;
7146
7146
  hasSpace = true;
7147
7147
  break;
7148
7148
  default:
@@ -7185,18 +7185,18 @@ var require_resolve_flow_collection = __commonJS({
7185
7185
  let offset = fc.offset + fc.start.source.length;
7186
7186
  for (let i = 0; i < fc.items.length; ++i) {
7187
7187
  const collItem = fc.items[i];
7188
- const { start, key, sep: sep3, value } = collItem;
7188
+ const { start, key, sep: sep2, value } = collItem;
7189
7189
  const props = resolveProps.resolveProps(start, {
7190
7190
  flow: fcName,
7191
7191
  indicator: "explicit-key-ind",
7192
- next: key ?? sep3?.[0],
7192
+ next: key ?? sep2?.[0],
7193
7193
  offset,
7194
7194
  onError,
7195
7195
  parentIndent: fc.indent,
7196
7196
  startOnNewline: false
7197
7197
  });
7198
7198
  if (!props.found) {
7199
- if (!props.anchor && !props.tag && !sep3 && !value) {
7199
+ if (!props.anchor && !props.tag && !sep2 && !value) {
7200
7200
  if (i === 0 && props.comma)
7201
7201
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
7202
7202
  else if (i < fc.items.length - 1)
@@ -7250,8 +7250,8 @@ var require_resolve_flow_collection = __commonJS({
7250
7250
  }
7251
7251
  }
7252
7252
  }
7253
- if (!isMap && !sep3 && !props.found) {
7254
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep3, null, props, onError);
7253
+ if (!isMap && !sep2 && !props.found) {
7254
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep2, null, props, onError);
7255
7255
  coll.items.push(valueNode);
7256
7256
  offset = valueNode.range[2];
7257
7257
  if (isBlock(value))
@@ -7263,7 +7263,7 @@ var require_resolve_flow_collection = __commonJS({
7263
7263
  if (isBlock(key))
7264
7264
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
7265
7265
  ctx.atKey = false;
7266
- const valueProps = resolveProps.resolveProps(sep3 ?? [], {
7266
+ const valueProps = resolveProps.resolveProps(sep2 ?? [], {
7267
7267
  flow: fcName,
7268
7268
  indicator: "map-value-ind",
7269
7269
  next: value,
@@ -7274,8 +7274,8 @@ var require_resolve_flow_collection = __commonJS({
7274
7274
  });
7275
7275
  if (valueProps.found) {
7276
7276
  if (!isMap && !props.found && ctx.options.strict) {
7277
- if (sep3)
7278
- for (const st of sep3) {
7277
+ if (sep2)
7278
+ for (const st of sep2) {
7279
7279
  if (st === valueProps.found)
7280
7280
  break;
7281
7281
  if (st.type === "newline") {
@@ -7292,7 +7292,7 @@ var require_resolve_flow_collection = __commonJS({
7292
7292
  else
7293
7293
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
7294
7294
  }
7295
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep3, null, valueProps, onError) : null;
7295
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep2, null, valueProps, onError) : null;
7296
7296
  if (valueNode) {
7297
7297
  if (isBlock(value))
7298
7298
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -7472,7 +7472,7 @@ var require_resolve_block_scalar = __commonJS({
7472
7472
  chompStart = i + 1;
7473
7473
  }
7474
7474
  let value = "";
7475
- let sep3 = "";
7475
+ let sep2 = "";
7476
7476
  let prevMoreIndented = false;
7477
7477
  for (let i = 0; i < contentStart; ++i)
7478
7478
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -7489,24 +7489,24 @@ var require_resolve_block_scalar = __commonJS({
7489
7489
  indent = "";
7490
7490
  }
7491
7491
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
7492
- value += sep3 + indent.slice(trimIndent) + content;
7493
- sep3 = "\n";
7492
+ value += sep2 + indent.slice(trimIndent) + content;
7493
+ sep2 = "\n";
7494
7494
  } else if (indent.length > trimIndent || content[0] === " ") {
7495
- if (sep3 === " ")
7496
- sep3 = "\n";
7497
- else if (!prevMoreIndented && sep3 === "\n")
7498
- sep3 = "\n\n";
7499
- value += sep3 + indent.slice(trimIndent) + content;
7500
- sep3 = "\n";
7495
+ if (sep2 === " ")
7496
+ sep2 = "\n";
7497
+ else if (!prevMoreIndented && sep2 === "\n")
7498
+ sep2 = "\n\n";
7499
+ value += sep2 + indent.slice(trimIndent) + content;
7500
+ sep2 = "\n";
7501
7501
  prevMoreIndented = true;
7502
7502
  } else if (content === "") {
7503
- if (sep3 === "\n")
7503
+ if (sep2 === "\n")
7504
7504
  value += "\n";
7505
7505
  else
7506
- sep3 = "\n";
7506
+ sep2 = "\n";
7507
7507
  } else {
7508
- value += sep3 + content;
7509
- sep3 = " ";
7508
+ value += sep2 + content;
7509
+ sep2 = " ";
7510
7510
  prevMoreIndented = false;
7511
7511
  }
7512
7512
  }
@@ -7684,25 +7684,25 @@ var require_resolve_flow_scalar = __commonJS({
7684
7684
  if (!match)
7685
7685
  return source;
7686
7686
  let res = match[1];
7687
- let sep3 = " ";
7687
+ let sep2 = " ";
7688
7688
  let pos = first.lastIndex;
7689
7689
  line.lastIndex = pos;
7690
7690
  while (match = line.exec(source)) {
7691
7691
  if (match[1] === "") {
7692
- if (sep3 === "\n")
7693
- res += sep3;
7692
+ if (sep2 === "\n")
7693
+ res += sep2;
7694
7694
  else
7695
- sep3 = "\n";
7695
+ sep2 = "\n";
7696
7696
  } else {
7697
- res += sep3 + match[1];
7698
- sep3 = " ";
7697
+ res += sep2 + match[1];
7698
+ sep2 = " ";
7699
7699
  }
7700
7700
  pos = line.lastIndex;
7701
7701
  }
7702
7702
  const last = /[ \t]*(.*)/sy;
7703
7703
  last.lastIndex = pos;
7704
7704
  match = last.exec(source);
7705
- return res + sep3 + (match?.[1] ?? "");
7705
+ return res + sep2 + (match?.[1] ?? "");
7706
7706
  }
7707
7707
  function doubleQuotedValue(source, onError) {
7708
7708
  let res = "";
@@ -8509,14 +8509,14 @@ var require_cst_stringify = __commonJS({
8509
8509
  }
8510
8510
  }
8511
8511
  }
8512
- function stringifyItem({ start, key, sep: sep3, value }) {
8512
+ function stringifyItem({ start, key, sep: sep2, value }) {
8513
8513
  let res = "";
8514
8514
  for (const st of start)
8515
8515
  res += st.source;
8516
8516
  if (key)
8517
8517
  res += stringifyToken(key);
8518
- if (sep3)
8519
- for (const st of sep3)
8518
+ if (sep2)
8519
+ for (const st of sep2)
8520
8520
  res += st.source;
8521
8521
  if (value)
8522
8522
  res += stringifyToken(value);
@@ -9659,18 +9659,18 @@ var require_parser = __commonJS({
9659
9659
  if (this.type === "map-value-ind") {
9660
9660
  const prev = getPrevProps(this.peek(2));
9661
9661
  const start = getFirstKeyStartProps(prev);
9662
- let sep3;
9662
+ let sep2;
9663
9663
  if (scalar.end) {
9664
- sep3 = scalar.end;
9665
- sep3.push(this.sourceToken);
9664
+ sep2 = scalar.end;
9665
+ sep2.push(this.sourceToken);
9666
9666
  delete scalar.end;
9667
9667
  } else
9668
- sep3 = [this.sourceToken];
9668
+ sep2 = [this.sourceToken];
9669
9669
  const map = {
9670
9670
  type: "block-map",
9671
9671
  offset: scalar.offset,
9672
9672
  indent: scalar.indent,
9673
- items: [{ start, key: scalar, sep: sep3 }]
9673
+ items: [{ start, key: scalar, sep: sep2 }]
9674
9674
  };
9675
9675
  this.onKeyLine = true;
9676
9676
  this.stack[this.stack.length - 1] = map;
@@ -9822,15 +9822,15 @@ var require_parser = __commonJS({
9822
9822
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
9823
9823
  const start2 = getFirstKeyStartProps(it.start);
9824
9824
  const key = it.key;
9825
- const sep3 = it.sep;
9826
- sep3.push(this.sourceToken);
9825
+ const sep2 = it.sep;
9826
+ sep2.push(this.sourceToken);
9827
9827
  delete it.key;
9828
9828
  delete it.sep;
9829
9829
  this.stack.push({
9830
9830
  type: "block-map",
9831
9831
  offset: this.offset,
9832
9832
  indent: this.indent,
9833
- items: [{ start: start2, key, sep: sep3 }]
9833
+ items: [{ start: start2, key, sep: sep2 }]
9834
9834
  });
9835
9835
  } else if (start.length > 0) {
9836
9836
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -10024,13 +10024,13 @@ var require_parser = __commonJS({
10024
10024
  const prev = getPrevProps(parent);
10025
10025
  const start = getFirstKeyStartProps(prev);
10026
10026
  fixFlowSeqItems(fc);
10027
- const sep3 = fc.end.splice(1, fc.end.length);
10028
- sep3.push(this.sourceToken);
10027
+ const sep2 = fc.end.splice(1, fc.end.length);
10028
+ sep2.push(this.sourceToken);
10029
10029
  const map = {
10030
10030
  type: "block-map",
10031
10031
  offset: fc.offset,
10032
10032
  indent: fc.indent,
10033
- items: [{ start, key: fc, sep: sep3 }]
10033
+ items: [{ start, key: fc, sep: sep2 }]
10034
10034
  };
10035
10035
  this.onKeyLine = true;
10036
10036
  this.stack[this.stack.length - 1] = map;
@@ -10509,7 +10509,7 @@ var SECURITY_PATTERNS = [
10509
10509
  /Dockerfile/
10510
10510
  ];
10511
10511
  var PROD_SERVICE_URL = "https://ofcamwrjwrkazqvdchko.supabase.co/functions/v1";
10512
- var DEFAULT_SERVICE_URL = "https://wukeddyzpijoegyajtnc.supabase.co/functions/v1".length > 0 ? "https://wukeddyzpijoegyajtnc.supabase.co/functions/v1" : PROD_SERVICE_URL;
10512
+ var DEFAULT_SERVICE_URL = "".length > 0 ? "" : PROD_SERVICE_URL;
10513
10513
  var GITHUB_CLIENT_ID = "Iv23li88HxAi3ZrbYzWh";
10514
10514
  var GITHUB_DEVICE_CODE_URL = "https://github.com/login/device/code";
10515
10515
  var GITHUB_ACCESS_TOKEN_URL = "https://github.com/login/oauth/access_token";
@@ -11519,7 +11519,7 @@ function startSpinner(label2, opts = {}) {
11519
11519
  }
11520
11520
 
11521
11521
  // src/lib/provider-auth.ts
11522
- var sleep = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms));
11522
+ var sleep = (ms) => new Promise((resolve4) => setTimeout(resolve4, ms));
11523
11523
  var form = (fields) => new URLSearchParams(fields).toString();
11524
11524
  async function githubAccountId(owner) {
11525
11525
  try {
@@ -12735,7 +12735,6 @@ async function applyMomentSelection(moments) {
12735
12735
 
12736
12736
  // src/lib/project-config.ts
12737
12737
  var import_node_fs4 = require("node:fs");
12738
- var import_node_path6 = require("node:path");
12739
12738
  var DEFAULTS = { git_moments: [] };
12740
12739
  function isMoment(value) {
12741
12740
  return value === "commit" || value === "push";
@@ -12743,39 +12742,20 @@ function isMoment(value) {
12743
12742
  function parseMoments(raw) {
12744
12743
  return [...new Set(raw.split(",").map((s) => s.trim()).filter(isMoment))];
12745
12744
  }
12746
- function readConfigFile(path) {
12745
+ function readProjectConfig() {
12747
12746
  try {
12748
- if (!(0, import_node_fs4.existsSync)(path)) return null;
12749
- const raw = JSON.parse((0, import_node_fs4.readFileSync)(path, "utf-8"));
12747
+ if (!(0, import_node_fs4.existsSync)(PROJECT_CONFIG_FILE)) return DEFAULTS;
12748
+ const raw = JSON.parse((0, import_node_fs4.readFileSync)(PROJECT_CONFIG_FILE, "utf-8"));
12750
12749
  const moments = Array.isArray(raw.git_moments) ? raw.git_moments.filter(isMoment) : [];
12751
12750
  return { git_moments: [...new Set(moments)] };
12752
12751
  } catch {
12753
12752
  return DEFAULTS;
12754
12753
  }
12755
12754
  }
12756
- function candidates() {
12757
- const local = projectPath(PROJECT_CONFIG_FILE);
12758
- const out = [{ path: local, source: "local" }];
12759
- const main = mainWorktreeRoot();
12760
- if (main) {
12761
- const inherited = (0, import_node_path6.join)(main, PROJECT_CONFIG_FILE);
12762
- if (inherited !== local) out.push({ path: inherited, source: "main-worktree" });
12763
- }
12764
- return out;
12765
- }
12766
- function readProjectConfig() {
12767
- for (const { path, source } of candidates()) {
12768
- const cfg = readConfigFile(path);
12769
- if (cfg) return { ...cfg, source, path };
12770
- }
12771
- return { ...DEFAULTS, source: "default" };
12772
- }
12773
12755
  function writeProjectConfig(patch) {
12774
- const { git_moments } = readProjectConfig();
12775
- const next = { git_moments, ...patch };
12776
- const target = projectPath(PROJECT_CONFIG_FILE);
12777
- (0, import_node_fs4.mkdirSync)((0, import_node_path6.dirname)(target), { recursive: true });
12778
- (0, import_node_fs4.writeFileSync)(target, JSON.stringify(next, null, 2) + "\n");
12756
+ const next = { ...readProjectConfig(), ...patch };
12757
+ (0, import_node_fs4.mkdirSync)(VERITY_DIR, { recursive: true });
12758
+ (0, import_node_fs4.writeFileSync)(PROJECT_CONFIG_FILE, JSON.stringify(next, null, 2) + "\n");
12779
12759
  return next;
12780
12760
  }
12781
12761
  function resolveGuardMoments(explicit) {
@@ -12785,8 +12765,6 @@ function resolveGuardMoments(explicit) {
12785
12765
 
12786
12766
  // src/lib/plugin-ownership.ts
12787
12767
  var import_node_fs6 = require("node:fs");
12788
- var import_node_os2 = require("node:os");
12789
- var import_node_path7 = require("node:path");
12790
12768
 
12791
12769
  // src/lib/stderr-log.ts
12792
12770
  var import_node_fs5 = require("node:fs");
@@ -12847,13 +12825,10 @@ var MARKER_TTL_SECONDS = 24 * 60 * 60;
12847
12825
  function isPluginInvocation() {
12848
12826
  return !!process.env.VERITY_PLUGIN_ROOT;
12849
12827
  }
12850
- function markerPath() {
12851
- return projectPath(PLUGIN_MARKER_FILE);
12852
- }
12853
12828
  function readMarker() {
12854
12829
  try {
12855
- if (!(0, import_node_fs6.existsSync)(markerPath())) return null;
12856
- const raw = JSON.parse((0, import_node_fs6.readFileSync)(markerPath(), "utf-8"));
12830
+ if (!(0, import_node_fs6.existsSync)(PLUGIN_MARKER_FILE)) return null;
12831
+ const raw = JSON.parse((0, import_node_fs6.readFileSync)(PLUGIN_MARKER_FILE, "utf-8"));
12857
12832
  const pluginRoot = typeof raw.plugin_root === "string" ? raw.plugin_root : "";
12858
12833
  if (!pluginRoot) return null;
12859
12834
  return {
@@ -12870,75 +12845,16 @@ function recordPluginOwnership(sessionId) {
12870
12845
  const pluginRoot = process.env.VERITY_PLUGIN_ROOT;
12871
12846
  if (!pluginRoot) return;
12872
12847
  try {
12873
- (0, import_node_fs6.mkdirSync)(projectPath(VERITY_DIR), { recursive: true });
12848
+ (0, import_node_fs6.mkdirSync)(VERITY_DIR, { recursive: true });
12874
12849
  const marker = {
12875
12850
  session_id: sessionId,
12876
12851
  plugin_root: pluginRoot,
12877
12852
  version: process.env.VERITY_PLUGIN_VERSION || null,
12878
12853
  ts: Math.floor(Date.now() / 1e3)
12879
12854
  };
12880
- (0, import_node_fs6.writeFileSync)(markerPath(), JSON.stringify(marker));
12881
- } catch {
12882
- }
12883
- }
12884
- function claudeConfigDir() {
12885
- return process.env.CLAUDE_CONFIG_DIR || (0, import_node_path7.join)((0, import_node_os2.homedir)(), ".claude");
12886
- }
12887
- function readJsonFile(path) {
12888
- try {
12889
- const parsed = JSON.parse((0, import_node_fs6.readFileSync)(path, "utf-8"));
12890
- return parsed && typeof parsed === "object" ? parsed : null;
12891
- } catch {
12892
- return null;
12893
- }
12894
- }
12895
- function enabledPluginSetting(key) {
12896
- const files = [
12897
- projectPath((0, import_node_path7.join)(".claude", "settings.local.json")),
12898
- projectPath((0, import_node_path7.join)(".claude", "settings.json")),
12899
- (0, import_node_path7.join)(claudeConfigDir(), "settings.json")
12900
- ];
12901
- for (const file of files) {
12902
- const map = readJsonFile(file)?.enabledPlugins;
12903
- if (map && typeof map === "object" && key in map) {
12904
- return map[key] !== false;
12905
- }
12906
- }
12907
- return void 0;
12908
- }
12909
- function registrySays(pluginRoot) {
12910
- const plugins = readJsonFile((0, import_node_path7.join)(claudeConfigDir(), "plugins", "installed_plugins.json"))?.plugins;
12911
- if (!plugins || typeof plugins !== "object") return "unverified";
12912
- const want = (0, import_node_path7.resolve)(pluginRoot);
12913
- for (const [key, value] of Object.entries(plugins)) {
12914
- for (const entry of Array.isArray(value) ? value : []) {
12915
- const installPath = entry?.installPath;
12916
- if (typeof installPath === "string" && (0, import_node_path7.resolve)(installPath) === want) {
12917
- if (enabledPluginSetting(key) === false) return "gone";
12918
- return (0, import_node_fs6.existsSync)(pluginRoot) ? "live" : "gone";
12919
- }
12920
- }
12921
- }
12922
- const managed = (0, import_node_path7.resolve)((0, import_node_path7.join)(claudeConfigDir(), "plugins", "cache"));
12923
- return want === managed || want.startsWith(managed + import_node_path7.sep) ? "gone" : "unverified";
12924
- }
12925
- var _live = /* @__PURE__ */ new Map();
12926
- function pluginLiveness(pluginRoot) {
12927
- const cached2 = _live.get(pluginRoot);
12928
- if (cached2 !== void 0) return cached2;
12929
- const said = registrySays(pluginRoot);
12930
- _live.set(pluginRoot, said);
12931
- return said;
12932
- }
12933
- function clearStalePluginMarker() {
12934
- const marker = readMarker();
12935
- if (!marker || pluginLiveness(marker.plugin_root) !== "gone") return null;
12936
- try {
12937
- (0, import_node_fs6.rmSync)(markerPath(), { force: true });
12855
+ (0, import_node_fs6.writeFileSync)(PLUGIN_MARKER_FILE, JSON.stringify(marker));
12938
12856
  } catch {
12939
- return null;
12940
12857
  }
12941
- return { pluginRoot: marker.plugin_root, version: marker.version };
12942
12858
  }
12943
12859
  function shouldDeferToPlugin(sessionId) {
12944
12860
  if (isPluginInvocation()) {
@@ -12947,24 +12863,13 @@ function shouldDeferToPlugin(sessionId) {
12947
12863
  }
12948
12864
  const marker = readMarker();
12949
12865
  if (!marker) return false;
12950
- const liveness = pluginLiveness(marker.plugin_root);
12951
- if (liveness === "gone") return false;
12866
+ if (!(0, import_node_fs6.existsSync)(marker.plugin_root)) return false;
12952
12867
  if (sessionId && marker.session_id) return sessionId === marker.session_id;
12953
- if (liveness !== "live") {
12954
- logToFileOnly(
12955
- `plugin ownership: ignoring an unverified marker for ${marker.plugin_root} \u2014 no session id to match and Claude Code does not list that install.`
12956
- );
12957
- return false;
12958
- }
12959
12868
  return Math.floor(Date.now() / 1e3) - marker.ts < MARKER_TTL_SECONDS;
12960
12869
  }
12961
12870
  function pluginActiveHere() {
12962
- return activePluginInstall() !== null;
12963
- }
12964
- function activePluginInstall() {
12965
12871
  const marker = readMarker();
12966
- if (!marker || pluginLiveness(marker.plugin_root) !== "live") return null;
12967
- return { pluginRoot: marker.plugin_root, version: marker.version };
12872
+ return !!marker && (0, import_node_fs6.existsSync)(marker.plugin_root);
12968
12873
  }
12969
12874
  function deferredToPlugin(command, sessionId) {
12970
12875
  if (!shouldDeferToPlugin(sessionId)) return false;
@@ -12974,63 +12879,21 @@ function deferredToPlugin(command, sessionId) {
12974
12879
  return true;
12975
12880
  }
12976
12881
 
12977
- // src/lib/hook-wiring.ts
12978
- function carriesAnyVerityHook(s) {
12979
- return s.stop || s.intent || s.baseline || s.compact || s.sessionEnd || s.guard;
12980
- }
12981
- async function resolveHookWiring() {
12982
- const settings = await checkAllVerityHooks();
12983
- const config = readProjectConfig();
12984
- const gitMoments = { source: config.source, path: config.path };
12985
- if (!pluginActiveHere()) {
12986
- return { source: "settings", status: settings, settings, duplicateSettingsHooks: false, gitMoments };
12987
- }
12988
- const status = {
12989
- stop: true,
12990
- intent: true,
12991
- baseline: true,
12992
- compact: true,
12993
- sessionEnd: true,
12994
- guard: true,
12995
- guardOn: config.git_moments
12996
- };
12997
- return {
12998
- source: "plugin",
12999
- status,
13000
- settings,
13001
- duplicateSettingsHooks: carriesAnyVerityHook(settings),
13002
- gitMoments
13003
- };
13004
- }
13005
-
13006
12882
  // src/commands/hooks.ts
13007
12883
  var ALL_MOMENTS = ["stop", "pre-commit", "pre-push"];
13008
- function parseMomentSelection(raw) {
13009
- const parts = raw.split(",").map((s) => s.trim()).filter(Boolean);
13010
- if (parts.length === 1 && parts[0].toLowerCase() === "none") return { moments: [] };
13011
- if (parts.length === 0) {
13012
- return { error: `--moments was empty. Pass one or more of ${ALL_MOMENTS.join(", ")} \u2014 or "none" to gate nothing.` };
13013
- }
13014
- const unknown = parts.filter((p) => !ALL_MOMENTS.includes(p));
13015
- if (unknown.length > 0) {
13016
- return {
13017
- error: `--moments: unrecognised ${unknown.length === 1 ? "moment" : "moments"} ${unknown.map((u) => `"${u}"`).join(", ")}. Valid: ${ALL_MOMENTS.join(", ")} \u2014 or "none" to gate nothing.`
13018
- };
12884
+ function parseMoments2(raw) {
12885
+ const seen = /* @__PURE__ */ new Set();
12886
+ for (const part of raw.split(",").map((s) => s.trim()).filter(Boolean)) {
12887
+ if (ALL_MOMENTS.includes(part)) seen.add(part);
13019
12888
  }
13020
- const seen = new Set(parts);
13021
- return { moments: ALL_MOMENTS.filter((m) => seen.has(m)) };
12889
+ return ALL_MOMENTS.filter((m) => seen.has(m));
13022
12890
  }
13023
12891
  function registerHooksCommands(program2) {
13024
12892
  const hooks = program2.command("hooks").description("Manage Claude Code hook wiring");
13025
12893
  hooks.command("install").description("Install Verity hooks into Claude Code settings").option("--force", "Overwrite existing Verity hooks").option("--moments <list>", "Reconcile to exactly these moments: stop,pre-commit,pre-push").action(async (opts) => {
13026
12894
  const force = opts.force ?? false;
13027
12895
  if (opts.moments != null) {
13028
- const parsed = parseMomentSelection(opts.moments);
13029
- if ("error" in parsed) {
13030
- printError(parsed.error);
13031
- process.exit(1);
13032
- }
13033
- const moments = parsed.moments;
12896
+ const moments = parseMoments2(opts.moments);
13034
12897
  const gitMoments = [
13035
12898
  ...moments.includes("pre-commit") ? ["commit"] : [],
13036
12899
  ...moments.includes("pre-push") ? ["push"] : []
@@ -13091,22 +12954,20 @@ function registerHooksCommands(program2) {
13091
12954
  printInfo(" SessionStart hook: verity baseline capture");
13092
12955
  });
13093
12956
  hooks.command("check").description("Check if Verity hooks are installed").action(async () => {
13094
- const wiring = await resolveHookWiring();
13095
- const status = wiring.status;
13096
- if (wiring.source === "plugin") {
13097
- const moments = status.guardOn;
13098
- const inherited = wiring.gitMoments.source === "main-worktree" && wiring.gitMoments.path ? ` (inherited from the main worktree: ${wiring.gitMoments.path})` : "";
12957
+ const status = await checkAllVerityHooks();
12958
+ if (pluginActiveHere()) {
12959
+ const moments = readProjectConfig().git_moments;
13099
12960
  printInfo("Wired by the Verity Claude Code plugin (not .claude/settings.json):");
13100
12961
  printInfo(" Stop hook (verity analyze): installed");
13101
12962
  printInfo(" Intent hook (verity intent capture): installed");
13102
12963
  printInfo(" Baseline hook (verity baseline capture): installed");
13103
12964
  printInfo(
13104
- ` Git-moment gate (verity guard): ${moments.length ? `installed [${moments.join(", ")}]${inherited}` : "wired but gating nothing"}`
12965
+ ` Git-moment gate (verity guard): ${moments.length ? `installed [${moments.join(", ")}]` : "wired but gating nothing"}`
13105
12966
  );
13106
12967
  if (!moments.length) {
13107
12968
  printInfo(' Enable it with "verity config git-moments commit,push".');
13108
12969
  }
13109
- if (wiring.duplicateSettingsHooks) {
12970
+ if (status.stop || status.intent || status.baseline || status.guard) {
13110
12971
  printWarn(" Duplicate hooks also exist in .claude/settings.json. They stand down at run time,");
13111
12972
  printWarn(' but remove them with "verity init --plugin-mode" so the wiring says what it does.');
13112
12973
  }
@@ -13491,8 +13352,8 @@ function isCommandOnlyTurn(input) {
13491
13352
  // src/lib/context-identity.ts
13492
13353
  var import_node_crypto2 = require("node:crypto");
13493
13354
  var import_node_fs8 = require("node:fs");
13494
- var import_node_os3 = require("node:os");
13495
- var import_node_path8 = require("node:path");
13355
+ var import_node_os2 = require("node:os");
13356
+ var import_node_path6 = require("node:path");
13496
13357
  var SHARED_SENTINELS = /* @__PURE__ */ new Set([
13497
13358
  "",
13498
13359
  "-",
@@ -13546,13 +13407,13 @@ function contextIdentity(input) {
13546
13407
  }
13547
13408
  function verityHome() {
13548
13409
  const override = process.env.VERITY_HOME;
13549
- return override && override.trim() ? (0, import_node_path8.resolve)(override) : (0, import_node_path8.join)((0, import_node_os3.homedir)(), ".verity");
13410
+ return override && override.trim() ? (0, import_node_path6.resolve)(override) : (0, import_node_path6.join)((0, import_node_os2.homedir)(), ".verity");
13550
13411
  }
13551
13412
  function dossierDir(identity) {
13552
- return (0, import_node_path8.join)(verityHome(), "sessions", identity.userKey, identity.treeKey, identity.sessionKey);
13413
+ return (0, import_node_path6.join)(verityHome(), "sessions", identity.userKey, identity.treeKey, identity.sessionKey);
13553
13414
  }
13554
13415
  function treeDir(identity) {
13555
- return (0, import_node_path8.join)(verityHome(), "sessions", identity.userKey, identity.treeKey);
13416
+ return (0, import_node_path6.join)(verityHome(), "sessions", identity.userKey, identity.treeKey);
13556
13417
  }
13557
13418
  function scopeIdentity(token, sessionId) {
13558
13419
  const t = (token ?? "").trim();
@@ -13568,7 +13429,7 @@ function sessionScopeKey(token, sessionId) {
13568
13429
  // src/lib/task-context-buffer.ts
13569
13430
  var import_promises6 = require("node:fs/promises");
13570
13431
  var import_node_fs9 = require("node:fs");
13571
- var import_node_path9 = require("node:path");
13432
+ var import_node_path7 = require("node:path");
13572
13433
  var TASK_CONTEXT_DIR = `${VERITY_DIR}/.task-context`;
13573
13434
  var MAX_BUFFER_BYTES = 500 * 1024;
13574
13435
  var MAX_PROMPT_CHARS = 2e3;
@@ -13646,7 +13507,7 @@ async function cleanupTaskContextBuffers() {
13646
13507
  const cutoffMs = Date.now() - RETENTION_DAYS * 24 * 60 * 60 * 1e3;
13647
13508
  for (const file of files) {
13648
13509
  if (!file.endsWith(".jsonl")) continue;
13649
- const filePath = (0, import_node_path9.join)(TASK_CONTEXT_DIR, file);
13510
+ const filePath = (0, import_node_path7.join)(TASK_CONTEXT_DIR, file);
13650
13511
  try {
13651
13512
  const stats = await (0, import_promises6.stat)(filePath);
13652
13513
  if (stats.mtimeMs < cutoffMs) {
@@ -13660,7 +13521,7 @@ async function cleanupTaskContextBuffers() {
13660
13521
  }
13661
13522
  function bufferPath(taskId) {
13662
13523
  const safe = taskId.replace(/[^a-zA-Z0-9_-]/g, "");
13663
- return (0, import_node_path9.join)(TASK_CONTEXT_DIR, `${safe}.jsonl`);
13524
+ return (0, import_node_path7.join)(TASK_CONTEXT_DIR, `${safe}.jsonl`);
13664
13525
  }
13665
13526
  async function appendEntry(taskId, entry) {
13666
13527
  try {
@@ -13686,7 +13547,7 @@ async function appendEntry(taskId, entry) {
13686
13547
  // src/lib/memory-retrieval.ts
13687
13548
  var import_promises7 = require("node:fs/promises");
13688
13549
  var import_node_fs10 = require("node:fs");
13689
- var import_node_path10 = require("node:path");
13550
+ var import_node_path8 = require("node:path");
13690
13551
  var memoryDir = () => projectPath(`${VERITY_DIR}/memory`);
13691
13552
  var DOMAINS = ["decisions", "quality", "security", "intent", "gotchas", "patterns", "domain", "integrations"];
13692
13553
  var DEFAULT_BUDGET_TOKENS = 2e3;
@@ -13784,14 +13645,14 @@ async function retrieveForInjection(promptText, taskFiles = [], budgetTokens = D
13784
13645
  const promptTokens = tokenize(promptText);
13785
13646
  const nodes = [];
13786
13647
  for (const domain of DOMAINS) {
13787
- const domainDir = (0, import_node_path10.join)(memoryDir(), domain);
13648
+ const domainDir = (0, import_node_path8.join)(memoryDir(), domain);
13788
13649
  if (!(0, import_node_fs10.existsSync)(domainDir)) continue;
13789
13650
  try {
13790
13651
  const files = await (0, import_promises7.readdir)(domainDir);
13791
13652
  for (const file of files) {
13792
13653
  if (!file.endsWith(".md")) continue;
13793
13654
  try {
13794
- const content = await (0, import_promises7.readFile)((0, import_node_path10.join)(domainDir, file), "utf-8");
13655
+ const content = await (0, import_promises7.readFile)((0, import_node_path8.join)(domainDir, file), "utf-8");
13795
13656
  const { fm, body } = parseFrontmatter(content);
13796
13657
  if (fm.status && fm.status !== "active") continue;
13797
13658
  nodes.push({
@@ -13851,26 +13712,26 @@ async function retrieveForInjection(promptText, taskFiles = [], budgetTokens = D
13851
13712
  // src/lib/memory-sync.ts
13852
13713
  var import_promises8 = require("node:fs/promises");
13853
13714
  var import_node_fs12 = require("node:fs");
13854
- var import_node_path12 = require("node:path");
13715
+ var import_node_path10 = require("node:path");
13855
13716
  var import_node_crypto3 = require("node:crypto");
13856
13717
 
13857
13718
  // src/lib/safe-path.ts
13858
13719
  var import_node_fs11 = require("node:fs");
13859
- var import_node_path11 = require("node:path");
13720
+ var import_node_path9 = require("node:path");
13860
13721
  function resolveInside(baseDir, candidate) {
13861
13722
  if (typeof candidate !== "string" || candidate.length === 0) return null;
13862
- if ((0, import_node_path11.isAbsolute)(candidate)) return null;
13863
- const baseAbs = (0, import_node_path11.resolve)(baseDir);
13864
- const full = (0, import_node_path11.resolve)(baseAbs, candidate);
13865
- const baseSep = baseAbs.endsWith(import_node_path11.sep) ? baseAbs : baseAbs + import_node_path11.sep;
13723
+ if ((0, import_node_path9.isAbsolute)(candidate)) return null;
13724
+ const baseAbs = (0, import_node_path9.resolve)(baseDir);
13725
+ const full = (0, import_node_path9.resolve)(baseAbs, candidate);
13726
+ const baseSep = baseAbs.endsWith(import_node_path9.sep) ? baseAbs : baseAbs + import_node_path9.sep;
13866
13727
  if (full !== baseAbs && !full.startsWith(baseSep)) return null;
13867
13728
  try {
13868
13729
  if ((0, import_node_fs11.existsSync)(baseAbs)) {
13869
13730
  const realBase = (0, import_node_fs11.realpathSync)(baseAbs);
13870
- const realBaseSep = realBase.endsWith(import_node_path11.sep) ? realBase : realBase + import_node_path11.sep;
13731
+ const realBaseSep = realBase.endsWith(import_node_path9.sep) ? realBase : realBase + import_node_path9.sep;
13871
13732
  let probe = full;
13872
13733
  while (!(0, import_node_fs11.existsSync)(probe)) {
13873
- const parent = (0, import_node_path11.dirname)(probe);
13734
+ const parent = (0, import_node_path9.dirname)(probe);
13874
13735
  if (parent === probe) break;
13875
13736
  probe = parent;
13876
13737
  }
@@ -13951,16 +13812,16 @@ var syncStateFile = () => projectPath(`${VERITY_DIR}/.memory-sync-state.json`);
13951
13812
  async function ensureMemoryDir() {
13952
13813
  await (0, import_promises8.mkdir)(memoryDir2(), { recursive: true });
13953
13814
  for (const domain of DOMAINS2) {
13954
- await (0, import_promises8.mkdir)((0, import_node_path12.join)(memoryDir2(), domain), { recursive: true });
13815
+ await (0, import_promises8.mkdir)((0, import_node_path10.join)(memoryDir2(), domain), { recursive: true });
13955
13816
  }
13956
- if (!(0, import_node_fs12.existsSync)((0, import_node_path12.join)(memoryDir2(), "SCHEMA.md"))) {
13957
- await (0, import_promises8.writeFile)((0, import_node_path12.join)(memoryDir2(), "SCHEMA.md"), SCHEMA_TEMPLATE);
13817
+ if (!(0, import_node_fs12.existsSync)((0, import_node_path10.join)(memoryDir2(), "SCHEMA.md"))) {
13818
+ await (0, import_promises8.writeFile)((0, import_node_path10.join)(memoryDir2(), "SCHEMA.md"), SCHEMA_TEMPLATE);
13958
13819
  }
13959
- if (!(0, import_node_fs12.existsSync)((0, import_node_path12.join)(memoryDir2(), "index.md"))) {
13960
- await (0, import_promises8.writeFile)((0, import_node_path12.join)(memoryDir2(), "index.md"), "# Project Memory Index\n\nNo nodes yet. Run an analysis to start building the knowledge graph.\n");
13820
+ if (!(0, import_node_fs12.existsSync)((0, import_node_path10.join)(memoryDir2(), "index.md"))) {
13821
+ await (0, import_promises8.writeFile)((0, import_node_path10.join)(memoryDir2(), "index.md"), "# Project Memory Index\n\nNo nodes yet. Run an analysis to start building the knowledge graph.\n");
13961
13822
  }
13962
- if (!(0, import_node_fs12.existsSync)((0, import_node_path12.join)(memoryDir2(), "log.md"))) {
13963
- await (0, import_promises8.writeFile)((0, import_node_path12.join)(memoryDir2(), "log.md"), "# Memory Log\n\n");
13823
+ if (!(0, import_node_fs12.existsSync)((0, import_node_path10.join)(memoryDir2(), "log.md"))) {
13824
+ await (0, import_promises8.writeFile)((0, import_node_path10.join)(memoryDir2(), "log.md"), "# Memory Log\n\n");
13964
13825
  }
13965
13826
  }
13966
13827
  async function buildManifest() {
@@ -13969,14 +13830,14 @@ async function buildManifest() {
13969
13830
  }
13970
13831
  const nodes = [];
13971
13832
  for (const domain of DOMAINS2) {
13972
- const domainDir = (0, import_node_path12.join)(memoryDir2(), domain);
13833
+ const domainDir = (0, import_node_path10.join)(memoryDir2(), domain);
13973
13834
  if (!(0, import_node_fs12.existsSync)(domainDir)) continue;
13974
13835
  try {
13975
13836
  const files = await (0, import_promises8.readdir)(domainDir);
13976
13837
  for (const file of files) {
13977
13838
  if (!file.endsWith(".md")) continue;
13978
13839
  const filePath = `${domain}/${file}`;
13979
- const fullPath = (0, import_node_path12.join)(memoryDir2(), filePath);
13840
+ const fullPath = (0, import_node_path10.join)(memoryDir2(), filePath);
13980
13841
  try {
13981
13842
  const content = await (0, import_promises8.readFile)(fullPath, "utf-8");
13982
13843
  const hash = (0, import_node_crypto3.createHash)("sha256").update(content).digest("hex").slice(0, 16);
@@ -13989,13 +13850,13 @@ async function buildManifest() {
13989
13850
  }
13990
13851
  let indexHash = null;
13991
13852
  try {
13992
- const indexContent = await (0, import_promises8.readFile)((0, import_node_path12.join)(memoryDir2(), "index.md"), "utf-8");
13853
+ const indexContent = await (0, import_promises8.readFile)((0, import_node_path10.join)(memoryDir2(), "index.md"), "utf-8");
13993
13854
  indexHash = `sha256:${(0, import_node_crypto3.createHash)("sha256").update(indexContent).digest("hex").slice(0, 16)}`;
13994
13855
  } catch {
13995
13856
  }
13996
13857
  let logLength = 0;
13997
13858
  try {
13998
- const logContent = await (0, import_promises8.readFile)((0, import_node_path12.join)(memoryDir2(), "log.md"), "utf-8");
13859
+ const logContent = await (0, import_promises8.readFile)((0, import_node_path10.join)(memoryDir2(), "log.md"), "utf-8");
13999
13860
  logLength = logContent.split("\n").length;
14000
13861
  } catch {
14001
13862
  }
@@ -14008,13 +13869,13 @@ async function readOnDiskNodes() {
14008
13869
  const out = /* @__PURE__ */ new Map();
14009
13870
  if (!(0, import_node_fs12.existsSync)(memoryDir2())) return out;
14010
13871
  for (const domain of DOMAINS2) {
14011
- const domainDir = (0, import_node_path12.join)(memoryDir2(), domain);
13872
+ const domainDir = (0, import_node_path10.join)(memoryDir2(), domain);
14012
13873
  if (!(0, import_node_fs12.existsSync)(domainDir)) continue;
14013
13874
  try {
14014
13875
  for (const file of await (0, import_promises8.readdir)(domainDir)) {
14015
13876
  if (!file.endsWith(".md")) continue;
14016
13877
  try {
14017
- out.set(`${domain}/${file}`, hashContent(await (0, import_promises8.readFile)((0, import_node_path12.join)(domainDir, file), "utf-8")));
13878
+ out.set(`${domain}/${file}`, hashContent(await (0, import_promises8.readFile)((0, import_node_path10.join)(domainDir, file), "utf-8")));
14018
13879
  } catch {
14019
13880
  }
14020
13881
  }
@@ -14060,7 +13921,7 @@ async function computeEditedNodeUploads() {
14060
13921
  const uploads = [];
14061
13922
  for (const [path, prevHash] of prev) {
14062
13923
  if (prevHash == null) continue;
14063
- const full = (0, import_node_path12.join)(memoryDir2(), path);
13924
+ const full = (0, import_node_path10.join)(memoryDir2(), path);
14064
13925
  if (!(0, import_node_fs12.existsSync)(full)) continue;
14065
13926
  let content;
14066
13927
  try {
@@ -14097,8 +13958,8 @@ async function applyMemoryWrites(writes, opts = {}) {
14097
13958
  const logLines = [`- ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 16)} \u2014 Applied ${count} write(s) from server`];
14098
13959
  for (const n of notes) logLines.push(` - ${n}`);
14099
13960
  try {
14100
- const existing = (0, import_node_fs12.existsSync)((0, import_node_path12.join)(memoryDir2(), "log.md")) ? await (0, import_promises8.readFile)((0, import_node_path12.join)(memoryDir2(), "log.md"), "utf-8") : "# Memory Log\n\n";
14101
- await (0, import_promises8.writeFile)((0, import_node_path12.join)(memoryDir2(), "log.md"), existing + logLines.join("\n") + "\n");
13961
+ const existing = (0, import_node_fs12.existsSync)((0, import_node_path10.join)(memoryDir2(), "log.md")) ? await (0, import_promises8.readFile)((0, import_node_path10.join)(memoryDir2(), "log.md"), "utf-8") : "# Memory Log\n\n";
13962
+ await (0, import_promises8.writeFile)((0, import_node_path10.join)(memoryDir2(), "log.md"), existing + logLines.join("\n") + "\n");
14102
13963
  } catch {
14103
13964
  }
14104
13965
  await recordSyncedNodePaths();
@@ -14130,7 +13991,7 @@ async function applyOneWrite(write, treePaths) {
14130
13991
  return { written: false, notes };
14131
13992
  }
14132
13993
  }
14133
- await (0, import_promises8.mkdir)((0, import_node_path12.dirname)(fullPath), { recursive: true });
13994
+ await (0, import_promises8.mkdir)((0, import_node_path10.dirname)(fullPath), { recursive: true });
14134
13995
  await (0, import_promises8.writeFile)(fullPath, content);
14135
13996
  return { written: true, notes };
14136
13997
  }
@@ -14171,7 +14032,7 @@ async function regenerateIndex() {
14171
14032
  ];
14172
14033
  let totalNodes = 0;
14173
14034
  for (const domain of DOMAINS2.filter((d) => d !== "_archive")) {
14174
- const domainDir = (0, import_node_path12.join)(memoryDir2(), domain);
14035
+ const domainDir = (0, import_node_path10.join)(memoryDir2(), domain);
14175
14036
  if (!(0, import_node_fs12.existsSync)(domainDir)) continue;
14176
14037
  try {
14177
14038
  const files = await (0, import_promises8.readdir)(domainDir);
@@ -14182,7 +14043,7 @@ async function regenerateIndex() {
14182
14043
  for (const file of mdFiles.sort()) {
14183
14044
  const slug = file.replace(/\.md$/, "");
14184
14045
  try {
14185
- const content = await (0, import_promises8.readFile)((0, import_node_path12.join)(domainDir, file), "utf-8");
14046
+ const content = await (0, import_promises8.readFile)((0, import_node_path10.join)(domainDir, file), "utf-8");
14186
14047
  const title = pickFrontmatter(content, "title") ?? slug;
14187
14048
  const kind = pickFrontmatter(content, "kind") ?? "-";
14188
14049
  const confidence = pickFrontmatter(content, "confidence");
@@ -14206,7 +14067,7 @@ async function regenerateIndex() {
14206
14067
  lines.push("No nodes yet. Run an analysis to start building the knowledge graph.");
14207
14068
  }
14208
14069
  const next = lines.join("\n") + "\n";
14209
- const indexPath = (0, import_node_path12.join)(memoryDir2(), "index.md");
14070
+ const indexPath = (0, import_node_path10.join)(memoryDir2(), "index.md");
14210
14071
  let existing = null;
14211
14072
  try {
14212
14073
  existing = await (0, import_promises8.readFile)(indexPath, "utf-8");
@@ -14440,7 +14301,7 @@ function hasLegacyMemoryBlock(text) {
14440
14301
  return findMarker(text, LEGACY_MD_START) !== -1;
14441
14302
  }
14442
14303
  async function ensureClaudeMdPointer(cwd = repoRoot()) {
14443
- const claudeMdPath = (0, import_node_path12.join)(cwd, "CLAUDE.md");
14304
+ const claudeMdPath = (0, import_node_path10.join)(cwd, "CLAUDE.md");
14444
14305
  let existing = "";
14445
14306
  if ((0, import_node_fs12.existsSync)(claudeMdPath)) {
14446
14307
  existing = await (0, import_promises8.readFile)(claudeMdPath, "utf-8");
@@ -14580,7 +14441,7 @@ Body content (\u22648KB). Use [[node-id]] wikilinks for cross-references.
14580
14441
  // src/lib/dossier-session.ts
14581
14442
  var import_node_fs17 = require("node:fs");
14582
14443
  var import_node_crypto7 = require("node:crypto");
14583
- var import_node_path15 = require("node:path");
14444
+ var import_node_path13 = require("node:path");
14584
14445
 
14585
14446
  // src/lib/pending-repeat.ts
14586
14447
  var STOP = /* @__PURE__ */ new Set([
@@ -14686,7 +14547,7 @@ function statementAnchorKey(file, patternId) {
14686
14547
  // src/lib/dossier/log.ts
14687
14548
  var import_node_crypto4 = require("node:crypto");
14688
14549
  var import_node_fs13 = require("node:fs");
14689
- var import_node_path13 = require("node:path");
14550
+ var import_node_path11 = require("node:path");
14690
14551
  var CRC_TABLE = (() => {
14691
14552
  const t = new Int32Array(256);
14692
14553
  for (let i = 0; i < 256; i++) {
@@ -14709,9 +14570,9 @@ function openDossier(identity) {
14709
14570
  return {
14710
14571
  dir,
14711
14572
  identity,
14712
- eventsPath: (0, import_node_path13.join)(dir, "events.jsonl"),
14713
- foldPath: (0, import_node_path13.join)(dir, "fold.json"),
14714
- rotatedDir: (0, import_node_path13.join)(dir, "rotated")
14573
+ eventsPath: (0, import_node_path11.join)(dir, "events.jsonl"),
14574
+ foldPath: (0, import_node_path11.join)(dir, "fold.json"),
14575
+ rotatedDir: (0, import_node_path11.join)(dir, "rotated")
14715
14576
  };
14716
14577
  } catch {
14717
14578
  return null;
@@ -14784,11 +14645,11 @@ function rotateIfNeeded2(d) {
14784
14645
  if (!(0, import_node_fs13.existsSync)(d.eventsPath)) return;
14785
14646
  if ((0, import_node_fs13.statSync)(d.eventsPath).size < ROTATE_BYTES) return;
14786
14647
  (0, import_node_fs13.mkdirSync)(d.rotatedDir, { recursive: true, mode: 448 });
14787
- (0, import_node_fs13.renameSync)(d.eventsPath, (0, import_node_path13.join)(d.rotatedDir, `events.${Date.now()}.jsonl`));
14648
+ (0, import_node_fs13.renameSync)(d.eventsPath, (0, import_node_path11.join)(d.rotatedDir, `events.${Date.now()}.jsonl`));
14788
14649
  const kept = (0, import_node_fs13.readdirSync)(d.rotatedDir).filter((f) => f.endsWith(".jsonl")).sort();
14789
14650
  for (const stale of kept.slice(0, Math.max(0, kept.length - ROTATE_KEEP))) {
14790
14651
  try {
14791
- (0, import_node_fs13.renameSync)((0, import_node_path13.join)(d.rotatedDir, stale), (0, import_node_path13.join)(d.rotatedDir, `${stale}.pruned`));
14652
+ (0, import_node_fs13.renameSync)((0, import_node_path11.join)(d.rotatedDir, stale), (0, import_node_path11.join)(d.rotatedDir, `${stale}.pruned`));
14792
14653
  } catch {
14793
14654
  }
14794
14655
  }
@@ -14799,7 +14660,7 @@ function rotateIfNeeded2(d) {
14799
14660
  // src/lib/dossier/fold-dossier.ts
14800
14661
  var import_node_crypto5 = require("node:crypto");
14801
14662
  var import_node_fs14 = require("node:fs");
14802
- var import_node_path14 = require("node:path");
14663
+ var import_node_path12 = require("node:path");
14803
14664
  var EMPTY_CAPABILITIES = () => ({
14804
14665
  human_reachable: { value: "unknown", tier: "unknown" },
14805
14666
  authorship_observability: { value: "unknown", tier: "unknown" },
@@ -14855,7 +14716,7 @@ function foldDossier(d, opts = {}) {
14855
14716
  state.meta.rotations = files.length;
14856
14717
  for (const f of files) {
14857
14718
  try {
14858
- ingest((0, import_node_fs14.readFileSync)((0, import_node_path14.join)(d.rotatedDir, f), "utf8"));
14719
+ ingest((0, import_node_fs14.readFileSync)((0, import_node_path12.join)(d.rotatedDir, f), "utf8"));
14859
14720
  } catch {
14860
14721
  state.meta.dropped_lines++;
14861
14722
  }
@@ -15712,16 +15573,16 @@ function foreignAuthoredPaths(identity, opts = {}) {
15712
15573
  for (const entry of (0, import_node_fs17.readdirSync)(dir, { withFileTypes: true })) {
15713
15574
  if (!entry.isDirectory()) continue;
15714
15575
  if (entry.name === identity.sessionKey) continue;
15715
- const log = (0, import_node_path15.join)(dir, entry.name, "events.jsonl");
15576
+ const log = (0, import_node_path13.join)(dir, entry.name, "events.jsonl");
15716
15577
  try {
15717
15578
  if (!(0, import_node_fs17.existsSync)(log)) continue;
15718
15579
  if (now - (0, import_node_fs17.statSync)(log).mtimeMs > windowMs) continue;
15719
15580
  const sib = {
15720
- dir: (0, import_node_path15.join)(dir, entry.name),
15581
+ dir: (0, import_node_path13.join)(dir, entry.name),
15721
15582
  identity,
15722
15583
  eventsPath: log,
15723
- foldPath: (0, import_node_path15.join)(dir, entry.name, "fold.json"),
15724
- rotatedDir: (0, import_node_path15.join)(dir, entry.name, "rotated")
15584
+ foldPath: (0, import_node_path13.join)(dir, entry.name, "fold.json"),
15585
+ rotatedDir: (0, import_node_path13.join)(dir, entry.name, "rotated")
15725
15586
  };
15726
15587
  const state = readFoldCache(sib) ?? foldDossier(sib);
15727
15588
  sessions++;
@@ -15749,22 +15610,22 @@ function pruneOldDossiers(identity, maxAgeMs = 7 * 24 * 60 * 60 * 1e3) {
15749
15610
  let removed = 0;
15750
15611
  try {
15751
15612
  const mine = dossierDir(identity);
15752
- const userDir = (0, import_node_path15.dirname)((0, import_node_path15.dirname)(mine));
15613
+ const userDir = (0, import_node_path13.dirname)((0, import_node_path13.dirname)(mine));
15753
15614
  if (!(0, import_node_fs17.existsSync)(userDir)) return 0;
15754
15615
  const cutoff = Date.now() - maxAgeMs;
15755
15616
  for (const tree of (0, import_node_fs17.readdirSync)(userDir, { withFileTypes: true })) {
15756
15617
  if (!tree.isDirectory()) continue;
15757
- const treePath = (0, import_node_path15.join)(userDir, tree.name);
15618
+ const treePath = (0, import_node_path13.join)(userDir, tree.name);
15758
15619
  let live = 0;
15759
15620
  for (const entry of (0, import_node_fs17.readdirSync)(treePath, { withFileTypes: true })) {
15760
15621
  if (!entry.isDirectory()) continue;
15761
- const dir = (0, import_node_path15.join)(treePath, entry.name);
15622
+ const dir = (0, import_node_path13.join)(treePath, entry.name);
15762
15623
  if (dir === mine) {
15763
15624
  live++;
15764
15625
  continue;
15765
15626
  }
15766
15627
  try {
15767
- const log = (0, import_node_path15.join)(dir, "events.jsonl");
15628
+ const log = (0, import_node_path13.join)(dir, "events.jsonl");
15768
15629
  const at = (0, import_node_fs17.existsSync)(log) ? (0, import_node_fs17.statSync)(log).mtimeMs : (0, import_node_fs17.statSync)(dir).mtimeMs;
15769
15630
  if (at < cutoff) {
15770
15631
  (0, import_node_fs17.rmSync)(dir, { recursive: true, force: true });
@@ -15819,7 +15680,7 @@ function recordTurn(d, t) {
15819
15680
  for (const a of t.authored) {
15820
15681
  const origin = a.owner === "subagent" ? "subagent" : "edit_tool";
15821
15682
  const prior = t.known?.authored?.get(a.p);
15822
- const hash = fileHash((0, import_node_path15.join)(root, a.p));
15683
+ const hash = fileHash((0, import_node_path13.join)(root, a.p));
15823
15684
  const hunks = Math.max(0, a.h - (prior?.hunks ?? 0));
15824
15685
  const adds = Math.max(0, a.a - (prior?.adds ?? 0));
15825
15686
  const dels = Math.max(0, a.d - (prior?.dels ?? 0));
@@ -15852,7 +15713,7 @@ function recordTurn(d, t) {
15852
15713
  }
15853
15714
  const seenDivergence = t.known?.divergence ?? /* @__PURE__ */ new Set();
15854
15715
  for (const u of t.unobserved) {
15855
- const hash = fileHash((0, import_node_path15.join)(root, u.p));
15716
+ const hash = fileHash((0, import_node_path13.join)(root, u.p));
15856
15717
  if (seenDivergence.has(divergenceKey(u.p, hash))) continue;
15857
15718
  appendEvent(d, { k: "divergence", kind: "external_mutation", path: u.p, hash });
15858
15719
  }
@@ -15887,7 +15748,7 @@ function recordVerdict(d, v) {
15887
15748
  if (!sent.has(f.file)) continue;
15888
15749
  if (!lines.has(f.file)) {
15889
15750
  try {
15890
- const abs = (0, import_node_path15.join)(root, f.file);
15751
+ const abs = (0, import_node_path13.join)(root, f.file);
15891
15752
  lines.set(f.file, (0, import_node_fs17.existsSync)(abs) ? (0, import_node_fs17.readFileSync)(abs, "utf8").split("\n") : null);
15892
15753
  } catch {
15893
15754
  lines.set(f.file, null);
@@ -15988,7 +15849,7 @@ function recallMemory(d, identity, opts) {
15988
15849
  budgetBytes: opts.budgetBytes,
15989
15850
  readFileLines: (file) => {
15990
15851
  try {
15991
- const abs = (0, import_node_path15.join)(root, file);
15852
+ const abs = (0, import_node_path13.join)(root, file);
15992
15853
  return (0, import_node_fs17.existsSync)(abs) ? (0, import_node_fs17.readFileSync)(abs, "utf8").split("\n") : null;
15993
15854
  } catch {
15994
15855
  return null;
@@ -16134,21 +15995,21 @@ async function fireClassify(prompt, sessionId, globals) {
16134
15995
 
16135
15996
  // src/commands/lifecycle.ts
16136
15997
  var import_node_fs21 = require("node:fs");
16137
- var import_node_path19 = require("node:path");
15998
+ var import_node_path17 = require("node:path");
16138
15999
 
16139
16000
  // src/lib/baseline.ts
16140
16001
  var import_node_fs20 = require("node:fs");
16141
- var import_node_path18 = require("node:path");
16002
+ var import_node_path16 = require("node:path");
16142
16003
  var import_node_crypto9 = require("node:crypto");
16143
16004
 
16144
16005
  // src/lib/snapshot.ts
16145
16006
  var import_node_fs19 = require("node:fs");
16146
- var import_node_path17 = require("node:path");
16007
+ var import_node_path15 = require("node:path");
16147
16008
  var import_node_child_process6 = require("node:child_process");
16148
16009
 
16149
16010
  // src/lib/files.ts
16150
16011
  var import_node_fs18 = require("node:fs");
16151
- var import_node_path16 = require("node:path");
16012
+ var import_node_path14 = require("node:path");
16152
16013
  var LANG_MAP = {
16153
16014
  // Analyzable (static analysis + Gemini)
16154
16015
  ts: "typescript",
@@ -16216,7 +16077,7 @@ var LANG_MAP = {
16216
16077
  mk: "make"
16217
16078
  };
16218
16079
  function detectLanguage(filepath) {
16219
- const ext = (0, import_node_path16.extname)(filepath).slice(1);
16080
+ const ext = (0, import_node_path14.extname)(filepath).slice(1);
16220
16081
  return LANG_MAP[ext] ?? ext;
16221
16082
  }
16222
16083
  function sortByMtime(files) {
@@ -16319,7 +16180,7 @@ function generateSnapshotDiffs(files) {
16319
16180
  const diffs = [];
16320
16181
  for (const file of files) {
16321
16182
  if (!resolveInside(SNAPSHOT_DIR, file.path)) continue;
16322
- const snapshotPath = (0, import_node_path17.join)(SNAPSHOT_DIR, file.path);
16183
+ const snapshotPath = (0, import_node_path15.join)(SNAPSHOT_DIR, file.path);
16323
16184
  const language = file.language ?? detectLanguage(file.path);
16324
16185
  if ((0, import_node_fs19.existsSync)(snapshotPath)) {
16325
16186
  const oldContent = (0, import_node_fs19.readFileSync)(snapshotPath, "utf-8");
@@ -16347,16 +16208,16 @@ function saveSnapshots(files) {
16347
16208
  const snapshotPaths = /* @__PURE__ */ new Set();
16348
16209
  for (const file of files) {
16349
16210
  if (!resolveInside(SNAPSHOT_DIR, file.path)) continue;
16350
- const snapshotPath = (0, import_node_path17.join)(SNAPSHOT_DIR, file.path);
16211
+ const snapshotPath = (0, import_node_path15.join)(SNAPSHOT_DIR, file.path);
16351
16212
  snapshotPaths.add(snapshotPath);
16352
- (0, import_node_fs19.mkdirSync)((0, import_node_path17.dirname)(snapshotPath), { recursive: true });
16213
+ (0, import_node_fs19.mkdirSync)((0, import_node_path15.dirname)(snapshotPath), { recursive: true });
16353
16214
  (0, import_node_fs19.writeFileSync)(snapshotPath, file.content);
16354
16215
  }
16355
16216
  cleanStaleSnapshots(SNAPSHOT_DIR, snapshotPaths);
16356
16217
  }
16357
16218
  function computeDiff(oldContent, newContent, filePath) {
16358
- const tmpOld = (0, import_node_path17.join)(SNAPSHOT_DIR, ".diff-old.tmp");
16359
- const tmpNew = (0, import_node_path17.join)(SNAPSHOT_DIR, ".diff-new.tmp");
16219
+ const tmpOld = (0, import_node_path15.join)(SNAPSHOT_DIR, ".diff-old.tmp");
16220
+ const tmpNew = (0, import_node_path15.join)(SNAPSHOT_DIR, ".diff-new.tmp");
16360
16221
  try {
16361
16222
  (0, import_node_fs19.mkdirSync)(SNAPSHOT_DIR, { recursive: true });
16362
16223
  (0, import_node_fs19.writeFileSync)(tmpOld, oldContent);
@@ -16389,7 +16250,7 @@ function cleanStaleSnapshots(dir, keepSet) {
16389
16250
  const entries = (0, import_node_fs19.readdirSync)(dir, { withFileTypes: true });
16390
16251
  for (const entry of entries) {
16391
16252
  if (dir === SNAPSHOT_DIR && (entry.name === ".diff-old.tmp" || entry.name === ".diff-new.tmp")) continue;
16392
- const fullPath = (0, import_node_path17.join)(dir, entry.name);
16253
+ const fullPath = (0, import_node_path15.join)(dir, entry.name);
16393
16254
  if (entry.isDirectory()) {
16394
16255
  cleanStaleSnapshots(fullPath, keepSet);
16395
16256
  try {
@@ -16418,13 +16279,13 @@ function sessionKey(sessionId) {
16418
16279
  return (0, import_node_crypto9.createHash)("sha256").update(sessionId).digest("hex").slice(0, 16);
16419
16280
  }
16420
16281
  function sessionDir(key) {
16421
- return (0, import_node_path18.join)(projectPath(BASELINE_DIR), key);
16282
+ return (0, import_node_path16.join)(projectPath(BASELINE_DIR), key);
16422
16283
  }
16423
16284
  function manifestPath(dir) {
16424
- return (0, import_node_path18.join)(dir, "manifest.json");
16285
+ return (0, import_node_path16.join)(dir, "manifest.json");
16425
16286
  }
16426
16287
  function mirrorPath(dir, repoRelPath) {
16427
- return (0, import_node_path18.join)(dir, "files", repoRelPath);
16288
+ return (0, import_node_path16.join)(dir, "files", repoRelPath);
16428
16289
  }
16429
16290
  var CARRY_FILE = `${BASELINE_DIR}/.carry`;
16430
16291
  var CARRY_WINDOW_MS = 12e4;
@@ -16486,7 +16347,7 @@ function captureBaseline(opts = {}) {
16486
16347
  (0, import_node_fs20.rmSync)(dir, { recursive: true, force: true });
16487
16348
  } catch {
16488
16349
  }
16489
- const filesDir = (0, import_node_path18.join)(dir, "files");
16350
+ const filesDir = (0, import_node_path16.join)(dir, "files");
16490
16351
  const mirrored = [];
16491
16352
  try {
16492
16353
  (0, import_node_fs20.mkdirSync)(filesDir, { recursive: true });
@@ -16496,7 +16357,7 @@ function captureBaseline(opts = {}) {
16496
16357
  if (content === null) continue;
16497
16358
  const dest = mirrorPath(dir, p);
16498
16359
  try {
16499
- (0, import_node_fs20.mkdirSync)((0, import_node_path18.dirname)(dest), { recursive: true });
16360
+ (0, import_node_fs20.mkdirSync)((0, import_node_path16.dirname)(dest), { recursive: true });
16500
16361
  (0, import_node_fs20.writeFileSync)(dest, content);
16501
16362
  mirrored.push(p);
16502
16363
  } catch {
@@ -16604,7 +16465,7 @@ function absorbIntoBaseline(paths, sessionId) {
16604
16465
  const content = safeReadForMirror(projectPath(p));
16605
16466
  if (content === null) continue;
16606
16467
  const dest = mirrorPath(dir, p);
16607
- (0, import_node_fs20.mkdirSync)((0, import_node_path18.dirname)(dest), { recursive: true });
16468
+ (0, import_node_fs20.mkdirSync)((0, import_node_path16.dirname)(dest), { recursive: true });
16608
16469
  (0, import_node_fs20.writeFileSync)(dest, content);
16609
16470
  dirty.add(p);
16610
16471
  adopted++;
@@ -16652,7 +16513,7 @@ function pruneOldBaselines() {
16652
16513
  }
16653
16514
  const now = Date.now();
16654
16515
  for (const name of entries) {
16655
- const dir = (0, import_node_path18.join)(root, name);
16516
+ const dir = (0, import_node_path16.join)(root, name);
16656
16517
  const manifest = readManifest(dir);
16657
16518
  if (!manifest) {
16658
16519
  try {
@@ -16840,7 +16701,7 @@ function buildCompactionContext(session) {
16840
16701
  commitsSince: commitsSincePaths(watermark, (state.authored ?? []).map((a) => a.path)),
16841
16702
  readFileLines: (file) => {
16842
16703
  try {
16843
- const abs = (0, import_node_path19.join)(root, file);
16704
+ const abs = (0, import_node_path17.join)(root, file);
16844
16705
  return (0, import_node_fs21.existsSync)(abs) ? (0, import_node_fs21.readFileSync)(abs, "utf8").split("\n") : null;
16845
16706
  } catch {
16846
16707
  return null;
@@ -16877,17 +16738,17 @@ async function readHookStdin() {
16877
16738
  try {
16878
16739
  if (process.stdin.isTTY) return {};
16879
16740
  const chunks = [];
16880
- const timeout = new Promise((resolve5) => setTimeout(() => resolve5({}), 500));
16881
- const read = new Promise((resolve5) => {
16741
+ const timeout = new Promise((resolve4) => setTimeout(() => resolve4({}), 500));
16742
+ const read = new Promise((resolve4) => {
16882
16743
  process.stdin.on("data", (c) => chunks.push(c));
16883
16744
  process.stdin.on("end", () => {
16884
16745
  try {
16885
- resolve5(JSON.parse(Buffer.concat(chunks).toString("utf-8").trim() || "{}"));
16746
+ resolve4(JSON.parse(Buffer.concat(chunks).toString("utf-8").trim() || "{}"));
16886
16747
  } catch {
16887
- resolve5({});
16748
+ resolve4({});
16888
16749
  }
16889
16750
  });
16890
- process.stdin.on("error", () => resolve5({}));
16751
+ process.stdin.on("error", () => resolve4({}));
16891
16752
  process.stdin.resume();
16892
16753
  });
16893
16754
  return await Promise.race([read, timeout]);
@@ -16905,17 +16766,17 @@ var import_yaml3 = __toESM(require_dist());
16905
16766
  var import_node_child_process8 = require("node:child_process");
16906
16767
  var import_node_fs24 = require("node:fs");
16907
16768
  var import_promises9 = require("node:fs/promises");
16908
- var import_node_path22 = require("node:path");
16769
+ var import_node_path20 = require("node:path");
16909
16770
  var import_yaml = __toESM(require_dist());
16910
16771
 
16911
16772
  // src/lib/data-dir.ts
16912
16773
  var import_node_fs22 = require("node:fs");
16913
- var import_node_path20 = require("node:path");
16774
+ var import_node_path18 = require("node:path");
16914
16775
  function resolveDataDir() {
16915
- const candidates2 = [
16916
- (0, import_node_path20.join)(__dirname, "..", "data"),
16776
+ const candidates = [
16777
+ (0, import_node_path18.join)(__dirname, "..", "data"),
16917
16778
  // installed: node_modules/@codacy/verity-cli/data
16918
- (0, import_node_path20.join)(__dirname, "..", "..", "data"),
16779
+ (0, import_node_path18.join)(__dirname, "..", "..", "data"),
16919
16780
  // edge case: nested resolution
16920
16781
  // THE COMMITTED SOURCE, for a source checkout that has not been built.
16921
16782
  // cli/data/skills/ is a BUILD ARTIFACT (scripts/build.js copies client/skills
@@ -16924,14 +16785,14 @@ function resolveDataDir() {
16924
16785
  // without this the synthesizer throws "Could not find Verity skill data"
16925
16786
  // for every test and every `verity` run from source. Resolved from this
16926
16787
  // module's own location, never the cwd: see the warning below.
16927
- (0, import_node_path20.join)(__dirname, "..", "..", "client"),
16788
+ (0, import_node_path18.join)(__dirname, "..", "..", "client"),
16928
16789
  // bundled: cli/bin/ → ../../client
16929
- (0, import_node_path20.join)(__dirname, "..", "..", "..", "client"),
16790
+ (0, import_node_path18.join)(__dirname, "..", "..", "..", "client"),
16930
16791
  // tsx: cli/src/lib/ → ../../../client
16931
16792
  ...process.env.VERITY_DEV_DATA_DIR ? [process.env.VERITY_DEV_DATA_DIR] : []
16932
16793
  ];
16933
- for (const candidate of candidates2) {
16934
- if ((0, import_node_fs22.existsSync)((0, import_node_path20.join)(candidate, "skills"))) {
16794
+ for (const candidate of candidates) {
16795
+ if ((0, import_node_fs22.existsSync)((0, import_node_path18.join)(candidate, "skills"))) {
16935
16796
  return candidate;
16936
16797
  }
16937
16798
  }
@@ -16940,13 +16801,13 @@ function resolveDataDir() {
16940
16801
  );
16941
16802
  }
16942
16803
  function setupDataPath(file) {
16943
- return (0, import_node_path20.join)(resolveDataDir(), "skills", "verity-setup", file);
16804
+ return (0, import_node_path18.join)(resolveDataDir(), "skills", "verity-setup", file);
16944
16805
  }
16945
16806
 
16946
16807
  // src/lib/detect.ts
16947
16808
  var import_node_child_process7 = require("node:child_process");
16948
16809
  var import_node_fs23 = require("node:fs");
16949
- var import_node_path21 = require("node:path");
16810
+ var import_node_path19 = require("node:path");
16950
16811
  var TOOLED_LANGUAGES = /* @__PURE__ */ new Set([
16951
16812
  "typescript",
16952
16813
  "javascript",
@@ -17009,18 +16870,18 @@ function walk(root) {
17009
16870
  for (const entry of entries) {
17010
16871
  if (found.length >= WALK_MAX_FILES) return;
17011
16872
  if (IGNORED_SEGMENTS.includes(entry.name)) continue;
17012
- const full = (0, import_node_path21.join)(dir, entry.name);
16873
+ const full = (0, import_node_path19.join)(dir, entry.name);
17013
16874
  if (entry.isDirectory()) visit(full, depth + 1);
17014
- else if (entry.isFile()) found.push((0, import_node_path21.relative)(root, full));
16875
+ else if (entry.isFile()) found.push((0, import_node_path19.relative)(root, full));
17015
16876
  }
17016
16877
  };
17017
16878
  visit(root, 0);
17018
16879
  return found;
17019
16880
  }
17020
16881
  function languageOf(path) {
17021
- const name = (0, import_node_path21.basename)(path);
16882
+ const name = (0, import_node_path19.basename)(path);
17022
16883
  if (/^Dockerfile(\..+)?$/i.test(name)) return "dockerfile";
17023
- if (!(0, import_node_path21.extname)(name)) return null;
16884
+ if (!(0, import_node_path19.extname)(name)) return null;
17024
16885
  const lang = detectLanguage(path);
17025
16886
  return lang || null;
17026
16887
  }
@@ -17102,12 +16963,12 @@ function declaredDependencies(root, files) {
17102
16963
  if (deps && typeof deps === "object") names2.push(...Object.keys(deps));
17103
16964
  }
17104
16965
  };
17105
- readPackageJson((0, import_node_path21.join)(root, "package.json"));
17106
- const nested = files.filter((f) => f.includes("/") && (0, import_node_path21.basename)(f) === "package.json").slice(0, NESTED_MANIFEST_LIMIT);
17107
- for (const rel of nested) readPackageJson((0, import_node_path21.join)(root, rel));
16966
+ readPackageJson((0, import_node_path19.join)(root, "package.json"));
16967
+ const nested = files.filter((f) => f.includes("/") && (0, import_node_path19.basename)(f) === "package.json").slice(0, NESTED_MANIFEST_LIMIT);
16968
+ for (const rel of nested) readPackageJson((0, import_node_path19.join)(root, rel));
17108
16969
  const pythonManifests = [
17109
- ...["pyproject.toml", "requirements.txt", "Pipfile", "setup.py"].map((f) => (0, import_node_path21.join)(root, f)),
17110
- ...files.filter((f) => f.includes("/") && /(^|\/)(pyproject\.toml|requirements\.txt)$/.test(f)).slice(0, NESTED_MANIFEST_LIMIT).map((f) => (0, import_node_path21.join)(root, f))
16970
+ ...["pyproject.toml", "requirements.txt", "Pipfile", "setup.py"].map((f) => (0, import_node_path19.join)(root, f)),
16971
+ ...files.filter((f) => f.includes("/") && /(^|\/)(pyproject\.toml|requirements\.txt)$/.test(f)).slice(0, NESTED_MANIFEST_LIMIT).map((f) => (0, import_node_path19.join)(root, f))
17111
16972
  ];
17112
16973
  for (const path of pythonManifests) {
17113
16974
  if (!(0, import_node_fs23.existsSync)(path)) continue;
@@ -17122,8 +16983,8 @@ function declaredDependencies(root, files) {
17122
16983
  }
17123
16984
  }
17124
16985
  const goMods = [
17125
- (0, import_node_path21.join)(root, "go.mod"),
17126
- ...files.filter((f) => f.includes("/") && (0, import_node_path21.basename)(f) === "go.mod").slice(0, NESTED_MANIFEST_LIMIT).map((f) => (0, import_node_path21.join)(root, f))
16986
+ (0, import_node_path19.join)(root, "go.mod"),
16987
+ ...files.filter((f) => f.includes("/") && (0, import_node_path19.basename)(f) === "go.mod").slice(0, NESTED_MANIFEST_LIMIT).map((f) => (0, import_node_path19.join)(root, f))
17127
16988
  ];
17128
16989
  for (const path of goMods) {
17129
16990
  if (!(0, import_node_fs23.existsSync)(path)) continue;
@@ -17136,7 +16997,7 @@ function declaredDependencies(root, files) {
17136
16997
  }
17137
16998
  }
17138
16999
  for (const file of ["pom.xml", "build.gradle", "build.gradle.kts", "Gemfile", "Cargo.toml"]) {
17139
- const path = (0, import_node_path21.join)(root, file);
17000
+ const path = (0, import_node_path19.join)(root, file);
17140
17001
  if (!(0, import_node_fs23.existsSync)(path)) continue;
17141
17002
  try {
17142
17003
  const text = (0, import_node_fs23.readFileSync)(path, "utf-8");
@@ -17147,7 +17008,7 @@ function declaredDependencies(root, files) {
17147
17008
  return names2;
17148
17009
  }
17149
17010
  function detectBuildSystem(root, files) {
17150
- const has = (f) => (0, import_node_fs23.existsSync)((0, import_node_path21.join)(root, f)) || files.some((p) => (0, import_node_path21.basename)(p) === f);
17011
+ const has = (f) => (0, import_node_fs23.existsSync)((0, import_node_path19.join)(root, f)) || files.some((p) => (0, import_node_path19.basename)(p) === f);
17151
17012
  if (has("pnpm-lock.yaml")) return "pnpm";
17152
17013
  if (has("yarn.lock")) return "yarn";
17153
17014
  if (has("bun.lock") || has("bun.lockb")) return "bun";
@@ -17164,8 +17025,8 @@ function detectBuildSystem(root, files) {
17164
17025
  }
17165
17026
  function detectArchitecture(root, files) {
17166
17027
  const workspaceMarkers = ["lerna.json", "pnpm-workspace.yaml", "nx.json", "turbo.json", "rush.json"];
17167
- if (workspaceMarkers.some((m) => (0, import_node_fs23.existsSync)((0, import_node_path21.join)(root, m)))) return "monorepo";
17168
- const pkg = readJson((0, import_node_path21.join)(root, "package.json"));
17028
+ if (workspaceMarkers.some((m) => (0, import_node_fs23.existsSync)((0, import_node_path19.join)(root, m)))) return "monorepo";
17029
+ const pkg = readJson((0, import_node_path19.join)(root, "package.json"));
17169
17030
  if (pkg && "workspaces" in pkg) return "monorepo";
17170
17031
  const manifests = files.filter((f) => /(^|\/)(package\.json|go\.mod|pyproject\.toml|Cargo\.toml|pom\.xml)$/.test(f));
17171
17032
  const nested = manifests.filter((f) => f.includes("/"));
@@ -17178,16 +17039,16 @@ function detectArchitecture(root, files) {
17178
17039
  var SAMPLE_LIMIT = 300;
17179
17040
  function measureAvgFileLength(root, files, languages) {
17180
17041
  const primary = new Set(languages.slice(0, 2));
17181
- const candidates2 = files.filter((f) => {
17042
+ const candidates = files.filter((f) => {
17182
17043
  const lang = languageOf(f);
17183
17044
  return lang !== null && primary.has(lang);
17184
17045
  });
17185
- if (candidates2.length === 0) return null;
17186
- const stride = Math.max(1, Math.floor(candidates2.length / SAMPLE_LIMIT));
17046
+ if (candidates.length === 0) return null;
17047
+ const stride = Math.max(1, Math.floor(candidates.length / SAMPLE_LIMIT));
17187
17048
  let total = 0;
17188
17049
  let counted = 0;
17189
- for (let i = 0; i < candidates2.length; i += stride) {
17190
- const path = (0, import_node_path21.join)(root, candidates2[i]);
17050
+ for (let i = 0; i < candidates.length; i += stride) {
17051
+ const path = (0, import_node_path19.join)(root, candidates[i]);
17191
17052
  try {
17192
17053
  if ((0, import_node_fs23.statSync)(path).size > 2 * 1024 * 1024) continue;
17193
17054
  total += (0, import_node_fs23.readFileSync)(path, "utf-8").split("\n").length;
@@ -17215,14 +17076,14 @@ function detectProject(root = repoRoot()) {
17215
17076
  const existingToolConfigs = [];
17216
17077
  for (const [tool, markers] of TOOL_CONFIG_MARKERS) {
17217
17078
  for (const marker of markers) {
17218
- if ((0, import_node_fs23.existsSync)((0, import_node_path21.join)(root, marker))) {
17079
+ if ((0, import_node_fs23.existsSync)((0, import_node_path19.join)(root, marker))) {
17219
17080
  existingToolConfigs.push({ tool, path: `./${marker}` });
17220
17081
  break;
17221
17082
  }
17222
17083
  }
17223
17084
  }
17224
17085
  return {
17225
- projectName: (0, import_node_path21.basename)(root),
17086
+ projectName: (0, import_node_path19.basename)(root),
17226
17087
  languages,
17227
17088
  languageCounts,
17228
17089
  frameworks: matchAll(dependencies, FRAMEWORK_BY_DEPENDENCY),
@@ -17668,7 +17529,7 @@ async function correctVerityMdVersion(opts) {
17668
17529
  }
17669
17530
  async function writeFileTo(relative2, body) {
17670
17531
  const target = projectPath(relative2);
17671
- await (0, import_promises9.mkdir)((0, import_node_path22.dirname)(target), { recursive: true });
17532
+ await (0, import_promises9.mkdir)((0, import_node_path20.dirname)(target), { recursive: true });
17672
17533
  await (0, import_promises9.writeFile)(target, body);
17673
17534
  }
17674
17535
  async function deriveConfigForStandard(standard) {
@@ -18143,11 +18004,7 @@ function registerConfigCommands(program2) {
18143
18004
  });
18144
18005
  config.command("git-moments [moments]").description('Get or set the git moments the guard reviews: commit,push \u2014 or "none"').action((moments) => {
18145
18006
  if (moments === void 0) {
18146
- const config2 = readProjectConfig();
18147
- const current = config2.git_moments;
18148
- if (config2.source === "main-worktree" && config2.path) {
18149
- printInfo(`Inherited from the main worktree: ${config2.path}`);
18150
- }
18007
+ const current = readProjectConfig().git_moments;
18151
18008
  process.stdout.write((current.length ? current.join(",") : "none") + "\n");
18152
18009
  return;
18153
18010
  }
@@ -18617,14 +18474,8 @@ function timeAgo(isoDate) {
18617
18474
  return `${days}d ago`;
18618
18475
  }
18619
18476
  function registerStatusCommand(program2) {
18620
- program2.command("status").description("Show project quality status").option("--history", "Include recent run history").option("--limit <n>", "Number of history entries (1-100)", "5").option("--json", "Output raw JSON").action(async (opts) => {
18477
+ program2.command("status").description("Show project quality status").option("--history", "Include recent run history").option("--limit <n>", "Number of history entries", "5").option("--json", "Output raw JSON").action(async (opts) => {
18621
18478
  const globals = program2.opts();
18622
- const rawLimit = String(opts.limit).trim();
18623
- const limit = /^\d{1,3}$/.test(rawLimit) ? Number(rawLimit) : Number.NaN;
18624
- if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
18625
- printError(`--limit must be a whole number between 1 and 100 (got "${opts.limit}").`);
18626
- process.exit(1);
18627
- }
18628
18479
  const tokenResult = await resolveToken(globals.token);
18629
18480
  if (!tokenResult.ok) {
18630
18481
  printError(tokenResult.error);
@@ -18662,7 +18513,7 @@ function registerStatusCommand(program2) {
18662
18513
  if (opts.history && !denial) {
18663
18514
  const runsResult = await apiRequest({
18664
18515
  method: "GET",
18665
- path: `/runs?limit=${limit}`,
18516
+ path: `/runs?limit=${opts.limit}`,
18666
18517
  serviceUrl,
18667
18518
  token,
18668
18519
  verbose: globals.verbose
@@ -18702,14 +18553,12 @@ function registerStatusCommand(program2) {
18702
18553
  printInfo(`Standard: v${s.version} (${s.quality_dimensions} quality, ${s.security_patterns} security, ${s.custom_patterns} custom)`);
18703
18554
  printInfo(`Languages: ${s.languages.join(", ")}`);
18704
18555
  }
18705
- const wiring = await resolveHookWiring();
18706
- const hookStatus = wiring.status;
18556
+ const hookStatus = await checkAllVerityHooks();
18707
18557
  const moments = [];
18708
18558
  if (hookStatus.stop) moments.push("stop");
18709
18559
  if (hookStatus.guardOn.includes("commit")) moments.push("pre-commit");
18710
18560
  if (hookStatus.guardOn.includes("push")) moments.push("pre-push/PR");
18711
- const via = wiring.source === "plugin" ? " (wired by the Verity plugin)" : "";
18712
- printInfo(`Moments: ${moments.length > 0 ? `${moments.join(", ")}${via}` : 'none (run "verity init")'}`);
18561
+ printInfo(`Moments: ${moments.length > 0 ? moments.join(", ") : 'none (run "verity init")'}`);
18713
18562
  if (!mem) return;
18714
18563
  if (mem.recent_runs) {
18715
18564
  const r = mem.recent_runs;
@@ -18786,7 +18635,7 @@ function registerStatusCommand(program2) {
18786
18635
  if (opts.history) {
18787
18636
  const runsResult = await apiRequest({
18788
18637
  method: "GET",
18789
- path: `/runs?limit=${limit}`,
18638
+ path: `/runs?limit=${opts.limit}`,
18790
18639
  serviceUrl,
18791
18640
  token,
18792
18641
  verbose: globals.verbose
@@ -18977,11 +18826,11 @@ var import_node_fs43 = require("node:fs");
18977
18826
 
18978
18827
  // src/lib/repo-context.ts
18979
18828
  var import_node_child_process9 = require("node:child_process");
18980
- var import_node_os4 = require("node:os");
18829
+ var import_node_os3 = require("node:os");
18981
18830
  function rgInvocations(env = process.env) {
18982
18831
  const out = [{ cmd: "rg" }];
18983
18832
  if (env.CLAUDE_CODE_EXECPATH) out.push({ cmd: env.CLAUDE_CODE_EXECPATH, argv0: "rg" });
18984
- out.push({ cmd: `${(0, import_node_os4.homedir)()}/.local/bin/claude`, argv0: "rg" });
18833
+ out.push({ cmd: `${(0, import_node_os3.homedir)()}/.local/bin/claude`, argv0: "rg" });
18985
18834
  return out;
18986
18835
  }
18987
18836
  var MAX_SYMBOLS = 12;
@@ -19795,9 +19644,9 @@ function installRunEvidence(run2) {
19795
19644
  // src/lib/git-frame.ts
19796
19645
  var import_node_child_process10 = require("node:child_process");
19797
19646
  var import_node_fs31 = require("node:fs");
19798
- var import_node_os5 = require("node:os");
19799
- var import_node_path23 = require("node:path");
19800
- var import_node_path24 = require("node:path");
19647
+ var import_node_os4 = require("node:os");
19648
+ var import_node_path21 = require("node:path");
19649
+ var import_node_path22 = require("node:path");
19801
19650
  var VALUE_TOKEN = `(?:'[^']*'|"[^"]*"|\\S+)`;
19802
19651
  var GIT_GLOBAL_OPTS = `(?:\\s+(?:-[Cc]\\s+${VALUE_TOKEN}|--?[\\w-]+(?:=\\S+)?))*`;
19803
19652
  var COMMIT_HEAD = `git${GIT_GLOBAL_OPTS}\\s+commit(?![\\w-])`;
@@ -19843,15 +19692,15 @@ function extractCommandTarget(command, segmentIndex, baseDir) {
19843
19692
  if (!m) continue;
19844
19693
  named = true;
19845
19694
  if (m[1] === void 0) {
19846
- dir = (0, import_node_os5.homedir)();
19695
+ dir = (0, import_node_os4.homedir)();
19847
19696
  continue;
19848
19697
  }
19849
19698
  const raw = unquote(m[1]);
19850
19699
  if (SHELL_DYNAMIC.test(raw) || raw === "-") {
19851
19700
  return { dir: null, named: true, unresolvable: `cd target not statically resolvable: ${raw}` };
19852
19701
  }
19853
- const expanded = raw === "~" ? (0, import_node_os5.homedir)() : raw.startsWith("~/") ? (0, import_node_path24.join)((0, import_node_os5.homedir)(), raw.slice(2)) : raw;
19854
- dir = (0, import_node_path23.isAbsolute)(expanded) ? expanded : (0, import_node_path23.resolve)(dir, expanded);
19702
+ const expanded = raw === "~" ? (0, import_node_os4.homedir)() : raw.startsWith("~/") ? (0, import_node_path22.join)((0, import_node_os4.homedir)(), raw.slice(2)) : raw;
19703
+ dir = (0, import_node_path21.isAbsolute)(expanded) ? expanded : (0, import_node_path21.resolve)(dir, expanded);
19855
19704
  }
19856
19705
  const seg = segments[segmentIndex];
19857
19706
  const overrideMatch = /--(?:git-dir|work-tree)(?:=|\s)|\bGIT_(?:DIR|WORK_TREE|INDEX_FILE)=/.exec(seg);
@@ -19869,8 +19718,8 @@ function extractCommandTarget(command, segmentIndex, baseDir) {
19869
19718
  if (SHELL_DYNAMIC.test(raw)) {
19870
19719
  return { dir: null, named: true, unresolvable: `-C target not statically resolvable: ${raw}` };
19871
19720
  }
19872
- const expanded = raw === "~" ? (0, import_node_os5.homedir)() : raw.startsWith("~/") ? (0, import_node_path24.join)((0, import_node_os5.homedir)(), raw.slice(2)) : raw;
19873
- dir = (0, import_node_path23.isAbsolute)(expanded) ? expanded : (0, import_node_path23.resolve)(dir, expanded);
19721
+ const expanded = raw === "~" ? (0, import_node_os4.homedir)() : raw.startsWith("~/") ? (0, import_node_path22.join)((0, import_node_os4.homedir)(), raw.slice(2)) : raw;
19722
+ dir = (0, import_node_path21.isAbsolute)(expanded) ? expanded : (0, import_node_path21.resolve)(dir, expanded);
19874
19723
  }
19875
19724
  }
19876
19725
  return { dir, named, unresolvable: null };
@@ -19935,7 +19784,7 @@ function realpathOr(p) {
19935
19784
  try {
19936
19785
  return import_node_fs31.realpathSync.native(p);
19937
19786
  } catch {
19938
- return (0, import_node_path23.resolve)(p);
19787
+ return (0, import_node_path21.resolve)(p);
19939
19788
  }
19940
19789
  }
19941
19790
  function resolveFrame(input) {
@@ -19974,7 +19823,7 @@ function resolveFrame(input) {
19974
19823
  const gitDirRaw = gitAt(dir, ["rev-parse", "--absolute-git-dir"]);
19975
19824
  const commonRaw = gitAt(dir, ["rev-parse", "--git-common-dir"]);
19976
19825
  const gitDir = gitDirRaw ? realpathOr(gitDirRaw) : null;
19977
- const commonDir = commonRaw ? realpathOr((0, import_node_path23.isAbsolute)(commonRaw) ? commonRaw : (0, import_node_path23.resolve)(dir, commonRaw)) : null;
19826
+ const commonDir = commonRaw ? realpathOr((0, import_node_path21.isAbsolute)(commonRaw) ? commonRaw : (0, import_node_path21.resolve)(dir, commonRaw)) : null;
19978
19827
  const branchRaw = gitAt(dir, ["rev-parse", "--abbrev-ref", "HEAD"]);
19979
19828
  return {
19980
19829
  moment: found?.moment ?? null,
@@ -19999,172 +19848,14 @@ function refResolves(frame, ref) {
19999
19848
  return frameGit(frame, ["rev-parse", "--verify", "-q", `${ref}^{commit}`]) !== "";
20000
19849
  }
20001
19850
  var SHA_RE2 = /^[0-9a-f]{40}$/;
20002
- function shellWords(segment) {
20003
- return segment.match(/'[^']*'|"[^"]*"|\S+/g) ?? [];
20004
- }
20005
- var ADD_FLAGS_REPLAYABLE = /* @__PURE__ */ new Set([
20006
- "-A",
20007
- "--all",
20008
- "--no-ignore-removal",
20009
- "-u",
20010
- "--update",
20011
- "--no-all",
20012
- "--ignore-removal",
20013
- "-f",
20014
- "--force",
20015
- "-v",
20016
- "--verbose",
20017
- "-N",
20018
- "--intent-to-add",
20019
- "--renormalize",
20020
- "--sparse",
20021
- "--ignore-errors",
20022
- "--refresh"
20023
- ]);
20024
- var ADD_FLAGS_INTERACTIVE = /* @__PURE__ */ new Set(["-i", "--interactive", "-p", "--patch", "-e", "--edit"]);
20025
- var PATHSPEC_UNRESOLVABLE = /[$`\\*?[\]{}~]/;
20026
- var COMMIT_VALUE_OPTS = /* @__PURE__ */ new Set([
20027
- "-m",
20028
- "--message",
20029
- "-F",
20030
- "--file",
20031
- "-C",
20032
- "--reuse-message",
20033
- "-c",
20034
- "--reedit-message",
20035
- "--author",
20036
- "--date",
20037
- "-t",
20038
- "--template",
20039
- "--fixup",
20040
- "--squash",
20041
- "--trailer",
20042
- "--cleanup"
20043
- ]);
20044
- var ADD_HEAD = `git${GIT_GLOBAL_OPTS}\\s+add(?![\\w-])`;
20045
- var ADD_RE = new RegExp(`(?:^|[\\s;&|(])${ADD_HEAD}|(?:^|[;&|(])\\s*[^\\s;&|()'"]*\\/${ADD_HEAD}`);
20046
- function pathspecOf(word) {
20047
- const raw = unquote(word);
20048
- if (!raw) return { reason: "an empty pathspec" };
20049
- if (PATHSPEC_UNRESOLVABLE.test(raw)) {
20050
- return { reason: `the shell rewrites the pathspec "${raw}" before git sees it` };
20051
- }
20052
- return { path: raw };
20053
- }
20054
- function parseAddSegment(segment) {
20055
- const words = shellWords(segment);
20056
- const at = words.indexOf("add");
20057
- if (at === -1) return { reason: 'the "git add" arguments could not be read' };
20058
- const flags = [];
20059
- const paths = [];
20060
- let literal = false;
20061
- for (const word of words.slice(at + 1)) {
20062
- if (literal || !word.startsWith("-") || word === "-") {
20063
- if (word === "--" && !literal) {
20064
- literal = true;
20065
- continue;
20066
- }
20067
- const p = pathspecOf(word);
20068
- if ("reason" in p) return p;
20069
- paths.push(p.path);
20070
- continue;
20071
- }
20072
- if (word === "--") {
20073
- literal = true;
20074
- continue;
20075
- }
20076
- const parts = /^-[A-Za-z]{2,}$/.test(word) ? [...word.slice(1)].map((c) => `-${c}`) : [word];
20077
- for (const flag of parts) {
20078
- if (ADD_FLAGS_INTERACTIVE.has(flag)) {
20079
- return { reason: `"git add ${flag}" stages what a human picks at a prompt` };
20080
- }
20081
- if (!ADD_FLAGS_REPLAYABLE.has(flag.split("=")[0])) {
20082
- return { reason: `unmodelled "git add" option ${flag}` };
20083
- }
20084
- flags.push(flag);
20085
- }
20086
- }
20087
- return { flags, paths };
20088
- }
20089
- function commitStagesTrackedChanges(segment) {
20090
- const words = shellWords(segment);
20091
- const at = words.indexOf("commit");
20092
- if (at === -1) return false;
20093
- let skipValue = false;
20094
- for (const word of words.slice(at + 1)) {
20095
- if (skipValue) {
20096
- skipValue = false;
20097
- continue;
20098
- }
20099
- if (word === "--") break;
20100
- if (!word.startsWith("-") || word === "-") continue;
20101
- if (word.startsWith("--")) {
20102
- const name = word.split("=")[0];
20103
- if (name === "--all") return true;
20104
- if (COMMIT_VALUE_OPTS.has(name) && !word.includes("=")) skipValue = true;
20105
- continue;
20106
- }
20107
- for (let i = 1; i < word.length; i++) {
20108
- const flag = `-${word[i]}`;
20109
- if (flag === "-a") return true;
20110
- if (COMMIT_VALUE_OPTS.has(flag)) {
20111
- if (i === word.length - 1) skipValue = true;
20112
- break;
20113
- }
20114
- }
20115
- }
20116
- return false;
20117
- }
20118
- function planInCommandStaging(frame, command) {
20119
- const found = findMomentSegment(command, ["commit"]);
20120
- if (!found) return { kind: "none" };
20121
- const segments = splitSegments(command);
20122
- if (commitStagesTrackedChanges(segments[found.segmentIndex])) {
20123
- return {
20124
- kind: "files",
20125
- via: "index+commit-a",
20126
- files: frameGit(frame, ["diff", "--name-only", "HEAD"]).split("\n").filter(Boolean)
20127
- };
20128
- }
20129
- const addSegments = segments.slice(0, found.segmentIndex).filter((s) => ADD_RE.test(s));
20130
- if (addSegments.length === 0) return { kind: "none" };
20131
- const staged = new Set(
20132
- frameGit(frame, ["diff", "--cached", "--name-only"]).split("\n").filter(Boolean)
20133
- );
20134
- for (const segment of addSegments) {
20135
- const parsed = parseAddSegment(segment);
20136
- if ("reason" in parsed) return { kind: "unpredictable", reason: parsed.reason };
20137
- const args = ["add", "--dry-run", "--ignore-missing", ...parsed.flags];
20138
- if (parsed.paths.length > 0) args.push("--", ...parsed.paths);
20139
- for (const line of frameGit(frame, args).split("\n")) {
20140
- const m = line.match(/^(?:add|remove) '(.*)'$/);
20141
- if (m) staged.add(m[1]);
20142
- }
20143
- }
20144
- return { kind: "files", via: "index+staged-in-command", files: [...staged] };
20145
- }
20146
- function stagedRange(frame, command) {
19851
+ function stagedRange(frame) {
20147
19852
  if (!frame.worktreeRoot) return { kind: "nothing", base: null, head: "INDEX", via: "refused" };
20148
- const plan = command ? planInCommandStaging(frame, command) : { kind: "none" };
20149
- if (plan.kind === "unpredictable") {
20150
- return { kind: "staged", base: "HEAD", head: "INDEX", via: "staged-in-command", refusal: plan.reason };
20151
- }
20152
- const mergeHead = frame.gitDir ? (0, import_node_path24.join)(frame.gitDir, "MERGE_HEAD") : null;
19853
+ const mergeHead = frame.gitDir ? (0, import_node_path22.join)(frame.gitDir, "MERGE_HEAD") : null;
20153
19854
  if (mergeHead && (0, import_node_fs31.existsSync)(mergeHead)) {
20154
19855
  const vsHead = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "HEAD"]).split("\n").filter(Boolean));
20155
19856
  const vsMerge = new Set(frameGit(frame, ["diff", "--cached", "--name-only", "MERGE_HEAD"]).split("\n").filter(Boolean));
20156
- const resolutions = new Set([...vsHead].filter((f) => vsMerge.has(f) && !isVerityOwnedPath(f)));
20157
- if (plan.kind === "files") {
20158
- const wtVsHead = new Set(frameGit(frame, ["diff", "--name-only", "HEAD"]).split("\n").filter(Boolean));
20159
- const wtVsMerge = new Set(frameGit(frame, ["diff", "--name-only", "MERGE_HEAD"]).split("\n").filter(Boolean));
20160
- for (const f of plan.files) {
20161
- if (wtVsHead.has(f) && wtVsMerge.has(f) && !isVerityOwnedPath(f)) resolutions.add(f);
20162
- }
20163
- }
20164
- return { kind: "merge", base: "HEAD", head: "INDEX", via: "merge-resolutions", files: [...resolutions] };
20165
- }
20166
- if (plan.kind === "files") {
20167
- return { kind: "staged", base: "HEAD", head: "INDEX", via: plan.via, files: plan.files };
19857
+ const resolutions = [...vsHead].filter((f) => vsMerge.has(f) && !isVerityOwnedPath(f));
19858
+ return { kind: "merge", base: "HEAD", head: "INDEX", via: "merge-resolutions", files: resolutions };
20168
19859
  }
20169
19860
  return { kind: "staged", base: "HEAD", head: "INDEX", via: "index" };
20170
19861
  }
@@ -20556,7 +20247,7 @@ function sanitizeCommandWithLoss(rawCmd) {
20556
20247
  const lost = lines.slice(1).some((l) => l.trim().length > 0);
20557
20248
  const first = lines[0];
20558
20249
  const cmd = sanitizeCommand(first);
20559
- const hadSeparator = SEPARATORS.some((sep3) => first.indexOf(sep3) > 0);
20250
+ const hadSeparator = SEPARATORS.some((sep2) => first.indexOf(sep2) > 0);
20560
20251
  return { cmd, lost: lost || !hadSeparator && first.length > MAX_COMMAND_CHARS };
20561
20252
  }
20562
20253
  var SEPARATORS = [" | ", " > ", " >> ", " 2>", " && ", " ; "];
@@ -20565,11 +20256,11 @@ function sanitizeCommand(rawCmd) {
20565
20256
  let cmd = rawCmd.split("\n")[0];
20566
20257
  let cut = -1;
20567
20258
  let marker = "";
20568
- for (const sep3 of SEPARATORS) {
20569
- const idx = cmd.indexOf(sep3);
20259
+ for (const sep2 of SEPARATORS) {
20260
+ const idx = cmd.indexOf(sep2);
20570
20261
  if (idx > 0 && (cut === -1 || idx < cut)) {
20571
20262
  cut = idx;
20572
- marker = sep3.trim();
20263
+ marker = sep2.trim();
20573
20264
  }
20574
20265
  }
20575
20266
  if (cut > -1) cmd = cmd.slice(0, cut);
@@ -20593,28 +20284,28 @@ async function readStopHookStdin() {
20593
20284
  try {
20594
20285
  if (process.stdin.isTTY) return empty;
20595
20286
  const chunks = [];
20596
- const timeout = new Promise((resolve5) => setTimeout(() => resolve5(empty), 500));
20597
- const read = new Promise((resolve5) => {
20287
+ const timeout = new Promise((resolve4) => setTimeout(() => resolve4(empty), 500));
20288
+ const read = new Promise((resolve4) => {
20598
20289
  process.stdin.on("data", (chunk) => chunks.push(chunk));
20599
20290
  process.stdin.on("end", () => {
20600
20291
  const raw = Buffer.concat(chunks).toString("utf-8").trim();
20601
20292
  if (!raw) {
20602
- resolve5(empty);
20293
+ resolve4(empty);
20603
20294
  return;
20604
20295
  }
20605
20296
  try {
20606
20297
  const data = JSON.parse(raw);
20607
- resolve5({
20298
+ resolve4({
20608
20299
  assistantMessage: typeof data.last_assistant_message === "string" ? data.last_assistant_message : null,
20609
20300
  stopReason: typeof data.stop_reason === "string" ? data.stop_reason : null,
20610
20301
  transcriptPath: typeof data.transcript_path === "string" ? data.transcript_path : null,
20611
20302
  sessionId: typeof data.session_id === "string" ? data.session_id : null
20612
20303
  });
20613
20304
  } catch {
20614
- resolve5(empty);
20305
+ resolve4(empty);
20615
20306
  }
20616
20307
  });
20617
- process.stdin.on("error", () => resolve5(empty));
20308
+ process.stdin.on("error", () => resolve4(empty));
20618
20309
  process.stdin.resume();
20619
20310
  });
20620
20311
  return await Promise.race([read, timeout]);
@@ -20818,7 +20509,7 @@ function channelSilence(input) {
20818
20509
  // src/lib/cli-version.ts
20819
20510
  function cliVersion() {
20820
20511
  try {
20821
- return true ? "0.32.0-experimental.cc76941" : "dev";
20512
+ return true ? "0.32.0" : "dev";
20822
20513
  } catch {
20823
20514
  return "dev";
20824
20515
  }
@@ -21177,7 +20868,7 @@ async function scope(run2) {
21177
20868
 
21178
20869
  // src/lib/specs.ts
21179
20870
  var import_node_fs34 = require("node:fs");
21180
- var import_node_path25 = require("node:path");
20871
+ var import_node_path23 = require("node:path");
21181
20872
  var SPEC_CANDIDATES = [
21182
20873
  "CLAUDE.md",
21183
20874
  "AGENTS.md",
@@ -21250,7 +20941,7 @@ function findMdFiles(dir, maxDepth, depth = 0) {
21250
20941
  try {
21251
20942
  const entries = (0, import_node_fs34.readdirSync)(dir, { withFileTypes: true });
21252
20943
  for (const entry of entries) {
21253
- const fullPath = (0, import_node_path25.join)(dir, entry.name);
20944
+ const fullPath = (0, import_node_path23.join)(dir, entry.name);
21254
20945
  if (entry.isFile() && entry.name.endsWith(".md")) {
21255
20946
  result.push(fullPath);
21256
20947
  } else if (entry.isDirectory() && depth < maxDepth - 1) {
@@ -21262,9 +20953,9 @@ function findMdFiles(dir, maxDepth, depth = 0) {
21262
20953
  return result;
21263
20954
  }
21264
20955
  function discoverPlans() {
21265
- const homePlansDir = (0, import_node_path25.join)(process.env.HOME ?? "", ".claude", "plans");
20956
+ const homePlansDir = (0, import_node_path23.join)(process.env.HOME ?? "", ".claude", "plans");
21266
20957
  const localPlansDir = ".claude/plans";
21267
- const candidates2 = [];
20958
+ const candidates = [];
21268
20959
  const seen = /* @__PURE__ */ new Set();
21269
20960
  for (const plansDir of [localPlansDir, homePlansDir]) {
21270
20961
  if (!(0, import_node_fs34.existsSync)(plansDir)) continue;
@@ -21272,19 +20963,19 @@ function discoverPlans() {
21272
20963
  for (const f of (0, import_node_fs34.readdirSync)(plansDir)) {
21273
20964
  if (!f.endsWith(".md") || seen.has(f)) continue;
21274
20965
  seen.add(f);
21275
- const fullPath = (0, import_node_path25.join)(plansDir, f);
20966
+ const fullPath = (0, import_node_path23.join)(plansDir, f);
21276
20967
  try {
21277
20968
  const stat3 = (0, import_node_fs34.statSync)(fullPath);
21278
- candidates2.push({ name: f, path: fullPath, mtime: stat3.mtimeMs, size: stat3.size });
20969
+ candidates.push({ name: f, path: fullPath, mtime: stat3.mtimeMs, size: stat3.size });
21279
20970
  } catch {
21280
20971
  }
21281
20972
  }
21282
20973
  } catch {
21283
20974
  }
21284
20975
  }
21285
- candidates2.sort((a, b) => b.mtime - a.mtime);
20976
+ candidates.sort((a, b) => b.mtime - a.mtime);
21286
20977
  const result = [];
21287
- for (const entry of candidates2.slice(0, MAX_PLAN_FILES)) {
20978
+ for (const entry of candidates.slice(0, MAX_PLAN_FILES)) {
21288
20979
  if (entry.size > MAX_PLAN_FILE_BYTES) continue;
21289
20980
  try {
21290
20981
  const content = (0, import_node_fs34.readFileSync)(entry.path, "utf-8");
@@ -21484,7 +21175,7 @@ async function mode(run2) {
21484
21175
 
21485
21176
  // src/lib/fold.ts
21486
21177
  var import_node_fs35 = require("node:fs");
21487
- var import_node_path26 = require("node:path");
21178
+ var import_node_path24 = require("node:path");
21488
21179
  var KNOWN_RECORD_TYPES = /* @__PURE__ */ new Set([
21489
21180
  "user",
21490
21181
  "assistant",
@@ -21716,9 +21407,9 @@ function fold(transcriptPath, opts = {}) {
21716
21407
  return result;
21717
21408
  }
21718
21409
  try {
21719
- const sidecarDir = (0, import_node_path26.join)(
21720
- (0, import_node_path26.dirname)(transcriptPath),
21721
- (0, import_node_path26.basename)(transcriptPath).replace(/\.jsonl$/, ""),
21410
+ const sidecarDir = (0, import_node_path24.join)(
21411
+ (0, import_node_path24.dirname)(transcriptPath),
21412
+ (0, import_node_path24.basename)(transcriptPath).replace(/\.jsonl$/, ""),
21722
21413
  "subagents"
21723
21414
  );
21724
21415
  if ((0, import_node_fs35.existsSync)(sidecarDir)) {
@@ -21728,7 +21419,7 @@ function fold(transcriptPath, opts = {}) {
21728
21419
  const walk2 = (d, depth) => {
21729
21420
  if (depth > 4) return;
21730
21421
  for (const e of (0, import_node_fs35.readdirSync)(d, { withFileTypes: true })) {
21731
- const p = (0, import_node_path26.join)(d, e.name);
21422
+ const p = (0, import_node_path24.join)(d, e.name);
21732
21423
  if (e.isDirectory()) {
21733
21424
  walk2(p, depth + 1);
21734
21425
  } else if (e.name.startsWith("agent-") && e.name.endsWith(".jsonl")) {
@@ -22103,7 +21794,7 @@ async function evidence(run2) {
22103
21794
 
22104
21795
  // src/lib/cache-cleanup.ts
22105
21796
  var import_node_fs36 = require("node:fs");
22106
- var import_node_path27 = require("node:path");
21797
+ var import_node_path25 = require("node:path");
22107
21798
  var CACHE_TTL_DAYS = 7;
22108
21799
  function pruneStaleCache() {
22109
21800
  try {
@@ -22111,7 +21802,7 @@ function pruneStaleCache() {
22111
21802
  const cutoff = Date.now() - CACHE_TTL_DAYS * 24 * 3600 * 1e3;
22112
21803
  for (const entry of (0, import_node_fs36.readdirSync)(dir)) {
22113
21804
  if (!entry.startsWith("pending-")) continue;
22114
- const path = (0, import_node_path27.join)(dir, entry);
21805
+ const path = (0, import_node_path25.join)(dir, entry);
22115
21806
  try {
22116
21807
  const stat3 = (0, import_node_fs36.statSync)(path);
22117
21808
  if (stat3.mtimeMs < cutoff) {
@@ -22130,7 +21821,7 @@ function pruneStaleCache() {
22130
21821
 
22131
21822
  // src/lib/context-files.ts
22132
21823
  var import_node_fs37 = require("node:fs");
22133
- var import_node_os6 = require("node:os");
21824
+ var import_node_os5 = require("node:os");
22134
21825
  var MAX_CONTEXT_FILES = 10;
22135
21826
  var MAX_CONTEXT_FILE_BYTES = 10240;
22136
21827
  var MAX_CONTEXT_TOTAL_BYTES = 24576;
@@ -22138,7 +21829,7 @@ function readSetContextPaths(summary, deltaFiles) {
22138
21829
  const reads = summary?.files_read ?? [];
22139
21830
  if (reads.length === 0) return [];
22140
21831
  const root = process.cwd().replace(/\/+$/, "");
22141
- const home = (0, import_node_os6.homedir)();
21832
+ const home = (0, import_node_os5.homedir)();
22142
21833
  const toRepoRelative2 = (p) => {
22143
21834
  if (!p) return null;
22144
21835
  let abs;
@@ -22279,7 +21970,7 @@ async function repoContext(run2) {
22279
21970
  // src/lib/seed-runner.ts
22280
21971
  var import_promises14 = require("node:fs/promises");
22281
21972
  var import_node_fs38 = require("node:fs");
22282
- var import_node_path28 = require("node:path");
21973
+ var import_node_path26 = require("node:path");
22283
21974
  var import_yaml4 = __toESM(require_dist());
22284
21975
 
22285
21976
  // src/lib/seed.ts
@@ -22546,7 +22237,7 @@ async function runSeed(opts) {
22546
22237
  }
22547
22238
  }
22548
22239
  }
22549
- const candidates2 = deriveSeedNodes({
22240
+ const candidates = deriveSeedNodes({
22550
22241
  knowledgeSpec: {
22551
22242
  project_name: knowledgeSpec.project_name,
22552
22243
  languages: knowledgeSpec.languages,
@@ -22558,20 +22249,20 @@ async function runSeed(opts) {
22558
22249
  readmeContent,
22559
22250
  claudeMdContent
22560
22251
  });
22561
- if (candidates2.length === 0) {
22252
+ if (candidates.length === 0) {
22562
22253
  return { created: 0, failed: 0, skipped: "no_candidates", candidates: [] };
22563
22254
  }
22564
- const overviewPath = (0, import_node_path28.join)(MEMORY_DIR, "domain", "project-overview.md");
22255
+ const overviewPath = (0, import_node_path26.join)(MEMORY_DIR, "domain", "project-overview.md");
22565
22256
  if ((0, import_node_fs38.existsSync)(overviewPath) && !opts.force) {
22566
- return { created: 0, failed: 0, skipped: "already_seeded", candidates: candidates2 };
22257
+ return { created: 0, failed: 0, skipped: "already_seeded", candidates };
22567
22258
  }
22568
22259
  if (opts.dryRun) {
22569
- return { created: 0, failed: 0, skipped: null, candidates: candidates2 };
22260
+ return { created: 0, failed: 0, skipped: null, candidates };
22570
22261
  }
22571
22262
  const createdAt = (/* @__PURE__ */ new Date()).toISOString();
22572
22263
  let created = 0;
22573
22264
  let failed = 0;
22574
- for (const c of candidates2) {
22265
+ for (const c of candidates) {
22575
22266
  const res = await apiRequest({
22576
22267
  method: "POST",
22577
22268
  path: "/compound/memory/nodes",
@@ -22604,7 +22295,7 @@ async function runSeed(opts) {
22604
22295
  continue;
22605
22296
  }
22606
22297
  try {
22607
- await (0, import_promises14.mkdir)((0, import_node_path28.dirname)(targetPath), { recursive: true });
22298
+ await (0, import_promises14.mkdir)((0, import_node_path26.dirname)(targetPath), { recursive: true });
22608
22299
  await (0, import_promises14.writeFile)(targetPath, renderNodeMarkdown(c, nodeId, createdAt));
22609
22300
  created++;
22610
22301
  opts.onCreated?.(nodeId, filePathRel, c);
@@ -22613,12 +22304,12 @@ async function runSeed(opts) {
22613
22304
  failed++;
22614
22305
  }
22615
22306
  }
22616
- return { created, failed, skipped: null, candidates: candidates2 };
22307
+ return { created, failed, skipped: null, candidates };
22617
22308
  }
22618
22309
 
22619
22310
  // src/commands/analyze/phases/08-memory-manifest.ts
22620
22311
  var import_node_fs39 = require("node:fs");
22621
- var import_node_path29 = require("node:path");
22312
+ var import_node_path27 = require("node:path");
22622
22313
  async function memoryManifest(run2) {
22623
22314
  const { globals } = run2;
22624
22315
  const { serviceUrl, token } = run2;
@@ -22628,7 +22319,7 @@ async function memoryManifest(run2) {
22628
22319
  let autoSeedNotice = null;
22629
22320
  try {
22630
22321
  await ensureMemoryDir();
22631
- const seedMarker = (0, import_node_path29.join)(VERITY_DIR, ".seeded");
22322
+ const seedMarker = (0, import_node_path27.join)(VERITY_DIR, ".seeded");
22632
22323
  const hasStandard = (0, import_node_fs39.existsSync)(STANDARD_FILE);
22633
22324
  const alreadyTried = (0, import_node_fs39.existsSync)(seedMarker);
22634
22325
  if (hasStandard && !alreadyTried) {
@@ -22746,7 +22437,7 @@ function computeIncrement(reviewedPaths, hashOf, priorAuthored) {
22746
22437
  }
22747
22438
 
22748
22439
  // src/commands/analyze/phases/10-working-memory.ts
22749
- var import_node_path30 = require("node:path");
22440
+ var import_node_path28 = require("node:path");
22750
22441
  async function workingMemory(run2) {
22751
22442
  const { opts } = run2;
22752
22443
  const { allForReview, baseline, conversation, foldResult, sessionId, token, transcriptPath } = run2;
@@ -22758,7 +22449,7 @@ async function workingMemory(run2) {
22758
22449
  const priorState = foldForMarks(memorySession.d);
22759
22450
  incrementReport = computeIncrement(
22760
22451
  allForReview,
22761
- (p) => fileHash((0, import_node_path30.join)(repoRoot(), p)),
22452
+ (p) => fileHash((0, import_node_path28.join)(repoRoot(), p)),
22762
22453
  priorState.authored_all.map((a) => ({
22763
22454
  path: a.path,
22764
22455
  hash_at_last_verdict: a.hash_at_last_verdict
@@ -23323,7 +23014,7 @@ async function transmit(run2) {
23323
23014
 
23324
23015
  // src/commands/analyze/phases/13-reconcile.ts
23325
23016
  var import_node_fs42 = require("node:fs");
23326
- var import_node_path31 = require("node:path");
23017
+ var import_node_path29 = require("node:path");
23327
23018
  async function reconcile(run2) {
23328
23019
  const { actionSummary, allChanged, analyzable, baseline, baselineSessionId, codeDelta, contentHash, conversation, decision, foldResult, memory, memorySession, response, reviewable, securityFiles, turnId } = run2;
23329
23020
  const sentPaths = codeDelta.files.map((f) => f.path);
@@ -23352,7 +23043,7 @@ async function reconcile(run2) {
23352
23043
  const st = foldDossier(memorySession.d);
23353
23044
  openElsewhere = openBlockingElsewhere(st.statements, sentPaths, (file, line) => {
23354
23045
  try {
23355
- const src = (0, import_node_fs42.readFileSync)((0, import_node_path31.join)(repoRoot(), file), "utf8").split("\n");
23046
+ const src = (0, import_node_fs42.readFileSync)((0, import_node_path29.join)(repoRoot(), file), "utf8").split("\n");
23356
23047
  const at = src[line - 1];
23357
23048
  return at === void 0 ? null : lineSha(at);
23358
23049
  } catch {
@@ -24204,14 +23895,14 @@ async function runReview(opts, globals) {
24204
23895
 
24205
23896
  // src/commands/guard.ts
24206
23897
  var import_node_fs45 = require("node:fs");
24207
- var import_node_path32 = require("node:path");
23898
+ var import_node_path30 = require("node:path");
24208
23899
  var GUARD_BLOCK_CAP = 2;
24209
- var GUARD_ITER_FILE = (0, import_node_path32.join)(VERITY_DIR, ".guard-iteration");
23900
+ var GUARD_ITER_FILE = (0, import_node_path30.join)(VERITY_DIR, ".guard-iteration");
24210
23901
  function readPreToolUseStdin() {
24211
23902
  const empty = { command: "", cwd: null, sessionId: null };
24212
- return new Promise((resolve5) => {
23903
+ return new Promise((resolve4) => {
24213
23904
  try {
24214
- if (process.stdin.isTTY) return resolve5(empty);
23905
+ if (process.stdin.isTTY) return resolve4(empty);
24215
23906
  const chunks = [];
24216
23907
  let timer;
24217
23908
  let settled = false;
@@ -24224,7 +23915,7 @@ function readPreToolUseStdin() {
24224
23915
  process.stdin.removeListener("end", onEnd);
24225
23916
  process.stdin.removeListener("error", onError);
24226
23917
  process.stdin.pause();
24227
- resolve5(value);
23918
+ resolve4(value);
24228
23919
  };
24229
23920
  const onEnd = () => {
24230
23921
  try {
@@ -24245,7 +23936,7 @@ function readPreToolUseStdin() {
24245
23936
  process.stdin.on("error", onError);
24246
23937
  process.stdin.resume();
24247
23938
  } catch {
24248
- resolve5(empty);
23939
+ resolve4(empty);
24249
23940
  }
24250
23941
  });
24251
23942
  }
@@ -24303,7 +23994,7 @@ function registerGuardCommand(program2) {
24303
23994
  });
24304
23995
  }
24305
23996
  function resolveMomentRange(moment, frame, command, on) {
24306
- return moment === "pre-commit" ? stagedRange(frame, command) : resolvePushRange(frame, command, on);
23997
+ return moment === "pre-commit" ? stagedRange(frame) : resolvePushRange(frame, command, on);
24307
23998
  }
24308
23999
  function describeRange(range) {
24309
24000
  if (range.kind === "staged") return "staged";
@@ -24463,13 +24154,6 @@ async function runGuard(opts, globals) {
24463
24154
  );
24464
24155
  }
24465
24156
  const range = resolveMomentRange(moment, frame, command, on);
24466
- if (range.refusal) {
24467
- logEvent("guard_frame", { moment, ...frameTelemetry(frame, range) });
24468
- emitAllowNotice(
24469
- `\u26A0 Verity ${moment}: could not tell what this ${verb} will include \u2014 ${verb === "commit" ? "committed" : "pushed"} WITHOUT review`,
24470
- `Verity ${moment}: this command stages files as it runs and the resulting set could not be resolved (${range.refusal}); the ${verb} was allowed WITHOUT a Verity review. Stage first (\`git add \u2026\`) and re-run the ${verb} to have it reviewed.`
24471
- );
24472
- }
24473
24157
  const files = rangeFiles(frame, range);
24474
24158
  if (files.length === 0) process.exit(0);
24475
24159
  const tokenResult = await resolveToken(globals.token);
@@ -24505,7 +24189,7 @@ async function runGuard(opts, globals) {
24505
24189
  upgradeToExcerpts(repoContext2, {
24506
24190
  readFile: (rel) => {
24507
24191
  try {
24508
- return (0, import_node_fs45.readFileSync)((0, import_node_path32.join)(frame.worktreeRoot ?? process.cwd(), rel), "utf8");
24192
+ return (0, import_node_fs45.readFileSync)((0, import_node_path30.join)(frame.worktreeRoot ?? process.cwd(), rel), "utf8");
24509
24193
  } catch {
24510
24194
  return null;
24511
24195
  }
@@ -24574,28 +24258,21 @@ async function runGuard(opts, globals) {
24574
24258
  ${covDetail}${viewUrl ? `
24575
24259
  Report: ${viewUrl}` : ""}`
24576
24260
  );
24577
- } else if (decision === "WARN") {
24261
+ }
24262
+ if (decision === "WARN") {
24578
24263
  emitAllowNotice(
24579
24264
  `\u26A0 Verity ${moment}: WARN \u2014 proceeding (${covLine})${link}`,
24580
24265
  `Verity ${moment} review: WARN (proceeding).
24581
24266
  ${covDetail}${viewUrl ? `
24582
24267
  Report: ${viewUrl}` : ""}`
24583
24268
  );
24584
- } else if (decision === "PASS") {
24585
- emitAllowNotice(
24586
- `\u2713 Verity ${moment}: PASS (${covLine})${link}`,
24587
- `Verity ${moment} review: PASS.
24588
- ${covDetail}${viewUrl ? `
24589
- Report: ${viewUrl}` : ""}`
24590
- );
24591
- } else {
24592
- emitAllowNotice(
24593
- `\u26A0 Verity ${moment}: no verdict came back \u2014 ${verb === "commit" ? "committed" : "pushed"} WITHOUT a usable review (${covLine})${link}`,
24594
- `Verity ${moment}: the service answered with no recognisable gate decision (${decision}); the ${verb} was allowed, but nothing reviewed it. Treat this as unreviewed, not as a pass.
24269
+ }
24270
+ emitAllowNotice(
24271
+ `\u2713 Verity ${moment}: PASS (${covLine})${link}`,
24272
+ `Verity ${moment} review: PASS.
24595
24273
  ${covDetail}${viewUrl ? `
24596
24274
  Report: ${viewUrl}` : ""}`
24597
- );
24598
- }
24275
+ );
24599
24276
  }
24600
24277
  function writeBlockMessage(moment, response, covDetail) {
24601
24278
  const label2 = moment === "pre-commit" ? "pre-commit" : "pre-push";
@@ -24790,7 +24467,7 @@ function registerWaiveCommand(program2) {
24790
24467
  var import_node_fs51 = require("node:fs");
24791
24468
  var import_promises17 = require("node:fs/promises");
24792
24469
  var import_yaml6 = __toESM(require_dist());
24793
- var import_node_path35 = require("node:path");
24470
+ var import_node_path33 = require("node:path");
24794
24471
  var import_node_child_process16 = require("node:child_process");
24795
24472
 
24796
24473
  // src/lib/banner.ts
@@ -24827,8 +24504,8 @@ function printBanner(opts) {
24827
24504
  const dim = (text) => color ? `${DIM3}${text}${RESET2}` : text;
24828
24505
  process.stderr.write("\n");
24829
24506
  if (!art) {
24830
- const candidates2 = [`Verity ${version}`, "Verity"];
24831
- const text = candidates2.find((c) => c.length + INDENT.length <= columns);
24507
+ const candidates = [`Verity ${version}`, "Verity"];
24508
+ const text = candidates.find((c) => c.length + INDENT.length <= columns);
24832
24509
  if (text) process.stderr.write(`${INDENT}${dim(text)}
24833
24510
  `);
24834
24511
  process.stderr.write("\n");
@@ -24935,13 +24612,13 @@ function checkAnalysisCli() {
24935
24612
  }
24936
24613
  var INSTALL_TIMEOUT_MS = 12e4;
24937
24614
  function run(command, args, opts = {}) {
24938
- return new Promise((resolve5) => {
24615
+ return new Promise((resolve4) => {
24939
24616
  const child = (0, import_node_child_process13.spawn)(command, args, {
24940
24617
  stdio: opts.inherit ? "inherit" : "pipe",
24941
24618
  timeout: INSTALL_TIMEOUT_MS
24942
24619
  });
24943
- child.on("error", () => resolve5(false));
24944
- child.on("close", (code) => resolve5(code === 0));
24620
+ child.on("error", () => resolve4(false));
24621
+ child.on("close", (code) => resolve4(code === 0));
24945
24622
  });
24946
24623
  }
24947
24624
  async function installAnalysisCli() {
@@ -25040,8 +24717,8 @@ function ensureVerityGitignore() {
25040
24717
  next = lines.map((l) => BREAKING_ENTRIES.has(l.trim()) ? ".verity/*" : l).join("\n");
25041
24718
  }
25042
24719
  if (!hasMarker) {
25043
- const sep3 = next === "" ? "" : next.endsWith("\n") ? "\n" : "\n\n";
25044
- next = next + sep3 + VERITY_GITIGNORE_BLOCK;
24720
+ const sep2 = next === "" ? "" : next.endsWith("\n") ? "\n" : "\n\n";
24721
+ next = next + sep2 + VERITY_GITIGNORE_BLOCK;
25045
24722
  }
25046
24723
  (0, import_node_fs47.writeFileSync)(".gitignore", next);
25047
24724
  return verified(needsRepair ? "repaired" : "added");
@@ -25168,8 +24845,7 @@ async function uninstallTelemetry() {
25168
24845
  async function buildReport() {
25169
24846
  const prereqs = await checkPrereqs({ install: false });
25170
24847
  const state = await readSetupState();
25171
- const wiring = await resolveHookWiring();
25172
- const hooks = wiring.status;
24848
+ const hooks = await checkAllVerityHooks();
25173
24849
  const telemetry = await checkTelemetry();
25174
24850
  const hasConfig = (0, import_node_fs48.existsSync)(projectPath(CODACY_CONFIG_FILE));
25175
24851
  const artifacts = {
@@ -25208,11 +24884,6 @@ async function buildReport() {
25208
24884
  'Your analysis config names pattern ids that no longer resolve, so those tools run with nothing enabled and report zero issues. Fix: "verity standard synthesize --config-only" (or re-run "verity init").'
25209
24885
  );
25210
24886
  }
25211
- if (wiring.duplicateSettingsHooks) {
25212
- next.push(
25213
- 'Duplicate Verity hooks also exist in .claude/settings.json. They stand down at run time under the plugin, but remove them with "verity init --plugin-mode" so the wiring says what it does.'
25214
- );
25215
- }
25216
24887
  if (state?.telemetry === "deferred") {
25217
24888
  next.push('Telemetry was requested but needs a token \u2014 run "verity login", then "verity telemetry install".');
25218
24889
  }
@@ -25228,12 +24899,7 @@ async function buildReport() {
25228
24899
  moments: state?.moments ?? null,
25229
24900
  telemetry: state?.telemetry ?? null
25230
24901
  },
25231
- hooks: {
25232
- source: wiring.source,
25233
- ...hooks,
25234
- duplicateSettingsHooks: wiring.duplicateSettingsHooks,
25235
- noAnalysisMoment
25236
- },
24902
+ hooks: { ...hooks, noAnalysisMoment },
25237
24903
  telemetry: { enabled: telemetry.enabled, endpoint: telemetry.endpoint },
25238
24904
  artifacts,
25239
24905
  next
@@ -25256,9 +24922,8 @@ function registerDoctorCommand(program2) {
25256
24922
  printInfo(` verity init: ${report.phases.init.done ? `done ${report.phases.init.completed_at ?? ""}`.trim() : "NOT run here"}`);
25257
24923
  printInfo(` /verity-setup: ${report.phases.setup.done ? "done" : "not completed"}`);
25258
24924
  printInfo(` intensity: ${report.answers.intensity ?? "\u2014"} moments: ${report.answers.moments?.join(", ") ?? "\u2014"}`);
25259
- const plugin = report.hooks.source === "plugin";
25260
- printInfo(plugin ? "Hooks: wired by the Verity Claude Code plugin (not .claude/settings.json)" : "Hooks:");
25261
- printInfo(` Stop (verity analyze): ${report.hooks.stop ? plugin ? "on (plugin)" : "on" : "off"}`);
24925
+ printInfo("Hooks:");
24926
+ printInfo(` Stop (verity analyze): ${report.hooks.stop ? "on" : "off"}`);
25262
24927
  printInfo(` Git-moment gate: ${report.hooks.guardOn.length ? report.hooks.guardOn.join(", ") : "off"}`);
25263
24928
  printInfo(` Infra (intent/baseline/compact/session-end): ${[report.hooks.intent, report.hooks.baseline, report.hooks.compact, report.hooks.sessionEnd].filter(Boolean).length}/4`);
25264
24929
  printInfo(`Telemetry: ${report.telemetry.enabled ? `enabled \u2192 ${report.telemetry.endpoint}` : "disabled"}`);
@@ -25281,7 +24946,7 @@ function registerDoctorCommand(program2) {
25281
24946
 
25282
24947
  // src/commands/migrate.ts
25283
24948
  var import_node_fs49 = require("node:fs");
25284
- var import_node_path33 = require("node:path");
24949
+ var import_node_path31 = require("node:path");
25285
24950
  var import_node_child_process15 = require("node:child_process");
25286
24951
  var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
25287
24952
  function defaultNpmRemover(pkg) {
@@ -25318,8 +24983,8 @@ async function runMigration(opts = {}) {
25318
24983
  return { actions, migrated: actions.length > 0 };
25319
24984
  }
25320
24985
  function migrateProjectDir(root, actions) {
25321
- const gateDir = (0, import_node_path33.join)(root, ".gate");
25322
- const verityDir = (0, import_node_path33.join)(root, ".verity");
24986
+ const gateDir = (0, import_node_path31.join)(root, ".gate");
24987
+ const verityDir = (0, import_node_path31.join)(root, ".verity");
25323
24988
  if ((0, import_node_fs49.existsSync)(gateDir) && !(0, import_node_fs49.existsSync)(verityDir)) {
25324
24989
  return migrateProjectDirRename(root, gateDir, verityDir, actions);
25325
24990
  }
@@ -25373,11 +25038,11 @@ function migrateProjectDirCarry(gateDir, verityDir, actions) {
25373
25038
  }
25374
25039
  function migrateGlobalCredentials(home, actions) {
25375
25040
  if (!home) return;
25376
- const gateCreds = (0, import_node_path33.join)(home, ".gate", "credentials");
25377
- const verityCreds = (0, import_node_path33.join)(home, ".verity", "credentials");
25041
+ const gateCreds = (0, import_node_path31.join)(home, ".gate", "credentials");
25042
+ const verityCreds = (0, import_node_path31.join)(home, ".verity", "credentials");
25378
25043
  if (!(0, import_node_fs49.existsSync)(gateCreds)) return;
25379
25044
  if (!(0, import_node_fs49.existsSync)(verityCreds)) {
25380
- (0, import_node_fs49.mkdirSync)((0, import_node_path33.join)(home, ".verity"), { recursive: true });
25045
+ (0, import_node_fs49.mkdirSync)((0, import_node_path31.join)(home, ".verity"), { recursive: true });
25381
25046
  moveFile(gateCreds, verityCreds);
25382
25047
  actions.push("Moved ~/.gate/credentials \u2192 ~/.verity/credentials");
25383
25048
  return;
@@ -25399,7 +25064,7 @@ async function migrateLegacyHooks(root, actions) {
25399
25064
  }
25400
25065
  }
25401
25066
  async function migrateClaudeMd(root, actions) {
25402
- const claudeMd = (0, import_node_path33.join)(root, "CLAUDE.md");
25067
+ const claudeMd = (0, import_node_path31.join)(root, "CLAUDE.md");
25403
25068
  const hadLegacyBlock = (0, import_node_fs49.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd));
25404
25069
  if (!hadLegacyBlock) return;
25405
25070
  try {
@@ -25410,8 +25075,8 @@ async function migrateClaudeMd(root, actions) {
25410
25075
  }
25411
25076
  }
25412
25077
  function migrateStandardFile(root, actions) {
25413
- const gateMd = (0, import_node_path33.join)(root, "GATE.md");
25414
- const verityMd = (0, import_node_path33.join)(root, "VERITY.md");
25078
+ const gateMd = (0, import_node_path31.join)(root, "GATE.md");
25079
+ const verityMd = (0, import_node_path31.join)(root, "VERITY.md");
25415
25080
  if (!(0, import_node_fs49.existsSync)(gateMd) || (0, import_node_fs49.existsSync)(verityMd)) return;
25416
25081
  let moved = false;
25417
25082
  if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
@@ -25428,7 +25093,7 @@ function migrateStandardFile(root, actions) {
25428
25093
  actions.push("Renamed GATE.md \u2192 VERITY.md");
25429
25094
  }
25430
25095
  async function migrateTelemetryHeaders(root, actions) {
25431
- const file = (0, import_node_path33.join)(root, ".claude", "settings.local.json");
25096
+ const file = (0, import_node_path31.join)(root, ".claude", "settings.local.json");
25432
25097
  if (!(0, import_node_fs49.existsSync)(file)) return;
25433
25098
  let settings;
25434
25099
  try {
@@ -25476,8 +25141,8 @@ function mergeGlobalCredentials(gateCreds, verityCreds) {
25476
25141
  toAppend.push(line.replace(/\r$/, ""));
25477
25142
  }
25478
25143
  if (toAppend.length > 0) {
25479
- const sep3 = verityContent.endsWith("\n") || verityContent === "" ? "" : "\n";
25480
- (0, import_node_fs49.writeFileSync)(verityCreds, verityContent + sep3 + toAppend.join("\n") + "\n");
25144
+ const sep2 = verityContent.endsWith("\n") || verityContent === "" ? "" : "\n";
25145
+ (0, import_node_fs49.writeFileSync)(verityCreds, verityContent + sep2 + toAppend.join("\n") + "\n");
25481
25146
  }
25482
25147
  (0, import_node_fs49.rmSync)(gateCreds, { force: true });
25483
25148
  return toAppend.length;
@@ -25518,15 +25183,15 @@ function moveFile(from, to) {
25518
25183
  function carryLegacyContents(gateDir, verityDir) {
25519
25184
  let copied = 0;
25520
25185
  const walk2 = (relDir) => {
25521
- const srcDir = (0, import_node_path33.join)(gateDir, relDir);
25186
+ const srcDir = (0, import_node_path31.join)(gateDir, relDir);
25522
25187
  for (const entry of (0, import_node_fs49.readdirSync)(srcDir)) {
25523
- const rel = relDir ? (0, import_node_path33.join)(relDir, entry) : entry;
25524
- const src = (0, import_node_path33.join)(gateDir, rel);
25525
- const dest = (0, import_node_path33.join)(verityDir, rel);
25188
+ const rel = relDir ? (0, import_node_path31.join)(relDir, entry) : entry;
25189
+ const src = (0, import_node_path31.join)(gateDir, rel);
25190
+ const dest = (0, import_node_path31.join)(verityDir, rel);
25526
25191
  if ((0, import_node_fs49.statSync)(src).isDirectory()) {
25527
25192
  walk2(rel);
25528
25193
  } else if (!(0, import_node_fs49.existsSync)(dest)) {
25529
- (0, import_node_fs49.mkdirSync)((0, import_node_path33.dirname)(dest), { recursive: true });
25194
+ (0, import_node_fs49.mkdirSync)((0, import_node_path31.dirname)(dest), { recursive: true });
25530
25195
  (0, import_node_fs49.cpSync)(src, dest);
25531
25196
  copied++;
25532
25197
  }
@@ -25536,22 +25201,22 @@ function carryLegacyContents(gateDir, verityDir) {
25536
25201
  return copied;
25537
25202
  }
25538
25203
  async function needsMigration(root = repoRoot()) {
25539
- const gateDir = (0, import_node_path33.join)(root, ".gate");
25540
- const verityDir = (0, import_node_path33.join)(root, ".verity");
25204
+ const gateDir = (0, import_node_path31.join)(root, ".gate");
25205
+ const verityDir = (0, import_node_path31.join)(root, ".verity");
25541
25206
  if ((0, import_node_fs49.existsSync)(gateDir) && !(0, import_node_fs49.existsSync)(verityDir)) return true;
25542
25207
  if ((0, import_node_fs49.existsSync)(gateDir) && (0, import_node_fs49.existsSync)(verityDir)) {
25543
- if ((0, import_node_fs49.existsSync)((0, import_node_path33.join)(gateDir, "credentials")) && !(0, import_node_fs49.existsSync)((0, import_node_path33.join)(verityDir, "credentials"))) {
25208
+ if ((0, import_node_fs49.existsSync)((0, import_node_path31.join)(gateDir, "credentials")) && !(0, import_node_fs49.existsSync)((0, import_node_path31.join)(verityDir, "credentials"))) {
25544
25209
  return true;
25545
25210
  }
25546
- if ((0, import_node_fs49.existsSync)((0, import_node_path33.join)(gateDir, "memory")) && !(0, import_node_fs49.existsSync)((0, import_node_path33.join)(verityDir, "memory"))) {
25211
+ if ((0, import_node_fs49.existsSync)((0, import_node_path31.join)(gateDir, "memory")) && !(0, import_node_fs49.existsSync)((0, import_node_path31.join)(verityDir, "memory"))) {
25547
25212
  return true;
25548
25213
  }
25549
25214
  }
25550
- const claudeMd = (0, import_node_path33.join)(root, "CLAUDE.md");
25215
+ const claudeMd = (0, import_node_path31.join)(root, "CLAUDE.md");
25551
25216
  if ((0, import_node_fs49.existsSync)(claudeMd) && hasLegacyMemoryBlock(readFileSyncSafe(claudeMd))) {
25552
25217
  return true;
25553
25218
  }
25554
- if ((0, import_node_fs49.existsSync)((0, import_node_path33.join)(root, "GATE.md")) && !(0, import_node_fs49.existsSync)((0, import_node_path33.join)(root, "VERITY.md"))) {
25219
+ if ((0, import_node_fs49.existsSync)((0, import_node_path31.join)(root, "GATE.md")) && !(0, import_node_fs49.existsSync)((0, import_node_path31.join)(root, "VERITY.md"))) {
25555
25220
  return true;
25556
25221
  }
25557
25222
  if (await hasLegacyHooksAt(root)) return true;
@@ -25674,7 +25339,7 @@ function runSelect(opts) {
25674
25339
  cursor: initialIdx[0] ?? 0,
25675
25340
  chosen: new Set(mode2 === "single" ? [initialIdx[0] ?? 0] : initialIdx)
25676
25341
  };
25677
- return new Promise((resolve5) => {
25342
+ return new Promise((resolve4) => {
25678
25343
  let painted = 0;
25679
25344
  let settled = false;
25680
25345
  const draw = () => {
@@ -25722,7 +25387,7 @@ function runSelect(opts) {
25722
25387
  if (settled) return;
25723
25388
  settled = true;
25724
25389
  restore();
25725
- resolve5(value);
25390
+ resolve4(value);
25726
25391
  };
25727
25392
  readline2.emitKeypressEvents(input);
25728
25393
  input.setRawMode(true);
@@ -25743,9 +25408,9 @@ async function askLine(question, io = {}) {
25743
25408
  output: io.output ?? process.stdout
25744
25409
  });
25745
25410
  try {
25746
- return await new Promise((resolve5) => {
25747
- rl.question(question).then((a) => resolve5(a.trim())).catch(() => resolve5(null));
25748
- rl.once("close", () => setImmediate(() => resolve5(null)));
25411
+ return await new Promise((resolve4) => {
25412
+ rl.question(question).then((a) => resolve4(a.trim())).catch(() => resolve4(null));
25413
+ rl.once("close", () => setImmediate(() => resolve4(null)));
25749
25414
  });
25750
25415
  } finally {
25751
25416
  rl.close();
@@ -25828,7 +25493,7 @@ async function promptMultiSelect(question, choices, fallback) {
25828
25493
  // src/lib/remote-config.ts
25829
25494
  var import_node_fs50 = require("node:fs");
25830
25495
  var import_promises16 = require("node:fs/promises");
25831
- var import_node_path34 = require("node:path");
25496
+ var import_node_path32 = require("node:path");
25832
25497
  var import_yaml5 = __toESM(require_dist());
25833
25498
  var IGNORE_RIDER = "verityignore";
25834
25499
  async function fetchRemoteSetup(opts) {
@@ -25906,7 +25571,7 @@ async function adoptRemoteSetup(found, opts) {
25906
25571
  }
25907
25572
  async function writeOut(relative2, body) {
25908
25573
  const target = projectPath(relative2);
25909
- await (0, import_promises16.mkdir)((0, import_node_path34.dirname)(target), { recursive: true });
25574
+ await (0, import_promises16.mkdir)((0, import_node_path32.dirname)(target), { recursive: true });
25910
25575
  await (0, import_promises16.writeFile)(target, body);
25911
25576
  }
25912
25577
  function describeRemote(found) {
@@ -26022,16 +25687,16 @@ async function runOptionalAuth(resolution, opts = {}) {
26022
25687
  }
26023
25688
  }
26024
25689
  function resolveDataDir2() {
26025
- const candidates2 = [
26026
- (0, import_node_path35.join)(__dirname, "..", "data"),
25690
+ const candidates = [
25691
+ (0, import_node_path33.join)(__dirname, "..", "data"),
26027
25692
  // installed: node_modules/@codacy/verity-cli/data
26028
- (0, import_node_path35.join)(__dirname, "..", "..", "data"),
25693
+ (0, import_node_path33.join)(__dirname, "..", "..", "data"),
26029
25694
  // edge case: nested resolution
26030
- (0, import_node_path35.join)(process.cwd(), "cli", "data")
25695
+ (0, import_node_path33.join)(process.cwd(), "cli", "data")
26031
25696
  // local dev: running from repo root
26032
25697
  ];
26033
- for (const candidate of candidates2) {
26034
- if ((0, import_node_fs51.existsSync)((0, import_node_path35.join)(candidate, "skills"))) {
25698
+ for (const candidate of candidates) {
25699
+ if ((0, import_node_fs51.existsSync)((0, import_node_path33.join)(candidate, "skills"))) {
26035
25700
  return candidate;
26036
25701
  }
26037
25702
  }
@@ -26049,7 +25714,7 @@ async function skillIsCurrent(src, dest) {
26049
25714
  const walk2 = (d, prefix) => {
26050
25715
  for (const e of (0, import_node_fs51.readdirSync)(d, { withFileTypes: true })) {
26051
25716
  const rel = prefix ? `${prefix}/${e.name}` : e.name;
26052
- if (e.isDirectory()) walk2((0, import_node_path35.join)(d, e.name), rel);
25717
+ if (e.isDirectory()) walk2((0, import_node_path33.join)(d, e.name), rel);
26053
25718
  else if (e.isFile()) out.push(rel);
26054
25719
  }
26055
25720
  };
@@ -26060,8 +25725,8 @@ async function skillIsCurrent(src, dest) {
26060
25725
  const shipped = list2(src);
26061
25726
  if (JSON.stringify(shipped) !== JSON.stringify(list2(dest))) return false;
26062
25727
  for (const rel of shipped) {
26063
- const a = await (0, import_promises17.readFile)((0, import_node_path35.join)(src, rel), "utf-8");
26064
- const b = await (0, import_promises17.readFile)((0, import_node_path35.join)(dest, rel), "utf-8");
25728
+ const a = await (0, import_promises17.readFile)((0, import_node_path33.join)(src, rel), "utf-8");
25729
+ const b = await (0, import_promises17.readFile)((0, import_node_path33.join)(dest, rel), "utf-8");
26065
25730
  if (a !== b) return false;
26066
25731
  }
26067
25732
  return true;
@@ -26336,12 +26001,12 @@ async function handoffToSetup(enabled, claudeInstalled) {
26336
26001
  async function installSkills(force, step) {
26337
26002
  step("Installing skills");
26338
26003
  const dataDir = resolveDataDir2();
26339
- const skillsSource = (0, import_node_path35.join)(dataDir, "skills");
26004
+ const skillsSource = (0, import_node_path33.join)(dataDir, "skills");
26340
26005
  const skillsDest = ".claude/skills";
26341
26006
  let skillsInstalled = 0;
26342
26007
  for (const skill of SKILLS) {
26343
- const src = (0, import_node_path35.join)(skillsSource, skill);
26344
- const dest = (0, import_node_path35.join)(skillsDest, skill);
26008
+ const src = (0, import_node_path33.join)(skillsSource, skill);
26009
+ const dest = (0, import_node_path33.join)(skillsDest, skill);
26345
26010
  if (!(0, import_node_fs51.existsSync)(src)) {
26346
26011
  printWarn(` Skill data not found: ${skill}`);
26347
26012
  continue;
@@ -26444,16 +26109,12 @@ function registerInitCommand(program2) {
26444
26109
  program2.command("init").alias("setup").description("Set up Verity in the current project (asks the setup questions, then hands off to /verity-setup)").option("--force", "Reinstall the skills even when they are already up to date (hooks are always reconciled)").option("-y, --yes", "Take the recommended answer for every question (no prompts)").option("--no-setup", "Skip the /verity-setup handoff at the end").option(
26445
26110
  "--plugin-mode",
26446
26111
  "The Claude Code plugin owns the skills and hooks: install neither, and remove any this project already has"
26447
- ).option(
26448
- "--no-plugin",
26449
- "Ignore any Claude Code plugin here and wire this project's own skills and hooks"
26450
26112
  ).option("--no-adopt", "Don't offer this repository's existing Standard from the service; synthesize a new one").action(async (opts) => {
26451
26113
  const force = opts.force ?? false;
26452
26114
  const wantsHandoff = opts.setup !== false;
26453
26115
  const wantsAdopt = opts.adopt !== false;
26454
26116
  const defaultsOnly = (opts.yes ?? false) || !interactive();
26455
- const staleMarker = clearStalePluginMarker();
26456
- const pluginMode = opts.plugin === false ? false : opts.pluginMode ?? pluginActiveHere();
26117
+ const pluginMode = opts.pluginMode ?? pluginActiveHere();
26457
26118
  const projectMarkers = [".git", "package.json", "pyproject.toml", "go.mod", "Cargo.toml", "Gemfile", "pom.xml", "build.gradle"];
26458
26119
  const isProject = projectMarkers.some((m) => (0, import_node_fs51.existsSync)(m));
26459
26120
  if (!isProject) {
@@ -26470,24 +26131,6 @@ function registerInitCommand(program2) {
26470
26131
  } else {
26471
26132
  printPhase(1, 2, "this machine", "prerequisites \xB7 skills \xB7 hooks \xB7 sign-in");
26472
26133
  }
26473
- if (staleMarker) {
26474
- printInfo(`Cleared a stale plugin marker \u2014 ${staleMarker.pluginRoot} is no longer installed.`);
26475
- }
26476
- const install = pluginMode ? activePluginInstall() : null;
26477
- if (pluginMode) {
26478
- const where = install ? ` \u2014 ${install.pluginRoot}${install.version ? ` (v${install.version})` : ""}` : "";
26479
- printInfo(`Hooks here: the Verity Claude Code plugin${where}.`);
26480
- printInfo(" It wires every event for every project, so this one gets no skills or settings.json");
26481
- printInfo(" hooks of its own, and any left by an earlier npm install are removed below.");
26482
- printInfo(" Not what you want here? Re-run with --no-plugin.");
26483
- } else if (opts.plugin === false && pluginActiveHere()) {
26484
- printWarn("Hooks here: this project's .claude/settings.json (--no-plugin).");
26485
- printWarn(" The Verity plugin is active on this machine and would otherwise own them. Both sets");
26486
- printWarn(" will fire; the settings.json copy stands down at run time so each turn is gated once.");
26487
- } else {
26488
- printInfo("Hooks here: this project's .claude/settings.json (no Verity Claude Code plugin is active).");
26489
- }
26490
- console.log("");
26491
26134
  const TOTAL_STEPS = 9;
26492
26135
  let stepNo = 0;
26493
26136
  const step = (label2) => {
@@ -26519,7 +26162,7 @@ function registerInitCommand(program2) {
26519
26162
  printInfo(` intensity: ${intensity} \xB7 moments: ${moments.join(", ") || "none"} (no questions asked)`);
26520
26163
  }
26521
26164
  await scaffoldProject(step, defaultsOnly);
26522
- const globalVerityDir = (0, import_node_path35.join)(process.env.HOME ?? "", ".verity");
26165
+ const globalVerityDir = (0, import_node_path33.join)(process.env.HOME ?? "", ".verity");
26523
26166
  await (0, import_promises17.mkdir)(globalVerityDir, { recursive: true });
26524
26167
  console.log("");
26525
26168
  step("Wiring Claude Code hooks");
@@ -26601,7 +26244,7 @@ function registerInitCommand(program2) {
26601
26244
  ...telemetryChoice ? { telemetry: telemetryChoice } : {},
26602
26245
  init: {
26603
26246
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
26604
- cli_version: true ? "0.32.0-experimental.cc76941" : "dev"
26247
+ cli_version: true ? "0.32.0" : "dev"
26605
26248
  }
26606
26249
  });
26607
26250
  } catch (err) {
@@ -26641,7 +26284,7 @@ function registerInitCommand(program2) {
26641
26284
 
26642
26285
  // src/commands/uninstall.ts
26643
26286
  var import_node_fs52 = require("node:fs");
26644
- var import_node_path36 = require("node:path");
26287
+ var import_node_path34 = require("node:path");
26645
26288
  var SKILL_NAMES = [
26646
26289
  "verity-setup",
26647
26290
  "verity-analyze",
@@ -26660,7 +26303,7 @@ function registerUninstallCommand(program2) {
26660
26303
  const actions = [];
26661
26304
  const skillsRoot = projectPath(".claude/skills");
26662
26305
  for (const name of SKILL_NAMES) {
26663
- const dir = (0, import_node_path36.join)(skillsRoot, name);
26306
+ const dir = (0, import_node_path34.join)(skillsRoot, name);
26664
26307
  if ((0, import_node_fs52.existsSync)(dir)) {
26665
26308
  actions.push({
26666
26309
  label: `Remove .claude/skills/${name}/`,
@@ -26706,7 +26349,7 @@ function registerUninstallCommand(program2) {
26706
26349
  }
26707
26350
  });
26708
26351
  const home = process.env.HOME ?? "";
26709
- const globalVerityDir = (0, import_node_path36.join)(home, ".verity");
26352
+ const globalVerityDir = (0, import_node_path34.join)(home, ".verity");
26710
26353
  if (purgeGlobal && (0, import_node_fs52.existsSync)(globalVerityDir)) {
26711
26354
  actions.push({
26712
26355
  label: `Remove ~/.verity/ (global credentials \u2014 reconnect requires re-registration)`,
@@ -26905,7 +26548,7 @@ function registerTaskCommands(program2) {
26905
26548
 
26906
26549
  // src/commands/reset.ts
26907
26550
  var import_node_fs53 = require("node:fs");
26908
- var import_node_path37 = require("node:path");
26551
+ var import_node_path35 = require("node:path");
26909
26552
  function registerResetCommand(program2) {
26910
26553
  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) => {
26911
26554
  const globals = program2.opts();
@@ -26946,7 +26589,7 @@ function registerResetCommand(program2) {
26946
26589
  for (const entry of (0, import_node_fs53.readdirSync)(cacheDir)) {
26947
26590
  if (entry.startsWith("pending-")) {
26948
26591
  try {
26949
- (0, import_node_fs53.unlinkSync)((0, import_node_path37.join)(cacheDir, entry));
26592
+ (0, import_node_fs53.unlinkSync)((0, import_node_path35.join)(cacheDir, entry));
26950
26593
  purged++;
26951
26594
  } catch {
26952
26595
  }
@@ -26973,7 +26616,7 @@ function registerResetCommand(program2) {
26973
26616
  if ((0, import_node_fs53.existsSync)(logsDir)) {
26974
26617
  for (const entry of (0, import_node_fs53.readdirSync)(logsDir)) {
26975
26618
  try {
26976
- (0, import_node_fs53.unlinkSync)((0, import_node_path37.join)(logsDir, entry));
26619
+ (0, import_node_fs53.unlinkSync)((0, import_node_path35.join)(logsDir, entry));
26977
26620
  } catch {
26978
26621
  }
26979
26622
  }
@@ -27281,8 +26924,8 @@ function registerTelemetryCommands(program2) {
27281
26924
  }
27282
26925
 
27283
26926
  // src/cli.ts
27284
- program.name("verity").description("CLI for Verity quality gate service").version("0.32.0-experimental.cc76941").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
27285
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.32.0-experimental.cc76941");
26927
+ program.name("verity").description("CLI for Verity quality gate service").version("0.32.0").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
26928
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.32.0");
27286
26929
  setUserNamedServiceUrl(program.opts().serviceUrl);
27287
26930
  try {
27288
26931
  await foldLegacyLocalCredential();