# SAL Rhai - Rhai Integration Module The `sal-rhai` package provides Rhai scripting integration for the SAL (System Abstraction Layer) ecosystem. This package serves as the central integration point that registers all SAL modules with the Rhai scripting engine, enabling powerful automation and scripting capabilities. ## Features - **Module Registration**: Automatically registers all SAL packages with Rhai engine - **Error Handling**: Provides unified error handling for Rhai scripts - **Script Execution**: Core functionality for executing Rhai scripts with SAL functions - **Cross-Module Integration**: Enables seamless interaction between different SAL modules ## Registered Modules This package integrates the following SAL modules with Rhai: - **File System Operations** (`sal-os`): File operations, downloads, package management - **Process Management** (`sal-process`): Command execution, process control - **Text Processing** (`sal-text`): String manipulation, templates, text replacement - **Network Operations** (`sal-net`): HTTP requests, network utilities - **Git Operations** (`sal-git`): Repository management, Git commands - **Database Clients** (`sal-postgresclient`, `sal-redisclient`): Database connectivity - **Virtualization** (`sal-virt`): Container and virtualization tools - **Cryptography** (`sal-vault`): Encryption, key management, digital signatures - **System Integration** (`sal-mycelium`, `sal-zinit-client`): Specialized system tools ## Usage ```rust use sal_rhai::{register, exec}; use rhai::Engine; // Create and configure Rhai engine with all SAL modules let mut engine = Engine::new(); register(&mut engine).expect("Failed to register SAL modules"); // Execute Rhai script with SAL functions available let result = exec(&mut engine, r#" // Use SAL functions in Rhai scripts let files = find_files("/tmp", "*.txt"); println("Found " + files.len() + " text files"); let result = run("echo 'Hello from SAL!'"); println("Command output: " + result.stdout); "#).expect("Script execution failed"); ``` ## Integration with Herodo This package is primarily used by the `herodo` binary to provide Rhai scripting capabilities with full access to SAL functionality. ## Error Handling The package provides comprehensive error handling that converts SAL errors into Rhai-compatible error types, ensuring smooth script execution and meaningful error messages. ## Dependencies This package depends on all other SAL packages to provide complete functionality registration. It serves as the integration hub for the entire SAL ecosystem.