173 lines
7.1 KiB
PowerShell
173 lines
7.1 KiB
PowerShell
# 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:
|
||
# "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"
|
||
$LOG_FILE = "$REPO_PATH\docs\OSVAUCO_OPAX_SESSION_LOG.md"
|
||
$PROJECT = "propane-will-491900-m5"
|
||
$REGION = "us-central1"
|
||
$MODEL = "gemini-2.5-pro"
|
||
$MCP_NAME = "OPAX-MCP"
|
||
$PROTOCOL = "OPAX Protocol"
|
||
|
||
Set-Location $REPO_PATH
|
||
Clear-Host
|
||
|
||
# ============================================================
|
||
# 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 ""
|
||
|
||
# ============================================================
|
||
# NESTE OPPGAVE fra session log
|
||
# ============================================================
|
||
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
|
||
$match.Groups[1].Value.Trim() -split "`n" | ForEach-Object {
|
||
Write-Host " $_" -ForegroundColor Green
|
||
}
|
||
} 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 ""
|
||
|
||
# ============================================================
|
||
# SISTE DOCS-ENDRINGER (git log)
|
||
# ============================================================
|
||
Write-Host " › Siste endringer i docs/:" -ForegroundColor Blue
|
||
try {
|
||
$gitLog = git -C $REPO_PATH log -5 --pretty=format:"%h %cd %s" --date=short -- docs 2>&1
|
||
if ($gitLog) {
|
||
$gitLog -split "`n" | ForEach-Object {
|
||
Write-Host " $_" -ForegroundColor DarkCyan
|
||
}
|
||
} else {
|
||
Write-Host " (ingen nylige docs-endringer)" -ForegroundColor DarkGray
|
||
}
|
||
} catch {
|
||
Write-Host " (git ikke tilgjengelig)" -ForegroundColor DarkGray
|
||
}
|
||
Write-Host ""
|
||
|
||
# ============================================================
|
||
# GIT PULL
|
||
# ============================================================
|
||
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
|
||
}
|
||
Write-Host ""
|
||
|
||
# ============================================================
|
||
# GCLOUD ADC / SDK SJEKK
|
||
# ============================================================
|
||
Write-Host " › GCP SDK + ADC status:" -ForegroundColor Blue
|
||
$gcOK = $false
|
||
$adcOK = $false
|
||
|
||
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
|
||
} 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 "============================================================" -ForegroundColor Cyan
|
||
Write-Host ""
|