No description
|
All checks were successful
Build / build (linux-amd64, false, x86_64-unknown-linux-gnu) (push) Successful in 4m35s
Build / build (darwin-amd64, true, x86_64-apple-darwin, true) (push) Successful in 4m50s
Build / build (darwin-arm64, true, aarch64-apple-darwin, true) (push) Successful in 4m56s
Build / build (linux-arm64, true, aarch64-linux-gnu-gcc, aarch64-unknown-linux-gnu) (push) Successful in 5m2s
|
||
|---|---|---|
| .claude | ||
| .forgejo/workflows | ||
| _archive | ||
| aiprompts | ||
| config | ||
| docs | ||
| examples | ||
| examples_rust/ai | ||
| herodo | ||
| installers | ||
| packages | ||
| patches | ||
| research/zos | ||
| rhai | ||
| rhai_tests | ||
| rhailib | ||
| scripts | ||
| src | ||
| .gitignore | ||
| build_herodo.sh | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| LICENSE | ||
| publish_all.sh | ||
| publish_batches.sh | ||
| PUBLISHING.md | ||
| README.md | ||
| run_rhai_tests.sh | ||
Herocode Herolib Rust Repository
Quick Install
Install herodo with a single command:
curl -sL https://forge.ourworld.tf/geomind_research/herolib_rust/raw/branch/main/scripts/install.sh | bash
This will:
- Detect your platform (Linux/macOS, amd64/arm64)
- Download the appropriate binary
- Install to
~/hero/bin/ - Add the path to your
~/.profile
After installation, start a new terminal or run:
export PATH="$HOME/hero/bin:$PATH"
Verify installation:
herodo --help
Overview
This repository contains the Herocode Herolib Rust library and a collection of scripts, examples, and utilities for building, testing, and publishing the SAL (System Abstraction Layer) crates. The repository includes:
- Rust crates for various system components (e.g.,
os,process,text,git,vault,kubernetes, etc.). - Rhai scripts and test suites for each crate.
- Utility scripts to automate common development tasks.
Scripts
The repository provides three primary helper scripts located in the repository root:
| Script | Description | Typical Usage |
|---|---|---|
scripts/publish-all.sh |
Publishes all SAL crates to crates.io in the correct dependency order. Handles version bumping, dependency updates, dry‑run mode, and rate‑limiting. | ./scripts/publish-all.sh [--dry-run] [--wait <seconds>] [--version <ver>] |
build_herodo.sh |
Builds the herodo binary from the herodo package and optionally runs a specified Rhai script. |
./build_herodo.sh [script_name] |
run_rhai_tests.sh |
Executes all Rhai test suites across the repository, logging results and providing a summary. | ./run_rhai_tests.sh |
Below are detailed usage instructions for each script.
1. scripts/publish-all.sh
Purpose
- Publishes each SAL crate in the correct dependency order.
- Updates crate versions (if
--versionis supplied). - Updates path dependencies to version dependencies before publishing.
- Supports dry‑run mode to preview actions without publishing.
- Handles rate‑limiting between crate publishes.
Options
| Option | Description |
|---|---|
--dry-run |
Shows what would be published without actually publishing. |
--wait <seconds> |
Wait time between publishes (default: 15 s). |
--version <ver> |
Set a new version for all crates (updates Cargo.toml files). |
-h, --help |
Show help message. |
Example Usage
# Dry run – no crates will be published
./scripts/publish-all.sh --dry-run
# Publish with a custom wait time and version bump
./scripts/publish-all.sh --wait 30 --version 1.2.3
# Normal publish (no dry‑run)
./scripts/publish-all.sh
Notes
- Must be run from the repository root (where
Cargo.tomllives). - Requires
cargoand a logged‑incargosession (cargo login). - The script automatically updates dependencies in each crate’s
Cargo.tomlto use the new version before publishing.
2. build_herodo.sh
Purpose
- Builds the
herodobinary from theherodopackage. - Copies the binary to a system‑wide location (
/usr/local/bin) if run as root, otherwise to~/hero/bin. - Optionally runs a specified Rhai script after building.
Usage
# Build only
./build_herodo.sh
# Build and run a specific Rhai script (e.g., `example`):
./build_herodo.sh example
Details
- The script changes to its own directory, builds the
herodocrate (cargo build), and copies the binary. - If a script name is provided, it looks for the script in:
src/rhaiexamples/<name>.rhaisrc/herodo/scripts/<name>.rhai
- If the script is not found, the script exits with an error.
3. run_rhai_tests.sh
Purpose
- Runs all Rhai test suites across the repository.
- Supports both the legacy
rhai_testsdirectory and the newer*/tests/rhailayout. - Logs output to
run_rhai_tests.logand prints a summary.
Usage
# Run all tests
./run_rhai_tests.sh
Output
- Colored console output for readability.
- Log file (
run_rhai_tests.log) contains full output for later review. - Summary includes total modules, passed, and failed counts.
- Exit code
0if all tests pass,1otherwise.
General Development Workflow
- Build: Use
build_herodo.shto compile theherodobinary. - Test: Run
run_rhai_tests.shto ensure all Rhai scripts pass. - Publish: When ready to release, use
scripts/publish-all.sh(with--dry-runfirst to verify).
Prerequisites
- Rust toolchain (
cargo,rustc) installed. - Rhai interpreter (
herodo) built and available. - Git for version control.
- Cargo login for publishing to crates.io.
License
See LICENSE for details.
Happy coding!