♻️ refactor: consolidate SessionService & TranscriptionService in @manacore/bot-services

Created shared services to eliminate code duplication across Matrix bots:

**New Services in @manacore/bot-services:**
- SessionService: User authentication via mana-core-auth (was duplicated in 11 bots)
- TranscriptionService: Speech-to-text via mana-stt (was duplicated in 6 bots)

**Migrated Bots:**
- matrix-todo-bot: uses TranscriptionService
- matrix-picture-bot: uses SessionService
- matrix-clock-bot: uses TranscriptionService
- matrix-zitare-bot: uses both SessionService & TranscriptionService

**Code Reduction:**
- Removed ~300 lines of duplicate code from migrated bots
- Centralized service configuration via NestJS modules
- Added comprehensive documentation in CLAUDE.md

Remaining bots can be migrated following the same pattern documented
in packages/bot-services/CLAUDE.md.

Note: @storage/backend type-check fails due to pre-existing drizzle-orm issue

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-02-01 00:37:54 +01:00
parent 508ae124a9
commit 9b61831cb5
35 changed files with 1014 additions and 903 deletions

View file

@ -181,12 +181,16 @@ User → matrix-mana-bot → @manacore/bot-services → Multiple Backends
Das Package `@manacore/bot-services` stellt transport-agnostische Geschäftslogik bereit:
```typescript
// Exportierte Services
// Business Logic Services
export { TodoModule, TodoService } from './todo';
export { CalendarModule, CalendarService } from './calendar';
export { AiModule, AiService } from './ai';
export { ClockModule, ClockService } from './clock';
// Infrastructure Services (NEU: Konsolidiert aus 11+ Bots)
export { SessionModule, SessionService } from './session'; // Auth via mana-core-auth
export { TranscriptionModule, TranscriptionService } from './transcription'; // STT via mana-stt
// Storage Provider (pluggable)
export { FileStorageProvider } from './shared/storage/file-storage.provider';
export { MemoryStorageProvider } from './shared/storage/memory-storage.provider';
@ -196,6 +200,15 @@ export { generateId, getTodayISO, formatDateDE } from './shared/utils';
export { parseGermanDateKeyword } from './shared/date-parser';
```
### 3.1.1 Konsolidierte Services
Die folgenden Services wurden aus den einzelnen Bots konsolidiert:
| Service | Vorher | Nachher | Bots |
|---------|--------|---------|------|
| `SessionService` | 11x dupliziert | 1x in bot-services | picture, contacts, chat, zitare, ... |
| `TranscriptionService` | 6x dupliziert | 1x in bot-services | todo, clock, zitare, nutriphi, ... |
### 3.2 TodoService
Vollständige Aufgabenverwaltung mit deutscher Sprachunterstützung: