# @errio/sdk

Capture runtime errors in Node.js apps and send them to [Errio](https://errio.dev) for AI-powered remediation.

## Installation

```bash
npm install @errio/sdk
```

## Quick Start

```typescript
import { initErrio } from '@errio/sdk';

initErrio({
  apiKey: 'ak_your_api_key',
});

// That's it — uncaught exceptions and unhandled rejections are now captured automatically.
```

## Manual Capture

```typescript
import { initErrio, captureError } from '@errio/sdk';

initErrio({ apiKey: 'ak_your_api_key' });

try {
  riskyOperation();
} catch (error) {
  captureError(error as Error);
}
```

## Configuration

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `apiKey` | `string` | *required* | API key with `ak_` prefix |
| `environment` | `string` | — | Environment name (e.g., `production`) |
| `serviceName` | `string` | — | Service identifier (e.g., `payment-service`) |

## Features

- **Automatic capture** of `uncaughtException` and `unhandledRejection`
- **Git auto-detection** of repo, commit SHA, and branch
- **Fingerprint deduplication** — duplicate errors within 5 minutes are skipped
- **Zero dependencies** — uses only Node.js built-ins
- **Safe by design** — never crashes your app, never blocks the event loop

## Requirements

Node.js >= 18.0.0
