use std::collections::HashSet; use std::path::PathBuf; use codex_protocol::protocol::SkillScope; #[derive(Debug, Clone, PartialEq, Eq)] pub struct SkillMetadata { pub name: String, pub description: String, pub short_description: Option, pub interface: Option, pub dependencies: Option, pub path: PathBuf, pub scope: SkillScope, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct SkillInterface { pub display_name: Option, pub short_description: Option, pub icon_small: Option, pub icon_large: Option, pub brand_color: Option, pub default_prompt: Option, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct SkillDependencies { pub tools: Vec, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct SkillToolDependency { pub r#type: String, pub value: String, pub description: Option, pub transport: Option, pub command: Option, pub url: Option, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct SkillError { pub path: PathBuf, pub message: String, } #[derive(Debug, Clone, Default)] pub struct SkillLoadOutcome { pub skills: Vec, pub errors: Vec, pub disabled_paths: HashSet, } impl SkillLoadOutcome { pub fn is_skill_enabled(&self, skill: &SkillMetadata) -> bool { !self.disabled_paths.contains(&skill.path) } pub fn enabled_skills(&self) -> Vec { self.skills .iter() .filter(|skill| self.is_skill_enabled(skill)) .cloned() .collect() } pub fn skills_with_enabled(&self) -> impl Iterator { self.skills .iter() .map(|skill| (skill, self.is_skill_enabled(skill))) } }