Coverage for src / lilbee / cli / tui / __init__.py: 100%
16 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-04-29 19:16 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-04-29 19:16 +0000
1"""Textual TUI for lilbee -- full-screen interactive knowledge base."""
3from __future__ import annotations
5from lilbee.cli.sync import shutdown_executor
6from lilbee.services import reset_services
9def run_tui(*, auto_sync: bool = False, initial_view: str | None = None) -> None:
10 """Launch the full-screen Textual TUI.
12 *initial_view* deep-links to a named view (e.g. ``"Catalog"``) after
13 the default chat screen is mounted. Used by ``lilbee model browse``.
14 """
15 import os
17 from lilbee.cli.tui.app import LilbeeApp
19 app = LilbeeApp(auto_sync=auto_sync, initial_view=initial_view)
20 try:
21 app.run()
22 except KeyboardInterrupt:
23 pass
24 finally:
25 try:
26 shutdown_executor()
27 reset_services()
28 except (KeyboardInterrupt, Exception):
29 # Rapid Ctrl+C during shutdown — force exit immediately
30 os._exit(1)