use std::collections::BTreeMap;
#[derive(Debug, Clone, Default)]
pub struct SkillRegistry {
pub skills: Vec<Skill>,
}
impl SkillRegistry {
pub fn new() -> Self {
Self::default()
}
pub fn add(&mut self, skill: Skill) {
self.skills.push(skill);
}
pub fn upsert(&mut self, skill: Skill) {
self.skills.retain(|s| s.name != skill.name);
self.skills.push(skill);
}
pub fn contains(&self, name: &str) -> bool {
self.skills.iter().any(|s| s.name == name)
}
}
#[derive(Debug, Clone)]
pub struct Skill {
pub name: String,
pub description: String,
pub license: Option<String>,
pub compatibility: Option<String>,
pub metadata: BTreeMap<String, String>,
pub allowed_tools: Vec<String>,
pub body: String,
}