agentic_config/lib.rs
1//! Unified configuration system for the agentic tools ecosystem.
2//!
3//! This crate provides:
4//! - [`AgenticConfig`]: The root configuration type with namespaced sub-configs
5//! - [`load_merged`]: Two-layer config loading (global + local) with env overrides
6//! - [`schema`]: JSON Schema generation for IDE autocomplete (Taplo support)
7//! - [`validation`]: Advisory validation that produces warnings
8//!
9//! # Configuration Precedence (lowest to highest)
10//! 1. Default values
11//! 2. Global config (`~/.config/agentic/agentic.toml`)
12//! 3. Local config (`./agentic.toml`)
13//! 4. Environment variables
14//!
15//! # Example
16//! ```no_run
17//! use agentic_config::{load_merged, AgenticConfig};
18//! use std::path::Path;
19//!
20//! let loaded = load_merged(Path::new(".")).unwrap();
21//! println!("Locator model: {}", loaded.config.subagents.locator_model);
22//!
23//! for warning in &loaded.warnings {
24//! eprintln!("Warning: {}", warning);
25//! }
26//! ```
27//!
28//! # Environment Variables
29//! - `ANTHROPIC_BASE_URL`: Override Anthropic API base URL
30//! - `ANTHROPIC_API_KEY`: Set Anthropic API key (env-only)
31//! - `EXA_BASE_URL`: Override Exa API base URL
32//! - `EXA_API_KEY`: Set Exa API key (env-only)
33//! - `AGENTIC_SUBAGENTS_LOCATOR_MODEL`: Override `subagents.locator_model`
34//! - `AGENTIC_SUBAGENTS_ANALYZER_MODEL`: Override `subagents.analyzer_model`
35//! - `AGENTIC_REASONING_OPTIMIZER_MODEL`: Override `reasoning.optimizer_model`
36//! - `AGENTIC_REASONING_EXECUTOR_MODEL`: Override `reasoning.executor_model`
37//! - `AGENTIC_REASONING_EFFORT`: Override `reasoning.reasoning_effort`
38//! - `AGENTIC_LOG_LEVEL`: Override log level
39//! - `AGENTIC_LOG_JSON`: Enable JSON logging ("true" or "1")
40
41#[cfg(not(unix))]
42compile_error!(
43 "agentic-config only supports Unix-like platforms (Linux/macOS). Windows is not supported."
44);
45
46pub mod loader;
47pub mod merge;
48pub mod paths;
49pub mod schema;
50#[cfg(test)]
51pub(crate) mod test_support;
52pub mod types;
53pub mod validation;
54
55// Re-exports for convenient access
56pub use loader::LoadedAgenticConfig;
57pub use loader::load_merged;
58pub use paths::agentic_config_dir;
59pub use paths::xdg_config_home;
60pub use schema::schema_json_pretty;
61pub use types::AgenticConfig;