mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 07:06:42 +02:00
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>
68 lines
1.3 KiB
TypeScript
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';
|