Design system introspection — dump the chirp-ui API surface.
Usage::
python -m chirp_ui.inspect # JSON report
python -m chirp_ui.inspect --summary # compact table
python -m chirp_ui.inspect --tokens # token catalog only
python -m chirp_ui.inspect --components # component descriptors only
python -m chirp_ui.inspect --provides # {% provide %} statements + annotations
python -m chirp_ui.inspect --consumes # consume() calls + annotations
python -m chirp_ui.inspect --audit-context # dead provides, unprovided consumes, annotation drift
inspect
| 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
A{% provide _key = ... %}statement found in a chirp-ui template.
Aconsume("_key", default)call found in a chirp-ui template.
Result ofaudit_provide_consume() — context-flow health at a glance.
dead_provides—{% provide %}statements whose key is neverconsume()d anywhere in…
Parse the body of a@providesannotation into a tuple of consumer macro names.
Parse one or more_key from: providers clauses inside a @consumesannotation.
Handles compound annotations like:
_card_variant from: card, _surface_variant from: panel, surface
by…
Normalize a consume() default literal: strip quotes/whitespace.
Walk every chirp-ui template and return each{% provide %}statement.
Statements adjacent to a{# @provides _key — consumed by: ... #}annotation…
Walk every chirp-ui template and return eachconsume(...)call.
Calls adjacent to a{# @consumes _key from: ... — falls back to ... #}…
Index every{% def macro_name %}to the template file(s) it's defined in.
Most macros have one definition; a few share names across files…
Audit chirp-ui's provide/consume graph against the templates.
Returns anAuditReportwith three diagnostics: dead provides (provided but never consumed), unprovided consumes (consumed but never…
ProvideRecord
class
A{% provide _key = ... %}statement found in a chirp-ui template.
ConsumeRecord
class
Aconsume("_key", default)call found in a chirp-ui template.
AuditReport
class
Result ofaudit_provide_consume() — context-flow health at a glance.
dead_provides—{% provide %}statements whose key is neverconsume()d anywhere in the bundled templates. Some are legitimate (reserved for apps to extend); apps should pin an allow-list.unprovided_consumes—consume()calls whose key is never{% provide %}d in the bundled templates. Usually means the value is expected to come from app code (see_sse_state).annotation_drift— human-readable diagnostics where a@providesannotation names a consumer macro that lacks a matching@consumesannotation for the same key. Flags rotted documentation.
_parse_provide_annotation
function
def _parse_provide_annotation(body: str) -> tuple[str, ...]
Parse the body of a@providesannotation into a tuple of consumer macro names.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
body
|
str
|
— |
_parse_consumes_annotation
function
def _parse_consumes_annotation(inner: str) -> list[tuple[str, tuple[str, ...]]]
Parse one or more_key from: providers clauses inside a @consumesannotation.
Handles compound annotations like:
_card_variant from: card, _surface_variant from: panel, surface
by splitting only at boundaries between distinct keys.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
inner
|
str
|
— |
_strip_default
function
def _strip_default(raw: str) -> str
Normalize a consume() default literal: strip quotes/whitespace.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
raw
|
str
|
— |
list_provides
function
def list_provides() -> list[ProvideRecord]
Walk every chirp-ui template and return each{% provide %}statement.
Statements adjacent to a{# @provides _key — consumed by: ... #}annotation
have theirconsumed_by populated and raw_annotationset; statements
without an annotation have empty defaults so callers can detect undocumented
providers.
No parameters.
list_consumes
function
def list_consumes() -> list[ConsumeRecord]
Walk every chirp-ui template and return eachconsume(...)call.
Calls adjacent to a{# @consumes _key from: ... — falls back to ... #}
annotation have theirproviders, fallback, and raw_annotation
populated; calls without an annotation fall back to the inline default
literal (or""if none).
No parameters.
_macro_to_template_map
function
def _macro_to_template_map() -> dict[str, tuple[str, ...]]
Index every{% def macro_name %}to the template file(s) it's defined in.
Most macros have one definition; a few share names across files (e.g.
segmented_control lives in both forms.htmland
segmented_control.html). Returning a tuple keeps the drift check
tolerant of these overlaps.
No parameters.
audit_provide_consume
function
def audit_provide_consume() -> AuditReport
Audit chirp-ui's provide/consume graph against the templates.
Returns anAuditReportwith three diagnostics: dead provides
(provided but never consumed), unprovided consumes (consumed but never
provided in bundled templates — usually an app-side provider is expected),
and annotation drift (@provideslists a consumer that has no matching
@consumesfor the same key).
No parameters.
main
function
def main(argv: list[str] | None = None) -> None
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
argv
|
list[str] | None
|
None
|
View source · /home/runner/work/chirp-ui/chirp-ui/site/../src/chirp_ui/inspect.py:1