(state)
| 66 | const dir = path.dirname(STATE_FILE); |
| 67 | if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); |
| 68 | const tmpFile = STATE_FILE + '.tmp'; |
| 69 | fs.writeFileSync(tmpFile, JSON.stringify(state, null, 2)); |
| 70 | fs.renameSync(tmpFile, STATE_FILE); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Handle PostToolUseFailure: track consecutive failures, trip on threshold. |
| 75 | */ |
| 76 | function handleFailure(event) { |
| 77 | const toolName = event.tool_name || 'unknown'; |
no outgoing calls
no test coverage detected