Skip to main content

assemble_context

Function assemble_context 

Source
pub fn assemble_context(paths: Vec<String>, base_dir: &Path) -> Result<String>
Expand description

Assembles context from multiple files into a single markdown document.

§Arguments

  • paths - File paths to include
  • base_dir - The base directory to resolve relative paths against

§Returns

  • Ok(String) - Markdown containing all readable files (empty if none succeed)
  • Err - If base_dir cannot be canonicalized

§Behavior

  • Validates each resolved path stays within base_dir (prevents directory traversal)
  • Skips files that escape the project directory, can’t be read, or are binary/too large
  • Continues even if some files fail