diagonaldiagrams

io.github.lucas19919由 GitHub 账号 lucas19919 发布v0.9.1更新于 Nov 3, 2026

Diagrams and charts for agents: Mermaid or a spec in, an audited SVG out.

已验证STDIO仅桌面开发者工具媒体与设计

概览

AI 生成的概览

把 Mermaid、JSON 或 CSV 规格绘制成 SVG 图表,并自动检查文字重叠、箭头穿框等问题。

可以做什么
  • 查询各类图表的规格结构、样式与故事格式
  • 在绘制前校验规格、场景或 CSV,失败时给出带修复建议的错误
  • 渲染图表为 SVG 与 HTML,返回布局大纲和警告
  • 审计任意 SVG 或 HTML 图表中的文字重叠、箭头穿框、文字溢出、低对比度与小字号
  • 用补丁就地修改规格文件,并对比两张图确认改动
  • 将已渲染图表导出为 PNG、PDF、SVG、draw.io 或 Excalidraw,或把一张图做成多视图动画页面
适用场景
适合需要让助手生成流程图、时序图、数据库结构图、等距分层图或统计图文件,并希望得到机器可读的检查结果而非截图时使用。也适合文档、README 和幻灯片中要求文字不重叠的配图。
运行要求
以 stdio 在本地运行,需要 Python 3.11 或更高版本,并通过 uv/uvx 启动 MCP 服务器。导出 PNG 和 PDF 还需 cairosvg 等依赖,生成 GIF 需要 ffmpeg。未声明任何账号、密钥或环境变量。
安装前请注意
多个工具会写入磁盘:render 生成 SVG、HTML 和回执文件,story 会覆盖已有 HTML 页面,apply 就地修改规格文件并写入补丁,export 会新建文件。请只在允许被修改的目录中使用。

安装

在 SourceWeft 中

  1. 打开 控制台中的 diagonaldiagrams,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

diagonaldiagrams

[PyPI] [License: MIT]

diagonaldiagrams is a Python library and MCP server that lets an AI agent draw diagrams and charts as SVG, and check them for overlapping text, arrows through boxes and text that spills, before showing them.

Site: filmed examples, benchmarks and a gallery.

[An architecture diagram drawn by diagonaldiagrams, with one chat request traced through an AI agent platform]

How it works

  1. Describe. The agent writes a short description of the figure, in Mermaid, JSON or CSV.
  2. Draw. diagonaldiagrams lays it out and saves an SVG.
  3. Check. It audits the drawing and prints one line of JSON: all clear, or what is wrong and how to fix it. The agent reads that line instead of a screenshot.
text
$ diagonaldiagrams mermaid flow.mmd -o flow.svg{"ok": true, "svg": "flow.svg", ..., "items": 3, "layout": ["row 1: Start", "row 2: Ready? (decision)", "row 3: Done"]}

When ok is false, each error comes with a fix.

Install

Needs Python 3.11 or newer.

Command line

bash
pip install diagonaldiagrams

MCP (Cursor, Claude Desktop and other MCP apps). Add this to the app's MCP settings; it needs uv. The server is in the official MCP registry as io.github.lucas19919/diagonaldiagrams.

json
{  "mcpServers": {    "diagonaldiagrams": { "command": "uvx", "args": ["diagonaldiagrams", "mcp"] }  }}

Claude Desktop can also open the .mcpb file from the latest release.

Claude Code

text
/plugin marketplace add lucas19919/diagonaldiagrams/plugin install diagonaldiagrams@diagonaldiagrams

Any other agent: tell it Install diagonaldiagrams from https://github.com/lucas19919/diagonaldiagrams. It follows the install skill, then draws with the drawing skill. The short version for models is llms.txt.

What it draws

CommandInputDraws
mermaidflowchart, sequenceDiagram, erDiagramA flow, a sequence, or a schema
flow, arch, seq, schemaJSONThe same four, from a spec
isoJSONA layer stack in isometric 3D, with links between layers
bar, line, scatterCSVA comparison, a trend, a relationship
geoCSV or GeoJSONPlaces on a built-in coastline
chart <type>CSV or JSONAbout 60 more
  • describe <type> prints the spec shape for any figure type.
  • --fit column sizes a figure for a README or docs page. slide is the default, and page is for print.
  • story turns one figure into several views in one page, and --gif films it when ffmpeg is installed.
  • apply edits a spec with a JSON patch, and export writes PNG, PDF, draw.io or Excalidraw files.

How it compares

Measured on 2026-10-19 against Mermaid CLI and Pele, on version 0.8.0, with the same four flowcharts of 5 to 40 steps.

  • Speed. A 20-step flowchart takes 152 ms, about 15 times faster than Mermaid CLI (2,340 ms) and about 1.5 times slower than Pele (101 ms).
  • Tokens. An agent used 4.4k to 6.4k tokens per figure at every size. At 5 to 20 steps Pele and Mermaid CLI used fewer (1.3k to 4.0k). At 40 steps diagonaldiagrams used 6.4k, Pele 6.3k and Mermaid CLI 15.4k. This is two runs, so treat it as a small sample.
  • Quality. In blind pairs, diagonaldiagrams was judged clearer than Pele 85% of the time and than Mermaid CLI 97% of the time on slide-sized figures. It lost where an architecture translated from Mermaid was sized for a narrow column: 0 of 8 against Pele.

The full tables, the method and the scripts to rerun them are in bench/.

Develop

bash
python -m unittest discover tests/unit   # unit testspython tests_smoke.py                    # the command-line contractpython scripts/golden.py                 # the reference figures, byte for byte

How the engine is put together: docs/ARCHITECTURE.md. How releases are made: PUBLISHING.md.

License

MIT. See LICENSE.

来源:README.md,提交 5082862

工具

9

describe

Describe a figure type

Look up how to write a spec. With a figure type it returns that type's spec shape, rules, size budgets and an example; with no type it lists every type. Also takes style and story. Read-only, writes nothing. Call it before render when you are unsure of the shape.

输入参数type

render

Draw and audit a figure

Draw one figure and audit it in a single call. Validates the input, lays it out, writes OUT.svg, OUT.html and a receipt (OUT.graph.json) side by side, then checks the drawing. Returns one JSON line: ok, the file paths, a layout outline and any warnings. When ok is false, each error has a fix: change the spec or options and call render again. Overwrites files at the same out path. Use validate to check an input without drawing, and audit for an SVG this tool did not just draw.

输入参数outdatapathspectype必填sceneoptions

validate

Validate a spec

Check an input without drawing anything: a spec, scene or CSV. Returns JSON with ok and, on failure, errors that each carry a fix. Read-only, and cheaper than render while you are still shaping the spec. For a finished drawing use audit.

输入参数datapathspectype必填sceneoptions

audit

Audit an SVG

Check a finished SVG or HTML figure for what you cannot see in your own output: text over text, arrows through boxes, text that spills out of its shape, low contrast, tiny text, and in 3D figures text hidden behind a nearer face. Works on any SVG on disk, not only ones this tool drew. Returns JSON: ok, errors with a fix, and warnings. Read-only. render already audits its own output, so use this after hand edits or on a figure from elsewhere.

输入参数path必填

export

Export a figure to another format

Redraw a rendered figure as png, pdf, svg, drawio or excalidraw. It reads the receipt (OUT.graph.json) that render wrote beside the figure, so the figure must have been drawn by this tool. Writes the new file next to it, or at out, and returns the path as a line of text. png and pdf need cairosvg or headless Edge or Chrome. Overwrites an existing file at the same path.

输入参数tooutpath必填layout

infer

Suggest a scatter spec from a CSV

Propose a starting spec for a scatter chart from a CSV. Returns the spec as JSON to edit and pass to render. Read-only: it suggests and draws nothing. Only for scatter charts; for other charts, describe the type and write the spec yourself.

输入参数datapath

apply

Patch a spec file

Edit a spec file with a patch instead of rewriting it: move or reorder items, rename text, change colors, add or remove things, or move them into a group, so a regenerated spec keeps the change. Changes the spec file in place and writes the patch beside it (SPEC.patch.json). Render the spec to the same out path again; changed in the result says what moved.

输入参数spec必填patch必填

story

Build an animated story page

Present one figure as a story: a story file lists views that focus, dim, highlight and reveal parts of it, and one HTML page animates between them. Writes OUT.html and returns JSON with ok, the path and the views; overwrites an existing page. describe story shows the story file's shape. For a plain figure use render.

输入参数out必填story必填

diff

Compare two drawings

Say what changed between two drawings of the same figure (.svg or .html): items added, removed, renamed, moved, reordered or recolored, as JSON and plain sentences. Read-only. Use it after apply or an edit to confirm the change did what you meant.

输入参数new必填old必填

版本历史

2
  1. v0.9.1最新Nov 1, 2026
  2. v0.9.0Nov 1, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分