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

Method getNodeNamesByFiles

src/db/queries.ts:5713–5726  ·  view source on GitHub ↗

* Distinct node names present in the given files — the symbol names a sync * pass uses to look up retryable failed refs after those files changed. * `kinds` narrows them to nodes of those kinds.

(filePaths: string[], kinds?: readonly NodeKind[])

Source from the content-addressed store, hash-verified

5711 * `kinds` narrows them to nodes of those kinds.
5712 */
5713 getNodeNamesByFiles(filePaths: string[], kinds?: readonly NodeKind[]): string[] {
5714 if (filePaths.length === 0) return [];
5715 const kindFilter = kinds ? ` AND kind IN (${kinds.map(() => '?').join(',')})` : '';
5716 const names = new Set<string>();
5717 for (let i = 0; i < filePaths.length; i += SQLITE_PARAM_CHUNK_SIZE) {
5718 const chunk = filePaths.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
5719 const placeholders = chunk.map(() => '?').join(',');
5720 const rows = this.db
5721 .prepare(`SELECT DISTINCT name FROM nodes WHERE file_path IN (${placeholders})${kindFilter}`)
5722 .all(...chunk, ...(kinds ?? [])) as Array<{ name: string }>;
5723 for (const row of rows) names.add(row.name);
5724 }
5725 return [...names];
5726 }
5727
5728 /**
5729 * Distinct `file\0name` pairs defined by the given files — the shape sync's

Callers 1

syncMethod · 0.80

Calls 5

mapMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected