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 分