Skip to main content

stynx_code_plugins/domain/
plugin.rs

1use std::path::PathBuf;
2
3#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4pub struct PluginId(pub String);
5
6impl PluginId {
7    pub fn new(id: impl Into<String>) -> Self {
8        Self(id.into())
9    }
10
11    pub fn as_str(&self) -> &str {
12        &self.0
13    }
14}
15
16impl std::fmt::Display for PluginId {
17    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18        write!(f, "{}", self.0)
19    }
20}
21
22#[derive(Debug, Clone)]
23pub enum PluginStatus {
24    Installed,
25    Running,
26    Stopped,
27    Error(String),
28}
29
30#[derive(Debug, Clone)]
31pub struct PluginInfo {
32    pub id: PluginId,
33    pub name: String,
34    pub version: String,
35    pub description: String,
36    pub path: PathBuf,
37    pub status: PluginStatus,
38}
39
40#[derive(Debug, Clone, PartialEq, Eq)]
41pub enum PluginCapability {
42    ProvidesTools,
43    ProvidesCommands,
44    ProvidesSkills,
45}