Move fabro-cli cp under run commands

This commit is contained in:
Bryan Helmkamp 2026-03-27 10:32:30 -04:00
parent ad96519858
commit 4a6aba6e10
5 changed files with 19 additions and 7 deletions

View file

@ -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",

View file

@ -1,5 +1,4 @@
pub mod asset;
pub mod cp;
pub mod doctor;
pub mod exec;
pub mod graph;

View file

@ -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,

View file

@ -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"])