From 2d9afccca005f4315428a5661f08748f345c561d Mon Sep 17 00:00:00 2001 From: "Mauro Rosero P." Date: Fri, 4 Apr 2025 11:27:55 -0500 Subject: [PATCH] [ADDED] Soporte para gum (Charm TUI toolkit) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Añadida instalación de gum a bootstrap.sh - Implementada actualización automática de gum en update.sh - Agregada función gum_install en bootstrap.lib - Actualizada documentación en README para reflejar el nuevo componente - Actualizada la estructura de directorios con el nuevo directorio data/ - Actualizada versión a 1.3.1 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- README.md | 26 ++++++++++++----------- bin/bootstrap.sh | 13 ++++++++++-- bin/lib/bootstrap.lib | 48 +++++++++++++++++++++++++++++++++++++++++++ bin/update.sh | 32 +++++++++++++++++++++++++++-- 4 files changed, 103 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 34020df..6d4fa85 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,8 @@ MRDevs Tools utiliza una estructura organizada que separa el código (en ~/devs) | Comando | Descripción | |---------|-------------| -| `bin/bootstrap.sh` | Instala herramientas básicas (incluyendo oathtool, zbar y redis-cli) y configura la gestión de contenedores | -| `bin/update.sh` | Actualiza el entorno de desarrollo y herramientas (incluyendo oathtool, zbar y redis-cli) | +| `bin/bootstrap.sh` | Instala herramientas básicas (incluyendo oathtool, zbar, redis-cli y gum) y configura la gestión de contenedores | +| `bin/update.sh` | Actualiza el entorno de desarrollo y herramientas (incluyendo oathtool, zbar, redis-cli y gum) | | `bin/npm_install.sh` | Instala NodeJS y npm de forma interactiva | | `bin/project_new.sh` | Crea un nuevo proyecto con estructura estandarizada según el tipo seleccionado | @@ -548,16 +548,18 @@ MRDevs Tools está diseñado con la seguridad y privacidad en mente: ``` $HOME/ ├── devs/ # Directorio principal del proyecto -│ └── bin/ # Scripts ejecutables y herramientas -│ ├── lib/ # Bibliotecas compartidas -│ ├── msg/ # Archivos de mensajes multilingües -│ ├── config/ # Configuraciones y parámetros -│ │ └── *.gitignore # Plantillas para proyectos -│ ├── bootstrap.sh # Instalador básico -│ ├── update.sh # Actualizador de entorno -│ ├── ollama*.sh # Scripts de Ollama -│ ├── claude_voice.py # Asistente de voz para Claude Code -│ └── ... # Otros scripts +│ ├── bin/ # Scripts ejecutables y herramientas +│ │ ├── lib/ # Bibliotecas compartidas +│ │ ├── msg/ # Archivos de mensajes multilingües +│ │ ├── config/ # Configuraciones y parámetros +│ │ │ └── *.gitignore # Plantillas para proyectos +│ │ ├── bootstrap.sh # Instalador básico +│ │ ├── update.sh # Actualizador de entorno +│ │ ├── ollama*.sh # Scripts de Ollama +│ │ ├── claude_voice.py # Asistente de voz para Claude Code +│ │ └── ... # Otros scripts +│ └── data/ # Datos persistentes (no versionados) +│ └── rates/ # Tarifas almacenadas para programadores │ ├── .sounds/ # Archivos de audio para notificaciones ├── .ollama/ # Configuración y datos de Ollama (IA) diff --git a/bin/bootstrap.sh b/bin/bootstrap.sh index e17a5bd..538c907 100755 --- a/bin/bootstrap.sh +++ b/bin/bootstrap.sh @@ -6,8 +6,8 @@ #Company Email : mauro@rosero.one #Personal Email : mauro.rosero@gmail.com #Created : 2025/03/19 11:57:08 -#Modified : 2025/03/30 16:30:00 -#Version : 1.3.0 +#Modified : 2025/04/04 14:00:00 +#Version : 1.3.1 #Use Notes : #============================================================================== # Derechos de Autor [2025] [Mauro Rosero P. ] @@ -89,6 +89,7 @@ install() { local OATHTOOL_PACKAGE=oathtool local ZBAR_PACKAGE=zbar local REDIS_CLI_PACKAGE=redis-tools + local GUM_PACKAGE=gum # Load base bash library BIN_HOME=$BIN_PATH @@ -230,6 +231,14 @@ install() { echo "Instalando redis-cli..." os_pkgs_install $REDIS_CLI_PACKAGE fi + + # Install gum if not already installed + command_installed gum + if [ $? -ne 0 ] + then + echo "Instalando gum..." + gum_install + fi } diff --git a/bin/lib/bootstrap.lib b/bin/lib/bootstrap.lib index 857bb17..24f85e4 100755 --- a/bin/lib/bootstrap.lib +++ b/bin/lib/bootstrap.lib @@ -465,3 +465,51 @@ function zbar_install() { echo "zbar instalado correctamente." return 0 } + +# Install gum package (TUI toolkit) +function gum_install() { + echo "Instalando gum (toolkit para interfaces TUI)..." + + if [ "$(uname)" == "Darwin" ]; then + # En macOS, instalamos a través de Homebrew + brew install gum + elif [ -f /etc/debian_version ] || [ -f /etc/os-release ]; then + # En sistemas Debian y derivados + mkdir -p /etc/apt/keyrings + curl -fsSL https://repo.charm.sh/apt/gpg.key | gpg --dearmor -o /etc/apt/keyrings/charm.gpg + echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" > /etc/apt/sources.list.d/charm.list + apt update + apt install -y gum + elif [ -f /etc/redhat-release ]; then + # En sistemas Red Hat + echo '[charm] +name=Charm +baseurl=https://repo.charm.sh/yum/ +enabled=1 +gpgcheck=1 +gpgkey=https://repo.charm.sh/yum/gpg.key' | tee /etc/yum.repos.d/charm.repo + dnf install -y gum + elif [ -f /etc/arch-release ]; then + # En Arch Linux, instalamos desde AUR + command_installed "yay" + if [ $? -ne 0 ]; then + echo "Instalando yay para acceder a AUR..." + pacman -Sy --noconfirm git base-devel + git clone https://aur.archlinux.org/yay.git /tmp/yay + cd /tmp/yay + makepkg -si --noconfirm + cd - > /dev/null + rm -rf /tmp/yay + fi + yay -S --noconfirm gum + elif [ -f /etc/rc.conf ]; then + # En FreeBSD + pkg install -y gum + else + echo "${os_nofound}" + return 1 + fi + + echo "gum instalado correctamente." + return 0 +} diff --git a/bin/update.sh b/bin/update.sh index 2827d83..41176a2 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -6,8 +6,8 @@ #Company Email : mauro@rosero.one #Personal Email : mauro.rosero@gmail.com #Created : 2024/12/09 10:27:00 -#Modified : 2025/03/30 16:30:00 -#Version : 1.3.0 +#Modified : 2025/04/04 14:00:00 +#Version : 1.3.1 #Use Notes : #============================================================================== # Derechos de Autor [2025] [Mauro Rosero P. ] @@ -288,6 +288,34 @@ update_additional_tools() { fi echo -e "${head_info}: redis-cli actualizado correctamente." fi + + # Actualizar gum si está instalado + command_installed gum + if [ $? -eq 0 ]; then + echo -e "\n${head_info}: Actualizando gum (Charm TUI toolkit)..." + if [ -f /etc/debian_version ] || [ -f /etc/os-release ]; then + # Para sistemas basados en Debian + apt update + apt install --only-upgrade -y gum + elif [ -f /etc/redhat-release ]; then + # Para sistemas basados en Red Hat + dnf upgrade -y gum + elif [ -f /etc/arch-release ]; then + # Para Arch Linux con yay + command_installed yay + if [ $? -eq 0 ]; then + yay -Syu --noconfirm gum + else + echo -e "${head_error}: yay no está instalado, no se puede actualizar gum" + fi + elif [ "$(uname)" == "Darwin" ]; then + # Para macOS con Homebrew + brew upgrade gum + else + echo -e "${head_error}: Sistema operativo no soportado para actualizar gum" + fi + echo -e "${head_info}: gum actualizado correctamente." + fi } # Actualizar herramientas adicionales con sudo si están instaladas