$ErrorActionPreference = 'Stop' function ConvertFrom-Utf8Base64 { param([string]$Value) return [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($Value)) } function Assert-Contains { param([string]$Content, [string]$Expected, [string]$Message) if ($Content -notmatch [regex]::Escape($Expected)) { throw $Message } } function Assert-NotContains { param([string]$Content, [string]$Unexpected, [string]$Message) if ($Content -match [regex]::Escape($Unexpected)) { throw $Message } } $root = Split-Path -Parent $PSScriptRoot $pagePath = Join-Path $root 'pages/auth/a05-reset-password.vue' $pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json $page = Get-Content -LiteralPath $pagePath -Raw -Encoding utf8 $resetCopy = ConvertFrom-Utf8Base64 '6YeN6K6+5a+G56CB' $confirmPasswordCopy = ConvertFrom-Utf8Base64 '56Gu6K6k5paw5a+G56CB' $getCodeCopy = ConvertFrom-Utf8Base64 '6I635Y+W6aqM6K+B56CB' $loginCopy = ConvertFrom-Utf8Base64 '6L+U5Zue55m75b2V' if (-not ($pages.pages.path -contains 'pages/auth/a05-reset-password')) { throw 'A-05 route must remain declared in pages.json' } Assert-NotContains -Content $page -Unexpected 'ModulePage' -Message 'A-05 must not remain a ModulePage shell' foreach ($required in @( '', 'const submitReset = async () =>', 'const fieldErrors = ref({', 'const successVisible = ref(false)', '', 'title="密码已重设"', 'if (!isAuthPhone(phone.value))', 'if (!/^\d{4}$/.test(verificationCode.value))', '.*?)^\}') if (-not $contentRule.Success) { throw 'A05 reset content rule is missing.' } foreach ($required in @('display: flex;', 'flex: 1;', 'flex-direction: column;', 'max-width: 480px;', 'margin: 0 auto;')) { Assert-Contains -Content $contentRule.Groups['Body'].Value -Expected $required -Message "A05 reset content must use document flow: $required" } $headingRule = [regex]::Match($page, '(?ms)^\.page-heading\s*\{(?.*?)^\}') if (-not $headingRule.Success) { throw 'A05 page heading rule is missing.' } Assert-Contains -Content $headingRule.Groups['Body'].Value -Expected 'grid-template-columns: minmax(0, 1fr);' -Message 'A05 heading must center against the full content width.' foreach ($selector in @('page-title', 'page-subtitle', 'reset-divider')) { $rule = [regex]::Match($page, "(?ms)^\.$selector\s*\{(?.*?)^\}") if (-not $rule.Success) { throw "A05 heading child rule is missing: $selector" } Assert-Contains -Content $rule.Groups['Body'].Value -Expected 'grid-column: 1;' -Message "A05 heading child must remain in the full-width grid column: $selector" } Write-Output 'A05-RESET-PASSWORD-CONTRACT PASS'