Skip to content

<BoilerplateTemplate>

The <BoilerplateTemplate> block renders Boilerplate templates inline or allows you to specify templates inline in your runbook. Like <BoilerplateInputs>, it uses the Boilerplate engine to generate files, but displays the rendered file directly in the markdown.

Both <BoilerplateInputs> and <BoilerplateTemplate> use the Boilerplate engine to generate files. The key differences are:

  • <BoilerplateInputs>: Generates files and saves them to your workspace (persisted), can reference template directories
  • <BoilerplateTemplate>: Generates files, displays content inline, allows inline template specification

Use <BoilerplateTemplate> when you want to:

  • Show users a preview of what will be generated
  • Display generated configuration inline
  • Debug template rendering
  • Generate content for display rather than file creation
<BoilerplateInputs id="config">
```yaml
variables:
- name: ServiceName
type: string
description: Name of the service
default: my-service
- name: Port
type: int
description: Port number
default: 8080
```
</BoilerplateInputs>
<BoilerplateTemplate boilerplateInputsId="config">
```yaml
# config.yaml
service:
name: {{ .ServiceName }}
port: {{ .Port }}
enabled: true
```
</BoilerplateTemplate>
  • boilerplateInputsId (string) - ID of the BoilerplateInputs block to get variables from
  • outputPath (string) - Optional subdirectory name for the generated files in the preview
    • Security: Must be a relative path without .. (e.g., prod, environments/staging)
    • Will be created as a subdirectory within the CLI-configured output path
    • Absolute paths and directory traversal attempts are blocked for security
  • children (ReactNode) - Inline template content to render
  1. User fills out the BoilerplateInputs form
  2. BoilerplateTemplate automatically uses the Boilerplate engine to generate files with the current variable values
  3. Files are generated to temporary directories, read for display, then immediately cleaned up
  4. Generated content is displayed in the UI with syntax highlighting
  5. No files are persisted to your workspace (only shown in the UI)
<BoilerplateInputs id="docker-config">
```yaml
variables:
- name: AppName
type: string
- name: NodeVersion
type: string
default: "18"
```
</BoilerplateInputs>
<BoilerplateTemplate boilerplateInputsId="docker-config">
```dockerfile
FROM node:{{ .NodeVersion }}-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
```
</BoilerplateTemplate>

You can have multiple BoilerplateTemplate blocks referencing the same BoilerplateInputs:

<BoilerplateInputs id="app-config">
```yaml
variables:
- name: AppName
type: string
- name: Environment
type: enum
options: [dev, prod]
```
</BoilerplateInputs>
### Application Configuration
<BoilerplateTemplate boilerplateInputsId="app-config" outputPath="config.yaml">
```yaml
app:
name: {{ .AppName }}
environment: {{ .Environment }}
```
</BoilerplateTemplate>
### Environment Variables
<BoilerplateTemplate boilerplateInputsId="app-config" outputPath=".env">
```bash
APP_NAME={{ .AppName }}
ENVIRONMENT={{ .Environment }}
```
</BoilerplateTemplate>

You can use full Boilerplate template syntax:

<BoilerplateInputs id="terraform-config">
```yaml
variables:
- name: Environment
type: enum
options: [dev, prod]
- name: InstanceType
type: string
default: t3.micro
- name: EnableMonitoring
type: bool
default: false
```
</BoilerplateInputs>
<BoilerplateTemplate boilerplateInputsId="terraform-config">
```hcl
resource "aws_instance" "app" {
ami = "ami-12345678"
instance_type = "{{ .InstanceType }}"
tags = {
Name = "app-{{ .Environment }}"
Environment = "{{ .Environment }}"
}
{{- if .EnableMonitoring }}
monitoring = true
{{- end }}
}
```
</BoilerplateTemplate>

The template automatically re-renders whenever the user changes values in the linked BoilerplateInputs form (with debouncing for performance).

Rendered content is displayed with appropriate syntax highlighting based on the file extension or language hint.

When multiple BoilerplateTemplate blocks reference the same BoilerplateInputs, they’re organized in a file tree view.

If template rendering fails (e.g., invalid Boilerplate syntax), an error message is displayed.

You can organize templates in a directory structure using the outputPath prop:

<BoilerplateTemplate boilerplateInputsId="config" outputPath="terraform/main.tf">
...
</BoilerplateTemplate>
<BoilerplateTemplate boilerplateInputsId="config" outputPath="terraform/variables.tf">
...
</BoilerplateTemplate>
<BoilerplateTemplate boilerplateInputsId="config" outputPath="scripts/deploy.sh">
...
</BoilerplateTemplate>

Use Boilerplate’s conditional logic:

<BoilerplateTemplate boilerplateInputsId="config">
```hcl
{{- if eq .Environment "prod" }}
# Production configuration
resource "aws_instance" "app" {
instance_type = "t3.large"
monitoring = true
}
{{- else }}
# Development configuration
resource "aws_instance" "app" {
instance_type = "t3.micro"
monitoring = false
}
{{- end }}
```
</BoilerplateTemplate>
  • Templates must be inline (cannot reference template directories like BoilerplateInputs can)
  • Generated files are not persisted to your workspace (only displayed in the UI)
  • Cannot include other template files (no {{ template "file.txt" }} support)
  • Best for simple, single-file templates or small sets of templates