node-autofixer
v1.0.3
Published
Watches your Node.js process. When it crashes, sends the error to AI, applies the fix, and restarts — automatically.
Readme
node-autofixer
Watches your Node.js process. When it crashes, sends the error to AI, applies the fix, and restarts — automatically.
Install
npm install node-autofixerUsage
import { AutoFixer } from 'node-autofixer'
const fixer = new AutoFixer()
fixer.watch('./bot.js')That's it. Every crash gets fixed and logged in autofixer.log.txt.
Options
new AutoFixer({
logFile: 'autofixer.log.txt',
minConfidence: 0.5,
maxRetries: 3,
restartDelay: 1000,
})| Option | Default | Description |
|---|---|---|
| logFile | autofixer.log.txt | Where to save errors and fixes |
| minConfidence | 0.5 | Minimum AI confidence to apply a fix (0–1) |
| maxRetries | 3 | Max fix attempts before giving up |
| restartDelay | 1000 | Milliseconds to wait before restarting |
Log format
Every error and fix is saved in plain text:
============================================================
[12/03/2026, 14:32:01] ERROR DETECTED
============================================================
File: /home/user/bot.js
Line: 12
Type: ReferenceError
Message: myVar is not defined
Stack:
at Object.<anonymous> (/home/user/bot.js:12:3)
------------------------------------------------------------
[12/03/2026, 14:32:03] FIX APPLIED
------------------------------------------------------------
File: /home/user/bot.js
AI Explanation:
myVar was used before being declared. Added const myVar = null on line 11.
Original code:
... (full original file)
Fixed code:
... (full fixed file)
============================================================How it works
- Spawns your script as a child process
- Intercepts stderr and crash events
- Parses the error — file, line, stack trace
- Sends error + source code to the AI proxy
- AI returns a fix with confidence score
- If confidence ≥ threshold, applies fix and restarts
- Saves everything to the log file
