"""Shared registration helper for AP2.0 method stubs — AP2.3e data_slices.""" from __future__ import annotations from typing import Literal from steering.lifecycle.states import STANDARD_LIFECYCLE_STEPS from steering.methods.registry import MethodDefinition, get_method, register_method _PRODUCT_LIKE_STEPS = ( "intake", "method_selection", "structure_setup", "planning", "action_selection", "assignment", "waiting", "result_intake", "validation", "review", "adaptation", "closure", ) _LIGHT_STEPS = ( "intake", "structure_setup", "action_selection", "assignment", "waiting", "review", "adaptation", "closure", ) SLICES_OM_STANDARD = frozenset( { "backlog", "actions", "roadmap", "projects", "blockers", "evidence", "decisions", "reviews", "steering_methods", } ) SLICES_PRODUCT = SLICES_OM_STANDARD | frozenset({"work_cycles"}) SLICES_QUEUE = frozenset({"backlog", "actions", "blockers", "steering_methods"}) SLICES_MATURITY = frozenset( { "actions", "roadmap", "blockers", "evidence", "decisions", "reviews", "recurring", "steering_methods", } ) SLICES_RECURRING = frozenset( {"actions", "roadmap", "recurring", "blockers", "steering_methods"} ) SLICES_PROGRAM = SLICES_OM_STANDARD | frozenset({"work_cycles"}) SLICES_GENERIC = SLICES_OM_STANDARD SLICES_AGILE = SLICES_PRODUCT def register_stub_method( *, key: str, label: str, description: str, next_action_strategy_key: str = "default", lifecycle_steps: tuple[str, ...] | None = None, data_slices: frozenset[str] | None = None, compatible_archetype_keys: frozenset[str] | Literal["*"] = "*", ) -> None: if get_method(key): return register_method( MethodDefinition( key=key, version="0.1.0", label=label, description=description, default_lifecycle_steps=lifecycle_steps or STANDARD_LIFECYCLE_STEPS, next_action_strategy_key=next_action_strategy_key, data_slices=data_slices or SLICES_GENERIC, compatible_archetype_keys=compatible_archetype_keys, ) ) def register_product_like_method( *, key: str, label: str, description: str, next_action_strategy_key: str, data_slices: frozenset[str] | None = None, compatible_archetype_keys: frozenset[str] | Literal["*"] | None = None, ) -> None: register_stub_method( key=key, label=label, description=description, next_action_strategy_key=next_action_strategy_key, lifecycle_steps=_PRODUCT_LIKE_STEPS, data_slices=data_slices or SLICES_PRODUCT, compatible_archetype_keys=compatible_archetype_keys if compatible_archetype_keys is not None else frozenset({"initiative.product"}), )