watch : supervision d'un agent avec redemarrage automatique et backoff (issue #35) - check_once testable, notification desktop, Ctrl-C n'affecte pas l'agent detache

This commit is contained in:
2026-08-17 08:58:19 -04:00
parent 18784ba9f7
commit 8d93eece1e
5 changed files with 157 additions and 1 deletions
+9 -1
View File
@@ -70,6 +70,7 @@ const COMMAND_DESCRIPTIONS: &[(&str, &str)] = &[
("init", "generate a project config"),
("alias", "manage aliases"),
("open", "open the install dir"),
("watch", "supervise an agent"),
("search", "search the catalog"),
("info", "agent details"),
("install", "install an agent"),
@@ -146,7 +147,7 @@ impl AmCompleter {
Self {
theme: std::cell::Cell::new(crate::theme::default_theme()),
commands: vec![
"list", "status", "sessions", "stats", "projects", "timeline", "log", "logs", "history", "init", "alias", "open", "search", "info", "install", "uninstall", "update",
"list", "status", "sessions", "stats", "projects", "timeline", "log", "logs", "history", "init", "alias", "open", "watch", "search", "info", "install", "uninstall", "update",
"start", "stop", "restart", "run", "doctor", "config", "completion",
"self-update", "self-uninstall", "export", "import", "shell", "theme",
"ls", "dir", "cd", "ps", "where", "get", "help", "version", "exit",
@@ -1230,6 +1231,12 @@ fn handle_line(
"open" => Command::Open {
agent: need("agent name")?,
},
"watch" => Command::Watch {
agent: need("agent name")?,
restart: flag("--restart"),
notify: flag("--notify"),
interval: opt_value("--interval").and_then(|v| v.parse().ok()).unwrap_or(5),
},
"alias" => match rest.first().map(|s| s.as_str()) {
Some("add") if rest.len() >= 3 => Command::Alias(crate::cli::AliasCmd::Add {
name: rest[1].clone(),
@@ -1398,6 +1405,7 @@ fn is_am_command(word: &str) -> bool {
| "init"
| "alias"
| "open"
| "watch"
| "search"
| "info"
| "install"