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,32 +1,33 @@
# OSVauco · OPAX — VS Code Windows Startup Script # OSVauco · OPAX — VS Code Windows Startup Script
# Kjøres via settings.json: # settings.json: "args": ["-NoExit", "-File", "G:\\Shared drives\\OS-VAUCO-DRIVE\\OSVauco\\scripts\\osv-startup.ps1"]
# "args": ["-NoExit", "-File", "G:\\Shared drives\\OS-VAUCO-DRIVE\\OSVauco\\scripts\\osv-startup.ps1"]
$REPO_PATH = "G:\Shared drives\OS-VAUCO-DRIVE\OSVauco" $REPO_PATH = "G:\Shared drives\OS-VAUCO-DRIVE\OSVauco"
$PING_URL = "https://opax.vauco.no/ping" $PING_URL = "https://opax.vauco.no/ping"
$LOG_FILE = "$REPO_PATH\docs\OSVAUCO_OPAX_SESSION_LOG.md" $LOG_FILE = "$REPO_PATH\docs\OSVAUCO_OPAX_SESSION_LOG.md"
$PROJECT = "propane-will-491900-m5" $PROJECT = "propane-will-491900-m5"
$REGION = "us-central1" $REGION = "us-central1"
$MODEL = "gemini-2.5-pro" $MODEL = "gemini-2.5-pro"
$MCP_NAME = "OPAX-MCP" $MCP_NAME = "OPAX-MCP"
$PROTOCOL = "OPAX Protocol" $PROTOCOL = "OPAX Protocol"
$LINE = " " + ("" * 54)
$THIN = " " + ("" * 54)
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$env:PYTHONUTF8 = "1"
Set-Location $REPO_PATH Set-Location $REPO_PATH
Clear-Host Clear-Host
$gcOK = $false $gcOK = $false
$adcOK = $false $adcOK = $false
$opaxOK = $false $opaxOK = $false
$gitOK = $false
# ============================================================ # ---- GIT PULL -----------------------------------------------
# 1) GIT PULL (stille, før banner)
# ============================================================
$gitOut = git pull 2>&1 $gitOut = git pull 2>&1
$gitOK = ($LASTEXITCODE -eq 0) $gitOK = ($LASTEXITCODE -eq 0)
# ============================================================ # ---- GCP SDK ------------------------------------------------
# 2) GCP SDK + ADC (stille)
# ============================================================
try { try {
$gcAccount = gcloud auth list --filter=status:ACTIVE --format="value(account)" 2>$null $gcAccount = gcloud auth list --filter=status:ACTIVE --format="value(account)" 2>$null
if ($gcAccount) { if ($gcAccount) {
@ -36,112 +37,121 @@ try {
} }
} catch {} } catch {}
# ---- ADC ----------------------------------------------------
try { try {
$adcToken = gcloud auth application-default print-access-token 2>$null $adcToken = gcloud auth application-default print-access-token 2>$null
if ($adcToken) { $adcOK = $true } if ($adcToken) { $adcOK = $true }
} catch {} } catch {}
# ============================================================ # ---- OPAX PING ----------------------------------------------
# 3) OPAX PING (stille)
# ============================================================
try { try {
$response = Invoke-RestMethod -Uri $PING_URL -TimeoutSec 5 $r = Invoke-RestMethod -Uri $PING_URL -TimeoutSec 5
if ($response.status -eq 'ok') { $opaxOK = $true } if ($r.status -eq 'ok') { $opaxOK = $true }
} catch {} } catch {}
# ============================================================ # ---- FARGE-LOGIKK -------------------------------------------
# 4) BESTEM GLOW-FARGE $allOK = $gitOK -and $opaxOK -and $gcOK
# ============================================================ $bannerCol = if ($allOK) { 'Green' } else { 'Yellow' }
$allOK = $gitOK -and $opaxOK $infoCol = if ($allOK) { 'Green' } else { 'Gray' }
$bannerColor = if ($allOK) { 'Green' } else { 'Yellow' } $Purple = 'Magenta'
$glowChar = if ($allOK) { '█' } else { '□' }
# ============================================================ # ============================================================
# 5) BANNER # TOPP-BLOKK
# ============================================================ # ============================================================
Write-Host "" 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 $LINE -ForegroundColor $bannerCol
Write-Host "" Write-Host " █ █" -ForegroundColor $bannerCol
Write-Host " O S V A U C O · O P A X" -ForegroundColor $bannerColor Write-Host " █ O S V A U C O · O P A X █" -ForegroundColor $bannerCol
Write-Host "" Write-Host " █ VS Code · Windows · PowerShell █" -ForegroundColor $bannerCol
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 " █ █" -ForegroundColor $bannerCol
Write-Host "" Write-Host $LINE -ForegroundColor $bannerCol
# 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 "" 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) { 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## |$)') $match = [regex]::Match($logContent, '(?s)## NESTE OPPGAVE\r?\n(.*?)(?=\r?\n## |$)')
if ($match.Success) { if ($match.Success) {
Write-Host " ▶ NESTE OPPGAVE:" -ForegroundColor $bannerColor
$match.Groups[1].Value.Trim() -split "`n" | ForEach-Object { $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 { try {
$env:GIT_TERMINAL_PROMPT = "0"
$gitLog = git -C $REPO_PATH log -4 --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) { if ($gitLog) {
$gitLog -split "`n" | ForEach-Object { $gitLog -split "`n" | ForEach-Object {
Write-Host " $_" -ForegroundColor DarkGreen Write-Host " $_" -ForegroundColor DarkGreen
} }
} else {
Write-Host " █ (ingen nylige endringer)" -ForegroundColor DarkGray
} }
} catch {} } catch {
Write-Host "" Write-Host " █ (git ikke tilgjengelig)" -ForegroundColor DarkGray
# ============================================================
# 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
} }
Write-Host $THIN -ForegroundColor $Purple
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 ""
# ============================================================
# 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 "" Write-Host ""