Added cmd to validate bundled extensions json (#7217)

This commit is contained in:
Zane
2026-02-17 09:47:48 -08:00
committed by GitHub
parent ff3ad4349d
commit fea34accc2
4 changed files with 290 additions and 0 deletions
+24
View File
@@ -863,6 +863,16 @@ enum Command {
#[arg(long, default_value = "goose", help = "Provide a custom binary name")]
bin_name: String,
},
#[command(
name = "validate-extensions",
about = "Validate a bundled-extensions.json file",
hide = true
)]
ValidateExtensions {
#[arg(help = "Path to the bundled-extensions.json file")]
file: PathBuf,
},
}
#[derive(Subcommand)]
@@ -955,6 +965,7 @@ fn get_command_name(command: &Option<Command>) -> &'static str {
Some(Command::Web { .. }) => "web",
Some(Command::Term { .. }) => "term",
Some(Command::Completion { .. }) => "completion",
Some(Command::ValidateExtensions { .. }) => "validate-extensions",
None => "default_session",
}
}
@@ -1519,6 +1530,19 @@ pub async fn cli() -> anyhow::Result<()> {
no_auth,
}) => crate::commands::web::handle_web(port, host, open, auth_token, no_auth).await,
Some(Command::Term { command }) => handle_term_subcommand(command).await,
Some(Command::ValidateExtensions { file }) => {
use goose::agents::validate_extensions::validate_bundled_extensions;
match validate_bundled_extensions(&file) {
Ok(msg) => {
println!("{msg}");
Ok(())
}
Err(e) => {
eprintln!("{e}");
std::process::exit(1);
}
}
}
None => handle_default_session().await,
}
}