bastion_toolkit/
common.rs1use std::path::Path;
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum ProjectType {
11 Rust,
12 Python,
13 Unknown,
14}
15
16pub fn detect_project_type() -> ProjectType {
18 if Path::new("Cargo.toml").exists() {
19 return ProjectType::Rust;
20 }
21 if Path::new("requirements.txt").exists() || Path::new("pyproject.toml").exists() {
22 return ProjectType::Python;
23 }
24 ProjectType::Unknown
25}
26
27pub fn is_ignored_path(path: &Path) -> bool {
29 let name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
30 name.starts_with('.') ||
31 matches!(name, "target" | "node_modules" | "venv" | ".venv" | "__pycache__" | "dist" | "build")
32}