Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 <path> / ANYR_RELEASES_JSON skips the network (tests / dry-run).
Expand Down
8 changes: 7 additions & 1 deletion src/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}");
}
}
10 changes: 9 additions & 1 deletion src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ fn print_pending_notice(env: &BTreeMap<String, String>) {
}
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);
}
}
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 4 additions & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading