changed user choice for TODO stale check

user can ignore, mark stale or quit.
This commit is contained in:
Jochen
2025-11-21 12:35:14 +11:00
parent 84718223bc
commit 551a577ee1
5 changed files with 99 additions and 39 deletions

View File

@@ -4276,8 +4276,25 @@ impl<W: UiWriter> Agent<W> {
print!("\x07\x07\x07\x07\x07\x07");
let _ = std::io::stdout().flush();
if !self.ui_writer.prompt_user_yes_no("Requirements have changed! Continue?") {
return Ok("❌ User aborted due to stale TODO list.".to_string());
let options = ["Ignore and Continue", "Mark as Stale", "Quit Application"];
let choice = self.ui_writer.prompt_user_choice("Requirements have changed! What would you like to do?", &options);
match choice {
0 => {
// Ignore and Continue
self.ui_writer.print_context_status("⚠️ Ignoring staleness warning.");
}
1 => {
// Mark as Stale
// We return a message to the agent so it knows to regenerate/fix it.
return Ok("⚠️ TODO list is stale (requirements changed). Please regenerate the TODO list to match the new requirements.".to_string());
}
2 => {
// Quit Application
self.ui_writer.print_context_status("❌ Quitting application as requested.");
std::process::exit(0);
}
_ => unreachable!(),
}
}
}

View File

@@ -59,6 +59,10 @@ pub trait UiWriter: Send + Sync {
/// Prompt the user for a yes/no confirmation
fn prompt_user_yes_no(&self, message: &str) -> bool;
/// Prompt the user to choose from a list of options
/// Returns the index of the selected option
fn prompt_user_choice(&self, message: &str, options: &[&str]) -> usize;
}
/// A no-op implementation for when UI output is not needed
@@ -84,4 +88,5 @@ impl UiWriter for NullUiWriter {
fn flush(&self) {}
fn wants_full_output(&self) -> bool { false }
fn prompt_user_yes_no(&self, _message: &str) -> bool { true }
fn prompt_user_choice(&self, _message: &str, _options: &[&str]) -> usize { 0 }
}