@inerrata-corporation/errata 2.0.2-dev.633 → 2.0.2-dev.635
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 +78 -20
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -27529,10 +27529,15 @@ function buildSymbolLexicon(store, summariesByBodyHash2) {
|
|
|
27529
27529
|
}
|
|
27530
27530
|
return lex;
|
|
27531
27531
|
}
|
|
27532
|
+
function isBareMatchableStem(stem) {
|
|
27533
|
+
return stem.length >= 5 && /^[A-Za-z0-9]+(?:[-_][A-Za-z0-9]+)+$/.test(stem);
|
|
27534
|
+
}
|
|
27532
27535
|
function buildFileLexicon(store) {
|
|
27533
27536
|
const byKey = /* @__PURE__ */ new Map();
|
|
27534
27537
|
const byBasename = /* @__PURE__ */ new Map();
|
|
27538
|
+
const byStem = /* @__PURE__ */ new Map();
|
|
27535
27539
|
const basenameCount = /* @__PURE__ */ new Map();
|
|
27540
|
+
const stemRelPaths = /* @__PURE__ */ new Map();
|
|
27536
27541
|
const entries = [];
|
|
27537
27542
|
for (const n of store.findNodesByLabel("File")) {
|
|
27538
27543
|
const relPath = typeof n.attrs["relPath"] === "string" && n.attrs["relPath"].length > 0 ? n.attrs["relPath"] : n.description;
|
|
@@ -27541,6 +27546,12 @@ function buildFileLexicon(store) {
|
|
|
27541
27546
|
if (!basename5.includes(".")) continue;
|
|
27542
27547
|
entries.push({ relPath, basename: basename5 });
|
|
27543
27548
|
basenameCount.set(basename5, (basenameCount.get(basename5) ?? 0) + 1);
|
|
27549
|
+
const stem = basename5.slice(0, basename5.indexOf("."));
|
|
27550
|
+
if (isBareMatchableStem(stem)) {
|
|
27551
|
+
let s = stemRelPaths.get(stem);
|
|
27552
|
+
if (!s) stemRelPaths.set(stem, s = /* @__PURE__ */ new Set());
|
|
27553
|
+
s.add(relPath);
|
|
27554
|
+
}
|
|
27544
27555
|
}
|
|
27545
27556
|
for (const { relPath, basename: basename5 } of entries) {
|
|
27546
27557
|
const entry = { relPath };
|
|
@@ -27550,8 +27561,18 @@ function buildFileLexicon(store) {
|
|
|
27550
27561
|
const list = byBasename.get(basename5);
|
|
27551
27562
|
if (list) list.push(entry);
|
|
27552
27563
|
else byBasename.set(basename5, [entry]);
|
|
27564
|
+
const stem = basename5.slice(0, basename5.indexOf("."));
|
|
27565
|
+
if (isBareMatchableStem(stem) && !CONVENTION_STEMS.has(stem) && !byStem.has(stem)) {
|
|
27566
|
+
const dirStems = new Set(
|
|
27567
|
+
[...stemRelPaths.get(stem) ?? []].map((p) => {
|
|
27568
|
+
const bn = p.split("/").pop();
|
|
27569
|
+
return p.slice(0, p.length - bn.length) + bn.slice(0, bn.indexOf("."));
|
|
27570
|
+
})
|
|
27571
|
+
);
|
|
27572
|
+
if (dirStems.size === 1) byStem.set(stem, entry);
|
|
27573
|
+
}
|
|
27553
27574
|
}
|
|
27554
|
-
return { byKey, byBasename };
|
|
27575
|
+
return { byKey, byBasename, byStem };
|
|
27555
27576
|
}
|
|
27556
27577
|
function resolveFileToken(token, lexicon) {
|
|
27557
27578
|
const exact = lexicon.byKey.get(token);
|
|
@@ -27582,24 +27603,40 @@ function fileRolePhrase(relPath, level = 1) {
|
|
|
27582
27603
|
if (/\.(json|ya?ml|toml|env)$/i.test(relPath)) return "a config file";
|
|
27583
27604
|
return "a source file";
|
|
27584
27605
|
}
|
|
27585
|
-
function
|
|
27606
|
+
function generalizeFileRefs(text, fileLexicon, level = 1) {
|
|
27586
27607
|
let out2 = text;
|
|
27587
|
-
|
|
27588
|
-
|
|
27589
|
-
|
|
27590
|
-
|
|
27591
|
-
|
|
27592
|
-
|
|
27593
|
-
|
|
27594
|
-
|
|
27595
|
-
|
|
27596
|
-
|
|
27597
|
-
|
|
27598
|
-
|
|
27599
|
-
|
|
27600
|
-
|
|
27601
|
-
|
|
27608
|
+
const files = [];
|
|
27609
|
+
const seenFiles = /* @__PURE__ */ new Set();
|
|
27610
|
+
for (const m of out2.matchAll(FILE_TOKEN_RE)) {
|
|
27611
|
+
const tok = m[0];
|
|
27612
|
+
if (seenFiles.has(tok)) continue;
|
|
27613
|
+
seenFiles.add(tok);
|
|
27614
|
+
const entry = resolveFileToken(tok, fileLexicon);
|
|
27615
|
+
if (entry) files.push([tok, entry]);
|
|
27616
|
+
}
|
|
27617
|
+
files.sort((a, b) => b[0].length - a[0].length);
|
|
27618
|
+
for (const [tok, entry] of files) {
|
|
27619
|
+
const re = new RegExp(`(?<![\\w$/\\\\.-])${escapeRe4(tok)}(?![\\w$-])`, "g");
|
|
27620
|
+
out2 = out2.replace(re, fileRolePhrase(entry.relPath, level));
|
|
27621
|
+
}
|
|
27622
|
+
const stems = [];
|
|
27623
|
+
const seenStems = /* @__PURE__ */ new Set();
|
|
27624
|
+
for (const m of out2.matchAll(STEM_TOKEN_RE)) {
|
|
27625
|
+
const tok = m[0];
|
|
27626
|
+
if (seenStems.has(tok)) continue;
|
|
27627
|
+
seenStems.add(tok);
|
|
27628
|
+
const entry = fileLexicon.byStem.get(tok);
|
|
27629
|
+
if (entry) stems.push([tok, entry]);
|
|
27602
27630
|
}
|
|
27631
|
+
stems.sort((a, b) => b[0].length - a[0].length);
|
|
27632
|
+
for (const [tok, entry] of stems) {
|
|
27633
|
+
const re = new RegExp(`(?<![\\w$/\\\\.-])${escapeRe4(tok)}(?![\\w$/\\\\.-])`, "g");
|
|
27634
|
+
out2 = out2.replace(re, fileRolePhrase(entry.relPath, level));
|
|
27635
|
+
}
|
|
27636
|
+
return out2;
|
|
27637
|
+
}
|
|
27638
|
+
function generalizeSymbols(text, lexicon, level = 1, fileLexicon) {
|
|
27639
|
+
let out2 = fileLexicon ? generalizeFileRefs(text, fileLexicon, level) : text;
|
|
27603
27640
|
const present = [];
|
|
27604
27641
|
const seen = /* @__PURE__ */ new Set();
|
|
27605
27642
|
for (const m of out2.matchAll(TOKEN_RE3)) {
|
|
@@ -27618,7 +27655,7 @@ function generalizeSymbols(text, lexicon, level = 1, fileLexicon) {
|
|
|
27618
27655
|
}
|
|
27619
27656
|
return generalize(out2, { level }).text;
|
|
27620
27657
|
}
|
|
27621
|
-
var SYMBOL_LABELS2, KIND_PHRASE, RE_RESERVED2, escapeRe4, CONVENTION_FILENAMES, CONVENTION_BASENAME_MIN_FILES, FILE_TOKEN_RE, TOKEN_RE3;
|
|
27658
|
+
var SYMBOL_LABELS2, KIND_PHRASE, RE_RESERVED2, escapeRe4, CONVENTION_FILENAMES, CONVENTION_BASENAME_MIN_FILES, CONVENTION_STEMS, FILE_TOKEN_RE, STEM_TOKEN_RE, TOKEN_RE3;
|
|
27622
27659
|
var init_generalize_graph = __esm({
|
|
27623
27660
|
"src/generalize-graph.ts"() {
|
|
27624
27661
|
"use strict";
|
|
@@ -27667,7 +27704,27 @@ var init_generalize_graph = __esm({
|
|
|
27667
27704
|
"index.mjs"
|
|
27668
27705
|
]);
|
|
27669
27706
|
CONVENTION_BASENAME_MIN_FILES = 3;
|
|
27707
|
+
CONVENTION_STEMS = /* @__PURE__ */ new Set([
|
|
27708
|
+
"well-known",
|
|
27709
|
+
"read-only",
|
|
27710
|
+
"type-safe",
|
|
27711
|
+
"end-to-end",
|
|
27712
|
+
"fail-open",
|
|
27713
|
+
"fail-closed",
|
|
27714
|
+
"up-to-date",
|
|
27715
|
+
"server-side",
|
|
27716
|
+
"client-side",
|
|
27717
|
+
"cross-origin",
|
|
27718
|
+
"same-origin",
|
|
27719
|
+
"well-formed",
|
|
27720
|
+
"first-class",
|
|
27721
|
+
"in-memory",
|
|
27722
|
+
"single-page",
|
|
27723
|
+
"use-case",
|
|
27724
|
+
"out-of-band"
|
|
27725
|
+
]);
|
|
27670
27726
|
FILE_TOKEN_RE = /(?:[A-Za-z0-9_.-]+\/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*\.[A-Za-z0-9]+/g;
|
|
27727
|
+
STEM_TOKEN_RE = /[A-Za-z0-9]+(?:[-_][A-Za-z0-9]+)+/g;
|
|
27671
27728
|
TOKEN_RE3 = /[A-Za-z_$][A-Za-z0-9_$]*(?:\.[A-Za-z_$][A-Za-z0-9_$]*)*/g;
|
|
27672
27729
|
}
|
|
27673
27730
|
});
|
|
@@ -54908,7 +54965,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
54908
54965
|
}
|
|
54909
54966
|
|
|
54910
54967
|
// src/engine.ts
|
|
54911
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
54968
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.635" : "2.0.0-alpha.0";
|
|
54912
54969
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
54913
54970
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
54914
54971
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -57274,7 +57331,8 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
57274
57331
|
const fileLexicon = buildFileLexicon(store);
|
|
57275
57332
|
const shareable = (n) => {
|
|
57276
57333
|
const preserved = symbolIndex ? preservedSymbolsFor(n.description, symbolIndex) : [];
|
|
57277
|
-
const
|
|
57334
|
+
const fileScrubbed = generalizeFileRefs(n.description, fileLexicon, level);
|
|
57335
|
+
const shippedText = generalize(fileScrubbed, { level, project: projectIdentity }).text;
|
|
57278
57336
|
const internalSyms = internalSymbolsFor(shippedText, (t) => ownLexicon.has(t), symbolIndex);
|
|
57279
57337
|
const internalFiles = internalFilesFor(shippedText, fileLexicon);
|
|
57280
57338
|
const internal = [.../* @__PURE__ */ new Set([...internalFiles, ...internalSyms])].slice(
|