feat(headless): add plan command for previewing agent configuration
This commit is contained in:
@@ -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 <preset> or aishell plan -f <config>");
|
||||
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");
|
||||
|
||||
@@ -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 <task> Run single agent");
|
||||
println!(" aishell run -p <preset> Preset: daily, review, improve, report");
|
||||
println!(" aishell run -f <config> Custom config file");
|
||||
println!(" aishell plan -p <preset> Preview agent config without running");
|
||||
println!(" aishell commit Git commit with AI-suggested message");
|
||||
println!(" aishell status [-v] Show agent status");
|
||||
println!(" aishell log <id|name> Show agent output");
|
||||
|
||||
Reference in New Issue
Block a user