package scanner import ( "path/filepath" "strings" ) // detectLanguage returns a best-effort language label based on the // file extension. Empty string for unknown — the caller treats those // as opaque and may still scan them for patterns. func detectLanguage(filename string) string { switch strings.ToLower(filepath.Ext(filename)) { case ".go": return "Go" case ".rs": return "Rust" case ".ts", ".tsx": return "TypeScript" case ".js", ".jsx", ".mjs", ".cjs": return "JavaScript" case ".py": return "Python" case ".java": return "Java" case ".kt": return "Kotlin" case ".rb": return "Ruby" case ".php": return "PHP" case ".swift": return "Swift" case ".c", ".h": return "C" case ".cpp", ".cc", ".cxx", ".hpp": return "C++" case ".cs": return "C#" case ".sh", ".bash": return "Shell" case ".sql": return "SQL" case ".yaml", ".yml": return "YAML" case ".toml": return "TOML" case ".json": return "JSON" case ".md", ".markdown": return "Markdown" case ".html", ".htm": return "HTML" case ".css", ".scss", ".sass", ".less": return "CSS" } // Special filenames without extensions switch strings.ToLower(filename) { case "dockerfile", "containerfile": return "Docker" case "makefile", "gnumakefile": return "Make" case "justfile": return "Justfile" } return "" }