Skip to content

Commit 700859c

Browse files
richlanderCopilot
andauthored
Release 0.7.4 — mermaid output and Markout 0.12.0 (#305)
* Add mermaid output workflow and feature entry New workflow doc covers standalone and embedded mermaid modes for type hierarchy, library reference, and package dependency graphs. Add feature entry for --mermaid flag. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Bump version to 0.7.4 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b88427d commit 700859c

3 files changed

Lines changed: 217 additions & 1 deletion

File tree

docs/workflows/features.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
| Tips system | 935a39b | 0.2.x | Contextual suggestions on stderr |
4747
| `-T` tips verbosity | 0c679e4 | 0.2.x | Control tip output level |
4848
| Redesigned tips UI | 381efa2 | 0.3.x | Single header with aligned entries |
49+
| `--mermaid` output | b88427d | 0.7.x | Mermaid diagram output for depends (standalone and embedded) |
4950

5051
## Type and Member Inspection
5152

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
---
2+
id: mermaid-output
3+
description: Mermaid diagram output for dependency graphs — standalone and embedded in markdown
4+
commands: [depends, --mermaid, --markdown]
5+
areas: [mermaid, output, diagrams, depends, visualization]
6+
---
7+
8+
# Mermaid Output
9+
10+
> The `--mermaid` flag produces Mermaid diagram syntax for dependency graphs. Two modes: standalone (`--mermaid`) for piping to `mmdc` or other tools, and embedded (`--markdown --mermaid`) for rendering in GitHub, VS Code, or any Markdown viewer.
11+
12+
## Preconditions
13+
14+
Isolated session with cached packages.
15+
16+
```bash
17+
export DOTNET_INSPECT_ISOLATED=mermaid-output
18+
```
19+
20+
```bash
21+
dotnet-inspect cache clear
22+
```
23+
24+
Prime the cache:
25+
26+
```bash
27+
dotnet-inspect System.CommandLine@2.0.3 -v:q
28+
```
29+
30+
## 1. Standalone mermaid for type hierarchy
31+
32+
> Goal: Get a mermaid graph of a type's inheritance tree, suitable for piping to `mmdc` or embedding in documentation.
33+
34+
### 1a. Simple class hierarchy
35+
36+
```prompt
37+
Show the Stream type hierarchy as a mermaid diagram.
38+
```
39+
40+
```bash
41+
dotnet-inspect depends Stream --mermaid
42+
```
43+
44+
```expect
45+
graph TD
46+
n0["System.MarshalByRefObject"]
47+
n1["System.IAsyncDisposable"]
48+
n2["System.IDisposable"]
49+
```
50+
51+
```expect-not
52+
#
53+
```
54+
55+
### 1b. Deep interface hierarchy
56+
57+
```prompt
58+
Show the INumber interface hierarchy as a mermaid graph.
59+
```
60+
61+
```bash
62+
dotnet-inspect depends 'INumber<TSelf>' --mermaid
63+
```
64+
65+
```expect
66+
graph TD
67+
n0["System.IComparable"]
68+
-->
69+
```
70+
71+
### 1c. NuGet package type
72+
73+
```bash
74+
dotnet-inspect depends Command --package System.CommandLine --mermaid
75+
```
76+
77+
```expect
78+
graph TD
79+
n0["System.CommandLine.Symbol"]
80+
n1["System.Collections.IEnumerable"]
81+
```
82+
83+
## 2. Embedded mermaid in markdown
84+
85+
> Goal: Get mermaid diagrams inside a markdown document — renders directly in GitHub and VS Code.
86+
87+
### 2a. Simple class
88+
89+
```prompt
90+
Show Stream dependencies as markdown with a mermaid diagram.
91+
```
92+
93+
```bash
94+
dotnet-inspect depends Stream --markdown --mermaid
95+
```
96+
97+
```expect
98+
# System.IO.Stream
99+
```mermaid
100+
graph TD
101+
```
102+
103+
### 2b. Deep hierarchy
104+
105+
```bash
106+
dotnet-inspect depends 'INumber<TSelf>' --markdown --mermaid -n 10
107+
```
108+
109+
```expect
110+
# INumber<TSelf>
111+
```mermaid
112+
graph TD
113+
```
114+
115+
## 3. Library reference graphs
116+
117+
> Goal: Visualize assembly reference dependencies for a platform library.
118+
119+
### 3a. Standalone mermaid
120+
121+
```prompt
122+
Show what System.Text.Json depends on as a mermaid diagram.
123+
```
124+
125+
```bash
126+
dotnet-inspect depends --library System.Text.Json --mermaid -n 10
127+
```
128+
129+
```expect
130+
graph TD
131+
n0["System.Collections
132+
-->
133+
```
134+
135+
### 3b. Embedded in markdown
136+
137+
```bash
138+
dotnet-inspect depends --library System.Text.Json --markdown --mermaid -n 10
139+
```
140+
141+
```expect
142+
# System.Text.Json
143+
```mermaid
144+
graph TD
145+
```
146+
147+
## 4. Package dependency graphs
148+
149+
> Goal: Visualize NuGet package dependencies as a diagram.
150+
151+
```prompt
152+
What does the Markout package depend on?
153+
```
154+
155+
```bash
156+
dotnet-inspect depends --package Markout --mermaid
157+
```
158+
159+
```expect
160+
graph TD
161+
n0["MarkdownTable.Formatting
162+
```
163+
164+
## 5. Default output unchanged
165+
166+
> Goal: Verify that `depends` without `--mermaid` still produces the standard tree output.
167+
168+
```bash
169+
dotnet-inspect depends Stream
170+
```
171+
172+
```expect
173+
System.IO.Stream
174+
├─ System.MarshalByRefObject
175+
├─ System.IAsyncDisposable
176+
└─ System.IDisposable
177+
```
178+
179+
```expect-not
180+
graph TD
181+
```
182+
183+
## 6. Mermaid with other flags
184+
185+
> Goal: Verify `--mermaid` works alongside other output flags.
186+
187+
### 6a. JSON takes precedence over mermaid
188+
189+
```bash
190+
dotnet-inspect depends Stream --mermaid --json
191+
```
192+
193+
```expect
194+
[
195+
{
196+
"type_name"
197+
```
198+
199+
```expect-not
200+
graph TD
201+
```
202+
203+
### 6b. Environment variable
204+
205+
```setup
206+
export DOTNET_INSPECT_FORMAT=mermaid
207+
```
208+
209+
```bash
210+
dotnet-inspect depends Stream
211+
```
212+
213+
```expect
214+
graph TD
215+
```

src/dotnet-inspect/dotnet-inspect.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<Authors>Richard Lander</Authors>
2222
<PackAsTool>true</PackAsTool>
2323
<ToolCommandName>dotnet-inspect</ToolCommandName>
24-
<VersionPrefix>0.7.3</VersionPrefix>
24+
<VersionPrefix>0.7.4</VersionPrefix>
2525
<PackageId>dotnet-inspect</PackageId>
2626
<Description>A CLI tool for inspecting .NET assemblies and NuGet packages</Description>
2727
<PackageLicenseExpression>MIT</PackageLicenseExpression>

0 commit comments

Comments
 (0)