# One-time setup for Windows. # # Creates an isolated virtual environment INSIDE this project folder # (.venv\) and installs the pipeline's dependencies into it. This never # touches your system Python, any other project's packages, or anything # outside this folder — deleting the project folder removes everything # this script installed (except Gitleaks, which is a separate one-time # system tool; see the message at the end). $ErrorActionPreference = "Stop" $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $ProjectDir = Split-Path -Parent $ScriptDir Set-Location $ProjectDir $pythonCmd = Get-Command python -ErrorAction SilentlyContinue if (-not $pythonCmd) { Write-Host "ERROR: python not found on PATH. Install Python 3.10+ from https://www.python.org/downloads/ (check 'Add python.exe to PATH' during install)." exit 1 } Write-Host "Using $(python --version)" if (-not (Test-Path ".venv")) { Write-Host "Creating isolated virtual environment in .venv\ ..." python -m venv .venv } else { Write-Host ".venv\ already exists — reusing it." } & .\.venv\Scripts\Activate.ps1 Write-Host "Installing dependencies into .venv\ (this does not touch system Python) ..." pip install --quiet --upgrade pip pip install --quiet -r requirements.txt if (-not (Test-Path ".env")) { Copy-Item ".env.example" ".env" Write-Host "Created .env from .env.example — edit it and fill in NIM_API_KEY, NIM_BASE_URL, NIM_MODEL." } else { Write-Host ".env already exists — leaving it alone." } Write-Host "" Write-Host "Checking for Gitleaks (required unless you deliberately set ALLOW_MISSING_GITLEAKS=1) ..." $gitleaksCmd = Get-Command gitleaks -ErrorAction SilentlyContinue if ($gitleaksCmd) { Write-Host " Found: $(gitleaks version)" } else { Write-Host " NOT found. Install it (one-time, system-level, like installing any CLI tool):" Write-Host " winget install gitleaks" Write-Host " (or see https://github.com/gitleaks/gitleaks#installing)" Write-Host " Until it's installed, real runs will refuse to start (fails closed by design)." } Write-Host "" Write-Host "Setup complete." Write-Host "Next: edit .env with your NIM credentials, then run scripts\run_daily.ps1"