$ErrorActionPreference = "Stop" $ScriptPath = Join-Path $PSScriptRoot "open-readest-latest.ps1" $ScriptText = Get-Content -LiteralPath $ScriptPath -Raw function Assert-Match { param( [string]$Pattern, [string]$Message ) if ($ScriptText -notmatch $Pattern) { throw $Message } } Assert-Match '\[string\]\$Remote\s*=\s*"akai-tools"' "Launcher must pull from akai-tools by default." Assert-Match '\[switch\]\$Desktop' "Launcher must expose an explicit desktop mode." Assert-Match 'if\s*\(\$Desktop\)[\s\S]*tauri[\s\S]*else[\s\S]*dev-web' "Launcher must default to dev-web while preserving Tauri." Assert-Match '\$requiredCommands\s*=\s*@\("git",\s*"pnpm"\)' "Web mode must not require Cargo." Assert-Match 'submodule\.fetchJobs=1' "Launcher must initialize missing submodules conservatively." Assert-Match 'status\s+--porcelain\s+--untracked-files=no\s+--ignore-submodules=dirty' "Clean check must ignore runtime logs and dirty submodule contents." Assert-Match 'Get-NetTCPConnection[^\r\n]*-LocalPort\s+3000' "Launcher must inspect the Tauri dev port before starting." Assert-Match 'Stop-Process[^\r\n]*-Id\s+\$ownerPid' "Launcher must stop an old Readest/Next process that owns port 3000." Assert-Match 'Port 3000 is occupied' "Launcher must report an actionable error for an unrelated port owner." Assert-Match 'Port 3000 is still occupied' "Launcher must wait for the previous dev server to release the port." Write-Host "open-readest-latest launcher checks passed."