Files
jiapuapp/tests/handoff-documentation-contract.ps1
T
2026-07-21 07:53:08 +08:00

52 lines
2.0 KiB
PowerShell

$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 'NiDkuKrmqKHlnZfln7rlh4Y='),
(ConvertFrom-Utf8Base64 'ZG9jcy/lpJzpl7Tmibnph4/mlLbmlZvkuqTmjqVfMjAyNi0wNy0yMC5tZA=='),
'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 10 -or $candidate -ne 42) {
throw "planning counts changed: approved=$approved candidate=$candidate"
}
Write-Output 'HANDOFF-DOCUMENTATION-CONTRACT PASS'