Skip to content

abc_ci_launcher.config

WARNING

This documentation is almost entirely "vibe coded"; while a helpful resource for humans and agents to understand this codebase, it should not be considered a source of ground truth in the way documentation normally is, and the user is responsible for verifying that all instructions given here are safe.

abc_ci_launcher.config

Configuration loading for abc-ci-launcher.

DEFAULT_CONFIG_DIR module-attribute

DEFAULT_CONFIG_DIR = Path.home() / '.abc-runner' / 'abc-ci'

DEFAULT_CONFIG_PATH module-attribute

DEFAULT_CONFIG_PATH = DEFAULT_CONFIG_DIR / 'config.yaml'

CONFIG_TEMPLATE module-attribute

CONFIG_TEMPLATE = '# abc-ci-launcher configuration\n#\n# This file contains only GitLab trigger settings and launcher defaults.\n# Do not put model provider API keys here. Provider keys belong in GitLab CI\n# variables used by the abc-ci pipeline.\n\ngitlab:\n  base_url: "https://gitlab.example.org"\n  project_id: "TODO"\n  ref: "main"\n  # Branch used when triggering with --dev. Pipelines on this branch archive to\n  # ABC_RUNNER_RESULTS_DIR_DEV and publish a separate Pages site.\n  dev_ref: "dev"\n  trigger_token_env: "ABC_CI_TRIGGER_TOKEN"\n\ndefaults:\n  agent: "opencode-default"\n  timeout_seconds: null\n'

LauncherConfig dataclass

LauncherConfig(path: Path, data: dict[str, Any])

Launcher-side GitLab trigger configuration.

path instance-attribute

path: Path

data instance-attribute

data: dict[str, Any]

gitlab_base_url property

gitlab_base_url: str

gitlab_project_id property

gitlab_project_id: str

gitlab_ref property

gitlab_ref: str

gitlab_dev_ref property

gitlab_dev_ref: str

trigger_token_env property

trigger_token_env: str

trigger_token property

trigger_token: str | None

default_agent property

default_agent: str | None

default_timeout_seconds property

default_timeout_seconds: int | None

validate

validate(require_token: bool = True) -> list[str]
Source code in abc-ci-launcher/src/abc_ci_launcher/config.py
def validate(self, require_token: bool = True) -> list[str]:
    errors: list[str] = []
    if not self.gitlab_base_url:
        errors.append("gitlab.base_url is required")
    if not self.gitlab_project_id or self.gitlab_project_id == "TODO":
        errors.append("gitlab.project_id is required")
    if not self.gitlab_ref:
        errors.append("gitlab.ref is required")
    if not self.trigger_token_env:
        errors.append("gitlab.trigger_token_env is required")
    if require_token and not self.trigger_token:
        errors.append(f"environment variable {self.trigger_token_env} is not set")
    return errors

init_config

init_config(path: Path = DEFAULT_CONFIG_PATH, force: bool = False) -> Path

Create a starter launcher config file.

Source code in abc-ci-launcher/src/abc_ci_launcher/config.py
def init_config(path: Path = DEFAULT_CONFIG_PATH, force: bool = False) -> Path:
    """Create a starter launcher config file."""

    path = path.expanduser().resolve()
    if path.exists() and not force:
        raise FileExistsError(f"config already exists: {path}")
    path.parent.mkdir(parents=True, exist_ok=True)
    path.write_text(CONFIG_TEMPLATE, encoding="utf-8")
    return path

load_config

load_config(path: Path | None = None) -> LauncherConfig

Load the launcher config, creating a starter file on first use.

Source code in abc-ci-launcher/src/abc_ci_launcher/config.py
def load_config(path: Path | None = None) -> LauncherConfig:
    """Load the launcher config, creating a starter file on first use."""

    config_path = (path or DEFAULT_CONFIG_PATH).expanduser().resolve()
    if not config_path.is_file():
        # Auto-initialize config on first run
        config_path.parent.mkdir(parents=True, exist_ok=True)
        config_path.write_text(CONFIG_TEMPLATE, encoding="utf-8")
        print(f"Created config file: {config_path}")
        print("Edit this file to configure GitLab project settings.")
    with config_path.open("r", encoding="utf-8") as handle:
        data = yaml.safe_load(handle) or {}
    if not isinstance(data, dict):
        raise ValueError(f"config root must be a mapping: {config_path}")
    return LauncherConfig(path=config_path, data=data)