Expand description
Parser for the opencode *** Begin Patch envelope.
This ports the pure parsing half of packages/opencode-plugin/src/patch-parser.ts.
Structs§
Enums§
Constants§
- MAX_
HUNKS - Maximum number of file operations per patch.
- MAX_
PATCH_ SIZE - Maximum patch text size in bytes to prevent memory exhaustion.
Functions§
- parse_
add_ file_ content - Parse added file content by collecting every
+line until the next patch marker. - parse_
patch - Parse an opencode apply_patch envelope; mirrors
patch-parser.ts:148-201. - parse_
patch_ header - Parse a file-operation header line and return its path, optional move destination, and next line index.
- parse_
update_ file_ chunks - Parse
@@update chunks into old/new line vectors and optional context anchors. - strip_
heredoc - Strip a whole-input heredoc wrapper; mirrors
patch-parser.ts:33-36.