Skip to main content

Module parser

Module parser 

Source
Expand description

Parser for the opencode *** Begin Patch envelope.

This ports the pure parsing half of packages/opencode-plugin/src/patch-parser.ts.

Structs§

PatchHeader
UpdateFileChunk

Enums§

Hunk

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.