({ codexCommand, model, cwd, mode })
| 478 | } |
| 479 | |
| 480 | async function runCodexMode({ codexCommand, model, cwd, mode }) { |
| 481 | const contextFile = |
| 482 | mode === 'beta' |
| 483 | ? `openspec/changes/${CHANGE_NAME}/.comet/handoff/spec-context.md` |
| 484 | : `openspec/changes/${CHANGE_NAME}/.comet/handoff/design-context.md`; |
| 485 | const contextText = await fs.readFile(path.join(cwd, contextFile), 'utf-8'); |
| 486 | const prompt = buildPrompt(mode, contextFile, contextText); |
| 487 | const args = buildCodexArgs({ cwd, model }); |
| 488 | const { stdout, stderr, exitCode } = await spawnCapture(codexCommand, args, { |
| 489 | cwd, |
| 490 | input: prompt, |
| 491 | timeoutMs: 15 * 60 * 1000, |
| 492 | }); |
| 493 | const parsed = parseCodexJsonl(stdout); |
| 494 | return { |
| 495 | usage: parsed.usage, |
| 496 | verdict: parsed.verdict, |
| 497 | stdout, |
| 498 | stderr, |
| 499 | exitCode, |
| 500 | }; |
| 501 | } |
| 502 | |
| 503 | export function buildCodexArgs({ cwd, model = null }) { |
| 504 | const args = [ |
no test coverage detected