bnl-dotnet 0.8.0

dotnet tool install --global bnl-dotnet --version 0.8.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local bnl-dotnet --version 0.8.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=bnl-dotnet&version=0.8.0
                    
nuke :add-package bnl-dotnet --version 0.8.0
                    

DiagramGenerator for .NET (bnl-dotnet)

Turns a C#/ASP.NET Core solution into navigable Mermaid flow diagrams via Roslyn - entirely on your own machine. Your source code is analyzed locally and never leaves it; nothing is ever uploaded anywhere.

Install

dotnet tool install -g bnl-dotnet

Quick start

Run it from the folder containing your API, the way you would dotnet build:

# Free - diagram a single method in isolation, no license needed.
bnl-dotnet basic OrderService.Create

# Licensed - list the controller actions, then diagram one with everything it calls.
bnl-dotnet endpoint
bnl-dotnet endpoint OrdersController.GetById

Commands

Command Tier What it does
basic [path] Free Lists every analyzable method, in the form to type back in.
basic [path] <method> Free Diagrams one method in isolation - full LINQ decomposition and call styling, but never follows a call into another method's own diagram.
endpoint [path] Paid Lists every controller action (ASP.NET Core Web API entry point).
endpoint [path] <action> Paid Full composed diagram for one controller action - every method it reaches, spliced into one page.
method [path] Paid Lists every analyzable method - broader than endpoint, not just controller actions.
method [path] <method> Paid Full composed diagram starting from any method - the paid counterpart to basic.
license <key> - Activates a license key locally, so it's picked up by every future run.

Finding your project. [path] is a .sln, .slnx or .csproj (or a folder containing one). Leave it out and the one in the current folder is used - a solution if there is exactly one, otherwise the one project; if there are several, you're asked to pick. With a single argument, it's treated as the project if it looks like one and as the method otherwise, so bnl-dotnet endpoint OrdersController.Get just works.

Naming a method. Write Type.Method. Add the namespace (Orders.Api.OrdersController.Get) if the same type name exists in two places, and parameter types (OrdersController.Get(int)) to pick one overload. If a name matches several methods the tool lists them and stops rather than guessing. The lists above print each method in the form to type back in.

Choosing from a menu

Don't know the method's name? Run any of basic, endpoint or method with -i:

bnl-dotnet basic --interactive
bnl-dotnet endpoint -i

You get one alphabetical list (for endpoint, each controller action with its HTTP verb and route), 15 rows to a page. Use the up/down arrows to move and page, or just start typing to filter the list; press Enter to generate the diagram for the highlighted entry. The equivalent typed command is printed, so you can skip the menu next time. --interactive needs a terminal, so it can't be used when output is piped, and can't be combined with --stdout or with a method name.

Output

By default the diagram is written to <Type.Method>.mmd in the current folder (.md for markdown, .drawio for advanced). Options (all commands unless noted):

Option What it does
-o, --output <path> Write to this file - or, if it's a folder (existing, or ending in /), to <Type.Method>.mmd (or .md/.drawio) inside it. Missing folders are created.
--stdout Write the diagram to standard output and nothing else, so it can be redirected or piped. Can't be combined with -o.
-f, --format <mermaid\|markdown\|advanced\|json> mermaid (default) is the bare diagram; markdown wraps it in a ```mermaid fence (.md) so it renders on GitHub or in a README/PR; advanced writes a variable-flow diagram for draw.io (.drawio; drawio is accepted too) - see Advanced diagrams; json (basic only) writes the Mermaid text plus where in the source file each node came from, for tools that link a diagram to the code - see JSON output.
--depth <n> endpoint/method only. How many levels of calls to follow (default 25). 1 draws just the starting method.
-i, --interactive Choose the method from a menu instead of naming it - see below.
-q, --quiet Suppress informational output.
--verbose Show every message MSBuild produced while loading the project. A long list is otherwise summarized in one line.
--version Print the tool version.
bnl-dotnet endpoint OrdersController.GetById --stdout > orders-get.mmd
bnl-dotnet endpoint OrdersController.GetById -o docs/ --format markdown

With --stdout, STDOUT carries only the diagram: the license line, progress spinner and notes are not printed at all. A successful run writes nothing to STDERR; errors (and any license warning that needs your attention) go to STDERR with a non-zero exit code for errors, and nothing is written to STDOUT when a run fails. Exit codes are otherwise unchanged: 0 on success, non-zero on failure.

When STDOUT is piped, endpoint and method with no method print one reference per line (no table, no extra output), so bnl-dotnet endpoint | fzf works.

Windows PowerShell 5.1: its > operator re-encodes output as UTF-16. Use -o there (PowerShell 7 and other shells are fine).

Advanced diagrams

--format advanced draws the flowchart as a variable-flow diagram, opened in draw.io (desktop, app.diagrams.net or the VS Code extension). It's available on every tier: basic draws one method, and endpoint/method draw the whole call chain.

bnl-dotnet basic OrderService.Create --format advanced
bnl-dotnet endpoint OrdersController.Checkout --format advanced -o docs/
  • Console - every variable the method uses is listed at the top-left, each in its own colour. Parameters enter it with an arrowhead.
  • Lanes - each variable has a lane running across the top, with a line dropping straight into every step that touches it: an arrowhead where the step reads it, a circle where it writes it.
  • Names - each line is labelled with its variable's name where it meets the step.
  • Outputs - out/ref parameters and the return value run off past the right of the flow.
  • Call chains (endpoint/method) - every method gets its own pane, with its own console, in one left-to-right row in the order the flow reaches it, grouped into a pane per class. A dashed line runs from each call to the method it calls (click the call to jump there), arguments run from the call into the callee's console, and return values run back. A value passed straight through keeps its colour from method to method.
  • Layers - the flowchart, the variable lines and the variable names are on separate layers (draw.io's Layers panel, Ctrl+Shift+L), so any of them can be hidden.
  • Logo - on the free plan the console carries a small Boxes'n'Lines logo, standing along its height (click it in draw.io to open this site), so the console is always tall enough to hold it. With an Individual or Team license the diagram is drawn without it.

These diagrams get wide on purpose: they show how much a method, or a whole endpoint, really does.

JSON output

bnl-dotnet basic <method> --format json (or -f json) writes one JSON document instead of bare Mermaid text, for tools that want to link a diagram back to the code - the VS Code extension uses it to follow your cursor through the diagram and to jump from a node to its line. It is available for basic only: a composed diagram spans several files, which this envelope doesn't describe yet.

{
  "schemaVersion": 1,
  "method": "OrdersController.ApplyDiscount",
  "sourceFile": "C:\\src\\Api\\Controllers\\OrdersController.cs",
  "mermaid": "flowchart LR\r\n    ...",
  "nodes": [
    { "id": "n1", "kind": "Decision", "label": "id", "span": { "startLine": 21, "startColumn": 13, "endLine": 21, "endColumn": 20 } }
  ]
}
  • mermaid is exactly the text --format mermaid would write.
  • Each nodes[].id is the node's identifier as it appears in that Mermaid text (n1), so you can find the node in the rendered diagram.
  • span is where the node came from in sourceFile: 1-based lines and columns, the end column being just past the last character. A node can span a whole statement (a for loop's exit node covers the whole loop), so to find the node for a cursor position pick the smallest span that contains it; START and END cover the whole method.
  • schemaVersion changes only for a change an existing reader would misread; new properties can be added without bumping it, so ignore ones you don't know.

Licensing

basic is free forever, with no signup. endpoint and method need an Individual ($39.99/year) or Team license - see dotnet.boxesnlines.com/pricing. After subscribing you'll get a license key by email; activate it once with:

bnl-dotnet license dgcli_...

bnl-dotnet license --status prints the license in force as JSON (tier, email, end date) and changes nothing, and --stdin reads the key from standard input instead of the command line - both are for tools that drive the CLI, like the VS Code extension. A method or endpoint run without a license exits with code 3.

This persists the key locally (under your user profile), so it's picked up automatically on every later run - no need to pass it again. For CI, set it via an environment variable instead, so nothing needs to be written to the build agent's disk:

export BNL_DOTNET_LICENSE=dgcli_...

The license works fully offline day to day - the CLI checks in with the license server only as your key nears its renewal date, and only to fetch a freshly-dated key if your subscription is still active. If that check can't reach the server at all (no network, an air-gapped CI runner, a transient outage), the CLI keeps working on the last-known-good key for a generous grace period rather than breaking your pipeline over a connectivity gap - only an explicit "this subscription has lapsed" from a reachable server stops it immediately. Keys are never tied to a specific machine, so the same key works wherever you run the tool.

Every command prints a one-line License: ... status so it's always visible what tier you're running as.

License

bnl-dotnet is proprietary software, free to use for the basic command and licensed per subscription for the rest. The terms are in LICENSE.txt in this package; bundled open-source components are listed in THIRD-PARTY-NOTICES.txt.

Full documentation: dotnet.boxesnlines.com/docs.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.8.0 0 11/23/2026
0.7.0 105 11/4/2026
0.6.0 91 11/4/2026
0.5.0 127 10/28/2026