|
| 1 | +mod acp; |
| 2 | +mod agent; |
| 3 | +mod channel; |
| 4 | +mod config; |
| 5 | +mod daemon; |
| 6 | +mod harness; |
| 7 | +mod release; |
| 8 | +mod skills; |
| 9 | + |
| 10 | +use clap::Parser; |
| 11 | +use std::path::PathBuf; |
| 12 | + |
| 13 | +use crate::onboard::OnboardStarter; |
| 14 | + |
| 15 | +pub(crate) use acp::AcpCommand; |
| 16 | +pub(crate) use agent::{AgentCommand, AgentKind}; |
| 17 | +pub(crate) use channel::ChannelCommand; |
| 18 | +pub(crate) use config::ConfigCommand; |
| 19 | +pub(crate) use daemon::DaemonCommand; |
| 20 | +pub(crate) use harness::HarnessCommand; |
| 21 | +pub(crate) use release::ReleaseCommand; |
| 22 | +pub(crate) use skills::SkillsCommand; |
| 23 | + |
| 24 | +#[derive(Debug, Parser)] |
| 25 | +#[command(name = "loopforge")] |
| 26 | +#[command( |
| 27 | + about = "LoopForge: long-running agent operating system", |
| 28 | + long_about = None |
| 29 | +)] |
| 30 | +pub(crate) struct Cli { |
| 31 | + #[command(subcommand)] |
| 32 | + pub(crate) command: Command, |
| 33 | +} |
| 34 | + |
| 35 | +#[derive(Debug, clap::Subcommand)] |
| 36 | +pub(crate) enum Command { |
| 37 | + /// Initialize ~/.loopforge (config + database) |
| 38 | + Init, |
| 39 | + /// One-command onboarding check (init + config + doctor + optional first task) |
| 40 | + Onboard { |
| 41 | + /// Workspace directory for the first verification run |
| 42 | + #[arg(long, default_value = "loopforge-onboard-demo")] |
| 43 | + workspace: PathBuf, |
| 44 | + /// Optional explicit prompt for the first verification run |
| 45 | + #[arg(long)] |
| 46 | + prompt: Option<String>, |
| 47 | + /// Starter profile used when `--prompt` is not provided |
| 48 | + #[arg(long, value_enum, default_value_t = OnboardStarter::Hello)] |
| 49 | + starter: OnboardStarter, |
| 50 | + /// Skip running the first agent task and only run setup checks |
| 51 | + #[arg(long)] |
| 52 | + skip_agent: bool, |
| 53 | + /// Timeout for doctor probes (milliseconds) |
| 54 | + #[arg(long, default_value_t = 1500)] |
| 55 | + timeout_ms: u64, |
| 56 | + }, |
| 57 | + /// Diagnose common setup issues (config, providers, browser, tooling) |
| 58 | + Doctor { |
| 59 | + /// Print JSON output (machine-readable) |
| 60 | + #[arg(long)] |
| 61 | + json: bool, |
| 62 | + /// Exit non-zero if any warnings are detected |
| 63 | + #[arg(long)] |
| 64 | + strict: bool, |
| 65 | + /// Timeout for network probes (milliseconds) |
| 66 | + #[arg(long, default_value_t = 1500)] |
| 67 | + timeout_ms: u64, |
| 68 | + }, |
| 69 | + /// Run an agent session (LLM + tools + memory) |
| 70 | + Agent { |
| 71 | + #[command(subcommand)] |
| 72 | + command: AgentCommand, |
| 73 | + }, |
| 74 | + /// Outbound channels (outbox + dispatcher) |
| 75 | + Channel { |
| 76 | + #[command(subcommand)] |
| 77 | + command: ChannelCommand, |
| 78 | + }, |
| 79 | + /// ACP event/checkpoint inspection helpers |
| 80 | + Acp { |
| 81 | + #[command(subcommand)] |
| 82 | + command: AcpCommand, |
| 83 | + }, |
| 84 | + /// Config helpers |
| 85 | + Config { |
| 86 | + #[command(subcommand)] |
| 87 | + command: ConfigCommand, |
| 88 | + }, |
| 89 | + /// Skills discovery, doctor and execution helpers |
| 90 | + Skills { |
| 91 | + #[command(subcommand)] |
| 92 | + command: SkillsCommand, |
| 93 | + }, |
| 94 | + /// Long-running harness helpers (initializer + sessions) |
| 95 | + Harness { |
| 96 | + #[command(subcommand)] |
| 97 | + command: HarnessCommand, |
| 98 | + }, |
| 99 | + /// Run LoopForge daemon (HTTP API) |
| 100 | + Daemon { |
| 101 | + #[command(subcommand)] |
| 102 | + command: DaemonCommand, |
| 103 | + }, |
| 104 | + /// Release assistants (metadata + preflight checks) |
| 105 | + Release { |
| 106 | + #[command(subcommand)] |
| 107 | + command: ReleaseCommand, |
| 108 | + }, |
| 109 | +} |
0 commit comments