Skip to content

abc_ci_launcher.validate

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.validate

Validation utilities for abc-ci inputs.

get_available_tasks

get_available_tasks() -> list[str]

Return available canonical task refs from installed abc-runner.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def get_available_tasks() -> list[str]:
    """Return available canonical task refs from installed abc-runner."""
    _, Task, _ = _import_abc_runner()
    return Task.list_tasks(_abc_runner_resolver())

get_available_task_groups

get_available_task_groups() -> list[str]

Return available task groups from installed abc-runner.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def get_available_task_groups() -> list[str]:
    """Return available task groups from installed abc-runner."""
    _, Task, _ = _import_abc_runner()
    return Task.list_task_groups(_abc_runner_resolver())

get_available_agents

get_available_agents(config_path: str | None = None) -> list[str]

Return available agent ids from installed abc-runner config.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def get_available_agents(config_path: str | None = None) -> list[str]:
    """Return available agent ids from installed abc-runner config."""
    Config, _, Agent = _import_abc_runner()
    config = Config(config_path) if config_path is not None else Config()
    return Agent.list_agents(config)

is_glob_pattern

is_glob_pattern(value: str) -> bool

Check whether a string contains shell-style glob metacharacters.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def is_glob_pattern(value: str) -> bool:
    """Check whether a string contains shell-style glob metacharacters."""

    return any(c in value for c in "*?[]")

resolve_agents

resolve_agents(pattern: str, config_path: str | None = None) -> list[str]

Expand a glob pattern to matching agent ids from the abc-runner config.

Returns a sorted list of agent ids that match the given pattern.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def resolve_agents(pattern: str, config_path: str | None = None) -> list[str]:
    """Expand a glob pattern to matching agent ids from the abc-runner config.

    Returns a sorted list of agent ids that match the given pattern.
    """

    available = get_available_agents(config_path)
    return sorted(fnmatch.filter(available, pattern))

get_available_models

get_available_models(config_path: str | None = None) -> list[str]

Return available model ids from ABC_RUNNER_CONFIG.

This remains useful for displaying underlying model references in tooling.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def get_available_models(config_path: str | None = None) -> list[str]:
    """Return available model ids from `ABC_RUNNER_CONFIG`.

    This remains useful for displaying underlying model references in tooling.
    """
    if config_path is None:
        config_file = _abc_runner_config_path()
    else:
        config_file = Path(config_path).expanduser().resolve()

    try:
        if not config_file.is_file():
            return []

        with config_file.open("r", encoding="utf-8") as f:
            config = yaml.safe_load(f)

        if not isinstance(config, dict):
            return []

        models = config.get("models", {})
        if not isinstance(models, dict):
            return []

        return sorted(models.keys())
    except Exception:
        return []

confirm_or_exit

confirm_or_exit(message: str) -> bool

Prompt for confirmation and return whether the user accepted.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def confirm_or_exit(message: str) -> bool:
    """Prompt for confirmation and return whether the user accepted."""
    try:
        response = input(f"{message} [y/N]: ").strip().lower()
        return response in ("y", "yes")
    except (EOFError, KeyboardInterrupt):
        print("\nAborted.", file=sys.stderr)
        return False

resolve_task_ref

resolve_task_ref(task: str) -> str

Resolve a short or canonical task id to a canonical group/task ref.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def resolve_task_ref(task: str) -> str:
    """Resolve a short or canonical task id to a canonical group/task ref."""
    _, Task, _ = _import_abc_runner()

    try:
        resolved = Task(task, _abc_runner_resolver())
    except FileNotFoundError:
        print(f"WARNING: Task '{task}' not found in installed abc-runner", file=sys.stderr)
        raise SystemExit(2)
    except ValueError as exc:
        print(f"ERROR: {exc}", file=sys.stderr)
        raise SystemExit(2)

    return resolved.task_ref

validate_task

validate_task(task: str, force: bool = False) -> bool

Validate a task id against installed abc-runner.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def validate_task(task: str, force: bool = False) -> bool:
    """Validate a task id against installed abc-runner."""
    available_tasks = get_available_tasks()

    if task in available_tasks:
        return True

    if "/" not in task:
        try:
            resolve_task_ref(task)
            return True
        except SystemExit:
            if force:
                return True
            return False

    if force:
        return True

    print(f"WARNING: Task '{task}' not found in installed abc-runner", file=sys.stderr)
    print(f"Available tasks: {', '.join(available_tasks[:10])}", file=sys.stderr)
    if len(available_tasks) > 10:
        print(f"... and {len(available_tasks) - 10} more", file=sys.stderr)

    return confirm_or_exit("Continue anyway?")

validate_task_group

validate_task_group(task_group: str, force: bool = False) -> bool

Validate a task group id against installed abc-runner.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def validate_task_group(task_group: str, force: bool = False) -> bool:
    """Validate a task group id against installed abc-runner."""
    available_groups = get_available_task_groups()

    if task_group in available_groups:
        return True

    if force:
        return True

    print(f"WARNING: Task group '{task_group}' not found in installed abc-runner", file=sys.stderr)
    print(f"Available task groups: {', '.join(available_groups)}", file=sys.stderr)

    return confirm_or_exit("Continue anyway?")

validate_agent

validate_agent(agent: str, config_path: str | None = None, force: bool = False) -> bool

Validate an agent id, optionally allowing user confirmation.

Source code in abc-ci-launcher/src/abc_ci_launcher/validate.py
def validate_agent(agent: str, config_path: str | None = None, force: bool = False) -> bool:
    """Validate an agent id, optionally allowing user confirmation."""
    available_agents = get_available_agents(config_path)

    if agent in available_agents:
        return True

    if force:
        return True

    print(f"WARNING: Agent '{agent}' not found in installed abc-runner config", file=sys.stderr)
    print(f"Available agents: {', '.join(available_agents)}", file=sys.stderr)

    return confirm_or_exit("Continue anyway?")