# Windows 录制入口（无需 bash/WSL）
# Usage:
#   npm run record:mothership
#   powershell -ExecutionPolicy Bypass -File scripts/record-mothership.ps1
#   powershell -ExecutionPolicy Bypass -File scripts/record-mothership.ps1 -StartUrl "https://..."

param(
    [string]$StartUrl
)

$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent $PSScriptRoot
Push-Location $Root
try {
    if ($StartUrl) {
        npm run record:mothership -- $StartUrl
    }
    else {
        npm run record:mothership
    }
    if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
finally {
    Pop-Location
}
