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

Method getCrossFileIncomingEdgesWithTarget

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

3689 * `contains`.
3690 */
3691 getCrossFileIncomingEdgesWithTarget(
3692 filePath: string
3693 ): Array<Edge & { edgeId: number; targetName: string; targetKind: NodeKind; sourceFilePath: string; sourceLanguage: Language }> {
3694 const sql = `SELECT e.*, tgt.name AS target_name, tgt.kind AS target_kind,
3695 src.file_path AS source_file_path, src.language AS source_language
3696 FROM edges e
3697 JOIN nodes tgt ON tgt.id = e.target
3698 JOIN nodes src ON src.id = e.source
3699 WHERE tgt.file_path = ?
3700 AND e.kind != 'contains'
3701 AND src.file_path != ?`;
3702 const rows = this.db.prepare(sql).all(filePath, filePath) as Array<
3703 EdgeRow & { target_name: string; target_kind: NodeKind; source_file_path: string; source_language: Language }
3704 >;
3705 return rows.map(row => ({
3706 ...rowToEdge(row),
3707 edgeId: row.id,
3708 targetName: row.target_name,
3709 targetKind: row.target_kind,
3710 sourceFilePath: row.source_file_path,
3711 sourceLanguage: row.source_language,
3712 }));
3713 }
3714
3715 /**
3716 * 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