inspect

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

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…

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

class ProvideRecord

A{% provide _key = ... %}statement found in a chirp-ui template.

Jump to symbol
class ConsumeRecord

Aconsume("_key", default)call found in a chirp-ui template.

Jump to symbol
class AuditReport

Result ofaudit_provide_consume() — context-flow health at a glance.

  • dead_provides{% provide %}statements whose key is never consume()d anywhere in…
Jump to symbol
function _parse_provide_annotation

Parse the body of a@providesannotation into a tuple of consumer macro names.

Jump to symbol
function _parse_consumes_annotation

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…

Jump to symbol
function _strip_default

Normalize a consume() default literal: strip quotes/whitespace.

Jump to symbol
function list_provides

Walk every chirp-ui template and return each{% provide %}statement.

Statements adjacent to a{# @provides _key — consumed by: ... #}annotation…

Jump to symbol
function list_consumes

Walk every chirp-ui template and return eachconsume(...)call.

Calls adjacent to a{# @consumes _key from: ... — falls back to ... #}…

Jump to symbol
function _macro_to_template_map

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…

Jump to symbol
function audit_provide_consume

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…

Jump to symbol
function main Jump to symbol
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 never consume()d anywhere in the bundled templates. Some are legitimate (reserved for apps to extend); apps should pin an allow-list.
  • unprovided_consumesconsume()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 @provides annotation names a consumer macro that lacks a matching@consumes annotation 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