#!/usr/bin/env bash
# Instalador Negócios com IA para Linux: prepara Git, Node.js, Python e Claude Code.
set -euo pipefail
if [ "$(uname -s)" != "Linux" ]; then echo "Este instalador é para Linux." >&2; exit 1; fi
command -v curl >/dev/null || { echo "Instale curl e execute novamente." >&2; exit 1; }
echo "NEGÓCIOS COM IA | Preparando seu computador"
echo "Vou verificar Git, Node.js LTS, Python e Claude Code."
read -r -p "Continuar? [s/N] " answer < /dev/tty
case "$answer" in s|S|sim|SIM) ;; *) echo "Cancelado. Nenhuma alteração realizada."; exit 0 ;; esac
if command -v apt-get >/dev/null; then
  sudo apt-get update
  sudo apt-get install -y git nodejs npm python3
elif command -v dnf >/dev/null; then
  sudo dnf install -y git nodejs npm python3
elif command -v pacman >/dev/null; then
  sudo pacman -Sy --needed --noconfirm git nodejs npm python
else
  echo "Distribuição não reconhecida. Instale Git, Node.js e Python pelo gerenciador da sua distribuição." >&2
  exit 1
fi
export PATH="$HOME/.local/bin:$PATH"
if ! command -v claude >/dev/null; then
  curl --proto '=https' --tlsv1.2 -fsSL https://claude.ai/install.sh | bash
fi
claude --version
echo "Ambiente preparado. Abra um novo terminal e execute: claude"
echo "Para diagnóstico: claude doctor"
