Module detection

Module detection 

Source
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.