[CmdletBinding()] param([string]$DatabasePath) $ErrorActionPreference = "Stop" $projectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path if (-not $DatabasePath) { $DatabasePath = Join-Path $projectRoot "state\scheduling-ledger.sqlite3" } $pythonCommand = Get-Command python -ErrorAction SilentlyContinue if (-not $pythonCommand) { throw "Python 3.11 or newer must be available on PATH." } $env:PYTHONPATH = Join-Path $projectRoot "src" $env:SCHEDULING_DB = $DatabasePath try { & $pythonCommand.Source -m scheduling_core.api } finally { Remove-Item Env:\PYTHONPATH,Env:\SCHEDULING_DB -ErrorAction SilentlyContinue }