diff --git a/src/help.rs b/src/help.rs index 9fdd8d7..9fdbd51 100644 --- a/src/help.rs +++ b/src/help.rs @@ -440,6 +440,7 @@ Switch channel and update: Auto-update is on by default. On startup a background process checks GitHub Releases, and while a coding agent is running it rechecks every few hours, then installs in place. The next `{bin}` uses the new build. +Press Ctrl+G in the agent to restart and resume after an auto-upgrade. auto_update: false in ~/.anyrouter/config.yaml to turn it off channel: beta follow main (GitHub prereleases) @@ -458,7 +459,7 @@ While installing, a spinner ticks with the from → to versions and channel: ⠋ Updating v0.1.11 -> v0.1.99 (stable channel) ✔ Updated to v0.1.99 - Run anyr to start using the new version. + Run anyr to start using the new version. Press Ctrl+G in the agent to restart and resume. --check reports current vs latest without installing. --fixture / ANYR_RELEASES_JSON skips the network (tests / dry-run). diff --git a/src/spinner.rs b/src/spinner.rs index 82dc216..7b79d8a 100644 --- a/src/spinner.rs +++ b/src/spinner.rs @@ -12,7 +12,11 @@ use crate::term::{self, BLUE, SUCCESS}; /// Braille spinner frames. Consecutive indices are visually distinct. pub const FRAMES: &[&str] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]; -pub const START_USING: &str = "Run anyr to start using the new version."; +/// After an in-place upgrade, a running agent still has the old binary in memory. +pub const RESTART_RESUME_HINT: &str = "Press Ctrl+G in the agent to restart and resume."; + +pub const START_USING: &str = + "Run anyr to start using the new version. Press Ctrl+G in the agent to restart and resume."; const DEFAULT_INTERVAL_MS: u64 = 80; const DEFAULT_MIN_TICKS: usize = 4; @@ -311,5 +315,7 @@ mod tests { ); assert!(text.contains("✔ Would update to v0.1.99"), "{text}"); assert!(text.contains(START_USING), "{text}"); + assert!(text.contains(RESTART_RESUME_HINT), "{text}"); + assert!(text.contains("Ctrl+G"), "{text}"); } } diff --git a/src/upgrade.rs b/src/upgrade.rs index 74cc6da..f3e2220 100644 --- a/src/upgrade.rs +++ b/src/upgrade.rs @@ -547,7 +547,8 @@ fn print_pending_notice(env: &BTreeMap) { } let running = VERSION.trim().strip_prefix('v').unwrap_or(VERSION.trim()); if ver == running { - eprintln!("anyr: updated to {ver}"); + eprintln!("anyr: auto-updated to {ver}"); + eprintln!("{}", crate::spinner::RESTART_RESUME_HINT); let _ = fs::remove_file(&path); } } @@ -923,6 +924,13 @@ mod tests { assert!(!auto_update_enabled(&env)); } + #[test] + fn pending_notice_mentions_auto_update_and_ctrl_g() { + assert!(crate::spinner::RESTART_RESUME_HINT.contains("Ctrl+G")); + assert!(crate::spinner::RESTART_RESUME_HINT.contains("restart and resume")); + assert!(crate::spinner::START_USING.contains("Ctrl+G")); + } + fn parsed_check() -> ParsedArgs { ParsedArgs { command: "upgrade".into(), diff --git a/tests/cli.rs b/tests/cli.rs index b1a058b..8e71589 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -910,6 +910,10 @@ fn upgrade_help_mentions_channel_stable_beta() { stdout.contains("Run anyr to start using the new version."), "upgrade help should show the post-update hint, got:\n{stdout}" ); + assert!( + stdout.contains("Ctrl+G") && stdout.contains("restart and resume"), + "upgrade help should mention Ctrl+G restart/resume after auto-upgrade:\n{stdout}" + ); } #[test]