Detects the stack based on repository files Checks for language-specific marker files in priority order: - Rust: `Cargo.toml` → "rust" - Lua: `rockspec`, `.luacheckrc`, `init.lua` → "lua" - Python: `pyproject.toml`, `requirements.txt`, `setup.py` → "python" - Node.js: `package.json` → "node" - Go: `go.mod` → "go" - Java: `pom.xml`, `build.gradle`, `build.gradle.kts` → "java" - Default: "default"
(repo_path: &Path)
| 12 | /// - Java: `pom.xml`, `build.gradle`, `build.gradle.kts` → "java" |
| 13 | /// - Default: "default" (when no specific files found) |
| 14 | pub async fn detect_stack(repo_path: &Path) -> Result<String> { |
| 15 | // Check for language-specific files in priority order |
| 16 | let stack = if file_exists(repo_path, "Cargo.toml").await { |
| 17 | "rust" |
| 18 | } else if file_exists(repo_path, "rockspec").await |
| 19 | || file_exists(repo_path, ".luacheckrc").await |
| 20 | || file_exists(repo_path, "init.lua").await |
| 21 | { |
| 22 | "lua" |
| 23 | } else if file_exists(repo_path, "pyproject.toml").await |
| 24 | || file_exists(repo_path, "requirements.txt").await |
| 25 | || file_exists(repo_path, "setup.py").await |
| 26 | { |
| 27 | "python" |
| 28 | } else if file_exists(repo_path, "package.json").await { |
| 29 | "node" |
| 30 | } else if file_exists(repo_path, "go.mod").await { |
| 31 | "go" |
| 32 | } else if file_exists(repo_path, "pom.xml").await |
| 33 | || file_exists(repo_path, "build.gradle").await |
| 34 | || file_exists(repo_path, "build.gradle.kts").await |
| 35 | { |
| 36 | "java" |
| 37 | } else { |
| 38 | "default" |
| 39 | }; |
| 40 | |
| 41 | Ok(stack.to_string()) |
| 42 | } |
| 43 | |
| 44 | /// Detects the project name from the repository path |
| 45 | /// |