$ErrorActionPreference = 'Stop' function Assert-Contains { param([string]$Content, [string]$Expected, [string]$Message) if ($Content -notmatch [regex]::Escape($Expected)) { throw $Message } } function Assert-NoCssSurface { param([string]$Content, [string]$ClassName) foreach ($property in @('border', 'border-radius')) { if ($Content -match "(?s)\\.$ClassName\\s*\\{[^}]*\\b$property\\s*:") { throw "G11-G12 must not construct .$ClassName with CSS $property" } } } $root = Split-Path -Parent $PSScriptRoot $g11 = Get-Content -LiteralPath (Join-Path $root 'pages/genealogy/g11-genealogy-settings.vue') -Raw -Encoding utf8 $g12 = Get-Content -LiteralPath (Join-Path $root 'pages/genealogy/g12-generation-poems.vue') -Raw -Encoding utf8 $profiles = Get-Content -LiteralPath (Join-Path $root 'styles/adaptive-frame-profiles.scss') -Raw -Encoding utf8 $catalog = Get-Content -LiteralPath (Join-Path $root 'data/page-catalog.js') -Raw -Encoding utf8 foreach ($page in @($g11, $g12)) { if ($page -match '' 'G11-G12 must use the accepted shared genealogy background' Assert-Contains $page 'adaptive.adaptive-genealogy-state-panel' 'G11-G12 forms must reuse the adaptive genealogy paper panel profile' if ($page -match "@/utils/api\.js|\bappApi\b") { throw 'G11-G12 design phase must not connect the API layer' } } foreach ($required in @( 'const settingsState = ref("loading")', 'settings-state--form', 'settings-state--success', 'settings-state--error', 'settings-state--no-permission', 'const nameError = ref', 'class="settings-feedback"', 'adaptive.adaptive-genealogy-form-field', 'a01-scroll-primary-v3.png', 'const genealogyDraft', 'query.genealogyId', '"MEMBER_ONLY"', '"PUBLIC_APPLY"' )) { Assert-Contains $g11 $required "Missing G11 settings contract: $required" } foreach ($required in @( 'const poemState = ref("loading")', 'poem-state--list', 'poem-state--empty', 'poem-state--edit', 'poem-state--error', 'poem-state--no-permission', 'const poemError = ref', 'class="poem-feedback"', 'adaptive.adaptive-genealogy-form-field', 'a01-scroll-primary-v3.png', 'a01-scroll-secondary-v3.png', 'const poemRows', 'stopMissingOldGeneration', 'query.genealogyId' )) { Assert-Contains $g12 $required "Missing G12 generation-poem contract: $required" } foreach ($assetName in @('g01-empty-panel-frame.png', 'g-form-field-frame.png')) { Assert-Contains $profiles $assetName "Adaptive genealogy profile must own: $assetName" } foreach ($page in @($g11, $g12)) { foreach ($nativeUi in @('uni.showToast', 'uni.showModal', 'uni.showLoading', 'uni.showActionSheet')) { if ($page -match [regex]::Escape($nativeUi)) { throw "G11-G12 must not use native UniApp UI: $nativeUi" } } } foreach ($className in @('settings-panel', 'settings-action', 'poem-row', 'poem-editor', 'poem-action')) { foreach ($page in @($g11, $g12)) { Assert-NoCssSurface $page $className } } foreach ($entry in @('g11:', 'g12:')) { if ($catalog -match [regex]::Escape($entry)) { throw "Page catalog must remove migrated generic entry: $entry" } } Write-Output 'G11-G12-SETTINGS-POEMS-CONTRACT PASS'