# AUTOGENERATED! DO NOT EDIT! File to edit: ../../../../../../../../../Users/lukastk/dev/2025-11-09_00__repoyard/pts/mod/cmds/05_include_repo.pct.py.

# %% top_export
from pathlib import Path

from repoyard._utils.bisync_helper import SyncSetting
from repoyard.config import get_config
from repoyard import const

def include_repo(
    config_path: Path,
    repo_full_name: str,
    sync_force: bool = False,
):
    """
    """
    
    # AUTOGENERATED! DO NOT EDIT! File to edit: ../../../../../../../../../Users/lukastk/dev/2025-11-09_00__repoyard/pts/mod/cmds/05_include_repo.pct.py.
    
    # %% auto 0
    __all__ = ['config', 'repoyard_meta', 'repo_meta']
    
    # %% ../../../../../../../../../Users/lukastk/dev/2025-11-09_00__repoyard/pts/mod/cmds/05_include_repo.pct.py 11
    config = get_config(config_path)
    
    # %% ../../../../../../../../../Users/lukastk/dev/2025-11-09_00__repoyard/pts/mod/cmds/05_include_repo.pct.py 14
    from .._repos import get_repoyard_meta
    repoyard_meta = get_repoyard_meta(config)
    
    if repo_full_name not in repoyard_meta.by_full_name:
        raise ValueError(f"Repo '{repo_full_name}' does not exist.")
    
    repo_meta = repoyard_meta.by_full_name[repo_full_name]
    
    if repo_meta.check_included(config):
        raise ValueError(f"Repo '{repo_full_name}' is already included.")
    
    # %% ../../../../../../../../../Users/lukastk/dev/2025-11-09_00__repoyard/pts/mod/cmds/05_include_repo.pct.py 16
    from . import sync_repo
    
    sync_repo(
        config_path=config_path,
        repo_full_name=repo_full_name,
        sync_setting=SyncSetting.REPLACE_LOCAL,
        force=sync_force,
    )