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).
contracts.rules_commands
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
Validate commandfor attribute values reference existing element IDs.
Returns(issues, validated_count) like check_hx_target_selectors.
Validate command attribute values are recognized built-in or valid custom commands.
Custom commands must use the--prefix convention (e.g., --my-action).
check_commandfor_targets
function
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 | Default | Description |
|---|---|---|---|
template_sources
|
dict[str, str]
|
— | |
all_ids
|
set[str]
|
— |
check_command_values
function
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 | Default | Description |
|---|---|---|---|
template_sources
|
dict[str, str]
|
— |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/contracts/rules_commands.py:1