#![warn(missing_docs)]
pub mod agent_config;
pub mod checkout;
pub mod cli;
pub mod commands;
#[cfg(feature = "fixture")]
pub mod demo_script;
#[cfg(feature = "fixture")]
pub mod demo_tools;
pub mod dev_server;
pub mod render;
pub mod serve_kill;
use anyhow::Result;
use crate::cli::{Cli, Command};
pub fn init_tracing() {
use std::io::IsTerminal;
use tracing_subscriber::{EnvFilter, fmt};
let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
let _ = fmt()
.with_env_filter(filter)
.with_writer(std::io::stderr)
.with_target(false)
.with_ansi(std::io::stderr().is_terminal())
.try_init();
}
pub async fn dispatch(cli: Cli) -> Result<u8> {
let store = cli.store.as_path();
match cli.command {
Command::Run(args) => commands::run(store, args).await,
Command::Resume(args) => commands::resume(store, args).await,
Command::Fork(args) => commands::fork(store, args).await,
Command::Resolve(args) => commands::resolve(store, args).await,
Command::Abandon(args) => commands::abandon(store, args).await,
Command::List => commands::list(store).await,
Command::History(args) => commands::history(store, args).await,
Command::Replay(args) => commands::replay(store, args).await,
Command::Serve(args) => commands::serve(store, args).await,
Command::Build(args) => commands::build(args).await,
Command::Graph { command } => match command {
crate::cli::GraphCommand::Validate(args) => commands::graph_validate(args),
crate::cli::GraphCommand::Schema => commands::graph_schema(),
crate::cli::GraphCommand::Run(args) => commands::graph_run(store, args).await,
},
}
}