managarten/packages/matrix-bot-common/src/index.ts
Till-JS 145b0b6599 feat: create @manacore/matrix-bot-common shared package
New package with shared utilities for Matrix bots:

**Components:**
- `BaseMatrixService` - Abstract base class with client lifecycle
- `HealthController` - Standardized health endpoint
- `MatrixMessageService` - Message/reply/reaction helpers
- `markdownToHtml` - Markdown to HTML conversion
- `KeywordCommandDetector` - Natural language command detection
- `SessionHelper<T>` - Type-safe session data wrapper
- `UserListMapper<T>` - Number-based reference system

**Estimated Impact:**
- ~4,000 lines of duplicate code can be eliminated
- 19 Matrix bots can use these shared utilities
- Consistent behavior across all bots

Documentation in packages/matrix-bot-common/CLAUDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 01:02:55 +01:00

68 lines
1.3 KiB
TypeScript

/**
* @manacore/matrix-bot-common
*
* Shared utilities and base classes for Matrix bots.
* Reduces code duplication across 19 Matrix bots.
*
* @example
* ```typescript
* import {
* BaseMatrixService,
* HealthController,
* MatrixMessageService,
* KeywordCommandDetector,
* markdownToHtml,
* SessionHelper,
* UserListMapper,
* } from '@manacore/matrix-bot-common';
* ```
*/
// Base Matrix Service
export {
BaseMatrixService,
type MatrixBotConfig,
type MatrixRoomEvent,
type MatrixMessageEvent,
isTextMessage,
isAudioMessage,
isImageMessage,
isFileMessage,
} from './base';
// Health Controller
export {
HealthController,
HEALTH_SERVICE_NAME,
createHealthProvider,
type HealthResponse,
} from './health';
// Message Service
export {
MatrixMessageService,
type MatrixMessageContent,
type SendMessageOptions,
} from './message';
// Markdown Utilities
export {
markdownToHtml,
escapeHtml,
formatNumberedList,
formatBulletList,
} from './markdown';
// Keyword Detection
export {
KeywordCommandDetector,
COMMON_KEYWORDS,
type KeywordCommand,
type KeywordDetectorOptions,
} from './keywords';
// Session Helper
export { SessionHelper, createSessionHelper } from './session';
// List Mapper
export { UserListMapper, UserIdListMapper } from './list-mapper';