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

Method headerFor

src/mcp/tools.ts:7662–7675  ·  view source on GitHub ↗
(
        symbols: readonly string[],
        elided: ReadonlyArray<ElidedSymbolRef> = [],
        /** Longest the header may run; fewer names are listed to meet it (never under one). */
        maxLength = Infinity,
      )

Source from the content-addressed store, hash-verified

7660 // body cap. Prefer symbols the trim elided (#1711), then frequency,
7661 // with a "+N more" tail.
7662 const headerFor = (
7663 symbols: readonly string[],
7664 elided: ReadonlyArray<ElidedSymbolRef> = [],
7665 /** Longest the header may run; fewer names are listed to meet it (never under one). */
7666 maxLength = Infinity,
7667 ): string => {
7668 for (let cap = budget.maxSymbolsInFileHeader; ; cap--) {
7669 const { shown, omitted } = biasHeaderSymbols(symbols, elided, cap);
7670 const header = fileSectionHeader(filePath, omitted > 0
7671 ? `${shown.join(', ')}, +${omitted} more`
7672 : shown.join(', '));
7673 if (header.length <= maxLength || cap <= 1) return header;
7674 }
7675 };
7676
7677 // Last stop before the hard ceiling. The reservation already bounded cluster
7678 // selection above, so reaching this means the bounded overshoot (an oversize

Callers

nothing calls this directly

Calls 3

biasHeaderSymbolsFunction · 0.85
fileSectionHeaderFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected