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

Method getFileNodes

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

3331 * throw all but one away.
3332 */
3333 getFileNodes(filePaths: string[]): Node[] {
3334 if (filePaths.length === 0) return [];
3335 const rows = this.db
3336 .prepare(
3337 `SELECT * FROM nodes
3338 WHERE kind = 'file'
3339 AND file_path IN (SELECT value FROM json_each(?))`
3340 )
3341 .all(JSON.stringify(filePaths)) as NodeRow[];
3342 return rows.map(rowToNode);
3343 }
3344
3345 /**
3346 * 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