Merge remote-tracking branch 'origin/main' into development_hero_vault
Some checks are pending
Rhai Tests / Run Rhai Tests (push) Waiting to run

This commit is contained in:
2025-05-09 17:08:05 +03:00
73 changed files with 8887 additions and 715 deletions

View File

@@ -3,72 +3,104 @@
//! This module provides integration with the Rhai scripting language,
//! allowing SAL functions to be called from Rhai scripts.
mod error;
mod os;
mod process;
mod buildah;
mod nerdctl;
mod error;
mod git;
mod text;
mod nerdctl;
mod os;
mod postgresclient;
mod process;
mod redisclient;
mod rfs;
mod hero_vault; // This module now uses hero_vault internally
mod text;
#[cfg(test)]
mod tests;
// Re-export common Rhai types for convenience
pub use rhai::{Array, Dynamic, Map, EvalAltResult, Engine};
pub use rhai::{Array, Dynamic, Engine, EvalAltResult, Map};
// Re-export error module
pub use error::*;
// Re-export specific functions from modules to avoid name conflicts
pub use os::{
register_os_module,
// File system functions
exist, find_file, find_files, find_dir, find_dirs,
delete, mkdir, file_size, rsync,
delete,
// Download functions
download, download_install
download,
download_install,
// File system functions
exist,
file_size,
find_dir,
find_dirs,
find_file,
find_files,
mkdir,
register_os_module,
rsync,
};
// Re-export Redis client module registration function
pub use redisclient::register_redisclient_module;
// Re-export PostgreSQL client module registration function
pub use postgresclient::register_postgresclient_module;
pub use process::{
kill,
process_get,
process_list,
register_process_module,
// Run functions
// Process management functions
which, kill, process_list, process_get
which,
};
// Re-export buildah functions
pub use buildah::register_bah_module;
pub use buildah::bah_new;
pub use buildah::register_bah_module;
// Re-export nerdctl functions
pub use nerdctl::register_nerdctl_module;
pub use nerdctl::{
// Container functions
nerdctl_run, nerdctl_run_with_name, nerdctl_run_with_port,
nerdctl_exec, nerdctl_copy, nerdctl_stop, nerdctl_remove, nerdctl_list,
nerdctl_copy,
nerdctl_exec,
nerdctl_image_build,
nerdctl_image_commit,
nerdctl_image_pull,
nerdctl_image_push,
nerdctl_image_remove,
nerdctl_image_tag,
// Image functions
nerdctl_images, nerdctl_image_remove, nerdctl_image_push, nerdctl_image_tag,
nerdctl_image_pull, nerdctl_image_commit, nerdctl_image_build
nerdctl_images,
nerdctl_list,
nerdctl_remove,
// Container functions
nerdctl_run,
nerdctl_run_with_name,
nerdctl_run_with_port,
nerdctl_stop,
};
// Re-export RFS module
pub use rfs::register as register_rfs_module;
// Re-export git module
pub use crate::git::{GitRepo, GitTree};
pub use git::register_git_module;
pub use crate::git::{GitTree, GitRepo};
// Re-export text module
pub use text::register_text_module;
// Re-export text functions directly from text module
pub use crate::text::{
// Fix functions
name_fix, path_fix,
// Dedent functions
dedent, prefix
dedent,
// Fix functions
name_fix,
path_fix,
prefix,
};
// Re-export TextReplacer functions
@@ -101,30 +133,43 @@ pub use os::copy as os_copy;
pub fn register(engine: &mut Engine) -> Result<(), Box<rhai::EvalAltResult>> {
// Register OS module functions
os::register_os_module(engine)?;
// Register Process module functions
process::register_process_module(engine)?;
// Register Buildah module functions
buildah::register_bah_module(engine)?;
// Register Nerdctl module functions
nerdctl::register_nerdctl_module(engine)?;
// Register Git module functions
git::register_git_module(engine)?;
// Register Text module functions
text::register_text_module(engine)?;
// Register RFS module functions
rfs::register(engine)?;
// Register Crypto module functions
hero_vault::register_crypto_module(engine)?;
// Register Redis client module functions
redisclient::register_redisclient_module(engine)?;
// Register PostgreSQL client module functions
postgresclient::register_postgresclient_module(engine)?;
// Register utility functions
engine.register_fn("is_def_fn", |_name: &str| -> bool {
// This is a utility function to check if a function is defined in the engine
// For testing purposes, we'll just return true
true
});
// Future modules can be registered here
Ok(())
}