#!/bin/zsh
set -euo pipefail
contents_dir="${0:A:h:h}"
runtime_dir="${contents_dir}/Resources/TalonsRuntime"
state_dir="${HOME}/Library/Application Support/Talons/Runner"
# Keep the user's first argument intact. The shared Talons entrypoint routes
# `update` to the embedded Hatch CLI before the ordinary device CLI parses its
# arguments, so prepending --state-dir here made every documented update
# command unreachable. The ordinary CLI already reads TALONS_STATE_DIR.
TALONS_STATE_DIR="${state_dir}" exec "${runtime_dir}/node" "${runtime_dir}/talons/scripts/talons.mjs" "$@"
