pub use crate::prompt::tool::builtin::NAMES as BUILTIN_TOOLS;
pub use crate::prompt::tool::inject::{InjectedTool, RoutedCall, RoutedCapture, ToolInjection};
pub use seam::{Error, Fx, Outcome};
pub mod advance;
pub mod bundle;
pub mod config;
pub mod delete;
pub mod dispatch;
pub mod invoke;
pub mod message;
pub mod new;
pub mod prelude;
pub mod prime;
pub mod prompt;
pub mod proposal;
pub mod replay;
pub mod retarget;
pub mod scan;
pub mod seam;
pub mod skills;
pub mod stop;
pub mod tool;
pub mod workflow;
#[cfg(test)]
mod tests;
#[derive(clap::Parser, Debug)]
#[command(name = "litany", about = "Git-backed agent harness",
version = crate::prompt::cli_version())]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(clap::Subcommand, Debug)]
pub enum Command {
New(new::Args),
Config(config::Args),
Prompt(prompt::Args),
Dispatch(dispatch::Args),
Retarget(retarget::Args),
Workflow(workflow::Args),
Stop(stop::Args),
Message(message::Args),
Scan(scan::Args),
Proposal(proposal::Args),
Skills(skills::Args),
Bundle(bundle::Args),
Delete(delete::Args),
Replay(replay::Args),
Advance(advance::Args),
Invoke(invoke::Args),
Tool(tool::Args),
Prime(prime::Args),
}
impl Command {
pub fn preludes(&self) -> &'static [fn()] {
match self {
Command::Prompt(_) | Command::Advance(_) => {
&[prelude::become_pgid_leader, prelude::install_stop_handler]
}
Command::Dispatch(_) => &[prelude::become_pgid_leader],
_ => &[],
}
}
pub fn run(self, fx: &mut Fx) -> Result<Outcome, Error> {
match self {
Command::New(a) => new::run(a, fx),
Command::Config(a) => config::run(a, fx),
Command::Prompt(a) => prompt::run(a, fx),
Command::Dispatch(a) => dispatch::run(a, fx),
Command::Retarget(a) => retarget::run(a, fx),
Command::Workflow(a) => workflow::run(a, fx),
Command::Stop(a) => stop::run(a, fx),
Command::Message(a) => message::run(a, fx),
Command::Proposal(a) => proposal::run(a, fx),
Command::Scan(a) => scan::run(a, fx),
Command::Skills(a) => skills::run(a, fx),
Command::Bundle(a) => bundle::run(a, fx),
Command::Delete(a) => delete::run(a, fx),
Command::Replay(a) => replay::run(a, fx),
Command::Advance(a) => advance::run(a, fx),
Command::Invoke(a) => invoke::run(a, fx),
Command::Tool(a) => tool::run(a, fx),
Command::Prime(a) => prime::run(a, fx),
}
}
}