autoheal-ai
v0.1.1
Published
Catch production errors and get AI-powered fixes. Works with Node.js, Express, and React Native.
Maintainers
Readme
autoheal-ai
Catch production errors and get AI-powered fixes. Works with Node.js, Express, and React Native.
Install
npm install autoheal-aiNode.js
const autoheal = require('autoheal-ai');
autoheal.init({ apiKey: 'ah_your_key_here' });
// Catch all uncaught errors automatically
autoheal.setupProcessHandlers();
// Or capture errors manually
try {
riskyFunction();
} catch (err) {
autoheal.captureError(err);
}Express
const express = require('express');
const autoheal = require('autoheal-ai');
const app = express();
autoheal.init({ apiKey: 'ah_your_key_here' });
// Your routes...
app.get('/', (req, res) => res.send('Hello'));
// Add as the LAST middleware
app.use(autoheal.expressErrorHandler());
app.listen(3000);React Native
import autoheal from 'autoheal-ai/react-native';
// In your App.tsx, before rendering
autoheal.init({ apiKey: 'ah_your_key_here' });
autoheal.setupErrorHandler();
export default function App() {
// Your app...
}Options
autoheal.init({
apiKey: 'ah_...', // Required — from your AutoHeal dashboard
appUrl: 'https://...', // Optional — defaults to https://autohealai.com
enabled: true, // Optional — defaults to true in production
debug: false, // Optional — log when errors are sent
metadata: { env: 'staging' } // Optional — extra data sent with every error
});How it works
- Your app hits an error
- AutoHeal sends it to your dashboard
- AI reads your code and writes a fix
- You get a Slack/email notification with the fix
- One click to create a pull request
License
MIT — Knod, Inc.
