MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / readSource

Method readSource

src/mcp/tools.ts:4189–4199  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

4187 const root = cg.getProjectRoot();
4188 const sources = new Map<string, string | undefined>();
4189 const readSource: SourceReader = (filePath) => {
4190 if (!sources.has(filePath)) {
4191 let text: string | undefined;
4192 try {
4193 const abs = validatePathWithinRoot(root, filePath);
4194 text = abs === null ? undefined : readFileSync(abs, 'utf-8');
4195 } catch { /* unreadable → not known to be test code */ }
4196 sources.set(filePath, text);
4197 }
4198 return sources.get(filePath);
4199 };
4200 const verdicts = new Map<string, boolean>();
4201 return (node) => {
4202 let v = verdicts.get(node.id);

Callers

nothing calls this directly

Calls 4

validatePathWithinRootFunction · 0.90
hasMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected