Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
fix(ingest): resolve renamed type imports
Hiro-Chiba819d67e06e43
diff --git a/core-ingestion/src/__tests__/resolveEdges.test.ts b/core-ingestion/src/__tests__/resolveEdges.test.tsindex 1a28b7c5..38e3fd8c 100644--- a/core-ingestion/src/__tests__/resolveEdges.test.ts+++ b/core-ingestion/src/__tests__/resolveEdges.test.ts@@ -583,6 +583,39 @@ describe('resolveEdges', () => {});});+ it('resolves renamed imports used in inheritance and type references', () => {+ const provider = parseFile(+ '/repo/types.ts',+ 'export interface User { id: string; }\nexport class Base {}\n',+ )!;+ const consumer = parseFile(+ '/repo/consumer.ts',+ 'import { type User as ExternalUser, Base as LocalBase } from "./types";\n'+ + 'export class Child extends LocalBase {}\n'+ + 'export function use(value: ExternalUser) { return value.id; }\n',+ )!;++ const resolved = resolveEdges([consumer, provider]);+ expect(resolved).toContainEqual({+ srcFilePath: '/repo/consumer.ts',+ srcName: 'Child',+ dstFilePath: '/repo/types.ts',+ dstName: 'LocalBase',+ dstQualifiedKey: 'Base',+ predicate: 'EXTENDS',+ confidence: 0.9,+ });+ expect(resolved).toContainEqual({+ srcFilePath: '/repo/consumer.ts',+ srcName: 'use',+ dstFilePath: '/repo/types.ts',+ dstName: 'ExternalUser',+ dstQualifiedKey: 'User',+ predicate: 'REFERENCES',+ confidence: 0.9,+ });+ });+it('uses caller-supplied parse results instead of re-parsing', () => {// The CLI parses prescan sources on its worker pool and hands the results// in, so the index costs no main-thread parsing. Proven by supplying adiff --git a/core-ingestion/src/index.ts b/core-ingestion/src/index.tsindex 006c9c66..5b8e5c38 100644--- a/core-ingestion/src/index.ts+++ b/core-ingestion/src/index.ts@@ -3989,7 +3989,8 @@ export function resolveEdges())];const publicMatches: Array<{ fp: string; local: string }> = [];for (const fp of providerFiles.length === 1 ? providerFiles : []) {- const local = filePublicNames.get(fp)?.get(binding.imported);+ const local = filePublicNames.get(fp)?.get(binding.imported)+ ?? (fileHasSymbol.get(fp)?.has(binding.imported) ? binding.imported : undefined);if (local && fileHasSymbol.get(fp)?.has(local)) publicMatches.push({ fp, local });}if (publicMatches.length === 1) {