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

Function codeFacts

graph-ui/src/browser-ai/code-facts.ts:128–133  ·  view source on GitHub ↗
(source: { text: string; path: string }, subject?: { name: string; kind?: string })

Source from the content-addressed store, hash-verified

126
127/** The facts of the code a selection stands for, or undefined without code. */
128export function codeFacts(source: { text: string; path: string }, subject?: { name: string; kind?: string }): CodeFacts | undefined {
129 const lines = source.text.replace(/\r\n?/g, '\n').split('\n');
130 if (!source.text.trim()) return undefined;
131 const fence = FENCES[extension(source.path)] ?? '';
132 return (fence === 'python' ? pythonFacts(lines, subject?.name) : undefined) ?? definitionLine(lines, subject?.name, fence);
133}
134
135const LANGUAGES: Readonly<Record<string, string>> = { python: 'Python', typescript: 'TypeScript', javascript: 'JavaScript', go: 'Go', rust: 'Rust', java: 'Java', c: 'C', cpp: 'C++',
136 ruby: 'Ruby', bash: 'Shell', kotlin: 'Kotlin', csharp: 'C#', php: 'PHP', swift: 'Swift' };

Callers 4

explainFunction · 0.90
sendFunction · 0.90
code-facts.test.tsFile · 0.90
codeSourceFactsFunction · 0.85

Calls 3

pythonFactsFunction · 0.85
definitionLineFunction · 0.85
extensionFunction · 0.70

Tested by

no test coverage detected