MCPcopy
hub / github.com/rpamis/comet / runCodexMode

Function runCodexMode

scripts/context-compression-benchmark.mjs:480–501  ·  view source on GitHub ↗
({ codexCommand, model, cwd, mode })

Source from the content-addressed store, hash-verified

478}
479
480async 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
503export function buildCodexArgs({ cwd, model = null }) {
504 const args = [

Callers 1

runBenchmarkFunction · 0.85

Calls 4

spawnCaptureFunction · 0.90
parseCodexJsonlFunction · 0.90
buildPromptFunction · 0.85
buildCodexArgsFunction · 0.85

Tested by

no test coverage detected