zeph_commands/handlers/
skill.rs1use std::future::Future;
11use std::pin::Pin;
12
13use crate::context::CommandContext;
14use crate::{CommandError, CommandHandler, CommandOutput, SlashCategory};
15
16pub struct SkillCommand;
21
22impl CommandHandler<CommandContext<'_>> for SkillCommand {
23 fn name(&self) -> &'static str {
24 "/skill"
25 }
26
27 fn description(&self) -> &'static str {
28 "Load and display a skill body, or manage skill lifecycle"
29 }
30
31 fn args_hint(&self) -> &'static str {
32 "<name|subcommand>"
33 }
34
35 fn category(&self) -> SlashCategory {
36 SlashCategory::Skills
37 }
38
39 fn handle<'a>(
40 &'a self,
41 ctx: &'a mut CommandContext<'_>,
42 args: &'a str,
43 ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
44 Box::pin(async move {
45 let result = ctx.agent.handle_skill(args).await?;
46 Ok(CommandOutput::Message(result))
47 })
48 }
49}
50
51pub struct SkillsCommand;
55
56impl CommandHandler<CommandContext<'_>> for SkillsCommand {
57 fn name(&self) -> &'static str {
58 "/skills"
59 }
60
61 fn description(&self) -> &'static str {
62 "List loaded skills (grouped by category when available)"
63 }
64
65 fn category(&self) -> SlashCategory {
66 SlashCategory::Skills
67 }
68
69 fn handle<'a>(
70 &'a self,
71 ctx: &'a mut CommandContext<'_>,
72 args: &'a str,
73 ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
74 Box::pin(async move {
75 let result = ctx.agent.handle_skills(args).await?;
76 Ok(CommandOutput::Message(result))
77 })
78 }
79}
80
81pub struct FeedbackCommand;
83
84impl CommandHandler<CommandContext<'_>> for FeedbackCommand {
85 fn name(&self) -> &'static str {
86 "/feedback"
87 }
88
89 fn description(&self) -> &'static str {
90 "Submit feedback for a skill"
91 }
92
93 fn args_hint(&self) -> &'static str {
94 "<skill> <message>"
95 }
96
97 fn category(&self) -> SlashCategory {
98 SlashCategory::Skills
99 }
100
101 fn handle<'a>(
102 &'a self,
103 ctx: &'a mut CommandContext<'_>,
104 args: &'a str,
105 ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
106 Box::pin(async move {
107 let result = ctx.agent.handle_feedback_command(args).await?;
108 Ok(CommandOutput::Message(result))
109 })
110 }
111}