Skip to content

feat(graph): add d2 diagram output format#499

Open
jongio wants to merge 1 commit into
mainfrom
idea/graph-d2
Open

feat(graph): add d2 diagram output format#499
jongio wants to merge 1 commit into
mainfrom
idea/graph-d2

Conversation

@jongio

@jongio jongio commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Implements #494.

azd app graph already exports text, json, markdown, mermaid, and dot. This adds d2 as an --output value that renders the service dependency graph as a D2 diagram.

  • Nodes reuse the diagram-safe ids from the mermaid renderer, so any service name is valid.
  • Resources render as cylinders to read like a datastore; services render as plain nodes.
  • Edges follow dependency direction, and --output-file and --focus work as with the other formats.

Tests cover the D2 renderer, the render dispatch, and label escaping. Command help updated with a d2 example.

Closes #494

Add d2 as an --output value for azd app graph, rendering the service dependency graph as a D2 (terrastruct) diagram. Nodes reuse the diagram-safe ids used by the mermaid renderer, resources render as cylinders, and edges follow dependency direction. Works with --output-file and --focus like the other formats.

Closes #494

Co-authored-by: Copilot App <[email protected]>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 12, 2026
@jongio jongio self-assigned this Jul 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Website Preview

Your PR preview is ready!

📎 Preview URL: https://jongio.github.io/azd-app/pr/499/

This preview will be automatically cleaned up when the PR is closed.

github-actions Bot added a commit that referenced this pull request Jul 12, 2026
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.80%. Comparing base (dd00a47) to head (35ecf1e).

Files with missing lines Patch % Lines
cli/src/cmd/app/commands/graph.go 93.75% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #499      +/-   ##
==========================================
+ Coverage   60.77%   60.80%   +0.03%     
==========================================
  Files         223      223              
  Lines       28527    28555      +28     
==========================================
+ Hits        17337    17363      +26     
- Misses      10010    10011       +1     
- Partials     1180     1181       +1     
Flag Coverage Δ
unittests 60.80% <93.75%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cli/src/cmd/app/commands/graph.go 85.97% <93.75%> (+0.62%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Test This PR

A preview build (0.19.5-pr499) is ready for testing!

🌐 Website Preview

Live Preview: https://jongio.github.io/azd-app/pr/499/

One-Line Install (Recommended)

PowerShell (Windows):

iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/install-pr.ps1) } -PrNumber 499 -Version 0.19.5-pr499"

Bash (macOS/Linux):

curl -fsSL https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/install-pr.sh | bash -s 499 0.19.5-pr499

Uninstall

When you're done testing:

PowerShell (Windows):

iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/uninstall-pr.ps1) } -PrNumber 499"

Bash (macOS/Linux):

curl -fsSL https://raw.githubusercontent.com/jongio/azd-app/main/cli/scripts/uninstall-pr.sh | bash -s 499

Build Info:

What to Test:
Please review the PR description and test the changes described there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add D2 diagram output to azd app graph

1 participant