Class: TemplateExpander
Defined in: packages/core/src/application/template-expander.ts:36
Encapsulates {{namespace.key}} template expansion logic.
Receives built-in variables at construction time (e.g. project.root).
Each expansion call merges contextual variables with built-ins, where
built-in keys take precedence on collision.
Constructors
Constructor
new TemplateExpander(
builtins):TemplateExpander
Defined in: packages/core/src/application/template-expander.ts:44
Creates a new TemplateExpander with the given built-in variables.
Parameters
builtins
Variables always present in every expansion (e.g. { project: { root: '...' } })
Returns
TemplateExpander
Methods
expand()
expand(
template,variables?):string
Defined in: packages/core/src/application/template-expander.ts:57
Expands {{namespace.key}} tokens with verbatim substitution.
Used for instruction text consumed by agents — no shell escaping.
Parameters
template
string
The template string containing optional {{namespace.key}} tokens
variables?
Contextual variables merged with built-ins (built-ins win on collision)
Returns
string
The expanded string
expandForShell()
expandForShell(
template,variables?):string
Defined in: packages/core/src/application/template-expander.ts:70
Expands {{namespace.key}} tokens with shell-escaped substitution.
Used for run: hook commands — all values are shell-escaped to prevent injection.
Parameters
template
string
The command string containing optional {{namespace.key}} tokens
variables?
Contextual variables merged with built-ins (built-ins win on collision)
Returns
string
The expanded and shell-escaped string