"""P.I.G. Farm Textual application."""

from pathlib import Path

from textual.app import App

from pigfarm.screens.pigfarm import PigFarmScreen


class PigFarmApp(App):
    """P.I.G. Farm - Programmatic Intelligence Gateway.

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

    CSS_PATH = "styles/pigfarm.tcss"
    TITLE = "P.I.G. Farm"
    SUB_TITLE = "Programmatic Intelligence Gateway"

    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(PigFarmScreen(working_directory=self.working_directory))


def main() -> None:
    """Run the P.I.G. Farm application."""
    app = PigFarmApp()
    app.run()


if __name__ == "__main__":
    main()
