From 0068be9ffcc9b07b6a13724d010c6dbdeaee8327 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Fri, 14 Aug 2026 12:27:38 -0700 Subject: [PATCH] Run the CLI update check in non-interactive shells so agents see it --- crates-cli/yaak-cli/skills/use-yaak/SKILL.md | 3 +++ crates-cli/yaak-cli/src/version_check.rs | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates-cli/yaak-cli/skills/use-yaak/SKILL.md b/crates-cli/yaak-cli/skills/use-yaak/SKILL.md index 74e12e6b..030c7a99 100644 --- a/crates-cli/yaak-cli/skills/use-yaak/SKILL.md +++ b/crates-cli/yaak-cli/skills/use-yaak/SKILL.md @@ -170,3 +170,6 @@ check the status. 5. Never write a real secret into an environment variable on the user's behalf. Reference one and let them fill in the value. 6. Verify what you built by sending it, and report the real HTTP status. +7. If the CLI warns on stderr that a newer version is available, offer to run + the upgrade command it prints, then re-run `yaak agent install` so this + skill updates too. diff --git a/crates-cli/yaak-cli/src/version_check.rs b/crates-cli/yaak-cli/src/version_check.rs index 4c1f3f4b..7f4d5bb2 100644 --- a/crates-cli/yaak-cli/src/version_check.rs +++ b/crates-cli/yaak-cli/src/version_check.rs @@ -47,6 +47,8 @@ struct VersionCheckRequest<'a> { install_source: String, platform: &'a str, arch: &'a str, + // False when stdout is piped, e.g. a coding agent driving the CLI + interactive: bool, } pub async fn maybe_check_for_updates() { @@ -102,11 +104,7 @@ fn should_skip_check() -> bool { return true; } - if std::env::var("CI").is_ok() { - return true; - } - - !std::io::stdout().is_terminal() + std::env::var("CI").is_ok() } async fn fetch_version_check() -> Option { @@ -118,6 +116,7 @@ async fn fetch_version_check() -> Option { install_source: install_source(), platform: std::env::consts::OS, arch: std::env::consts::ARCH, + interactive: std::io::stdout().is_terminal(), }; let client = yaak_api_client(ApiClientKind::Cli, current_version).ok()?;