CLI Reference

butter compile

Compiles a .butter file to a Markdown prompt (default) or other formats like JSON and YAML.

butter compile [input file] [flags]

Flags

FlagShortDescription
--format-fOutput format (default: prompt). Supported: prompt, json, yaml
--output-oOutput path (default: <input>.prompt.md)
--checkValidate without generating output
--onlyCompile specific blocks only (e.g. endpoint:ProcessOrder)
--excludeExclude specific blocks (e.g. endpoint:HealthCheck)

Examples

# Basic compile — produces demo.prompt.md
butter compile demo.butter

# JSON output
butter compile demo.butter -f json

# YAML output
butter compile demo.butter -f yaml

# Custom output path
butter compile demo.butter -f json -o result.json

# Validate only (no output)
butter compile --check demo.butter

# Extract a single endpoint
butter compile api.butter --only endpoint:ProcessOrder -f json

# Exclude a block
butter compile api.butter --exclude endpoint:HealthCheck -f json

Selective Compilation

The --only and --exclude flags extract or remove specific features and endpoints. The filter syntax is block_type:name — e.g. endpoint:ProcessOrder or feature:CreateTask. Comma-separated for multiple targets.

The global context (app name, description, version) is always preserved. Both flags fail if a referenced block doesn't exist — typos are caught at compile time.

butter fmt

Formats a .butter file — normalizes indentation and spacing.

butter fmt demo.butter
butter fmt --check demo.butter   # check without modifying

Error Messages

Errors include the line number and a clear description:

Error: compilation syntax compilation error:
line 5: expected an application name after 'app'
ErrorWhat went wrong
input file must have a .butter extensionFile doesn't end in .butter.
expected an application name after 'app'app needs a name after it.
expected a quoted string for descriptiondescription must be followed by a quoted string.
expected a feature name after 'feature'feature needs a name after it.
expected an indented block under this featureContent after a feature must be indented.
action statement must be a quoted stringActions must be in double quotes.
unexpected '...' at the top levelOnly app, feature, endpoint, and rules are valid at the root.
Indentation mismatchInconsistent spacing. Use the same indent throughout.