| Crates.io | herolib-do |
| lib.rs | herolib-do |
| version | 0.3.12 |
| created_at | 2025-12-27 20:04:30.335068+00 |
| updated_at | 2026-01-22 17:16:14.03183+00 |
| description | Interactive Rhai shell aggregating herolib packages |
| homepage | |
| repository | https://github.com/herolib/herolib_rust |
| max_upload_size | |
| id | 2007735 |
| size | 274,042 |
Herodo is a command-line utility that executes Rhai scripts with full access to the HeroLib ecosystem. It provides a powerful scripting environment for automation, AI, system management, and infrastructure tasks.
.rhai script files.rhai scripts in a directory (recursively)env_loggergit clone https://github.com/herolib/herolib_rust
cd herolib_rust
./build.sh
This script will:
~/hero/bin/herodo (non-root) or /usr/local/bin/herodo (root)Note: If using the non-root installation, make sure ~/hero/bin is in your PATH:
export PATH="$HOME/hero/bin:$PATH"
herodo path/to/script.rhai
herodo path/to/scripts/
When given a directory, herodo will:
.rhai files// hello.rhai
print("Hello from Herodo!");
let result = 42 * 2;
print(`Result: ${result}`);
// ai_chat.rhai
// Requires GROQ_API_KEY, OPENROUTER_API_KEY, or SAMBANOVA_API_KEY
// List available models
let models = ai_models();
print("Available models:");
for model in models {
print(` - ${model}`);
}
// Simple chat
let response = ai_chat("What is the capital of France?");
print(response);
// Chat with specific model
let response = ai_chat_with_model("gpt_oss_120b", "Hello!");
print(response);
// Chat with system message
let response = ai_chat_with_system(
"llama3_3_70b",
"You are a helpful coding assistant.",
"Write a hello world in Rust"
);
print(response);
// system_info.rhai
// Check if a file exists
let config_exists = exist("/etc/hosts");
print(`Config file exists: ${config_exists}`);
// Download a file
download("https://example.com/data.txt", "/tmp/data.txt");
print("File downloaded successfully");
// Execute a system command
let output = run("ls -la /tmp");
print("Directory listing:");
print(output.stdout);
// redis_example.rhai
// Set a value
redis_set("app_status", "running");
print("Status set in Redis");
// Get the value
let status = redis_get("app_status");
print(`Current status: ${status}`);
Herodo provides access to all HeroLib modules through Rhai:
herolib-ai)ai_chat(prompt) - Chat with default modelai_chat_with_model(model, prompt) - Chat with specific modelai_chat_with_system(model, system, prompt) - Chat with system messageai_models() - List available chat modelsai_embed(text) - Generate text embeddingai_embed_batch(texts) - Batch embeddingsai_transcribe(file_path) - Transcribe audio fileherolib-core)herolib-crypt)keypair_new() - Generate Ed25519 keypairkeypair_sign(keypair, message) - Sign messageskeypair_verify(pubkey, message, signature) - Verify signaturesherolib-os)exist(path) - Check file existencemkdir(path) - Create directoriesdelete(path) - Delete files/directoriesdownload(url, dest) - Download filesrun(cmd) - Execute system commandsherolib-clients)redis_set(key, value) - Redis operationsredis_get(key) - Get Redis valuesherolib-virt)herolib-mos)Set API keys for AI providers:
export GROQ_API_KEY="your-groq-key"
export OPENROUTER_API_KEY="your-openrouter-key"
export SAMBANOVA_API_KEY="your-sambanova-key"
Enable detailed logging:
RUST_LOG=debug herodo script.rhai
Herodo provides clear error messages and appropriate exit codes:
Run the test suite:
cd packages/herodo
cargo test
Apache-2.0