@neat.is/core 0.3.2 → 0.3.3
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-66Z5IEFY.js → chunk-ICFH326H.js} +2 -2
- package/dist/{chunk-FIXKIYNF.js → chunk-VABXPLDT.js} +457 -206
- package/dist/chunk-VABXPLDT.js.map +1 -0
- package/dist/cli.cjs +555 -309
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +24 -26
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +451 -221
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +2 -2
- package/dist/neatd.cjs +458 -228
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +2 -2
- package/dist/server.cjs +420 -190
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-FIXKIYNF.js.map +0 -1
- /package/dist/{chunk-66Z5IEFY.js.map → chunk-ICFH326H.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -21,7 +21,9 @@ import {
|
|
|
21
21
|
ensureCompatLoaded,
|
|
22
22
|
evaluateAllPolicies,
|
|
23
23
|
extractFromDirectory,
|
|
24
|
+
formatExtractionBanner,
|
|
24
25
|
getGraph,
|
|
26
|
+
isStrictExtractionEnabled,
|
|
25
27
|
listProjects,
|
|
26
28
|
loadGraphFromDisk,
|
|
27
29
|
loadPolicyFile,
|
|
@@ -31,11 +33,12 @@ import {
|
|
|
31
33
|
promoteFrontierNodes,
|
|
32
34
|
removeProject,
|
|
33
35
|
resetGraph,
|
|
36
|
+
retireEdgesByFile,
|
|
34
37
|
saveGraphToDisk,
|
|
35
38
|
setStatus,
|
|
36
39
|
startPersistLoop,
|
|
37
40
|
startStalenessLoop
|
|
38
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-VABXPLDT.js";
|
|
39
42
|
import {
|
|
40
43
|
startOtelGrpcReceiver
|
|
41
44
|
} from "./chunk-G3PDTGOW.js";
|
|
@@ -51,23 +54,6 @@ import { promises as fs4 } from "fs";
|
|
|
51
54
|
import fs from "fs";
|
|
52
55
|
import path from "path";
|
|
53
56
|
import chokidar from "chokidar";
|
|
54
|
-
|
|
55
|
-
// src/extract/retire.ts
|
|
56
|
-
import { Provenance } from "@neat.is/types";
|
|
57
|
-
function retireEdgesByFile(graph, file) {
|
|
58
|
-
const normalized = file.split("\\").join("/");
|
|
59
|
-
const toDrop = [];
|
|
60
|
-
graph.forEachEdge((id, attrs) => {
|
|
61
|
-
const edge = attrs;
|
|
62
|
-
if (edge.provenance !== Provenance.EXTRACTED) return;
|
|
63
|
-
if (!edge.evidence?.file) return;
|
|
64
|
-
if (edge.evidence.file === normalized) toDrop.push(id);
|
|
65
|
-
});
|
|
66
|
-
for (const id of toDrop) graph.dropEdge(id);
|
|
67
|
-
return toDrop.length;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/watch.ts
|
|
71
57
|
var ALL_PHASES = [
|
|
72
58
|
"services",
|
|
73
59
|
"aliases",
|
|
@@ -806,7 +792,7 @@ function renderPatch(sections) {
|
|
|
806
792
|
import { DivergenceTypeSchema } from "@neat.is/types";
|
|
807
793
|
|
|
808
794
|
// src/cli-client.ts
|
|
809
|
-
import { Provenance
|
|
795
|
+
import { Provenance } from "@neat.is/types";
|
|
810
796
|
var HttpError = class extends Error {
|
|
811
797
|
constructor(status, message, responseBody = "") {
|
|
812
798
|
super(message);
|
|
@@ -941,7 +927,7 @@ async function runBlastRadius(client, input) {
|
|
|
941
927
|
}
|
|
942
928
|
}
|
|
943
929
|
function formatBlastEntry(n) {
|
|
944
|
-
const tag = n.edgeProvenance ===
|
|
930
|
+
const tag = n.edgeProvenance === Provenance.STALE ? " [STALE \u2014 last seen too long ago]" : "";
|
|
945
931
|
return ` \u2022 ${n.nodeId} (distance ${n.distance}, ${n.edgeProvenance})${tag}`;
|
|
946
932
|
}
|
|
947
933
|
async function runDependencies(client, input) {
|
|
@@ -987,9 +973,9 @@ async function runObservedDependencies(client, input) {
|
|
|
987
973
|
const edges = await client.get(
|
|
988
974
|
projectPath(input.project, `/graph/edges/${encodeURIComponent(input.nodeId)}`)
|
|
989
975
|
);
|
|
990
|
-
const observed = edges.outbound.filter((e) => e.provenance ===
|
|
976
|
+
const observed = edges.outbound.filter((e) => e.provenance === Provenance.OBSERVED);
|
|
991
977
|
if (observed.length === 0) {
|
|
992
|
-
const hasExtracted = edges.outbound.some((e) => e.provenance ===
|
|
978
|
+
const hasExtracted = edges.outbound.some((e) => e.provenance === Provenance.EXTRACTED);
|
|
993
979
|
const note = hasExtracted ? " Static (EXTRACTED) dependencies exist but no runtime traffic has been seen \u2014 is OTel running?" : "";
|
|
994
980
|
return { summary: `No OBSERVED dependencies for ${input.nodeId}.${note}` };
|
|
995
981
|
}
|
|
@@ -997,7 +983,7 @@ async function runObservedDependencies(client, input) {
|
|
|
997
983
|
return {
|
|
998
984
|
summary: `${input.nodeId} has ${observed.length} runtime dependenc${observed.length === 1 ? "y" : "ies"} confirmed by OTel.`,
|
|
999
985
|
block: blockLines.join("\n"),
|
|
1000
|
-
provenance:
|
|
986
|
+
provenance: Provenance.OBSERVED
|
|
1001
987
|
};
|
|
1002
988
|
} catch (err) {
|
|
1003
989
|
if (err instanceof HttpError && err.status === 404) {
|
|
@@ -1051,7 +1037,7 @@ async function runIncidents(client, input) {
|
|
|
1051
1037
|
return {
|
|
1052
1038
|
summary: `${target} has ${body.total} recorded incident${body.total === 1 ? "" : "s"}; showing the ${ordered.length} most recent.`,
|
|
1053
1039
|
block: blockLines.join("\n"),
|
|
1054
|
-
provenance:
|
|
1040
|
+
provenance: Provenance.OBSERVED
|
|
1055
1041
|
};
|
|
1056
1042
|
} catch (err) {
|
|
1057
1043
|
if (err instanceof HttpError && err.status === 404) {
|
|
@@ -1160,7 +1146,7 @@ async function runStaleEdges(client, input) {
|
|
|
1160
1146
|
return {
|
|
1161
1147
|
summary: `${events.length} stale-edge transition${events.length === 1 ? "" : "s"} recorded${input.edgeType ? ` for ${input.edgeType}` : ""}.`,
|
|
1162
1148
|
block: blockLines.join("\n"),
|
|
1163
|
-
provenance:
|
|
1149
|
+
provenance: Provenance.STALE
|
|
1164
1150
|
};
|
|
1165
1151
|
}
|
|
1166
1152
|
async function runPolicies(client, input) {
|
|
@@ -1569,7 +1555,12 @@ async function runInit(opts) {
|
|
|
1569
1555
|
const graphKey = opts.projectExplicit ? opts.project : DEFAULT_PROJECT;
|
|
1570
1556
|
resetGraph(graphKey);
|
|
1571
1557
|
const graph = getGraph(graphKey);
|
|
1572
|
-
const
|
|
1558
|
+
const projectPaths = pathsForProject(
|
|
1559
|
+
graphKey,
|
|
1560
|
+
path4.join(opts.scanPath, "neat-out")
|
|
1561
|
+
);
|
|
1562
|
+
const errorsPath = path4.join(path4.dirname(opts.outPath), path4.basename(projectPaths.errorsPath));
|
|
1563
|
+
const result = await extractFromDirectory(graph, opts.scanPath, { errorsPath });
|
|
1573
1564
|
await saveGraphToDisk(graph, opts.outPath);
|
|
1574
1565
|
written.push(opts.outPath);
|
|
1575
1566
|
const languages = [...new Set(services.map((s) => s.node.language))].sort();
|
|
@@ -1614,6 +1605,10 @@ async function runInit(opts) {
|
|
|
1614
1605
|
console.log(`added: ${result.nodesAdded} nodes, ${result.edgesAdded} edges`);
|
|
1615
1606
|
console.log(`total: ${graph.order} nodes, ${graph.size} edges`);
|
|
1616
1607
|
console.log(summarise(nodes, edges));
|
|
1608
|
+
console.log(formatExtractionBanner(result.extractionErrors));
|
|
1609
|
+
if (result.extractionErrors > 0) {
|
|
1610
|
+
console.log(`errors: ${errorsPath}`);
|
|
1611
|
+
}
|
|
1617
1612
|
const incompatibilities = findIncompatibilities(nodes);
|
|
1618
1613
|
if (incompatibilities.length > 0) {
|
|
1619
1614
|
console.log("");
|
|
@@ -1624,6 +1619,9 @@ async function runInit(opts) {
|
|
|
1624
1619
|
}
|
|
1625
1620
|
}
|
|
1626
1621
|
}
|
|
1622
|
+
if (result.extractionErrors > 0 && isStrictExtractionEnabled()) {
|
|
1623
|
+
return { exitCode: 4, writtenFiles: written };
|
|
1624
|
+
}
|
|
1627
1625
|
return { exitCode: 0, writtenFiles: written };
|
|
1628
1626
|
}
|
|
1629
1627
|
var CLAUDE_SKILL_CONFIG = {
|