Skip to content

Add --dag-mermaid option to output workflow DAG in Mermaid format#154

Merged
linyows merged 2 commits intomainfrom
add-dag-mermaid-option
Jan 18, 2026
Merged

Add --dag-mermaid option to output workflow DAG in Mermaid format#154
linyows merged 2 commits intomainfrom
add-dag-mermaid-option

Conversation

@linyows
Copy link
Owner

@linyows linyows commented Jan 18, 2026

Summary

  • Add --dag-mermaid CLI option to render workflow job dependencies in Mermaid flowchart format
  • Uses left-right (LR) direction which is better suited for typical workflow structures
  • Outputs can be directly rendered in GitHub, GitLab, Notion, and other Markdown viewers

Example

probe examples/needs-literal.yml --dag-mermaid

Output:

flowchart LR
    subgraph build["Build"]
        build_step0["Compile"]
    end
    subgraph unit_test["Unit Test"]
        unit_test_step0["Run unit"]
    end
    subgraph lint["Lint"]
        lint_step0["Run lint"]
    end
    subgraph deploy["Deploy"]
        deploy_step0["Deploy app"]
    end

    build --> unit_test
    build --> lint
    unit_test --> deploy
    lint --> deploy
Loading

Test plan

  • Added unit tests for DagMermaidRenderer
  • Added golden tests covering 12 DAG patterns (single, linear, divergence, convergence, diamond, hourglass, parallel, mixed)
  • Verified existing tests pass
  • Tested with example workflow files

🤖 Generated with Claude Code

Similar to --dag-ascii, this option renders the workflow job dependencies
in Mermaid flowchart format (LR direction), which can be directly rendered
in GitHub, GitLab, Notion, and other Markdown viewers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Update README.md, README.ja.md, and CLI reference docs with
--dag-mermaid option description and usage examples.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@linyows linyows requested a review from Copilot January 18, 2026 02:11
@github-actions

This comment has been minimized.

@github-actions
Copy link

Code Metrics Report

main (028ef05) #154 (e816d14) +/-
Coverage 54.6% 54.8% +0.1%
Code to Test Ratio 1:1.0 1:1.0 -0.1
Test Execution Time 24s 25s +1s
Details
  |                     | main (028ef05) | #154 (e816d14) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          54.6% |          54.8% | +0.1% |
  |   Files             |             63 |             64 |    +1 |
  |   Lines             |           6375 |           6439 |   +64 |
+ |   Covered           |           3483 |           3530 |   +47 |
- | Code to Test Ratio  |          1:1.0 |          1:1.0 |  -0.1 |
  |   Code              |          12570 |          12684 |  +114 |
  |   Test              |          13180 |          13180 |     0 |
- | Test Execution Time |            24s |            25s |   +1s |

Code coverage of files in pull request scope (69.4% → 70.1%)

Files Coverage +/- Status
cmd/probe/main.go 57.0% -5.8% modified
dag_mermaid.go 92.0% +92.0% added
mail/mock_server.go 73.1% +1.0% affected
probe.go 71.9% -2.0% modified

Reported by octocov

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a --dag-mermaid CLI option to output workflow job dependencies in Mermaid flowchart format, complementing the existing --dag-ascii option. The Mermaid output can be directly rendered in GitHub, GitLab, Notion, and other Markdown viewers.

Changes:

  • Added DagMermaidRenderer with support for rendering workflow DAGs in Mermaid flowchart format (LR direction)
  • Integrated --dag-mermaid flag into CLI argument parsing and help text
  • Added comprehensive test coverage with 12 golden test cases covering various DAG patterns

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dag_mermaid.go Core renderer implementation for Mermaid flowchart generation
dag_mermaid_test.go Unit and golden tests for the DagMermaidRenderer
probe.go Added DagMermaid() method to Probe API
cmd/probe/main.go Integrated --dag-mermaid flag and runDagMermaid() handler
cmd/probe/main_test.go Updated test expectations for new flag
README.md Added documentation for --dag-mermaid option
README.ja.md Added Japanese documentation for --dag-mermaid option
docs/src/en/reference/cli-reference.md Added English CLI reference documentation
docs/src/ja/reference/cli-reference.md Added Japanese CLI reference documentation
testdata/dag_mermaid/*.golden.txt Golden test files for 12 DAG pattern variations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@linyows linyows merged commit 52a5483 into main Jan 18, 2026
7 checks passed
@linyows linyows deleted the add-dag-mermaid-option branch January 18, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants