xbp 10.30.3

XBP is a zero-config build pack that can also interact with proxies, kafka, sockets, synthetic monitors.
Documentation
use std::path::{Path, PathBuf};

pub fn find_node_toolchain_root(start: &Path) -> Option<PathBuf> {
    for candidate in start.ancestors() {
        if candidate.join(".nvmrc").is_file()
            && candidate.join("scripts/run-with-nvm.mjs").is_file()
        {
            return Some(candidate.to_path_buf());
        }
    }

    None
}

pub fn node_toolchain_wrapper_path(start: &Path) -> Option<PathBuf> {
    find_node_toolchain_root(start).map(|root| root.join("scripts/run-with-nvm.mjs"))
}

pub fn is_node_toolchain_command(command: &str) -> bool {
    let normalized = command.trim();
    if normalized.is_empty() {
        return false;
    }

    if normalized.contains("cargo ") || normalized == "cargo" {
        return false;
    }

    normalized.contains("pnpm")
        || normalized.contains("node ")
        || normalized == "node"
        || normalized.contains("npm ")
        || normalized == "npm"
        || normalized.contains("npx ")
        || normalized == "npx"
        || normalized.contains("wrangler")
        || normalized.contains("vite")
        || normalized.contains("tsc")
        || normalized.contains("vitest")
        || normalized.contains("biome")
        || normalized.contains("next")
        || normalized.contains("turbo")
        || normalized.contains("bun ")
        || normalized == "bun"
}