Skip to content
Back to search

code-to-diagram

CTD Studio — local-first code-to-diagram editor & ctd-mcp server for Mermaid, DOT, PlantUML, D2, SQL, TypeScript, and XML

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 17 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/cxernlol/code-to-diagram with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/cxernlol/code-to-diagram'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/cxernlol--code-to-diagram/badge.svg)](/listings/cxernlol--code-to-diagram)

HTML

<a href="/listings/cxernlol--code-to-diagram"><img src="/api/listings/cxernlol--code-to-diagram/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

git clone https://github.com/cxernlol/code-to-diagram.git
cd code-to-diagram
npm install
npm run dev

Type-check and build for production:

npm run build

Run the Playwright end-to-end test suite:

npm test

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 142 lines
  1. # CTD Studio
  2. [![CI](https://github.com/cxernlol/code-to-diagram/actions/workflows/ci.yml/badge.svg)](https://github.com/cxernlol/code-to-diagram/actions/workflows/ci.yml)
  3. [![npm](https://img.shields.io/npm/v/ctd-mcp?label=ctd-mcp)](https://www.npmjs.com/package/ctd-mcp)
  4. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
  5. Write diagram code, drag it into shape, export. No account, no server.
  6. **[Open the app ->](https://code-to-diagram.vercel.app/)** · **[Syntax & Template Docs ->](https://code-to-diagram.vercel.app/#docs)**
  7. Supports Mermaid, Graphviz DOT, PlantUML, D2, SQL DDL, TypeScript, and XML (Draw.io, BPMN). Your diagrams stay in your browser.
  8. ## Features
  9. - **7 input formats**, auto-detected, with one-click conversion between them
  10. - **Drag nodes and edges**, arrow-key nudging, grid snap, alignment guides
  11. - **One-click auto-arrange** and orthogonal edge routing
  12. - **Themes:** default, dark, forest, neutral, plus opt-in colorized boxes on export
  13. - **Local-first:** diagrams, layouts, and version history live in IndexedDB
  14. - **5-device live rooms:** share a live PeerJS session link to collaborate in real time
  15. - **Export** full-bounds SVG/PNG, or share a URL that keeps your manual layout
  16. - **Optional BYOK AI:** OpenAI, DeepSeek, Ollama, OpenRouter, Groq, or any compatible endpoint
  17. - **Syntax & template docs:** quick reference for arrows (`-->`, `-.->`, `==>`), shapes, 7-format syntax, and starter templates at [`#docs`](https://code-to-diagram.vercel.app/#docs)
  18. ## Supported Syntax
  19. All 7 formats are auto-detected and can be converted to Mermaid or translated across formats via the shared intermediate representation (`src/lib/formats.ts` and `src/lib/translate.ts`). Non-Mermaid formats support focused, practical subsets rather than full language specs:
  20. | Format | Extension | What is parsed & rendered | Notable omissions |
  21. | :--- | :--- | :--- | :--- |
  22. | **Mermaid** | `.mmd` | **Full Mermaid v12.3.0** for rendering. IR translation supports `flowchart`/`graph` (shapes, `TD`/`LR`, `-->`/`-.->`/`==>`/`---`/`<-->`), `classDiagram`, `erDiagram`, and `sequenceDiagram`. | Other Mermaid types (`gantt`, `pie`, `mindmap`, `gitGraph`, `C4*`, etc.) render natively but are not translated by the IR converter. |
  23. | **Graphviz DOT** | `.dot` | `(strict) (di)graph`, `rankdir` (`TB`/`TD`/`BT`/`RL`/`LR`), node `label` & `shape` (`diamond`, `circle`, `doublecircle`, `ellipse`, `oval`, `cylinder`), chained `->` / `--` edges with `label` & `style=dashed\|dotted`, `//` and `/* */` comments. | `subgraph` blocks, default `node`/`edge`/`graph` attribute statements, HTML-like labels, and `record` port layouts. |
  24. | **PlantUML** | `.puml` | `@startuml` blocks: **sequence** (`actor`/`participant`, `->`/`-->`/`->>`/`-->>` messages), **state** (`[*]` & `state` transitions), and **class** (`class`/`interface`/`enum`/`abstract class` blocks and `<\|--`, `*--`, `o--`, `-->`, `..>`, `..\|>`, `--` relations). | Activity, component, deployment, and use-case diagrams; `note`, `alt`/`loop` fragments, `package` nesting, and `skinparam` styling. |
  25. | **D2** | `.d2` | `direction` (`right`/`left`/`down`/`up`), nested `{ ... }` containers (`subgraph`), `id: label`, `id.shape: <shape>`, edges (`->`, `<-`, `<->`, `--`) with labels, and `#` comments. | `sql_table` / `class` shape blocks, `style` rules, `icon`, `link`, `near`, `grid-*`, and `vars`/`layers`/`scenarios`. |
  26. | **SQL DDL** | `.sql` | `CREATE TABLE [IF NOT EXISTS]` statements into `erDiagram` entities: column names & base types, `PRIMARY KEY` (`PK`), inline `REFERENCES`, table-level `FOREIGN KEY ... REFERENCES`, and `--` / `/* */` comments. | `ALTER TABLE`, views, indexes, `ENUM` declarations, triggers/functions, and `CHECK`/`UNIQUE` constraint details. |
  27. | **TypeScript** | `.ts` | `[export] interface`, `class`, and object `type Name = { ... }` declarations; `extends`/`implements` (`<\|--`), PascalCase property type references (`-->`), properties, methods, and `//` / `/* */` comments. | Generic type parameters (`<T>`), non-object union/intersection `type` aliases, `enum`s, functions, and imports. |
  28. | **XML** | `.xml` | **Draw.io / mxGraph** (`mxCell` vertices & edges), **BPMN 2.0** (`sequenceFlow`, events, gateways, tasks), explicit `<diagram>`/`<graph>`/`<schema>` (`<node>`/`<table>`/`<class>` + `<edge>`/`<relation>`), and **generic XML** as a hierarchical tree. | Draw.io styling/coordinates beyond basic shapes & dashed edges; BPMN pools/lanes/message flows; XML namespaces/XSD validation. |
  29. ## Getting Started
  30. ```bash
  31. git clone https://github.com/cxernlol/code-to-diagram.git
  32. cd code-to-diagram
  33. npm install
  34. npm run dev
  35. ```
  36. Type-check and build for production:
  37. ```bash
  38. npm run build
  39. ```
  40. Run the Playwright end-to-end test suite:
  41. ```bash
  42. npm test
  43. ```
  44. ## CTD Studio MCP Server (`ctd-mcp` via `npx`)
  45. `ctd-mcp` is the Model Context Protocol (MCP) server ([`mcp/`](mcp/README.md)) bundled with this repo, reusing the same multi-format parsers and translators. Use it in **Claude Desktop**, **Cursor**, **Windsurf**, **VS Code**, **Claude Code**, or directly from your terminal.
  46. Run directly via `npx` (`ctd-mcp` on npm):
  47. ```bash
  48. npx -y ctd-mcp
  49. ```
  50. ### Claude Desktop / Cursor / Windsurf
  51. Add to `claude_desktop_config.json`, `.cursor/mcp.json`, or `mcp_config.json`:
  52. ```json
  53. {
  54. "mcpServers": {
  55. "ctd-mcp": {
  56. "command": "npx",
  57. "args": ["-y", "ctd-mcp"]
  58. }
  59. }
  60. }
  61. ```
  62. ### VS Code (`.vscode/mcp.json`)
  63. ```json
  64. {
  65. "servers": {
  66. "ctd-mcp": {
  67. "type": "stdio",
  68. "command": "npx",
  69. "args": ["-y", "ctd-mcp"]
  70. }
  71. }
  72. }
  73. ```
  74. ### Available MCP Tools & Resources
  75. - **Tools:** `detect_format`, `to_mermaid`, `translate_format`, `parse_diagram_ir`, `emit_from_ir`, `list_templates`, `get_studio_info`
  76. - **Resources & Prompt:** `ctd://formats`, `ctd://themes`, `ctd://templates/{name}`, `code_to_diagram`
  77. - **MCP Safety:** `ctd-mcp` runs purely in-memory over stdio and **does not use filesystem or network APIs**. As with any text tool, untrusted diagram labels passed to an assistant remain untrusted text.
  78. Example output from `npx -y ctd-mcp` (`to_mermaid` on SQL DDL):
  79. ```mermaid
  80. erDiagram
  81. users {
  82. int id PK
  83. text email
  84. }
  85. diagrams {
  86. int id PK
  87. int user_id FK
  88. text title
  89. }
  90. users ||--o{ diagrams : references
  91. ```
  92. Build and test the MCP server locally:
  93. ```bash
  94. npm run mcp:build
  95. npm run mcp:test
  96. ```
  97. ## Tech Stack & CI/CD
  98. - **Stack:** TypeScript, React 19, CodeMirror 6, D3 (`d3-selection`, `d3-zoom`), PeerJS (5-device live rooms), and **Mermaid v12.3.0** (bundled locally in `public/mermaid.min.js` for offline reliability and consistent SVG DOM selectors when dragging nodes and edges).
  99. - **CI/CD:** GitHub Actions ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)) runs type-checking, web and `ctd-mcp` builds, MCP stdio tests, and Playwright E2E tests on every push and pull request to `main` (see the CI badge above). Releases publish `ctd-mcp` to npm via [`.github/workflows/publish-mcp.yml`](.github/workflows/publish-mcp.yml).
  100. ## Data & Privacy
  101. - **Storage:** Diagrams, layouts, and preferences stay in your browser's IndexedDB. Legacy `mstudio2` `localStorage` data is migrated on first load while keeping a recovery copy.
  102. - **AI Requests & Keys:** API keys are stored in your browser only and are never included in share URLs. Prompts, diagram source, and keys are sent directly from your browser to the endpoint you configure.
  103. - **Cost:** CTD Studio is free to run and has no accounts or paid tiers. If you connect a commercial AI API key, provider usage is billed by that provider.
  104. ## Contributing
  105. All changes go through Pull Requests. See [CONTRIBUTING.md](CONTRIBUTING.md) for strict scope boundaries, local-first rules, and required checks before opening a PR.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.