1use crate::theme::Theme;
2use std::path::PathBuf;
3
4#[derive(Debug, Clone)]
6pub struct AgentConfig {
7 pub port: u16,
9
10 pub claude_dir: PathBuf,
12
13 pub data_dir: PathBuf,
15
16 pub theme: Theme,
18
19 pub max_concurrency: usize,
21
22 pub testing_ratio: f64,
24
25 pub batch_size: usize,
27
28 pub yolo_mode: bool,
30
31 pub public_dir: Option<PathBuf>,
33
34 pub open_browser: bool,
36}
37
38impl Default for AgentConfig {
39 fn default() -> Self {
40 let home = dirs::home_dir().expect("Failed to get home directory");
41 let claude_dir = home.join(".claude");
42 let data_dir = claude_dir.join("data");
43
44 Self {
45 port: 3456,
46 claude_dir,
47 data_dir,
48 theme: Theme::default(),
49 max_concurrency: 4,
50 testing_ratio: 0.3,
51 batch_size: 10,
52 yolo_mode: false,
53 public_dir: None,
54 open_browser: true,
55 }
56 }
57}
58
59impl AgentConfig {
60 #[must_use]
62 pub fn new() -> Self {
63 Self::default()
64 }
65
66 #[must_use]
68 pub fn tasks_dir(&self) -> PathBuf {
69 self.claude_dir.join("tasks")
70 }
71
72 #[must_use]
74 pub fn projects_dir(&self) -> PathBuf {
75 self.claude_dir.join("projects")
76 }
77
78 #[must_use]
80 pub fn teams_dir(&self) -> PathBuf {
81 self.claude_dir.join("teams")
82 }
83
84 #[must_use]
86 pub fn features_db_path(&self, project: &str) -> PathBuf {
87 self.data_dir.join(format!("{project}.db"))
88 }
89
90 #[must_use]
92 pub const fn with_port(mut self, port: u16) -> Self {
93 self.port = port;
94 self
95 }
96
97 #[must_use]
99 pub fn with_claude_dir(mut self, dir: PathBuf) -> Self {
100 self.claude_dir = dir;
101 self
102 }
103
104 #[must_use]
106 pub const fn with_theme(mut self, theme: Theme) -> Self {
107 self.theme = theme;
108 self
109 }
110
111 #[must_use]
113 pub const fn with_yolo_mode(mut self, enabled: bool) -> Self {
114 self.yolo_mode = enabled;
115 self
116 }
117
118 #[must_use]
120 pub fn with_public_dir(mut self, dir: PathBuf) -> Self {
121 self.public_dir = Some(dir);
122 self
123 }
124
125 #[must_use]
127 pub const fn with_open_browser(mut self, open: bool) -> Self {
128 self.open_browser = open;
129 self
130 }
131}