feat: osv-startup.ps1 — purple section titles, box borders, text inside glow blocks, fix ADC logic + git encoding [Phase 4]

This commit is contained in:
chrischristiansen-glitch 2026-05-22 02:32:41 +02:00
parent 0e43473d74
commit 2e66e6c510

View File

@ -1,6 +1,5 @@
# OSVauco · OPAX — VS Code Windows Startup Script
# Kjøres via settings.json:
# "args": ["-NoExit", "-File", "G:\\Shared drives\\OS-VAUCO-DRIVE\\OSVauco\\scripts\\osv-startup.ps1"]
# 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"
$PING_URL = "https://opax.vauco.no/ping"
@ -10,6 +9,11 @@ $REGION = "us-central1"
$MODEL = "gemini-2.5-pro"
$MCP_NAME = "OPAX-MCP"
$PROTOCOL = "OPAX Protocol"
$LINE = " " + ("" * 54)
$THIN = " " + ("" * 54)
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$env:PYTHONUTF8 = "1"
Set-Location $REPO_PATH
Clear-Host
@ -17,16 +21,13 @@ Clear-Host
$gcOK = $false
$adcOK = $false
$opaxOK = $false
$gitOK = $false
# ============================================================
# 1) GIT PULL (stille, før banner)
# ============================================================
# ---- GIT PULL -----------------------------------------------
$gitOut = git pull 2>&1
$gitOK = ($LASTEXITCODE -eq 0)
# ============================================================
# 2) GCP SDK + ADC (stille)
# ============================================================
# ---- GCP SDK ------------------------------------------------
try {
$gcAccount = gcloud auth list --filter=status:ACTIVE --format="value(account)" 2>$null
if ($gcAccount) {
@ -36,112 +37,121 @@ try {
}
} catch {}
# ---- ADC ----------------------------------------------------
try {
$adcToken = gcloud auth application-default print-access-token 2>$null
if ($adcToken) { $adcOK = $true }
} catch {}
# ============================================================
# 3) OPAX PING (stille)
# ============================================================
# ---- OPAX PING ----------------------------------------------
try {
$response = Invoke-RestMethod -Uri $PING_URL -TimeoutSec 5
if ($response.status -eq 'ok') { $opaxOK = $true }
$r = Invoke-RestMethod -Uri $PING_URL -TimeoutSec 5
if ($r.status -eq 'ok') { $opaxOK = $true }
} catch {}
# ============================================================
# 4) BESTEM GLOW-FARGE
# ============================================================
$allOK = $gitOK -and $opaxOK
$bannerColor = if ($allOK) { 'Green' } else { 'Yellow' }
$glowChar = if ($allOK) { '█' } else { '□' }
# ---- FARGE-LOGIKK -------------------------------------------
$allOK = $gitOK -and $opaxOK -and $gcOK
$bannerCol = if ($allOK) { 'Green' } else { 'Yellow' }
$infoCol = if ($allOK) { 'Green' } else { 'Gray' }
$Purple = 'Magenta'
# ============================================================
# 5) BANNER
# TOPP-BLOKK
# ============================================================
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 ""
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 $LINE -ForegroundColor $bannerCol
Write-Host " █ █" -ForegroundColor $bannerCol
Write-Host " █ O S V A U C O · O P A X █" -ForegroundColor $bannerCol
Write-Host " █ VS Code · Windows · PowerShell █" -ForegroundColor $bannerCol
Write-Host " █ █" -ForegroundColor $bannerCol
Write-Host $LINE -ForegroundColor $bannerCol
Write-Host ""
# ============================================================
# 6) NESTE OPPGAVE
# LOCKED DEFINITIONS
# ============================================================
Write-Host " ■ LOCKED DEFINITIONS" -ForegroundColor $Purple
Write-Host $THIN -ForegroundColor $Purple
Write-Host " █ MCP_NAME : $MCP_NAME" -ForegroundColor $infoCol
Write-Host " █ PROTOCOL : $PROTOCOL" -ForegroundColor $infoCol
Write-Host " █ PROJECT : $PROJECT" -ForegroundColor $infoCol
Write-Host " █ REGION : $REGION" -ForegroundColor $infoCol
Write-Host " █ MODEL : $MODEL ← locked for alle TUI-prompts" -ForegroundColor $infoCol
Write-Host " █ HUB_URL : https://opax.vauco.no" -ForegroundColor $infoCol
Write-Host " █ SESSION : $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" -ForegroundColor $infoCol
Write-Host $THIN -ForegroundColor $Purple
Write-Host ""
# ============================================================
# NESTE OPPGAVE
# ============================================================
Write-Host " ■ NESTE OPPGAVE" -ForegroundColor $Purple
Write-Host $THIN -ForegroundColor $Purple
if (Test-Path $LOG_FILE) {
$logContent = Get-Content $LOG_FILE -Raw
$logContent = Get-Content $LOG_FILE -Raw -Encoding UTF8
$match = [regex]::Match($logContent, '(?s)## NESTE OPPGAVE\r?\n(.*?)(?=\r?\n## |$)')
if ($match.Success) {
Write-Host " ▶ NESTE OPPGAVE:" -ForegroundColor $bannerColor
$match.Groups[1].Value.Trim() -split "`n" | ForEach-Object {
Write-Host " $_" -ForegroundColor $bannerColor
Write-Host " $_" -ForegroundColor $bannerCol
}
Write-Host ""
} else {
Write-Host " █ Ingen NESTE OPPGAVE — sjekk docs/VAUCO_OS_ROADMAP.md" -ForegroundColor Yellow
}
} else {
Write-Host " █ Session log ikke funnet" -ForegroundColor Yellow
}
Write-Host $THIN -ForegroundColor $Purple
Write-Host ""
# ============================================================
# 7) SISTE DOCS-ENDRINGER
# SISTE DOCS-ENDRINGER
# ============================================================
Write-Host " Siste endringer i docs/:" -ForegroundColor $infoColor
Write-Host " ■ SISTE ENDRINGER I DOCS/" -ForegroundColor $Purple
Write-Host $THIN -ForegroundColor $Purple
try {
$env:GIT_TERMINAL_PROMPT = "0"
$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 DarkGreen
Write-Host " $_" -ForegroundColor DarkGreen
}
} else {
Write-Host " █ (ingen nylige endringer)" -ForegroundColor DarkGray
}
} catch {}
Write-Host ""
# ============================================================
# 8) STATUS-LINJER
# ============================================================
# 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 ""
# ============================================================
# 9) READY-LINJE MED GLOW
# ============================================================
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
if ($allOK) {
Write-Host " ▶▶ OSVAUCO / OPAX — ALL SYSTEMS GREEN ◀◀" -ForegroundColor Green
} else {
Write-Host " ⚠ OSVAUCO / OPAX — PARTIAL — sjekk status over" -ForegroundColor Yellow
} catch {
Write-Host " █ (git ikke tilgjengelig)" -ForegroundColor DarkGray
}
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 $THIN -ForegroundColor $Purple
Write-Host ""
# ============================================================
# SYSTEM STATUS
# ============================================================
Write-Host " ■ SYSTEM STATUS" -ForegroundColor $Purple
Write-Host $THIN -ForegroundColor $Purple
$gitTxt = if ($gitOK) { if ($gitOut -match 'Already up to date') { "✅ up to date" } else { "✅ oppdatert" } } else { "❌ FEIL" }
$gcTxt = if ($gcOK) { "$gcAccount" } else { "⚠ ikke logget inn — kjør: gcloud auth login" }
$adcTxt = if ($adcOK) { "✅ Application Default Credentials OK" } else { "⚠ kjør: gcloud auth application-default login" }
$opaxTxt = if ($opaxOK){ "✅ https://opax.vauco.no" } else { "❌ nede — sjekk Cloud Run" }
Write-Host " █ Git pull : $gitTxt" -ForegroundColor $(if ($gitOK) { 'Green' } else { 'Red' })
Write-Host " █ GCP SDK : $gcTxt" -ForegroundColor $(if ($gcOK) { 'Green' } else { 'Yellow' })
Write-Host " █ ADC : $adcTxt" -ForegroundColor $(if ($adcOK) { 'Green' } else { 'Yellow' })
Write-Host " █ OPAX-MCP : $opaxTxt" -ForegroundColor $(if ($opaxOK) { 'Green' } else { 'Red' })
Write-Host " █ Gemini : Cloud Shell → source scripts/osvauco-opax-boot.sh → gemini" -ForegroundColor $infoCol
Write-Host $THIN -ForegroundColor $Purple
Write-Host ""
# ============================================================
# BUNN-BLOKK
# ============================================================
Write-Host $LINE -ForegroundColor $bannerCol
if ($allOK) {
Write-Host " █ ▶▶ OSVAUCO / OPAX — ALL SYSTEMS GREEN ◀◀ █" -ForegroundColor Green
} else {
Write-Host " █ ⚠ OSVAUCO / OPAX — PARTIAL — sjekk status over █" -ForegroundColor Yellow
}
Write-Host $LINE -ForegroundColor $bannerCol
Write-Host ""