MCPcopy Create free account
hub / github.com/arctic-cli/interface / parseAddFileContent

Function parseAddFileContent

packages/arctic/src/patch/index.ts:161–178  ·  view source on GitHub ↗
(lines: string[], startIdx: number)

Source from the content-addressed store, hash-verified

159 }
160
161 function parseAddFileContent(lines: string[], startIdx: number): { content: string; nextIdx: number } {
162 let content = ""
163 let i = startIdx
164
165 while (i < lines.length && !lines[i].startsWith("***")) {
166 if (lines[i].startsWith("+")) {
167 content += lines[i].substring(1) + "\n"
168 }
169 i++
170 }
171
172 // Remove trailing newline
173 if (content.endsWith("\n")) {
174 content = content.slice(0, -1)
175 }
176
177 return { content, nextIdx: i }
178 }
179
180 export function parsePatch(patchText: string): { hunks: Hunk[] } {
181 const lines = patchText.split("\n")

Callers 1

parsePatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected