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

Function levelOf

graph-ui/src/architecture/semantic-graph.ts:487–492  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

485 // An opened area shows its next level: deeper areas, and the files that sit in it directly.
486 const scope = options.filePath ? undefined : options.areaPath;
487 const levelOf = (path: string): { kind: 'area' | 'file'; path: string } | undefined => {
488 const trail = trailOf(path);
489 if (!scope) return { kind: 'area', path: trail[0] };
490 const at = trail.indexOf(scope);
491 return at < 0 ? undefined : at + 1 < trail.length ? { kind: 'area', path: trail[at + 1] } : { kind: 'file', path };
492 };
493 const scopedLabel = (path: string) => scope && path.startsWith(`${scope}/`) ? path.slice(scope.length + 1) : path;
494 for (const node of graph.nodes.filter(sourceNode).sort(nodeOrder)) {
495 if (options.visibleFiles && !options.visibleFiles.has(node.file_path!)) continue;

Callers 2

buildSemanticGraphFunction · 0.70
inScopeFunction · 0.70

Calls 1

trailOfFunction · 0.70

Tested by

no test coverage detected