2026-04-19 23:24:28 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
2026-04-19 23:26:42 +00:00
|
|
|
cd "$(dirname "$0")"
|
2026-04-19 23:24:28 +00:00
|
|
|
|
2026-04-19 23:26:42 +00:00
|
|
|
# Auto-install auth-rt if not found
|
|
|
|
|
if ! command -v auth-rt &>/dev/null && [ ! -x "$HOME/.local/bin/auth-rt" ]; then
|
|
|
|
|
echo "auth-rt not found, installing..."
|
|
|
|
|
_FORGEJO="http://192.168.0.108:3030"
|
|
|
|
|
_OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
|
|
|
_ARCH="$(uname -m)"; case "$_ARCH" in x86_64) _ARCH="amd64";; aarch64) _ARCH="arm64";; esac
|
|
|
|
|
_URL="$_FORGEJO/agent-skills/auth-runtime/releases/download/latest/auth-rt-${_OS}-${_ARCH}"
|
|
|
|
|
mkdir -p "$HOME/.local/bin"
|
|
|
|
|
if curl -fsSL "$_URL" -o "$HOME/.local/bin/auth-rt" 2>/dev/null; then
|
|
|
|
|
chmod +x "$HOME/.local/bin/auth-rt"
|
|
|
|
|
echo "auth-rt installed (downloaded)"
|
|
|
|
|
else
|
|
|
|
|
echo "Download failed, building from source..."
|
|
|
|
|
_SRC="$HOME/.local/share/auth-runtime"
|
|
|
|
|
if [ -d "$_SRC/.git" ]; then git -C "$_SRC" pull --ff-only
|
|
|
|
|
else git clone --depth 1 "$_FORGEJO/agent-skills/auth-runtime.git" "$_SRC"
|
|
|
|
|
fi
|
|
|
|
|
bash "$_SRC/install.sh"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2026-04-19 23:24:28 +00:00
|
|
|
|
2026-04-19 23:26:42 +00:00
|
|
|
# Check required system dependencies
|
2026-04-19 23:24:28 +00:00
|
|
|
for cmd in ffmpeg ffprobe bun; do
|
|
|
|
|
if ! command -v "$cmd" &>/dev/null; then
|
|
|
|
|
echo "ERROR: '$cmd' not found in PATH. Please install it first." >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
bun install
|
|
|
|
|
bun run build
|
|
|
|
|
|
|
|
|
|
echo "Done. Run with: bun dist/run.js <command> [args]"
|
2026-04-19 23:26:42 +00:00
|
|
|
echo "Copy .env.example to .env and fill in VISION_API_KEY."
|