(symbols: readonly string[])
| 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 |
nothing calls this directly
no test coverage detected