GitHub CLI (gh): gestionar GitHub desde el chat de Cerewro

La CLI oficial de GitHub (gh) permite interactuar con GitHub directamente desde la línea de comandos: crear y clonar repos, gestionar issues y Pull Requests, ver el estado de GitHub Actions y mucho más, sin abrir el navegador.

Instalar y autenticar gh

Instalar gh en Windows
# Con winget (recomendado)
winget install GitHub.cli

# Con Chocolatey
choco install gh -y

# Con Scoop
scoop install gh
Autenticar con tu cuenta de GitHub
gh auth login
# Sigue las instrucciones: elige GitHub.com, HTTPS o SSH, y autentícate via navegador

Comandos esenciales de gh

CategoríaComandoAcción
Reposgh repo create mi-repo --publicCrear repositorio nuevo
Reposgh repo clone usuario/repoClonar repositorio
Reposgh repo list --limit 20Listar tus repos
Reposgh repo view --webAbrir repo en el navegador
Issuesgh issue listVer issues abiertos
Issuesgh issue create --title "Bug" --body "Descripción"Crear issue
Issuesgh issue close 42Cerrar issue #42
PRsgh pr create --fillCrear PR con info del commit
PRsgh pr listVer PRs abiertos
PRsgh pr merge 15 --squashMergear PR #15 con squash
Actionsgh run listVer ejecuciones recientes
Actionsgh run watchSeguir ejecución activa
Actionsgh workflow run deploy.ymlDisparar workflow manualmente
Desde Cerewro: pipeline completo nuevo proyecto
Crea un repositorio público en GitHub llamado "mi-api-rest", inicializa Git en C:\proyectos\mi-api-rest, haz el primer commit con un README y sube el código
Flujo feature branch → PR automatizado
# 1. Crear rama de feature
git switch -c feature/nueva-funcionalidad

# 2. Hacer cambios y commit
git add . && git commit -m "feat: nueva funcionalidad"

# 3. Push y abrir PR en un solo comando
git push -u origin feature/nueva-funcionalidad
gh pr create --title "Nueva funcionalidad" --body "Descripción detallada" --label "enhancement"
gh + Cerewro = revisión de PRs con IA: Pide a Cerewro: "Muéstrame los cambios del PR #42 y dime si hay algo que mejorar". La IA usa gh pr diff 42 para obtener el diff y lo analiza automáticamente.