llm_link/apps/
mod.rs

1mod codex;
2mod zed;
3mod aider;
4mod openhands;
5mod info;
6mod protocol;
7
8use serde::{Deserialize, Serialize};
9use crate::settings::Settings;
10
11pub use info::AppInfoProvider;
12
13// Re-export app-specific modules
14pub use codex::CodexApp;
15pub use zed::ZedApp;
16pub use aider::AiderApp;
17pub use openhands::OpenHandsApp;
18
19/// Supported application types
20#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
21pub enum SupportedApp {
22    /// Codex CLI - OpenAI API client
23    CodexCLI,
24    /// Zed - Ollama API client
25    Zed,
26    /// Aider - AI pair programming tool
27    Aider,
28    /// OpenHands - AI agent framework
29    OpenHands,
30}
31
32impl SupportedApp {
33    /// Parse application type from string
34    pub fn from_str(s: &str) -> Option<Self> {
35        match s.to_lowercase().as_str() {
36            "codex-cli" | "codex" => Some(Self::CodexCLI),
37            "zed-dev" | "zed" => Some(Self::Zed),
38            "aider" => Some(Self::Aider),
39            "openhands" => Some(Self::OpenHands),
40            _ => None,
41        }
42    }
43
44    /// Get application name
45    pub fn name(&self) -> &'static str {
46        match self {
47            Self::CodexCLI => "codex-cli",
48            Self::Zed => "zed",
49            Self::Aider => "aider",
50            Self::OpenHands => "openhands",
51        }
52    }
53
54    /// Get all supported applications
55    pub fn all() -> Vec<Self> {
56        vec![
57            Self::CodexCLI,
58            Self::Zed,
59            Self::Aider,
60            Self::OpenHands,
61        ]
62    }
63}
64
65/// Application configuration generator
66pub struct AppConfigGenerator;
67
68impl AppConfigGenerator {
69    /// Generate configuration for specified application
70    pub fn generate_config(app: &SupportedApp, cli_api_key: Option<&str>) -> Settings {
71        match app {
72            SupportedApp::CodexCLI => CodexApp::generate_config(cli_api_key),
73            SupportedApp::Zed => ZedApp::generate_config(),
74            SupportedApp::Aider => AiderApp::generate_config(cli_api_key),
75            SupportedApp::OpenHands => OpenHandsApp::generate_config(cli_api_key),
76        }
77    }
78
79    /// Generate protocol combination configuration
80    pub fn generate_protocol_config(protocols: &[String], cli_api_key: Option<&str>) -> Settings {
81        protocol::generate_protocol_config(protocols, cli_api_key)
82    }
83}