#!/bin/sh
set -eu

repo=${UNIDESK_TRANS_REPO_ROOT:-/root/unidesk}
if [ ! -f "$repo/scripts/ssh-cli.ts" ]; then
  self_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
  repo=$(CDPATH= cd -- "$self_dir/.." && pwd)
fi

UNIDESK_SSH_ENTRYPOINT=${UNIDESK_SSH_ENTRYPOINT:-trans}
export UNIDESK_SSH_ENTRYPOINT
exec bun "$repo/scripts/ssh-cli.ts" ssh "$@"
