Coverage for src / lexigram / contracts / cli / types.py: 100%
21 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-19 05:41 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-19 05:41 +0800
1from __future__ import annotations
3from dataclasses import dataclass, field
6@dataclass(frozen=True)
7class GeneratorOption:
8 """A single CLI option/flag accepted by a generator command.
10 Used for auto-generated help text and input validation.
11 """
13 name: str
14 type_hint: str # e.g. "str", "bool", "int"
15 required: bool = False
16 default: object | None = None
17 description: str = ""
18 short_flag: str | None = None # e.g. "-n"
21@dataclass(frozen=True)
22class GeneratorDefinition:
23 """Describes a single executable scaffolding generator contributed to the CLI.
25 Generators are discovered via ``CliContributorProtocol.get_generators()``
26 and assembled into the unified ``gen`` command by ``CommandAssembler``.
27 ``generator_path`` is required so every definition can be executed once it
28 has been discovered and registered.
29 """
31 name: str
32 title: str
33 description: str
34 contributor: str # contributor_id of the owning contributor
35 generator_path: str
36 category: str = "general"
37 options: tuple[GeneratorOption, ...] = field(default_factory=tuple)
38 default_output_dir: str = "src"
41__all__ = ["GeneratorDefinition", "GeneratorOption"]