Created
April 10, 2026 11:10
-
-
Save ir31k0/7d0526ef0441010bea6614457289ce57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Author: ir31k0 | |
| # Version 1.0.0 (10.04.2026) | |
| # Lizenz: MIT | |
| # | |
| # Beschreibung: Dieses Bash-Script überprüft automatisch, ob deine Entwicklungsumgebung für OpenAI | |
| # Codex unter WSL korrekt eingerichtet ist. Es prüft zentrale Komponenten wie Node.js (inkl. Version), | |
| # npm, Codex CLI, nvm sowie wichtige Tools wie ripgrep und git. Zusätzlich werden WSL-Umgebung, | |
| # Projektpfad und Git-Konfiguration validiert. | |
| # | |
| # Vibe Coded mit ChatGPT | |
| set -u | |
| PASS="✅" | |
| FAIL="❌" | |
| WARN="⚠️" | |
| fail_count=0 | |
| warn_count=0 | |
| print_ok() { | |
| echo "$PASS $1" | |
| } | |
| print_fail() { | |
| echo "$FAIL $1" | |
| fail_count=$((fail_count + 1)) | |
| } | |
| print_warn() { | |
| echo "$WARN $1" | |
| warn_count=$((warn_count + 1)) | |
| } | |
| check_cmd() { | |
| local cmd="$1" | |
| local label="$2" | |
| if command -v "$cmd" >/dev/null 2>&1; then | |
| local path | |
| path="$(command -v "$cmd")" | |
| print_ok "$label gefunden: $path" | |
| return 0 | |
| else | |
| print_fail "$label nicht gefunden" | |
| return 1 | |
| fi | |
| } | |
| check_nvm_version() { | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
| install_cmd=$(curl -s https://raw.githubusercontent.com/nvm-sh/nvm/master/README.md | sed -n '/curl.*install\.sh/,/bash/p' | head -n1) | |
| if ! command -v nvm >/dev/null 2>&1; then | |
| if [[ -n "$install_cmd" ]]; then | |
| print_warn "nvm nicht installiert" | |
| echo " Installiere mit:" | |
| echo " $install_cmd" | |
| else | |
| print_warn "nvm nicht installiert" | |
| echo " https://github.com/nvm-sh/nvm" | |
| fi | |
| return | |
| fi | |
| local current latest | |
| current="$(nvm --version 2>/dev/null || echo '')" | |
| if [[ -z "$current" ]]; then | |
| print_warn "nvm Version konnte nicht gelesen werden" | |
| return | |
| fi | |
| print_ok "nvm installiert: v$current" | |
| # GitHub API call | |
| latest=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r .tag_name | sed 's/^v//') | |
| if [[ -z "$latest" ]]; then | |
| print_warn "Konnte aktuelle nvm-Version nicht von GitHub laden" | |
| return | |
| fi | |
| if [[ "$current" == "$latest" ]]; then | |
| print_ok "nvm ist aktuell (v$current)" | |
| else | |
| print_warn "nvm veraltet (installiert: v$current, aktuell: v$latest)" | |
| if [[ -n "$install_cmd" ]]; then | |
| echo " Aktualisieren mit:" | |
| echo " $install_cmd" | |
| else | |
| echo " Update: https://github.com/nvm-sh/nvm" | |
| fi | |
| fi | |
| } | |
| check_node_version() { | |
| if ! command -v node >/dev/null 2>&1; then | |
| print_fail "Node.js nicht installiert" | |
| return | |
| fi | |
| local version major | |
| version="$(node -v 2>/dev/null)" | |
| major="$(echo "$version" | sed -E 's/^v([0-9]+).*/\1/')" | |
| if [[ "$major" =~ ^[0-9]+$ ]]; then | |
| if (( major >= 22 )); then | |
| print_ok "Node.js Version ist geeignet: $version" | |
| else | |
| print_fail "Node.js Version ist zu alt: $version (erwartet: >= v22)" | |
| fi | |
| else | |
| print_fail "Node.js Version konnte nicht ausgewertet werden: $version" | |
| fi | |
| } | |
| check_npm() { | |
| if command -v npm >/dev/null 2>&1; then | |
| print_ok "npm installiert: $(npm -v)" | |
| else | |
| print_fail "npm nicht installiert" | |
| fi | |
| } | |
| check_codex() { | |
| if command -v codex >/dev/null 2>&1; then | |
| local version | |
| version="$(codex --version 2>/dev/null || true)" | |
| if [[ -n "$version" ]]; then | |
| print_ok "Codex installiert: $version" | |
| else | |
| print_ok "Codex installiert" | |
| fi | |
| else | |
| print_fail "Codex nicht installiert" | |
| fi | |
| } | |
| check_wsl() { | |
| if [[ -n "${WSL_DISTRO_NAME:-}" ]]; then | |
| print_ok "WSL erkannt: $WSL_DISTRO_NAME" | |
| else | |
| print_warn "Keine WSL-Umgebung erkannt" | |
| fi | |
| } | |
| check_repo_location() { | |
| local cwd | |
| cwd="$(pwd)" | |
| if [[ "$cwd" == /mnt/* ]]; then | |
| print_warn "Aktuelles Verzeichnis liegt unter /mnt: $cwd" | |
| echo " Empfehlung: Projekte besser unter ~/code ablegen" | |
| else | |
| print_ok "Aktuelles Verzeichnis liegt im Linux-Dateisystem: $cwd" | |
| fi | |
| } | |
| check_home_projects_dir() { | |
| if [[ -d "$HOME/projects" ]]; then | |
| print_ok "~/projects existiert" | |
| else | |
| print_warn "~/projects existiert nicht" | |
| fi | |
| } | |
| check_git_config() { | |
| local name email | |
| name="$(git config --global user.name 2>/dev/null || true)" | |
| email="$(git config --global user.email 2>/dev/null || true)" | |
| if [[ -n "$name" ]]; then | |
| print_ok "Git user.name gesetzt: $name" | |
| else | |
| print_warn "Git user.name nicht gesetzt > git config --global user.name <name>" | |
| fi | |
| if [[ -n "$email" ]]; then | |
| print_ok "Git user.email gesetzt: $email" | |
| else | |
| print_warn "Git user.email nicht gesetzt > git config --global user.email <email>" | |
| fi | |
| } | |
| echo "=== Codex / WSL Gesundheitscheck ===" | |
| echo | |
| check_wsl | |
| check_repo_location | |
| check_home_projects_dir | |
| echo | |
| echo "--- nvm ---" | |
| check_nvm_version | |
| echo | |
| echo "--- Pflicht-Tools ---" | |
| check_node_version | |
| check_npm | |
| check_codex | |
| check_cmd rg "ripgrep (rg)" | |
| check_cmd git "git" | |
| echo | |
| echo "--- Sinnvolle Zusatztools ---" | |
| check_cmd jq "jq" | |
| check_cmd fzf "fzf" | |
| if command -v fd >/dev/null 2>&1; then | |
| print_ok "fd gefunden: $(command -v fd)" | |
| elif command -v fdfind >/dev/null 2>&1; then | |
| print_ok "fd/fdfind gefunden: $(command -v fdfind)" | |
| else | |
| print_warn "fd bzw. fdfind nicht gefunden" | |
| fi | |
| if command -v bat >/dev/null 2>&1; then | |
| print_ok "bat gefunden: $(command -v bat)" | |
| elif command -v batcat >/dev/null 2>&1; then | |
| print_ok "bat/batcat gefunden: $(command -v batcat)" | |
| else | |
| print_warn "bat bzw. batcat nicht gefunden" | |
| fi | |
| check_cmd tmux "tmux" | |
| echo | |
| echo "--- Versionen ---" | |
| command -v node >/dev/null 2>&1 && echo "Node: $(node -v)" | |
| command -v npm >/dev/null 2>&1 && echo "npm: $(npm -v)" | |
| command -v codex >/dev/null 2>&1 && echo "Codex: $(codex --version 2>/dev/null || echo 'Version nicht lesbar')" | |
| command -v rg >/dev/null 2>&1 && echo "rg: $(rg --version | head -n 1)" | |
| command -v git >/dev/null 2>&1 && echo "git: $(git --version)" | |
| echo | |
| echo "--- Git-Konfiguration ---" | |
| if command -v git >/dev/null 2>&1; then | |
| check_git_config | |
| else | |
| print_fail "Git-Konfiguration kann nicht geprüft werden, weil git fehlt" | |
| fi | |
| echo | |
| echo "=== Ergebnis ===" | |
| if (( fail_count == 0 )); then | |
| echo "✅ Keine harten Fehler gefunden" | |
| else | |
| echo "❌ $fail_count Problem(e) gefunden" | |
| fi | |
| if (( warn_count > 0 )); then | |
| echo "⚠️ $warn_count Hinweis(e)" | |
| fi | |
| echo | |
| if (( fail_count == 0 )); then | |
| echo "Codex-Setup sieht grundsätzlich gut aus." | |
| else | |
| echo "Bitte die ❌ Punkte beheben." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment