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

Method getFileNodes

src/db/queries.ts:3695–3705  ·  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

3693 * throw all but one away.
3694 */
3695 getFileNodes(filePaths: string[]): Node[] {
3696 if (filePaths.length === 0) return [];
3697 const rows = this.db
3698 .prepare(
3699 `SELECT * FROM nodes
3700 WHERE kind = 'file'
3701 AND file_path IN (SELECT value FROM json_each(?))`
3702 )
3703 .all(JSON.stringify(filePaths)) as NodeRow[];
3704 return rows.map(rowToNode);
3705 }
3706
3707 /**
3708 * 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