Expand description
Package manager detection module.
This module provides functionality to detect which package managers are in use within a workspace by scanning for lockfiles, workspace configurations, and analyzing command strings.
§Examples
Detect package managers in a directory:
use cuenv_workspaces::detection::detect_package_managers;
use std::path::Path;
let root = Path::new("/path/to/workspace");
let managers = detect_package_managers(root)?;
for manager in managers {
println!("Detected: {}", manager);
}Detect from a command string:
use cuenv_workspaces::detection::detect_from_command;
use cuenv_workspaces::PackageManager;
assert_eq!(detect_from_command("cargo build"), Some(PackageManager::Cargo));
assert_eq!(detect_from_command("npm install"), Some(PackageManager::Npm));
assert_eq!(detect_from_command("bun run test"), Some(PackageManager::Bun));Functions§
- detect_
from_ command - Infers the package manager from a command string.
- detect_
package_ managers - Detects all package managers present in the given directory.
- detect_
with_ command_ hint - Combines filesystem and command-based detection with command hint prioritization.