Skip to content

Commit fe4aff4

Browse files
committed
refactor: enhance output handling in runCodex
1 parent cfc9c9d commit fe4aff4

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

src/client/codex.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ function buildCliArgs(
2121
images: string[],
2222
): string[] {
2323
const imageArgs = images.flatMap((img) => ['-i', img]);
24-
return [
25-
...imageArgs,
26-
'--model',
27-
model,
28-
'exec',
29-
'--yolo',
30-
prompt,
31-
];
24+
return [...imageArgs, '--model', model, 'exec', '--yolo', prompt];
3225
}
3326

3427
/**
@@ -95,13 +88,17 @@ export async function runCodex(
9588

9689
try {
9790
core.info('Logging into Codex CLI with provided OpenAI API key.');
98-
await execa('sh', ['-c', 'printenv OPENAI_API_KEY | codex login --with-api-key'], {
99-
timeout,
100-
cwd: workspace,
101-
env: envVars,
102-
stdio: 'pipe',
103-
reject: false,
104-
});
91+
await execa(
92+
'sh',
93+
['-c', 'printenv OPENAI_API_KEY | codex login --with-api-key'],
94+
{
95+
timeout,
96+
cwd: workspace,
97+
env: envVars,
98+
stdio: 'pipe',
99+
reject: false,
100+
},
101+
);
105102

106103
core.info(`Run command: codex ${cliArgs.join(' ')}`);
107104
const result = await execa('codex', cliArgs, {
@@ -142,7 +139,7 @@ export async function runCodex(
142139

143140
core.info('Codex command executed successfully.');
144141

145-
return extractCodexOutput(result.stdout);
142+
return result.stdout; // Return full stdout for flexibility
146143
} catch (error: unknown) {
147144
core.error(
148145
`Error executing Codex command: ${

0 commit comments

Comments
 (0)