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

Function ranked

graph-ui/src/galaxy/selection-evidence.ts:78–88  ·  view source on GitHub ↗
(members: ReadonlySet<number>)

Source from the content-addressed store, hash-verified

76 }
77 }
78 const ranked = (members: ReadonlySet<number>): RelatedSymbol[] => {
79 const symbols = [...members].map(id => {
80 const node = byId.get(id);
81 return { name: node?.name ?? `#${id}`, kind: node?.label || undefined, path: node?.file_path ?? '' };
82 });
83 const perFile = new Map<string, number>();
84 symbols.forEach(symbol => perFile.set(symbol.path, (perFile.get(symbol.path) ?? 0) + 1));
85 // Files with the most related symbols first, so a bounded list keeps the densest evidence.
86 return symbols.sort((left, right) => perFile.get(right.path)! - perFile.get(left.path)!
87 || left.path.localeCompare(right.path) || left.name.localeCompare(right.name)).slice(0, RELATED_NAMES_PER_GROUP);
88 };
89 const ordered = (side: Map<string, Set<number>>) => [...side].sort(([leftType, left], [rightType, right]) =>
90 right.size - left.size || leftType.localeCompare(rightType));
91 const sides = [ordered(related.incoming), ordered(related.outgoing)];

Callers 1

scopeRelationshipsFunction · 0.70

Calls 1

getMethod · 0.65

Tested by

no test coverage detected