feat(headless): add review command with auto-commit on pass
This commit is contained in:
@@ -147,6 +147,34 @@ pub fn run(config_or_task: &str, cwd_override: Option<&str>, name_override: Opti
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Review changes, auto-commit if no issues found.
|
||||
pub fn review() {
|
||||
let configs = config::preset("review").unwrap();
|
||||
match execute_once(configs) {
|
||||
Ok(()) => {
|
||||
// Check if decision says "no issues" / "問題なし" / "コミット可能"
|
||||
if let Ok(content) = std::fs::read_to_string(format!("{STATE_DIR}/decision.json")) {
|
||||
if let Ok(d) = serde_json::from_str::<serde_json::Value>(&content) {
|
||||
let text = d["decision"].as_str().unwrap_or("").to_lowercase();
|
||||
if text.contains("コミット可能") || text.contains("no issues") || text.contains("問題なし") || text.contains("commit") {
|
||||
eprintln!("\n review passed → running commit...");
|
||||
commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => eprintln!(" review failed: {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Run daily health check.
|
||||
pub fn daily() {
|
||||
match run_preset("daily") {
|
||||
Ok(()) => {}
|
||||
Err(e) => eprintln!(" daily failed: {e}"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_preset(preset_name: &str) -> Result<(), String> {
|
||||
let configs = config::preset(preset_name)
|
||||
.ok_or_else(|| format!("unknown preset: {preset_name}"))?;
|
||||
|
||||
@@ -93,6 +93,8 @@ fn main() {
|
||||
aishell::headless::log(&id);
|
||||
}
|
||||
Some("decision") => aishell::headless::decision(),
|
||||
Some("review") => aishell::headless::review(),
|
||||
Some("daily") => aishell::headless::daily(),
|
||||
Some("plan") => {
|
||||
let preset = parse_flag("-p");
|
||||
let config = parse_flag("-f");
|
||||
@@ -140,6 +142,8 @@ fn print_help() {
|
||||
println!("aishell v{}\n", env!("CARGO_PKG_VERSION"));
|
||||
println!("USAGE:");
|
||||
println!(" aishell TUI (AI + Agents + Shell)");
|
||||
println!(" aishell review Review changes + auto-commit if clean");
|
||||
println!(" aishell daily Health + quality + idea check");
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user