diff --git a/lib/crates/fabro-cli/src/args.rs b/lib/crates/fabro-cli/src/args.rs index 6ebdc3543..6d12c964a 100644 --- a/lib/crates/fabro-cli/src/args.rs +++ b/lib/crates/fabro-cli/src/args.rs @@ -621,6 +621,8 @@ pub(crate) enum RunCommands { #[arg(long)] resume: bool, }, + /// Copy files to/from a run's sandbox + Cp(CpArgs), /// Get a preview URL for a port on a run's sandbox Preview(PreviewArgs), /// SSH into a run's Daytona sandbox @@ -648,6 +650,7 @@ impl RunCommands { Self::Start { .. } => "start", Self::Attach { .. } => "attach", Self::Detached { .. } => "__detached", + Self::Cp(_) => "cp", Self::Preview(_) => "preview", Self::Ssh(_) => "ssh", Self::Diff(_) => "diff", @@ -700,8 +703,6 @@ pub(crate) enum Commands { Parse(ParseArgs), /// Inspect and copy run assets (screenshots, reports, traces) Asset(AssetNamespace), - /// Copy files to/from a run's sandbox - Cp(CpArgs), #[command(flatten)] RunsCmd(RunsCommands), /// List and test LLM models @@ -782,7 +783,6 @@ impl Commands { Self::Validate(_) => "validate", Self::Graph(_) => "graph", Self::Parse(_) => "parse", - Self::Cp(_) => "cp", Self::RunsCmd(cmd) => cmd.name(), Self::Model { command } => match command { Some(fabro_llm::cli::ModelsCommand::List { .. }) => "model list", diff --git a/lib/crates/fabro-cli/src/commands/mod.rs b/lib/crates/fabro-cli/src/commands/mod.rs index f3c6c16c1..6e53c2f37 100644 --- a/lib/crates/fabro-cli/src/commands/mod.rs +++ b/lib/crates/fabro-cli/src/commands/mod.rs @@ -1,5 +1,4 @@ pub mod asset; -pub mod cp; pub mod doctor; pub mod exec; pub mod graph; diff --git a/lib/crates/fabro-cli/src/commands/cp.rs b/lib/crates/fabro-cli/src/commands/run/cp.rs similarity index 100% rename from lib/crates/fabro-cli/src/commands/cp.rs rename to lib/crates/fabro-cli/src/commands/run/cp.rs diff --git a/lib/crates/fabro-cli/src/commands/run/mod.rs b/lib/crates/fabro-cli/src/commands/run/mod.rs index 98e9b8b34..41f9bb842 100644 --- a/lib/crates/fabro-cli/src/commands/run/mod.rs +++ b/lib/crates/fabro-cli/src/commands/run/mod.rs @@ -3,6 +3,7 @@ use anyhow::Result; use crate::args::{GlobalArgs, RunCommands}; pub(crate) mod attach; +pub(crate) mod cp; pub(crate) mod create; pub(crate) mod detached; pub(crate) mod detached_support; @@ -48,6 +49,7 @@ pub async fn dispatch(cmd: RunCommands, globals: &GlobalArgs) -> Result<()> { Ok(()) } RunCommands::Detached { run_dir, resume } => detached::execute(run_dir, resume).await, + RunCommands::Cp(args) => cp::cp_command(args).await, RunCommands::Preview(args) => preview::run(args).await, RunCommands::Ssh(args) => ssh::run(args).await, RunCommands::Diff(args) => diff::run(args).await, diff --git a/lib/crates/fabro-cli/src/main.rs b/lib/crates/fabro-cli/src/main.rs index 9cb8b0d4e..ecc6e8eeb 100644 --- a/lib/crates/fabro-cli/src/main.rs +++ b/lib/crates/fabro-cli/src/main.rs @@ -168,9 +168,6 @@ async fn main_inner() -> (String, Result<()>) { commands::parse::run(&args)?; } Commands::Asset(ns) => commands::asset::dispatch(ns)?, - Commands::Cp(args) => { - commands::cp::cp_command(args).await?; - } Commands::RunsCmd(cmd) => commands::runs::dispatch(cmd).await?, Commands::Model { command } => commands::model::execute(command, &globals).await?, #[cfg(feature = "server")] @@ -318,6 +315,20 @@ mod tests { } } + #[test] + fn parse_cp_command() { + let cli = Cli::try_parse_from(["fabro", "cp", "ABC123:/tmp/file", "./file"]) + .expect("should parse"); + match *cli.command { + Commands::RunCmd(RunCommands::Cp(args)) => { + assert_eq!(args.src, "ABC123:/tmp/file"); + assert_eq!(args.dst, "./file"); + assert!(!args.recursive); + } + _ => panic!("unexpected command variant"), + } + } + #[test] fn parse_detached_command() { let cli = Cli::try_parse_from(["fabro", "__detached", "--run-dir", "/tmp/runs/test"])