smith.application.status

Status use-case — report the current connection state of a project.

 1"""Status use-case — report the current connection state of a project."""
 2
 3from __future__ import annotations
 4
 5from pathlib import Path
 6
 7from smith.domain.connection import Connection
 8from smith.domain.value_objects import ConnectionStatus, TemplateSource
 9from smith.infrastructure.filesystem import AtomicFileSystem
10from smith.infrastructure.gitignore import GitignoreManager
11from smith.infrastructure.metadata import SectionMetadata
12from smith.infrastructure.template_source import TemplateSourceAdapter
13
14
15class StatusUseCase:
16    """Orchestrate querying the connection status of a project."""
17
18    def __init__(self, project_dir: Path) -> None:
19        """Initialise with the target project directory."""
20        self._project_dir = project_dir
21
22    def execute(self) -> ConnectionStatus:
23        """Return the current connection status of the project."""
24        connection = Connection(
25            template_source_port=TemplateSourceAdapter(
26                TemplateSource(kind="bundled", location="agents-smith"),
27            ),
28            filesystem_port=AtomicFileSystem(self._project_dir),
29            gitignore_port=GitignoreManager(self._project_dir),
30            metadata_port=SectionMetadata(self._project_dir),
31        )
32        return connection.status()
class StatusUseCase:
16class StatusUseCase:
17    """Orchestrate querying the connection status of a project."""
18
19    def __init__(self, project_dir: Path) -> None:
20        """Initialise with the target project directory."""
21        self._project_dir = project_dir
22
23    def execute(self) -> ConnectionStatus:
24        """Return the current connection status of the project."""
25        connection = Connection(
26            template_source_port=TemplateSourceAdapter(
27                TemplateSource(kind="bundled", location="agents-smith"),
28            ),
29            filesystem_port=AtomicFileSystem(self._project_dir),
30            gitignore_port=GitignoreManager(self._project_dir),
31            metadata_port=SectionMetadata(self._project_dir),
32        )
33        return connection.status()

Orchestrate querying the connection status of a project.

StatusUseCase(project_dir: pathlib._local.Path)
19    def __init__(self, project_dir: Path) -> None:
20        """Initialise with the target project directory."""
21        self._project_dir = project_dir

Initialise with the target project directory.

def execute(self) -> smith.domain.value_objects.ConnectionStatus:
23    def execute(self) -> ConnectionStatus:
24        """Return the current connection status of the project."""
25        connection = Connection(
26            template_source_port=TemplateSourceAdapter(
27                TemplateSource(kind="bundled", location="agents-smith"),
28            ),
29            filesystem_port=AtomicFileSystem(self._project_dir),
30            gitignore_port=GitignoreManager(self._project_dir),
31            metadata_port=SectionMetadata(self._project_dir),
32        )
33        return connection.status()

Return the current connection status of the project.