pub struct FileInfo {Show 14 fields
pub path: PathBuf,
pub relative_path: String,
pub size: u64,
pub modified: Option<SystemTime>,
pub decision: RenderDecision,
pub file_type: FileType,
pub language: Language,
pub content: Option<String>,
pub token_estimate: Option<usize>,
pub line_count: Option<usize>,
pub char_count: Option<usize>,
pub is_binary: bool,
pub git_status: Option<GitStatus>,
pub centrality_score: Option<f64>,
}
Expand description
Comprehensive file metadata structure
Fields§
§path: PathBuf
Absolute path to the file on disk
relative_path: String
Path relative to repository root (forward slash separated)
size: u64
File size in bytes
modified: Option<SystemTime>
File modification time
decision: RenderDecision
Analysis decision (include/exclude)
file_type: FileType
Detected file type
language: Language
Detected programming language
content: Option<String>
File content (loaded on demand)
token_estimate: Option<usize>
Estimated token count for LLM processing
line_count: Option<usize>
Line count (if text file)
char_count: Option<usize>
Character count (if text file)
is_binary: bool
Whether the file is likely binary
git_status: Option<GitStatus>
Git status information (if available)
centrality_score: Option<f64>
PageRank centrality score (0.0-1.0, higher means more important)
Implementations§
Source§impl FileInfo
impl FileInfo
Sourcepub fn new<P: AsRef<Path>>(
path: P,
relative_path: String,
decision: RenderDecision,
) -> Result<Self>
pub fn new<P: AsRef<Path>>( path: P, relative_path: String, decision: RenderDecision, ) -> Result<Self>
Create a new FileInfo from a path
Sourcepub fn load_content(&mut self) -> Result<()>
pub fn load_content(&mut self) -> Result<()>
Load file content and compute statistics
Sourcepub fn estimate_tokens(content: &str) -> usize
pub fn estimate_tokens(content: &str) -> usize
Estimate token count for LLM processing using tiktoken
This method uses the shared global TokenCounter instance for optimal performance. If tiktoken fails, it falls back to the legacy character-based estimation.
Sourcepub fn estimate_tokens_with_path(content: &str, file_path: &Path) -> usize
pub fn estimate_tokens_with_path(content: &str, file_path: &Path) -> usize
Estimate token count for LLM processing with file context
This method uses the file path to apply language-specific multipliers for more accurate token estimation.
Sourcepub fn detect_binary_by_extension(extension: &str) -> bool
pub fn detect_binary_by_extension(extension: &str) -> bool
Check if file extension indicates binary content
Sourcepub fn classify_file_type(
path: &str,
language: &Language,
extension: &str,
) -> FileType
pub fn classify_file_type( path: &str, language: &Language, extension: &str, ) -> FileType
Classify file type based on path and language
Sourcepub fn human_size(&self) -> String
pub fn human_size(&self) -> String
Get human-readable size
Sourcepub fn should_include(&self) -> bool
pub fn should_include(&self) -> bool
Check if file should be included in analysis