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

Function indexAndCollect

__tests__/c-fnptr-kernel-sweep.test.ts:49–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 };
48
49 const indexAndCollect = async (): Promise<{ edges: EdgeRow[]; nodes: number }> => {
50 fs.rmSync(path.join(dir, '.codegraph'), { recursive: true, force: true });
51 const cg = await CodeGraph.init(dir, { silent: true });
52 await cg.indexAll();
53 const db = (cg as any).db.db;
54 const edges: EdgeRow[] = db
55 .prepare(
56 `SELECT s.name src, t.name tgt, json_extract(e.metadata,'$.via') via, e.line line
57 FROM edges e JOIN nodes s ON s.id = e.source JOIN nodes t ON t.id = e.target
58 WHERE json_extract(e.metadata,'$.synthesizedBy') = 'fn-pointer-dispatch'
59 ORDER BY e.id`
60 )
61 .all();
62 const nodes = db.prepare('SELECT count(*) c FROM nodes').get().c as number;
63 cg.close?.();
64 return { edges, nodes };
65 };
66
67 const writeFixture = () => {
68 // The git shape + designated init + assignment registration.

Callers 1

Calls 7

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

Tested by

no test coverage detected