naming: add hako/hakorune wrappers; hako-check prefers alias via HAKO_BIN or tools/bin/hako; docs updated

This commit is contained in:
nyash-codex
2025-10-31 19:22:00 +09:00
parent 8596bea1ee
commit 8cc4654a7f
4 changed files with 35 additions and 4 deletions

13
tools/bin/hako Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
BIN="$ROOT_DIR/target/release/nyash"
if [[ ! -x "$BIN" ]]; then
echo "[info] building (release) ..." >&2
cargo build --release -q
fi
exec "$BIN" "$@"

6
tools/bin/hakorune Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
"$ROOT_DIR/tools/bin/hako" "$@"

View File

@ -5,10 +5,11 @@ Purpose
- Useful while Python/llvmlite migration is in-flight to keep scripts healthy.
Usage
- Build nyash:
- Build once (auto-build if missing):
- cargo build --release
- Run checker:
- tools/hako-check/hako-check.sh path/to/file.hako
- or set alias explicitly: HAKO_BIN=tools/bin/hako tools/hako-check/hako-check.sh file.hako
Behavior
- Runs: nyash --backend mir --verify <file>
@ -17,6 +18,8 @@ Behavior
- 2+: Parse/MIR verify failure (nyash returns nonzero; checker forwards)
Notes
- Binary alias
- Preferred alias: tools/bin/hako (or tools/bin/hakorune)
- Backwardcompat: target/release/nyash も利用可(自動検出)
- This MVP only checks a single file and depends on the Rust parser.
- Extend with flags (parser selection, JSON emit) as migration progresses.

View File

@ -7,7 +7,17 @@ if [[ $# -lt 1 ]]; then
fi
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
BIN="$ROOT_DIR/target/release/nyash"
# Allow alias: HAKO_BIN overrides binary path. Otherwise prefer 'hako' alias, then 'nyash'.
BIN="${HAKO_BIN:-}"
if [[ -z "${BIN}" ]]; then
if [[ -x "$ROOT_DIR/tools/bin/hako" ]]; then
BIN="$ROOT_DIR/tools/bin/hako"
elif [[ -x "$ROOT_DIR/tools/bin/hakorune" ]]; then
BIN="$ROOT_DIR/tools/bin/hakorune"
else
BIN="$ROOT_DIR/target/release/nyash"
fi
fi
FILE="$1"
if [[ ! -x "$BIN" ]]; then
@ -23,4 +33,3 @@ fi
# Parse → MIR build → verify (no execute)
"$BIN" --backend mir --verify "$FILE"
echo "OK: $FILE"