Go to file
2025-08-06 03:27:49 +02:00
_archive/service_manager ... 2025-08-05 15:33:03 +02:00
.github/workflows feat: Add CI/CD workflows for testing and publishing SAL crates 2025-07-01 08:34:20 +03:00
aiprompts ... 2025-04-04 15:05:48 +02:00
docs feat: Convert SAL to a Rust monorepo 2025-06-18 14:12:36 +03:00
examples ... 2025-08-05 16:39:00 +02:00
herodo integrated hetzner client in repo + showcase of using scope for 'cleaner' scripts 2025-08-05 20:27:14 +02:00
installers ... 2025-06-16 07:30:37 +02:00
packages integrated hetzner client in repo + showcase of using scope for 'cleaner' scripts 2025-08-05 20:27:14 +02:00
research added robot hetzner code to research for later importing it into codebase 2025-08-05 16:32:29 +02:00
rhai integrated hetzner client in repo + showcase of using scope for 'cleaner' scripts 2025-08-05 20:27:14 +02:00
rhai_tests feat: Update zinit-client dependency to 0.4.0 2025-07-10 11:27:59 +03:00
scripts feat: Update zinit-client dependency to 0.4.0 2025-07-10 11:27:59 +03:00
src integrated hetzner client in repo + showcase of using scope for 'cleaner' scripts 2025-08-05 20:27:14 +02:00
.gitignore feat: Enhance service manager with zinit socket discovery and systemd fallback 2025-07-02 16:37:27 +03:00
build_herodo.sh feat: Add herodo package to workspace 2025-06-23 13:19:20 +03:00
cargo_instructions.md ... 2025-08-05 15:43:13 +02:00
Cargo.toml integrated hetzner client in repo + showcase of using scope for 'cleaner' scripts 2025-08-05 20:27:14 +02:00
LICENSE Initial commit 2025-04-02 05:08:51 +00:00
PUBLISHING.md feat: Add CI/CD workflows for testing and publishing SAL crates 2025-07-01 08:34:20 +03:00
README.md /// 2025-08-06 03:27:49 +02:00
run_rhai_tests.sh feat: Migrate SAL to Cargo workspace 2025-06-24 12:39:18 +03:00

Herocode Herolib Rust Repository

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, dryrun mode, and ratelimiting. ./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 --version is supplied).
  • Updates path dependencies to version dependencies before publishing.
  • Supports dryrun mode to preview actions without publishing.
  • Handles ratelimiting between crate publishes.

Options

Option Description
--dry-run Shows what would be published without actually publishing.
--wait <seconds> Wait time between publishes (default: 15s).
--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 dryrun)
./scripts/publish-all.sh

Notes

  • Must be run from the repository root (where Cargo.toml lives).
  • Requires cargo and a loggedin cargo session (cargo login).
  • The script automatically updates dependencies in each crates Cargo.toml to use the new version before publishing.

2. build_herodo.sh

Purpose

  • Builds the herodo binary from the herodo package.
  • Copies the binary to a systemwide 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 herodo crate (cargo build), and copies the binary.
  • If a script name is provided, it looks for the script in:
    • src/rhaiexamples/<name>.rhai
    • src/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_tests directory and the newer */tests/rhai layout.
  • Logs output to run_rhai_tests.log and 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 0 if all tests pass, 1 otherwise.

General Development Workflow

  1. Build: Use build_herodo.sh to compile the herodo binary.
  2. Test: Run run_rhai_tests.sh to ensure all Rhai scripts pass.
  3. Publish: When ready to release, use scripts/publish-all.sh (with --dry-run first 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!