diff --git a/src/headless.rs b/src/headless.rs index 4185cf8..bc900eb 100644 --- a/src/headless.rs +++ b/src/headless.rs @@ -757,6 +757,31 @@ pub fn commit() { } } +/// Preview agent configuration without executing. +pub fn plan(preset: Option<&str>, config_path: Option<&str>) { + let configs = if let Some(name) = preset { + config::preset(name).unwrap_or_default() + } else if let Some(path) = config_path { + config::load(path) + } else { + eprintln!("usage: aishell plan -p or aishell plan -f "); + return; + }; + + if configs.is_empty() { + println!("(no agents)"); + return; + } + + println!("{} agent(s):", configs.len()); + for (i, c) in configs.iter().enumerate() { + let last = i == configs.len() - 1; + let prefix = if last { "└─" } else { "├─" }; + let task_short: String = c.task.chars().take(50).collect(); + println!(" {prefix} {:16} {task_short}", c.name); + } +} + /// Save the latest decision to aigpt memory (explicit, not automatic). pub fn remember() { let dec_path = format!("{STATE_DIR}/decision.json"); diff --git a/src/main.rs b/src/main.rs index 429731c..01b3fbf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -92,6 +92,11 @@ fn main() { aishell::headless::log(&id); } Some("decision") => aishell::headless::decision(), + Some("plan") => { + let preset = parse_flag("-p"); + let config = parse_flag("-f"); + aishell::headless::plan(preset.as_deref(), config.as_deref()); + } Some("commit") => aishell::headless::commit(), Some("context") => aishell::headless::context(), Some("remember") => aishell::headless::remember(), @@ -136,6 +141,7 @@ fn print_help() { println!(" aishell run Run single agent"); println!(" aishell run -p Preset: daily, review, improve, report"); println!(" aishell run -f Custom config file"); + println!(" aishell plan -p Preview agent config without running"); println!(" aishell commit Git commit with AI-suggested message"); println!(" aishell status [-v] Show agent status"); println!(" aishell log Show agent output");