@inerrata-corporation/errata 2.0.2-dev.548 → 2.0.2-dev.556

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/errata.mjs +224 -94
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -29302,12 +29302,12 @@ function loadSymbolSummaryCache(configDir) {
29302
29302
  }
29303
29303
  return { version: 1, entries: {} };
29304
29304
  }
29305
- function saveSymbolSummaryCache(configDir, cache) {
29306
- writeFileSync7(symbolSummariesPath(configDir), JSON.stringify(cache, null, 2), "utf8");
29305
+ function saveSymbolSummaryCache(configDir, cache2) {
29306
+ writeFileSync7(symbolSummariesPath(configDir), JSON.stringify(cache2, null, 2), "utf8");
29307
29307
  }
29308
- function summariesByBodyHash(cache) {
29308
+ function summariesByBodyHash(cache2) {
29309
29309
  const m = /* @__PURE__ */ new Map();
29310
- for (const [bodyHash, e] of Object.entries(cache.entries)) {
29310
+ for (const [bodyHash, e] of Object.entries(cache2.entries)) {
29311
29311
  if (!e.rejected && typeof e.summary === "string" && e.summary.trim()) m.set(bodyHash, e.summary);
29312
29312
  }
29313
29313
  return m;
@@ -29389,7 +29389,7 @@ function readSnippet(workspaceRoot, attrs) {
29389
29389
  async function runSymbolSummarySweep(store, workspaceRoot, configDir, summarizer, opts = {}) {
29390
29390
  const maxSymbols = opts.maxSymbols ?? DEFAULT_MAX_SYMBOLS_PER_SWEEP;
29391
29391
  const batchSize = Math.max(1, opts.batchSize ?? DEFAULT_BATCH_SIZE);
29392
- const cache = loadSymbolSummaryCache(configDir);
29392
+ const cache2 = loadSymbolSummaryCache(configDir);
29393
29393
  const candidates = [];
29394
29394
  const seen = /* @__PURE__ */ new Set();
29395
29395
  const docs = buildDocIndex(store);
@@ -29397,7 +29397,7 @@ async function runSymbolSummarySweep(store, workspaceRoot, configDir, summarizer
29397
29397
  for (const n of store.findNodesByLabel(label)) {
29398
29398
  const bodyHash = n.attrs["bodyHash"];
29399
29399
  if (typeof bodyHash !== "string" || !bodyHash || seen.has(bodyHash)) continue;
29400
- if (cache.entries[bodyHash]) continue;
29400
+ if (cache2.entries[bodyHash]) continue;
29401
29401
  const name2 = n.description;
29402
29402
  if (!name2 || !isDistinctiveIdentifier(name2)) continue;
29403
29403
  seen.add(bodyHash);
@@ -29429,14 +29429,14 @@ async function runSymbolSummarySweep(store, workspaceRoot, configDir, summarizer
29429
29429
  const phrase = phrases[j];
29430
29430
  if (phrase == null) continue;
29431
29431
  if (summaryRejectionReason(phrase, isKnown) === null) {
29432
- cache.entries[sym.bodyHash] = { summary: phrase, model: SUMMARY_MODEL, createdAt: now };
29432
+ cache2.entries[sym.bodyHash] = { summary: phrase, model: SUMMARY_MODEL, createdAt: now };
29433
29433
  generated++;
29434
29434
  } else {
29435
- cache.entries[sym.bodyHash] = { rejected: true, model: SUMMARY_MODEL, createdAt: now };
29435
+ cache2.entries[sym.bodyHash] = { rejected: true, model: SUMMARY_MODEL, createdAt: now };
29436
29436
  rejected++;
29437
29437
  }
29438
29438
  }
29439
- saveSymbolSummaryCache(configDir, cache);
29439
+ saveSymbolSummaryCache(configDir, cache2);
29440
29440
  }
29441
29441
  return { generated, rejected, remaining };
29442
29442
  }
@@ -48877,8 +48877,8 @@ var init_report_render = __esm({
48877
48877
 
48878
48878
  // src/cli.ts
48879
48879
  init_src6();
48880
- import { closeSync as closeSync2, existsSync as existsSync28, openSync as openSync2, readFileSync as readFileSync27, renameSync as renameSync4, statSync as statSync6 } from "node:fs";
48881
- import { join as join31 } from "node:path";
48880
+ import { closeSync as closeSync2, existsSync as existsSync29, openSync as openSync2, readFileSync as readFileSync28, renameSync as renameSync4, statSync as statSync6 } from "node:fs";
48881
+ import { join as join32 } from "node:path";
48882
48882
  import { spawn as spawn3 } from "node:child_process";
48883
48883
 
48884
48884
  // src/daemon.ts
@@ -49105,14 +49105,14 @@ var Response2 = class _Response {
49105
49105
  }
49106
49106
  }
49107
49107
  get headers() {
49108
- const cache = this[cacheKey];
49109
- if (cache) {
49110
- if (!(cache[2] instanceof Headers)) {
49111
- cache[2] = new Headers(
49112
- cache[2] || { "content-type": "text/plain; charset=UTF-8" }
49108
+ const cache2 = this[cacheKey];
49109
+ if (cache2) {
49110
+ if (!(cache2[2] instanceof Headers)) {
49111
+ cache2[2] = new Headers(
49112
+ cache2[2] || { "content-type": "text/plain; charset=UTF-8" }
49113
49113
  );
49114
49114
  }
49115
- return cache[2];
49115
+ return cache2[2];
49116
49116
  }
49117
49117
  return this[getResponseCache]().headers;
49118
49118
  }
@@ -54374,7 +54374,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
54374
54374
  }
54375
54375
 
54376
54376
  // src/engine.ts
54377
- var DAEMON_VERSION = true ? "2.0.2-dev.548" : "2.0.0-alpha.0";
54377
+ var DAEMON_VERSION = true ? "2.0.2-dev.556" : "2.0.0-alpha.0";
54378
54378
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
54379
54379
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
54380
54380
  var GIT_OP_MUTE_MS = 4e3;
@@ -56197,7 +56197,7 @@ function pidAlive(pid) {
56197
56197
  // src/multi.ts
56198
56198
  init_dist();
56199
56199
  init_src5();
56200
- import { readFileSync as readFileSync26, unlinkSync as unlinkSync3, writeFileSync as writeFileSync22 } from "node:fs";
56200
+ import { readFileSync as readFileSync27, unlinkSync as unlinkSync3, writeFileSync as writeFileSync22 } from "node:fs";
56201
56201
 
56202
56202
  // src/principle-sync.ts
56203
56203
  init_src5();
@@ -56435,6 +56435,114 @@ function noveltyAgainst(node2, neighbors, opts = {}) {
56435
56435
  };
56436
56436
  }
56437
56437
 
56438
+ // src/public-symbols.ts
56439
+ import { readFileSync as readFileSync25, readdirSync as readdirSync10, existsSync as existsSync26 } from "node:fs";
56440
+ import { join as join30 } from "node:path";
56441
+ var HEAD_BYTES = 8 * 1024;
56442
+ var INDEX_TTL_MS = 10 * 60 * 1e3;
56443
+ var MIN_SYMBOL_LEN = 4;
56444
+ var NAMED_IMPORT_RE = /import\s+(?:type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/g;
56445
+ var REQUIRE_RE = /(?:const|let|var)\s+(.+?)\s*=\s*require\(\s*['"]([^'"]+)['"]\s*\)/g;
56446
+ function isBareExternal(spec, internalNames) {
56447
+ if (spec.startsWith(".") || spec.startsWith("/") || spec.startsWith("node:")) return false;
56448
+ const pkg = spec.startsWith("@") ? spec.split("/").slice(0, 2).join("/") : spec.split("/")[0];
56449
+ return !internalNames.has(pkg);
56450
+ }
56451
+ function bindingNames(clause) {
56452
+ const names = [];
56453
+ const braced = /\{([^}]*)\}/.exec(clause);
56454
+ if (braced) {
56455
+ for (const part of braced[1].split(",")) {
56456
+ const local = part.split(/\s+as\s+/).pop()?.trim();
56457
+ if (local && /^[A-Za-z_$][\w$]*$/.test(local)) names.push(local);
56458
+ }
56459
+ }
56460
+ const ns = /\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(clause);
56461
+ if (ns) names.push(ns[1]);
56462
+ const head2 = clause.replace(/\{[^}]*\}/, "").replace(/\*\s+as\s+[A-Za-z_$][\w$]*/, "");
56463
+ const def = /(?:^|,)\s*([A-Za-z_$][\w$]*)\s*(?:,|$)/.exec(head2.trim());
56464
+ if (def) names.push(def[1]);
56465
+ return names;
56466
+ }
56467
+ function internalPackageNames(workspaceRoot) {
56468
+ const names = /* @__PURE__ */ new Set();
56469
+ const tryRead = (dir) => {
56470
+ const pj = join30(dir, "package.json");
56471
+ if (!existsSync26(pj)) return;
56472
+ try {
56473
+ const name2 = JSON.parse(readFileSync25(pj, "utf8")).name;
56474
+ if (typeof name2 === "string" && name2.length > 0) names.add(name2);
56475
+ } catch {
56476
+ }
56477
+ };
56478
+ tryRead(workspaceRoot);
56479
+ for (const group of ["packages", "apps"]) {
56480
+ const groupDir = join30(workspaceRoot, group);
56481
+ if (!existsSync26(groupDir)) continue;
56482
+ try {
56483
+ for (const entry of readdirSync10(groupDir)) tryRead(join30(groupDir, entry));
56484
+ } catch {
56485
+ }
56486
+ }
56487
+ return names;
56488
+ }
56489
+ var cache = /* @__PURE__ */ new Map();
56490
+ function publicSymbolIndex(store, workspaceRoot, deps = {}) {
56491
+ const now = deps.nowMs ?? Date.now();
56492
+ const cached2 = cache.get(workspaceRoot);
56493
+ if (cached2 && now - cached2.builtAt < INDEX_TTL_MS) return cached2;
56494
+ const readHead = deps.readHead ?? ((absPath) => {
56495
+ try {
56496
+ return readFileSync25(absPath, "utf8").slice(0, HEAD_BYTES);
56497
+ } catch {
56498
+ return "";
56499
+ }
56500
+ });
56501
+ const internal = internalPackageNames(workspaceRoot);
56502
+ const bareModules = /* @__PURE__ */ new Set();
56503
+ for (const mod of store.findNodesByLabel("Module")) {
56504
+ if (isBareExternal(mod.description, internal)) bareModules.add(mod.id);
56505
+ }
56506
+ const files = /* @__PURE__ */ new Set();
56507
+ for (const modId of bareModules) {
56508
+ for (const e of store.inEdges(modId, ["IMPORTS"])) {
56509
+ const f = store.getNode(e.from);
56510
+ const rel = f?.attrs["relPath"];
56511
+ if (f && f.validTo == null && typeof rel === "string") files.add(rel);
56512
+ }
56513
+ }
56514
+ const symbols = /* @__PURE__ */ new Set();
56515
+ for (const rel of files) {
56516
+ const head2 = readHead(join30(workspaceRoot, rel));
56517
+ if (!head2) continue;
56518
+ for (const re of [NAMED_IMPORT_RE, REQUIRE_RE]) {
56519
+ re.lastIndex = 0;
56520
+ for (const m of head2.matchAll(re)) {
56521
+ if (!isBareExternal(m[2], internal)) continue;
56522
+ for (const name2 of bindingNames(m[1])) {
56523
+ if (name2.length >= MIN_SYMBOL_LEN) symbols.add(name2);
56524
+ }
56525
+ }
56526
+ }
56527
+ }
56528
+ const index = { symbols, builtAt: now };
56529
+ cache.set(workspaceRoot, index);
56530
+ return index;
56531
+ }
56532
+ var PRESERVED_SYMBOLS_CAP = 8;
56533
+ function preservedSymbolsFor(description, index) {
56534
+ const out2 = [];
56535
+ const seen = /* @__PURE__ */ new Set();
56536
+ for (const m of description.matchAll(/[A-Za-z_$][\w$]{3,}/g)) {
56537
+ const tok = m[0];
56538
+ if (seen.has(tok) || !index.symbols.has(tok)) continue;
56539
+ seen.add(tok);
56540
+ out2.push(tok);
56541
+ if (out2.length >= PRESERVED_SYMBOLS_CAP) break;
56542
+ }
56543
+ return out2;
56544
+ }
56545
+
56438
56546
  // src/instance-ingest.ts
56439
56547
  var INSTANCE_LABELS = ["Problem", "Solution", "RootCause"];
56440
56548
  var INSTANCE_EDGES = ["CAUSED_BY", "SOLVED_BY"];
@@ -56504,17 +56612,22 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
56504
56612
  const key = sessionOriginKey(n.attrs["sources"]?.[0]);
56505
56613
  return key ? { originSession: key } : {};
56506
56614
  };
56507
- const shareable = (n) => ({
56508
- ...n,
56509
- description: generalize(n.description, { level }).text,
56510
- embedding: [],
56511
- ...originSessionOf(n),
56512
- attrs: {
56513
- scope: stripCodebaseScope(n.attrs["scope"]),
56514
- ...n.attrs["kind"] ? { kind: n.attrs["kind"] } : {},
56515
- ...n.attrs["resolvedAs"] ? { resolvedAs: n.attrs["resolvedAs"] } : {}
56516
- }
56517
- });
56615
+ const symbolIndex = opts.workspaceRoot ? publicSymbolIndex(store, opts.workspaceRoot) : null;
56616
+ const shareable = (n) => {
56617
+ const preserved = symbolIndex ? preservedSymbolsFor(n.description, symbolIndex) : [];
56618
+ return {
56619
+ ...n,
56620
+ description: generalize(n.description, { level }).text,
56621
+ embedding: [],
56622
+ ...originSessionOf(n),
56623
+ attrs: {
56624
+ scope: stripCodebaseScope(n.attrs["scope"]),
56625
+ ...n.attrs["kind"] ? { kind: n.attrs["kind"] } : {},
56626
+ ...n.attrs["resolvedAs"] ? { resolvedAs: n.attrs["resolvedAs"] } : {},
56627
+ ...preserved.length > 0 ? { preservedSymbols: preserved } : {}
56628
+ }
56629
+ };
56630
+ };
56518
56631
  const nodes = [];
56519
56632
  const seen = /* @__PURE__ */ new Set();
56520
56633
  const shippedById = /* @__PURE__ */ new Map();
@@ -56524,7 +56637,8 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
56524
56637
  for (const label of INSTANCE_LABELS) {
56525
56638
  const ref = [];
56526
56639
  includedByLabel.set(label, ref);
56527
- for (const n of store.findNodesByLabel(label)) {
56640
+ const population = label === "RootCause" && opts.sharedStore ? [...store.findNodesByLabel(label), ...opts.sharedStore.findNodesByLabel(label)] : store.findNodesByLabel(label);
56641
+ for (const n of population) {
56528
56642
  if (seen.has(n.id)) continue;
56529
56643
  if (n.attrs["source"] === "cloud") continue;
56530
56644
  if (label === "Problem" && n.attrs["resolvedAs"] === PROBLEM_RESOLUTION.FALSE_POSITIVE) continue;
@@ -56659,10 +56773,17 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
56659
56773
  const edges = [];
56660
56774
  const semanticEdgeDigests = {};
56661
56775
  for (const [sourceId, wireFrom] of semanticEndpoints) {
56662
- const outs = store.outEdges(sourceId, [...INSTANCE_EDGES]).map((e) => ({ e, wireTo: semanticEndpoints.get(e.to) })).filter((x) => x.wireTo != null);
56776
+ const rawOuts = [
56777
+ ...store.outEdges(sourceId, [...INSTANCE_EDGES]),
56778
+ ...opts.sharedStore?.outEdges(sourceId, [...INSTANCE_EDGES]) ?? []
56779
+ ];
56780
+ const dedup = /* @__PURE__ */ new Map();
56781
+ for (const e of rawOuts) dedup.set(`${e.type}>${e.to}`, e);
56782
+ const outs = [...dedup.values()].map((e) => ({ e, wireTo: semanticEndpoints.get(e.to) })).filter((x) => x.wireTo != null);
56663
56783
  if (outs.length === 0) continue;
56664
56784
  const dg = digest(outs.map(({ e, wireTo }) => `${e.type}>${wireTo}`).sort());
56665
- if (store.getNode(sourceId)?.attrs["semanticEdgesContributedDigest"] === dg) continue;
56785
+ const owner = store.getNode(sourceId) ?? opts.sharedStore?.getNode(sourceId);
56786
+ if (owner?.attrs["semanticEdgesContributedDigest"] === dg) continue;
56666
56787
  semanticEdgeDigests[sourceId] = dg;
56667
56788
  for (const { e, wireTo } of outs) edges.push({ ...e, from: wireFrom, to: wireTo, attrs: {} });
56668
56789
  }
@@ -56827,7 +56948,7 @@ var ConsolidateWorker = class {
56827
56948
  init_paths();
56828
56949
 
56829
56950
  // src/lock.ts
56830
- import { existsSync as existsSync26, readFileSync as readFileSync25 } from "node:fs";
56951
+ import { existsSync as existsSync27, readFileSync as readFileSync26 } from "node:fs";
56831
56952
  function isProcessAlive(pid) {
56832
56953
  if (!pid || pid <= 0) return false;
56833
56954
  try {
@@ -56838,9 +56959,9 @@ function isProcessAlive(pid) {
56838
56959
  }
56839
56960
  }
56840
56961
  function readDaemonLock(lockPath) {
56841
- if (!existsSync26(lockPath)) return null;
56962
+ if (!existsSync27(lockPath)) return null;
56842
56963
  try {
56843
- const lock = JSON.parse(readFileSync25(lockPath, "utf8"));
56964
+ const lock = JSON.parse(readFileSync26(lockPath, "utf8"));
56844
56965
  return typeof lock.pid === "number" ? lock : null;
56845
56966
  } catch {
56846
56967
  return null;
@@ -57124,12 +57245,12 @@ async function reanchorProject(opts) {
57124
57245
  }
57125
57246
 
57126
57247
  // src/adopt.ts
57127
- import { existsSync as existsSync27 } from "node:fs";
57128
- import { dirname as dirname10, join as join30 } from "node:path";
57248
+ import { existsSync as existsSync28 } from "node:fs";
57249
+ import { dirname as dirname10, join as join31 } from "node:path";
57129
57250
  function findGitRoot(absPath) {
57130
57251
  let dir = absPath;
57131
57252
  for (let depth = 0; depth < 64; depth++) {
57132
- if (existsSync27(join30(dir, ".git"))) return dir;
57253
+ if (existsSync28(join31(dir, ".git"))) return dir;
57133
57254
  const parent = dirname10(dir);
57134
57255
  if (parent === dir) return null;
57135
57256
  dir = parent;
@@ -57978,6 +58099,8 @@ async function startMultiDaemon(opts = {}) {
57978
58099
  }
57979
58100
  const instances = buildInstanceIngest(store, r.engine.profile, DAEMON_VERSION, ignore, {
57980
58101
  includePackages: cfg2.consent.contributePackages,
58102
+ workspaceRoot: r.root,
58103
+ sharedStore,
57981
58104
  ...lexicon ? { lexicon } : {},
57982
58105
  ...project ? { project } : {}
57983
58106
  });
@@ -58001,31 +58124,38 @@ async function startMultiDaemon(opts = {}) {
58001
58124
  const cloudIdByLocal = new Map(
58002
58125
  res.result.nodes.filter((rn) => rn.nodeId).map((rn) => [rn.canonicalId, rn.nodeId])
58003
58126
  );
58127
+ const owningStore = (id) => {
58128
+ const w = store.getNode(id);
58129
+ if (w) return { s: store, n: w };
58130
+ const sh = sharedStore.getNode(id);
58131
+ if (sh) return { s: sharedStore, n: sh };
58132
+ return null;
58133
+ };
58004
58134
  for (const n of instances.nodes) {
58005
- const local = store.getNode(n.id);
58006
- if (!local || !["Problem", "Solution", "RootCause"].includes(local.label)) continue;
58135
+ const owner = owningStore(n.id);
58136
+ if (!owner || !["Problem", "Solution", "RootCause"].includes(owner.n.label)) continue;
58007
58137
  if (blocked.has(n.id)) continue;
58008
58138
  const cloudNodeId = cloudIdByLocal.get(n.id);
58009
- store.updateNode(n.id, {
58139
+ owner.s.updateNode(n.id, {
58010
58140
  attrs: {
58011
- ...local.attrs,
58141
+ ...owner.n.attrs,
58012
58142
  contributedAtSeq: seq,
58013
58143
  ...cloudNodeId && cloudNodeId !== n.id ? { cloudNodeId } : {}
58014
58144
  }
58015
58145
  });
58016
58146
  }
58017
58147
  for (const [localId, dg] of Object.entries(instances.anchorDigests)) {
58018
- const local = store.getNode(localId);
58019
- if (!local) continue;
58020
- store.updateNode(localId, {
58021
- attrs: { ...local.attrs, anchorsContributedDigest: dg }
58148
+ const owner = owningStore(localId);
58149
+ if (!owner) continue;
58150
+ owner.s.updateNode(localId, {
58151
+ attrs: { ...owner.n.attrs, anchorsContributedDigest: dg }
58022
58152
  });
58023
58153
  }
58024
58154
  for (const [localId, dg] of Object.entries(instances.semanticEdgeDigests)) {
58025
- const local = store.getNode(localId);
58026
- if (!local) continue;
58027
- store.updateNode(localId, {
58028
- attrs: { ...local.attrs, semanticEdgesContributedDigest: dg }
58155
+ const owner = owningStore(localId);
58156
+ if (!owner) continue;
58157
+ owner.s.updateNode(localId, {
58158
+ attrs: { ...owner.n.attrs, semanticEdgesContributedDigest: dg }
58029
58159
  });
58030
58160
  }
58031
58161
  return res.accepted;
@@ -58124,7 +58254,7 @@ async function startMultiDaemon(opts = {}) {
58124
58254
  },
58125
58255
  async stop() {
58126
58256
  try {
58127
- const cur = readFileSync26(lockPath, "utf8");
58257
+ const cur = readFileSync27(lockPath, "utf8");
58128
58258
  if (JSON.parse(cur).pid === process.pid) unlinkSync3(lockPath);
58129
58259
  } catch {
58130
58260
  }
@@ -59147,21 +59277,21 @@ async function cmdInit() {
59147
59277
  if (!skipHooks) {
59148
59278
  console.log("");
59149
59279
  console.log("installing harness hooks...");
59150
- const { existsSync: existsSync29 } = await import("node:fs");
59151
- const { join: join32 } = await import("node:path");
59280
+ const { existsSync: existsSync30 } = await import("node:fs");
59281
+ const { join: join33 } = await import("node:path");
59152
59282
  try {
59153
59283
  await installClaudeHooks(port);
59154
59284
  } catch (err2) {
59155
59285
  console.warn(` \u26A0\uFE0F Claude hook install failed: ${err2 instanceof Error ? err2.message : err2}`);
59156
59286
  }
59157
- if (existsSync29(join32(ROOT, ".cursor"))) {
59287
+ if (existsSync30(join33(ROOT, ".cursor"))) {
59158
59288
  try {
59159
59289
  await installCursorMcpConfig();
59160
59290
  } catch (err2) {
59161
59291
  console.warn(` \u26A0\uFE0F Cursor MCP config failed: ${err2 instanceof Error ? err2.message : err2}`);
59162
59292
  }
59163
59293
  }
59164
- if (existsSync29(join32(ROOT, ".codex"))) {
59294
+ if (existsSync30(join33(ROOT, ".codex"))) {
59165
59295
  try {
59166
59296
  await installCodexHooks(port);
59167
59297
  } catch (err2) {
@@ -59318,9 +59448,9 @@ async function cmdStatus() {
59318
59448
  console.log(` stack: ${profile.stack.join(", ") || "(none)"}`);
59319
59449
  console.log(` languages: ${profile.languages.join(", ") || "(none)"}`);
59320
59450
  }
59321
- console.log(` graph db: ${existsSync28(paths.castalia) ? "yes" : "no"} (${paths.castalia})`);
59322
- console.log(` event log: ${existsSync28(paths.eventLog) ? "yes" : "no"} (${paths.eventLog})`);
59323
- if (existsSync28(paths.castalia)) {
59451
+ console.log(` graph db: ${existsSync29(paths.castalia) ? "yes" : "no"} (${paths.castalia})`);
59452
+ console.log(` event log: ${existsSync29(paths.eventLog) ? "yes" : "no"} (${paths.eventLog})`);
59453
+ if (existsSync29(paths.castalia)) {
59324
59454
  try {
59325
59455
  const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
59326
59456
  const store = openGraphStore2({ path: paths.castalia });
@@ -60001,11 +60131,11 @@ function cmdInstallationProfile(args2) {
60001
60131
  }
60002
60132
  async function cmdReview() {
60003
60133
  const paths = workspacePaths(ROOT);
60004
- if (!existsSync28(paths.reviewQueue)) {
60134
+ if (!existsSync29(paths.reviewQueue)) {
60005
60135
  console.log("(review queue empty)");
60006
60136
  return;
60007
60137
  }
60008
- const queue = JSON.parse(readFileSync27(paths.reviewQueue, "utf8"));
60138
+ const queue = JSON.parse(readFileSync28(paths.reviewQueue, "utf8"));
60009
60139
  if (queue.length === 0) {
60010
60140
  console.log("(review queue empty)");
60011
60141
  return;
@@ -60676,7 +60806,7 @@ async function gatherRepo(store, ws) {
60676
60806
  };
60677
60807
  }
60678
60808
  async function gatherReportData(generatedAt) {
60679
- const { existsSync: existsSync29 } = await import("node:fs");
60809
+ const { existsSync: existsSync30 } = await import("node:fs");
60680
60810
  const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
60681
60811
  const cfg = loadConfig();
60682
60812
  const outbound = cfg.consent.sync ? "auto" : "off";
@@ -60684,7 +60814,7 @@ async function gatherReportData(generatedAt) {
60684
60814
  for (const ws of listWorkspaces()) {
60685
60815
  if (ws.missing) continue;
60686
60816
  const dbPath = workspacePaths(ws.path).castalia;
60687
- if (!existsSync29(dbPath)) continue;
60817
+ if (!existsSync30(dbPath)) continue;
60688
60818
  let store = null;
60689
60819
  try {
60690
60820
  store = openGraphStore2({ path: dbPath });
@@ -60728,8 +60858,8 @@ async function cmdReport(args2) {
60728
60858
  const outDir = workspacePaths(ROOT).configDir;
60729
60859
  mkdirSync8(outDir, { recursive: true });
60730
60860
  const files = renderReport2(data, { includeFutureVerbs });
60731
- for (const f of files) writeFileSync23(join31(outDir, f.name), f.html, "utf8");
60732
- const indexPath = join31(outDir, "report.html");
60861
+ for (const f of files) writeFileSync23(join32(outDir, f.name), f.html, "utf8");
60862
+ const indexPath = join32(outDir, "report.html");
60733
60863
  console.log(`report \u2192 ${indexPath}`);
60734
60864
  console.log(
60735
60865
  ` ${data.repos.length} repo(s) \xB7 ${files.length} file(s) \xB7 ${data.rollup.nodes.toLocaleString("en-US")} nodes`
@@ -60847,15 +60977,15 @@ function hookRelayCommand(port, path2) {
60847
60977
  return process.platform === "win32" ? `cmd //c "curl -s --connect-timeout 1 --max-time 2 -X POST -H \\"Content-Type: application/json\\" --data-binary @- ${url2} 2>NUL || echo {}"` : `curl -s --connect-timeout 1 --max-time 2 -X POST -H 'Content-Type: application/json' --data-binary @- ${url2} 2>/dev/null || echo '{}'`;
60848
60978
  }
60849
60979
  async function installClaudeHooks(port) {
60850
- const { mkdirSync: mkdirSync8, existsSync: existsSync29, readFileSync: readFileSync28, writeFileSync: writeFileSync23 } = await import("node:fs");
60851
- const { join: join32 } = await import("node:path");
60852
- const dir = join32(ROOT, ".claude");
60853
- if (!existsSync29(dir)) mkdirSync8(dir, { recursive: true });
60854
- const file2 = join32(dir, "settings.json");
60980
+ const { mkdirSync: mkdirSync8, existsSync: existsSync30, readFileSync: readFileSync29, writeFileSync: writeFileSync23 } = await import("node:fs");
60981
+ const { join: join33 } = await import("node:path");
60982
+ const dir = join33(ROOT, ".claude");
60983
+ if (!existsSync30(dir)) mkdirSync8(dir, { recursive: true });
60984
+ const file2 = join33(dir, "settings.json");
60855
60985
  let settings = {};
60856
- if (existsSync29(file2)) {
60986
+ if (existsSync30(file2)) {
60857
60987
  try {
60858
- settings = JSON.parse(readFileSync28(file2, "utf8"));
60988
+ settings = JSON.parse(readFileSync29(file2, "utf8"));
60859
60989
  } catch {
60860
60990
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
60861
60991
  process.exit(2);
@@ -60904,7 +61034,7 @@ async function installClaudeHooks(port) {
60904
61034
  writeFileSync23(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
60905
61035
  console.log(`installed Claude Code hooks \u2192 ${file2}`);
60906
61036
  await installClaudeMcpConfig();
60907
- const claudeMd = join32(ROOT, "CLAUDE.md");
61037
+ const claudeMd = join33(ROOT, "CLAUDE.md");
60908
61038
  const recall = writeManagedBlock(claudeMd, { body: RECALL_FIRST_BLOCK });
60909
61039
  if (recall.kind === "collision") {
60910
61040
  console.warn(
@@ -60916,15 +61046,15 @@ async function installClaudeHooks(port) {
60916
61046
  console.log(` endpoint: http://127.0.0.1:${port}/api/hook`);
60917
61047
  }
60918
61048
  async function installClaudeMcpConfig() {
60919
- const { mkdirSync: mkdirSync8, existsSync: existsSync29, readFileSync: readFileSync28, writeFileSync: writeFileSync23 } = await import("node:fs");
60920
- const { join: join32, dirname: dirname11 } = await import("node:path");
60921
- const file2 = join32(ROOT, ".mcp.json");
61049
+ const { mkdirSync: mkdirSync8, existsSync: existsSync30, readFileSync: readFileSync29, writeFileSync: writeFileSync23 } = await import("node:fs");
61050
+ const { join: join33, dirname: dirname11 } = await import("node:path");
61051
+ const file2 = join33(ROOT, ".mcp.json");
60922
61052
  const dir = dirname11(file2);
60923
- if (!existsSync29(dir)) mkdirSync8(dir, { recursive: true });
61053
+ if (!existsSync30(dir)) mkdirSync8(dir, { recursive: true });
60924
61054
  let cfg = {};
60925
- if (existsSync29(file2)) {
61055
+ if (existsSync30(file2)) {
60926
61056
  try {
60927
- cfg = JSON.parse(readFileSync28(file2, "utf8"));
61057
+ cfg = JSON.parse(readFileSync29(file2, "utf8"));
60928
61058
  } catch {
60929
61059
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
60930
61060
  process.exit(2);
@@ -60938,15 +61068,15 @@ async function installClaudeMcpConfig() {
60938
61068
  console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses / show / similar`);
60939
61069
  }
60940
61070
  async function installCursorMcpConfig() {
60941
- const { mkdirSync: mkdirSync8, existsSync: existsSync29, readFileSync: readFileSync28, writeFileSync: writeFileSync23 } = await import("node:fs");
60942
- const { join: join32 } = await import("node:path");
60943
- const dir = join32(ROOT, ".cursor");
60944
- if (!existsSync29(dir)) mkdirSync8(dir, { recursive: true });
60945
- const file2 = join32(dir, "mcp.json");
61071
+ const { mkdirSync: mkdirSync8, existsSync: existsSync30, readFileSync: readFileSync29, writeFileSync: writeFileSync23 } = await import("node:fs");
61072
+ const { join: join33 } = await import("node:path");
61073
+ const dir = join33(ROOT, ".cursor");
61074
+ if (!existsSync30(dir)) mkdirSync8(dir, { recursive: true });
61075
+ const file2 = join33(dir, "mcp.json");
60946
61076
  let cfg = {};
60947
- if (existsSync29(file2)) {
61077
+ if (existsSync30(file2)) {
60948
61078
  try {
60949
- cfg = JSON.parse(readFileSync28(file2, "utf8"));
61079
+ cfg = JSON.parse(readFileSync29(file2, "utf8"));
60950
61080
  } catch {
60951
61081
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
60952
61082
  process.exit(2);
@@ -60962,16 +61092,16 @@ async function installCursorMcpConfig() {
60962
61092
  console.log(` \u26A0\uFE0F reload Cursor (Cmd/Ctrl-Shift-P \u2192 "Reload Window") to pick it up.`);
60963
61093
  }
60964
61094
  async function installCodexHooks(port) {
60965
- const { mkdirSync: mkdirSync8, existsSync: existsSync29, readFileSync: readFileSync28, writeFileSync: writeFileSync23 } = await import("node:fs");
60966
- const { join: join32 } = await import("node:path");
60967
- const dir = join32(ROOT, ".codex");
60968
- if (!existsSync29(dir)) mkdirSync8(dir, { recursive: true });
60969
- const file2 = join32(dir, "config.toml");
61095
+ const { mkdirSync: mkdirSync8, existsSync: existsSync30, readFileSync: readFileSync29, writeFileSync: writeFileSync23 } = await import("node:fs");
61096
+ const { join: join33 } = await import("node:path");
61097
+ const dir = join33(ROOT, ".codex");
61098
+ if (!existsSync30(dir)) mkdirSync8(dir, { recursive: true });
61099
+ const file2 = join33(dir, "config.toml");
60970
61100
  const BEGIN = `# >>> errata hooks (errata-managed)`;
60971
61101
  const END = `# <<< errata hooks`;
60972
61102
  let existing = "";
60973
- if (existsSync29(file2)) {
60974
- existing = readFileSync28(file2, "utf8");
61103
+ if (existsSync30(file2)) {
61104
+ existing = readFileSync29(file2, "utf8");
60975
61105
  const beginIdx = existing.indexOf(BEGIN);
60976
61106
  const endIdx = existing.indexOf(END);
60977
61107
  if (beginIdx >= 0 && endIdx > beginIdx) {
@@ -61336,7 +61466,7 @@ async function cmdDash(args2) {
61336
61466
  await yieldToLoop2();
61337
61467
  try {
61338
61468
  const items = selectDurableMemory(handle2.sharedStore, r.engine.profile);
61339
- const res = bleedRules(join31(r.root, ".claude", "rules"), items);
61469
+ const res = bleedRules(join32(r.root, ".claude", "rules"), items);
61340
61470
  if (res.written || res.pruned) {
61341
61471
  console.log(
61342
61472
  `[rules:${r.entry.name}] ${res.written} collective principle(s) \u2192 .claude/rules` + (res.pruned ? `, ${res.pruned} pruned` : "")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.548",
3
+ "version": "2.0.2-dev.556",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {