MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / checkPatchBoundaries

Function checkPatchBoundaries

src/core/tools/apply-patch/parser.ts:86–101  ·  view source on GitHub ↗

* Check if lines start and end with correct patch markers.

(lines: string[])

Source from the content-addressed store, hash-verified

84 * Check if lines start and end with correct patch markers.
85 */
86function checkPatchBoundaries(lines: string[]): void {
87 if (lines.length === 0) {
88 throw new ParseError("Empty patch")
89 }
90
91 const firstLine = lines[0]?.trim()
92 const lastLine = lines[lines.length - 1]?.trim()
93
94 if (firstLine !== BEGIN_PATCH_MARKER) {
95 throw new ParseError("The first line of the patch must be '*** Begin Patch'")
96 }
97
98 if (lastLine !== END_PATCH_MARKER) {
99 throw new ParseError("The last line of the patch must be '*** End Patch'")
100 }
101}
102
103/**
104 * Parse a single UpdateFileChunk from lines.

Callers 1

parsePatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected