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

Function load

__tests__/java-records.test.ts:48–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 };
47
48 const load = async () => {
49 const cg = await CodeGraph.init(dir, { silent: true });
50 await cg.indexAll();
51 const db = (cg as any).db.db;
52 const nodes: NodeRow[] = db
53 .prepare(`SELECT kind, name, qualified_name, signature, docstring FROM nodes`)
54 .all();
55 const edges: EdgeRow[] = db
56 .prepare(
57 `SELECT e.kind kind, s.qualified_name src, t.qualified_name tgt, t.kind tgtKind FROM edges e
58 JOIN nodes s ON s.id = e.source JOIN nodes t ON t.id = e.target`
59 )
60 .all();
61 cg.close?.();
62 const has = (kind: string, src: string, tgt: string) =>
63 edges.some((e) => e.kind === kind && e.src === src && e.tgt === tgt);
64 const node = (qn: string, kind: string) => nodes.filter((n) => n.qualified_name === qn && n.kind === kind);
65 return { nodes, edges, has, node };
66 };
67
68 const fixture = () => {
69 write('p/Shape.java', `package p;

Callers 1

Calls 5

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

Tested by

no test coverage detected