Skip to content

Commit fe8d257

Browse files
committed
Remove --print mode to allow Claude file editing
Replace --print mode with interactive mode using stdio inheritance. This allows Claude to use file editing tools when fixing CI failures detected early during workflow execution.
1 parent 1217beb commit fe8d257

File tree

1 file changed

+46
-22
lines changed

1 file changed

+46
-22
lines changed

scripts/claude.mjs

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,19 +3308,30 @@ Fix all CI failures now by making the necessary changes.`
33083308
}, 10_000)
33093309

33103310
try {
3311-
// Use --print flag to run Claude in non-interactive mode
3312-
// This avoids stdin raw mode issues (Ink requires TTY for raw mode)
3313-
const printArgs = ['--print', ...prepareClaudeArgs([], opts)]
3314-
const result = await runCommandWithOutput(claudeCmd, printArgs, {
3315-
cwd: rootPath,
3316-
input: fixPrompt,
3317-
stdio: ['pipe', 'pipe', 'pipe'],
3318-
})
3319-
if (result.exitCode !== 0) {
3320-
log.warn(`Claude fix exited with code ${result.exitCode}`)
3321-
if (result.stderr) {
3322-
log.warn(`Claude stderr: ${result.stderr.slice(0, 500)}`)
3311+
const fixArgs = prepareClaudeArgs([], opts)
3312+
const exitCode = await new Promise((resolve, _reject) => {
3313+
const child = spawn(claudeCmd, fixArgs, {
3314+
stdio: ['pipe', 'inherit', 'inherit'],
3315+
cwd: rootPath,
3316+
...(WIN32 && { shell: true }),
3317+
})
3318+
3319+
// Write the fix prompt to stdin
3320+
if (fixPrompt) {
3321+
child.stdin.write(fixPrompt)
3322+
child.stdin.end()
33233323
}
3324+
3325+
child.on('exit', code => {
3326+
resolve(code || 0)
3327+
})
3328+
3329+
child.on('error', () => {
3330+
resolve(1)
3331+
})
3332+
})
3333+
if (exitCode !== 0) {
3334+
log.warn(`Claude fix exited with code ${exitCode}`)
33243335
}
33253336
} catch (error) {
33263337
log.warn(`Claude fix error: ${error.message}`)
@@ -3502,17 +3513,30 @@ Fix the failure now by making the necessary changes.`
35023513
}, 10_000)
35033514

35043515
try {
3505-
const printArgs = ['--print', ...prepareClaudeArgs([], opts)]
3506-
const result = await runCommandWithOutput(claudeCmd, printArgs, {
3507-
cwd: rootPath,
3508-
input: fixPrompt,
3509-
stdio: ['pipe', 'pipe', 'pipe'],
3510-
})
3511-
if (result.exitCode !== 0) {
3512-
log.warn(`Claude fix exited with code ${result.exitCode}`)
3513-
if (result.stderr) {
3514-
log.warn(`Claude stderr: ${result.stderr.slice(0, 500)}`)
3516+
const fixArgs = prepareClaudeArgs([], opts)
3517+
const exitCode = await new Promise((resolve, _reject) => {
3518+
const child = spawn(claudeCmd, fixArgs, {
3519+
stdio: ['pipe', 'inherit', 'inherit'],
3520+
cwd: rootPath,
3521+
...(WIN32 && { shell: true }),
3522+
})
3523+
3524+
// Write the fix prompt to stdin
3525+
if (fixPrompt) {
3526+
child.stdin.write(fixPrompt)
3527+
child.stdin.end()
35153528
}
3529+
3530+
child.on('exit', code => {
3531+
resolve(code || 0)
3532+
})
3533+
3534+
child.on('error', () => {
3535+
resolve(1)
3536+
})
3537+
})
3538+
if (exitCode !== 0) {
3539+
log.warn(`Claude fix exited with code ${exitCode}`)
35163540
}
35173541
} catch (error) {
35183542
log.warn(`Claude fix error: ${error.message}`)

0 commit comments

Comments
 (0)