from __future__ import annotations from typing import Dict from .config import TaskConfig class TaskRegistry: """ Holds named task configs for reuse. """ _registry: Dict[str, TaskConfig] = {} @classmethod def register(cls, task: TaskConfig) -> TaskConfig: cls._registry[task.name] = task return task @classmethod def get(cls, name: str) -> TaskConfig: if name not in cls._registry: raise KeyError(f"Task '{name}' is not registered.") return cls._registry[name] @classmethod def available(cls) -> Dict[str, TaskConfig]: return dict(cls._registry)