# cli

URL: /kida/api/cli/
Section: api
Description: Command-line interface for Kida (``kida check``, future subcommands).

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/cli/index.txt)

Share with AI

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

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

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

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

Module

#
`cli`

Command-line interface for Kida (`kida check`, future subcommands).

2Classes14Functions

## Classes

`_ComponentParamRow`

4

▼

#### Attributes

Name
Type
Description

`name`

`str`

—

`annotation`

`str | None`

—

`has_default`

`bool`

—

`required`

`bool`

—

`_ComponentRow`

9

▼

#### Attributes

Name
Type
Description

`name`

`str`

—

`template`

`str`

—

`lineno`

`int`

—

`params`

`list[_ComponentParamRow]`

—

`slots`

`list[str]`

—

`has_default_slot`

`bool`

—

`depends_on`

`list[str]`

—

`vararg`

`str | None`

—

`kwarg`

`str | None`

—

## Functions

`_iter_templates`

1

`list[Path]`

▼

Collect template files matching all known extensions, sorted.

`def _iter_templates(root: Path) -> list[Path]`

##### Parameters

Name
Type
Description

`root`
`Path`

##### Returns

`list[Path]`

`_cmd_check`

6

`int`

▼

Parse every template under *template_dir*; exit non-zero on failure.

`def _cmd_check(template_dir: Path, *, strict: bool, validate_calls: bool, a11y: bool, typed: bool, lint_fragile_paths: bool) -> int`

##### Parameters

Name
Type
Description

`template_dir`
`Path`

`strict`
`bool`

`validate_calls`
`bool`

`a11y`
`bool`

`typed`
`bool`

`lint_fragile_paths`
`bool`

##### Returns

`int`

`_format_pot`

2

`str`

▼

Format extracted messages as a PO template (.pot) file.

`def _format_pot(messages: list[ExtractedMessage], *, template_dir: Path | None = None) -> str`

##### Parameters

Name
Type
Description

`messages`
`list[ExtractedMessage]`

`template_dir`
`Path | None`

Default:`None`

##### Returns

`str`

`_pot_escape`

1

`str`

▼

Escape a string for POT file output.

`def _pot_escape(s: str) -> str`

##### Parameters

Name
Type
Description

`s`
`str`

##### Returns

`str`

`_cmd_extract`

3

`int`

▼

Extract translatable messages from templates under *template_dir*.

`def _cmd_extract(template_dir: Path, *, output: Path | None, extensions: list[str]) -> int`

##### Parameters

Name
Type
Description

`template_dir`
`Path`

`output`
`Path | None`

`extensions`
`list[str]`

##### Returns

`int`

`_cmd_fmt`

3

`int`

▼

Format template files.

`def _cmd_fmt(paths: list[Path], *, indent: int, check_only: bool) -> int`

##### Parameters

Name
Type
Description

`paths`
`list[Path]`

`indent`
`int`

`check_only`
`bool`

##### Returns

`int`

`_ast_contains`

2

`bool`

▼

Check if a Kida AST tree contains any node of the given type.

`def _ast_contains(node: object, cls: type) -> bool`

##### Parameters

Name
Type
Description

`node`
`object`

`cls`
`type`

##### Returns

`bool`

`_print_explain`

2

`None`

▼

Print which compile-time optimizations are active for this template.

`def _print_explain(env: Environment, tpl: object) -> None`

##### Parameters

Name
Type
Description

`env`
`Environment`

`tpl`
`object`

`_cmd_render`

11

`int`

▼

Render a single template to stdout.

`def _cmd_render(template_path: Path, *, data_file: Path | None, data_str: str | None, data_format: str, width: int | None, color: str | None, mode: str, stream: bool = False, stream_delay: float = 0.02, explain: bool = False, set_vars: list[str] | None = None) -> int`

##### Parameters

Name
Type
Description

`template_path`
`Path`

`data_file`
`Path | None`

`data_str`
`str | None`

`data_format`
`str`

`width`
`int | None`

`color`
`str | None`

`mode`
`str`

`stream`
`bool`

Default:`False`

`stream_delay`
`float`

Default:`0.02`

`explain`
`bool`

Default:`False`

`set_vars`
`list[str] | None`

Default:`None`

##### Returns

`int`

`_cmd_components`

3

`int`

▼

List all ``{% def %}`` components across templates in *template_dir*.

`def _cmd_components(template_dir: Path, *, json_output: bool, filter_name: str | None) -> int`

##### Parameters

Name
Type
Description

`template_dir`
`Path`

`json_output`
`bool`

`filter_name`
`str | None`

##### Returns

`int`

`_cmd_readme`

7

`int`

▼

Generate a README from auto-detected project metadata.

`def _cmd_readme(root: Path, *, output: Path | None, preset: str | None, template: Path | None, set_vars: list[str] | None, depth: int, dump_json: bool) -> int`

##### Parameters

Name
Type
Description

`root`
`Path`

`output`
`Path | None`

`preset`
`str | None`

`template`
`Path | None`

`set_vars`
`list[str] | None`

`depth`
`int`

`dump_json`
`bool`

##### Returns

`int`

`_cmd_manifest`

4

`int`

▼

Render templates and output a capture manifest as JSON.

`def _cmd_manifest(template_dir: Path, *, output: Path | None, data_file: Path | None, search: bool) -> int`

##### Parameters

Name
Type
Description

`template_dir`
`Path`

`output`
`Path | None`

`data_file`
`Path | None`

`search`
`bool`

##### Returns

`int`

`_cmd_diff`

2

`int`

▼

Semantic diff between two render manifests.

`def _cmd_diff(old_path: Path, new_path: Path) -> int`

##### Parameters

Name
Type
Description

`old_path`
`Path`

`new_path`
`Path`

##### Returns

`int`

`main`

1

`int`

▼

Entry point for ``python -m kida`` / the ``kida`` console script.

`def main(argv: list[str] | None = None) -> int`

##### Parameters

Name
Type
Description

`argv`
`list[str] | None`

Default:`None`

##### Returns

`int`
