#!/usr/bin/env bash
set -euo pipefail

if [ -f /etc/debian_version ]; then
  sudo apt-get update -y
  sudo apt-get install -y curl git build-essential ripgrep
elif [ -f /etc/fedora-release ]; then
  sudo dnf install -y curl git @development-tools ripgrep
fi

if ! command -v node >/dev/null 2>&1; then
  curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
  sudo apt-get install -y nodejs || true
fi

npm i -g pnpm@9

pnpm i

echo "✓ Setup complete. Configure .env and run: pnpm dev"
