$ErrorActionPreference = 'Stop' $root = Split-Path -Parent $PSScriptRoot $errors = [System.Collections.Generic.List[string]]::new() $pageCommentPrefix = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('PCEtLSDpobXpnaLnvJblj7fvvJo=')) $pages = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages.json') | ConvertFrom-Json $registeredPaths = @($pages.pages | ForEach-Object { $_.path }) function Test-ExpectedPage { param( [string]$ExpectedPath, [string]$PageId ) $pageFile = Join-Path $root ($expectedPath + '.vue') if ($registeredPaths -notcontains $expectedPath) { $errors.Add("Missing final route: $expectedPath") } if (-not (Test-Path -LiteralPath $pageFile)) { $errors.Add("Missing final page file: $($expectedPath).vue") return } $content = Get-Content -Raw -Encoding UTF8 $pageFile if (-not $content.StartsWith($pageCommentPrefix + $pageId)) { $errors.Add("Missing Chinese page header: $($expectedPath).vue") } } function Test-AssetDirectory { param([string]$AssetDirectory) if (-not (Test-Path -LiteralPath (Join-Path $root $assetDirectory))) { $errors.Add("Missing foundation asset directory: $assetDirectory") } } # P-00 final routes: each file name identifies the page and its design ID. Test-ExpectedPage -ExpectedPath 'pages/auth/a01-entry' -PageId 'A-01' Test-ExpectedPage -ExpectedPath 'pages/auth/a02-login' -PageId 'A-02' Test-ExpectedPage -ExpectedPath 'pages/genealogy/g01-my-genealogies' -PageId 'G-01' Test-ExpectedPage -ExpectedPath 'pages/genealogy/g03-create-genealogy' -PageId 'G-03' Test-ExpectedPage -ExpectedPath 'pages/genealogy/g04-first-ancestor' -PageId 'G-04' Test-ExpectedPage -ExpectedPath 'pages/genealogy/g05-genealogy-overview' -PageId 'G-05' Test-ExpectedPage -ExpectedPath 'pages/genealogy/g06-search-genealogies' -PageId 'G-06' Test-ExpectedPage -ExpectedPath 'pages/genealogy/g10-application-review' -PageId 'G-10' Test-ExpectedPage -ExpectedPath 'pages/tree/t01-tree-overview' -PageId 'T-01' Test-ExpectedPage -ExpectedPath 'pages/tree/t03-member-profile' -PageId 'T-03' Test-ExpectedPage -ExpectedPath 'pages/family/f01-family-feed' -PageId 'F-01' Test-ExpectedPage -ExpectedPath 'pages/family/f02-publish-feed' -PageId 'F-02' Test-ExpectedPage -ExpectedPath 'pages/skeleton/content-list-skeleton' -PageId 'S-01' Test-ExpectedPage -ExpectedPath 'pages/notification/n01-message-center' -PageId 'N-01' Test-ExpectedPage -ExpectedPath 'pages/profile/m01-profile-home' -PageId 'M-01' # Both asset directories are required so opaque bases and transparent overlays stay separate. Test-AssetDirectory -AssetDirectory 'static/assets/foundation/opaque' Test-AssetDirectory -AssetDirectory 'static/assets/foundation/transparent' if ($errors.Count -gt 0) { throw "P-00 foundation structure audit failed:`n$($errors -join "`n")" } Write-Output 'PASS foundation structure audit'