Skip to main content

template_resolve_for_shell

Function template_resolve_for_shell 

Source
pub fn template_resolve_for_shell<'a>(
    template: &'a str,
    bindings: &ResolvedBindings,
    datastore: &RunContext,
) -> Result<Cow<'a, str>, NikaError>
Expand description

Resolve templates for shell context

Similar to resolve, but shell-escapes all substituted values to prevent command injection from LLM outputs containing special characters.

Example: echo 'Hello {{with.msg}}' with msg=“Nika’s test” becomes echo 'Hello '\''Nika'\''s test'\'''