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

Method headerFor

src/mcp/tools.ts:5570–5581  ·  view source on GitHub ↗
(symbols: readonly string[])

Source from the content-addressed store, hash-verified

5568 // from cluster scoring + edge-source lines, dwarfing the per-file
5569 // body cap. Show top names by frequency, with a "+N more" tail.
5570 const headerFor = (symbols: readonly string[]): string => {
5571 const symbolCounts = new Map<string, number>();
5572 for (const s of symbols) symbolCounts.set(s, (symbolCounts.get(s) ?? 0) + 1);
5573 const sortedSymbols = [...symbolCounts.entries()]
5574 .sort((a, b) => b[1] - a[1])
5575 .map(([name]) => name);
5576 const headerSymbols = sortedSymbols.slice(0, budget.maxSymbolsInFileHeader);
5577 const omittedCount = sortedSymbols.length - headerSymbols.length;
5578 return fileSectionHeader(filePath, omittedCount > 0
5579 ? `${headerSymbols.join(', ')}, +${omittedCount} more`
5580 : headerSymbols.join(', '));
5581 };
5582
5583 // Last stop before the hard ceiling. The reservation already bounded cluster
5584 // selection above, so reaching this means the bounded overshoot (an oversize

Callers

nothing calls this directly

Calls 4

fileSectionHeaderFunction · 0.85
getMethod · 0.65
setMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected