"""Shared App holder for the command modules, wired by each group's register.""" from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from vibe_bot.app import App _app: App | None = None def set_app(app: App) -> None: """Store the App so command handlers can reach the services.""" global _app _app = app def require_app() -> App: """The App wired by build_bot(); handlers must not run before it.""" if _app is None: msg = "App is not initialized; build_bot(app) must be called first." raise RuntimeError(msg) return _app