Generated Files
When you use a Runbook, files are generated locally on your machine. This page explains how file generation works and where those files end up.
How files are generated
Section titled “How files are generated”Files can be generated in two ways:
1. Template blocks
Section titled “1. Template blocks”The Template and TemplateInline blocks generate files from Boilerplate templates. When you fill in the form fields and click “Generate”, the template engine processes your inputs and creates the output files.
<Template id="vpc-setup" path="templates/vpc" />Template blocks automatically re-render when you change input values, so your generated files stay in sync with the form.
2. Command blocks with $RUNBOOKS_OUTPUT
Section titled “2. Command blocks with $RUNBOOKS_OUTPUT”Command blocks can write files to the $RUNBOOKS_OUTPUT environment variable to capture them:
<Command id="export-terraform" command={`tofu output -json > "$RUNBOOKS_OUTPUT/tf-outputs.json"`} title="Export Terraform outputs"/>Any files written to $RUNBOOKS_OUTPUT automatically appear in your generated files after the command completes successfully.
Where files are stored
Section titled “Where files are stored”Generated files are persisted to a folder on your local machine—they’re not ephemeral or stored in memory.
Default location
Section titled “Default location”By default, generated files are written to a generated/ folder in the current working directory (the directory you run the runbooks command from):
Directorygenerated/ ← Created in your current working directory
- main.tf
- variables.tf
- outputs.tf
Customizing the output path
Section titled “Customizing the output path”You can change where generated files are written using the --output-path flag:
# Write to a custom folderrunbooks open my-runbook --output-path ./infrastructure
# Nested subdirectoryrunbooks open my-runbook --output-path ./projects/acme/infraRelative paths are resolved from the current working directory.
Subdirectories within templates
Section titled “Subdirectories within templates”Within a runbook, you can organize generated files into subdirectories:
- Template blocks: The directory structure of your template folder is preserved in the output.
- TemplateInline blocks: Use the
outputPathprop to specify a path likeconfig/app.yaml. - Command/Check blocks: Create subdirectories within
$RUNBOOKS_OUTPUT.
# In your command scriptmkdir -p "$RUNBOOKS_OUTPUT/config"echo '{}' > "$RUNBOOKS_OUTPUT/config/app.json"Viewing generated files
Section titled “Viewing generated files”When files are generated, they appear in the file panel on the right side of the Runbooks UI. You can:
- Browse the file tree
- Click files to view their contents
- Copy file contents to clipboard
- See which files changed after each render
Security: Where files can be written
Section titled “Security: Where files can be written”Runbooks enforces strict rules about where files can be written to protect your system:
Path restrictions
Section titled “Path restrictions”| Rule | Description |
|---|---|
| Within working directory | All paths must resolve to locations within your current working directory |
| No directory traversal | Paths containing .. (like ../../../etc/passwd) are rejected |
| No system directories | Protected directories like /etc, /usr, C:\Windows are blocked |
Protected directories
Section titled “Protected directories”Runbooks blocks writes to system-critical directories:
/,/etc,/usr,/bin,/var,/home,/rootC:\,C:\Windows,C:\Program Files,C:\Users
Now that you understand how generated files work, explore the use cases where Runbooks shines.