pub mod apt;
pub mod brew;
pub mod bun;
pub mod composer;
pub mod deno;
pub mod gem;
pub mod mix;
pub mod npm;
pub mod pip;
pub mod pnpm;
pub mod poetry;
pub mod uv;

use forge::signal::compactor;

/// Route pkg-manager output to the right compressor.
pub fn compress_pkg(prog: &str, subcmd: &str, raw: &str) -> String {
    match prog {
        "npm" | "yarn" => npm::compress_npm(subcmd, raw),
        "pnpm" => pnpm::compress_pnpm(subcmd, raw),
        "bun" | "bunx" => bun::compress_bun(subcmd, raw, 0),
        "pip" | "pip3" => pip::compress_pip(subcmd, raw),
        "poetry" => poetry::compress_poetry(raw),
        "uv" => uv::compress_uv(subcmd, raw),
        "conda" | "mamba" => poetry::compress_uv(raw),
        "composer" => composer::compress_composer(subcmd, raw),
        "artisan" => composer::compress_artisan(subcmd, raw),
        "mix" => mix::compress_mix(subcmd, raw, 0),
        "deno" => deno::compress_deno(subcmd, raw, 0),
        "apt" | "apt-get" => apt::compress_apt(subcmd, raw),
        "brew" => brew::compress_brew(subcmd, raw),
        _ => compactor::normalise(raw),
    }
}

/// Legacy alias kept for existing FilterMesh nodes.
pub fn compress_npm_install(raw: &str) -> String {
    npm::compress_install(raw)
}
