()
| 624 | } |
| 625 | |
| 626 | function findCodexCLI() { |
| 627 | if (_codexCmd !== undefined) return _codexCmd; |
| 628 | |
| 629 | const candidates = [CODEX_BIN, 'codex', 'codex.exe'].filter(Boolean); |
| 630 | for (const cmd of candidates) { |
| 631 | try { |
| 632 | execFileSync(cmd, ['--version'], { stdio: 'pipe', timeout: 5000 }); |
| 633 | _codexCmd = cmd; |
| 634 | return cmd; |
| 635 | } catch { /* not found */ } |
| 636 | } |
| 637 | _codexCmd = null; |
| 638 | return null; |
| 639 | } |
| 640 | |
| 641 | // ── Scenario execution ──────────────────────────────────────────────────────── |
| 642 |