#!/bin/sh
# Runtime-agnostic launcher — works with bun, node, or tsx
# Resolve symlinks to find the actual package directory
SELF="$0"
while [ -L "$SELF" ]; do
  DIR="$(cd "$(dirname "$SELF")" && pwd)"
  SELF="$(readlink "$SELF")"
  case "$SELF" in /*) ;; *) SELF="$DIR/$SELF" ;; esac
done
CLI="$(cd "$(dirname "$SELF")/.." && pwd)/dist/cli.js"

if command -v bun >/dev/null 2>&1; then
  exec bun "$CLI" "$@"
elif command -v node >/dev/null 2>&1; then
  exec node "$CLI" "$@"
else
  echo "Error: Neither bun nor node found in PATH. Install one of them." >&2
  exit 1
fi
