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

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 +193 -79
  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.554" : "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();
@@ -56827,7 +56940,7 @@ var ConsolidateWorker = class {
56827
56940
  init_paths();
56828
56941
 
56829
56942
  // src/lock.ts
56830
- import { existsSync as existsSync26, readFileSync as readFileSync25 } from "node:fs";
56943
+ import { existsSync as existsSync27, readFileSync as readFileSync26 } from "node:fs";
56831
56944
  function isProcessAlive(pid) {
56832
56945
  if (!pid || pid <= 0) return false;
56833
56946
  try {
@@ -56838,9 +56951,9 @@ function isProcessAlive(pid) {
56838
56951
  }
56839
56952
  }
56840
56953
  function readDaemonLock(lockPath) {
56841
- if (!existsSync26(lockPath)) return null;
56954
+ if (!existsSync27(lockPath)) return null;
56842
56955
  try {
56843
- const lock = JSON.parse(readFileSync25(lockPath, "utf8"));
56956
+ const lock = JSON.parse(readFileSync26(lockPath, "utf8"));
56844
56957
  return typeof lock.pid === "number" ? lock : null;
56845
56958
  } catch {
56846
56959
  return null;
@@ -57124,12 +57237,12 @@ async function reanchorProject(opts) {
57124
57237
  }
57125
57238
 
57126
57239
  // src/adopt.ts
57127
- import { existsSync as existsSync27 } from "node:fs";
57128
- import { dirname as dirname10, join as join30 } from "node:path";
57240
+ import { existsSync as existsSync28 } from "node:fs";
57241
+ import { dirname as dirname10, join as join31 } from "node:path";
57129
57242
  function findGitRoot(absPath) {
57130
57243
  let dir = absPath;
57131
57244
  for (let depth = 0; depth < 64; depth++) {
57132
- if (existsSync27(join30(dir, ".git"))) return dir;
57245
+ if (existsSync28(join31(dir, ".git"))) return dir;
57133
57246
  const parent = dirname10(dir);
57134
57247
  if (parent === dir) return null;
57135
57248
  dir = parent;
@@ -57978,6 +58091,7 @@ async function startMultiDaemon(opts = {}) {
57978
58091
  }
57979
58092
  const instances = buildInstanceIngest(store, r.engine.profile, DAEMON_VERSION, ignore, {
57980
58093
  includePackages: cfg2.consent.contributePackages,
58094
+ workspaceRoot: r.root,
57981
58095
  ...lexicon ? { lexicon } : {},
57982
58096
  ...project ? { project } : {}
57983
58097
  });
@@ -58124,7 +58238,7 @@ async function startMultiDaemon(opts = {}) {
58124
58238
  },
58125
58239
  async stop() {
58126
58240
  try {
58127
- const cur = readFileSync26(lockPath, "utf8");
58241
+ const cur = readFileSync27(lockPath, "utf8");
58128
58242
  if (JSON.parse(cur).pid === process.pid) unlinkSync3(lockPath);
58129
58243
  } catch {
58130
58244
  }
@@ -59147,21 +59261,21 @@ async function cmdInit() {
59147
59261
  if (!skipHooks) {
59148
59262
  console.log("");
59149
59263
  console.log("installing harness hooks...");
59150
- const { existsSync: existsSync29 } = await import("node:fs");
59151
- const { join: join32 } = await import("node:path");
59264
+ const { existsSync: existsSync30 } = await import("node:fs");
59265
+ const { join: join33 } = await import("node:path");
59152
59266
  try {
59153
59267
  await installClaudeHooks(port);
59154
59268
  } catch (err2) {
59155
59269
  console.warn(` \u26A0\uFE0F Claude hook install failed: ${err2 instanceof Error ? err2.message : err2}`);
59156
59270
  }
59157
- if (existsSync29(join32(ROOT, ".cursor"))) {
59271
+ if (existsSync30(join33(ROOT, ".cursor"))) {
59158
59272
  try {
59159
59273
  await installCursorMcpConfig();
59160
59274
  } catch (err2) {
59161
59275
  console.warn(` \u26A0\uFE0F Cursor MCP config failed: ${err2 instanceof Error ? err2.message : err2}`);
59162
59276
  }
59163
59277
  }
59164
- if (existsSync29(join32(ROOT, ".codex"))) {
59278
+ if (existsSync30(join33(ROOT, ".codex"))) {
59165
59279
  try {
59166
59280
  await installCodexHooks(port);
59167
59281
  } catch (err2) {
@@ -59318,9 +59432,9 @@ async function cmdStatus() {
59318
59432
  console.log(` stack: ${profile.stack.join(", ") || "(none)"}`);
59319
59433
  console.log(` languages: ${profile.languages.join(", ") || "(none)"}`);
59320
59434
  }
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)) {
59435
+ console.log(` graph db: ${existsSync29(paths.castalia) ? "yes" : "no"} (${paths.castalia})`);
59436
+ console.log(` event log: ${existsSync29(paths.eventLog) ? "yes" : "no"} (${paths.eventLog})`);
59437
+ if (existsSync29(paths.castalia)) {
59324
59438
  try {
59325
59439
  const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
59326
59440
  const store = openGraphStore2({ path: paths.castalia });
@@ -60001,11 +60115,11 @@ function cmdInstallationProfile(args2) {
60001
60115
  }
60002
60116
  async function cmdReview() {
60003
60117
  const paths = workspacePaths(ROOT);
60004
- if (!existsSync28(paths.reviewQueue)) {
60118
+ if (!existsSync29(paths.reviewQueue)) {
60005
60119
  console.log("(review queue empty)");
60006
60120
  return;
60007
60121
  }
60008
- const queue = JSON.parse(readFileSync27(paths.reviewQueue, "utf8"));
60122
+ const queue = JSON.parse(readFileSync28(paths.reviewQueue, "utf8"));
60009
60123
  if (queue.length === 0) {
60010
60124
  console.log("(review queue empty)");
60011
60125
  return;
@@ -60676,7 +60790,7 @@ async function gatherRepo(store, ws) {
60676
60790
  };
60677
60791
  }
60678
60792
  async function gatherReportData(generatedAt) {
60679
- const { existsSync: existsSync29 } = await import("node:fs");
60793
+ const { existsSync: existsSync30 } = await import("node:fs");
60680
60794
  const { openGraphStore: openGraphStore2 } = await Promise.resolve().then(() => (init_src5(), src_exports2));
60681
60795
  const cfg = loadConfig();
60682
60796
  const outbound = cfg.consent.sync ? "auto" : "off";
@@ -60684,7 +60798,7 @@ async function gatherReportData(generatedAt) {
60684
60798
  for (const ws of listWorkspaces()) {
60685
60799
  if (ws.missing) continue;
60686
60800
  const dbPath = workspacePaths(ws.path).castalia;
60687
- if (!existsSync29(dbPath)) continue;
60801
+ if (!existsSync30(dbPath)) continue;
60688
60802
  let store = null;
60689
60803
  try {
60690
60804
  store = openGraphStore2({ path: dbPath });
@@ -60728,8 +60842,8 @@ async function cmdReport(args2) {
60728
60842
  const outDir = workspacePaths(ROOT).configDir;
60729
60843
  mkdirSync8(outDir, { recursive: true });
60730
60844
  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");
60845
+ for (const f of files) writeFileSync23(join32(outDir, f.name), f.html, "utf8");
60846
+ const indexPath = join32(outDir, "report.html");
60733
60847
  console.log(`report \u2192 ${indexPath}`);
60734
60848
  console.log(
60735
60849
  ` ${data.repos.length} repo(s) \xB7 ${files.length} file(s) \xB7 ${data.rollup.nodes.toLocaleString("en-US")} nodes`
@@ -60847,15 +60961,15 @@ function hookRelayCommand(port, path2) {
60847
60961
  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
60962
  }
60849
60963
  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");
60964
+ const { mkdirSync: mkdirSync8, existsSync: existsSync30, readFileSync: readFileSync29, writeFileSync: writeFileSync23 } = await import("node:fs");
60965
+ const { join: join33 } = await import("node:path");
60966
+ const dir = join33(ROOT, ".claude");
60967
+ if (!existsSync30(dir)) mkdirSync8(dir, { recursive: true });
60968
+ const file2 = join33(dir, "settings.json");
60855
60969
  let settings = {};
60856
- if (existsSync29(file2)) {
60970
+ if (existsSync30(file2)) {
60857
60971
  try {
60858
- settings = JSON.parse(readFileSync28(file2, "utf8"));
60972
+ settings = JSON.parse(readFileSync29(file2, "utf8"));
60859
60973
  } catch {
60860
60974
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
60861
60975
  process.exit(2);
@@ -60904,7 +61018,7 @@ async function installClaudeHooks(port) {
60904
61018
  writeFileSync23(file2, JSON.stringify(settings, null, 2) + "\n", "utf8");
60905
61019
  console.log(`installed Claude Code hooks \u2192 ${file2}`);
60906
61020
  await installClaudeMcpConfig();
60907
- const claudeMd = join32(ROOT, "CLAUDE.md");
61021
+ const claudeMd = join33(ROOT, "CLAUDE.md");
60908
61022
  const recall = writeManagedBlock(claudeMd, { body: RECALL_FIRST_BLOCK });
60909
61023
  if (recall.kind === "collision") {
60910
61024
  console.warn(
@@ -60916,15 +61030,15 @@ async function installClaudeHooks(port) {
60916
61030
  console.log(` endpoint: http://127.0.0.1:${port}/api/hook`);
60917
61031
  }
60918
61032
  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");
61033
+ const { mkdirSync: mkdirSync8, existsSync: existsSync30, readFileSync: readFileSync29, writeFileSync: writeFileSync23 } = await import("node:fs");
61034
+ const { join: join33, dirname: dirname11 } = await import("node:path");
61035
+ const file2 = join33(ROOT, ".mcp.json");
60922
61036
  const dir = dirname11(file2);
60923
- if (!existsSync29(dir)) mkdirSync8(dir, { recursive: true });
61037
+ if (!existsSync30(dir)) mkdirSync8(dir, { recursive: true });
60924
61038
  let cfg = {};
60925
- if (existsSync29(file2)) {
61039
+ if (existsSync30(file2)) {
60926
61040
  try {
60927
- cfg = JSON.parse(readFileSync28(file2, "utf8"));
61041
+ cfg = JSON.parse(readFileSync29(file2, "utf8"));
60928
61042
  } catch {
60929
61043
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
60930
61044
  process.exit(2);
@@ -60938,15 +61052,15 @@ async function installClaudeMcpConfig() {
60938
61052
  console.log(` Tools: errata.search / locate / neighbors / callers_of / what_uses / show / similar`);
60939
61053
  }
60940
61054
  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");
61055
+ const { mkdirSync: mkdirSync8, existsSync: existsSync30, readFileSync: readFileSync29, writeFileSync: writeFileSync23 } = await import("node:fs");
61056
+ const { join: join33 } = await import("node:path");
61057
+ const dir = join33(ROOT, ".cursor");
61058
+ if (!existsSync30(dir)) mkdirSync8(dir, { recursive: true });
61059
+ const file2 = join33(dir, "mcp.json");
60946
61060
  let cfg = {};
60947
- if (existsSync29(file2)) {
61061
+ if (existsSync30(file2)) {
60948
61062
  try {
60949
- cfg = JSON.parse(readFileSync28(file2, "utf8"));
61063
+ cfg = JSON.parse(readFileSync29(file2, "utf8"));
60950
61064
  } catch {
60951
61065
  console.error(`refusing to overwrite invalid JSON at ${file2}`);
60952
61066
  process.exit(2);
@@ -60962,16 +61076,16 @@ async function installCursorMcpConfig() {
60962
61076
  console.log(` \u26A0\uFE0F reload Cursor (Cmd/Ctrl-Shift-P \u2192 "Reload Window") to pick it up.`);
60963
61077
  }
60964
61078
  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");
61079
+ const { mkdirSync: mkdirSync8, existsSync: existsSync30, readFileSync: readFileSync29, writeFileSync: writeFileSync23 } = await import("node:fs");
61080
+ const { join: join33 } = await import("node:path");
61081
+ const dir = join33(ROOT, ".codex");
61082
+ if (!existsSync30(dir)) mkdirSync8(dir, { recursive: true });
61083
+ const file2 = join33(dir, "config.toml");
60970
61084
  const BEGIN = `# >>> errata hooks (errata-managed)`;
60971
61085
  const END = `# <<< errata hooks`;
60972
61086
  let existing = "";
60973
- if (existsSync29(file2)) {
60974
- existing = readFileSync28(file2, "utf8");
61087
+ if (existsSync30(file2)) {
61088
+ existing = readFileSync29(file2, "utf8");
60975
61089
  const beginIdx = existing.indexOf(BEGIN);
60976
61090
  const endIdx = existing.indexOf(END);
60977
61091
  if (beginIdx >= 0 && endIdx > beginIdx) {
@@ -61336,7 +61450,7 @@ async function cmdDash(args2) {
61336
61450
  await yieldToLoop2();
61337
61451
  try {
61338
61452
  const items = selectDurableMemory(handle2.sharedStore, r.engine.profile);
61339
- const res = bleedRules(join31(r.root, ".claude", "rules"), items);
61453
+ const res = bleedRules(join32(r.root, ".claude", "rules"), items);
61340
61454
  if (res.written || res.pruned) {
61341
61455
  console.log(
61342
61456
  `[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.554",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {