$ErrorActionPreference = "Stop" $root = Split-Path -Parent $PSScriptRoot $dataDir = Join-Path $root "data" $envPath = Join-Path $root ".env" New-Item -ItemType Directory -Force -Path $dataDir | Out-Null $secureKey = Read-Host "Together API key" -AsSecureString $bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureKey) try { $plainKey = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr) } finally { [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($bstr) } if ([string]::IsNullOrWhiteSpace($plainKey)) { throw "Together API key cannot be empty." } @( "# Local development secrets for AI Time Machine." "# This file is ignored by git via data/*." "TIME_MACHINE_ADAPTER_PROFILE=dev" "TIME_MACHINE_LLM_API_KEY=$plainKey" "TIME_MACHINE_LLM_MODEL=Qwen/Qwen2.5-7B-Instruct-Turbo" ) | Set-Content -Path $envPath -Encoding UTF8 Write-Host "Wrote $envPath" Write-Host "Next: .\.venv\Scripts\python.exe scripts\walk_smoke.py"