use serde::{Deserialize, Serialize}; /// How a tool presents its UI. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "lowercase")] pub enum ToolType { Cli, Web, Headless, } /// Unique identifier for a tool (name + version). #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] pub struct ToolId { pub name: String, pub version: semver::Version, } impl std::fmt::Display for ToolId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}@{}", self.name, self.version) } } /// Metadata about an installed or available tool. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ToolMetadata { pub name: String, pub version: semver::Version, pub description: String, pub author: String, pub license: String, pub homepage: Option, pub tool_type: ToolType, pub hash: String, }