Package Exports
- healcode-client
- healcode-client/dist/index.js
- healcode-client/dist/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (healcode-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@healcode/client
🩺 HealCode - Automatic error detection and fix generation for your frontend projects.
Installation
npm install @healcode/clientQuick Start
1. Initialize in your project
npx healcode initThis will prompt you for your HealCode token and create a healcode.config.json file.
2. Import in your app
// main.ts or index.js
import { initFromConfig } from '@healcode/client';
initFromConfig();Or with manual configuration:
import { HealCode } from '@healcode/client';
const healcode = new HealCode({
token: 'hc_your_token_here',
endpoint: 'https://api.healcode.io', // optional
enabled: true,
captureConsoleErrors: true,
captureUnhandledRejections: true,
maxBreadcrumbs: 20,
});Features
- 🔍 Automatic Error Capture - Catches window errors, console.error, and unhandled rejections
- 🍞 Breadcrumbs - Tracks user interactions leading up to errors
- 🔧 Auto-Fix - Generates and creates PRs with fixes automatically
- 🔒 Secure - Your repository tokens are encrypted
- 📊 Dashboard - View all errors and fixes at healcode.io
CLI Commands
npx healcode init # Initialize HealCode in your project
npx healcode status # Check configuration status
npx healcode enable # Enable error tracking
npx healcode disable # Disable error trackingManual Error Capture
import { captureError, addBreadcrumb } from '@healcode/client';
// Add custom breadcrumb
addBreadcrumb('user.action', 'User clicked checkout button', { cartItems: 3 });
// Manually capture an error
try {
riskyOperation();
} catch (error) {
captureError(error.message, error.stack);
}Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
token |
string | required | Your HealCode integration token |
endpoint |
string | https://api.healcode.io |
API endpoint |
enabled |
boolean | true |
Enable/disable tracking |
captureConsoleErrors |
boolean | true |
Capture console.error calls |
captureUnhandledRejections |
boolean | true |
Capture unhandled promise rejections |
maxBreadcrumbs |
number | 20 |
Maximum breadcrumbs to store |
beforeSend |
function | - | Modify or filter errors before sending |
beforeSend Hook
const healcode = new HealCode({
token: 'hc_...',
beforeSend: (payload) => {
// Filter out specific errors
if (payload.message.includes('ResizeObserver')) {
return null; // Don't send
}
// Modify payload
payload.message = payload.message.replace(/secret/gi, '[REDACTED]');
return payload;
},
});License
MIT