Skip to main content

extract_file_markers

Function extract_file_markers 

Source
pub fn extract_file_markers(raw: &str) -> Vec<FileMarker>
Expand description

Extract file markers from a raw LLM response.

Recognizes these heading patterns:

  • ### File: path/to/file.rs
  • ## File: path/to/file.rs
  • File: path/to/file.rs
  • ### Diff: path/to/file.rs
  • Diff: path/to/file.rs

Content between headings (or between a heading and the next heading / end of input) is captured. Fenced code blocks (```) within a section are unwrapped. Unnamed code blocks (no heading before them) get path: None.

This is the tolerant recovery layer (PSP-7 Layer D) that replaces the legacy language-tag-to-filename guessing in extract_all_code_blocks_from_response.