Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/base-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ ctx.run_id # str
ctx.base_home # Path | None
ctx.project_root # Path | None
ctx.manifest_path # Path | None
ctx.workspace_root # configured workspace root, or None
ctx.state_dir # Base cache root / cli / <cli-name>
ctx.log_dir # state_dir/logs
ctx.cache_dir # state_dir/cache
Expand All @@ -138,6 +139,7 @@ ctx.environment # str
ctx.debug # bool
ctx.dry_run # bool
ctx.keep_temp # bool
ctx.quiet # bool
ctx.log # logging.Logger
```

Expand Down
24 changes: 24 additions & 0 deletions tests/test_base_cli_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import re
from dataclasses import fields
from pathlib import Path

from base_cli.context import Context


REPO_ROOT = Path(__file__).resolve().parents[1]
BASE_CLI_DOC = REPO_ROOT / "docs" / "base-cli.md"
INTERNAL_CONTEXT_FIELDS = {"cleanup_hooks"}


def context_section() -> str:
text = BASE_CLI_DOC.read_text(encoding="utf-8")
start = text.index("## Context")
end = text.index("## State Directories")
return text[start:end]


def test_base_cli_context_docs_list_public_context_fields() -> None:
documented_fields = set(re.findall(r"ctx\.([a-z_]+)", context_section()))
public_context_fields = {field.name for field in fields(Context)} - INTERNAL_CONTEXT_FIELDS

assert public_context_fields <= documented_fields
Loading