Module

contracts.rules_commands

Invoker Commands validation — commandfor/command attribute checks.

The Invoker Commands API (baseline Jan 2026) enables declarative element relationships::

<button commandfor="my-dialog" command="show-modal">Open</button>
<dialog id="my-dialog">...</dialog>

check_commandfor_targets validates that commandforattribute values reference existing element IDs, similar to howcheck_hx_target_selectors validateshx-targetselectors.

check_command_values validates that commandattributes use recognized built-in commands (or valid custom--prefixedcommands).

Functions

check_commandfor_targets 2 tuple[list[ContractIssue…
Validate commandfor attribute values reference existing element IDs. Returns `…
def check_commandfor_targets(template_sources: dict[str, str], all_ids: set[str]) -> tuple[list[ContractIssue], int]

Validate commandfor attribute values reference existing element IDs.

Returns(issues, validated_count) like check_hx_target_selectors.

Parameters
Name Type Description
template_sources dict[str, str]
all_ids set[str]
Returns
tuple[list[ContractIssue], int]
check_command_values 1 list[ContractIssue]
Validate command attribute values are recognized built-in or valid custom comma…
def check_command_values(template_sources: dict[str, str]) -> list[ContractIssue]

Validate command attribute values are recognized built-in or valid custom commands.

Custom commands must use the--prefix convention (e.g., --my-action).

Parameters
Name Type Description
template_sources dict[str, str]
Returns
list[ContractIssue]