← Documentation

Using the CLI

bnl-diagrams is the fastest way to generate diagrams for a whole folder of stored procedures at once, and the building block for the CI integration guide.

Install

dotnet tool install -g bnl-diagrams

Requires the .NET SDK. Works the same way on Windows, macOS, and Linux.

Get an API key

Create one from API Keys once you have an active subscription. Pass it via --key, or set it once as an environment variable:

export BNL_DIAGRAMS_API_KEY=dg_live_yourapikeyhere

Usage

bnl-diagrams ./procs/*.sql --output ./diagrams

Accepts one or more .sql files, directories, or glob patterns (e.g. ./procs/*.sql) in a single run - glob patterns are expanded by the CLI itself, not the shell, so they behave the same in PowerShell/cmd.exe as in bash/zsh.

OptionDefaultDescription
-o, --output <path>current directoryDirectory to write generated diagrams to.
-r, --recursive <bool>trueSearch subdirectories when an input path is a directory.
-f, --format <mermaid|json>mermaidmermaid writes just the raw .mmd text; json writes a full envelope (graph + Mermaid text).
-q, --quietoffSuppress informational output.
-k, --key <key>Your API key. Falls back to BNL_DIAGRAMS_API_KEY. Always required.

Examples

# A folder of procedures via a glob, into ./diagrams, using an API key from the environment
export BNL_DIAGRAMS_API_KEY=dg_live_yourapikeyhere
bnl-diagrams ./procs/*.sql --output ./diagrams

# Several specific files in one run, JSON envelope output (graph + Mermaid text)
bnl-diagrams OrderQueue.prc RefundFlow.txt --key dg_live_yourapikeyhere --format json

A file that fails to parse is reported and skipped rather than aborting the whole batch; the process exits non-zero if any file failed.