@inerrata-corporation/errata 2.0.2-dev.597 → 2.0.2-dev.600
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.
- package/errata.mjs +109 -6
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -27308,10 +27308,80 @@ function buildSymbolLexicon(store, summariesByBodyHash2) {
|
|
|
27308
27308
|
}
|
|
27309
27309
|
return lex;
|
|
27310
27310
|
}
|
|
27311
|
-
function
|
|
27311
|
+
function buildFileLexicon(store) {
|
|
27312
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
27313
|
+
const byBasename = /* @__PURE__ */ new Map();
|
|
27314
|
+
const basenameCount = /* @__PURE__ */ new Map();
|
|
27315
|
+
const entries = [];
|
|
27316
|
+
for (const n of store.findNodesByLabel("File")) {
|
|
27317
|
+
const relPath = typeof n.attrs["relPath"] === "string" && n.attrs["relPath"].length > 0 ? n.attrs["relPath"] : n.description;
|
|
27318
|
+
if (!relPath) continue;
|
|
27319
|
+
const basename5 = relPath.split("/").pop();
|
|
27320
|
+
if (!basename5.includes(".")) continue;
|
|
27321
|
+
entries.push({ relPath, basename: basename5 });
|
|
27322
|
+
basenameCount.set(basename5, (basenameCount.get(basename5) ?? 0) + 1);
|
|
27323
|
+
}
|
|
27324
|
+
for (const { relPath, basename: basename5 } of entries) {
|
|
27325
|
+
const entry = { relPath };
|
|
27326
|
+
if (relPath !== basename5) byKey.set(relPath, entry);
|
|
27327
|
+
const conventional = CONVENTION_FILENAMES.has(basename5) || (basenameCount.get(basename5) ?? 0) >= CONVENTION_BASENAME_MIN_FILES;
|
|
27328
|
+
if (!conventional && !byKey.has(basename5)) byKey.set(basename5, entry);
|
|
27329
|
+
const list = byBasename.get(basename5);
|
|
27330
|
+
if (list) list.push(entry);
|
|
27331
|
+
else byBasename.set(basename5, [entry]);
|
|
27332
|
+
}
|
|
27333
|
+
return { byKey, byBasename };
|
|
27334
|
+
}
|
|
27335
|
+
function resolveFileToken(token, lexicon) {
|
|
27336
|
+
const exact = lexicon.byKey.get(token);
|
|
27337
|
+
if (exact) return exact;
|
|
27338
|
+
if (!token.includes("/")) return null;
|
|
27339
|
+
const basename5 = token.split("/").pop();
|
|
27340
|
+
for (const entry of lexicon.byBasename.get(basename5) ?? []) {
|
|
27341
|
+
if (entry.relPath === token || entry.relPath.endsWith(`/${token}`)) return entry;
|
|
27342
|
+
}
|
|
27343
|
+
return null;
|
|
27344
|
+
}
|
|
27345
|
+
function internalFilesFor(description, lexicon) {
|
|
27346
|
+
const out2 = [];
|
|
27347
|
+
const seen = /* @__PURE__ */ new Set();
|
|
27348
|
+
for (const m of description.matchAll(FILE_TOKEN_RE)) {
|
|
27349
|
+
const tok = m[0];
|
|
27350
|
+
if (seen.has(tok)) continue;
|
|
27351
|
+
seen.add(tok);
|
|
27352
|
+
if (resolveFileToken(tok, lexicon)) out2.push(tok);
|
|
27353
|
+
}
|
|
27354
|
+
return out2;
|
|
27355
|
+
}
|
|
27356
|
+
function fileRolePhrase(relPath, level = 1) {
|
|
27357
|
+
if (level !== 1) return "a file";
|
|
27358
|
+
if (/\.(test|spec)\.|__tests__\/|(?:^|\/)e2e\//.test(relPath)) return "a test file";
|
|
27359
|
+
if (/(?:^|\/)scripts?\//.test(relPath)) return "a script";
|
|
27360
|
+
if (/\.md$/i.test(relPath)) return "a documentation file";
|
|
27361
|
+
if (/\.(json|ya?ml|toml|env)$/i.test(relPath)) return "a config file";
|
|
27362
|
+
return "a source file";
|
|
27363
|
+
}
|
|
27364
|
+
function generalizeSymbols(text, lexicon, level = 1, fileLexicon) {
|
|
27365
|
+
let out2 = text;
|
|
27366
|
+
if (fileLexicon) {
|
|
27367
|
+
const files = [];
|
|
27368
|
+
const seenFiles = /* @__PURE__ */ new Set();
|
|
27369
|
+
for (const m of out2.matchAll(FILE_TOKEN_RE)) {
|
|
27370
|
+
const tok = m[0];
|
|
27371
|
+
if (seenFiles.has(tok)) continue;
|
|
27372
|
+
seenFiles.add(tok);
|
|
27373
|
+
const entry = resolveFileToken(tok, fileLexicon);
|
|
27374
|
+
if (entry) files.push([tok, entry]);
|
|
27375
|
+
}
|
|
27376
|
+
files.sort((a, b) => b[0].length - a[0].length);
|
|
27377
|
+
for (const [tok, entry] of files) {
|
|
27378
|
+
const re = new RegExp(`(?<![\\w$/\\\\.-])${escapeRe4(tok)}(?![\\w$-])`, "g");
|
|
27379
|
+
out2 = out2.replace(re, fileRolePhrase(entry.relPath, level));
|
|
27380
|
+
}
|
|
27381
|
+
}
|
|
27312
27382
|
const present = [];
|
|
27313
27383
|
const seen = /* @__PURE__ */ new Set();
|
|
27314
|
-
for (const m of
|
|
27384
|
+
for (const m of out2.matchAll(TOKEN_RE3)) {
|
|
27315
27385
|
const tok = m[0];
|
|
27316
27386
|
if (!seen.has(tok) && lexicon.has(tok)) {
|
|
27317
27387
|
seen.add(tok);
|
|
@@ -27319,7 +27389,6 @@ function generalizeSymbols(text, lexicon, level = 1) {
|
|
|
27319
27389
|
}
|
|
27320
27390
|
}
|
|
27321
27391
|
present.sort((a, b) => b.length - a.length);
|
|
27322
|
-
let out2 = text;
|
|
27323
27392
|
for (const key of present) {
|
|
27324
27393
|
const entry = lexicon.get(key);
|
|
27325
27394
|
const phrase = level === 1 && entry.summary ? entry.summary : KIND_PHRASE[entry.kind][level === 1 ? "l1" : "l2"];
|
|
@@ -27328,7 +27397,7 @@ function generalizeSymbols(text, lexicon, level = 1) {
|
|
|
27328
27397
|
}
|
|
27329
27398
|
return generalize(out2, { level }).text;
|
|
27330
27399
|
}
|
|
27331
|
-
var SYMBOL_LABELS2, KIND_PHRASE, RE_RESERVED2, escapeRe4, TOKEN_RE3;
|
|
27400
|
+
var SYMBOL_LABELS2, KIND_PHRASE, RE_RESERVED2, escapeRe4, CONVENTION_FILENAMES, CONVENTION_BASENAME_MIN_FILES, FILE_TOKEN_RE, TOKEN_RE3;
|
|
27332
27401
|
var init_generalize_graph = __esm({
|
|
27333
27402
|
"src/generalize-graph.ts"() {
|
|
27334
27403
|
"use strict";
|
|
@@ -27350,6 +27419,34 @@ var init_generalize_graph = __esm({
|
|
|
27350
27419
|
};
|
|
27351
27420
|
RE_RESERVED2 = /[.*+?^${}()|[\]\\]/g;
|
|
27352
27421
|
escapeRe4 = (s) => s.replace(RE_RESERVED2, "\\$&");
|
|
27422
|
+
CONVENTION_FILENAMES = /* @__PURE__ */ new Set([
|
|
27423
|
+
"package.json",
|
|
27424
|
+
"package-lock.json",
|
|
27425
|
+
"pnpm-lock.yaml",
|
|
27426
|
+
"pnpm-workspace.yaml",
|
|
27427
|
+
"yarn.lock",
|
|
27428
|
+
"tsconfig.json",
|
|
27429
|
+
"tsconfig.base.json",
|
|
27430
|
+
"turbo.json",
|
|
27431
|
+
"README.md",
|
|
27432
|
+
"LICENSE",
|
|
27433
|
+
"CHANGELOG.md",
|
|
27434
|
+
"CONTRIBUTING.md",
|
|
27435
|
+
// agent-config conventions — as cross-repo universal as README.md by 2026
|
|
27436
|
+
"AGENTS.md",
|
|
27437
|
+
"CLAUDE.md",
|
|
27438
|
+
"Dockerfile",
|
|
27439
|
+
"docker-compose.yml",
|
|
27440
|
+
".gitignore",
|
|
27441
|
+
".env",
|
|
27442
|
+
".env.example",
|
|
27443
|
+
"index.ts",
|
|
27444
|
+
"index.js",
|
|
27445
|
+
"index.tsx",
|
|
27446
|
+
"index.mjs"
|
|
27447
|
+
]);
|
|
27448
|
+
CONVENTION_BASENAME_MIN_FILES = 3;
|
|
27449
|
+
FILE_TOKEN_RE = /(?:[A-Za-z0-9_.-]+\/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*\.[A-Za-z0-9]+/g;
|
|
27353
27450
|
TOKEN_RE3 = /[A-Za-z_$][A-Za-z0-9_$]*(?:\.[A-Za-z_$][A-Za-z0-9_$]*)*/g;
|
|
27354
27451
|
}
|
|
27355
27452
|
});
|
|
@@ -54462,7 +54559,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
54462
54559
|
}
|
|
54463
54560
|
|
|
54464
54561
|
// src/engine.ts
|
|
54465
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
54562
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.600" : "2.0.0-alpha.0";
|
|
54466
54563
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
54467
54564
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
54468
54565
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -56781,10 +56878,16 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
56781
56878
|
};
|
|
56782
56879
|
const symbolIndex = opts.workspaceRoot ? publicSymbolIndex(store, opts.workspaceRoot) : null;
|
|
56783
56880
|
const ownLexicon = buildSymbolLexicon(store);
|
|
56881
|
+
const fileLexicon = buildFileLexicon(store);
|
|
56784
56882
|
const shareable = (n) => {
|
|
56785
56883
|
const preserved = symbolIndex ? preservedSymbolsFor(n.description, symbolIndex) : [];
|
|
56786
56884
|
const shippedText = generalize(n.description, { level }).text;
|
|
56787
|
-
const
|
|
56885
|
+
const internalSyms = internalSymbolsFor(shippedText, (t) => ownLexicon.has(t), symbolIndex);
|
|
56886
|
+
const internalFiles = internalFilesFor(shippedText, fileLexicon);
|
|
56887
|
+
const internal = [.../* @__PURE__ */ new Set([...internalFiles, ...internalSyms])].slice(
|
|
56888
|
+
0,
|
|
56889
|
+
PRESERVED_SYMBOLS_CAP
|
|
56890
|
+
);
|
|
56788
56891
|
return {
|
|
56789
56892
|
...n,
|
|
56790
56893
|
description: shippedText,
|