#!/bin/bash
# launchd entrypoint for the CTM primary.
#
# Resolves the pinned Node via bin/node-bin.sh (ignoring ambient PATH, so a
# `brew upgrade node` or a v26-first shell can't flip the ABI) and exec's the
# server. `exec` replaces this shell with the node process, so launchd's
# KeepAlive supervises node directly. Because the runtime is chosen from
# .node-version, a deliberate Node upgrade is just "edit .node-version" — the
# LaunchAgent plist never needs to change.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
NODE_BIN="$(bash "$ROOT/bin/node-bin.sh")"
exec "$NODE_BIN" "$ROOT/claude-task-manager/server.js" "$@"
