@inerrata-corporation/errata 2.0.0-dev.66 → 2.0.0-dev.67
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 +44 -14
- package/package.json +1 -1
- package/pass-worker.mjs +43 -13
package/errata.mjs
CHANGED
|
@@ -27054,6 +27054,23 @@ function purgeWorkspaceCodeGraph(store, workspaceId2) {
|
|
|
27054
27054
|
edges: Math.max(0, edgesBefore - store.edgeCount())
|
|
27055
27055
|
};
|
|
27056
27056
|
}
|
|
27057
|
+
function isReExportBarrel(relPath) {
|
|
27058
|
+
return /(^|\/)index\.(ts|tsx|js|jsx|mjs|cjs)$/.test(relPath);
|
|
27059
|
+
}
|
|
27060
|
+
function graphExportMap(store, workspaceId2, relPath) {
|
|
27061
|
+
const out2 = /* @__PURE__ */ new Map();
|
|
27062
|
+
const fileId = fileNodeId(workspaceId2, relPath);
|
|
27063
|
+
if (!store.getNode(fileId)) return out2;
|
|
27064
|
+
for (const e of store.outEdges(fileId, ["DEFINES"])) {
|
|
27065
|
+
const n = store.getNode(e.to);
|
|
27066
|
+
if (!n || !EXPORTABLE_LABELS.has(n.label)) continue;
|
|
27067
|
+
if (n.attrs["workspaceId"] !== workspaceId2) continue;
|
|
27068
|
+
const name2 = n.attrs["name"] ?? n.description;
|
|
27069
|
+
if (!name2 || name2.startsWith("<") || name2.includes(":")) continue;
|
|
27070
|
+
if (!out2.has(name2)) out2.set(name2, n.id);
|
|
27071
|
+
}
|
|
27072
|
+
return out2;
|
|
27073
|
+
}
|
|
27057
27074
|
async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths, t = Date.now(), opts = {}) {
|
|
27058
27075
|
const emptyDelta = {
|
|
27059
27076
|
changedPaths: [],
|
|
@@ -27222,15 +27239,20 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
27222
27239
|
rootPath,
|
|
27223
27240
|
providers,
|
|
27224
27241
|
clean: false,
|
|
27225
|
-
now: t
|
|
27242
|
+
now: t,
|
|
27243
|
+
changedRelPaths
|
|
27226
27244
|
});
|
|
27227
27245
|
store.transaction(() => {
|
|
27246
|
+
const versionedAndFile = /* @__PURE__ */ new Set([...VERSIONED_LABELS, "File"]);
|
|
27228
27247
|
const ownedLive = [];
|
|
27229
|
-
for (const
|
|
27230
|
-
|
|
27231
|
-
|
|
27232
|
-
|
|
27233
|
-
|
|
27248
|
+
for (const n of store.nodesByRelPath([...changedRelPaths])) {
|
|
27249
|
+
if (n.attrs["workspaceId"] !== workspaceId2) continue;
|
|
27250
|
+
const rel = n.attrs["relPath"];
|
|
27251
|
+
if (typeof rel !== "string" || !changedRelPaths.has(rel)) continue;
|
|
27252
|
+
if (versionedAndFile.has(n.label)) {
|
|
27253
|
+
ownedLive.push(n.id);
|
|
27254
|
+
} else if (n.label === "Comment" && n.lastUpdatedAt < t) {
|
|
27255
|
+
store.closeNode(n.id, t);
|
|
27234
27256
|
}
|
|
27235
27257
|
}
|
|
27236
27258
|
for (const id of ownedLive) {
|
|
@@ -27244,12 +27266,6 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
27244
27266
|
}
|
|
27245
27267
|
}
|
|
27246
27268
|
}
|
|
27247
|
-
for (const n of store.findNodesByLabel("Comment")) {
|
|
27248
|
-
if (n.attrs["workspaceId"] !== workspaceId2) continue;
|
|
27249
|
-
const rel = n.attrs["relPath"];
|
|
27250
|
-
if (typeof rel !== "string" || !changedRelPaths.has(rel)) continue;
|
|
27251
|
-
if (n.lastUpdatedAt < t) store.closeNode(n.id, t);
|
|
27252
|
-
}
|
|
27253
27269
|
});
|
|
27254
27270
|
const continuations = [];
|
|
27255
27271
|
if (removedIds.length > 0 && addedIds.length > 0) {
|
|
@@ -27350,6 +27366,8 @@ async function runIndexer(store, opts) {
|
|
|
27350
27366
|
indexNow = opts.now ?? Date.now();
|
|
27351
27367
|
const ignores = /* @__PURE__ */ new Set([...DEFAULT_IGNORES, ...opts.ignoreDirs ?? []]);
|
|
27352
27368
|
const maxBytes = opts.maxFileBytes ?? 1024 * 1024;
|
|
27369
|
+
const scope = opts.changedRelPaths;
|
|
27370
|
+
const inScope = (relPath) => scope === void 0 || scope.has(relPath) || isReExportBarrel(relPath);
|
|
27353
27371
|
let perfLast = started2;
|
|
27354
27372
|
const perfFile = process.env["ERRATA_PERF"];
|
|
27355
27373
|
const perf = (label) => {
|
|
@@ -27396,6 +27414,7 @@ async function runIndexer(store, opts) {
|
|
|
27396
27414
|
upsertFolder(store, rootId, ".", opts.workspaceId, rootRel);
|
|
27397
27415
|
report.nodesEmitted++;
|
|
27398
27416
|
for (const f of files) {
|
|
27417
|
+
if (!inScope(f.relPath)) continue;
|
|
27399
27418
|
const segments = f.relPath.split(/[\\/]/).slice(0, -1);
|
|
27400
27419
|
let parentId = rootId;
|
|
27401
27420
|
let acc = "";
|
|
@@ -27429,6 +27448,10 @@ async function runIndexer(store, opts) {
|
|
|
27429
27448
|
report.filesSkipped++;
|
|
27430
27449
|
continue;
|
|
27431
27450
|
}
|
|
27451
|
+
if (!inScope(f.relPath)) {
|
|
27452
|
+
report.filesSkipped++;
|
|
27453
|
+
continue;
|
|
27454
|
+
}
|
|
27432
27455
|
let source;
|
|
27433
27456
|
try {
|
|
27434
27457
|
const st = statSync(f.absPath);
|
|
@@ -27480,6 +27503,12 @@ async function runIndexer(store, opts) {
|
|
|
27480
27503
|
}
|
|
27481
27504
|
exportsByFile.set(relPath, localExports);
|
|
27482
27505
|
}
|
|
27506
|
+
if (scope !== void 0) {
|
|
27507
|
+
for (const f of files) {
|
|
27508
|
+
if (inScope(f.relPath) || exportsByFile.has(f.relPath)) continue;
|
|
27509
|
+
exportsByFile.set(f.relPath, graphExportMap(store, opts.workspaceId, f.relPath));
|
|
27510
|
+
}
|
|
27511
|
+
}
|
|
27483
27512
|
const workspacePackages = /* @__PURE__ */ new Map();
|
|
27484
27513
|
for (const fileNode of files) {
|
|
27485
27514
|
if (fileNode.relPath !== "package.json" && !fileNode.relPath.endsWith("/package.json")) {
|
|
@@ -28133,7 +28162,7 @@ function upsertEdge(store, from, type, to, confidence, attrs = {}) {
|
|
|
28133
28162
|
};
|
|
28134
28163
|
store.mergeEdge(edge2);
|
|
28135
28164
|
}
|
|
28136
|
-
var DEFAULT_IGNORES, indexNow, VERSIONED_LABELS, KIND_TO_LABEL, INDEXER_OWNED_LABELS, REEXPORT_RE;
|
|
28165
|
+
var DEFAULT_IGNORES, indexNow, VERSIONED_LABELS, KIND_TO_LABEL, INDEXER_OWNED_LABELS, EXPORTABLE_LABELS, REEXPORT_RE;
|
|
28137
28166
|
var init_pipeline = __esm({
|
|
28138
28167
|
"../../packages/indexer/src/pipeline.ts"() {
|
|
28139
28168
|
"use strict";
|
|
@@ -28193,6 +28222,7 @@ var init_pipeline = __esm({
|
|
|
28193
28222
|
"Namespace",
|
|
28194
28223
|
"Property"
|
|
28195
28224
|
];
|
|
28225
|
+
EXPORTABLE_LABELS = /* @__PURE__ */ new Set(["Function", "Class", "Method", "Interface", "Const"]);
|
|
28196
28226
|
REEXPORT_RE = /^\s*export\s+(?:type\s+)?(\*|\{[^}]+\})\s+from\s+["']([^"']+)["']/gm;
|
|
28197
28227
|
}
|
|
28198
28228
|
});
|
|
@@ -42874,7 +42904,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
42874
42904
|
}
|
|
42875
42905
|
|
|
42876
42906
|
// src/engine.ts
|
|
42877
|
-
var DAEMON_VERSION = true ? "2.0.0-dev.
|
|
42907
|
+
var DAEMON_VERSION = true ? "2.0.0-dev.67" : "2.0.0-alpha.0";
|
|
42878
42908
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
42879
42909
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
42880
42910
|
var GIT_OP_MUTE_MS = 4e3;
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -15544,6 +15544,23 @@ function purgeWorkspaceCodeGraph(store2, workspaceId) {
|
|
|
15544
15544
|
edges: Math.max(0, edgesBefore - store2.edgeCount())
|
|
15545
15545
|
};
|
|
15546
15546
|
}
|
|
15547
|
+
function isReExportBarrel(relPath) {
|
|
15548
|
+
return /(^|\/)index\.(ts|tsx|js|jsx|mjs|cjs)$/.test(relPath);
|
|
15549
|
+
}
|
|
15550
|
+
function graphExportMap(store2, workspaceId, relPath) {
|
|
15551
|
+
const out2 = /* @__PURE__ */ new Map();
|
|
15552
|
+
const fileId = fileNodeId(workspaceId, relPath);
|
|
15553
|
+
if (!store2.getNode(fileId)) return out2;
|
|
15554
|
+
for (const e of store2.outEdges(fileId, ["DEFINES"])) {
|
|
15555
|
+
const n = store2.getNode(e.to);
|
|
15556
|
+
if (!n || !EXPORTABLE_LABELS.has(n.label)) continue;
|
|
15557
|
+
if (n.attrs["workspaceId"] !== workspaceId) continue;
|
|
15558
|
+
const name2 = n.attrs["name"] ?? n.description;
|
|
15559
|
+
if (!name2 || name2.startsWith("<") || name2.includes(":")) continue;
|
|
15560
|
+
if (!out2.has(name2)) out2.set(name2, n.id);
|
|
15561
|
+
}
|
|
15562
|
+
return out2;
|
|
15563
|
+
}
|
|
15547
15564
|
async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths, t = Date.now(), opts = {}) {
|
|
15548
15565
|
const emptyDelta = {
|
|
15549
15566
|
changedPaths: [],
|
|
@@ -15712,15 +15729,20 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15712
15729
|
rootPath,
|
|
15713
15730
|
providers,
|
|
15714
15731
|
clean: false,
|
|
15715
|
-
now: t
|
|
15732
|
+
now: t,
|
|
15733
|
+
changedRelPaths
|
|
15716
15734
|
});
|
|
15717
15735
|
store2.transaction(() => {
|
|
15736
|
+
const versionedAndFile = /* @__PURE__ */ new Set([...VERSIONED_LABELS, "File"]);
|
|
15718
15737
|
const ownedLive = [];
|
|
15719
|
-
for (const
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15738
|
+
for (const n of store2.nodesByRelPath([...changedRelPaths])) {
|
|
15739
|
+
if (n.attrs["workspaceId"] !== workspaceId) continue;
|
|
15740
|
+
const rel = n.attrs["relPath"];
|
|
15741
|
+
if (typeof rel !== "string" || !changedRelPaths.has(rel)) continue;
|
|
15742
|
+
if (versionedAndFile.has(n.label)) {
|
|
15743
|
+
ownedLive.push(n.id);
|
|
15744
|
+
} else if (n.label === "Comment" && n.lastUpdatedAt < t) {
|
|
15745
|
+
store2.closeNode(n.id, t);
|
|
15724
15746
|
}
|
|
15725
15747
|
}
|
|
15726
15748
|
for (const id of ownedLive) {
|
|
@@ -15734,12 +15756,6 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15734
15756
|
}
|
|
15735
15757
|
}
|
|
15736
15758
|
}
|
|
15737
|
-
for (const n of store2.findNodesByLabel("Comment")) {
|
|
15738
|
-
if (n.attrs["workspaceId"] !== workspaceId) continue;
|
|
15739
|
-
const rel = n.attrs["relPath"];
|
|
15740
|
-
if (typeof rel !== "string" || !changedRelPaths.has(rel)) continue;
|
|
15741
|
-
if (n.lastUpdatedAt < t) store2.closeNode(n.id, t);
|
|
15742
|
-
}
|
|
15743
15759
|
});
|
|
15744
15760
|
const continuations = [];
|
|
15745
15761
|
if (removedIds.length > 0 && addedIds.length > 0) {
|
|
@@ -15840,6 +15856,8 @@ async function runIndexer(store2, opts) {
|
|
|
15840
15856
|
indexNow = opts.now ?? Date.now();
|
|
15841
15857
|
const ignores = /* @__PURE__ */ new Set([...DEFAULT_IGNORES, ...opts.ignoreDirs ?? []]);
|
|
15842
15858
|
const maxBytes = opts.maxFileBytes ?? 1024 * 1024;
|
|
15859
|
+
const scope = opts.changedRelPaths;
|
|
15860
|
+
const inScope = (relPath) => scope === void 0 || scope.has(relPath) || isReExportBarrel(relPath);
|
|
15843
15861
|
let perfLast = started;
|
|
15844
15862
|
const perfFile = process.env["ERRATA_PERF"];
|
|
15845
15863
|
const perf = (label) => {
|
|
@@ -15886,6 +15904,7 @@ async function runIndexer(store2, opts) {
|
|
|
15886
15904
|
upsertFolder(store2, rootId, ".", opts.workspaceId, rootRel);
|
|
15887
15905
|
report.nodesEmitted++;
|
|
15888
15906
|
for (const f of files) {
|
|
15907
|
+
if (!inScope(f.relPath)) continue;
|
|
15889
15908
|
const segments = f.relPath.split(/[\\/]/).slice(0, -1);
|
|
15890
15909
|
let parentId = rootId;
|
|
15891
15910
|
let acc = "";
|
|
@@ -15919,6 +15938,10 @@ async function runIndexer(store2, opts) {
|
|
|
15919
15938
|
report.filesSkipped++;
|
|
15920
15939
|
continue;
|
|
15921
15940
|
}
|
|
15941
|
+
if (!inScope(f.relPath)) {
|
|
15942
|
+
report.filesSkipped++;
|
|
15943
|
+
continue;
|
|
15944
|
+
}
|
|
15922
15945
|
let source;
|
|
15923
15946
|
try {
|
|
15924
15947
|
const st = statSync(f.absPath);
|
|
@@ -15970,6 +15993,12 @@ async function runIndexer(store2, opts) {
|
|
|
15970
15993
|
}
|
|
15971
15994
|
exportsByFile.set(relPath, localExports);
|
|
15972
15995
|
}
|
|
15996
|
+
if (scope !== void 0) {
|
|
15997
|
+
for (const f of files) {
|
|
15998
|
+
if (inScope(f.relPath) || exportsByFile.has(f.relPath)) continue;
|
|
15999
|
+
exportsByFile.set(f.relPath, graphExportMap(store2, opts.workspaceId, f.relPath));
|
|
16000
|
+
}
|
|
16001
|
+
}
|
|
15973
16002
|
const workspacePackages = /* @__PURE__ */ new Map();
|
|
15974
16003
|
for (const fileNode of files) {
|
|
15975
16004
|
if (fileNode.relPath !== "package.json" && !fileNode.relPath.endsWith("/package.json")) {
|
|
@@ -16623,7 +16652,7 @@ function upsertEdge(store2, from, type, to, confidence, attrs = {}) {
|
|
|
16623
16652
|
};
|
|
16624
16653
|
store2.mergeEdge(edge);
|
|
16625
16654
|
}
|
|
16626
|
-
var DEFAULT_IGNORES, indexNow, VERSIONED_LABELS, KIND_TO_LABEL, INDEXER_OWNED_LABELS, REEXPORT_RE;
|
|
16655
|
+
var DEFAULT_IGNORES, indexNow, VERSIONED_LABELS, KIND_TO_LABEL, INDEXER_OWNED_LABELS, EXPORTABLE_LABELS, REEXPORT_RE;
|
|
16627
16656
|
var init_pipeline = __esm({
|
|
16628
16657
|
"../../packages/indexer/src/pipeline.ts"() {
|
|
16629
16658
|
"use strict";
|
|
@@ -16683,6 +16712,7 @@ var init_pipeline = __esm({
|
|
|
16683
16712
|
"Namespace",
|
|
16684
16713
|
"Property"
|
|
16685
16714
|
];
|
|
16715
|
+
EXPORTABLE_LABELS = /* @__PURE__ */ new Set(["Function", "Class", "Method", "Interface", "Const"]);
|
|
16686
16716
|
REEXPORT_RE = /^\s*export\s+(?:type\s+)?(\*|\{[^}]+\})\s+from\s+["']([^"']+)["']/gm;
|
|
16687
16717
|
}
|
|
16688
16718
|
});
|