use super::{Error, Fx, Outcome};
use crate::prompt::dispatch_cli;
use std::path::PathBuf;
#[derive(clap::Args, Debug)]
pub struct Args {
pub role: String,
pub repo: PathBuf,
pub branch: String,
#[arg(long)]
pub goal: Option<String>,
}
pub fn run(args: Args, fx: &mut Fx) -> Result<Outcome, Error> {
crate::name::require_agent_id(&args.branch)
.map_err(|e| Error::new(format!("dispatch {}", args.role), e))?;
dispatch_cli::run(
&args.role,
&args.repo,
&args.branch,
args.goal.as_deref(),
&fx.driver_target,
)
.map_err(|e| Error::new(format!("dispatch {}", args.role), e))?;
Ok(Outcome::Quiet)
}