@junando/core 0.6.1 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# @junando/core
|
|
2
|
+
|
|
3
|
+
Core domain logic for the Junando alerting platform. Implements the full incident processing pipeline: receives normalized alerts, clusters them by root cause, deduplicates, fetches traces from Loki, analyzes with an LLM, and dispatches notifications to Slack or Teams.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @junando/core
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @junando/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
Junando follows hexagonal architecture. `@junando/core` defines the domain model and ports — infrastructure adapters are provided out of the box but can be replaced with custom implementations.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
NormalizedAlert[]
|
|
19
|
+
↓
|
|
20
|
+
ClusteringService (pure, no I/O)
|
|
21
|
+
↓
|
|
22
|
+
AlertCluster[]
|
|
23
|
+
↓
|
|
24
|
+
ProcessIncidentUseCase (orchestrates ports)
|
|
25
|
+
├── IDeduplicationStore → RedisDeduplicationStore / InMemoryDeduplicationStore
|
|
26
|
+
├── ITraceRepository → LokiTraceRepository / MockTraceRepository
|
|
27
|
+
├── ILLMProvider → ClaudeProvider / GeminiProvider / MockLLMProvider
|
|
28
|
+
├── INotifier → SlackNotifier / TeamsNotifier / ConsoleNotifier
|
|
29
|
+
└── IIndexer → OpenSearchIndexer / InMemoryIndexer
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import {
|
|
36
|
+
ProcessIncidentUseCase,
|
|
37
|
+
RedisDeduplicationStore,
|
|
38
|
+
LokiTraceRepository,
|
|
39
|
+
ClaudeProvider,
|
|
40
|
+
SlackNotifier,
|
|
41
|
+
InMemoryIndexer,
|
|
42
|
+
loadConfig,
|
|
43
|
+
createLogger,
|
|
44
|
+
} from '@junando/core'
|
|
45
|
+
|
|
46
|
+
const config = await loadConfig()
|
|
47
|
+
const logger = createLogger(config)
|
|
48
|
+
|
|
49
|
+
const useCase = new ProcessIncidentUseCase({
|
|
50
|
+
deduplicationStore: new RedisDeduplicationStore(redisClient),
|
|
51
|
+
traceRepository: new LokiTraceRepository(config.loki),
|
|
52
|
+
llmProvider: new ClaudeProvider(config.llm),
|
|
53
|
+
notifier: new SlackNotifier(config.slack),
|
|
54
|
+
indexer: new InMemoryIndexer(),
|
|
55
|
+
logger,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
await useCase.execute(normalizedAlerts)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Key Exports
|
|
62
|
+
|
|
63
|
+
### Domain types
|
|
64
|
+
|
|
65
|
+
| Export | Description |
|
|
66
|
+
|--------|-------------|
|
|
67
|
+
| `NormalizedAlert` | Source-agnostic canonical alert |
|
|
68
|
+
| `AlertCluster` | Group of alerts sharing the same root cause |
|
|
69
|
+
| `Fingerprint` | SHA-256 value object for grouping and deduplication |
|
|
70
|
+
| `AlertType` | Enum of supported alert categories |
|
|
71
|
+
|
|
72
|
+
### Use case
|
|
73
|
+
|
|
74
|
+
| Export | Description |
|
|
75
|
+
|--------|-------------|
|
|
76
|
+
| `ProcessIncidentUseCase` | Main pipeline orchestrator |
|
|
77
|
+
| `ClusteringService` | Pure clustering logic (no I/O) |
|
|
78
|
+
|
|
79
|
+
### Ports (interfaces)
|
|
80
|
+
|
|
81
|
+
`IAlertQueue`, `IDeduplicationStore`, `IIndexer`, `ILLMProvider`, `INotifier`, `ITraceRepository`
|
|
82
|
+
|
|
83
|
+
### Adapters
|
|
84
|
+
|
|
85
|
+
| Port | Implementations |
|
|
86
|
+
|------|----------------|
|
|
87
|
+
| `IDeduplicationStore` | `RedisDeduplicationStore`, `InMemoryDeduplicationStore` |
|
|
88
|
+
| `ITraceRepository` | `LokiTraceRepository`, `MockTraceRepository` |
|
|
89
|
+
| `ILLMProvider` | `ClaudeProvider`, `GeminiProvider`, `MockLLMProvider` |
|
|
90
|
+
| `INotifier` | `SlackNotifier`, `TeamsNotifier`, `ConsoleNotifier` |
|
|
91
|
+
| `IIndexer` | `OpenSearchIndexer`, `InMemoryIndexer` |
|
|
92
|
+
|
|
93
|
+
### Utilities
|
|
94
|
+
|
|
95
|
+
| Export | Description |
|
|
96
|
+
|--------|-------------|
|
|
97
|
+
| `loadConfig()` | Loads config from AWS SSM / environment |
|
|
98
|
+
| `createLogger()` | Structured logger (pino + Loki transport) |
|
|
99
|
+
| `normalizePayload()` | Converts `AlertmanagerPayload` → `NormalizedAlert[]` |
|
|
100
|
+
| `metrics` | Prometheus counters (prom-client) |
|
|
101
|
+
|
|
102
|
+
## Requirements
|
|
103
|
+
|
|
104
|
+
- Node.js >= 24
|
|
105
|
+
- Redis (for `RedisDeduplicationStore`)
|
|
106
|
+
- AWS credentials (for `ClaudeProvider` / `loadConfig` with SSM)
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junando/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "Core domain types, interfaces, and shared utilities for the Junando alerting platform",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md"
|
|
11
12
|
],
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|