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

Method getFileNodes

src/db/queries.ts:3367–3377  ·  view source on GitHub ↗

* The `file` nodes for the given paths, in one query. * * A file's own node is what makes a file row navigable, and looking it up * with getNodesInFile means materialising every symbol in the file to * throw all but one away.

(filePaths: string[])

Source from the content-addressed store, hash-verified

3365 * throw all but one away.
3366 */
3367 getFileNodes(filePaths: string[]): Node[] {
3368 if (filePaths.length === 0) return [];
3369 const rows = this.db
3370 .prepare(
3371 `SELECT * FROM nodes
3372 WHERE kind = 'file'
3373 AND file_path IN (SELECT value FROM json_each(?))`
3374 )
3375 .all(JSON.stringify(filePaths)) as NodeRow[];
3376 return rows.map(rowToNode);
3377 }
3378
3379 /**
3380 * Roll the whole edge table up to module granularity in one pass.

Callers 1

testFilesFunction · 0.45

Calls 3

mapMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected