@neat.is/core 0.10.4 → 0.10.5-dev.20261002
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/dist/{chunk-TUGYIRUT.js → chunk-HHAPD6JD.js} +32 -6
- package/dist/chunk-HHAPD6JD.js.map +1 -0
- package/dist/{chunk-2OQVIBZZ.js → chunk-TONL5O2E.js} +4 -4
- package/dist/chunk-TONL5O2E.js.map +1 -0
- package/dist/cli.cjs +154 -28
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +125 -25
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +33 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/neatd.cjs +33 -7
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +2 -2
- package/dist/server.cjs +31 -5
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-2OQVIBZZ.js.map +0 -1
- package/dist/chunk-TUGYIRUT.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3399,6 +3399,10 @@ function languageForPath(relPath) {
|
|
|
3399
3399
|
return void 0;
|
|
3400
3400
|
}
|
|
3401
3401
|
}
|
|
3402
|
+
var currentSource;
|
|
3403
|
+
function setExtractionSource(source) {
|
|
3404
|
+
currentSource = source;
|
|
3405
|
+
}
|
|
3402
3406
|
function ensureFileNode(graph, serviceName, serviceNodeId, relPath) {
|
|
3403
3407
|
let nodesAdded = 0;
|
|
3404
3408
|
let edgesAdded = 0;
|
|
@@ -3411,10 +3415,16 @@ function ensureFileNode(graph, serviceName, serviceNodeId, relPath) {
|
|
|
3411
3415
|
service: serviceName,
|
|
3412
3416
|
path: relPath,
|
|
3413
3417
|
...language ? { language } : {},
|
|
3418
|
+
...currentSource ? { source: currentSource } : {},
|
|
3414
3419
|
discoveredVia: "static"
|
|
3415
3420
|
};
|
|
3416
3421
|
graph.addNode(fileNodeId, node);
|
|
3417
3422
|
nodesAdded++;
|
|
3423
|
+
} else if (currentSource) {
|
|
3424
|
+
const existing = graph.getNodeAttributes(fileNodeId);
|
|
3425
|
+
if (existing.source !== currentSource) {
|
|
3426
|
+
graph.replaceNodeAttributes(fileNodeId, { ...existing, source: currentSource });
|
|
3427
|
+
}
|
|
3418
3428
|
}
|
|
3419
3429
|
const containsId = (0, import_types4.extractedEdgeId)(serviceNodeId, fileNodeId, import_types4.EdgeType.CONTAINS);
|
|
3420
3430
|
if (!graph.hasEdge(containsId)) {
|
|
@@ -16475,10 +16485,12 @@ init_cjs_shims();
|
|
|
16475
16485
|
var import_node_fs33 = require("fs");
|
|
16476
16486
|
var import_node_path68 = __toESM(require("path"), 1);
|
|
16477
16487
|
var import_types58 = require("@neat.is/types");
|
|
16478
|
-
function dropOrphanedFileNodes(graph) {
|
|
16488
|
+
function dropOrphanedFileNodes(graph, source) {
|
|
16479
16489
|
const orphans = [];
|
|
16480
16490
|
graph.forEachNode((id, attrs) => {
|
|
16481
|
-
|
|
16491
|
+
const node = attrs;
|
|
16492
|
+
if (node.type !== import_types58.NodeType.FileNode) return;
|
|
16493
|
+
if (source && node.source !== source) return;
|
|
16482
16494
|
if (graph.inboundEdges(id).length === 0 && graph.outboundEdges(id).length === 0) {
|
|
16483
16495
|
orphans.push(id);
|
|
16484
16496
|
}
|
|
@@ -16486,12 +16498,23 @@ function dropOrphanedFileNodes(graph) {
|
|
|
16486
16498
|
for (const id of orphans) graph.dropNode(id);
|
|
16487
16499
|
return orphans.length;
|
|
16488
16500
|
}
|
|
16489
|
-
function
|
|
16501
|
+
function outOfScope(graph, edge, source) {
|
|
16502
|
+
if (!source) return false;
|
|
16503
|
+
for (const endpoint2 of [edge.source, edge.target]) {
|
|
16504
|
+
if (!graph.hasNode(endpoint2)) continue;
|
|
16505
|
+
const node = graph.getNodeAttributes(endpoint2);
|
|
16506
|
+
if (node.type !== import_types58.NodeType.FileNode) continue;
|
|
16507
|
+
return node.source !== source;
|
|
16508
|
+
}
|
|
16509
|
+
return false;
|
|
16510
|
+
}
|
|
16511
|
+
function retireExtractedEdgesByMissingFile(graph, scanPath, serviceDirs = [], source) {
|
|
16490
16512
|
const toDrop = [];
|
|
16491
16513
|
const bases = [scanPath, ...serviceDirs];
|
|
16492
16514
|
graph.forEachEdge((id, attrs) => {
|
|
16493
16515
|
const edge = attrs;
|
|
16494
16516
|
if (edge.provenance !== import_types58.Provenance.EXTRACTED) return;
|
|
16517
|
+
if (outOfScope(graph, edge, source)) return;
|
|
16495
16518
|
const evidenceFile = edge.evidence?.file;
|
|
16496
16519
|
if (!evidenceFile) return;
|
|
16497
16520
|
if (import_node_path68.default.isAbsolute(evidenceFile)) {
|
|
@@ -16502,7 +16525,7 @@ function retireExtractedEdgesByMissingFile(graph, scanPath, serviceDirs = []) {
|
|
|
16502
16525
|
if (!found) toDrop.push(id);
|
|
16503
16526
|
});
|
|
16504
16527
|
for (const id of toDrop) graph.dropEdge(id);
|
|
16505
|
-
dropOrphanedFileNodes(graph);
|
|
16528
|
+
dropOrphanedFileNodes(graph, source);
|
|
16506
16529
|
return toDrop.length;
|
|
16507
16530
|
}
|
|
16508
16531
|
|
|
@@ -16511,6 +16534,7 @@ async function extractFromDirectory(graph, scanPath, opts = {}) {
|
|
|
16511
16534
|
await ensureCompatLoaded();
|
|
16512
16535
|
drainExtractionErrors();
|
|
16513
16536
|
drainSkippedFiles();
|
|
16537
|
+
setExtractionSource(opts.source);
|
|
16514
16538
|
const services = await discoverServices(scanPath);
|
|
16515
16539
|
const phase1Nodes = addServiceNodes(graph, services);
|
|
16516
16540
|
await addServiceAliases(graph, scanPath, services);
|
|
@@ -16531,7 +16555,8 @@ async function extractFromDirectory(graph, scanPath, opts = {}) {
|
|
|
16531
16555
|
const ghostsRetired = retireExtractedEdgesByMissingFile(
|
|
16532
16556
|
graph,
|
|
16533
16557
|
scanPath,
|
|
16534
|
-
services.map((s) => s.dir)
|
|
16558
|
+
services.map((s) => s.dir),
|
|
16559
|
+
opts.source
|
|
16535
16560
|
);
|
|
16536
16561
|
const frontiersPromoted = promoteFrontierNodes(graph);
|
|
16537
16562
|
if (opts.onPolicyTrigger) await opts.onPolicyTrigger(graph);
|
|
@@ -16566,6 +16591,7 @@ async function extractFromDirectory(graph, scanPath, opts = {}) {
|
|
|
16566
16591
|
);
|
|
16567
16592
|
}
|
|
16568
16593
|
}
|
|
16594
|
+
setExtractionSource(void 0);
|
|
16569
16595
|
const result = {
|
|
16570
16596
|
nodesAdded: phase1Nodes + fileEnum.nodesAdded + symbolEnum.nodesAdded + importGraph.nodesAdded + symbolEdges.nodesAdded + actionPhase.nodesAdded + phase2.nodesAdded + phase3.nodesAdded + routePhase.nodesAdded + grpcPhase.nodesAdded + phase4.nodesAdded + tableEdges.nodesAdded + phase5.nodesAdded + zodPhase.nodesAdded + firestoreRulesPhase.nodesAdded,
|
|
16571
16597
|
edgesAdded: fileEnum.edgesAdded + symbolEnum.edgesAdded + importGraph.edgesAdded + symbolEdges.edgesAdded + actionPhase.edgesAdded + phase2.edgesAdded + phase3.edgesAdded + routePhase.edgesAdded + grpcPhase.edgesAdded + phase4.edgesAdded + tableEdges.edgesAdded + phase5.edgesAdded + zodPhase.edgesAdded + firestoreRulesPhase.edgesAdded,
|
|
@@ -24526,7 +24552,7 @@ async function syncOneRepo(r, input) {
|
|
|
24526
24552
|
await cpPostStatus(deps, r.owner, r.name, { syncStatus: "syncing", detail: "cloning" }).catch(() => {
|
|
24527
24553
|
});
|
|
24528
24554
|
await cloneRepo(r.cloneUrl, r.defaultBranch, dir);
|
|
24529
|
-
const extracted = await extract(graph, dir);
|
|
24555
|
+
const extracted = await extract(graph, dir, { source: label });
|
|
24530
24556
|
const nodes = extracted?.nodesAdded ?? 0;
|
|
24531
24557
|
const edges = extracted?.edgesAdded ?? 0;
|
|
24532
24558
|
await cpPostStatus(deps, r.owner, r.name, {
|
|
@@ -25309,7 +25335,7 @@ async function bootstrapProject(entry, connectors = [], neatHome3) {
|
|
|
25309
25335
|
await loadGraphFromDisk(graph, outPath);
|
|
25310
25336
|
const detachEvents = attachGraphToEventBus(graph, { project: entry.name });
|
|
25311
25337
|
try {
|
|
25312
|
-
await extractFromDirectory(graph, entry.path);
|
|
25338
|
+
await extractFromDirectory(graph, entry.path, { source: entry.name });
|
|
25313
25339
|
const stopPersist = startPersistLoop(graph, outPath, { exitOnSignal: false });
|
|
25314
25340
|
const stopStaleness = startStalenessLoop(graph, {
|
|
25315
25341
|
staleEventsPath: paths.staleEventsPath,
|