param( [string]$DriveRoot = (Resolve-Path "$PSScriptRoot\..\..").Path, [string]$ManifestPath = "manifest\gguf-downloads.json" ) $ErrorActionPreference = 'Stop' Set-Location $DriveRoot $full = Join-Path $DriveRoot $ManifestPath if (!(Test-Path $full)) { throw "Missing $ManifestPath. Create it from manifest\gguf-downloads.example.json." } $m = Get-Content $full -Raw | ConvertFrom-Json New-Item -ItemType Directory -Force -Path "$DriveRoot\models\gguf" | Out-Null foreach ($item in $m.files) { $out = Join-Path $DriveRoot $item.path New-Item -ItemType Directory -Force -Path (Split-Path $out -Parent) | Out-Null Write-Host "Downloading $($item.name)" Invoke-WebRequest -Uri $item.url -OutFile $out if ($item.sha256) { $h = (Get-FileHash $out -Algorithm SHA256).Hash.ToLowerInvariant() if ($h -ne $item.sha256.ToLowerInvariant()) { throw "SHA256 mismatch for $($item.name)" } } }