add (auto) updating for plugins (#9061)
This commit is contained in:
@@ -14,7 +14,7 @@ use goose_mcp::{AutoVisualiserRouter, ComputerControllerServer, MemoryServer, Tu
|
||||
use crate::commands::configure::configure_telemetry_consent_dialog;
|
||||
use crate::commands::configure::handle_configure;
|
||||
use crate::commands::info::handle_info;
|
||||
use crate::commands::plugin::handle_plugin_install;
|
||||
use crate::commands::plugin::{handle_plugin_install, handle_plugin_update};
|
||||
use crate::commands::project::{handle_project_default, handle_projects_interactive};
|
||||
use crate::commands::recipe::{handle_deeplink, handle_list, handle_open, handle_validate};
|
||||
use crate::commands::term::{
|
||||
@@ -649,9 +649,22 @@ enum PluginCommand {
|
||||
/// Install a plugin from a git repository URL
|
||||
#[command(about = "Install a plugin from a git repository URL")]
|
||||
Install {
|
||||
#[arg(
|
||||
long,
|
||||
help = "Automatically update this plugin before plugin skills are loaded"
|
||||
)]
|
||||
auto_update: bool,
|
||||
|
||||
#[arg(help = "URL to a git repository containing a supported plugin")]
|
||||
url: String,
|
||||
},
|
||||
|
||||
/// Update an installed git-backed plugin
|
||||
#[command(about = "Update an installed git-backed plugin")]
|
||||
Update {
|
||||
#[arg(help = "Name of the installed plugin to update")]
|
||||
name: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@@ -1550,7 +1563,8 @@ async fn handle_schedule_command(command: SchedulerCommand) -> Result<()> {
|
||||
|
||||
fn handle_plugin_subcommand(command: PluginCommand) -> Result<()> {
|
||||
match command {
|
||||
PluginCommand::Install { url } => handle_plugin_install(&url),
|
||||
PluginCommand::Install { url, auto_update } => handle_plugin_install(&url, auto_update),
|
||||
PluginCommand::Update { name } => handle_plugin_update(&name),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
use anyhow::Result;
|
||||
use console::style;
|
||||
|
||||
pub fn handle_plugin_install(url: &str) -> Result<()> {
|
||||
let install = goose::plugins::install_plugin(url)?;
|
||||
pub fn handle_plugin_install(url: &str, auto_update: bool) -> Result<()> {
|
||||
let install = goose::plugins::install_plugin_with_options(
|
||||
url,
|
||||
goose::plugins::PluginInstallOptions { auto_update },
|
||||
)?;
|
||||
|
||||
println!(
|
||||
"{} Installed {} plugin '{}' ({})",
|
||||
@@ -11,6 +14,27 @@ pub fn handle_plugin_install(url: &str) -> Result<()> {
|
||||
style(&install.name).bold(),
|
||||
install.version
|
||||
);
|
||||
print_plugin_install(&install);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn handle_plugin_update(name: &str) -> Result<()> {
|
||||
let install = goose::plugins::update_plugin(name)?;
|
||||
|
||||
println!(
|
||||
"{} Updated {} plugin '{}' ({})",
|
||||
style("✓").green(),
|
||||
install.format,
|
||||
style(&install.name).bold(),
|
||||
install.version
|
||||
);
|
||||
print_plugin_install(&install);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_plugin_install(install: &goose::plugins::PluginInstall) {
|
||||
println!(" Source: {}", install.source);
|
||||
println!(" Location: {}", install.directory.display());
|
||||
|
||||
@@ -18,10 +42,8 @@ pub fn handle_plugin_install(url: &str) -> Result<()> {
|
||||
println!(" No skills imported.");
|
||||
} else {
|
||||
println!(" Imported skills:");
|
||||
for skill in install.skills {
|
||||
for skill in &install.skills {
|
||||
println!(" - {}", skill.name);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user