tools-codeflowiommd
1.0.0
dotnet tool install --global tools-codeflowiommd --version 1.0.0
dotnet new tool-manifest
dotnet tool install --local tools-codeflowiommd --version 1.0.0
#tool dotnet:?package=tools-codeflowiommd&version=1.0.0
nuke :add-package tools-codeflowiommd --version 1.0.0
Code-Flow-IO
Description
Code-Flow-IO is a tool that generates flowcharts from the C# source code of a .NET solution.
It uses Roslyn to analyze the Control Flow Graph (CFG) of each implemented method and converts that flow into Mermaid diagrams, automatically producing .mmd, .svg, and .png files.
How it works
Solution reading:
The tool opens a.slnspecified by the user.Compilation and analysis:
For each project (or a filtered project) it compiles and analyzes all.csfiles.CFG generation:
For each implemented method (with a body), the tool generates the Control Flow Graph using Roslyn.Conversion to Mermaid:
The CFG is converted into a Mermaid diagram (.mmd).Diagram rendering:
The Mermaid CLI (mmdc) is used to produce.svgand.pngfiles from the.mmd.Output files:
Generated files are saved to the specified output directory, overwriting previous versions.Code Base Program.cs
Requirements
- .NET 8 SDK
- Node.js
- Mermaid CLI installed globally
Install Mermaid CLI
To render .svg and .png files you must install the Mermaid CLI on your machine.
Install Mermaid CLI globally with:
npm install -g @mermaid-js/mermaid-cli
After installation, the mmdc command will be available in the terminal and will be used automatically by the tool to convert .mmd files into .svg and .png.
Verify installation:
mmdc -h
If the Mermaid CLI help appears, the installation is correct.
Project installation
Clone the repository and restore dependencies:
git clone <repository-url> && cd Code-Flow-IO && dotnet restore
How to run
Run the command below, providing the solution path and output directory:
dotnet run --project src/Rest.Code-Flow-io/Rest.Code-Flow-io.csproj -- <path.sln> <out-dir>
Example:
dotnet run --project src/Rest.Code-Flow-io/Rest.Code-Flow-io.csproj -- C:\projects\my-sln.sln docs/flow/mmd
To filter by a specific project:
dotnet run --project src/Rest.Code-Flow-io/Rest.Code-Flow-io.csproj -- C:\projects\my-sln.sln docs/flow/mmd --project ProjectName
Generated files structure
<out-dir>/<Project>_<File>_<Method>.mmd(Mermaid diagram)<out-dir>/<Project>_<File>_<Method>.svg(SVG image)<out-dir>/<Project>_<File>_<Method>.png(PNG image)
Files are overwritten on each run.
Notes
- Only methods with bodies are processed (interfaces and abstract methods are ignored).
- The Mermaid CLI must be available in the system PATH.
- If any generated
.mmdfile causes a syntax error, inspect the.mmdcontent and adjust the source or sanitization logic as needed. - The program prints warnings with details when diagram generation fails.
References
Architecture documentation (generated)
The tool automatically produces an architecture document that interlinks projects, source files, classes and methods, and shows the full processing chain (Solution → Project → Documents → Control Flow Graph → Mermaid → mmdc → outputs).
When generated, the files are saved under the output directory in a docs-architecture folder, for example:
<out-dir>/docs-architecture/ARCHITECTURE.mmd(Mermaid source)<out-dir>/docs-architecture/ARCHITECTURE.md(Markdown with embedded Mermaid)<out-dir>/docs-architecture/ARCHITECTURE.svg(optional, generated by mmdc)<out-dir>/docs-architecture/ARCHITECTURE.png(optional, generated by mmdc)
The architecture document is generated automatically at the end of a run. You can control how much detail is included via appsettings.json values described below.
Configure detail limits (appsettings.json)
Add or edit an appsettings.json file in the tool working folder (or in src/Rest.Code-Flow-io/ for development). The following keys control the amount of information included in the architecture diagram:
{ "Architecture": { "MaxDocsPerProject": 8, "MaxClassesPerProject": 10, "MaxMethodsPerClass": 10, "MaxFreeMethods": 10 } }
MaxDocsPerProject— maximum number of documents (.cs) to show per project in the diagram. Set to0to hide documents.MaxClassesPerProject— maximum number of classes/records/structs to show per project (summed across sampled documents).MaxMethodsPerClass— maximum number of methods to show per class node.MaxFreeMethods— maximum number of top-level (non-type) methods to list.
Adjust these values to keep the diagram readable for large solutions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 206 | 12/23/2025 |