MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / load

Function load

__tests__/cfml-inheritance-resolution.test.ts:36–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 };
35
36 const load = async () => {
37 const cg = await CodeGraph.init(dir, { silent: true });
38 await cg.indexAll();
39 const db = (cg as any).db.db;
40 const edges: { src: string; srcFile: string; tgt: string; tgtFile: string; kind: string }[] = db
41 .prepare(
42 `SELECT s.name src, s.file_path srcFile, t.name tgt, t.file_path tgtFile, e.kind kind
43 FROM edges e JOIN nodes s ON s.id = e.source JOIN nodes t ON t.id = e.target
44 WHERE e.kind IN ('extends', 'implements')`
45 )
46 .all();
47 cg.close?.();
48 return edges;
49 };
50 const has = (edges: any[], src: string, tgt: string, tgtFile: string, kind = 'extends') =>
51 edges.some((e) => e.src === src && e.tgt === tgt && e.tgtFile === tgtFile && e.kind === kind);
52

Calls 5

allMethod · 0.65
prepareMethod · 0.65
closeMethod · 0.65
initMethod · 0.45
indexAllMethod · 0.45

Tested by

no test coverage detected