Expand description
Santa - A package manager meta-tool
Santa is a comprehensive package manager abstraction layer that provides unified interfaces across different package managers and platforms. It supports multiple package sources (apt, brew, cargo, etc.) and offers features like caching, configuration management, and async command execution.
§Quick Start
use santa::{SantaConfig, SantaData, KnownSources};
use std::path::Path;
// Load configuration from a file
let config = SantaConfig::load_from(Path::new("santa.yaml"))?;
// Create Santa data manager with default built-in data
let santa_data = SantaData::default();
// Get sources for the current platform
let sources = santa_data.sources(&config);
// Use specific package managers
for source in sources {
println!("Available source: {}", source.name_str());
}§Features
- Multi-platform Support: Works across Linux, macOS, and Windows
- Unified Interface: Common API for different package managers
- Async Operations: Non-blocking package operations using tokio
- Caching: Intelligent caching of package lists and metadata
- Configuration: Flexible CCL-based configuration system
- Security: Input sanitization and shell escape protection
- Hot Reload: Configuration changes without restart
§Architecture
Santa is built around several core concepts:
PackageSource: Individual package manager implementationsSantaConfig: Configuration management and validationSantaData: Platform detection and source managementPackageCache: Caching layer for performanceSantaError: Unified error handling
§Error Handling
All fallible operations return Result<T> where the error type is SantaError.
This provides structured error information with context about what operation failed.
use santa::{SantaConfig, SantaError};
use std::path::Path;
match SantaConfig::load_from(Path::new("santa.yaml")) {
Ok(config) => println!("Configuration loaded successfully"),
Err(e) => eprintln!("Configuration error: {}", e),
}§Safety
Santa takes security seriously, especially around shell command execution:
- All user inputs are sanitized before shell execution
- Package names are validated against known-safe patterns
- Command injection protection using
shell-escapecrate - No raw shell command execution from user input
§Performance Considerations
- Caching reduces repeated package manager queries
- Async operations prevent blocking on slow package managers
- Lazy loading of configuration and package data
- Memory-efficient data structures with reference counting where appropriate
Re-exports§
pub use data::SantaData;pub use data_layers::DataLayerManager;pub use data_layers::DataOrigin;pub use data_layers::LayeredPackage;pub use data_layers::LayeredSource;pub use errors::Result;pub use errors::SantaError;pub use script_generator::ExecutionMode;pub use script_generator::ScriptFormat;pub use script_generator::ScriptGenerator;pub use sources::PackageCache;pub use sources::PackageSource;pub use source_layers::SourceLayerManager;pub use source_layers::SourceOrigin;
Modules§
- commands
- Command implementations for Santa CLI operations.
- completions
- configuration
- data
- data_
layers - Data layering system for Santa
- errors
- Error types for the Santa package manager.
- plugins
- script_
generator - Safe script generation for package manager operations.
- source_
layers - Source layering system for Santa
- sources
- Package source implementations and caching layer.
- traits
Structs§
- Package
Data - Package-specific configuration data
- Santa
Config - Main configuration structure for Santa