diff --git a/src/hqt/cli.py b/src/hqt/cli.py index 55cbebb..cd056b7 100644 --- a/src/hqt/cli.py +++ b/src/hqt/cli.py @@ -122,10 +122,15 @@ def doctor(): def _build_session_service(): - """Wire a SessionService the same way HqtApp.on_mount does (for CLI use).""" + """Wire a SessionService the same way HqtApp.on_mount does (for CLI use). + + Mirrors on_mount's DB + tmux wiring, including seeding harness rows, but + deliberately omits apply_theme — a one-off CLI call must not re-theme the + session's status bar. + """ from hqt.config import get_settings from hqt.db.engine import ensure_db, get_engine, get_session_factory - from hqt.harnesses.registry import discover_harnesses + from hqt.harnesses.registry import discover_harnesses, ensure_harnesses_in_db from hqt.sessions.service import SessionService from hqt.tmux.manager import TmuxManager from hqt.tmux.runner import TmuxRunner @@ -133,6 +138,8 @@ def _build_session_service(): settings = get_settings() ensure_db(settings) factory = get_session_factory(get_engine(settings)) + with factory() as db: + ensure_harnesses_in_db(db) runner = TmuxRunner(settings.tmux_path, settings.tui_session_name) return SessionService(factory, TmuxManager(runner), discover_harnesses())