$ErrorActionPreference = 'Stop' $root = Split-Path -Parent $PSScriptRoot $requiredFiles = @( 'App.vue', 'main.js', 'manifest.json', 'pages.json', 'uni.scss', 'styles/global.scss', 'data/mock.js', 'utils/config.js', 'utils/api.js', 'components/AppTabbar.vue', 'components/PageHeader.vue', 'pages/auth/login.vue', 'pages/genealogy/index.vue', 'pages/genealogy/create.vue', 'pages/genealogy/detail.vue', 'pages/genealogy/search.vue', 'pages/genealogy/applications.vue', 'pages/tree/index.vue', 'pages/member/detail.vue', 'pages/family/index.vue', 'pages/profile/index.vue', 'pages/notification/index.vue', 'static/icons/tab-genealogy.png', 'static/icons/tab-family.png', 'static/icons/tab-profile.png' ) $missing = $requiredFiles | Where-Object { -not (Test-Path (Join-Path $root $_)) } if ($missing) { throw "Missing phase-one files: $($missing -join ', ')" } $pages = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages.json') | ConvertFrom-Json $paths = @($pages.pages | ForEach-Object { $_.path }) $requiredRoutes = @( 'pages/auth/login', 'pages/genealogy/index', 'pages/genealogy/create', 'pages/genealogy/detail', 'pages/genealogy/search', 'pages/genealogy/applications', 'pages/tree/index', 'pages/member/detail', 'pages/family/index', 'pages/profile/index', 'pages/notification/index' ) $missingRoutes = $requiredRoutes | Where-Object { $_ -notin $paths } if ($missingRoutes) { throw "Missing page routes: $($missingRoutes -join ', ')" } $tokens = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'uni.scss') foreach ($token in @('$brand-red:', '$ink:', '$paper:', '$gold:')) { if ($tokens -notmatch [regex]::Escape($token)) { throw "Missing design token: $token" } } Add-Type -AssemblyName System.Drawing foreach ($icon in @('tab-genealogy.png', 'tab-family.png', 'tab-profile.png')) { $bitmap = [System.Drawing.Bitmap]::new((Join-Path $root "static/icons/$icon")) try { if (-not [System.Drawing.Image]::IsAlphaPixelFormat($bitmap.PixelFormat)) { throw "Icon must keep an alpha channel: $icon" } if ($bitmap.GetPixel(0, 0).A -ne 0) { throw "Icon corner must be transparent: $icon" } } finally { $bitmap.Dispose() } } Write-Output 'PASS phase-one Uni-App contract'