Skip to content

Commit 445581f

Browse files
committed
feat(config): add obsidian and agents config sections
1 parent c058079 commit 445581f

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

src/config.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@ pub struct ModelConfig {
1414
pub expand: Option<String>,
1515
}
1616

17+
/// Obsidian integration configuration.
18+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
19+
pub struct ObsidianConfig {
20+
#[serde(default)]
21+
pub enabled: bool,
22+
pub vault_name: Option<String>,
23+
pub cli_path: Option<PathBuf>,
24+
}
25+
26+
/// Agent integration configuration.
27+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
28+
pub struct AgentsConfig {
29+
#[serde(default)]
30+
pub claude_code: bool,
31+
#[serde(default)]
32+
pub cursor: bool,
33+
#[serde(default)]
34+
pub windsurf: bool,
35+
}
36+
1737
/// Application configuration, loaded from `~/.engraph/config.toml` with CLI overrides.
1838
#[derive(Debug, Clone, Serialize, Deserialize)]
1939
#[serde(default)]
@@ -30,6 +50,12 @@ pub struct Config {
3050
pub intelligence: Option<bool>,
3151
/// Model override URIs.
3252
pub models: ModelConfig,
53+
/// Obsidian integration settings.
54+
#[serde(default)]
55+
pub obsidian: ObsidianConfig,
56+
/// Agent integration settings.
57+
#[serde(default)]
58+
pub agents: AgentsConfig,
3359
}
3460

3561
impl Default for Config {
@@ -41,6 +67,8 @@ impl Default for Config {
4167
batch_size: 64,
4268
intelligence: None,
4369
models: ModelConfig::default(),
70+
obsidian: ObsidianConfig::default(),
71+
agents: AgentsConfig::default(),
4472
}
4573
}
4674
}
@@ -216,6 +244,29 @@ rerank = "hf:ggml-org/Qwen3-Reranker-0.6B-Q8_0-GGUF/qwen3-reranker-0.6b-q8_0.ggu
216244
assert!(!cfg.intelligence_enabled());
217245
}
218246

247+
#[test]
248+
fn test_config_backward_compat() {
249+
// Old format: intelligence = true at top level
250+
let toml = r#"intelligence = true"#;
251+
let config: Config = toml::from_str(toml).unwrap();
252+
assert_eq!(config.intelligence, Some(true));
253+
// New fields default to None/false
254+
assert!(!config.obsidian.enabled);
255+
}
256+
257+
#[test]
258+
fn test_config_with_obsidian() {
259+
let toml = r#"
260+
intelligence = true
261+
[obsidian]
262+
enabled = true
263+
vault_name = "Personal"
264+
"#;
265+
let config: Config = toml::from_str(toml).unwrap();
266+
assert!(config.obsidian.enabled);
267+
assert_eq!(config.obsidian.vault_name.as_deref(), Some("Personal"));
268+
}
269+
219270
#[test]
220271
fn test_config_roundtrip_with_intelligence() {
221272
let dir = tempfile::tempdir().unwrap();

0 commit comments

Comments
 (0)