Seed harness rows in CLI service wiring (mirror on_mount)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+9
-2
@@ -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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user