name: Installa OpenCode description: Installa opencode-ai globalmente tramite npm. inputs: version: description: "Versione di opencode da installare (default: latest)." required: false default: "" runs: using: composite steps: - name: Verifica prerequisiti e installa npm se assente shell: bash run: | set -euo pipefail if ! command -v node &> /dev/null; then echo "ERRORE: node non trovato. Installa Node.js sul runner." exit 1 fi if ! command -v npm &> /dev/null; then echo "npm non trovato, tentativo di installazione..." if command -v apt-get &> /dev/null; then apt-get update -qq && apt-get install -y -qq npm 2>&1 || true elif command -v apk &> /dev/null; then apk add --no-cache npm 2>&1 || true fi if ! command -v npm &> /dev/null; then echo "ERRORE: impossibile installare npm." exit 1 fi fi echo "node $(node --version), npm $(npm --version)" - name: Installa opencode shell: bash run: | set -euo pipefail if command -v opencode &> /dev/null; then echo "opencode giĆ  installato: $(opencode --version)" exit 0 fi VERSION="${{ inputs.version }}" if [ -n "$VERSION" ]; then npm install -g "opencode-ai@${VERSION}" else npm install -g opencode-ai fi echo "opencode installato: $(opencode --version)"