From 7088ccce2d64acffdbf81adaa46440474dbe5ed7 Mon Sep 17 00:00:00 2001 From: chrischristiansen-glitch Date: Fri, 22 May 2026 02:14:31 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20osv-startup.ps1=20=E2=80=94=20full=20gr?= =?UTF-8?q?een=20glow=20banner=20when=20all=20systems=20OK=20[visual=20fee?= =?UTF-8?q?dback]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/osv-startup.ps1 | 219 ++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 122 deletions(-) diff --git a/scripts/osv-startup.ps1 b/scripts/osv-startup.ps1 index 97d39c9..542e8af 100644 --- a/scripts/osv-startup.ps1 +++ b/scripts/osv-startup.ps1 @@ -1,6 +1,5 @@ # OSVauco · OPAX — VS Code Windows Startup Script -# Tilsvarer osvauco-opax-boot.sh men for PowerShell/Windows -# Kjøres via terminal.integrated.profiles.windows i VS Code settings.json: +# Kjøres via settings.json: # "args": ["-NoExit", "-File", "G:\\Shared drives\\OS-VAUCO-DRIVE\\OSVauco\\scripts\\osv-startup.ps1"] $REPO_PATH = "G:\Shared drives\OS-VAUCO-DRIVE\OSVauco" @@ -15,158 +14,134 @@ $PROTOCOL = "OPAX Protocol" Set-Location $REPO_PATH Clear-Host +$gcOK = $false +$adcOK = $false +$opaxOK = $false + # ============================================================ -# BANNER +# 1) GIT PULL (stille, før banner) +# ============================================================ +$gitOut = git pull 2>&1 +$gitOK = ($LASTEXITCODE -eq 0) + +# ============================================================ +# 2) GCP SDK + ADC (stille) +# ============================================================ +try { + $gcAccount = gcloud auth list --filter=status:ACTIVE --format="value(account)" 2>$null + if ($gcAccount) { + $gcOK = $true + gcloud config set project $PROJECT 2>$null | Out-Null + gcloud config set compute/region $REGION 2>$null | Out-Null + } +} catch {} + +try { + $adcToken = gcloud auth application-default print-access-token 2>$null + if ($adcToken) { $adcOK = $true } +} catch {} + +# ============================================================ +# 3) OPAX PING (stille) +# ============================================================ +try { + $response = Invoke-RestMethod -Uri $PING_URL -TimeoutSec 5 + if ($response.status -eq 'ok') { $opaxOK = $true } +} catch {} + +# ============================================================ +# 4) BESTEM GLOW-FARGE +# ============================================================ +$allOK = $gitOK -and $opaxOK +$bannerColor = if ($allOK) { 'Green' } else { 'Yellow' } +$glowChar = if ($allOK) { '█' } else { '□' } + +# ============================================================ +# 5) BANNER # ============================================================ -Write-Host "============================================================" -ForegroundColor Cyan -Write-Host " O S V A U C O · O P A X" -ForegroundColor Cyan -Write-Host "============================================================" -ForegroundColor Cyan -Write-Host " VS Code · Windows · PowerShell" -ForegroundColor DarkCyan Write-Host "" -Write-Host " MCP_NAME : $MCP_NAME" -ForegroundColor Gray -Write-Host " PROTOCOL : $PROTOCOL" -ForegroundColor Gray -Write-Host " PROJECT : $PROJECT" -ForegroundColor Gray -Write-Host " REGION : $REGION" -ForegroundColor Gray -Write-Host " MODEL : $MODEL (locked — bruk for alle TUI-prompts)" -ForegroundColor Gray -Write-Host " HUB_URL : $PING_URL" -ForegroundColor Gray -Write-Host " SESSION : $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor Gray +Write-Host " $glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar" -ForegroundColor $bannerColor +Write-Host "" +Write-Host " O S V A U C O · O P A X" -ForegroundColor $bannerColor +Write-Host "" +Write-Host " $glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar" -ForegroundColor $bannerColor +Write-Host "" + +# Info-linjer i banner-farge når alt er OK, grå ellers +$infoColor = if ($allOK) { $bannerColor } else { 'Gray' } + +Write-Host " MCP_NAME : $MCP_NAME" -ForegroundColor $infoColor +Write-Host " PROTOCOL : $PROTOCOL" -ForegroundColor $infoColor +Write-Host " PROJECT : $PROJECT" -ForegroundColor $infoColor +Write-Host " REGION : $REGION" -ForegroundColor $infoColor +Write-Host " MODEL : $MODEL ← locked for alle TUI-prompts" -ForegroundColor $infoColor +Write-Host " HUB_URL : https://opax.vauco.no" -ForegroundColor $infoColor +Write-Host " SESSION : $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor $infoColor Write-Host "" # ============================================================ -# NESTE OPPGAVE fra session log +# 6) NESTE OPPGAVE # ============================================================ if (Test-Path $LOG_FILE) { $logContent = Get-Content $LOG_FILE -Raw $match = [regex]::Match($logContent, '(?s)## NESTE OPPGAVE\r?\n(.*?)(?=\r?\n## |$)') if ($match.Success) { - Write-Host " ▶ NESTE OPPGAVE:" -ForegroundColor Green + Write-Host " ▶ NESTE OPPGAVE:" -ForegroundColor $bannerColor $match.Groups[1].Value.Trim() -split "`n" | ForEach-Object { - Write-Host " $_" -ForegroundColor Green + Write-Host " $_" -ForegroundColor $bannerColor } - } else { - Write-Host " ⚠ Ingen NESTE OPPGAVE — sjekk docs/VAUCO_OS_ROADMAP.md" -ForegroundColor Yellow + Write-Host "" } -} else { - Write-Host " ⚠ Session log ikke funnet" -ForegroundColor Yellow } -Write-Host "" # ============================================================ -# SISTE DOCS-ENDRINGER (git log) +# 7) SISTE DOCS-ENDRINGER # ============================================================ -Write-Host " › Siste endringer i docs/:" -ForegroundColor Blue +Write-Host " › Siste endringer i docs/:" -ForegroundColor $infoColor try { - $gitLog = git -C $REPO_PATH log -5 --pretty=format:"%h %cd %s" --date=short -- docs 2>&1 + $gitLog = git -C $REPO_PATH log -4 --pretty=format:"%h %cd %s" --date=short -- docs 2>&1 if ($gitLog) { $gitLog -split "`n" | ForEach-Object { - Write-Host " $_" -ForegroundColor DarkCyan + Write-Host " $_" -ForegroundColor DarkGreen } - } else { - Write-Host " (ingen nylige docs-endringer)" -ForegroundColor DarkGray } -} catch { - Write-Host " (git ikke tilgjengelig)" -ForegroundColor DarkGray -} +} catch {} Write-Host "" # ============================================================ -# GIT PULL +# 8) STATUS-LINJER # ============================================================ -Write-Host " › Git pull..." -NoNewline -ForegroundColor Blue -try { - $gitOut = git pull 2>&1 - if ($LASTEXITCODE -eq 0) { - Write-Host " [OK]" -ForegroundColor Green - if ($gitOut -match 'Already up to date') { - Write-Host " Already up to date" -ForegroundColor DarkGray - } else { - $gitOut | Where-Object { $_ -match 'changed' } | ForEach-Object { - Write-Host " $_" -ForegroundColor Cyan - } - } - } else { - Write-Host " [FAIL]" -ForegroundColor Red - } -} catch { - Write-Host " [FAIL] $_" -ForegroundColor Red -} +# Git +$gitStatus = if ($gitOK) { if ($gitOut -match 'Already up to date') { '✅ up to date' } else { "✅ oppdatert" } } else { '❌ FEIL' } +Write-Host " Git pull : $gitStatus" -ForegroundColor $(if ($gitOK) { 'Green' } else { 'Red' }) + +# GCP +$gcStatus = if ($gcOK) { "✅ $gcAccount" } else { '⚠ ikke logget inn — gcloud auth login' } +Write-Host " GCP SDK : $gcStatus" -ForegroundColor $(if ($gcOK) { 'Green' } else { 'Yellow' }) + +# ADC +$adcStatus = if ($adcOK) { '✅ Application Default Credentials OK' } else { '⚠ mangler — gcloud auth application-default login' } +Write-Host " ADC : $adcStatus" -ForegroundColor $(if ($adcOK) { 'Green' } else { 'Yellow' }) + +# OPAX +$opaxStatus = if ($opaxOK) { '✅ https://opax.vauco.no' } else { '❌ nede — sjekk Cloud Run' } +Write-Host " OPAX-MCP : $opaxStatus" -ForegroundColor $(if ($opaxOK) { 'Green' } else { 'Red' }) + +# Gemini +Write-Host " Gemini : ℹ Cloud Shell → source scripts/osvauco-opax-boot.sh → gemini" -ForegroundColor $infoColor + Write-Host "" # ============================================================ -# GCLOUD ADC / SDK SJEKK +# 9) READY-LINJE MED GLOW # ============================================================ -Write-Host " › GCP SDK + ADC status:" -ForegroundColor Blue -$gcOK = $false -$adcOK = $false +Write-Host " $glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar" -ForegroundColor $bannerColor -try { - $gcAccount = gcloud auth list --filter=status:ACTIVE --format="value(account)" 2>$null - if ($gcAccount) { - $gcOK = $true - Write-Host " gcloud : OK — $gcAccount" -ForegroundColor Green - # Sett riktig prosjekt og region - gcloud config set project $PROJECT 2>$null | Out-Null - gcloud config set compute/region $REGION 2>$null | Out-Null - Write-Host " Project : $PROJECT" -ForegroundColor DarkGray - Write-Host " Region : $REGION" -ForegroundColor DarkGray - } else { - Write-Host " gcloud : IKKE LOGGET INN — kjør: gcloud auth login" -ForegroundColor Yellow - } -} catch { - Write-Host " gcloud : IKKE TILGJENGELIG i dette miljøet" -ForegroundColor DarkGray -} - -try { - $adcToken = gcloud auth application-default print-access-token 2>$null - if ($adcToken) { - $adcOK = $true - Write-Host " ADC : OK (Application Default Credentials aktive)" -ForegroundColor Green - } else { - Write-Host " ADC : MANGLER — kjør: gcloud auth application-default login" -ForegroundColor Yellow - } -} catch { - Write-Host " ADC : ikke verifisert i dette miljøet" -ForegroundColor DarkGray -} -Write-Host "" - -# ============================================================ -# OPAX PING -# ============================================================ -Write-Host " › Tester OPAX-MCP: $PING_URL" -NoNewline -ForegroundColor Blue -try { - $response = Invoke-RestMethod -Uri $PING_URL -TimeoutSec 5 - if ($response.status -eq 'ok') { - Write-Host " [OK]" -ForegroundColor Green - Write-Host " ✅ OPAX-MCP: OK — https://opax.vauco.no" -ForegroundColor Green - } else { - Write-Host " [WARN]" -ForegroundColor Yellow - } -} catch { - Write-Host " [FAIL]" -ForegroundColor Red - Write-Host " ❌ OPAX-MCP nede — sjekk Cloud Run / DNS" -ForegroundColor Red -} -Write-Host "" - -# ============================================================ -# GEMINI TUI REMINDER -# ============================================================ -Write-Host " › Gemini TUI:" -ForegroundColor Blue -Write-Host " Modell : $MODEL (bruk alltid denne i TUI)" -ForegroundColor DarkCyan -Write-Host " Boot TUI : start Cloud Shell → source scripts/osvauco-opax-boot.sh → gemini" -ForegroundColor DarkCyan -Write-Host " TUI lest : GEMINI.md lastes automatisk ved oppstart i Cloud Shell" -ForegroundColor DarkCyan -Write-Host "" - -# ============================================================ -# READY-LINJE -# ============================================================ -Write-Host "============================================================" -ForegroundColor Cyan -if ($gcOK -and $adcOK) { - Write-Host " ▶ OSVAUCO/OPAX READY — GCP + ADC + OPAX verifisert" -ForegroundColor Green -} elseif ($gcOK) { - Write-Host " ▶ OSVAUCO/OPAX READY — OPAX OK. ADC ikke verifisert." -ForegroundColor Yellow +if ($allOK) { + Write-Host " ▶▶ OSVAUCO / OPAX — ALL SYSTEMS GREEN ◀◀" -ForegroundColor Green } else { - Write-Host " ▶ OSVAUCO/OPAX PARTIAL — gcloud ikke tilgjengelig i VS Code shell" -ForegroundColor Yellow - Write-Host " (Bruk Cloud Shell for gcloud-kommandoer)" -ForegroundColor DarkGray + Write-Host " ⚠ OSVAUCO / OPAX — PARTIAL — sjekk status over" -ForegroundColor Yellow } -Write-Host "============================================================" -ForegroundColor Cyan + +Write-Host " $glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar$glowChar" -ForegroundColor $bannerColor Write-Host ""