$ErrorActionPreference = 'Stop' $root = Split-Path -Parent $PSScriptRoot $requiredFiles = @('utils/config.js', 'utils/session.js', 'utils/genealogy-context.js', 'utils/api.js', 'pages/genealogy/g03-create-genealogy.vue', 'pages/family/f04-article-list.vue', 'pages/family/f02-publish-feed.vue') foreach ($file in $requiredFiles) { if (-not (Test-Path (Join-Path $root $file))) { throw "Missing core-flow file: $file" } } $config = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'utils/config.js') foreach ($token in @('mode:', 'isMockMode')) { if ($config -notmatch [regex]::Escape($token)) { throw "Missing runtime mode contract: $token" } } $context = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'utils/genealogy-context.js') foreach ($method in @('getCurrentGenealogyId', 'setCurrentGenealogyId', 'clearCurrentGenealogyId')) { if ($context -notmatch [regex]::Escape($method)) { throw "Missing genealogy context method: $method" } } $api = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'utils/api.js') foreach ($method in @('unwrapResponse', 'sendSmsCode', 'loginWithPassword', 'loginWithSms')) { if ($api -notmatch [regex]::Escape($method)) { throw "Missing auth API method: $method" } } foreach ($method in @('createPerson', 'getPerson')) { if ($api -notmatch [regex]::Escape($method)) { throw "Missing lineage API method: $method" } } foreach ($method in @('getArticles', 'getAlbums', 'getCeremonies', 'getGrowthRecords', 'createFeed')) { if ($api -notmatch [regex]::Escape($method)) { throw "Missing family content API method: $method" } } if ($api -notmatch 'getProfile') { throw 'Missing current-user profile API method' } $pages = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages.json') if ($pages -notmatch 'pages/genealogy/g03-create-genealogy') { throw 'Missing G03 create-flow route' } if ($pages -match 'pages/genealogy/g04-first-ancestor') { throw 'G04 first-person route must be merged into G03' } $createFlow = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/genealogy/g03-create-genealogy.vue') foreach ($token in @('step=ancestor', 'createPerson', 'genealogyContext')) { if ($createFlow -notmatch [regex]::Escape($token)) { throw "Missing G03 first-person flow: $token" } } foreach ($route in @('pages/family/f04-article-list', 'pages/family/f02-publish-feed')) { if ($pages -notmatch [regex]::Escape($route)) { throw "Missing content page route: $route" } } foreach ($pageFile in @('pages/genealogy/g05-genealogy-overview.vue', 'pages/tree/t01-tree-overview.vue', 'pages/tree/t03-member-profile.vue')) { $page = Get-Content -Raw -Encoding UTF8 (Join-Path $root $pageFile) if ($page -match "id=1001|id=3") { throw "Hard-coded route ID remains in $pageFile" } if ($page -notmatch 'genealogyContext') { throw "Missing genealogy context in $pageFile" } } foreach ($method in @('markNotificationRead', 'markAllNotificationsRead')) { if ($api -notmatch [regex]::Escape($method)) { throw "Missing notification API method: $method" } } foreach ($pageFile in @('pages/genealogy/g10-application-review.vue', 'pages/notification/n01-message-center.vue')) { $page = Get-Content -Raw -Encoding UTF8 (Join-Path $root $pageFile) if ($page -match '1001') { throw "Hard-coded genealogy ID remains in $pageFile" } } $applications = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/genealogy/g10-application-review.vue') if ($applications -notmatch 'genealogyContext') { throw 'Missing genealogy context in applications page' } $notifications = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/notification/n01-message-center.vue') foreach ($method in @('markNotificationRead', 'markAllNotificationsRead')) { if ($notifications -notmatch [regex]::Escape($method)) { throw "Notification page does not use $method" } } $family = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/family/f01-family-feed.vue') foreach ($token in @('genealogyContext', 'openSection', 'pages/family/f04-article-list', 'pages/family/f07-album-list', 'pages/records/r05-ritual-list', 'pages/records/r10-memo-list', 'pages/family/f02-publish-feed')) { if ($family -notmatch [regex]::Escape($token)) { throw "Missing family content flow: $token" } } $profile = Get-Content -Raw -Encoding UTF8 (Join-Path $root 'pages/profile/m01-profile-home.vue') foreach ($token in @('appApi', 'getProfile', 'profile.name')) { if ($profile -notmatch [regex]::Escape($token)) { throw "Missing dynamic profile behavior: $token" } } Write-Output 'PASS core-flow session and auth contract'