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

Function formatBackReference

src/mcp/explore-dedup.ts:219–235  ·  view source on GitHub ↗
(
  filePath: string,
  covered: ReadonlyArray<ExploreLineRange>,
  symbols: ReadonlyArray<string>,
  opts: { partial: boolean },
)

Source from the content-addressed store, hash-verified

217 * "omitted", and it never steers to Read.
218 */
219export function formatBackReference(
220 filePath: string,
221 covered: ReadonlyArray<ExploreLineRange>,
222 symbols: ReadonlyArray<string>,
223 opts: { partial: boolean },
224): string {
225 const names = symbols.slice(0, EXPLORE_DEDUP.MAX_SYMBOLS_IN_POINTER);
226 const moreNames = symbols.length - names.length;
227 const symbolPart = names.length > 0
228 ? ` (${names.join(', ')}${moreNames > 0 ? `, +${moreNames} more` : ''})`
229 : '';
230 const head = `> **Already sent earlier in this conversation:** \`${filePath}\` ${formatSpans(covered)}${symbolPart}`;
231 const tail = opts.partial
232 ? ' — unchanged on disk since, so that copy is still exact. Only the NEW lines are shown below; scroll back for the rest. Do NOT Read this file.'
233 : ' — unchanged on disk since, so that copy is still exact and is not repeated here. Use it from your context; do NOT Read this file.';
234 return head + tail;
235}
236
237/** Symbol names whose definitions fall inside the withheld spans. */
238export function symbolsInSpans(

Callers 2

emitFileSectionMethod · 0.90

Calls 2

formatSpansFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected