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

Method getCrossFileIncomingEdgesWithTarget

src/db/queries.ts:1835–1856  ·  view source on GitHub ↗

* Cross-file edges whose TARGET is a node in `filePath` and whose SOURCE is a * node in a *different* file, paired with the target node's (name, kind) so a * caller can re-resolve the edge to the re-indexed target's new ID (node IDs * are `sha256(filePath:kind:name:line)`, so any line shift

(
    filePath: string
  )

Source from the content-addressed store, hash-verified

1833 * {@link getDependentFilePaths}: all kinds except `contains`.
1834 */
1835 getCrossFileIncomingEdgesWithTarget(
1836 filePath: string
1837 ): Array<Edge & { targetName: string; targetKind: NodeKind; sourceFilePath: string; sourceLanguage: Language }> {
1838 const sql = `SELECT e.*, tgt.name AS target_name, tgt.kind AS target_kind,
1839 src.file_path AS source_file_path, src.language AS source_language
1840 FROM edges e
1841 JOIN nodes tgt ON tgt.id = e.target
1842 JOIN nodes src ON src.id = e.source
1843 WHERE tgt.file_path = ?
1844 AND e.kind != 'contains'
1845 AND src.file_path != ?`;
1846 const rows = this.db.prepare(sql).all(filePath, filePath) as Array<
1847 EdgeRow & { target_name: string; target_kind: NodeKind; source_file_path: string; source_language: Language }
1848 >;
1849 return rows.map(row => ({
1850 ...rowToEdge(row),
1851 targetName: row.target_name,
1852 targetKind: row.target_kind,
1853 sourceFilePath: row.source_file_path,
1854 sourceLanguage: row.source_language,
1855 }));
1856 }
1857
1858 // ===========================================================================
1859 // File Operations

Callers 2

storeExtractionResultMethod · 0.80
syncMethod · 0.80

Calls 3

rowToEdgeFunction · 0.85
allMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected