# Installer Templates

This directory contains Rhai installation scripts for various system components.

## Available Installers

### zinit.rhai
Platform-aware installer for Zinit (process supervisor) and Herodo (script interpreter).

**Features:**
- Auto-detects OS (Linux/Darwin) and architecture (amd64/arm64)
- Downloads correct binaries from forge.ourworld.tf
- Installs to `~/hero/bin/`
- Verifies installation

**Run:**
```bash
chmod +x zinit.rhai
./zinit.rhai
```

Or via herodo:
```bash
herodo zinit.rhai
```

## Rhai Script Reference

For complete Rhai scripting documentation, see: **aiprompts/rhai/RHAI_ONE.md**

This reference includes:
- Text manipulation (dedent, prefix, templates, regex)
- File operations (read, write, find, download, sync)
- Process management (Zinit service control)
- Cryptography (encryption, signatures)
- Network operations (TCP, HTTP, SSH)
- Error handling and control flow

### Key Patterns Used in These Installers

```rhai
#!/usr/bin/env herodo
// Platform detection
let os = get_env("OSTYPE");
let arch = run("uname -m");

// Download and install
download_install(url, dest, 0o755);

// File operations
mkdir(path);
copy(src, dst);
delete(path);

// Error handling
try {
    // operation
} catch(e) {
    throw `Error: ${e}`;
}

// Output
print("Status message");
```

For more examples and complete reference, see **aiprompts/rhai/RHAI_ONE.md**.
