( input: ScanResult, ctx: PipelineContext, )
| 47 | import type { Registries, CallInfo } from '../parser/callResolver'; |
| 48 | |
| 49 | export function* execute( |
| 50 | input: ScanResult, |
| 51 | ctx: PipelineContext, |
| 52 | ): Generator<PipelineEvent, ProcessingOutput> { |
| 53 | const { parseableFiles, repoId, knownPaths, pathToFileId, goModulePath } = |
| 54 | input; |
| 55 | const total = parseableFiles.length; |
| 56 | |
| 57 | yield { |
| 58 | kind: 'stage_start', |
| 59 | phase: 'processing', |
| 60 | message: `Processing ${total} files`, |
| 61 | }; |
| 62 | |
| 63 | // Initialize registries |
| 64 | const registries: Registries = { |
| 65 | nameRegistry: new Map(), |
| 66 | fileRegistry: new Map(), |
| 67 | classRegistry: new Map(), |
| 68 | importRegistry: new Map(), |
| 69 | }; |
| 70 | const allCallInfo: CallInfo[] = []; |
| 71 | const emittedNodeIds = new Set<string>(); |
| 72 | |
| 73 | // Copy package nodes from scanning (will accumulate more from imports) |
| 74 | const packageNodes = new Map(input.packageNodes); |
| 75 | |
| 76 | const structureNodes: GraphNode[] = [ |
| 77 | input.repoNode, |
| 78 | ...input.dirNodes.values(), |
| 79 | ...input.fileNodes, |
| 80 | ...input.packageNodes.values(), |
| 81 | ]; |
| 82 | let totalNodes = structureNodes.length; |
| 83 | let totalRels = input.structureRels.length + input.dependencyRels.length; |
| 84 | let filesProcessed = 0; |
| 85 | let classesExtracted = 0; |
| 86 | let functionsExtracted = 0; |
| 87 | const errors: string[] = []; |
| 88 | |
| 89 | for (let i = 0; i < parseableFiles.length; i++) { |
| 90 | if (ctx.cancelled) break; |
| 91 | |
| 92 | const file = parseableFiles[i]; |
| 93 | const ext = getExtension(file.path); |
| 94 | const language = detectLanguage(ext); |
| 95 | const fileId = `${repoId}/${file.path}`; |
| 96 | |
| 97 | if (!language) { |
| 98 | filesProcessed++; |
| 99 | continue; |
| 100 | } |
| 101 | |
| 102 | const parser = getParserForLanguage(language, ext); |
| 103 | const extractor = getExtractor(language); |
| 104 | |
| 105 | if (!parser || !extractor) { |
| 106 | filesProcessed++; |
nothing calls this directly
no test coverage detected