# components_cli

URL: /milo-cli/api/milo/components_cli/
Section: milo
Description: `milo components` — discover bundled and user-defined template components.

Walks the bundled ``src/milo/templates/components/`` tree (and any extra path
the caller supplies) and lists the ``{% def %}`` macros each template exposes.
Backed by Kida's ``Template.def_metadata()`` introspection.

---

> For a complete page index, fetch /milo-cli/llms.txt.

Open LLM text
(/milo-cli/api/milo/components_cli/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fcomponents_cli%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fcomponents_cli%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fcomponents_cli%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fcomponents_cli%2Findex.txt)

Module

#
`components_cli`

`milo components`— discover bundled and user-defined template components.

Walks the bundled`src/milo/templates/components/`tree (and any extra path
the caller supplies) and lists the`{% def %}`macros each template exposes.
Backed by Kida's`Template.def_metadata()`introspection.

2Functions

## Functions

`_collect_defs`

1

`list[dict[str, Any]]`

▼

Walk *roots* and return one row per (template_name, def_name) pair.

`def _collect_defs(roots: tuple[Path, ...]) -> list[dict[str, Any]]`

##### Parameters

Name
Type
Description

`roots`
`tuple[Path, ...]`

##### Returns

`list[dict[str, Any]]`

`run`

2

`int`

▼

Entry point used by ``milo components``. Returns exit code.

`def run(*, paths: tuple[Path, ...] = (), as_json: bool = False) -> int`

##### Parameters

Name
Type
Description

`paths`
`tuple[Path, ...]`

Default:`()`

`as_json`
`bool`

Default:`False`

##### Returns

`int`
