fix: rename overview.md files to avoid conflicts and add collection name

This commit is contained in:
Timur Gordon
2025-11-14 11:01:43 +01:00
parent f67296cd25
commit 2c24b120de
20 changed files with 85 additions and 91 deletions

View File

@@ -4,16 +4,16 @@ A specialized runner for the Hero ecosystem that executes heroscripts using the
## Overview
The Hero runner executes heroscripts by calling `hero run -h <payload>` for each job. This makes it ideal for:
The Hero runner executes heroscripts by piping the payload to `hero run -s` via stdin for each job. This makes it ideal for:
- Running heroscripts from job payloads
- Executing Hero automation tasks
- Executing Hero automation tasks (e.g., `!!git.list`, `!!docker.start`)
- Integrating with the Hero CLI ecosystem
- Running scripted workflows
## Features
- **Heroscript Execution**: Executes `hero run -h <payload>` for each job
- **Heroscript Execution**: Pipes payload to `hero run -s` via stdin (no temp files)
- **Environment Variables**: Passes job environment variables to the hero command
- **Timeout Support**: Respects job timeout settings
- **Signature Verification**: Verifies job signatures before execution
@@ -38,15 +38,28 @@ herorunner my-hero-runner --redis-url redis://localhost:6379
## Job Payload Format
The job payload should contain the heroscript content that will be passed to `hero run -h`.
The job payload should contain the heroscript content. The runner will pipe it directly to `hero run -s` via stdin.
### Example Payload
### Example Payloads
**Simple print:**
```
print("Hello from heroscript!")
```
The runner will execute: `hero run -h 'print("Hello from heroscript!")'`
**Hero actions:**
```
!!git.list
```
**Multi-line script:**
```
!!git.list
print("Repositories listed")
!!docker.ps
```
The runner executes: `echo "<payload>" | hero run -s`
## Examples

View File

@@ -25,21 +25,22 @@ impl HeroExecutor {
/// Execute a command from the job payload
fn execute_command(&self, job: &Job) -> Result<String, Box<dyn std::error::Error + Send + Sync>> {
info!("Runner '{}': Executing hero run -h for job {}", self.runner_id, job.id);
info!("Runner '{}': Executing hero run for job {}", self.runner_id, job.id);
// Always execute: hero run -h <payload>
// Execute: hero run -s (reads from stdin)
let mut cmd = Command::new("hero");
cmd.args(&["run", "-h", &job.payload]);
cmd.args(&["run", "-s"]);
debug!("Runner '{}': Executing: hero run -h {}", self.runner_id, job.payload);
debug!("Runner '{}': Executing: hero run -s with stdin", self.runner_id);
// Set environment variables from job
for (key, value) in &job.env_vars {
cmd.env(key, value);
}
// Configure stdio
cmd.stdout(Stdio::piped())
// Configure stdio - pipe stdin to send heroscript content
cmd.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
// Execute command with timeout
@@ -49,7 +50,16 @@ impl HeroExecutor {
info!("Runner '{}': Starting command execution for job {}", self.runner_id, job.id);
let mut child = cmd.spawn()
.map_err(|e| format!("Failed to spawn 'hero run -h': {}", e))?;
.map_err(|e| format!("Failed to spawn 'hero run -s': {}", e))?;
// Write heroscript payload to stdin
if let Some(mut stdin) = child.stdin.take() {
use std::io::Write;
stdin.write_all(job.payload.as_bytes())
.map_err(|e| format!("Failed to write to stdin: {}", e))?;
// Close stdin to signal EOF
drop(stdin);
}
// Wait for command with timeout
let output = loop {