MCPcopy Create free account
hub / github.com/anomalyco/opencode / parseAdd

Function parseAdd

packages/core/src/patch.ts:88–97  ·  view source on GitHub ↗
(lines: ReadonlyArray<string>, start: number)

Source from the content-addressed store, hash-verified

86}
87
88function parseAdd(lines: ReadonlyArray<string>, start: number) {
89 const content: string[] = []
90 let index = start
91 while (index < lines.length && !lines[index]!.startsWith("***")) {
92 if (!lines[index]!.startsWith("+")) throw new Error(`Invalid add file line: ${lines[index]}`)
93 content.push(lines[index]!.slice(1))
94 index++
95 }
96 return { content: content.join("\n"), next: index }
97}
98
99function parseUpdate(lines: ReadonlyArray<string>, start: number) {
100 const chunks: UpdateFileChunk[] = []

Callers 1

parseFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected