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

Function readerGraphFocus

graph-ui/src/galaxy/reader-graph-focus.ts:35–48  ·  view source on GitHub ↗
(nodes: readonly GraphNode[], filePath: string, range?: SourceFocusRange)

Source from the content-addressed store, hash-verified

33}
34
35export function readerGraphFocus(nodes: readonly GraphNode[], filePath: string, range?: SourceFocusRange): { ids: Set<number>; message: string } {
36 const fileNodes = nodes.filter((node) => node.file_path && normalizedPath(node.file_path) === normalizedPath(filePath));
37 if (fileNodes.length === 0) return { ids: new Set(), message: `${filePath} is not in the loaded graph layout.` };
38 if (range) {
39 const overlapping = fileNodes.filter((node) => !['File', 'Folder', 'Module', 'Package', 'Namespace'].includes(node.label)
40 && node.start_line !== undefined && node.start_line <= range.endLine
41 && (node.end_line ?? node.start_line) >= range.startLine);
42 const symbols = overlapping.filter((node) => !['Class', 'Interface', 'Struct', 'Enum'].includes(node.label));
43 const selected = symbols.length > 0 ? symbols : overlapping;
44 if (selected.length > 0) return { ids: new Set(selected.map((node) => node.id)), message: '' };
45 return { ids: new Set(fileNodes.map((node) => node.id)), message: 'No indexed symbol overlaps this source range. Showing the file.' };
46 }
47 return { ids: new Set(fileNodes.map((node) => node.id)), message: '' };
48}

Callers 5

useGraphScopeFunction · 0.90
projectReaderHierarchyFunction · 0.90
GalaxyPanelFunction · 0.90
loadGraphScopeFunction · 0.90

Calls 1

normalizedPathFunction · 0.70

Tested by

no test coverage detected