docs(standards): vendor template into MCP bundle; add component tools + start_app prompt
This commit is contained in:
29
standards/mcp/templates/app/pipelines/shared/registry.py
Normal file
29
standards/mcp/templates/app/pipelines/shared/registry.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""# Summary
|
||||
|
||||
Family registry — resolve a ``(kind, variant, mode)`` triple to a root class.
|
||||
|
||||
A single lookup replaces hand-rolled ``if/else`` family selection.
|
||||
"""
|
||||
from typing import Dict, Type
|
||||
|
||||
# Populated by ``register`` as families import.
|
||||
_FAMILIES: Dict[str, Dict[str, Dict[str, Type]]] = {}
|
||||
|
||||
|
||||
def register(kind: str, variant: str, root_cls: Type, mode: str = "default") -> Type:
|
||||
"""Register ``root_cls`` for a ``(kind, variant, mode)`` triple.
|
||||
|
||||
Returns:
|
||||
Type: The registered class (so it can be used as a decorator).
|
||||
"""
|
||||
_FAMILIES.setdefault(kind, {}).setdefault(variant, {})[mode] = root_cls
|
||||
return root_cls
|
||||
|
||||
|
||||
def resolve_root(kind: str, variant: str, mode: str = "default") -> Type:
|
||||
"""Return the root class for a ``(kind, variant, mode)`` triple.
|
||||
|
||||
Raises:
|
||||
KeyError: When no family matches the triple.
|
||||
"""
|
||||
return _FAMILIES[kind][variant][mode]
|
||||
Reference in New Issue
Block a user