diff options
Diffstat (limited to 'src/integration/types.rs')
| -rw-r--r-- | src/integration/types.rs | 215 |
1 files changed, 215 insertions, 0 deletions
diff --git a/src/integration/types.rs b/src/integration/types.rs new file mode 100644 index 00000000..c6ab7a0b --- /dev/null +++ b/src/integration/types.rs @@ -0,0 +1,215 @@ +use std::path::PathBuf; + +#[derive(Debug)] +pub(crate) struct ClaudeInstallPaths { + pub hook_path: PathBuf, + pub settings_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct CodexInstallPaths { + pub hook_path: PathBuf, + pub hooks_path: PathBuf, + pub config_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct KimiInstallPaths { + pub hook_path: PathBuf, + pub config_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct CopilotInstallPaths { + pub hook_path: PathBuf, + pub settings_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct DevinInstallPaths { + pub hook_path: PathBuf, + pub settings_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct DroidInstallPaths { + pub hook_path: PathBuf, + pub hooks_path: PathBuf, + pub settings_path: PathBuf, + pub updated_legacy_hooks: bool, +} + +#[derive(Debug)] +pub(crate) struct OpenCodeInstallPaths { + pub plugin_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct KiloInstallPaths { + pub plugin_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct OmpInstallPaths { + pub extension_path: PathBuf, + pub removed_legacy_pi_extension: bool, +} + +#[derive(Debug)] +pub(crate) struct HermesInstallPaths { + pub plugin_dir: PathBuf, + pub config_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct QodercliInstallPaths { + pub hook_path: PathBuf, + pub settings_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct CursorInstallPaths { + pub hook_path: PathBuf, + pub hooks_path: PathBuf, +} + +#[derive(Debug)] +pub(crate) struct CursorUninstallResult { + pub hook_path: PathBuf, + pub hooks_path: PathBuf, + pub removed_hook_file: bool, + pub updated_hooks: bool, +} + +#[derive(Debug)] +pub(crate) struct QodercliUninstallResult { + pub hook_path: PathBuf, + pub settings_path: PathBuf, + pub removed_hook_file: bool, + pub updated_settings: bool, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub(crate) struct IntegrationStatus { + pub target: crate::api::schema::IntegrationTarget, + pub path: PathBuf, + pub state: IntegrationStatusKind, + pub installed_version: Option<u32>, + pub expected_version: u32, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub(crate) enum IntegrationStatusKind { + NotInstalled, + Current, + Outdated, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub(crate) struct IntegrationRecommendation { + pub target: crate::api::schema::IntegrationTarget, + pub label: &'static str, + pub command: &'static str, + pub available: bool, + pub path: PathBuf, + pub state: IntegrationStatusKind, +} + +impl IntegrationRecommendation { + pub fn needs_install(&self) -> bool { + self.state == IntegrationStatusKind::Outdated + || (self.available && self.state == IntegrationStatusKind::NotInstalled) + } + + pub fn status_label(&self) -> &'static str { + match (self.available, self.state) { + (_, IntegrationStatusKind::Current) => "installed", + (_, IntegrationStatusKind::Outdated) => "update available", + (true, IntegrationStatusKind::NotInstalled) => "available", + (false, IntegrationStatusKind::NotInstalled) => "not found", + } + } +} + +#[derive(Debug)] +pub(crate) struct PiUninstallResult { + pub extension_path: PathBuf, + pub removed_extension: bool, +} + +#[derive(Debug)] +pub(crate) struct OmpUninstallResult { + pub extension_path: PathBuf, + pub removed_extension: bool, +} + +#[derive(Debug)] +pub(crate) struct ClaudeUninstallResult { + pub hook_path: PathBuf, + pub settings_path: PathBuf, + pub removed_hook_file: bool, + pub updated_settings: bool, +} + +#[derive(Debug)] +pub(crate) struct CodexUninstallResult { + pub hook_path: PathBuf, + pub hooks_path: PathBuf, + pub config_path: PathBuf, + pub removed_hook_file: bool, + pub updated_hooks: bool, +} + +#[derive(Debug)] +pub(crate) struct KimiUninstallResult { + pub hook_path: PathBuf, + pub config_path: PathBuf, + pub removed_hook_file: bool, + pub updated_config: bool, +} + +#[derive(Debug)] +pub(crate) struct CopilotUninstallResult { + pub hook_path: PathBuf, + pub settings_path: PathBuf, + pub removed_hook_file: bool, + pub updated_settings: bool, +} + +#[derive(Debug)] +pub(crate) struct DevinUninstallResult { + pub hook_path: PathBuf, + pub settings_path: PathBuf, + pub removed_hook_file: bool, + pub updated_settings: bool, +} + +#[derive(Debug)] +pub(crate) struct DroidUninstallResult { + pub hook_path: PathBuf, + pub hooks_path: PathBuf, + pub settings_path: PathBuf, + pub removed_hook_file: bool, + pub updated_hooks: bool, + pub updated_settings: bool, +} + +#[derive(Debug)] +pub(crate) struct OpenCodeUninstallResult { + pub plugin_path: PathBuf, + pub removed_plugin: bool, +} + +#[derive(Debug)] +pub(crate) struct KiloUninstallResult { + pub plugin_path: PathBuf, + pub removed_plugin: bool, +} + +#[derive(Debug)] +pub(crate) struct HermesUninstallResult { + pub plugin_dir: PathBuf, + pub config_path: PathBuf, + pub removed_plugin_dir: bool, + pub updated_config: bool, +} |
