# Creates blueprint-source.zip (no node_modules/dist) for exact reproduction or sharing.
$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
if (Test-Path "$PSScriptRoot\..\backend\package.json") {
  $root = Resolve-Path "$PSScriptRoot\.."
}

$out = Join-Path $root "blueprint-source.zip"
$temp = Join-Path $env:TEMP "blueprint-pack-$(Get-Random)"

New-Item -ItemType Directory -Path $temp | Out-Null
robocopy $root $temp /E /XD node_modules dist .git /XF *.zip package-lock.json | Out-Null

if (Test-Path $out) { Remove-Item $out -Force }
Compress-Archive -Path "$temp\*" -DestinationPath $out -Force
Remove-Item $temp -Recurse -Force

Write-Host "Created: $out"
Write-Host "Give another AI: unzip and run npm install in backend + frontend, copy .env.example files to .env"
