33 lines
1.3 KiB
PowerShell
33 lines
1.3 KiB
PowerShell
param(
|
|||
|
|
[string]$PythonExecutable = ""
|
||
|
|
)
|
||
|
|
|
||
|
|
$ErrorActionPreference = "Stop"
|
||
|
|
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||
|
|
$insightsHubRoot = (Resolve-Path (Join-Path $scriptDirectory "..")).Path
|
||
|
|
$pipeline = Join-Path $scriptDirectory "future_map_pipeline.py"
|
||
|
|
$runtimeDirectory = Join-Path $insightsHubRoot "runtime"
|
||
|
|
$logDirectory = Join-Path $runtimeDirectory "logs"
|
||
|
|
$logFile = Join-Path $logDirectory ("future-map-insights-hub-" + (Get-Date -Format "yyyy-MM-dd") + ".log")
|
||
|
|
|
||
|
|
if (-not $PythonExecutable) {
|
||
|
|
$pythonCommand = Get-Command python -ErrorAction Stop
|
||
|
|
$PythonExecutable = $pythonCommand.Source
|
||
|
|
}
|
||
|
|
|
||
|
|
New-Item -ItemType Directory -Path $logDirectory -Force | Out-Null
|
||
|
|
|
||
|
|
$started = Get-Date -Format "yyyy-MM-dd HH:mm:ss zzz"
|
||
|
|
"[$started] Starting deterministic Future Map Insights Hub preparation." | Set-Content -LiteralPath $logFile -Encoding utf8
|
||
|
|
|
||
|
|
$pipelineOutput = & $PythonExecutable $pipeline sync 2>&1
|
||
|
|
$exitCode = $LASTEXITCODE
|
||
|
|
$pipelineOutput | Add-Content -LiteralPath $logFile -Encoding utf8
|
||
|
|
|
||
|
|
$finished = Get-Date -Format "yyyy-MM-dd HH:mm:ss zzz"
|
||
|
|
"[$finished] Finished with exit code $exitCode. AI reasoning remains a separate skill-driven step." | Add-Content -LiteralPath $logFile -Encoding utf8
|
||
|
|
|
||
|
|
if ($exitCode -ne 0) {
|
||
|
|
throw "Future Map Insights Hub preparation failed with exit code $exitCode. See $logFile"
|
||
|
|
}
|
||
|
|
|