@inerrata-corporation/errata 2.0.0-dev.66 → 2.0.0-dev.68
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/consolidate-worker.mjs +23 -1
- package/errata.mjs +84 -18
- package/package.json +1 -1
- package/pass-worker.mjs +66 -14
package/consolidate-worker.mjs
CHANGED
|
@@ -15110,7 +15110,7 @@ var init_symbol_intent = __esm({
|
|
|
15110
15110
|
});
|
|
15111
15111
|
|
|
15112
15112
|
// ../../packages/shared/src/wire.ts
|
|
15113
|
-
var CLOUD_NODE_LABELS, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15113
|
+
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15114
15114
|
var init_wire = __esm({
|
|
15115
15115
|
"../../packages/shared/src/wire.ts"() {
|
|
15116
15116
|
"use strict";
|
|
@@ -15122,6 +15122,28 @@ var init_wire = __esm({
|
|
|
15122
15122
|
...SEMANTIC_NODE_LABELS,
|
|
15123
15123
|
...CONTEXT_NODE_LABELS
|
|
15124
15124
|
];
|
|
15125
|
+
CLOUD_WRITABLE_NODE_LABELS = [
|
|
15126
|
+
"Problem",
|
|
15127
|
+
"Solution",
|
|
15128
|
+
"RootCause",
|
|
15129
|
+
"Component",
|
|
15130
|
+
"Symptom",
|
|
15131
|
+
"Pattern",
|
|
15132
|
+
"Vulnerability",
|
|
15133
|
+
"Exploit",
|
|
15134
|
+
"Weakness",
|
|
15135
|
+
"Package",
|
|
15136
|
+
"OperatingSystem",
|
|
15137
|
+
"Language",
|
|
15138
|
+
"Domain",
|
|
15139
|
+
"Algorithm",
|
|
15140
|
+
"Paradigm",
|
|
15141
|
+
"DataStructure",
|
|
15142
|
+
"Triage",
|
|
15143
|
+
"Claim",
|
|
15144
|
+
"AntiPattern"
|
|
15145
|
+
];
|
|
15146
|
+
CLOUD_WRITABLE_NODE_LABEL_SET = new Set(CLOUD_WRITABLE_NODE_LABELS);
|
|
15125
15147
|
CLOUD_EDGE_TYPES = ALL_EDGE_TYPES.filter(
|
|
15126
15148
|
(e) => !CODE_EDGES.includes(e) && !GIT_EDGES.includes(e) && !BRIDGE_EDGES.includes(e)
|
|
15127
15149
|
);
|
package/errata.mjs
CHANGED
|
@@ -15365,6 +15365,9 @@ var init_symbol_intent = __esm({
|
|
|
15365
15365
|
});
|
|
15366
15366
|
|
|
15367
15367
|
// ../../packages/shared/src/wire.ts
|
|
15368
|
+
function isCloudWritableNodeLabel(label) {
|
|
15369
|
+
return CLOUD_WRITABLE_NODE_LABEL_SET.has(label);
|
|
15370
|
+
}
|
|
15368
15371
|
function provenanceBand(source) {
|
|
15369
15372
|
switch (source) {
|
|
15370
15373
|
case "agent-observed":
|
|
@@ -15413,7 +15416,7 @@ function summarizeIngestResult(r) {
|
|
|
15413
15416
|
...r.patternReconciliation ? { patternReconciliation: r.patternReconciliation } : {}
|
|
15414
15417
|
};
|
|
15415
15418
|
}
|
|
15416
|
-
var CLOUD_NODE_LABELS, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, MAX_NODES_PER_PAYLOAD, MAX_EDGES_PER_PAYLOAD, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15419
|
+
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, MAX_NODES_PER_PAYLOAD, MAX_EDGES_PER_PAYLOAD, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
15417
15420
|
var init_wire = __esm({
|
|
15418
15421
|
"../../packages/shared/src/wire.ts"() {
|
|
15419
15422
|
"use strict";
|
|
@@ -15425,6 +15428,28 @@ var init_wire = __esm({
|
|
|
15425
15428
|
...SEMANTIC_NODE_LABELS,
|
|
15426
15429
|
...CONTEXT_NODE_LABELS
|
|
15427
15430
|
];
|
|
15431
|
+
CLOUD_WRITABLE_NODE_LABELS = [
|
|
15432
|
+
"Problem",
|
|
15433
|
+
"Solution",
|
|
15434
|
+
"RootCause",
|
|
15435
|
+
"Component",
|
|
15436
|
+
"Symptom",
|
|
15437
|
+
"Pattern",
|
|
15438
|
+
"Vulnerability",
|
|
15439
|
+
"Exploit",
|
|
15440
|
+
"Weakness",
|
|
15441
|
+
"Package",
|
|
15442
|
+
"OperatingSystem",
|
|
15443
|
+
"Language",
|
|
15444
|
+
"Domain",
|
|
15445
|
+
"Algorithm",
|
|
15446
|
+
"Paradigm",
|
|
15447
|
+
"DataStructure",
|
|
15448
|
+
"Triage",
|
|
15449
|
+
"Claim",
|
|
15450
|
+
"AntiPattern"
|
|
15451
|
+
];
|
|
15452
|
+
CLOUD_WRITABLE_NODE_LABEL_SET = new Set(CLOUD_WRITABLE_NODE_LABELS);
|
|
15428
15453
|
CLOUD_EDGE_TYPES = ALL_EDGE_TYPES.filter(
|
|
15429
15454
|
(e) => !CODE_EDGES.includes(e) && !GIT_EDGES.includes(e) && !BRIDGE_EDGES.includes(e)
|
|
15430
15455
|
);
|
|
@@ -15575,6 +15600,7 @@ __export(src_exports, {
|
|
|
15575
15600
|
CAUSAL_PROTECT_EDGES: () => CAUSAL_PROTECT_EDGES,
|
|
15576
15601
|
CLOUD_EDGE_TYPES: () => CLOUD_EDGE_TYPES,
|
|
15577
15602
|
CLOUD_NODE_LABELS: () => CLOUD_NODE_LABELS,
|
|
15603
|
+
CLOUD_WRITABLE_NODE_LABELS: () => CLOUD_WRITABLE_NODE_LABELS,
|
|
15578
15604
|
CODE_EDGES: () => CODE_EDGES,
|
|
15579
15605
|
CODE_NODE_LABELS: () => CODE_NODE_LABELS,
|
|
15580
15606
|
CONCEPTUAL_EDGES: () => CONCEPTUAL_EDGES,
|
|
@@ -15628,6 +15654,7 @@ __export(src_exports, {
|
|
|
15628
15654
|
genericCanonicalId: () => genericCanonicalId,
|
|
15629
15655
|
identityId: () => identityId,
|
|
15630
15656
|
isCausalProtected: () => isCausalProtected,
|
|
15657
|
+
isCloudWritableNodeLabel: () => isCloudWritableNodeLabel,
|
|
15631
15658
|
isCodeLabel: () => isCodeLabel,
|
|
15632
15659
|
isContextLabel: () => isContextLabel,
|
|
15633
15660
|
isInferredSource: () => isInferredSource,
|
|
@@ -20727,7 +20754,10 @@ function sidecarForNodes(sidecar, nodes) {
|
|
|
20727
20754
|
return count > 0 ? filtered : void 0;
|
|
20728
20755
|
}
|
|
20729
20756
|
function toWirePayload(batch, runId) {
|
|
20730
|
-
const
|
|
20757
|
+
const droppedNodeIds = new Set(
|
|
20758
|
+
batch.nodes.filter((n) => !isCloudWritableNodeLabel(n.label)).map((n) => n.id)
|
|
20759
|
+
);
|
|
20760
|
+
const nodes = batch.nodes.filter((n) => !droppedNodeIds.has(n.id)).map((n) => ({
|
|
20731
20761
|
canonicalId: n.id,
|
|
20732
20762
|
label: n.label,
|
|
20733
20763
|
description: n.description,
|
|
@@ -20736,7 +20766,7 @@ function toWirePayload(batch, runId) {
|
|
|
20736
20766
|
attrs: n.attrs ?? {},
|
|
20737
20767
|
extractionSource: n.extractionSource
|
|
20738
20768
|
}));
|
|
20739
|
-
const edges = batch.edges.map((e) => {
|
|
20769
|
+
const edges = batch.edges.filter((e) => !droppedNodeIds.has(e.from) && !droppedNodeIds.has(e.to)).map((e) => {
|
|
20740
20770
|
const perContext = wirePerContext(e.attrs?.["perContext"]);
|
|
20741
20771
|
return {
|
|
20742
20772
|
fromCanonicalId: e.from,
|
|
@@ -27054,6 +27084,23 @@ function purgeWorkspaceCodeGraph(store, workspaceId2) {
|
|
|
27054
27084
|
edges: Math.max(0, edgesBefore - store.edgeCount())
|
|
27055
27085
|
};
|
|
27056
27086
|
}
|
|
27087
|
+
function isReExportBarrel(relPath) {
|
|
27088
|
+
return /(^|\/)index\.(ts|tsx|js|jsx|mjs|cjs)$/.test(relPath);
|
|
27089
|
+
}
|
|
27090
|
+
function graphExportMap(store, workspaceId2, relPath) {
|
|
27091
|
+
const out2 = /* @__PURE__ */ new Map();
|
|
27092
|
+
const fileId = fileNodeId(workspaceId2, relPath);
|
|
27093
|
+
if (!store.getNode(fileId)) return out2;
|
|
27094
|
+
for (const e of store.outEdges(fileId, ["DEFINES"])) {
|
|
27095
|
+
const n = store.getNode(e.to);
|
|
27096
|
+
if (!n || !EXPORTABLE_LABELS.has(n.label)) continue;
|
|
27097
|
+
if (n.attrs["workspaceId"] !== workspaceId2) continue;
|
|
27098
|
+
const name2 = n.attrs["name"] ?? n.description;
|
|
27099
|
+
if (!name2 || name2.startsWith("<") || name2.includes(":")) continue;
|
|
27100
|
+
if (!out2.has(name2)) out2.set(name2, n.id);
|
|
27101
|
+
}
|
|
27102
|
+
return out2;
|
|
27103
|
+
}
|
|
27057
27104
|
async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths, t = Date.now(), opts = {}) {
|
|
27058
27105
|
const emptyDelta = {
|
|
27059
27106
|
changedPaths: [],
|
|
@@ -27222,15 +27269,20 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
27222
27269
|
rootPath,
|
|
27223
27270
|
providers,
|
|
27224
27271
|
clean: false,
|
|
27225
|
-
now: t
|
|
27272
|
+
now: t,
|
|
27273
|
+
changedRelPaths
|
|
27226
27274
|
});
|
|
27227
27275
|
store.transaction(() => {
|
|
27276
|
+
const versionedAndFile = /* @__PURE__ */ new Set([...VERSIONED_LABELS, "File"]);
|
|
27228
27277
|
const ownedLive = [];
|
|
27229
|
-
for (const
|
|
27230
|
-
|
|
27231
|
-
|
|
27232
|
-
|
|
27233
|
-
|
|
27278
|
+
for (const n of store.nodesByRelPath([...changedRelPaths])) {
|
|
27279
|
+
if (n.attrs["workspaceId"] !== workspaceId2) continue;
|
|
27280
|
+
const rel = n.attrs["relPath"];
|
|
27281
|
+
if (typeof rel !== "string" || !changedRelPaths.has(rel)) continue;
|
|
27282
|
+
if (versionedAndFile.has(n.label)) {
|
|
27283
|
+
ownedLive.push(n.id);
|
|
27284
|
+
} else if (n.label === "Comment" && n.lastUpdatedAt < t) {
|
|
27285
|
+
store.closeNode(n.id, t);
|
|
27234
27286
|
}
|
|
27235
27287
|
}
|
|
27236
27288
|
for (const id of ownedLive) {
|
|
@@ -27244,12 +27296,6 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
|
|
|
27244
27296
|
}
|
|
27245
27297
|
}
|
|
27246
27298
|
}
|
|
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
27299
|
});
|
|
27254
27300
|
const continuations = [];
|
|
27255
27301
|
if (removedIds.length > 0 && addedIds.length > 0) {
|
|
@@ -27350,6 +27396,8 @@ async function runIndexer(store, opts) {
|
|
|
27350
27396
|
indexNow = opts.now ?? Date.now();
|
|
27351
27397
|
const ignores = /* @__PURE__ */ new Set([...DEFAULT_IGNORES, ...opts.ignoreDirs ?? []]);
|
|
27352
27398
|
const maxBytes = opts.maxFileBytes ?? 1024 * 1024;
|
|
27399
|
+
const scope = opts.changedRelPaths;
|
|
27400
|
+
const inScope = (relPath) => scope === void 0 || scope.has(relPath) || isReExportBarrel(relPath);
|
|
27353
27401
|
let perfLast = started2;
|
|
27354
27402
|
const perfFile = process.env["ERRATA_PERF"];
|
|
27355
27403
|
const perf = (label) => {
|
|
@@ -27396,6 +27444,7 @@ async function runIndexer(store, opts) {
|
|
|
27396
27444
|
upsertFolder(store, rootId, ".", opts.workspaceId, rootRel);
|
|
27397
27445
|
report.nodesEmitted++;
|
|
27398
27446
|
for (const f of files) {
|
|
27447
|
+
if (!inScope(f.relPath)) continue;
|
|
27399
27448
|
const segments = f.relPath.split(/[\\/]/).slice(0, -1);
|
|
27400
27449
|
let parentId = rootId;
|
|
27401
27450
|
let acc = "";
|
|
@@ -27429,6 +27478,10 @@ async function runIndexer(store, opts) {
|
|
|
27429
27478
|
report.filesSkipped++;
|
|
27430
27479
|
continue;
|
|
27431
27480
|
}
|
|
27481
|
+
if (!inScope(f.relPath)) {
|
|
27482
|
+
report.filesSkipped++;
|
|
27483
|
+
continue;
|
|
27484
|
+
}
|
|
27432
27485
|
let source;
|
|
27433
27486
|
try {
|
|
27434
27487
|
const st = statSync(f.absPath);
|
|
@@ -27480,6 +27533,12 @@ async function runIndexer(store, opts) {
|
|
|
27480
27533
|
}
|
|
27481
27534
|
exportsByFile.set(relPath, localExports);
|
|
27482
27535
|
}
|
|
27536
|
+
if (scope !== void 0) {
|
|
27537
|
+
for (const f of files) {
|
|
27538
|
+
if (inScope(f.relPath) || exportsByFile.has(f.relPath)) continue;
|
|
27539
|
+
exportsByFile.set(f.relPath, graphExportMap(store, opts.workspaceId, f.relPath));
|
|
27540
|
+
}
|
|
27541
|
+
}
|
|
27483
27542
|
const workspacePackages = /* @__PURE__ */ new Map();
|
|
27484
27543
|
for (const fileNode of files) {
|
|
27485
27544
|
if (fileNode.relPath !== "package.json" && !fileNode.relPath.endsWith("/package.json")) {
|
|
@@ -28133,7 +28192,7 @@ function upsertEdge(store, from, type, to, confidence, attrs = {}) {
|
|
|
28133
28192
|
};
|
|
28134
28193
|
store.mergeEdge(edge2);
|
|
28135
28194
|
}
|
|
28136
|
-
var DEFAULT_IGNORES, indexNow, VERSIONED_LABELS, KIND_TO_LABEL, INDEXER_OWNED_LABELS, REEXPORT_RE;
|
|
28195
|
+
var DEFAULT_IGNORES, indexNow, VERSIONED_LABELS, KIND_TO_LABEL, INDEXER_OWNED_LABELS, EXPORTABLE_LABELS, REEXPORT_RE;
|
|
28137
28196
|
var init_pipeline = __esm({
|
|
28138
28197
|
"../../packages/indexer/src/pipeline.ts"() {
|
|
28139
28198
|
"use strict";
|
|
@@ -28193,6 +28252,7 @@ var init_pipeline = __esm({
|
|
|
28193
28252
|
"Namespace",
|
|
28194
28253
|
"Property"
|
|
28195
28254
|
];
|
|
28255
|
+
EXPORTABLE_LABELS = /* @__PURE__ */ new Set(["Function", "Class", "Method", "Interface", "Const"]);
|
|
28196
28256
|
REEXPORT_RE = /^\s*export\s+(?:type\s+)?(\*|\{[^}]+\})\s+from\s+["']([^"']+)["']/gm;
|
|
28197
28257
|
}
|
|
28198
28258
|
});
|
|
@@ -37406,6 +37466,12 @@ async function flushOutbox(paths, client, store) {
|
|
|
37406
37466
|
}
|
|
37407
37467
|
try {
|
|
37408
37468
|
const res = await client.ingest(payload);
|
|
37469
|
+
if (res.accepted > 0) uploaded++;
|
|
37470
|
+
if (res.rejected > 0) {
|
|
37471
|
+
failed++;
|
|
37472
|
+
quarantine(abs, `semantic rejection (${res.rejected} item${res.rejected === 1 ? "" : "s"})`);
|
|
37473
|
+
continue;
|
|
37474
|
+
}
|
|
37409
37475
|
if (store && res.patternReconciliation) {
|
|
37410
37476
|
for (const [provId, canonId] of Object.entries(res.patternReconciliation)) {
|
|
37411
37477
|
const n = store.getNode(provId);
|
|
@@ -37417,7 +37483,7 @@ async function flushOutbox(paths, client, store) {
|
|
|
37417
37483
|
}
|
|
37418
37484
|
}
|
|
37419
37485
|
unlinkSync(abs);
|
|
37420
|
-
uploaded++;
|
|
37486
|
+
if (res.accepted === 0) uploaded++;
|
|
37421
37487
|
} catch (err2) {
|
|
37422
37488
|
failed++;
|
|
37423
37489
|
const status = err2.status;
|
|
@@ -42874,7 +42940,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
42874
42940
|
}
|
|
42875
42941
|
|
|
42876
42942
|
// src/engine.ts
|
|
42877
|
-
var DAEMON_VERSION = true ? "2.0.0-dev.
|
|
42943
|
+
var DAEMON_VERSION = true ? "2.0.0-dev.68" : "2.0.0-alpha.0";
|
|
42878
42944
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
42879
42945
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
42880
42946
|
var GIT_OP_MUTE_MS = 4e3;
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -14958,7 +14958,7 @@ var init_symbol_intent = __esm({
|
|
|
14958
14958
|
});
|
|
14959
14959
|
|
|
14960
14960
|
// ../../packages/shared/src/wire.ts
|
|
14961
|
-
var CLOUD_NODE_LABELS, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
14961
|
+
var CLOUD_NODE_LABELS, CLOUD_WRITABLE_NODE_LABELS, CLOUD_WRITABLE_NODE_LABEL_SET, CLOUD_EDGE_TYPES, INGEST_SOURCES, INGEST_EXTRACTION_SOURCES, CastaliaIngestNodeSchema, RouteContextCountWireSchema, CastaliaIngestEdgeSchema, SymbolSummarySidecarSchema, CastaliaIngestPayloadSchema;
|
|
14962
14962
|
var init_wire = __esm({
|
|
14963
14963
|
"../../packages/shared/src/wire.ts"() {
|
|
14964
14964
|
"use strict";
|
|
@@ -14970,6 +14970,28 @@ var init_wire = __esm({
|
|
|
14970
14970
|
...SEMANTIC_NODE_LABELS,
|
|
14971
14971
|
...CONTEXT_NODE_LABELS
|
|
14972
14972
|
];
|
|
14973
|
+
CLOUD_WRITABLE_NODE_LABELS = [
|
|
14974
|
+
"Problem",
|
|
14975
|
+
"Solution",
|
|
14976
|
+
"RootCause",
|
|
14977
|
+
"Component",
|
|
14978
|
+
"Symptom",
|
|
14979
|
+
"Pattern",
|
|
14980
|
+
"Vulnerability",
|
|
14981
|
+
"Exploit",
|
|
14982
|
+
"Weakness",
|
|
14983
|
+
"Package",
|
|
14984
|
+
"OperatingSystem",
|
|
14985
|
+
"Language",
|
|
14986
|
+
"Domain",
|
|
14987
|
+
"Algorithm",
|
|
14988
|
+
"Paradigm",
|
|
14989
|
+
"DataStructure",
|
|
14990
|
+
"Triage",
|
|
14991
|
+
"Claim",
|
|
14992
|
+
"AntiPattern"
|
|
14993
|
+
];
|
|
14994
|
+
CLOUD_WRITABLE_NODE_LABEL_SET = new Set(CLOUD_WRITABLE_NODE_LABELS);
|
|
14973
14995
|
CLOUD_EDGE_TYPES = ALL_EDGE_TYPES.filter(
|
|
14974
14996
|
(e) => !CODE_EDGES.includes(e) && !GIT_EDGES.includes(e) && !BRIDGE_EDGES.includes(e)
|
|
14975
14997
|
);
|
|
@@ -15544,6 +15566,23 @@ function purgeWorkspaceCodeGraph(store2, workspaceId) {
|
|
|
15544
15566
|
edges: Math.max(0, edgesBefore - store2.edgeCount())
|
|
15545
15567
|
};
|
|
15546
15568
|
}
|
|
15569
|
+
function isReExportBarrel(relPath) {
|
|
15570
|
+
return /(^|\/)index\.(ts|tsx|js|jsx|mjs|cjs)$/.test(relPath);
|
|
15571
|
+
}
|
|
15572
|
+
function graphExportMap(store2, workspaceId, relPath) {
|
|
15573
|
+
const out2 = /* @__PURE__ */ new Map();
|
|
15574
|
+
const fileId = fileNodeId(workspaceId, relPath);
|
|
15575
|
+
if (!store2.getNode(fileId)) return out2;
|
|
15576
|
+
for (const e of store2.outEdges(fileId, ["DEFINES"])) {
|
|
15577
|
+
const n = store2.getNode(e.to);
|
|
15578
|
+
if (!n || !EXPORTABLE_LABELS.has(n.label)) continue;
|
|
15579
|
+
if (n.attrs["workspaceId"] !== workspaceId) continue;
|
|
15580
|
+
const name2 = n.attrs["name"] ?? n.description;
|
|
15581
|
+
if (!name2 || name2.startsWith("<") || name2.includes(":")) continue;
|
|
15582
|
+
if (!out2.has(name2)) out2.set(name2, n.id);
|
|
15583
|
+
}
|
|
15584
|
+
return out2;
|
|
15585
|
+
}
|
|
15547
15586
|
async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths, t = Date.now(), opts = {}) {
|
|
15548
15587
|
const emptyDelta = {
|
|
15549
15588
|
changedPaths: [],
|
|
@@ -15712,15 +15751,20 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15712
15751
|
rootPath,
|
|
15713
15752
|
providers,
|
|
15714
15753
|
clean: false,
|
|
15715
|
-
now: t
|
|
15754
|
+
now: t,
|
|
15755
|
+
changedRelPaths
|
|
15716
15756
|
});
|
|
15717
15757
|
store2.transaction(() => {
|
|
15758
|
+
const versionedAndFile = /* @__PURE__ */ new Set([...VERSIONED_LABELS, "File"]);
|
|
15718
15759
|
const ownedLive = [];
|
|
15719
|
-
for (const
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15760
|
+
for (const n of store2.nodesByRelPath([...changedRelPaths])) {
|
|
15761
|
+
if (n.attrs["workspaceId"] !== workspaceId) continue;
|
|
15762
|
+
const rel = n.attrs["relPath"];
|
|
15763
|
+
if (typeof rel !== "string" || !changedRelPaths.has(rel)) continue;
|
|
15764
|
+
if (versionedAndFile.has(n.label)) {
|
|
15765
|
+
ownedLive.push(n.id);
|
|
15766
|
+
} else if (n.label === "Comment" && n.lastUpdatedAt < t) {
|
|
15767
|
+
store2.closeNode(n.id, t);
|
|
15724
15768
|
}
|
|
15725
15769
|
}
|
|
15726
15770
|
for (const id of ownedLive) {
|
|
@@ -15734,12 +15778,6 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
|
|
|
15734
15778
|
}
|
|
15735
15779
|
}
|
|
15736
15780
|
}
|
|
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
15781
|
});
|
|
15744
15782
|
const continuations = [];
|
|
15745
15783
|
if (removedIds.length > 0 && addedIds.length > 0) {
|
|
@@ -15840,6 +15878,8 @@ async function runIndexer(store2, opts) {
|
|
|
15840
15878
|
indexNow = opts.now ?? Date.now();
|
|
15841
15879
|
const ignores = /* @__PURE__ */ new Set([...DEFAULT_IGNORES, ...opts.ignoreDirs ?? []]);
|
|
15842
15880
|
const maxBytes = opts.maxFileBytes ?? 1024 * 1024;
|
|
15881
|
+
const scope = opts.changedRelPaths;
|
|
15882
|
+
const inScope = (relPath) => scope === void 0 || scope.has(relPath) || isReExportBarrel(relPath);
|
|
15843
15883
|
let perfLast = started;
|
|
15844
15884
|
const perfFile = process.env["ERRATA_PERF"];
|
|
15845
15885
|
const perf = (label) => {
|
|
@@ -15886,6 +15926,7 @@ async function runIndexer(store2, opts) {
|
|
|
15886
15926
|
upsertFolder(store2, rootId, ".", opts.workspaceId, rootRel);
|
|
15887
15927
|
report.nodesEmitted++;
|
|
15888
15928
|
for (const f of files) {
|
|
15929
|
+
if (!inScope(f.relPath)) continue;
|
|
15889
15930
|
const segments = f.relPath.split(/[\\/]/).slice(0, -1);
|
|
15890
15931
|
let parentId = rootId;
|
|
15891
15932
|
let acc = "";
|
|
@@ -15919,6 +15960,10 @@ async function runIndexer(store2, opts) {
|
|
|
15919
15960
|
report.filesSkipped++;
|
|
15920
15961
|
continue;
|
|
15921
15962
|
}
|
|
15963
|
+
if (!inScope(f.relPath)) {
|
|
15964
|
+
report.filesSkipped++;
|
|
15965
|
+
continue;
|
|
15966
|
+
}
|
|
15922
15967
|
let source;
|
|
15923
15968
|
try {
|
|
15924
15969
|
const st = statSync(f.absPath);
|
|
@@ -15970,6 +16015,12 @@ async function runIndexer(store2, opts) {
|
|
|
15970
16015
|
}
|
|
15971
16016
|
exportsByFile.set(relPath, localExports);
|
|
15972
16017
|
}
|
|
16018
|
+
if (scope !== void 0) {
|
|
16019
|
+
for (const f of files) {
|
|
16020
|
+
if (inScope(f.relPath) || exportsByFile.has(f.relPath)) continue;
|
|
16021
|
+
exportsByFile.set(f.relPath, graphExportMap(store2, opts.workspaceId, f.relPath));
|
|
16022
|
+
}
|
|
16023
|
+
}
|
|
15973
16024
|
const workspacePackages = /* @__PURE__ */ new Map();
|
|
15974
16025
|
for (const fileNode of files) {
|
|
15975
16026
|
if (fileNode.relPath !== "package.json" && !fileNode.relPath.endsWith("/package.json")) {
|
|
@@ -16623,7 +16674,7 @@ function upsertEdge(store2, from, type, to, confidence, attrs = {}) {
|
|
|
16623
16674
|
};
|
|
16624
16675
|
store2.mergeEdge(edge);
|
|
16625
16676
|
}
|
|
16626
|
-
var DEFAULT_IGNORES, indexNow, VERSIONED_LABELS, KIND_TO_LABEL, INDEXER_OWNED_LABELS, REEXPORT_RE;
|
|
16677
|
+
var DEFAULT_IGNORES, indexNow, VERSIONED_LABELS, KIND_TO_LABEL, INDEXER_OWNED_LABELS, EXPORTABLE_LABELS, REEXPORT_RE;
|
|
16627
16678
|
var init_pipeline = __esm({
|
|
16628
16679
|
"../../packages/indexer/src/pipeline.ts"() {
|
|
16629
16680
|
"use strict";
|
|
@@ -16683,6 +16734,7 @@ var init_pipeline = __esm({
|
|
|
16683
16734
|
"Namespace",
|
|
16684
16735
|
"Property"
|
|
16685
16736
|
];
|
|
16737
|
+
EXPORTABLE_LABELS = /* @__PURE__ */ new Set(["Function", "Class", "Method", "Interface", "Const"]);
|
|
16686
16738
|
REEXPORT_RE = /^\s*export\s+(?:type\s+)?(\*|\{[^}]+\})\s+from\s+["']([^"']+)["']/gm;
|
|
16687
16739
|
}
|
|
16688
16740
|
});
|