MCPcopy
hub / github.com/codeaashu/claude-code / parseReferences

Function parseReferences

src/history.ts:62–75  ·  view source on GitHub ↗
(
  input: string,
)

Source from the content-addressed store, hash-verified

60}
61
62export function parseReferences(
63 input: string,
64): Array<{ id: number; match: string; index: number }> {
65 const referencePattern =
66 /\[(Pasted text|Image|\.\.\.Truncated text) #(\d+)(?: \+\d+ lines)?(\.)*\]/g
67 const matches = [...input.matchAll(referencePattern)]
68 return matches
69 .map(match => ({
70 id: parseInt(match[2] || '0'),
71 match: match[0],
72 index: match.index,
73 }))
74 .filter(match => match.id > 0)
75}
76
77/**
78 * Replace [Pasted text #N] placeholders in input with their actual content.

Callers 5

expandPastedTextRefsFunction · 0.85
PromptInputFunction · 0.85
getInitialPasteIdFunction · 0.85
handlePromptSubmitFunction · 0.85
REPLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected