Inspect the workspace for well-known project marker files and return a short `## Project Context` section that the agent can use without any manual configuration. Returns an empty string when the workspace type cannot be determined.
(workspace: &std::path::Path)
| 2 | /// `## Project Context` section that the agent can use without any manual configuration. |
| 3 | /// Returns an empty string when the workspace type cannot be determined. |
| 4 | pub(super) fn detect_project_hint(workspace: &std::path::Path) -> String { |
| 5 | struct Marker { |
| 6 | file: &'static str, |
| 7 | lang: &'static str, |
| 8 | tip: &'static str, |
| 9 | } |
| 10 | |
| 11 | let markers = [ |
| 12 | Marker { |
| 13 | file: "Cargo.toml", |
| 14 | lang: "Rust", |
| 15 | tip: "Use `cargo build`, `cargo test`, `cargo clippy`, and `cargo fmt`. \ |
| 16 | Prefer `anyhow` / `thiserror` for error handling. \ |
| 17 | Follow the Microsoft Rust Guidelines (no panics in library code, \ |
| 18 | async-first with Tokio).", |
| 19 | }, |
| 20 | Marker { |
| 21 | file: "package.json", |
| 22 | lang: "Node.js / TypeScript", |
| 23 | tip: "Check `package.json` for the package manager (npm/yarn/pnpm/bun) \ |
| 24 | and available scripts. Prefer TypeScript with strict mode. \ |
| 25 | Use ESM imports unless the project is CommonJS.", |
| 26 | }, |
| 27 | Marker { |
| 28 | file: "pyproject.toml", |
| 29 | lang: "Python", |
| 30 | tip: "Use the package manager declared in `pyproject.toml` \ |
| 31 | (uv, poetry, hatch, etc.). Prefer type hints and async/await for I/O.", |
| 32 | }, |
| 33 | Marker { |
| 34 | file: "setup.py", |
| 35 | lang: "Python", |
| 36 | tip: "Legacy Python project. Prefer type hints and async/await for I/O.", |
| 37 | }, |
| 38 | Marker { |
| 39 | file: "requirements.txt", |
| 40 | lang: "Python", |
| 41 | tip: "Python project with pip-style dependencies. \ |
| 42 | Prefer type hints and async/await for I/O.", |
| 43 | }, |
| 44 | Marker { |
| 45 | file: "go.mod", |
| 46 | lang: "Go", |
| 47 | tip: "Use `go build ./...` and `go test ./...`. \ |
| 48 | Follow standard Go project layout. Use `gofmt` for formatting.", |
| 49 | }, |
| 50 | Marker { |
| 51 | file: "pom.xml", |
| 52 | lang: "Java / Maven", |
| 53 | tip: "Use `mvn compile`, `mvn test`, `mvn package`. \ |
| 54 | Follow standard Maven project structure.", |
| 55 | }, |
| 56 | Marker { |
| 57 | file: "build.gradle", |
| 58 | lang: "Java / Gradle", |
| 59 | tip: "Use `./gradlew build` and `./gradlew test`. \ |
| 60 | Follow standard Gradle project structure.", |
| 61 | }, |
no test coverage detected