sourcepile 0.1.0

Flatten a folder of source files into a single annotated dump for LLMs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::path::Path;

/// Very small allow-list of typical “code” extensions.
pub fn is_source_file(path: &Path) -> bool {
    match path.extension().and_then(|s| s.to_str()) {
        Some(ext) => matches!(
            ext,
            "rs" | "ts" | "tsx" | "js" | "jsx" | "json" |
            "py" | "java" | "kt" | "swift" | "c"  | "cpp" | "h" | "hpp" |
            "go" | "rb" | "php" | "scala" | "dart" |
            "css" | "html" | "md"  | "toml" | "yaml" | "yml" | "txt"
        ),
        None => false,
    }
}