vibe.jinja_context¶
VibeContext - Custom Jinja2 context for VIBE template rendering.
This module provides a custom Jinja context that cleanly separates: - Template data (NestedValue) - accessible via normal variable access - Internal context (host_template, current_state, etc.) - stored as instance attrs
This eliminates the need for INTERNAL_KEYS filtering and cleanup passes.
Usage in templates remains unchanged
{{ variable_name }} -> Accesses template data {% if _is_probing %}... -> Accesses internal context
Usage in Python (Jinja functions): ctx["_host_template"] -> Works via getitem override ctx.get("_is_probing", False) -> Works via get override
VibeContext ¶
Custom Jinja context that stores internal keys as instance attributes.
Internal keys (prefixed with _) are stored separately from template data, so they don't pollute iteration and don't need cleanup.
| Attributes: |
|
|---|
resolve_or_missing ¶
resolve_or_missing(key: str) -> object
Resolve a variable, checking internal attrs first.
get ¶
get(key: str, default: object | None = None) -> object | None
Get item with default, checking internal attrs first.
derived ¶
derived(locals: dict[str, Any] | None = None) -> VibeContext
Create a derived context, preserving internal attrs.
VibeProbeContext ¶
Extended context for probe phase with placeholder resolution.
Inherits all VibeContext functionality and adds: - Placeholder resolution for undefined variables
resolve_or_missing ¶
resolve_or_missing(key: str) -> object
Resolve a variable, using placeholder if not found.
derived ¶
derived(locals: dict[str, Any] | None = None) -> VibeProbeContext
Create a derived context, preserving placeholder resolver.