Files
ableton-mcp-ai/AbletonMCP_AI_BAK_20260328_200801/automation/invoke_codex_review.ps1
renato97 6ec8663954 Initial commit: AbletonMCP-AI complete system
- MCP Server with audio fallback, sample management
- Song generator with bus routing
- Reference listener and audio resampler
- Vector-based sample search
- Master chain with limiter and calibration
- Fix: Audio fallback now works without M4L
- Fix: Full song detection in sample loader

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 22:53:10 -03:00

95 lines
2.5 KiB
PowerShell

param(
[Parameter(Mandatory = $true)]
[string]$TaskFile,
[Parameter(Mandatory = $true)]
[string]$ReportFile,
[Parameter(Mandatory = $true)]
[string]$ProjectRoot,
[Parameter(Mandatory = $true)]
[string]$OutputFile,
[string]$CodexModel = ""
)
$ErrorActionPreference = "Stop"
function Resolve-CodexCommand() {
$cmd = Get-Command "codex.cmd" -ErrorAction SilentlyContinue
if ($cmd) {
return $cmd.Source
}
$fallback = Get-Command "codex" -ErrorAction SilentlyContinue
if ($fallback) {
return $fallback.Source
}
throw "Command not found: codex"
}
$taskPath = (Resolve-Path -LiteralPath $TaskFile).Path
$reportPath = (Resolve-Path -LiteralPath $ReportFile).Path
$projectPath = (Resolve-Path -LiteralPath $ProjectRoot).Path
$outputPath = [System.IO.Path]::GetFullPath($OutputFile)
$codexCommand = Resolve-CodexCommand
$reviewPrompt = @"
Read this worker task file:
$taskPath
Read this GLM report:
$reportPath
Your job:
1. Inspect the real diff in the repository.
2. Verify whether GLM actually implemented what the report claims.
3. Fix anything incorrect, incomplete, or unsafe.
4. Run the relevant validations mentioned by the task/report.
5. Leave the repository in the best corrected state you can reach in one pass.
6. Write a concise final summary to the output file configured by the CLI.
Be strict about overclaims. The code is the source of truth, not the report.
"@
$codexArgs = @(
"exec",
"--dangerously-bypass-approvals-and-sandbox",
"-C", $projectPath,
"-o", $outputPath
)
if (-not [string]::IsNullOrWhiteSpace($CodexModel)) {
$codexArgs += @("-m", $CodexModel)
}
$codexArgs += $reviewPrompt
$stdoutPath = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($outputPath), "codex_review_stdout.tmp.txt")
$stderrPath = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($outputPath), "codex_review_stderr.tmp.txt")
if (Test-Path -LiteralPath $stdoutPath) { Remove-Item -LiteralPath $stdoutPath -Force }
if (Test-Path -LiteralPath $stderrPath) { Remove-Item -LiteralPath $stderrPath -Force }
Push-Location $projectPath
try {
& $codexCommand @codexArgs 1> $stdoutPath 2> $stderrPath
$exitCode = $LASTEXITCODE
}
finally {
Pop-Location
}
if (Test-Path -LiteralPath $stdoutPath) {
Get-Content -LiteralPath $stdoutPath
}
if (Test-Path -LiteralPath $stderrPath) {
Get-Content -LiteralPath $stderrPath
}
if ($exitCode -ne 0) {
throw "Codex exited with code $exitCode"
}