| # Stage a clean HF Space upload (excludes node_modules, .env, gateway-src) | |
| $ErrorActionPreference = "Stop" | |
| $Root = Split-Path -Parent $PSScriptRoot | |
| $Stage = Join-Path $env:TEMP "src-hf-upload" | |
| if (Test-Path $Stage) { Remove-Item $Stage -Recurse -Force } | |
| New-Item -ItemType Directory -Path $Stage | Out-Null | |
| $Include = @( | |
| "symbolic_recursion", | |
| "huggingface", | |
| "tests", | |
| "scripts", | |
| "atlas-src", | |
| "config.env.example", | |
| "pyproject.toml", | |
| "requirements.txt", | |
| "README.md", | |
| "start_system.ps1", | |
| ".gitignore", | |
| ".hfignore" | |
| ) | |
| foreach ($item in $Include) { | |
| $src = Join-Path $Root $item | |
| if (Test-Path $src) { | |
| Copy-Item $src (Join-Path $Stage $item) -Recurse -Force | |
| } | |
| } | |
| # Vendor PrimalLang interpreter (required on HF Space) | |
| $PlSrc = "C:\Users\stlta\primal-lang-evolution\sources\local-downloads\extracted\primallang_v3\primallang_v3" | |
| $PlDst = Join-Path $Stage "vendor\primallang_v3" | |
| if (Test-Path $PlSrc) { | |
| New-Item -ItemType Directory -Path (Split-Path $PlDst) -Force | Out-Null | |
| Copy-Item $PlSrc $PlDst -Recurse -Force | |
| Write-Host "Vendored PrimalLang -> vendor/primallang_v3" | |
| } | |
| # Strip __pycache__ | |
| Get-ChildItem $Stage -Recurse -Directory -Filter "__pycache__" | Remove-Item -Recurse -Force | |
| Write-Host "Staged at: $Stage" | |
| Write-Output $Stage |