ledger.mkdocs.adr.cli
CLI commands for creating and managing ADRs/MADRs.
This module provides command-line tools for managing Architecture Decision Records (ADRs) following the MADR 4.0 template specification.
See: - https://adr.github.io/ for ADR documentation - https://adr.github.io/madr/ for MADR template documentation
Classes:
-
ADRDict
–Dictionary representation of an ADR/MADR document.
-
Context
–Common context object for CLI commands containing shared parameters.
-
ThemedConsole
–
Functions:
-
adr_to_dict
–Convert an ADRDocument to a normalized dictionary.
-
cli
–ADR/MADR management helpers
-
get_jinja_env
–Get a configured Jinja2 environment.
-
get_next_adr_index
–Get the next ADR/MADR index by scanning existing files.
-
list_adrs
–List ADR/MADR documents in a directory.
-
new_adr
–Create a new ADR/MADR document.
-
slugify
–Convert title to a URL-friendly slug.
Attributes:
ALLOWED_STATUSES
module-attribute
LEDGER_THEME
module-attribute
LEDGER_THEME = Theme({'success': 'bold green', 'warning': 'bold yellow', 'error': 'bold red', 'info': 'bold blue', 'muted': 'dim', 'prompt': 'bold cyan', 'adr.index': 'cyan', 'adr.title': 'bold', 'adr.status': 'green', 'adr.date': 'dim'})
ADRDict
Context
dataclass
Context(directory: Path, out: ThemedConsole, err: Console)
Common context object for CLI commands containing shared parameters.
Attributes:
-
directory
(Path
) – -
err
(Console
) – -
out
(ThemedConsole
) –
ThemedConsole
Bases: Console
Methods:
-
ask
–Ask with style
-
ask_multiple
–Ask user repeatedly for multiple values until empty input.
ask
ask_multiple
Ask user repeatedly for multiple values until empty input.
Source code in ledger/mkdocs/adr/cli.py
adr_to_dict
Convert an ADRDocument to a normalized dictionary.
Parameters:
-
doc
ADRDocument
) –ADRDocument to convert.
Returns: Normalized ADR dictionary with defaults.
Source code in ledger/mkdocs/adr/cli.py
cli
cli(ctx: Context, directory: Path)
ADR/MADR management helpers
Source code in ledger/mkdocs/adr/cli.py
get_jinja_env
get_next_adr_index
Get the next ADR/MADR index by scanning existing files.
list_adrs
List ADR/MADR documents in a directory.
Source code in ledger/mkdocs/adr/cli.py
new_adr
new_adr(ctx: Context, title: str | None, status: str, decider: tuple[str, ...], consulted: tuple[str, ...], informed: tuple[str, ...])
Create a new ADR/MADR document.
Source code in ledger/mkdocs/adr/cli.py
slugify
Convert title to a URL-friendly slug.