use clap::Subcommand;
use crate::types::Result;
use super::upgrade;

#[derive(Subcommand)]
pub enum JsCommands {
    /// Upgrade dependencies to latest versions
    Upgrade {
        /// Only upgrade regular dependencies (excludes devDependencies)
        #[arg(long, conflicts_with = "dev_only")]
        prod_only: bool,
        
        /// Only upgrade dev dependencies (excludes regular dependencies)
        #[arg(long, conflicts_with = "prod_only")]
        dev_only: bool,
    },
}

pub async fn handle_js_command(command: JsCommands) -> Result<()> {
    match command {
        JsCommands::Upgrade { prod_only, dev_only } => {
            upgrade::execute(prod_only, dev_only).await
        }
    }
}