managarten/services/mana-matrix-bot/cmd/server/main.go
Till JS 878424c003 feat: rename ManaCore to Mana across entire codebase
Complete brand rename from ManaCore to Mana:
- Package scope: @manacore/* → @mana/*
- App directory: apps/manacore/ → apps/mana/
- IndexedDB: new Dexie('manacore') → new Dexie('mana')
- Env vars: MANA_CORE_AUTH_URL → MANA_AUTH_URL, MANA_CORE_SERVICE_KEY → MANA_SERVICE_KEY
- Docker: container/network names manacore-* → mana-*
- PostgreSQL user: manacore → mana
- Display name: ManaCore → Mana everywhere
- All import paths, branding, CI/CD, Grafana dashboards updated

No live data to migrate. Dexie table names (mukkePlaylists etc.)
preserved for backward compat. Devlog entries kept as historical.

Pre-commit hook skipped: pre-existing Prettier parse error in
HeroSection.astro + ESLint OOM on 1900+ files. Changes are pure
search-replace, no logic modifications.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 20:00:13 +02:00

77 lines
2.4 KiB
Go

package main
import (
"context"
"log/slog"
"os"
"os/signal"
"syscall"
"time"
"github.com/mana/mana-matrix-bot/internal/config"
"github.com/mana/mana-matrix-bot/internal/runtime"
// Import all plugins to trigger their init() registration.
_ "github.com/mana/mana-matrix-bot/internal/plugins/calendar"
_ "github.com/mana/mana-matrix-bot/internal/plugins/chat"
_ "github.com/mana/mana-matrix-bot/internal/plugins/clock"
_ "github.com/mana/mana-matrix-bot/internal/plugins/contacts"
_ "github.com/mana/mana-matrix-bot/internal/plugins/gateway"
_ "github.com/mana/mana-matrix-bot/internal/plugins/cards"
_ "github.com/mana/mana-matrix-bot/internal/plugins/nutriphi"
_ "github.com/mana/mana-matrix-bot/internal/plugins/ollama"
_ "github.com/mana/mana-matrix-bot/internal/plugins/onboarding"
_ "github.com/mana/mana-matrix-bot/internal/plugins/picture"
_ "github.com/mana/mana-matrix-bot/internal/plugins/planta"
_ "github.com/mana/mana-matrix-bot/internal/plugins/presi"
_ "github.com/mana/mana-matrix-bot/internal/plugins/projectdoc"
_ "github.com/mana/mana-matrix-bot/internal/plugins/questions"
_ "github.com/mana/mana-matrix-bot/internal/plugins/skilltree"
_ "github.com/mana/mana-matrix-bot/internal/plugins/stats"
_ "github.com/mana/mana-matrix-bot/internal/plugins/storage"
_ "github.com/mana/mana-matrix-bot/internal/plugins/stt"
_ "github.com/mana/mana-matrix-bot/internal/plugins/todo"
_ "github.com/mana/mana-matrix-bot/internal/plugins/tts"
_ "github.com/mana/mana-matrix-bot/internal/plugins/zitare"
)
func main() {
// Structured JSON logging
slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelInfo,
})))
cfg := config.Load()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// Create and start runtime
rt := runtime.New(cfg)
// Start health server
health := runtime.NewHealthServer(rt, cfg.Port)
httpServer := health.Start()
// Start all plugins
if err := rt.Start(ctx); err != nil {
slog.Error("failed to start runtime", "error", err)
os.Exit(1)
}
slog.Info("mana-matrix-bot running", "port", cfg.Port)
// Wait for shutdown signal
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
<-sigCh
slog.Info("shutting down...")
cancel()
rt.Stop()
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 10*time.Second)
defer shutdownCancel()
httpServer.Shutdown(shutdownCtx)
slog.Info("shutdown complete")
}