#!/bin/sh
set -eu

if command -v npm >/dev/null 2>&1; then
  npm install --global cmux-relay
elif command -v bun >/dev/null 2>&1; then
  bun install --global cmux-relay
else
  printf '%s\n' 'Chatmux Relay requires Node.js 20 or newer.' >&2
  printf '%s\n' 'Install Node.js from https://nodejs.org, then run this command again.' >&2
  exit 1
fi

printf '%s\n' 'cmux-relay installed.'
printf '%s\n' 'Run: cmux-relay'
