Module

cli.helpers.metadata

Command metadata system for discovery and documentation.

Classes

CommandMetadata dataclass
Metadata for a CLI command.
1

Metadata for a CLI command.

Attributes

Name Type Description
category str
description str
examples list[str]
requires_site bool
requires_build bool
tags list[str]
aliases list[str]

Methods 1

to_dict
Convert metadata to dictionary.
0 dict[str, Any]
def to_dict(self) -> dict[str, Any]

Convert metadata to dictionary.

Returns

dict[str, Any]

Functions

command_metadata
Decorator to attach metadata to a CLI command.
7 Callable[[F], F]
def command_metadata(category: str = 'general', description: str = '', examples: list[str] | None = None, requires_site: bool = False, requires_build: bool = False, tags: list[str] | None = None, aliases: list[str] | None = None) -> Callable[[F], F]

Decorator to attach metadata to a CLI command.

Parameters 7

Name Type Default Description
category str 'general'

Command category (e.g., 'build', 'content', 'config', 'dev')

description str ''

Short description of what the command does

examples list[str] | None None

Example usage strings

requires_site bool False

Whether this command requires a site to be loaded

requires_build bool False

Whether this command requires the site to be built first

tags list[str] | None None

Tags for filtering/discovery (e.g., ['dev', 'content', 'quick'])

aliases list[str] | None None

Command aliases (for discovery)

Returns

Callable[[F], F]

get_command_metadata
Get metadata from a command.
1 CommandMetadata | None
def get_command_metadata(cmd: click.Command | Callable[..., Any]) -> CommandMetadata | None

Get metadata from a command.

Parameters 1

Name Type Default Description
cmd click.Command | Callable[..., Any]

Click command or callable

Returns

CommandMetadata | None

CommandMetadata if found, None otherwise

list_commands_by_category
List all commands in a group, organized by category.
1 dict[str, list[clic…
def list_commands_by_category(group: click.Group) -> dict[str, list[click.Command]]

List all commands in a group, organized by category.

Parameters 1

Name Type Default Description
group click.Group

Click group to scan

Returns

dict[str, list[click.Command]]

Dictionary mapping category names to lists of commands

find_commands_by_tag
Find commands that have a specific tag.
2 list[tuple[str, cli…
def find_commands_by_tag(group: click.Group, tag: str) -> list[tuple[str, click.Command]]

Find commands that have a specific tag.

Parameters 2

Name Type Default Description
group click.Group

Click group to scan

tag str

Tag to search for

Returns

list[tuple[str, click.Command]]

List of (command_path, command) tuples