aeat.application.wizard._commands module

Typer command factory for wizard flows.

build_wizard_command(flow) returns a Typer-compatible callable whose signature is composed at construction time from the flow’s questions plus three fixed mode flags (--profile, --quiet, --accept-defaults). The closure walks the flow against a Prompter and persists the typed answers.

Flag derivation per question kind:

  • TEXT / SECRET / PATH--<question-id> str option (Path for PATH);

  • INTEGER--<question-id> int option;

  • CONFIRM--<question-id>/--no-<question-id> boolean pair;

  • SELECT--<question-id> option with click.Choice([c.value for c in choices]);

  • CHECKBOX → repeated --<question-id> option that accumulates a list[str].

The closure accepts a Prompter injection through the keyword-only _prompter parameter (not exposed as a Typer option) so tests can drive the flow without questionary interaction.

build_wizard_command(flow, *, mode)[source]

Return a Typer-compatible callable that runs flow.

The returned closure carries one parameter per question in the flow (typed and annotated for Typer to derive a CLI flag) plus the three mode flags. Tests can pass a custom prompter through the keyword-only _prompter slot (not surfaced as a Typer option).

mode binds the closure to a single wizard verb. "create" refuses a name that already has a manifest; "edit" refuses a name that has none. Both refusals fire before the wizard prompts, so an operator is never walked through 40-odd questions only to have the persistence step reject the work.

Return type:

Callable[..., None]

Parameters: