mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-24 20:34:05 +02:00
Run the CLI update check in non-interactive shells so agents see it
This commit is contained in:
@@ -170,3 +170,6 @@ check the status.
|
|||||||
5. Never write a real secret into an environment variable on the user's behalf.
|
5. Never write a real secret into an environment variable on the user's behalf.
|
||||||
Reference one and let them fill in the value.
|
Reference one and let them fill in the value.
|
||||||
6. Verify what you built by sending it, and report the real HTTP status.
|
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.
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ struct VersionCheckRequest<'a> {
|
|||||||
install_source: String,
|
install_source: String,
|
||||||
platform: &'a str,
|
platform: &'a str,
|
||||||
arch: &'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() {
|
pub async fn maybe_check_for_updates() {
|
||||||
@@ -102,11 +104,7 @@ fn should_skip_check() -> bool {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if std::env::var("CI").is_ok() {
|
std::env::var("CI").is_ok()
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
!std::io::stdout().is_terminal()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn fetch_version_check() -> Option<VersionCheckResponse> {
|
async fn fetch_version_check() -> Option<VersionCheckResponse> {
|
||||||
@@ -118,6 +116,7 @@ async fn fetch_version_check() -> Option<VersionCheckResponse> {
|
|||||||
install_source: install_source(),
|
install_source: install_source(),
|
||||||
platform: std::env::consts::OS,
|
platform: std::env::consts::OS,
|
||||||
arch: std::env::consts::ARCH,
|
arch: std::env::consts::ARCH,
|
||||||
|
interactive: std::io::stdout().is_terminal(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let client = yaak_api_client(ApiClientKind::Cli, current_version).ok()?;
|
let client = yaak_api_client(ApiClientKind::Cli, current_version).ok()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user