2026-08-12 16:41:20 -06:00
param (
[ string ] $PythonExecutable = ""
)
$ErrorActionPreference = "Stop"
$scriptDirectory = Split-Path -Parent $MyInvocation . MyCommand . Path
$insightsHubRoot = ( Resolve-Path ( Join-Path $scriptDirectory ".." )). Path
2026-08-24 12:22:24 -06:00
$copyScript = Join-Path $scriptDirectory "copy_future_map_tagged_files.py"
2026-08-12 16:41:20 -06:00
$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"
2026-08-24 12:22:24 -06:00
"[ $started ] Starting exact-tag Future Map intake copy." | Set-Content -LiteralPath $logFile -Encoding utf8
2026-08-12 16:41:20 -06:00
2026-08-24 12:22:24 -06:00
$pipelineOutput = & $PythonExecutable $copyScript 2 >& 1
2026-08-12 16:41:20 -06:00
$exitCode = $LASTEXITCODE
$pipelineOutput | Add-Content -LiteralPath $logFile -Encoding utf8
$finished = Get-Date -Format "yyyy-MM-dd HH:mm:ss zzz"
2026-08-24 12:22:24 -06:00
"[ $finished ] Finished exact-tag intake copy with exit code $exitCode . Public transformation and AI reasoning remain separate steps." | Add-Content -LiteralPath $logFile -Encoding utf8
2026-08-12 16:41:20 -06:00
if ( $exitCode -ne 0 ) {
2026-08-24 12:22:24 -06:00
throw "Future Map exact-tag intake copy failed with exit code $exitCode . See $logFile "
2026-08-12 16:41:20 -06:00
}