Section 2.6Source:
server/src/parser/extractors/RelationshipExtractor.tsRelationship Extraction
The second AST traversal pass that links symbols and files into directed graph edges by resolving function calls, class inheritance, constructor instantiations, and module imports.
Source:
server/src/parser/extractors/RelationshipExtractor.tsSupported Relationship Kinds
RelationshipExtractor generates 7 distinct directed edge kinds:
| Relationship Kind | Source Kind | Target Kind | Edge Direction Semantics |
|---|---|---|---|
| "calls" | symbol | symbol | (callerFunction) --[calls]--> (targetFunction) |
| "extends" | symbol | symbol | (subClass) --[extends]--> (superClass) |
| "implements" | symbol | symbol | (class) --[implements]--> (interface/type) |
| "instantiates" | symbol | symbol | (sourceFunction/var) --[instantiates]--> (class) |
| "imports" | file | file / symbol / dep / module | (file) --[imports]--> (target) |
| "exports" | file | symbol | (file) --[exports]--> (symbol) |
| "references" | symbol | symbol | (symbol) --[references]--> (targetSymbol) |
The `ParsedRelationship` Model
server/src/parser/models/ParsedRelationship.ts
12345678export interface ParsedRelationship { id: string; // Deterministic ID: ${sourceId}:${relationshipKind}:${targetId} sourceId: string; // Source entity ID (file path or symbol ID) sourceKind: RelationshipEntityKind; // "file" | "symbol" | "module" | "dependency" targetId: string; // Target entity ID targetKind: RelationshipEntityKind; // "file" | "symbol" | "module" | "dependency" relationshipKind: RelationshipKind; // "calls" | "imports" | "extends" | ... }
Detailed Subtopics
Explore the in-depth resolution algorithms for every relationship kind:
2.6.1 Call Graph Resolution
Resolving direct calls, member calls X.foo(), this.foo(), and cross-file calls.
2.6.2 Inheritance & TypesResolving class extends superclasses and TypeScript implements clauses.
2.6.3 Instantiation ResolutionTracking constructor new expressions in variable assignments and return statements.
2.6.4 Import Resolution (5-Step Waterfall)Relative paths, path aliases (@/*), external dependencies, and extension resolution waterfall.
2.6.5 Export Mapping & SpecifiersNamed declarations, specifier aliases (export { a as b }), and default export resolution.