@dreamtree-org/graphify 1.3.0 → 1.5.0
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-K322XB4U.js → chunk-7LTO76UD.js} +2 -1
- package/dist/chunk-7LTO76UD.js.map +1 -0
- package/dist/{chunk-UBXYMMXJ.js → chunk-EHMBINRV.js} +115 -102
- package/dist/chunk-EHMBINRV.js.map +1 -0
- package/dist/cli/index.cjs +19 -7
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/index.cjs +564 -108
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -17
- package/dist/index.d.ts +229 -17
- package/dist/index.js +442 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.cjs.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-K322XB4U.js.map +0 -1
- package/dist/chunk-UBXYMMXJ.js.map +0 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -1564,13 +1564,15 @@ var RelationSchema = import_zod.z.enum([
|
|
|
1564
1564
|
"references",
|
|
1565
1565
|
"contains",
|
|
1566
1566
|
"method",
|
|
1567
|
-
"re_exports"
|
|
1567
|
+
"re_exports",
|
|
1568
|
+
"follows"
|
|
1568
1569
|
]);
|
|
1569
1570
|
var GraphNodeSchema = import_zod.z.object({
|
|
1570
1571
|
id: import_zod.z.string().min(1, "node id must be non-empty"),
|
|
1571
1572
|
label: import_zod.z.string(),
|
|
1572
1573
|
sourceFile: import_zod.z.string(),
|
|
1573
|
-
sourceLocation: import_zod.z.string()
|
|
1574
|
+
sourceLocation: import_zod.z.string(),
|
|
1575
|
+
kind: import_zod.z.string().optional()
|
|
1574
1576
|
});
|
|
1575
1577
|
var GraphEdgeSchema = import_zod.z.object({
|
|
1576
1578
|
source: import_zod.z.string().min(1, "edge source must be non-empty"),
|
|
@@ -1618,16 +1620,27 @@ function buildGraph(extractions) {
|
|
|
1618
1620
|
const validated = extractions.map(
|
|
1619
1621
|
(extraction, index) => validateExtraction(extraction, `extraction #${index}`)
|
|
1620
1622
|
);
|
|
1623
|
+
mergeExtractionsInto(graph, validated);
|
|
1624
|
+
return graph;
|
|
1625
|
+
}
|
|
1626
|
+
function mergeExtractionsInto(graph, validated) {
|
|
1621
1627
|
const allNodes = validated.flatMap((extraction) => extraction.nodes);
|
|
1622
1628
|
const allEdges = validated.flatMap((extraction) => extraction.edges);
|
|
1623
1629
|
const sortedNodes = [...allNodes].sort((a, b) => a.id.localeCompare(b.id));
|
|
1624
1630
|
for (const node of sortedNodes) {
|
|
1625
|
-
|
|
1626
|
-
graph.addNode(node.id, {
|
|
1631
|
+
const attributes = {
|
|
1627
1632
|
label: node.label,
|
|
1628
1633
|
sourceFile: node.sourceFile,
|
|
1629
|
-
sourceLocation: node.sourceLocation
|
|
1630
|
-
|
|
1634
|
+
sourceLocation: node.sourceLocation,
|
|
1635
|
+
...node.kind !== void 0 ? { kind: node.kind } : {}
|
|
1636
|
+
};
|
|
1637
|
+
if (graph.hasNode(node.id)) {
|
|
1638
|
+
if (graph.getNodeAttribute(node.id, "sourceFile") === "<unknown>") {
|
|
1639
|
+
graph.mergeNodeAttributes(node.id, attributes);
|
|
1640
|
+
}
|
|
1641
|
+
continue;
|
|
1642
|
+
}
|
|
1643
|
+
graph.addNode(node.id, attributes);
|
|
1631
1644
|
}
|
|
1632
1645
|
const sortedEdges = [...allEdges].sort(
|
|
1633
1646
|
(a, b) => a.source.localeCompare(b.source) || a.target.localeCompare(b.target) || a.relation.localeCompare(b.relation)
|
|
@@ -1646,7 +1659,6 @@ function buildGraph(extractions) {
|
|
|
1646
1659
|
confidence: edge.confidence
|
|
1647
1660
|
});
|
|
1648
1661
|
}
|
|
1649
|
-
return graph;
|
|
1650
1662
|
}
|
|
1651
1663
|
|
|
1652
1664
|
// src/extractionCache.ts
|