OSVauco/scripts/osv-startup.ps1

85 lines
3.2 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# OSVauco · OPAX — VS Code Windows Startup Script
# Kjøres automatisk via terminal.integrated.profiles.windows i VS Code
# Tilsvarer osvauco-opax-boot.sh men for PowerShell/Windows
$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"
Set-Location $REPO_PATH
Clear-Host
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 " Repo : OSVauco (main)" -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
}
Write-Host ""
} else {
Write-Host " ⚠ Ingen NESTE OPPGAVE funnet — sjekk docs/VAUCO_OS_ROADMAP.md" -ForegroundColor Yellow
Write-Host ""
}
} else {
Write-Host " ⚠ Session log ikke funnet" -ForegroundColor Yellow
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 'files? changed' } | ForEach-Object {
Write-Host " $_" -ForegroundColor Cyan
}
}
} else {
Write-Host " [FAIL]" -ForegroundColor Red
}
} catch {
Write-Host " [FAIL] $_" -ForegroundColor Red
}
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
Write-Host " ⚠ Uventet svar: $response" -ForegroundColor Yellow
}
} catch {
Write-Host " [FAIL]" -ForegroundColor Red
Write-Host " ❌ OPAX-MCP nede — sjekk Cloud Run / DNS" -ForegroundColor Red
}
Write-Host ""
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host " ▶ OSVAUCO/OPAX READY" -ForegroundColor Green
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host ""