MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / sourceLanguage

Function sourceLanguage

graph-ui/src/architecture/source-metrics.ts:45–52  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

43
44/** File-type classification, not a claim that an embedded language was parsed. */
45export function sourceLanguage(path: string): string {
46 const name = pathKey(path).split('/').at(-1) ?? '';
47 if (/^dockerfile(?:\.|$)/i.test(name)) return 'Dockerfile';
48 if (/^(?:gnumakefile|makefile)(?:\.|$)/i.test(name)) return 'Makefile';
49 if (name === 'CMakeLists.txt') return 'CMake';
50 if (name.endsWith('.C')) return 'C++';
51 return EXTENSIONS[name.split('.').at(-1)?.toLowerCase() ?? ''] ?? 'Unknown';
52}
53export function languageColor(language: string): string {
54 if (COLORS[language]) return COLORS[language];
55 // Stable for less common languages, independent of repository or row order.

Callers 3

ArchitectureSceneFunction · 0.90
addFileFunction · 0.85

Calls 1

pathKeyFunction · 0.85

Tested by

no test coverage detected