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

Method getNodeIdentitiesByFile

src/db/queries.ts:1348–1366  ·  view source on GitHub ↗

* The NodeIdentity of every node in a file, without decoding whole * nodes. Read before a re-index deletes the file, so each incoming * cross-file edge can follow its target to the node that replaces it (#2276).

(filePath: string)

Source from the content-addressed store, hash-verified

1346 * cross-file edge can follow its target to the node that replaces it (#2276).
1347 */
1348 getNodeIdentitiesByFile(filePath: string): NodeIdentity[] {
1349 if (!this.stmts.getNodeIdentitiesByFile) {
1350 this.stmts.getNodeIdentitiesByFile = this.db.prepare(
1351 'SELECT id, kind, name, qualified_name, signature, start_line, start_column FROM nodes WHERE file_path = ?'
1352 );
1353 }
1354 const rows = this.stmts.getNodeIdentitiesByFile.all(filePath) as Array<
1355 Pick<NodeRow, 'id' | 'kind' | 'name' | 'qualified_name' | 'signature' | 'start_line' | 'start_column'>
1356 >;
1357 return rows.map((row) => ({
1358 id: row.id,
1359 kind: row.kind as NodeKind,
1360 name: row.name,
1361 qualifiedName: row.qualified_name,
1362 signature: row.signature ?? undefined,
1363 startLine: row.start_line,
1364 startColumn: row.start_column,
1365 }));
1366 }
1367
1368 /**
1369 * Get all nodes in several files at once — one chunked `IN` query rather than

Callers 1

storeExtractionResultMethod · 0.80

Calls 3

mapMethod · 0.80
prepareMethod · 0.65
allMethod · 0.65

Tested by

no test coverage detected