Skip to content

Commit 6edda12

Browse files
Royal-lobsterclaude
andcommitted
Add CI/CD, changelog, contributing guide, and package metadata
- GitHub Actions CI: lint, test, build on Node 18/20/22 for push + PR - GitHub Actions Release: publish to npm with provenance on tag push (v*) - CHANGELOG.md with initial 0.1.0 release notes - CONTRIBUTING.md with dev setup, scripts, custom adapter guide - package.json: added keywords, author field Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7b8c014 commit 6edda12

6 files changed

Lines changed: 200 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18, 20, 22]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: npm
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Type check
29+
run: npm run lint
30+
31+
- name: Run tests
32+
run: npm test
33+
34+
- name: Build
35+
run: npm run build

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Use Node.js 22
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
cache: npm
23+
registry-url: https://registry.npmjs.org
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Run tests
29+
run: npm test
30+
31+
- name: Build
32+
run: npm run build
33+
34+
- name: Publish to npm
35+
run: npm publish --provenance --access public
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changelog
2+
3+
## 0.1.0
4+
5+
Initial release.
6+
7+
### Features
8+
9+
- **Core engine**: unified alert API with `info`, `warn`, `error`, `critical` methods
10+
- **Error fingerprinting**: automatic deduplication via MD5 hash of normalized error message + stack frames
11+
- **Smart aggregation**: exponential suppression (onset -> ramp -> sustained -> resolution)
12+
- **Multi-channel routing**: route alerts by severity level or custom tags to different webhook URLs
13+
- **Per-environment config**: different thresholds, levels, and ping rules for prod/staging/dev
14+
- **Environment badges**: `[PROD]`, `[STG]`, `[DEV]` prefix on every alert
15+
16+
### Adapters
17+
18+
- **DiscordAdapter**: color-coded embeds, mention sanitization, 429 retry with Retry-After
19+
- **ConsoleAdapter**: TTY-aware pretty/JSON output
20+
21+
### Reliability
22+
23+
- **RetryQueue**: ring buffer with configurable max size, FIFO drain
24+
- **HealthManager**: per-adapter health tracking, graceful degradation, recovery detection
25+
- **Disk persistence**: atomic JSON save/load for crash recovery
26+
27+
### Framework Integrations
28+
29+
- **NestJS** (`@iqai/alert-logger/nestjs`): global module, injectable service, exception filter, request context via AsyncLocalStorage
30+
- **Next.js** (`@iqai/alert-logger/nextjs`): instrumentation.ts handler, onRequestError hook, getAlertLogger for manual use

CONTRIBUTING.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Contributing to @iqai/alert-logger
2+
3+
Thanks for your interest in contributing!
4+
5+
## Development Setup
6+
7+
```bash
8+
git clone https://github.com/IQAIcom/alert-logger.git
9+
cd alert-logger
10+
npm install
11+
```
12+
13+
## Scripts
14+
15+
```bash
16+
npm test # Run tests
17+
npm run test:watch # Run tests in watch mode
18+
npm run lint # Type check
19+
npm run build # Build with tsup
20+
```
21+
22+
## Making Changes
23+
24+
1. Fork the repo and create a branch from `main`
25+
2. Write your changes
26+
3. Add tests for new functionality
27+
4. Ensure all tests pass: `npm test`
28+
5. Ensure types check: `npm run lint`
29+
6. Submit a pull request
30+
31+
## Writing Adapters
32+
33+
To create a custom adapter, implement the `AlertAdapter` interface:
34+
35+
```ts
36+
import type { AlertAdapter, FormattedAlert, AlertLevel } from '@iqai/alert-logger'
37+
38+
class MyAdapter implements AlertAdapter {
39+
readonly name = 'my-adapter'
40+
levels: AlertLevel[] = ['info', 'warning', 'critical']
41+
42+
rateLimits() {
43+
return { maxPerWindow: 60, windowMs: 60_000 }
44+
}
45+
46+
async send(alert: FormattedAlert): Promise<void> {
47+
// Your sending logic here
48+
}
49+
}
50+
```
51+
52+
## Code Style
53+
54+
- TypeScript strict mode
55+
- ESM with `.js` extensions in imports
56+
- No external runtime dependencies in core
57+
58+
## License
59+
60+
By contributing, you agree that your contributions will be licensed under the MIT License.

PHASE6-PLAN.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Phase 6: Publish — Implementation Plan
2+
3+
## Tasks
4+
5+
### 6.1 GitHub Actions CI
6+
- Lint (tsc --noEmit), test (vitest), build (tsup) on push/PR
7+
- Matrix: Node 18, 20, 22
8+
- Use pnpm or npm
9+
10+
### 6.2 GitHub Actions Release
11+
- Publish to npm on tag push (v*)
12+
- Use NPM_TOKEN secret
13+
- Semantic versioning
14+
15+
### 6.3 Package polish
16+
- Add keywords, author, license fields to package.json
17+
- Ensure package.json files field is correct
18+
- Add CONTRIBUTING.md
19+
20+
### 6.4 Changelog
21+
- CHANGELOG.md with initial release notes
22+
23+
### 6.5 Verification
24+
- CI workflow valid YAML
25+
- Build + test passes locally

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44
"description": "Smart alert aggregation for any destination — Discord, Sentry, Slack, console, or your own adapter",
55
"type": "module",
66
"license": "MIT",
7+
"author": "IQ AI <https://github.com/IQAIcom>",
8+
"keywords": [
9+
"alert",
10+
"logger",
11+
"discord",
12+
"webhook",
13+
"error-tracking",
14+
"aggregation",
15+
"deduplication",
16+
"nestjs",
17+
"nextjs",
18+
"monitoring"
19+
],
720
"repository": {
821
"type": "git",
922
"url": "https://github.com/IQAIcom/alert-logger"

0 commit comments

Comments
 (0)