24 lines
653 B
Bash
Executable File
24 lines
653 B
Bash
Executable File
#!/bin/sh
|
|
# Neuron launcher: prefer the compiled binary from a local build,
|
|
# fall back to running from source under Bun.
|
|
SELF="$0"
|
|
while [ -L "$SELF" ]; do
|
|
LINK="$(readlink "$SELF")"
|
|
case "$LINK" in
|
|
/*) SELF="$LINK" ;;
|
|
*) SELF="$(dirname "$SELF")/$LINK" ;;
|
|
esac
|
|
done
|
|
DIR="$(cd "$(dirname "$SELF")" && pwd)"
|
|
PKG="$DIR/.."
|
|
ARCH=$(uname -m)
|
|
case "$ARCH" in
|
|
arm64) TARGET="opencode-darwin-arm64" ;;
|
|
x86_64) TARGET="opencode-darwin-x64" ;;
|
|
*) TARGET="" ;;
|
|
esac
|
|
if [ -n "$TARGET" ] && [ -x "$PKG/dist/$TARGET/bin/opencode" ]; then
|
|
exec "$PKG/dist/$TARGET/bin/opencode" "$@"
|
|
fi
|
|
exec bun run --conditions=browser "$PKG/src/index.ts" "$@"
|