#!/bin/sh
# aish — AI-augmented conversational shell launcher.
# Source of truth: git.reauktion.de/marfrit/aish
#
# Installed by the aish package at /usr/bin/aish; execs LuaJIT against
# the packaged main.lua under $AISH_LIB (default /usr/share/lua/5.1/aish).
#
# Dev mode: AISH_LIB=$HOME/src/aish aish ...

AISH_LIB="${AISH_LIB:-/usr/share/lua/5.1/aish}"

if [ ! -r "$AISH_LIB/main.lua" ]; then
    echo "aish: $AISH_LIB/main.lua not found." >&2
    echo "aish: set AISH_LIB to the directory containing main.lua." >&2
    exit 2
fi

if ! command -v luajit >/dev/null 2>&1; then
    echo "aish: luajit not found in PATH. Install luajit." >&2
    exit 2
fi

exec luajit "$AISH_LIB/main.lua" "$@"
