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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable Darc release changes should be summarized here.

## Unreleased

- Print post-upgrade auto-refresh restart guidance after `darc upgrade`.

## [0.2.0] - 2026-05-20

- Add Git-backed encrypted team sharing for selected Darc session context with `darc share`, `darc remote`,
Expand Down
15 changes: 15 additions & 0 deletions crates/cli/src/tests/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,21 @@ fn upgrade_check_json_uses_current_install_command() {
);
}

#[test]
fn post_upgrade_background_refresh_note_bolds_restart_command() {
let note = super::post_upgrade_background_refresh_note(HumanStyle::new(
true,
false,
Some("xterm-256color"),
));

assert!(note.contains("\x1b[1mdarc refresh --auto\x1b[0m"));
assert_eq!(
strip_ansi_text(&note),
"If Darc auto-refresh was running, run darc refresh --auto to restart it with the new version."
);
}

#[test]
fn upgrade_http_error_detail_is_bounded_and_single_line() {
let detail = super::upgrade_http_error_detail(" first line\nsecond\tline ").unwrap();
Expand Down
16 changes: 16 additions & 0 deletions crates/cli/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,27 @@ fn run_darc_upgrade(status: UpgradeStatus) -> Result<()> {
.status()
.with_context(|| format!("failed to run updater {}", updater_path.display()))?;
if result.success() {
print_post_upgrade_background_refresh_note(style);
return Ok(());
}
bail!("updater exited with status {result}")
}

/// Prints follow-up guidance for users with a running auto-refresh service.
fn print_post_upgrade_background_refresh_note(style: HumanStyle) {
println!();
print_section(style, "Background refresh");
print_line(2, post_upgrade_background_refresh_note(style));
}

/// Formats the post-upgrade auto-refresh restart guidance.
pub(crate) fn post_upgrade_background_refresh_note(style: HumanStyle) -> String {
format!(
"If Darc auto-refresh was running, run {} to restart it with the new version.",
style.bold("darc refresh --auto")
)
}

/// Checks GitHub Releases for the latest Darc CLI release.
fn check_darc_upgrade(timeout: Duration, auth: UpgradeCheckAuth) -> Result<UpgradeStatus> {
let current_version = env!("CARGO_PKG_VERSION").to_owned();
Expand Down
Loading