mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 20:21:55 +02:00
Final cleanup of references missed in previous rename commits: - Dockerfiles: PUBLIC_MANA_CORE_AUTH_URL → PUBLIC_MANA_AUTH_URL - Go modules: github.com/manacore/* → github.com/mana/* (7 go.mod files) - launchd plists: com.manacore.* → com.mana.* (14 files renamed + content) - Image assets: *_Manacore_AI_Credits* → *_Mana_AI_Credits* (11 files) - .env.example files: ManaCore brand strings → Mana - .prettierignore: stale apps/manacore/* paths → apps/mana/* - Markdown docs (CLAUDE.md, /docs/*): mana-core-auth → mana-auth, etc. Excluded from rename: .claude/, devlog/, manascore/ (historical content), client testimonials, blueprints, npm package refs (@mana-core/*). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
67 lines
2.2 KiB
Markdown
67 lines
2.2 KiB
Markdown
# mana-matrix-bot
|
|
|
|
Consolidated Go Matrix bot replacing 21 separate NestJS bot services.
|
|
|
|
## Architecture
|
|
|
|
- **Language:** Go 1.23
|
|
- **Matrix SDK:** mautrix-go
|
|
- **Port:** 4000 (health/metrics)
|
|
- **Pattern:** Plugin architecture with compile-time registration
|
|
|
|
## Structure
|
|
|
|
```
|
|
cmd/server/main.go # Entry point, imports all plugins
|
|
internal/
|
|
config/ # Env-based configuration
|
|
runtime/ # Plugin lifecycle, Matrix sync, event routing
|
|
matrix/ # Matrix client wrapper, markdown, media
|
|
plugin/ # Plugin interface, registry, command routing
|
|
session/ # In-memory + Redis session store
|
|
services/ # Backend HTTP client, voice (STT/TTS)
|
|
plugins/ # One directory per bot plugin
|
|
todo/ # @todo-bot
|
|
calendar/ # @calendar-bot
|
|
gateway/ # @mana-bot (composite: AI + todo + calendar + clock + voice)
|
|
...
|
|
```
|
|
|
|
## Adding a New Plugin
|
|
|
|
1. Create `internal/plugins/mybot/mybot.go`
|
|
2. Implement `plugin.Plugin` interface
|
|
3. Register via `func init() { plugin.Register("mybot", func() plugin.Plugin { return &MyBot{} }) }`
|
|
4. Import in `cmd/server/main.go`: `_ "github.com/mana/mana-matrix-bot/internal/plugins/mybot"`
|
|
5. Set env: `MATRIX_MYBOT_BOT_TOKEN=syt_xxx`
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
# Build
|
|
go build -o dist/mana-matrix-bot ./cmd/server
|
|
|
|
# Run
|
|
PORT=4000 MATRIX_HOMESERVER_URL=http://localhost:8008 MATRIX_TODO_BOT_TOKEN=xxx ./dist/mana-matrix-bot
|
|
|
|
# Test
|
|
go test ./...
|
|
|
|
# Docker
|
|
docker build -t mana-matrix-bot:local -f Dockerfile .
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
### Global
|
|
- `PORT` — Health server port (default: 4000)
|
|
- `MATRIX_HOMESERVER_URL` — Matrix homeserver (default: http://localhost:8008)
|
|
- `MATRIX_STORAGE_PATH` — Sync state directory (default: ./data)
|
|
- `MANA_AUTH_URL` — Auth service URL
|
|
- `REDIS_HOST`, `REDIS_PORT`, `REDIS_PASSWORD` — Redis for sessions
|
|
- `STT_URL`, `TTS_URL` — Voice services
|
|
|
|
### Per Plugin (legacy env var names supported)
|
|
- `MATRIX_{NAME}_BOT_TOKEN` — Matrix access token
|
|
- `MATRIX_{NAME}_BOT_ROOMS` — Comma-separated allowed room IDs
|
|
- `{NAME}_BACKEND_URL` — Backend service URL
|