Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions crates/goose-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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",
}
}
Expand Down Expand Up @@ -1519,6 +1530,24 @@ 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;
let result = validate_bundled_extensions(&file)?;
if result.is_ok() {
println!("✓ All {} extensions validated successfully.", result.total);
Ok(())
} else {
eprintln!(
"✗ Found {} error(s) in {} extensions:\n",
result.errors.len(),
result.total
);
for err in &result.errors {
eprintln!(" {}", err);
}
std::process::exit(1);
}
}
None => handle_default_session().await,
}
}
25 changes: 25 additions & 0 deletions crates/goose-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ mod routes;
mod state;
mod tunnel;

use std::path::PathBuf;

use clap::{Parser, Subcommand};
use goose::agents::validate_extensions;
use goose::config::paths::Paths;
use goose_mcp::{
mcp_server_runner::{serve, McpCommand},
Expand All @@ -31,6 +34,12 @@ enum Commands {
#[arg(value_parser = clap::value_parser!(McpCommand))]
server: McpCommand,
},
/// Validate a bundled-extensions JSON file
#[command(name = "validate-extensions")]
ValidateExtensions {
/// Path to the bundled-extensions JSON file
path: PathBuf,
},
}

#[tokio::main]
Expand Down Expand Up @@ -59,6 +68,22 @@ async fn main() -> anyhow::Result<()> {
}
}
}
Commands::ValidateExtensions { path } => {
let result = validate_extensions::validate_bundled_extensions(&path)?;
if result.errors.is_empty() {
println!("✓ All {} extensions validated successfully.", result.total);
} else {
eprintln!(
"✗ Found {} error(s) in {} extension(s):\n",
result.errors.len(),
result.errors.len()
);
for (i, error) in result.errors.iter().enumerate() {
eprintln!(" [{}] {}", i, error);
}
std::process::exit(1);
}
}
Comment thread
zanesq marked this conversation as resolved.
}

Ok(())
Expand Down
10 changes: 10 additions & 0 deletions crates/goose/src/agents/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,16 @@ impl ExtensionConfig {
}
}

pub const VALID_TYPES: &[&str] = &[
Comment thread
zanesq marked this conversation as resolved.
Outdated
"sse",
"stdio",
"builtin",
"platform",
"streamable_http",
"frontend",
"inline_python",
];

pub fn key(&self) -> String {
name_to_key(&self.name())
}
Expand Down
1 change: 1 addition & 0 deletions crates/goose/src/agents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub(crate) mod subagent_handler;
pub(crate) mod subagent_task_config;
mod tool_execution;
pub mod types;
pub mod validate_extensions;

pub use agent::{Agent, AgentConfig, AgentEvent, ExtensionLoadResult};
pub use container::Container;
Expand Down
Loading
Loading