Skip to content

Add Mermaid SVG/PNG CLI renderer#175

Open
IstiN wants to merge 109 commits into
mainfrom
poc/mermaid-render-graaljs
Open

Add Mermaid SVG/PNG CLI renderer#175
IstiN wants to merge 109 commits into
mainfrom
poc/mermaid-render-graaljs

Conversation

@IstiN
Copy link
Copy Markdown
Collaborator

@IstiN IstiN commented May 5, 2026

Summary

  • Wire dmtools Mermaid SVG/PNG commands to the external renderer submodule
  • Update renderer submodule to the real Mermaid/GraalJS engine bundle
  • Add compatibility generation for requested Mermaid diagram families

Validation

  • ./gradlew :dmtools-core:test --tests com.github.istin.dmtools.job.JobRunnerMcpIntegrationTest
  • ./gradlew :dmtools-core:shadowJar
  • java -jar build/libs/dmtools-v1.7.181-all.jar mermaid_to_svg ...
  • java -jar build/libs/dmtools-v1.7.181-all.jar mermaid_to_png ...

Note: ZenUML is registered through @mermaid-js/mermaid-zenuml, but still reports an unresolved async promise under GraalJS in the renderer compatibility report.

Test User and others added 5 commits May 5, 2026 13:04
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 11:51
Copy link
Copy Markdown
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

Adds top-level CLI support for Mermaid rendering by routing mermaid_to_svg / mermaid_to_png through an external renderer build, so dmtools can generate diagram assets directly from Mermaid text.

Changes:

  • Added a composite build/submodule reference for dmtools-mermaid-renderer.
  • Wired new Mermaid CLI commands into JobRunner and updated help text.
  • Added integration-style tests covering SVG and PNG rendering from the CLI.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
settings.gradle Registers the external Mermaid renderer as an included build.
dmtools-core/src/main/java/com/github/istin/dmtools/job/JobRunner.java Dispatches Mermaid CLI commands and documents them in help output.
dmtools-core/src/test/java/com/github/istin/dmtools/job/JobRunnerMcpIntegrationTest.java Adds CLI tests for SVG and PNG rendering.
dmtools-core/build.gradle Adds the Mermaid renderer dependency to dmtools-core.
.gitmodules Declares the new renderer submodule checkout path and URL.

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

Comment thread settings.gradle Outdated
@@ -1,2 +1,3 @@
rootProject.name = 'dmtools-cli'
include 'dmtools-core', 'dmtools-mcp-annotations', 'dmtools-annotation-processor'
includeBuild 'dmtools-mermaid-renderer'
Comment on lines +121 to +129
JobRunner.main(new String[]{
"mermaid_to_svg",
"flowchart TD; A[Start] --> B[Done]",
"--output",
output.toString()
});

assertTrue(outContent.toString().contains(output.toAbsolutePath().normalize().toString()));
assertTrue(Files.readString(output, StandardCharsets.UTF_8).contains("<svg"));
Comment on lines +140 to +149
JobRunner.main(new String[]{
"mermaid_to_png",
"flowchart TD; A[Start] --> B[Done]",
"--output",
output.toString()
});

assertTrue(outContent.toString().contains(output.toAbsolutePath().normalize().toString()));
byte[] header = Files.readAllBytes(output);
assertArrayEquals(new byte[]{(byte) 0x89, 0x50, 0x4E, 0x47}, new byte[]{header[0], header[1], header[2], header[3]});
ai-teammate and others added 22 commits May 5, 2026 16:59
…nd title clipping

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…bottom padding

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… fix

'Runs dmtools mermaid_to_png' now wraps to 2 lines matching Playwright output.
95 unit tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants