Prompt catalog with optional overrides and cached runtime loading.
Summary
Functions
Returns the prompt body for the given key, checking the override store first, then falling back to the cached prompt's body.
Returns the configured prompt root directory, falling back to
config/comm_bus/prompts relative to the project root.
Fetches a cached prompt by its key (slug, name, or path), raising if not found.
Returns all cached prompts as a list, loading from disk if not yet cached.
Loads all prompt files from the configured root directory, caches them in
:persistent_term, and returns the prompt map.
Reloads all prompts from disk, refreshing the :persistent_term cache.
Renders a prompt by key with the given variables, applying any active override before rendering. Raises on failure.
Functions
Returns the prompt body for the given key, checking the override store first, then falling back to the cached prompt's body.
Parameters
key— The prompt identifier string.opts— Keyword options forwarded to the override store.
Returns
The prompt body as a String.t().
@spec default_root() :: String.t()
Returns the configured prompt root directory, falling back to
config/comm_bus/prompts relative to the project root.
Returns
A string path to the prompt directory.
@spec get_prompt!(String.t()) :: CommBus.Template.Prompt.t()
Fetches a cached prompt by its key (slug, name, or path), raising if not found.
Parameters
key— The prompt identifier string.
Returns
A %CommBus.Template.Prompt{} struct.
Raises
Raises if no prompt matches the given key.
@spec list_prompts() :: [CommBus.Template.Prompt.t()]
Returns all cached prompts as a list, loading from disk if not yet cached.
Returns
A list of %CommBus.Template.Prompt{} structs.
Loads all prompt files from the configured root directory, caches them in
:persistent_term, and returns the prompt map.
Parameters
opts— Keyword options::root(directory path),:schema(:devman,:human,:flex).
Returns
A map of prompt keys to %CommBus.Template.Prompt{} structs.
Raises
Raises if any prompt files fail validation.
@spec reload!() :: map()
Reloads all prompts from disk, refreshing the :persistent_term cache.
Returns
A map of prompt keys to %CommBus.Template.Prompt{} structs.
Renders a prompt by key with the given variables, applying any active override before rendering. Raises on failure.
Parameters
key— The prompt identifier string.vars— A map of template variable bindings.opts— Keyword options forwarded to the template engine.
Returns
The rendered content as a String.t().