MCPcopy Create free account
hub / github.com/PatrickSys/codebase-context / getUsageFile

Function getUsageFile

src/core/symbol-references.ts:40–54  ·  view source on GitHub ↗
(rootPath: string, chunk: IndexedChunk)

Source from the content-addressed store, hash-verified

38}
39
40function getUsageFile(rootPath: string, chunk: IndexedChunk): string {
41 if (typeof chunk.relativePath === 'string' && chunk.relativePath.trim()) {
42 return chunk.relativePath.replace(/\\/g, '/');
43 }
44
45 if (typeof chunk.filePath === 'string' && chunk.filePath.trim()) {
46 const relativePath = path.relative(rootPath, chunk.filePath);
47 if (!relativePath || relativePath.startsWith('..')) {
48 return path.basename(chunk.filePath);
49 }
50 return relativePath.replace(/\\/g, '/');
51 }
52
53 return 'unknown';
54}
55
56function buildPreview(content: string, lineOffset: number): string {
57 const lines = content.split('\n');

Callers 1

findSymbolReferencesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected