Module extract

Source
Expand description

Extract command functionality for extracting code blocks from files.

This module provides functions for extracting code blocks from files based on file paths and optional line numbers. When a line number is specified, it uses tree-sitter to find the closest suitable parent node (function, struct, class, etc.) for that line.

Modules§

symbol_finder
Functions for finding symbols in files.

Structs§

ExtractOptions
Options for the extract command

Enums§

PromptTemplate
Enum representing different prompt template sources

Functions§

extract_file_paths_from_git_diff
Extract file paths from git diff format
extract_file_paths_from_text
Extract file paths from text (for stdin mode)
format_and_print_extraction_results
Format and print the extraction results in the specified format
format_extraction_dry_run
Format the extraction results for dry-run mode (only file names and line numbers)
format_extraction_results
Format the extraction results in the specified format and return as a string
handle_extract
Handle the extract command
is_git_diff_format
Check if content is in git diff format
parse_file_with_line
Parse a file path with optional line number or range (e.g., “file.rs:10” or “file.rs:1-60”)
process_file_for_extraction
Process a single file and extract code blocks