#!/bin/sh # Dosu CLI installer # Usage: curl -fsSL https://cli.dosu.dev/install.sh | sh set -e echo "Dosu CLI Installer" echo "" # Check Node.js >= 22 if ! command -v node >/dev/null 2>&1; then echo "Error: Node.js is not installed." echo "Install Node.js 22 or later from https://nodejs.org" exit 1 fi NODE_MAJOR=$(node -v | sed 's/v//' | cut -d. -f1) if [ "$NODE_MAJOR" -lt 22 ] 2>/dev/null; then echo "Error: Node.js 22+ is required (found $(node -v))." echo "Install a newer version from https://nodejs.org" exit 1 fi # Check npm if ! command -v npm >/dev/null 2>&1; then echo "Error: npm is not installed." exit 1 fi # Install the CLI globally echo "Installing @dosu/cli..." if ! npm install -g @dosu/cli; then echo "" echo "Installation failed. If you got a permissions error, try:" echo " sudo npm install -g @dosu/cli" echo "Or configure npm to install globally without sudo:" echo " https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally" echo "" echo "After installing, run 'dosu setup' from your project root to finish setup." exit 1 fi echo "" echo "Dosu CLI installed successfully!" echo "" # Run interactive setup if a terminal is available if [ -t 1 ] && [ -r /dev/tty ]; then # Read from /dev/tty so curl | sh can hand the terminal to the setup flow. dosu setup "$@"