1mod commands;
2pub mod display;
3pub mod init_templates;
4
5use clap::{Parser, Subcommand};
6
7#[derive(Parser)]
8#[command(
9 name = "minion",
10 about = "AI Workflow Engine — orchestrate Claude Code CLI with YAML workflows",
11 version,
12 after_help = "\x1b[1mQuick start:\x1b[0m
13 cargo install --path .
14 export ANTHROPIC_API_KEY=\"sk-ant-...\"
15 gh auth login
16 minion execute workflows/code-review.yaml --sandbox -- <PR_NUMBER>
17
18\x1b[1mRequirements:\x1b[0m
19 • ANTHROPIC_API_KEY — required for AI steps (chat, map)
20 • gh auth login — required for GitHub-based workflows (GH_TOKEN auto-detected)
21 • Docker Desktop — required for --sandbox mode (creates isolated containers)
22
23\x1b[1mExamples:\x1b[0m
24 minion execute workflows/code-review.yaml -- 42 Review PR #42 (sandbox on by default)
25 minion execute workflows/fix-issue.yaml -- 123 Fix issue #123
26 minion execute my-workflow.yaml --no-sandbox -- main Run without Docker sandbox
27 minion list List available workflows
28 minion init my-workflow --template code-review Create a new workflow"
29)]
30pub struct Cli {
31 #[command(subcommand)]
32 command: Command,
33}
34
35#[derive(Subcommand)]
36enum Command {
37 Execute(commands::ExecuteArgs),
39 Validate(commands::ValidateArgs),
41 List,
43 Init(commands::InitArgs),
45 Inspect(commands::InspectArgs),
47 Version,
49}
50
51impl Cli {
52 pub async fn run(self) -> anyhow::Result<()> {
53 match self.command {
54 Command::Execute(args) => commands::execute(args).await,
55 Command::Validate(args) => commands::validate(args).await,
56 Command::List => commands::list().await,
57 Command::Init(args) => commands::init(args).await,
58 Command::Inspect(args) => commands::inspect(args).await,
59 Command::Version => {
60 println!("minion {}", env!("CARGO_PKG_VERSION"));
61 Ok(())
62 }
63 }
64 }
65}