Core Engine API Reference¶
Reference for sayer/core/engine.py, which defines command/group decorators and parameter binding behavior.
command(...)¶
Transforms a Python function into a Click command with Sayer runtime behavior.
Supports¶
- typed parameter conversion
Option,Argument,Env,JsonParam- middleware resolution and execution
click.ContextandStateinjection- async command execution
Signature modes¶
@command
@command()
@command("custom-name")
@command(name="custom-name", hidden=True)
@command(middleware=[...])
group(name, group_cls=None, help=None, is_custom=False, custom_command_name=None, **kwargs)¶
Creates or retrieves a group and patches its .command method to use Sayer's command decorator.
build_click_parameter(...)¶
Internal helper that converts an inspected function parameter plus metadata into the correct Click option/argument decorator.
Registries¶
COMMANDS: global registry of top-level commandsGROUPS: global registry of groups
Utility Functions¶
get_commands()get_groups()bind_command_to_group(...)
Runtime Flow¶
- Inspect function signature and type hints.
- Build Click parameters from metadata.
- Bind and convert parsed values at invocation.
- Inject state/context.
- Execute middleware and command function.
- Return value to Click/testing layers.