Aggiunge azioni opencode-prompt e install-opencode (#1)

Aggiunge due nuove action composite:

### `install-opencode`
Verifica i prerequisiti (node/npm) e installa opencode-ai globalmente.
Input opzionale `version` per fissare una versione specifica.

### `opencode-prompt`
Esegue opencode con un prompt sul codice del repository.
- Input: `prompt` (req), `api-key` (req), `api-provider`, `model`, `agent`, `working-directory`
- Output: `result` con la risposta di opencode
- Salva copia in `opencode-output.txt` nel workspace

Reviewed-on: #1
Co-authored-by: alberto <a.nuti@live.it>
Co-committed-by: alberto <a.nuti@live.it>
This commit is contained in:
2026-05-30 20:26:00 +00:00
committed by anuti
parent 72fcf2f74f
commit 2603f780e6
2 changed files with 105 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
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
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 "ERRORE: npm non trovato."
exit 1
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)"