use std::future::Future;
use std::pin::Pin;
use crate::context::CommandContext;
use crate::{CommandError, CommandHandler, CommandOutput, SlashCategory};
pub struct SkillCommand;
impl CommandHandler<CommandContext<'_>> for SkillCommand {
fn name(&self) -> &'static str {
"/skill"
}
fn description(&self) -> &'static str {
"Load and display a skill body, or manage skill lifecycle"
}
fn args_hint(&self) -> &'static str {
"<name|subcommand>"
}
fn category(&self) -> SlashCategory {
SlashCategory::Skills
}
fn handle<'a>(
&'a self,
ctx: &'a mut CommandContext<'_>,
args: &'a str,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
Box::pin(async move {
let result = ctx.agent.handle_skill(args).await?;
Ok(CommandOutput::Message(result))
})
}
}
pub struct SkillsCommand;
impl CommandHandler<CommandContext<'_>> for SkillsCommand {
fn name(&self) -> &'static str {
"/skills"
}
fn description(&self) -> &'static str {
"List loaded skills (grouped by category when available)"
}
fn category(&self) -> SlashCategory {
SlashCategory::Skills
}
fn handle<'a>(
&'a self,
ctx: &'a mut CommandContext<'_>,
args: &'a str,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
Box::pin(async move {
let result = ctx.agent.handle_skills(args).await?;
Ok(CommandOutput::Message(result))
})
}
}
pub struct FeedbackCommand;
impl CommandHandler<CommandContext<'_>> for FeedbackCommand {
fn name(&self) -> &'static str {
"/feedback"
}
fn description(&self) -> &'static str {
"Submit feedback for a skill"
}
fn args_hint(&self) -> &'static str {
"<skill> <message>"
}
fn category(&self) -> SlashCategory {
SlashCategory::Skills
}
fn handle<'a>(
&'a self,
ctx: &'a mut CommandContext<'_>,
args: &'a str,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
Box::pin(async move {
let result = ctx.agent.handle_feedback_command(args).await?;
Ok(CommandOutput::Message(result))
})
}
}