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

Method getCrossFileIncomingEdgesWithTarget

src/db/queries.ts:3802–3824  ·  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). * Node IDs are `sha256(filePath:kind:name:line)`, so any line shift in the * callee file changes target IDs and a naive re-insert by old ID

(
    filePath: string
  )

Source from the content-addressed store, hash-verified

3800 * `contains`.
3801 */
3802 getCrossFileIncomingEdgesWithTarget(
3803 filePath: string
3804 ): Array<Edge & { edgeId: number; targetName: string; targetKind: NodeKind; sourceFilePath: string; sourceLanguage: Language }> {
3805 const sql = `SELECT e.*, tgt.name AS target_name, tgt.kind AS target_kind,
3806 src.file_path AS source_file_path, src.language AS source_language
3807 FROM edges e
3808 JOIN nodes tgt ON tgt.id = e.target
3809 JOIN nodes src ON src.id = e.source
3810 WHERE tgt.file_path = ?
3811 AND e.kind != 'contains'
3812 AND src.file_path != ?`;
3813 const rows = this.db.prepare(sql).all(filePath, filePath) as Array<
3814 EdgeRow & { target_name: string; target_kind: NodeKind; source_file_path: string; source_language: Language }
3815 >;
3816 return rows.map(row => ({
3817 ...rowToEdge(row),
3818 edgeId: row.id,
3819 targetName: row.target_name,
3820 targetKind: row.target_kind,
3821 sourceFilePath: row.source_file_path,
3822 sourceLanguage: row.source_language,
3823 }));
3824 }
3825
3826 /**
3827 * Resolution edges out of the nodes of `filePath` whose reference was

Callers 4

storeExtractionResultMethod · 0.80
removeTrackedMethod · 0.80
changedDefaultExportsMethod · 0.80

Calls 4

rowToEdgeFunction · 0.85
mapMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected