#!/usr/bin/env bash set -Eeuo pipefail PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin export PATH ROOT=$(cd -- "$(dirname -- "$0")/.." && pwd -P) NODE=${TALLYNOTE_NODE:-} node_is_usable() { local candidate=$1 major [[ -n "$candidate" && -x "$candidate" ]] || return 1 major=$("$candidate" -p 'process.versions.node.split(".")[0]' 2>/dev/null || true) [[ "$major" =~ ^[0-9]+$ && "$major" -ge 24 ]] } node_is_usable "$NODE" || NODE=$(command -v node || true) node_is_usable "$NODE" || { printf 'TallyNote: Node.js 24+ not found; run the installer again\n' >&2; exit 127; } exec "$NODE" "$ROOT/dist/server/index.js" "$@"