Skip to content

opencode

dev_tool.services.opencode

__all__ = ['OpenCodeService'] module-attribute

OpenCodeService

Bases: BaseService

A service class for managing OpenCode files.

This class provides methods for downloading and syncing OpenCode files from the public repository.

The constructor for the OpenCodeService class.

It initializes the service by calling the parent constructor.

Source code in dev_tool/services/opencode/service.py
def __init__(self) -> None:
    """
    The constructor for the OpenCodeService class.

    It initializes the service by calling the parent constructor.
    """

    super().__init__()

sync

A method that syncs the OpenCode files from the repository.

This method clones the repository if it does not exist locally, or pulls the latest changes if it does.

Raises:

  • GitNotAvailableError

    If git is not found.

  • OpenCodeSyncError

    If the sync operation fails.

Source code in dev_tool/services/opencode/service.py
def sync(self) -> None:
    """
    A method that syncs the OpenCode files from the repository.

    This method clones the repository if it does not exist locally,
    or pulls the latest changes if it does.

    :raises GitNotAvailableError: If git is not found.
    :raises OpenCodeSyncError: If the sync operation fails.
    """

    self._validate_git()

    if self._is_cloned():
        self._pull()
    else:
        self._clone()