A CLI tool for bot/webhook-triggered script execution with live output streaming. Supports --config and is ready for npm + npx usage.
- Stream script stdout/stderr over Server-Sent Events (SSE)
- Prevent duplicate concurrent runs per script name
- Audit logs for every execution
- Config-driven scripts via
--config
npx script-runner-kit --config ./script-runner.config.jsonnpm install
npm run check
node bin/script-runner-kit.js --config ./script-runner.config.jsonServer default URL:
http://127.0.0.1:8088
script-runner-kit --config <path> [--port <number>]Options:
--config <path>: required, supports.json/.js/.cjs--port <number>: optional, override config/env portPORTenv: optional fallback if--portomitted
Port precedence:
--portPORTenvironment variableportfrom config file- default
8088
Example script-runner.config.json:
{
"port": 8088,
"auditDir": ".script-audit-logs",
"akSk": [
{ "ak": "global-bot-v2", "sk": "global-secret-a" },
{ "ak": "global-bot-v1", "sk": "global-secret-b" }
],
"scripts": {
"check-update": {
"scriptPath": "./scripts/check-update.sh",
"rootDir": ".",
"akSk": [
{ "ak": "check-bot-v2", "sk": "check-secret-a" },
{ "ak": "check-bot-v1", "sk": "check-secret-b" }
]
}
}
}Notes:
scriptPathandrootDirare resolved relative to the config file directory.- Each script supports either:
scriptPath(execute viabash <scriptPath>)- or
command+ optionalargs.
- Auth uses JWT and supports AK/SK pairs per script via
akSk.
When starting in a directory containing package.json, this tool auto-discovers npm scripts and exposes them as runnable items:
<name>(for examplebuild)npm:<name>(for examplenpm:build)
Config-defined scripts take priority on name conflict.
Every API call requires a JWT token. Supported token sources:
Authorization: Bearer <token>(recommended)x-runner-token: <token>- query parameter
?token=<token>(convenient for EventSource demos)
Generate your JWT at https://jwt.io using:
- Header:
{"alg":"HS256","typ":"JWT"} - Payload example:
{"sub":"gitai","ak":"check-bot-v2","script":"check-update"} - Secret: use the SK mapped to that AK in your config
Verification rules:
- Uses
jsonwebtoken.verify()with algorithmsHS256/HS384/HS512 - Supports multiple credentials per script (
akSkarray), useful for key rotation - If a script has no local
akSk, top-levelakSkis used as fallback - Legacy
authTokensis still accepted for backward compatibility
GET /– minimal UI pageGET /api/<script-name>– run script and stream SSE events
SSE events:
startlogenderror
- This tool executes shell scripts from your config. Only expose it inside trusted networks.
- Avoid putting untrusted script paths into config.
git tag v0.1.0
git push origin v0.1.0
gh release create v0.1.0 --title "v0.1.0" --notes "Release v0.1.0"GitHub Actions workflow .github/workflows/publish.yml will publish to npm automatically.
It triggers on v* tags and supports npm Trusted Publishing (OIDC) or NPM_TOKEN secret.
- Verify via:
npx script-runner-kit --config ./script-runner.config.json --helpDetailed release steps: see docs/RELEASE.md.
MIT