import type Database from 'better-sqlite3'; import type { CallsiteResult, DependencyInfo, DependencyWithMetadata, IncomingDependency, ReadySymbolInfo } from '../schema.js'; export interface ImportGraphNode { id: number; name: string; kind: string; } export interface ImportGraphLink { source: number; target: number; type: string; } export declare class DependencyRepository { private db; constructor(db: Database.Database); getCallsites(definitionId: number): CallsiteResult[]; getCallsitesForFile(fileId: number): CallsiteResult[]; getCallsiteCount(): number; /** * Get incoming dependencies - symbols that use this definition. * This finds all definitions that have usages pointing to this definition. */ getIncoming(definitionId: number, limit?: number): IncomingDependency[]; /** * Get count of incoming dependencies - how many symbols use this definition. */ getIncomingCount(definitionId: number): number; /** * Get all symbols that a definition depends on (uses within its line range). * This finds usages within the definition's code that reference other definitions. */ getForDefinition(definitionId: number): DependencyInfo[]; /** * Get dependencies with their metadata status for a specific aspect. * Combines dependency lookup with metadata check in a single efficient query. */ getWithMetadata(definitionId: number, aspect?: string): DependencyWithMetadata[]; /** * Get dependencies that don't have a specific aspect set. * Orders by dependency count (leaf nodes first) for topological processing. */ getUnmet(definitionId: number, aspect: string): DependencyInfo[]; /** * Get the full prerequisite chain for understanding a symbol. * Returns unmet dependencies in topological order (leaves first). * Handles circular dependencies by tracking visited nodes. */ getPrerequisiteChain(definitionId: number, aspect: string, getDefinitionById: (id: number) => { name: string; kind: string; filePath: string; line: number; } | null): Array; /** * Find symbols that are "ready to understand" for a given aspect. * A symbol is ready when all its dependencies already have the aspect set (or it has no dependencies). * Excludes symbols that already have the aspect set. */ getReadySymbols(aspect: string, options?: { limit?: number; kind?: string; filePattern?: string; }): { symbols: ReadySymbolInfo[]; totalReady: number; remaining: number; }; /** * Detect orphan module-scope usages: imported symbols used in a file at lines * outside any definition's line range. These are module-scope statements * (e.g., app.use('/auth', authRouter)) that the line-range join cannot capture. * Returns one row per (file, referenced definition) pair. */ getOrphanModuleScopeUsages(): Array<{ filePath: string; symbolName: string; usageLine: number; referencedDefId: number; referencedDefName: string; }>; /** * Get module-scope method calls with receiver info and referenced file path. * Used to detect Express mount calls like `app.use('/api/auth', authRouter)`. * Extends getOrphanModuleScopeUsages() with is_method_call, receiver_name, * and the referenced definition's file path. */ getModuleScopeMountCalls(): Array<{ filePath: string; usageLine: number; receiverName: string; symbolName: string; referencedDefId: number; referencedFilePath: string; }>; /** * Get import dependency graph data for D3 visualization */ getImportGraph(): { nodes: ImportGraphNode[]; links: ImportGraphLink[]; }; } //# sourceMappingURL=dependency-repository.d.ts.map