feat: show installed skills in UI (#7910)
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> Signed-off-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -135,6 +135,7 @@ pub enum ConfigValueResponse {
|
||||
pub enum CommandType {
|
||||
Builtin,
|
||||
Recipe,
|
||||
Skill,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||
@@ -387,14 +388,23 @@ pub async fn get_provider_models(
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, utoipa::IntoParams)]
|
||||
pub struct SlashCommandsQuery {
|
||||
/// Optional working directory to discover local skills from
|
||||
pub working_dir: Option<String>,
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/config/slash_commands",
|
||||
params(SlashCommandsQuery),
|
||||
responses(
|
||||
(status = 200, description = "Slash commands retrieved successfully", body = SlashCommandsResponse)
|
||||
)
|
||||
)]
|
||||
pub async fn get_slash_commands() -> Result<Json<SlashCommandsResponse>, ErrorResponse> {
|
||||
pub async fn get_slash_commands(
|
||||
axum::extract::Query(query): axum::extract::Query<SlashCommandsQuery>,
|
||||
) -> Result<Json<SlashCommandsResponse>, ErrorResponse> {
|
||||
let mut commands: Vec<_> = slash_commands::list_commands()
|
||||
.iter()
|
||||
.map(|command| SlashCommand {
|
||||
@@ -412,6 +422,23 @@ pub async fn get_slash_commands() -> Result<Json<SlashCommandsResponse>, ErrorRe
|
||||
});
|
||||
}
|
||||
|
||||
let working_dir = query.working_dir.map(std::path::PathBuf::from);
|
||||
for source in
|
||||
goose::agents::platform_extensions::summon::list_installed_sources(working_dir.as_deref())
|
||||
{
|
||||
if matches!(
|
||||
source.kind,
|
||||
goose::agents::platform_extensions::summon::SourceKind::Skill
|
||||
| goose::agents::platform_extensions::summon::SourceKind::BuiltinSkill
|
||||
) {
|
||||
commands.push(SlashCommand {
|
||||
command: source.name,
|
||||
help: source.description,
|
||||
command_type: CommandType::Skill,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Json(SlashCommandsResponse { commands }))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user