@senad-d/drawme 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Senad Dizdarević
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,254 @@
1
+ <p align="center">
2
+ <img alt="DrawMe icon" src="https://raw.githubusercontent.com/senad-d/DrawMe/main/img/icon.svg" width="128">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://pi.dev"><img alt="pi package" src="https://img.shields.io/badge/pi-package-6f42c1?style=flat-square" /></a>
7
+ <a href="https://www.npmjs.com/package/@senad-d/drawme"><img alt="npm" src="https://img.shields.io/npm/v/%40senad-d%2Fdrawme?style=flat-square" /></a>
8
+ <a href="https://github.com/senad-d/DrawMe/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/senad-d/DrawMe/actions/workflows/ci.yml/badge.svg" /></a>
9
+ <a href="https://sonarcloud.io/summary/new_code?id=senad-d_DrawMe"><img alt="Quality Gate Status" src="https://sonarcloud.io/api/project_badges/measure?project=senad-d_DrawMe&metric=alert_status" /></a>
10
+ <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" /></a>
11
+ <a href="#security"><img alt="network" src="https://img.shields.io/badge/network-none-brightgreen?style=flat-square" /></a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ Natural-language diagrams for <a href="https://pi.dev">pi</a>.
16
+ <br />Turns a description into editable <code>.drawio</code> XML and exports it to PNG / SVG / PDF / JPG with the native draw.io desktop CLI — entirely on your machine.
17
+ </p>
18
+
19
+ ---
20
+
21
+ DrawMe is a native Pi **extension** that exposes the diagram-authoring workflow as plain commands and model-callable tools instead of a skill. You describe a diagram; Pi plans it, writes editable `.drawio` XML (or Mermaid on draw.io v30+), lints it deterministically, previews it for a visual self-check, and exports the approved result. It is a pure-TypeScript port of the [`drawio-skill`](example/) and is **network-free by construction**.
22
+
23
+ <table align="center">
24
+ <tr>
25
+ <th>DrawMe</th>
26
+ </tr>
27
+ <tr>
28
+ <td align="center">
29
+ <img src="https://raw.githubusercontent.com/senad-d/DrawMe/main/example/drawme-how-it-works.drawio.png" alt="DrawMe: from a prompt to an editable diagram" title="DrawMe" width="820">
30
+ </td>
31
+ </tr>
32
+ </table>
33
+
34
+ - **Natural-language authoring:** flowcharts, architecture, UML, BPMN, ERD, C4, network, ML — as native `.drawio`, or as Mermaid with automatic layout on v30+.
35
+ - **Local-only, no network:** the only processes spawned are the draw.io CLI, `xvfb-run` on headless Linux, and the OS file opener. Nothing is ever uploaded.
36
+ - **Deterministic validation:** a structural linter catches dangling edges, duplicate/reserved ids, broken parents, missing geometry, overlaps, and edge-routing defects before you ever look at a pixel.
37
+ - **Exact shapes, not guesses:** search 10k+ official AWS/Azure/GCP/Cisco/Kubernetes/UML/BPMN styles from a bundled local index.
38
+ - **Editable source of truth:** final PNG/SVG/PDF exports embed the diagram XML, and the truncated `-e` PNG chunk is auto-repaired.
39
+
40
+ > **Security:** Pi packages run with your full system permissions. DrawMe reads Pi events through the extension API, spawns only the local draw.io CLI (never a shell), and makes no network requests. Read [`SECURITY.md`](SECURITY.md).
41
+
42
+ ## Table of Contents
43
+
44
+ - [Implementation Status](#implementation-status)
45
+ - [Quick Start](#quick-start)
46
+ - [Installation](#installation)
47
+ - [Commands](#commands)
48
+ - [Tools](#tools)
49
+ - [Architecture](#architecture)
50
+ - [The /drawme Workflow](#the-drawme-workflow)
51
+ - [Bundled References and Assets](#bundled-references-and-assets)
52
+ - [Requirements and Compatibility](#requirements-and-compatibility)
53
+ - [Security](#security)
54
+ - [Examples](#examples)
55
+ - [Development](#development)
56
+ - [Publishing](#publishing)
57
+ - [License](#license)
58
+
59
+ ---
60
+
61
+ ## Implementation Status
62
+
63
+ This checkout implements the DrawMe core loop as a Pi extension:
64
+
65
+ - Eight model-callable tools (`drawio_check`, `drawio_export`, `drawio_validate`, `drawio_shapesearch`, `drawio_from_mermaid`, `drawio_layout`, `drawio_explain`, `drawio_open`) and three commands (`/drawme`, `/drawme-check`, `/drawme-export`).
66
+ - A guided `/drawme` workflow that steers authoring, validation, a vision preview self-check, human review, and final multi-format export.
67
+ - Pure-TypeScript ports of the skill's structural linter, `-e` PNG IEND repair, shape search (over a bundled index), and diagram-to-Markdown describer — no Python runtime required.
68
+ - draw.io binary resolution across macOS/Linux/Windows/WSL, headless-Linux `xvfb-run` handling, and version-gated Mermaid conversion + ELK auto-layout (draw.io v30+).
69
+ - Validation pipeline: golden asset-integrity check, TypeScript typecheck, ESLint, a custom format check, and unit + real-CLI integration tests.
70
+
71
+ ## Quick Start
72
+
73
+ ### 1) Install the draw.io desktop CLI
74
+
75
+ ```bash
76
+ brew install --cask drawio # macOS
77
+ # others: https://github.com/jgraph/drawio-desktop/releases (Linux: prefer the .deb/.rpm, not snap)
78
+ drawio --version
79
+ ```
80
+
81
+ ### 2) Install the extension
82
+
83
+ ```bash
84
+ cd /path/to/your/project
85
+ pi install npm:@senad-d/drawme
86
+ ```
87
+
88
+ ### 3) Start Pi and check the CLI
89
+
90
+ ```bash
91
+ pi
92
+ ```
93
+
94
+ Inside Pi:
95
+
96
+ ```text
97
+ /drawme-check
98
+ ```
99
+
100
+ ### 4) Draw something
101
+
102
+ ```text
103
+ /drawme a flowchart of a user login: enter credentials, validate, then success or retry
104
+ ```
105
+
106
+ Pi checks the CLI, plans and writes the `.drawio`, validates it, exports a preview PNG, self-checks it visually, and — after your review — exports the final editable deliverable. Everything runs locally.
107
+
108
+ ### Run from a source checkout
109
+
110
+ ```bash
111
+ git clone https://github.com/senad-d/DrawMe.git
112
+ cd DrawMe
113
+ npm ci --ignore-scripts
114
+ npm run validate
115
+ pi --no-extensions -e .
116
+ ```
117
+
118
+ ## Installation
119
+
120
+ | Scope | Command | Notes |
121
+ | --- | --- | --- |
122
+ | Global | `pi install npm:@senad-d/drawme` | Loads in every trusted Pi project. |
123
+ | Project-local | `pi install npm:@senad-d/drawme -l` | Writes to `.pi/settings.json` in the current project. |
124
+ | One run | `pi -e npm:@senad-d/drawme` | Try without changing settings. |
125
+ | Git | `pi install git:senad-d/DrawMe` | Install from Git; pin a tag or commit for a fixed version. |
126
+ | Local checkout | `pi --no-extensions -e .` | Develop or test this repository. |
127
+
128
+ ## Commands
129
+
130
+ | Command | Description |
131
+ | --- | --- |
132
+ | `/drawme <description>` | Kick off the full author → validate → preview → export workflow for the described diagram. |
133
+ | `/drawme-check` | Report whether the draw.io CLI is available, its version, and v30+ feature support. |
134
+ | `/drawme-export <file> [png\|svg\|pdf\|jpg]` | One-shot final export of an existing `.drawio`. |
135
+
136
+ ## Tools
137
+
138
+ Registered for the model to call directly.
139
+
140
+ | Tool | Purpose |
141
+ | --- | --- |
142
+ | `drawio_check` | Resolve the draw.io binary, version, and whether it supports Mermaid import / `--layout` (v30+). |
143
+ | `drawio_export` | Export a `.drawio` to PNG/SVG/PDF/JPG. `mode:"preview"` → clean width-capped PNG for a vision self-check (never embedded); `mode:"final"` → embedded editable deliverable, with the truncated `-e` PNG IEND chunk auto-repaired. |
144
+ | `drawio_validate` | Deterministic structural lint: dangling edges, duplicate/reserved ids, broken parents, missing geometry; warnings for overlaps, off-canvas nodes, and edges routing through / crossing shapes. |
145
+ | `drawio_shapesearch` | Exact official `style=` strings for 10k+ AWS/Azure/GCP/Cisco/Kubernetes/UML/BPMN shapes, from a bundled local index. Use instead of guessing a style. |
146
+ | `drawio_from_mermaid` | Convert Mermaid text (inline or a `.mmd`) to a native `.drawio` with automatic layout. Requires draw.io **v30+**. |
147
+ | `drawio_layout` | Re-place nodes / route edges with an ELK preset (`verticalFlow`, `horizontalFlow`, `verticalTree`, `horizontalTree`, `radialTree`, `organic`) for large graphs. Requires draw.io **v30+**. |
148
+ | `drawio_explain` | Describe an existing `.drawio` as structured Markdown (components by container, relations) — for READMEs/PR summaries or model read-back. |
149
+ | `drawio_open` | Open a `.drawio`/export in the OS default app (draw.io desktop) for fine-tuning. |
150
+
151
+ ## Architecture
152
+
153
+ ```text
154
+ Natural-language request
155
+ └── Pi agent
156
+ └── DrawMe extension (check · validate · export · shape search · Mermaid · layout · explain · open)
157
+ └── draw.io desktop CLI (renders and exports, local process)
158
+ └── Deliverables: .drawio source + PNG / SVG / PDF / JPG
159
+ ```
160
+
161
+ The extension factory in `src/index.ts` only registers tools and commands. Each tool spawns the draw.io CLI on demand with an argument list — never a shell — so importing or loading the extension opens no sockets, timers, or network connections.
162
+
163
+ ## The /drawme Workflow
164
+
165
+ `/drawme` injects a guided seven-step loop that the model follows using the tools above:
166
+
167
+ 1. **Check** — resolve the CLI and note the version (v30+ unlocks Mermaid conversion and ELK layout).
168
+ 2. **Plan** — pick the diagram type, shapes, relationships, and layout direction.
169
+ 3. **Author** — write editable, uncompressed `.drawio` XML (or Mermaid on v30+); use `drawio_shapesearch` for exact vendor/UML/BPMN shapes; use `drawio_layout` for large graphs.
170
+ 4. **Validate** — run `drawio_validate` and fix every error before exporting.
171
+ 5. **Preview & self-check** — export a clean, width-capped PNG and inspect it visually; fix overlaps, clipping, and edge defects (max two rounds).
172
+ 6. **Review** — show the preview, apply targeted edits from your feedback, re-preview until approved.
173
+ 7. **Final export** — export each requested format (embedded/editable), report paths, and offer to open the source in the desktop app.
174
+
175
+ ## Bundled References and Assets
176
+
177
+ The model reads these on demand; all are network-free and ship in the package.
178
+
179
+ - `assets/references/xml-authoring.md` — `.drawio` skeleton, cell/edge forms, containers, palette, spacing.
180
+ - `assets/references/diagram-types.md` — per-type presets (ERD, UML, sequence, C4, architecture, ML, flowchart, SysML, BPMN, network, swimlane).
181
+ - `assets/references/mermaid-authoring.md` — Mermaid authoring for the v30+ conversion path.
182
+ - `assets/references/troubleshooting.md` — export/render failure recovery.
183
+ - `assets/data/shape-index.json.gz` — the vendored draw.io shape index behind `drawio_shapesearch` (see its notice).
184
+
185
+ ## Requirements and Compatibility
186
+
187
+ - **Node.js** ≥ 22.19.
188
+ - **draw.io desktop CLI** on PATH (or a known app path); resolved automatically on macOS (`.app`), Linux, Windows, and WSL. Pass an explicit `binary` to any tool to override.
189
+ - **draw.io v30+** for `drawio_from_mermaid` and `drawio_layout`; on older versions those tools return a clear "needs v30+" message and everything else works normally.
190
+ - **Headless Linux:** exports are wrapped in `xvfb-run` automatically when no display is present.
191
+
192
+ ## Security
193
+
194
+ DrawMe is **network-free by construction** — no tool, command, bundled reference, or the bundled shape
195
+ index makes any network request. The only processes spawned are the draw.io CLI, `xvfb-run` on headless
196
+ Linux, and the OS file opener (`open`/`xdg-open`/`start`). No prompt, diagram, file, or environment data
197
+ is ever sent anywhere. The source `drawio-skill` was audited before porting; its only outbound calls
198
+ (`aiicons.py` icon-CDN downloads and a browser-fallback URL builder) were **not** ported. See
199
+ [`SECURITY.md`](SECURITY.md).
200
+
201
+ ## Examples
202
+
203
+ Sample diagrams authored with DrawMe live in [`example/`](example/):
204
+
205
+ - [`drawme-how-it-works.drawio`](example/drawme-how-it-works.drawio) — the workflow/architecture overview shown above.
206
+ - [`drawme-installation-guide.drawio`](example/drawme-installation-guide.drawio) — an installation walkthrough.
207
+ - [`tube-map-mode-example.drawio`](example/tube-map-mode-example.drawio) — a metro-style diagram.
208
+
209
+ ## Development
210
+
211
+ ```bash
212
+ npm ci --ignore-scripts # first time: npm install to create the lockfile
213
+ npm run validate # golden check + lint + tests
214
+ ```
215
+
216
+ Individual checks:
217
+
218
+ ```bash
219
+ npm run typecheck # tsc --noEmit
220
+ npm run lint:eslint # eslint . --max-warnings=0
221
+ npm run format:check # LF endings, no trailing whitespace, final newline, valid JSON
222
+ npm run check:golden # SHA-256 integrity of bundled assets (--update to re-baseline)
223
+ npm test # vitest run
224
+ npm run coverage # vitest run --coverage
225
+ pi --no-extensions -e . # load this checkout in Pi
226
+ ```
227
+
228
+ Source layout:
229
+
230
+ - `src/index.ts` — registers the tools and commands.
231
+ - `src/drawio.ts` — binary resolution, a pure/testable export planner, the CLI runner, Mermaid conversion, ELK layout, and file-open.
232
+ - `src/validate.ts` — structural linter.
233
+ - `src/shapesearch.ts` — shape search over the bundled index.
234
+ - `src/explain.ts` — diagram-to-Markdown describer.
235
+ - `src/dom.ts` — shared xmldom helpers used by `validate`/`explain`.
236
+ - `src/png.ts` — `-e` PNG IEND repair.
237
+ - `src/workflow.ts` — the guidance `/drawme` injects.
238
+
239
+ ## Publishing
240
+
241
+ DrawMe publishes to npm as `@senad-d/drawme`. Run from a clean working tree after validation.
242
+
243
+ ```bash
244
+ npm login
245
+ npm run validate
246
+ npm version <version>
247
+ npm publish --access public
248
+ ```
249
+
250
+ Push the release commit and tag after the package is published.
251
+
252
+ ## License
253
+
254
+ MIT — see [`LICENSE`](LICENSE).
@@ -0,0 +1,17 @@
1
+ # Shape index attribution
2
+
3
+ `shape-index.json.gz` is a gzipped copy of the shape search index from
4
+ [jgraph/drawio-mcp](https://github.com/jgraph/drawio-mcp) (`shape-search/search-index.json`),
5
+ which is generated from the official draw.io / diagrams.net client shape
6
+ libraries. Both upstream sources are licensed under the **Apache License 2.0**.
7
+
8
+ - Each entry is `{style, w, h, title, tags, type}` for one palette shape.
9
+ - 10,446 shapes spanning AWS, Azure, GCP, Cisco, Kubernetes, UML, BPMN, P&ID,
10
+ electrical, flowchart, network, and the general shape sets.
11
+ - Used read-only by `scripts/shapesearch.py` to resolve exact official style
12
+ strings instead of hand-guessing them.
13
+
14
+ To refresh against a newer draw.io release, regenerate upstream with
15
+ `shape-search/generate-index.js` in the drawio-mcp repo, then re-gzip:
16
+
17
+ gzip -9 -c search-index.json > data/shape-index.json.gz
Binary file
@@ -0,0 +1,205 @@
1
+ # Diagram Type Presets
2
+
3
+ When the user requests a specific diagram type, apply the matching preset below for shapes, styles, and layout conventions. These presets set **structural** style keywords (e.g. ERD's `shape=table;childLayout=tableLayout`); a user style preset (see `references/style-presets.md`) layers color/font/edge/extras on top.
4
+
5
+ Read this file when:
6
+ - The user names one of these diagram types (ERD, UML class, sequence, C4, architecture, ML/DL model, flowchart, SysML, BPMN, network topology, cross-functional/swimlane)
7
+ - You're choosing shape vocabulary or layout direction for a new diagram
8
+
9
+ ## ERD (Entity-Relationship Diagram)
10
+
11
+ **From SQL DDL, don't hand-build**: `python3 scripts/sqlerd.py schema.sql -o graph.json` parses `CREATE TABLE` into per-table nodes (PK/FK-marked column lists) + crow's-foot FK edges for autolayout. Hand-build with the styles below when there's no DDL to parse.
12
+
13
+ | Element | Style | Notes |
14
+ |---------|-------|-------|
15
+ | Table | `shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;strokeColor=#6c8ebf;fillColor=#dae8fc;` | Each table is a container |
16
+ | Row (column) | `shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontSize=12;` | Child of table, `parent=tableId` |
17
+ | PK column | Bold text: `fontStyle=1` on the row | Mark with `PK` prefix or key icon |
18
+ | FK relationship | Dashed edge: `dashed=1;endArrow=ERmandOne;startArrow=ERmandOne;` | Use ER notation arrows |
19
+ | Layout | TB, tables spaced 300px apart | Group related tables vertically |
20
+
21
+ ## UML Class Diagram
22
+
23
+ | Element | Style | Notes |
24
+ |---------|-------|-------|
25
+ | Class box | `swimlane;fontStyle=1;align=center;startSize=26;html=1;` | 3-section: title / attributes / methods |
26
+ | Separator | `line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=10;rotatable=0;labelPosition=left;points=[];portConstraint=eastwest;` | Between sections |
27
+ | Inheritance | `endArrow=block;endFill=0;` | Hollow triangle arrow |
28
+ | Implementation | `endArrow=block;endFill=0;dashed=1;` | Dashed + hollow triangle |
29
+ | Composition | `endArrow=diamondThin;endFill=1;` | Filled diamond |
30
+ | Aggregation | `endArrow=diamondThin;endFill=0;` | Hollow diamond |
31
+ | Layout | TB, classes 250px apart | Interfaces above implementations |
32
+
33
+ ## Sequence Diagram
34
+
35
+ **Don't hand-place sequence geometry** — `python3 scripts/seqlayout.py seq.json -o out.drawio` computes all lifeline/activation-bar/arrow coordinates deterministically from a participants + messages JSON (schema in the script docstring), using exactly the styles below. Hand-edit the output only for fragments (alt/loop frames), which are out of its scope.
36
+
37
+ | Element | Style | Notes |
38
+ |---------|-------|-------|
39
+ | Actor/Object | `shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;portConstraint=eastwest;` | Lifeline with dashed vertical line |
40
+ | Sync message | `html=1;verticalAlign=bottom;endArrow=block;` | Solid line, filled arrowhead |
41
+ | Async message | `html=1;verticalAlign=bottom;endArrow=open;dashed=1;` | Dashed line, open arrowhead |
42
+ | Return message | `html=1;verticalAlign=bottom;endArrow=open;dashed=1;strokeColor=#999999;` | Grey dashed |
43
+ | Activation box | `shape=umlFrame;whiteSpace=wrap;` on the lifeline | Narrow rectangle on lifeline |
44
+ | Layout | LR, lifelines spaced 200px apart | Time flows top to bottom |
45
+
46
+ ## C4 Model (System Context / Container / Component)
47
+
48
+ **Don't hand-build** — `python3 scripts/c4.py c4.json -o out.drawio` generates the whole multi-page set (one page per level, drill-down links from parent elements to child pages, Graphviz placement; schema in the script docstring). The styles below are what it emits — for hand-tweaks afterwards:
49
+
50
+ | Element | Style | Notes |
51
+ |---------|-------|-------|
52
+ | Person | `shape=mxgraph.c4.person2;html=1;whiteSpace=wrap;fontColor=#ffffff;fillColor=#083F75;strokeColor=#06315C;` | Dark-blue person shape, 200×180 |
53
+ | Software System | `rounded=1;arcSize=10;html=1;whiteSpace=wrap;fontColor=#ffffff;fillColor=#1061B0;strokeColor=#0D5091;` | 240×120 |
54
+ | External System | same, `fillColor=#8C8496;strokeColor=#736782;` | Grey = outside your control |
55
+ | Container | same, `fillColor=#23A2D9;strokeColor=#0E7DAD;` | Mid-blue |
56
+ | Component | same, `fillColor=#63BEF2;strokeColor=#2086C9;` | Light-blue |
57
+ | Database | `shape=cylinder3;size=15;boundedLbl=1;` + Container colors | Cylinder |
58
+ | Relationship | `endArrow=blockThin;endFill=1;html=1;fontSize=11;fontColor=#404040;strokeColor=#828282;labelBackgroundColor=#ffffff;` | Grey thin arrow, label = protocol/action |
59
+ | Label format | `Name` ⏎ `[Type: Tech]` ⏎ `description` | The standard three-line C4 label |
60
+ | Drill-down | wrap the element in `<UserObject link="data:page/id,<pageId>">` | Click jumps to the child page in draw.io / viewer |
61
+ | Layout | TB, one `<diagram>` page per level | Export a single page with `--page-index <n>` (1-based) |
62
+
63
+ ## Architecture Diagram
64
+
65
+ | Element | Style | Notes |
66
+ |---------|-------|-------|
67
+ | Layer/tier | `swimlane;startSize=30;` | Containers for grouping: Client / API / Service / Data |
68
+ | Service | `rounded=1;whiteSpace=wrap;html=1;` + tier color | Use color palette by tier |
69
+ | Database | `shape=cylinder3;whiteSpace=wrap;html=1;` | Green palette |
70
+ | Queue/Bus | `rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;` | Yellow — place centrally for hub pattern |
71
+ | Gateway/LB | `shape=mxgraph.aws4.resourceIcon;` or `rounded=1;` with orange | Orange palette |
72
+ | External | `rounded=1;dashed=1;fillColor=#f5f5f5;strokeColor=#666666;` | Dashed border for external systems |
73
+ | Layout | TB or LR by tier count; ≥4 tiers → TB | Hub nodes centered |
74
+
75
+ ## ML / Deep Learning Model Diagram
76
+
77
+ For neural network architecture diagrams — ideal for papers targeting NeurIPS, ICML, ICLR.
78
+
79
+ | Element | Style | Notes |
80
+ |---------|-------|-------|
81
+ | Layer block | `rounded=1;whiteSpace=wrap;html=1;` + type color | Main building block |
82
+ | Input/Output | `fillColor=#d5e8d4;strokeColor=#82b366;` | Green |
83
+ | Conv / Pooling | `fillColor=#dae8fc;strokeColor=#6c8ebf;` | Blue |
84
+ | Attention / Transformer | `fillColor=#e1d5e7;strokeColor=#9673a6;` | Purple |
85
+ | RNN / LSTM / GRU | `fillColor=#fff2cc;strokeColor=#d6b656;` | Yellow |
86
+ | FC / Linear | `fillColor=#ffe6cc;strokeColor=#d79b00;` | Orange |
87
+ | Loss / Activation | `fillColor=#f8cecc;strokeColor=#b85450;` | Red/Pink |
88
+ | Skip connection | `dashed=1;endArrow=block;curved=1;` | Dashed curved arrow |
89
+ | Tensor shape label | Add shape annotation as secondary label: `value="Conv2D&#xa;(B, 64, 32, 32)"` | Use `&#xa;` for multi-line |
90
+ | Layout | TB (data flows top→bottom), layers 150px apart | Group encoder/decoder as swimlanes |
91
+
92
+ **Tensor shape convention:** annotate each layer with input/output tensor dimensions in `(B, C, H, W)` or `(B, T, D)` format. Place dimensions as the second line of the label using `&#xa;`.
93
+
94
+ ## SysML (Block Definition / Internal Block / Requirement / Parametric)
95
+
96
+ draw.io ships a native SysML 1.x shape library (`mxgraph.sysml.*`, ~60 shapes) — run `python3 scripts/shapesearch.py "sysml <keyword>"` for any element not listed below. Stereotype labels use guillemets as the first label line: `&#171;block&#187;` (HTML entities for « »). SysML behavioral diagrams (activity, state machine, use case, sequence) reuse the UML presets above; search `shapesearch.py "sysml activity"` / `"sysml state"` for the SysML-specific variants.
97
+
98
+ ### Block Definition Diagram (bdd)
99
+
100
+ | Element | Style | Notes |
101
+ |---------|-------|-------|
102
+ | Block | `swimlane;fontStyle=1;align=center;startSize=40;html=1;` | Label `&#171;block&#187;&#xa;Name`; compartments (values / parts / operations) like UML class |
103
+ | Compartment separator | same `line;...` style as UML Class | Between compartments |
104
+ | Composite association | `html=1;endArrow=none;startArrow=diamondThin;startFill=1;` | Filled diamond at the whole (owner) end |
105
+ | Reference association | `html=1;endArrow=none;startArrow=diamondThin;startFill=0;` | Hollow diamond |
106
+ | Generalization | `edgeStyle=none;html=1;endArrow=block;endFill=0;endSize=12;` | Hollow triangle pointing at the parent block |
107
+ | Multiplicity | edge labels `1`, `0..1`, `1..*` near the ends | Offset with edge label geometry |
108
+ | Layout | TB, whole block on top, part blocks below, 250px apart | Same convention as UML class |
109
+
110
+ ### Internal Block Diagram (ibd)
111
+
112
+ | Element | Style | Notes |
113
+ |---------|-------|-------|
114
+ | Frame | `rounded=0;html=1;verticalAlign=top;align=left;spacingLeft=10;fontStyle=1;container=1;` | Label `ibd [block] Name`; parts are children |
115
+ | Part | `rounded=0;whiteSpace=wrap;html=1;` | Label `partName : BlockType` |
116
+ | Port | `html=1;shape=mxgraph.sysml.port;sysMLPortType=flowN;` 20×20 | Child of the part, relative geometry pinned to its border |
117
+ | Connector | `html=1;endArrow=none;` | Solid line port-to-port |
118
+ | Item flow direction | `shape=triangle;fillColor=strokeColor;` 10×10 on the connector + item label | Triangle points along the flow |
119
+
120
+ ### Requirement Diagram (req)
121
+
122
+ | Element | Style | Notes |
123
+ |---------|-------|-------|
124
+ | Requirement | `swimlane;fontStyle=1;align=center;startSize=26;html=1;` | Title `&#171;requirement&#187;&#xa;Name`; body compartment `id="R1.1"&#xa;text="..."` |
125
+ | Containment | `edgeStyle=none;html=1;startArrow=sysMLPackCont;startSize=12;endArrow=none;` | Crosshair-circle at the parent end |
126
+ | deriveReqt / satisfy / verify / refine | `html=1;endArrow=open;endSize=12;dashed=1;` + edge label `&#171;satisfy&#187;` | Dashed open arrow pointing at the requirement |
127
+ | Trace | same dashed style, label `&#171;trace&#187;` | |
128
+ | Layout | TB, parent requirements above children, 200px apart | Satisfy/verify sources (blocks, test cases) at the bottom |
129
+
130
+ ### Parametric Diagram (par)
131
+
132
+ | Element | Style | Notes |
133
+ |---------|-------|-------|
134
+ | Constraint block | `rounded=1;whiteSpace=wrap;html=1;` | Label `&#171;constraint&#187;&#xa;{F = m · a}` |
135
+ | Parameter port | `rounded=0;html=1;fontSize=10;` 20×20 on the border | Label = parameter name (`m`, `a`, `F`) |
136
+ | Binding connector | `html=1;endArrow=none;` | Solid, no arrows |
137
+ | Value property | `rounded=0;whiteSpace=wrap;html=1;` | Label `name : Type` |
138
+ | Layout | LR, value properties on the outside, constraints centered | |
139
+
140
+ ## BPMN (Business Process)
141
+
142
+ draw.io ships ~200 native BPMN 2.0 shapes (`mxgraph.bpmn.*`). The official styles carry a long `points=[...]` connection-point list — run `python3 scripts/shapesearch.py "bpmn <element>"` for the full string; the styles below omit it for brevity and still render correctly.
143
+
144
+ | Element | Style | Notes |
145
+ |---------|-------|-------|
146
+ | Pool | `swimlane;html=1;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;collapsible=0;` | Container; label rotated in the left header band |
147
+ | Lane | `swimlane;html=1;startSize=30;horizontal=0;collapsible=0;fillColor=none;` | Child of the pool, `parent=poolId`, one per role |
148
+ | Task | `shape=mxgraph.bpmn.task2;whiteSpace=wrap;rectStyle=rounded;size=10;html=1;container=1;expand=0;collapsible=0;taskMarker=abstract;` | `taskMarker=user\|service\|script\|manual\|send\|receive\|businessRule` for typed tasks |
149
+ | Start event | `shape=mxgraph.bpmn.event;html=1;perimeter=ellipsePerimeter;aspect=fixed;outline=standard;symbol=general;verticalLabelPosition=bottom;verticalAlign=top;align=center;labelBackgroundColor=#ffffff;` 50×50 | `symbol=message\|timer` for message/timer start |
150
+ | Intermediate event | same, `outline=throwing` (send) or `outline=catching` (receive) | Double circle |
151
+ | End event | same, `outline=end;symbol=general` | Thick circle; `symbol=terminate` for terminate end |
152
+ | Gateway | `shape=mxgraph.bpmn.gateway2;html=1;perimeter=rhombusPerimeter;outline=none;symbol=none;gwType=exclusive;verticalLabelPosition=bottom;verticalAlign=top;align=center;labelBackgroundColor=#ffffff;` 50×50 | `gwType=exclusive\|parallel\|inclusive\|complex` |
153
+ | Sequence flow | `edgeStyle=elbowEdgeStyle;html=1;endArrow=blockThin;endFill=1;` | Solid, filled thin arrow |
154
+ | Conditional flow | same + `startArrow=diamondThin;startFill=0;startSize=10;endSize=6;` | Hollow diamond at source |
155
+ | Default flow | same + `startArrow=dash;startFill=0;startSize=6;endSize=6;` | Tick at source |
156
+ | Message flow | `dashed=1;dashPattern=8 4;endArrow=blockThin;endFill=1;startArrow=oval;startFill=0;startSize=4;endSize=6;html=1;` | Dashed, only **between** pools |
157
+ | Data object | `shape=mxgraph.bpmn.data2;size=15;html=1;verticalLabelPosition=bottom;verticalAlign=top;align=center;` 40×60 | Dashed dotted-arrow association |
158
+ | Annotation | `html=1;shape=mxgraph.flowchart.annotation_2;align=left;labelPosition=right;` | Open bracket + dashed line |
159
+ | Layout | LR inside lanes, events/gateways vertically centered on the flow line | Sequence flows never cross pool borders; message flows never stay inside one |
160
+
161
+ ## Network Topology
162
+
163
+ Generic vocabulary is the `mxgraph.networks` library — one shared style prefix, per-element `shape=`. For **vendor-specific** icons (Cisco `mxgraph.cisco19`/`cisco_safe`, rack `mxgraph.rack`, cloud vendors), run `python3 scripts/shapesearch.py "<vendor> <device>"` instead.
164
+
165
+ Shared prefix (every node below): `fontColor=#0066CC;verticalAlign=top;verticalLabelPosition=bottom;labelPosition=center;align=center;html=1;outlineConnect=0;fillColor=#CCCCCC;strokeColor=#6881B3;gradientColor=none;gradientDirection=north;strokeWidth=2;`
166
+
167
+ | Element | Append to prefix | Size |
168
+ |---------|------------------|------|
169
+ | Router | `shape=mxgraph.networks.router;` | 100×30 |
170
+ | Switch | `shape=mxgraph.networks.switch;` | 100×30 |
171
+ | Firewall | `shape=mxgraph.networks.firewall;` | 100×100 |
172
+ | Load balancer | `shape=mxgraph.networks.load_balancer;` | 100×30 |
173
+ | Server | `shape=mxgraph.networks.server;` | 90×100 |
174
+ | Storage / NAS | `shape=mxgraph.networks.storage;` / `...nas_filer;` | 100×100 / 100×35 |
175
+ | PC / Laptop | `shape=mxgraph.networks.pc;` / `...laptop;` | 100×70 / 100×55 |
176
+ | Wireless AP | `shape=mxgraph.networks.wireless_hub;` | 100×100 |
177
+ | Internet / WAN | `shape=mxgraph.networks.cloud;fontColor=#ffffff;` | 90×50 |
178
+ | Zone (subnet/VLAN/DMZ) | `rounded=1;dashed=1;fillColor=#f5f5f5;strokeColor=#666666;verticalAlign=top;fontStyle=1;container=1;` | Container; label = CIDR / zone name |
179
+ | Physical link | `html=1;endArrow=none;strokeWidth=2;` | Plain line; label = interface/VLAN |
180
+ | Logical/VPN link | `html=1;endArrow=none;dashed=1;` | Dashed |
181
+ | Layout | TB by tier: Internet → edge (router/firewall) → distribution (switch/LB) → servers/clients | Group each subnet in a zone container; label links with CIDR/port |
182
+
183
+ ## Cross-Functional Flowchart (Swimlane)
184
+
185
+ A flowchart split by **who does what** — one lane per role/department. Node vocabulary reuses the Flowchart preset below; only the container skeleton differs.
186
+
187
+ | Element | Style | Notes |
188
+ |---------|-------|-------|
189
+ | Pool (process) | `swimlane;html=1;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;collapsible=0;` | Outer container, label = process name |
190
+ | Lane (role) | `swimlane;html=1;startSize=30;horizontal=0;collapsible=0;fillColor=none;` | Child of pool, one per role/team/system |
191
+ | Steps | Flowchart preset styles (Start/End, Process, Decision, I/O) | Each step's `parent` = its lane id; coordinates relative to the lane |
192
+ | Handoff edge | `edgeStyle=orthogonalEdgeStyle;html=1;rounded=1;` | Edges crossing lanes are the handoffs — the diagram's point |
193
+ | Layout | LR flow inside horizontal lanes; time flows left → right | Keep each step inside its actor's lane; ≥160px horizontal spacing |
194
+
195
+ ## Flowchart (enhanced)
196
+
197
+ | Element | Style | Notes |
198
+ |---------|-------|-------|
199
+ | Start/End | `ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;` | Green oval |
200
+ | Process | `rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;` | Blue rectangle |
201
+ | Decision | `rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;` | Yellow diamond |
202
+ | I/O | `shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;` | Orange parallelogram |
203
+ | Subprocess | `rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;` + double border | Purple |
204
+ | Yes/No labels | `value="Yes"` / `value="No"` on decision edges | Always label decision branches |
205
+ | Layout | TB, 200px vertical gap | Decisions branch LR, merge back to center |
@@ -0,0 +1,56 @@
1
+ # Mermaid authoring → native .drawio
2
+
3
+ Read this when the diagram is a **standard type with no custom styling needs** and the draw.io CLI is **version ≥ 30** — writing Mermaid text and letting the CLI convert it is faster and safer than hand-placing XML: you only get the *structure* right, layout comes free.
4
+
5
+ ```bash
6
+ # .mmd in → laid-out, editable, native .drawio out (draw.io desktop ≥ 30)
7
+ drawio -x -f xml -o diagram.drawio diagram.mmd
8
+ # then continue the normal workflow (validate → preview PNG → self-check → …)
9
+ ```
10
+
11
+ **Version gate (critical):** on draw.io ≤ 29 the `.mmd` input fails with `Export failed`, and the `--layout` flag corrupts argument parsing entirely (like the `-w` pitfall). Resolve the CLI version in workflow step 1 (`drawio --version`); if it prints < 30, skip both this path and `--layout`, and author XML instead (optionally suggest `brew upgrade --cask drawio`).
12
+
13
+ ## When to prefer which authoring mode
14
+
15
+ | Author as | Best for | Why |
16
+ |---|---|---|
17
+ | **Mermaid → CLI convert** | flowchart, state, gantt, timeline, journey, pie, quadrant, sankey, gitGraph, **mindmap**, kanban, requirement, block, xychart, radar, wardley, C4 sketches | structure-only input, free layout, 28 types |
18
+ | **XML (this skill's core path)** | anything needing **official vendor icons** (shapesearch/aiicons), **style presets**, swimlanes, precise positions, edge waypoint control, multi-page/drill-down | Mermaid can't express draw.io styles/shapes |
19
+ | **Bundled generators** | code/IaC/SQL imports, sequence (seqlayout), C4 with drill-down (c4.py) | deterministic, data-driven |
20
+
21
+ Routing note: this converts Mermaid **into a `.drawio` deliverable**. If the user wants Mermaid text that lives in git / renders in Markdown, route to the **mermaid** skill instead (see "When to use / when NOT to use").
22
+
23
+ ## Mermaid quirks that matter for draw.io's parser
24
+
25
+ Condensed from the upstream reference (jgraph/drawio-mcp `shared/mermaid-reference.md`, Apache-2.0):
26
+
27
+ - The **first non-directive line's keyword selects the type** — a misspelled header yields a blank diagram. Common: `flowchart TD`, `sequenceDiagram`, `classDiagram`, `stateDiagram-v2`, `erDiagram`, `gantt`, `mindmap`, `timeline`, `journey`, `pie`, `gitGraph`, `quadrantChart`, `sankey-beta`, `kanban`, `c4Context`.
28
+ - **Node IDs are identifiers** (`A`, `node_1`) — no spaces, no trailing punctuation, avoid reserved words (`end`, `class`, `subgraph`). Display text goes in brackets/quotes: `A["User's Account"]`.
29
+ - **One statement per line**; quote labels containing `:`, `-`, parentheses, or non-ASCII (use `"`, not `'`).
30
+ - Only `<br>`, `<b>`, `<i>`, `<u>` are reliable HTML in labels; hex colors only (`#fff`, never `rgb()`).
31
+ - Styling: `style A fill:#f9f,stroke:#333`, reusable `classDef x fill:#dfd` + `A:::x`, edge `linkStyle 0 stroke:#f00`.
32
+ - **Never apply `--layout` to a Mermaid-converted file** — it is already laid out.
33
+ - Match label language to the user's language.
34
+
35
+ After converting, treat the `.drawio` as the artifact (delete the `.mmd`) and continue at the **validate → export draft** steps as usual. The converted file uses `UserObject`-wrapped cells — `validate.py` handles those.
36
+
37
+ ## ELK `--layout` pass (XML-authored diagrams, CLI ≥ 30)
38
+
39
+ For XML you authored with rough (or all-zero) positions, the CLI can run the editor's ELK layouts — an alternative to `autolayout.py` when Graphviz is unavailable, and the better choice for **organic/radial** shapes (networks, mind-map-like graphs) that `dot` lays out poorly:
40
+
41
+ ```bash
42
+ # in-place re-layout (reading and overwriting the same path is supported)
43
+ drawio -x -f xml --layout verticalFlow -o diagram.drawio diagram.drawio
44
+ # or layout + export in one call
45
+ drawio -x -f png -e -b 10 --layout verticalFlow -o diagram.drawio.png diagram.drawio
46
+ ```
47
+
48
+ | Preset | Layout |
49
+ |---|---|
50
+ | `verticalFlow` / `horizontalFlow` | layered — flowcharts, pipelines |
51
+ | `verticalTree` / `horizontalTree` / `radialTree` | trees — hierarchies, org charts |
52
+ | `organic` | force-directed — networks, mind maps |
53
+
54
+ Finer control: pass a JSON array instead of a preset — `--layout '[{"layout":"elkLayered","config":{"elk.direction":"RIGHT","elk.spacing.nodeNode":40}}]'` (algorithms: `elkLayered`, `elkTree`, `elkRadial`, `elkOrganic`, `elkStress`, `elkBox`).
55
+
56
+ Choosing between layout engines: `autolayout.py` (Graphviz) understands this skill's graph-JSON pipeline (importers, groups→clusters, `--tune`, palette tinting) — prefer it when that pipeline is in play. Use `--layout` when Graphviz is missing, when re-laying-out an existing `.drawio`, or for organic/radial topologies.
@@ -0,0 +1,63 @@
1
+ # Troubleshooting — Common Mistakes
2
+
3
+ Read this when something looks wrong in the output (rendering, export, layout, edges) or when a CLI invocation fails. Most rows have a one-line fix.
4
+
5
+ | Mistake | Fix |
6
+ |---------|-----|
7
+ | Missing `id="0"` and `id="1"` root cells | Always include both at the top of `<root>` |
8
+ | Shapes not connected | `source` and `target` on edge must match existing shape `id` values |
9
+ | Self-closing edge `mxCell` (`<mxCell ... edge="1" />`) | Use the expanded form with `<mxGeometry relative="1" as="geometry" />` child — self-closing edges won't render |
10
+ | `--` inside XML comments | Illegal per XML spec — use single hyphens or rephrase |
11
+ | Special characters in `value` | Use XML entities: `&amp;` `&lt;` `&gt;` `&quot;` |
12
+ | Literal `\n` in label text | Use `&#xa;` for line breaks in `value` attributes |
13
+ | Overlapping shapes | Scale spacing with complexity (200–350px); leave routing corridors |
14
+ | Edges crossing through shapes | Add waypoints, distribute entry/exit points, or increase spacing |
15
+ | Arrowhead overlaps bend | Final edge segment before target must be ≥20px — increase spacing or add waypoints |
16
+ | Iteration loop never ends | After 5 rounds, suggest user open .drawio in draw.io desktop for fine-tuning |
17
+ | `command not found: draw.io` after `brew install --cask drawio` | Homebrew installs the binary as `drawio` (no dot). Use `drawio --version`, not `draw.io --version`. The dot-name only exists inside the `.app` bundle (`/Applications/draw.io.app/Contents/MacOS/draw.io`) and on Windows (`draw.io.exe`). |
18
+ | Export command not found on macOS | Try full path `/Applications/draw.io.app/Contents/MacOS/draw.io` |
19
+ | Vision returns "Unable to resize image — dimensions exceed the 2576x2576px limit" | The preview PNG is too large for Claude's vision API. Re-export with `--width 2000` instead of `-s 2` (the flag is `--width`; there is no short `-w` — passing `-w 2000` silently breaks input-file parsing and drawio errors with "input file/directory not found"). For very tall-narrow diagrams that still overshoot, use `--height 2000` instead. |
20
+ | Linux: blank/error output headlessly | Prefix command with `xvfb-run -a` |
21
+ | Linux: `--no-sandbox` placed before input file (parsed as filename) | Move `--no-sandbox` to the very end of the command (drawio-desktop#249, #1056) |
22
+ | Linux: `Failed to get 'appData' path` / `Home directory not accessible` | `export HOME=/tmp` before invoking drawio (drawio-desktop#127) |
23
+ | Linux server: segfault / EGL / MESA `failed to load driver` errors | Add `--disable-gpu` (suppresses Chromium GL init when no GPU available) |
24
+ | PDF export fails | Ensure Chromium is available (draw.io bundles it on desktop) |
25
+ | Background color wrong in CLI export | Known CLI bug; add `--transparent` flag or set background via style |
26
+ | Vision returns 400 "Could not process image" on draft PNG | Re-export the preview without `-e` (issue #8). Root cause is a truncated IEND chunk in `-e` PNGs, not the `zTXt` chunk itself — but skipping `-e` for the preview is the simplest fix. |
27
+ | Final `-e` PNG won't open in image viewers / vision APIs | Run `python3 <this-skill-dir>/scripts/repair_png.py <path>`. draw.io CLI emits `-e` PNGs with an 8-byte truncation at IEND. SVG/PDF unaffected. |
28
+ | WSL2: `drawio` / `draw.io` not found | The CLI lives on the Windows side. Use the Windows desktop exe via `/mnt/c`: `"/mnt/c/Program Files/draw.io/draw.io.exe"` (or per-user `"/mnt/c/Users/<you>/AppData/Local/Programs/draw.io/draw.io.exe"`). |
29
+ | WSL2: opening an exported file fails with a `/mnt/c/...`-style path | `cmd.exe` can't resolve WSL paths — convert first: `cmd.exe /c start "" "$(wslpath -w diagram.drawio.png)"`. The empty `""` after `start` is the (required) window title. |
30
+ | Browser URL opens to a blank/empty diagram (Windows/WSL2) | `cmd.exe`'s `start` treats `&` as a separator and drops everything after `#` — so the `#R…`/`#create=…` fragment (the whole diagram) is lost. Never pass the URL straight to `start`. Write a `.url` shortcut file and open *that* (see "WSL2 / Windows" below). |
31
+
32
+ ## WSL2 / Windows specifics
33
+
34
+ **Locate the CLI.** Detect WSL2 with `grep -qi microsoft /proc/version`. On WSL2 the
35
+ export CLI is the Windows desktop exe, reached through `/mnt/c` (quote the path —
36
+ it contains a space):
37
+
38
+ ```bash
39
+ "/mnt/c/Program Files/draw.io/draw.io.exe" --version
40
+ # per-user install fallback:
41
+ "/mnt/c/Users/$USER/AppData/Local/Programs/draw.io/draw.io.exe" --version
42
+ ```
43
+
44
+ **Open a file.** Convert the WSL path to a Windows path first; `cmd.exe` cannot
45
+ follow `/mnt/c/...`:
46
+
47
+ ```bash
48
+ cmd.exe /c start "" "$(wslpath -w diagram.drawio.png)"
49
+ ```
50
+
51
+ **Open a browser-fallback URL.** `cmd.exe /c start` strips the URL fragment
52
+ (`&` ends the command, `#…` is dropped) — and the fragment carries the entire
53
+ diagram. Write a `.url` shortcut and open it instead, so the URL survives intact:
54
+
55
+ ```bash
56
+ URL=$(python3 <this-skill-dir>/scripts/encode_drawio_url.py --edit diagram.drawio)
57
+ TMP=$(mktemp --suffix=.url)
58
+ printf '[InternetShortcut]\r\nURL=%s\r\n' "$URL" > "$TMP"
59
+ cmd.exe /c start "" "$(wslpath -w "$TMP")"
60
+ ```
61
+
62
+ On native Windows the same `.url`-file trick applies (`start "" "%TEMP%\d.url"`).
63
+ On macOS/Linux just `open "$URL"` / `xdg-open "$URL"` — no workaround needed.