| 30 | |
| 31 | type Row = { name: string; kind: string; decorators: string | null; docstring: string | null; signature: string | null }; |
| 32 | const load = async () => { |
| 33 | const cg = await CodeGraph.init(dir, { silent: true }); |
| 34 | await cg.indexAll(); |
| 35 | const db = (cg as any).db.db; |
| 36 | const nodes: Row[] = db.prepare(`SELECT name, kind, decorators, docstring, signature FROM nodes`).all(); |
| 37 | const calls: { src: string; tgt: string }[] = db |
| 38 | .prepare( |
| 39 | `SELECT s.name src, t.name tgt FROM edges e |
| 40 | JOIN nodes s ON s.id = e.source JOIN nodes t ON t.id = e.target |
| 41 | WHERE e.kind = 'calls'` |
| 42 | ) |
| 43 | .all(); |
| 44 | cg.close?.(); |
| 45 | return { nodes, calls }; |
| 46 | }; |
| 47 | |
| 48 | const isLombok = (n: Row | undefined) => !!n && (n.decorators ?? '').includes('lombok'); |
| 49 | |