Skip to content

Commit 57bcb7c

Browse files
committed
Fix darkwing mode flag passing and improve job-specific log fetching
Use sh -c wrapper to properly pass --dangerously-skip-permissions flag through script command. Fetch logs using specific job ID with --job flag instead of --log-failed to get focused logs for individual jobs.
1 parent dc86851 commit 57bcb7c

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

scripts/claude.mjs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3319,7 +3319,10 @@ Fix all CI failures now by making the necessary changes.`
33193319
await fs.writeFile(tmpFile, fixPrompt, 'utf8')
33203320

33213321
const fixArgs = prepareClaudeArgs([], opts)
3322-
const claudeCommand = `${claudeCmd} ${fixArgs.join(' ')}`
3322+
const claudeArgs = fixArgs.join(' ')
3323+
const claudeCommand = claudeArgs
3324+
? `${claudeCmd} ${claudeArgs}`
3325+
: claudeCmd
33233326

33243327
// Use script command to create pseudo-TTY for Ink compatibility
33253328
// Platform-specific script command syntax
@@ -3334,8 +3337,8 @@ Fix all CI failures now by making the necessary changes.`
33343337
scriptCmd = `${claudeCommand} < "${tmpFile}"`
33353338
}
33363339
} else {
3337-
// Unix/macOS: use script command
3338-
scriptCmd = `script -q /dev/null ${claudeCommand} < "${tmpFile}"`
3340+
// Unix/macOS: use script command with quoted command
3341+
scriptCmd = `script -q /dev/null sh -c '${claudeCommand} < "${tmpFile}"'`
33393342
}
33403343

33413344
const exitCode = await new Promise((resolve, _reject) => {
@@ -3476,17 +3479,18 @@ Fix all CI failures now by making the necessary changes.`
34763479
for (const job of newFailures) {
34773480
log.substep(`❌ ${job.name}: ${job.conclusion}`)
34783481

3479-
// Fetch logs for this specific failed job
3482+
// Fetch logs for this specific failed job using job ID
34803483
log.progress(`Fetching logs for ${job.name}`)
34813484
const logsResult = await runCommandWithOutput(
34823485
'gh',
34833486
[
34843487
'run',
34853488
'view',
3486-
lastRunId.toString(),
3489+
'--job',
3490+
job.databaseId.toString(),
34873491
'--repo',
34883492
`${owner}/${repo}`,
3489-
'--log-failed',
3493+
'--log',
34903494
],
34913495
{
34923496
cwd: rootPath,
@@ -3547,7 +3551,10 @@ Fix the failure now by making the necessary changes.`
35473551
await fs.writeFile(tmpFile, fixPrompt, 'utf8')
35483552

35493553
const fixArgs = prepareClaudeArgs([], opts)
3550-
const claudeCommand = `${claudeCmd} ${fixArgs.join(' ')}`
3554+
const claudeArgs = fixArgs.join(' ')
3555+
const claudeCommand = claudeArgs
3556+
? `${claudeCmd} ${claudeArgs}`
3557+
: claudeCmd
35513558

35523559
// Use script command to create pseudo-TTY for Ink compatibility
35533560
// Platform-specific script command syntax
@@ -3562,8 +3569,8 @@ Fix the failure now by making the necessary changes.`
35623569
scriptCmd = `${claudeCommand} < "${tmpFile}"`
35633570
}
35643571
} else {
3565-
// Unix/macOS: use script command
3566-
scriptCmd = `script -q /dev/null ${claudeCommand} < "${tmpFile}"`
3572+
// Unix/macOS: use script command with quoted command
3573+
scriptCmd = `script -q /dev/null sh -c '${claudeCommand} < "${tmpFile}"'`
35673574
}
35683575

35693576
const exitCode = await new Promise((resolve, _reject) => {

0 commit comments

Comments
 (0)