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

Method headerFor

src/mcp/tools.ts:7606–7619  ·  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

7604 // body cap. Prefer symbols the trim elided (#1711), then frequency,
7605 // with a "+N more" tail.
7606 const headerFor = (
7607 symbols: readonly string[],
7608 elided: ReadonlyArray<ElidedSymbolRef> = [],
7609 /** Longest the header may run; fewer names are listed to meet it (never under one). */
7610 maxLength = Infinity,
7611 ): string => {
7612 for (let cap = budget.maxSymbolsInFileHeader; ; cap--) {
7613 const { shown, omitted } = biasHeaderSymbols(symbols, elided, cap);
7614 const header = fileSectionHeader(filePath, omitted > 0
7615 ? `${shown.join(', ')}, +${omitted} more`
7616 : shown.join(', '));
7617 if (header.length <= maxLength || cap <= 1) return header;
7618 }
7619 };
7620
7621 // Last stop before the hard ceiling. The reservation already bounded cluster
7622 // 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