llm_shield_core/lib.rs
1//! # LLM Shield Core
2//!
3//! Core types, traits, and utilities for the LLM Shield security toolkit.
4//!
5//! ## SPARC Methodology - Specification Phase
6//!
7//! This module defines the core abstractions for the LLM Shield system:
8//! - `Scanner`: Core trait for all security scanners
9//! - `ScanResult`: Standardized result type
10//! - `Risk`: Risk assessment types
11//! - `Error`: Comprehensive error handling
12//!
13//! ## Enterprise-Grade Design Principles
14//!
15//! 1. **Type Safety**: Strong typing throughout
16//! 2. **Async-First**: All scanners support async operations
17//! 3. **Composability**: Scanners can be chained and combined
18//! 4. **Observability**: Comprehensive tracing and metrics
19//! 5. **Error Context**: Rich error types with context
20
21pub mod error;
22pub mod result;
23pub mod scanner;
24pub mod types;
25pub mod vault;
26
27// Re-exports for convenience
28pub use async_trait::async_trait;
29pub use error::{Error, Result};
30pub use result::{Entity, RiskFactor, ScanResult, Severity};
31pub use scanner::{InputScanner, OutputScanner, Scanner, ScannerType};
32pub use types::{ScannerConfig, ScannerMetadata};
33pub use vault::Vault;
34
35/// Version information
36pub const VERSION: &str = env!("CARGO_PKG_VERSION");
37
38/// Library initialization
39pub fn init() {
40 tracing_subscriber::fmt()
41 .with_target(false)
42 .with_thread_ids(true)
43 .init();
44}
45
46#[cfg(test)]
47mod tests {
48 use super::*;
49
50 #[test]
51 fn test_version() {
52 assert!(!VERSION.is_empty());
53 }
54}