feat: add built-in upgrade command for self-update (#898)
Adds a new `agent-browser upgrade` command that automatically detects the installation method (npm, Homebrew, or Cargo) and runs the appropriate update command. **Changes:** - Added new `upgrade.rs` module with upgrade logic - Updated `main.rs` to handle the `upgrade` command - Added upgrade help text in `output.rs` - Updated README.md and documentation with upgrade instructions - Updated SKILL.md to mention the upgrade command **Implementation details:** - Fetches latest version from npm registry to show version diff - Auto-detects installation method by checking Homebrew, Cargo paths, and npm global packages - Provides fallback instructions if installation method cannot be determined - Uses existing color module for consistent styled output - Gracefully handles network failures and continues with upgrade Fixes #895
This commit is contained in:
@@ -7,6 +7,7 @@ mod native;
|
||||
mod output;
|
||||
#[cfg(test)]
|
||||
mod test_utils;
|
||||
mod upgrade;
|
||||
mod validation;
|
||||
|
||||
use serde_json::json;
|
||||
@@ -26,6 +27,7 @@ use install::run_install;
|
||||
use output::{
|
||||
print_command_help, print_help, print_response_with_opts, print_version, OutputOptions,
|
||||
};
|
||||
use upgrade::run_upgrade;
|
||||
|
||||
fn serialize_json_value(value: &serde_json::Value) -> String {
|
||||
serde_json::to_string(value).unwrap_or_else(|_| {
|
||||
@@ -226,6 +228,12 @@ fn main() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle upgrade separately
|
||||
if clean.first().map(|s| s.as_str()) == Some("upgrade") {
|
||||
run_upgrade();
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle session separately (doesn't need daemon)
|
||||
if clean.first().map(|s| s.as_str()) == Some("session") {
|
||||
run_session(&clean, &flags.session, flags.json);
|
||||
|
||||
Reference in New Issue
Block a user