/** * Parse GitHub review-comment "suggestion" blocks. * * GitHub's "Commit suggestion" UI button treats the first ```suggestion fenced * block in a review comment as a replacement for the commented line range. * This module extracts that block from the comment body. * * There is no GitHub API for applying suggestions — tools that reproduce the * button (this one included) must parse + commit themselves. */ interface ParsedSuggestion { /** * Replacement lines to splice in. Empty array means "delete these lines". * `[""]` means "replace with a single blank line". Array length equals the * number of replacement lines in the suggestion snippet (not the number of * lines in the resulting file). */ lines: readonly string[]; } /** * Return the first ```suggestion block from a review-comment body, or null if none. * * Handles three distinct cases: * - Empty block (` ```suggestion\n``` `) → `lines: []` (deletion). * - Blank-line-only body (` ```suggestion\n\n``` `) → `lines: [""]`. * - Non-empty body → split into lines. * * The opening fence may be 3+ backticks; the closing fence must be at least * as many backticks, at the start of a line (after the captured prefix). This * means content lines that contain ` ``` ` in the middle (not at line-start) * are treated as content rather than a closing fence — fixing the silent * truncation in the original regex approach (issue #68). * * When the block is embedded in a quoted reply (e.g. `> ```suggestion …`), * the leading prefix captured from the opening fence is stripped from each * body line — but only when that exact prefix is present, so legitimate `>` * characters inside the suggested code survive. */ export declare function parseSuggestion(body: string): ParsedSuggestion | null; /** * True when a parsed suggestion's replacement is safe to commit: the joined * replacement contains no nested ` ```suggestion ` marker and no unmatched * ` ``` ` run (odd count). Both shapes previously masked silent truncation * (issue #68). Conservative by design: reviewers whose suggestion content * legitimately includes these markers must apply the change manually. */ export declare function isCommittableSuggestion(parsed: ParsedSuggestion): boolean; export {};