Files
ai-contract-platform/scripts/run-phase14-remaining-articles-report.ps1
T

42 lines
1.6 KiB
PowerShell

param(
[string]$Phase14Root = "",
[string]$Phase14ArtifactRoot = "",
[string]$ArtifactRoot = ""
)
$ErrorActionPreference = "Stop"
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
if (-not (Test-Path "$HOME\.Codex\skills\gstack\bin")) {
throw "GSTACK_MISSING: gstack is required for AI-assisted work in this repo."
}
if ([string]::IsNullOrWhiteSpace($Phase14Root)) {
$Phase14Root = Join-Path $repoRoot "project-docs\phase14-legal-fulltext-library"
}
if ([string]::IsNullOrWhiteSpace($Phase14ArtifactRoot)) {
$Phase14ArtifactRoot = Join-Path $repoRoot "project-docs\qa-artifacts\phase14-legal-fulltext-import"
}
if ([string]::IsNullOrWhiteSpace($ArtifactRoot)) {
$ArtifactRoot = Join-Path $repoRoot "project-docs\qa-artifacts\phase14-remaining-articles"
}
$timestamp = Get-Date -Format "yyyy-MM-ddTHH-mm-ss-fff"
$artifactDir = Join-Path $ArtifactRoot $timestamp
New-Item -ItemType Directory -Force -Path $artifactDir | Out-Null
$toolPath = Join-Path $repoRoot "backend\tools\report_phase14_remaining_articles.py"
$toolOutput = & python $toolPath `
--phase14-root $Phase14Root `
--artifact-root $Phase14ArtifactRoot `
--output-dir $artifactDir
$toolExitCode = if ($LASTEXITCODE -is [int]) { $LASTEXITCODE } else { 0 }
($toolOutput -join [Environment]::NewLine) | Set-Content -Encoding UTF8 -Path (Join-Path $artifactDir "phase14-remaining-articles-tool.log")
if ($toolExitCode -ne 0) {
throw "report_phase14_remaining_articles.py failed with exit code $toolExitCode."
}
Write-Host "PHASE14_REMAINING_ARTICLES_REPORT_PASS $artifactDir"
Write-Output ($toolOutput -join [Environment]::NewLine)