Returns `true` if the command looks like a build invocation.
(cmd: &str)
| 345 | |
| 346 | /// Returns `true` if the command looks like a build invocation. |
| 347 | fn is_build_command(cmd: &str) -> bool { |
| 348 | let lower = cmd.to_lowercase(); |
| 349 | let patterns = [ |
| 350 | // Rust |
| 351 | "cargo build", |
| 352 | "cargo check", |
| 353 | // JavaScript / TypeScript — tsc alone (without --noEmit) is a build |
| 354 | "npm run build", |
| 355 | "yarn build", |
| 356 | "pnpm build", |
| 357 | "bun build", |
| 358 | // Go |
| 359 | "go build", |
| 360 | // General |
| 361 | "make", |
| 362 | "cmake", |
| 363 | // .NET |
| 364 | "dotnet build", |
| 365 | ]; |
| 366 | |
| 367 | // Special case: bare `tsc` without --noEmit is a build |
| 368 | if lower.contains("tsc") && !lower.contains("--noemit") { |
| 369 | return true; |
| 370 | } |
| 371 | |
| 372 | patterns.iter().any(|p| lower.contains(p)) |
| 373 | } |
| 374 | |
| 375 | /// Returns `true` if the shell command is primarily reading/searching. |
| 376 | fn is_read_command(cmd: &str) -> bool { |
no test coverage detected