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

Function load

__tests__/c-fnptr-synthesizer.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; tgt: string; via: string }[] = db
41 .prepare(
42 `SELECT s.name src, t.name tgt, json_extract(e.metadata,'$.via') via
43 FROM edges e JOIN nodes s ON s.id = e.source JOIN nodes t ON t.id = e.target
44 WHERE json_extract(e.metadata,'$.synthesizedBy') = 'fn-pointer-dispatch'`
45 )
46 .all();
47 cg.close?.();
48 return edges;
49 };
50 const has = (edges: any[], src: string, tgt: string) => edges.some((e) => e.src === src && e.tgt === tgt);
51
52 it('bridges a {name, fn} command table dispatched through p->fn() (the git shape)', async () => {

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