$ErrorActionPreference = 'Stop' function ConvertFrom-Utf8Base64 { param([string]$Value) return [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($Value)) } $root = Split-Path -Parent $PSScriptRoot $handoffPath = ConvertFrom-Utf8Base64 'ZG9jcy/kuqTmjqXorrDlvZUubWQ=' $manualPath = ConvertFrom-Utf8Base64 'ZG9jcy9kZXNpZ24v6KeG6KeJ6K6+6K6h5Lqk5o6l5omL5YaMLm1k' $planningPath = ConvertFrom-Utf8Base64 'ZG9jcy/pqozmlLbop4TliJIubWQ=' $handoff = Get-Content -Raw -Encoding UTF8 (Join-Path $root $handoffPath) $manual = Get-Content -Raw -Encoding UTF8 (Join-Path $root $manualPath) $planning = Get-Content -Raw -Encoding UTF8 (Join-Path $root $planningPath) foreach ($required in @( (ConvertFrom-Utf8Base64 'NTIg5p2h5rS75Yqo6Lev55Sx'), (ConvertFrom-Utf8Base64 'NTIg5Liq5b6F5a6h5qC4'), (ConvertFrom-Utf8Base64 'MCDkuKrlt7LpqozmlLY='), 'product-design:index', 'product-design:audit', 'imagegen', 'superpowers:test-driven-development', 'superpowers:systematic-debugging', 'superpowers:verification-before-completion', (ConvertFrom-Utf8Base64 'ZG9jcy9kZXNpZ24v6KeG6KeJ6K+B5o2u57Si5byVLm1k') )) { if ($handoff -notmatch [regex]::Escape($required)) { throw "handoff missing: $required" } } foreach ($encodedStale in @( '5YWt5Liq5bey6aqM5pS2', '57uT5p6c5oCB5ZKM5peg57uT5p6c5oCB55qE5ZCM54mI6YeN5paw5oiq5Zu+5bCa5pyq5a6M5oiQ', '57uT5p6c5oCBL+aXoOe7k+aenOaAgeeahOWQjOeJiOaIquWbvuWSjOeUqOaIt+Wuoee+juehruiupOWwmuacquWujOaIkA==', '5LiL5LiA6aG55oyJIEbjgIFS44CBTuOAgU0g5o6o6L+b' )) { $stale = ConvertFrom-Utf8Base64 $encodedStale if (($handoff + $manual) -match [regex]::Escape($stale)) { throw "stale handoff text remains: $stale" } } $approved = ([regex]::Matches($planning, '\|\s*`\[x\]`[^|]*\|\s*\d+\s*\|')).Count $candidate = ([regex]::Matches($planning, '\|\s*`\[~\]`[^|]*\|\s*\d+\s*\|')).Count if ($approved -ne 0 -or $candidate -ne 52) { throw "planning counts changed: approved=$approved candidate=$candidate" } Write-Output 'HANDOFF-DOCUMENTATION-CONTRACT PASS'