MCPcopy Index your code
hub / github.com/anomalyco/opencode / stripHeredoc

Function stripHeredoc

packages/opencode/src/patch/index.ts:176–183  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

174}
175
176function stripHeredoc(input: string): string {
177 // Match heredoc patterns like: cat <<'EOF'\n...\nEOF or <<EOF\n...\nEOF
178 const heredocMatch = input.match(/^(?:cat\s+)?<<['"]?(\w+)['"]?\s*\n([\s\S]*?)\n\1\s*$/)
179 if (heredocMatch) {
180 return heredocMatch[2]
181 }
182 return input
183}
184
185export function parsePatch(patchText: string): { hunks: Hunk[] } {
186 const cleaned = stripHeredoc(patchText.trim())

Callers 1

parsePatchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected