Files
chrome-use/cli/src/upgrade.rs
T
leeguooooo 61060486f4
Release binaries / Build macOS ARM64 (push) Has been cancelled
Release binaries / Build macOS x64 (push) Has been cancelled
Release binaries / Build Linux ARM64 (push) Has been cancelled
Release binaries / Build Linux musl ARM64 (push) Has been cancelled
Release binaries / Build Linux musl x64 (push) Has been cancelled
Release binaries / Build Linux x64 (push) Has been cancelled
Release binaries / Build Windows x64 (push) Has been cancelled
Release binaries / Attach binaries to GitHub Release (push) Has been cancelled
rebrand: agent-browser-stealth → chrome-use, de-fork, reset to v1.0.0
Standalone product rename across the whole repo (issue: project identity):

- Binary/package/repo/skill/docs: agent-browser[-stealth] → chrome-use
  (single binary name `chrome-use`; old aliases agent-browser/abs dropped).
- Version: 0.27.0-fork.51 → 1.0.0 (drop the upstream-fork counter).
- Native-messaging host: com.agent_browser.connect → com.leeguoo.chrome_use
  (CLI + ab-connect extension in lockstep — this is a breaking handshake change,
  extension bumped 0.4.2 → 0.5.0, needs a Web Store republish).
- Config dir: ~/.agent-browser → ~/.chrome-use.
- README/zh: reframed from "stealth fork of agent-browser" to a standalone
  product with a small `originally based on vercel-labs/agent-browser` credit.
- Kept AGENT_BROWSER_* env vars working (63 vars across the codebase; renaming
  them would break every existing script/skill for no user-facing gain).

Build green, 802 unit tests pass, fmt + clippy clean. Upstream attribution to
vercel-labs/agent-browser preserved.
2026-06-12 12:56:21 +09:00

73 lines
2.6 KiB
Rust

use crate::color;
use std::process::{exit, Command};
const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION");
/// Canonical installer for the stealth fork. `upgrade` just re-runs it, so the
/// upgrade path and the install path are identical (GitHub Release, no npm).
const INSTALL_URL: &str = "https://raw.githubusercontent.com/leeguooooo/chrome-use/main/install.sh";
/// Upgrade to the latest GitHub Release.
///
/// The stealth fork ships as a prebuilt binary attached to a GitHub Release —
/// NOT via the npm registry. Earlier this command (inherited from upstream)
/// ran `npm/pnpm install -g chrome-use@latest`, which installed the
/// UNRELATED upstream `chrome-use` package and clobbered the user's setup.
/// Now `upgrade` simply re-runs install.sh into the same directory as the
/// current binary, so it always tracks the freshest GitHub Release.
pub fn run_upgrade() {
println!(
"{}",
color::cyan(&format!(
"Upgrading chrome-use (currently v{}) from the latest GitHub Release...",
CURRENT_VERSION
))
);
#[cfg(windows)]
{
eprintln!(
"{} Automatic upgrade isn't supported on Windows.",
color::warning_indicator()
);
eprintln!(" Download the latest chrome-use-win32-x64.tar.gz from:");
eprintln!(" https://github.com/leeguooooo/chrome-use/releases/latest");
eprintln!(" and replace chrome-use.exe on your PATH.");
exit(1);
}
#[cfg(not(windows))]
{
// Install into the SAME directory as the running binary (in-place
// upgrade), so we don't create a second copy elsewhere on PATH.
let bin_dir = std::env::current_exe()
.ok()
.and_then(|p| p.canonicalize().ok())
.and_then(|p| p.parent().map(|d| d.to_path_buf()));
let install_cmd = format!("curl -fsSL {} | sh", INSTALL_URL);
println!("Running: {}", install_cmd);
let mut cmd = Command::new("sh");
cmd.arg("-c").arg(&install_cmd);
if let Some(ref dir) = bin_dir {
cmd.env("AGENT_BROWSER_BIN_DIR", dir);
}
let ok = cmd.status().map(|s| s.success()).unwrap_or(false);
if ok {
println!(
"{} Upgrade complete — run `chrome-use --version` to confirm.",
color::success_indicator()
);
} else {
eprintln!(
"{} Upgrade failed. Install manually:",
color::error_indicator()
);
eprintln!(" curl -fsSL {} | sh", INSTALL_URL);
exit(1);
}
}
}