ggen_config/
lib.rs

1//! # ggen-config
2//!
3//! Configuration parser and validator for ggen.toml files.
4//!
5//! This crate provides a type-safe interface for loading, parsing, and validating
6//! ggen.toml configuration files that define project settings, AI providers,
7//! templates, RDF/SPARQL settings, and more.
8//!
9//! ## Features
10//!
11//! - **Type-safe parsing**: Strongly-typed Rust structs with serde
12//! - **Schema validation**: Validates configuration against expected schema
13//! - **Environment overrides**: Support for environment-specific configs
14//! - **Workspace support**: Mono-repo and workspace configuration
15//! - **Error handling**: Comprehensive error types with context
16//!
17//! ## Example
18//!
19//! ```no_run
20//! use ggen_config::{GgenConfig, ConfigLoader};
21//!
22//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
23//! // Load configuration from file
24//! let config = ConfigLoader::from_file("ggen.toml")?;
25//!
26//! // Access configuration
27//! println!("Project: {}", config.project.name);
28//! if let Some(ai) = &config.ai {
29//!     println!("AI Provider: {}", ai.provider);
30//! }
31//! # Ok(())
32//! # }
33//! ```
34
35#![warn(missing_docs)]
36#![warn(clippy::all)]
37#![warn(clippy::pedantic)]
38#![allow(clippy::struct_excessive_bools)]
39#![allow(clippy::should_implement_trait)]
40#![allow(clippy::cast_possible_truncation)]
41#![allow(clippy::missing_errors_doc)]
42#![allow(clippy::missing_panics_doc)]
43
44mod error;
45mod parser;
46mod schema;
47mod validator;
48
49pub use error::{ConfigError, Result};
50pub use parser::ConfigLoader;
51pub use schema::*;
52pub use validator::ConfigValidator;
53
54/// Re-export commonly used types
55pub mod prelude {
56    pub use super::{
57        AiConfig, ConfigError, ConfigLoader, ConfigValidator, GgenConfig, ProjectConfig, Result,
58        TemplatesConfig,
59    };
60}