"""Cleave TUI - Interactive terminal interface for task decomposition."""

from pathlib import Path

from textual.app import App

from cleave.tui.screens.main import CleaveMainScreen


class CleaveTUI(App):
    """Cleave TUI - Interactive task decomposition interface.

    A terminal UI for managing directives and executing them through the
    Claude Agent SDK with Cleave skill integration.
    """

    CSS_PATH = "styles/cleave.tcss"
    TITLE = "╔═══ CLEAVE ═══╗"
    SUB_TITLE = "∴ Recursive Task Decomposition ∴"

    def __init__(self, working_directory: Path | None = None):
        super().__init__()
        self.working_directory = working_directory or Path.cwd()

    def on_mount(self) -> None:
        """Push the main screen on mount."""
        self.push_screen(CleaveMainScreen(working_directory=self.working_directory))


def main() -> None:
    """Run the Cleave TUI application."""
    app = CleaveTUI()
    app.run()


if __name__ == "__main__":
    main()
