import type { QueryService, GraphFact } from '../domain/query/queryService.js'; /** * Reason for relationship with human-readable explanation */ export interface RelationshipReason { type: string; weight: number; description: string; fact: GraphFact; } /** * Scored file with detailed reasons */ export interface ScoredFile { filePath: string; score: number; normalizedScore: number; reasons: RelationshipReason[]; relationshipCounts: Record; } /** * Configuration for scoring algorithm */ export interface ScorerConfig { includeSharedDependencies?: boolean; maxSharedDepsToCheck?: number; minScoreThreshold?: number; } /** * Dependencies for RelatedFilesScorer */ export interface RelatedFilesScorerDependencies { queryService: QueryService; } /** * Input for scoring related files */ export interface ScoreRelatedFilesInput { projectPath: string; filePath: string; limit?: number; config?: ScorerConfig; } /** * Output of scoring operation */ export interface ScoreRelatedFilesResult { targetFile: string; scoredFiles: ScoredFile[]; totalFilesAnalyzed: number; maxScore: number; } /** * RelatedFilesScorer: Intelligent multi-relationship file scoring service * * Analyzes code relationships to find related files with weighted scoring: * - IMPORTS (1.0): Direct dependencies * - IMPLEMENTS/EXTENDS (0.9): Inheritance relationships * - CALLS (0.8): Function call relationships * - CONTAINS/DEFINES (0.5/0.4): Entity membership * - Shared dependencies (0.3): Indirect relationships */ export declare class RelatedFilesScorer { private readonly queryService; constructor(deps: RelatedFilesScorerDependencies); /** * Score and rank files by their relationship strength to target file */ scoreRelatedFiles(input: ScoreRelatedFilesInput): Promise; /** * Collect all direct relationships (both directions) */ private collectDirectRelations; /** * Process direct relationships and build initial scores */ private processDirectRelations; /** * Add scores for shared dependencies * Files that import the same dependencies are likely related */ private addSharedDependencyScores; /** * Normalize scores and filter out low scores */ private normalizeAndFilter; /** * Create human-readable reason for relationship */ private createReason; /** * Extract related file from fact (not the target file) */ private extractRelatedFile; /** * Normalize file path to node format (file:...) */ private normalizeFileNode; /** * Remove file: prefix from node */ private denormalizeFileNode; /** * Format dependency list for display (truncate if too long) */ private formatDepList; }