@senad-d/drawme 0.1.10 → 0.2.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/CHANGELOG.md +17 -1
- package/README.md +47 -46
- package/SECURITY.md +1 -1
- package/assets/references/diagram-types.md +3 -3
- package/assets/references/mermaid-authoring.md +10 -9
- package/assets/references/troubleshooting.md +5 -27
- package/assets/references/xml-authoring.md +5 -3
- package/docs/reference.md +75 -73
- package/docs/visual-review-implementation-tasks.md +4 -2
- package/example/README.md +9 -9
- package/example/drawme-architecture.drawio +5 -5
- package/example/drawme-how-it-works.drawio +7 -7
- package/example/drawme-installation-guide.drawio +6 -6
- package/package.json +5 -3
- package/src/animate.ts +124 -88
- package/src/animation.ts +105 -109
- package/src/diagram-files.ts +159 -0
- package/src/dom.ts +5 -0
- package/src/drawio.ts +330 -558
- package/src/editable-import.ts +228 -0
- package/src/explain.ts +81 -88
- package/src/export-plan.ts +175 -0
- package/src/fitcanvas.ts +29 -25
- package/src/geometry.ts +68 -29
- package/src/index.ts +201 -142
- package/src/motion.ts +251 -163
- package/src/png.ts +233 -34
- package/src/renderer.ts +361 -0
- package/src/shapesearch.ts +33 -32
- package/src/storyboard.ts +41 -26
- package/src/svg-helpers.ts +129 -0
- package/src/svgexport.ts +6 -9
- package/src/validate.ts +686 -292
- package/src/workflow.ts +41 -30
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,21 @@ All notable changes to this project are documented here. The format is based on
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Explicit raster sizes are now subject to the 6,000,000-pixel budget, including the border. `drawio_export` exposes `width` only; `height` is internal. See the [export reference](docs/reference.md#drawio_export) for format-specific sizing.
|
|
12
|
+
|
|
13
|
+
## [0.2.0] - 2026-12-01
|
|
14
|
+
|
|
15
|
+
- Linux rendering requires an unprivileged user, explicit page selection requires draw.io 32.4.1 or later, and nondefault animation outputs use page-specific storyboard names.
|
|
16
|
+
- The five tools no longer accept a `binary` option; set `DRAWME_DRAWIO_BINARY` in Pi’s launch environment for a custom CLI, and use the desktop opener only for supported documents. `drawio_animate` rejects an exported SVG instead of reporting verified flow when a declared connector is missing or lacks the native animation marker.
|
|
17
|
+
|
|
18
|
+
## [0.1.11] - 2026-11-09
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Final PNG/JPG exports use the selected page's content width and height to lower the raster scale when needed, targeting a six-million-pixel budget to avoid draw.io `UnknownVizError` failures. That release left explicit sizing requests unchanged; only width was exposed by the registered tool.
|
|
23
|
+
|
|
9
24
|
## [0.1.10] - 2026-10-27
|
|
10
25
|
|
|
11
26
|
### Fixed
|
|
@@ -142,7 +157,8 @@ Initial release: DrawMe as a native Pi extension for authoring, validating, and
|
|
|
142
157
|
- Tooling: ESLint flat config, custom `format:check`, `check:golden` asset-integrity check, Vitest suite
|
|
143
158
|
with real-CLI integration tests, CI, SonarCloud, and release workflows.
|
|
144
159
|
|
|
145
|
-
[Unreleased]: https://github.com/senad-d/DrawMe/compare/v0.1.
|
|
160
|
+
[Unreleased]: https://github.com/senad-d/DrawMe/compare/v0.1.11...HEAD
|
|
161
|
+
[0.1.11]: https://github.com/senad-d/DrawMe/compare/v0.1.10...v0.1.11
|
|
146
162
|
[0.1.10]: https://github.com/senad-d/DrawMe/compare/v0.1.9...v0.1.10
|
|
147
163
|
[0.1.9]: https://github.com/senad-d/DrawMe/compare/v0.0.1...v0.1.9
|
|
148
164
|
[0.0.1]: https://github.com/senad-d/DrawMe/releases/tag/v0.0.1
|
package/README.md
CHANGED
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
Natural-language diagrams for <a href="https://pi.dev">pi</a>.
|
|
15
|
-
<br />Turns a description into editable <code>.drawio</code> XML and exports it to PNG / SVG / PDF / JPG, including verified standalone animated SVG
|
|
15
|
+
<br />Turns a description into editable <code>.drawio</code> XML and exports it to PNG / SVG / PDF / JPG, including verified standalone animated SVG, with local rendering.
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
DrawMe is a native Pi **extension** for diagram authoring. Describe a diagram and Pi plans it, writes editable `.drawio` XML (or Mermaid
|
|
20
|
+
DrawMe is a native Pi **extension** for diagram authoring. Describe a diagram and Pi plans it, writes editable `.drawio` XML (or Mermaid when the CLI supports conversion), lints every source revision, critiques the rendered preview when the active model can view images, and exports the final deliverable — fully autonomously, with no human intervention once started.
|
|
21
|
+
|
|
22
|
+
> **Privacy:** DrawMe renders diagrams locally. Your request and any attached preview or storyboard images enter Pi's model context and may be sent to your configured hosted model provider. A text-only model, or one whose image support is unknown, gets no image attachment.
|
|
21
23
|
|
|
22
24
|
<table align="center">
|
|
23
25
|
<tr>
|
|
@@ -35,13 +37,13 @@ DrawMe is a native Pi **extension** for diagram authoring. Describe a diagram an
|
|
|
35
37
|
</tr>
|
|
36
38
|
</table>
|
|
37
39
|
|
|
38
|
-
- **Natural-language authoring:** flowcharts, architecture, UML, BPMN, ERD, C4, network, ML — as native `.drawio`, or as Mermaid with automatic layout on
|
|
40
|
+
- **Natural-language authoring:** flowcharts, architecture, UML, BPMN, ERD, C4, network, ML — as native `.drawio`, or as Mermaid with automatic layout on supported renderers.
|
|
39
41
|
- **Guided workflow:** CLI detection, planning, authoring, validation, a gated multi-pass visual review (fit/sizing → element placement → connections → holistic confirmation), and final export run end to end from a single `/drawme` — no approval pauses.
|
|
40
42
|
- **Deterministic validation:** a structural linter catches dangling edges, duplicate/reserved ids, malformed geometry, page/container overflow, inadequate margins, conservative readability defects, overlaps, and explicit edge-routing defects before you look at a pixel.
|
|
41
|
-
- **Vision-aware previews:**
|
|
43
|
+
- **Vision-aware previews:** verified PNG previews attach an image only when the active model can view it. Otherwise, review is structural. An image in the transcript is not a promise that its preview file remains on disk.
|
|
42
44
|
- **Exact shapes, not guesses:** search 10k+ official AWS/Azure/GCP/Cisco/Kubernetes/UML/BPMN styles from a bundled local index.
|
|
43
45
|
- **Animated SVG:** pop/slide entrances, connector draw-in, travelling dots, highlights, staggered cascades, persistent connector flow, and portable page sequences export as verified standalone SVG animation, with a storyboard, reduced-motion handling, and a static PNG fallback.
|
|
44
|
-
- **Editable source of truth:** final PNG/SVG/PDF exports embed the diagram XML
|
|
46
|
+
- **Editable source of truth:** final PNG/SVG/PDF exports embed the diagram XML by default (JPG never does). DrawMe can repair an otherwise valid PNG with a truncated end chunk.
|
|
45
47
|
|
|
46
48
|
> **Security:** Pi packages run with your full system permissions. DrawMe reads and writes diagram files and can launch the draw.io CLI or your OS file opener. Review [`SECURITY.md`](SECURITY.md) before installation.
|
|
47
49
|
|
|
@@ -72,8 +74,8 @@ This checkout implements the DrawMe core loop as a Pi extension:
|
|
|
72
74
|
- Ten model-callable tools (`drawio_check`, `drawio_export`, `drawio_animate`, `drawio_validate`, `drawio_fit_canvas`, `drawio_shapesearch`, `drawio_from_mermaid`, `drawio_layout`, `drawio_explain`, `drawio_open`) and three commands (`/drawme`, `/drawme-check`, `/drawme-export`).
|
|
73
75
|
- A guided `/drawme` workflow that steers authoring, validation after every edit, a gated multi-pass visual review, and autonomous final multi-format export.
|
|
74
76
|
- Pure-TypeScript structural linting, `-e` PNG IEND repair, shape search over a bundled index, and diagram-to-Markdown description — no Python runtime required.
|
|
75
|
-
- draw.io binary resolution across macOS/Linux/Windows/WSL, headless-Linux `xvfb-run` handling, and version-gated Mermaid conversion
|
|
76
|
-
-
|
|
77
|
+
- Native draw.io binary resolution across macOS/Linux/Windows/WSL, headless-Linux `xvfb-run` handling, and version-gated Mermaid conversion and ELK auto-layout.
|
|
78
|
+
- Development gate: golden asset check, lint (including type and format checks), tests, and package contents check.
|
|
77
79
|
|
|
78
80
|
## Extension Reference
|
|
79
81
|
|
|
@@ -133,7 +135,7 @@ pi --no-extensions -e .
|
|
|
133
135
|
| Global | `pi install npm:@senad-d/drawme` | Loads in every trusted Pi project. |
|
|
134
136
|
| Project-local | `pi install npm:@senad-d/drawme -l` | Writes to `.pi/settings.json` in the current project. |
|
|
135
137
|
| One run | `pi -e npm:@senad-d/drawme` | Try without changing settings. |
|
|
136
|
-
| Git | `pi install git:senad-d/DrawMe` | Install from Git; pin a tag or commit for a fixed version. |
|
|
138
|
+
| Git | `pi install git:github.com/senad-d/DrawMe` | Install from Git; pin a tag or commit for a fixed version. |
|
|
137
139
|
| Local checkout | `pi --no-extensions -e .` | Develop or test this repository. |
|
|
138
140
|
|
|
139
141
|
## Commands
|
|
@@ -141,8 +143,8 @@ pi --no-extensions -e .
|
|
|
141
143
|
| Command | Description |
|
|
142
144
|
| --- | --- |
|
|
143
145
|
| `/drawme <description>` | Kick off authoring, per-edit validation, the gated multi-pass visual review, and autonomous final export. |
|
|
144
|
-
| `/drawme-check` | Report
|
|
145
|
-
| `/drawme-export <file> [png\|svg\|animated-svg\|pdf\|jpg]` | One-shot final export of an existing `.drawio
|
|
146
|
+
| `/drawme-check` | Report the detected CLI path, version, and Mermaid import and `--layout` support, or explain why the CLI is unavailable. |
|
|
147
|
+
| `/drawme-export <file> [png\|svg\|animated-svg\|pdf\|jpg]` | One-shot final export of an existing `.drawio`. `animated-svg` verifies native connector flow or a portable native page sequence. For stored DrawMe motion, use `drawio_animate` with `input` and omit `steps`. |
|
|
146
148
|
|
|
147
149
|
## Tools
|
|
148
150
|
|
|
@@ -150,14 +152,14 @@ Registered for the model to call directly.
|
|
|
150
152
|
|
|
151
153
|
| Tool | Purpose |
|
|
152
154
|
| --- | --- |
|
|
153
|
-
| `drawio_check` | Resolve the draw.io binary, version, and whether it supports Mermaid import
|
|
154
|
-
| `drawio_export` | Export a `.drawio` to PNG/SVG/PDF/JPG. `animated:true` requires a final SVG, preserves connector flow, compiles portable page sequences, and verifies that the result actually contains animation. `mode:"preview"`
|
|
155
|
-
| `drawio_animate` | Add motion to an existing page (pop and slide entrances, connector draw-in, travelling dots, highlights, dimming, staggered cascades) from typed steps, store it on the page, and export a verified animated SVG plus a storyboard PNG
|
|
155
|
+
| `drawio_check` | Resolve the draw.io binary, version, and whether it supports Mermaid import and `--layout`. |
|
|
156
|
+
| `drawio_export` | Export a `.drawio` to PNG/SVG/PDF/JPG. `animated:true` requires a final SVG, preserves connector flow, compiles portable page sequences, and verifies that the result actually contains animation. `mode:"preview"` gives a static, unembedded review PNG that fits within 2000px on both axes, with an image attachment when eligible. `mode:"final"` gives the deliverable (editable by default for PNG/SVG/PDF). See the [export reference](docs/reference.md#mode-and-naming-behavior) for sizing, naming, and cleanup rules. |
|
|
157
|
+
| `drawio_animate` | Add motion to an existing page (pop and slide entrances, connector draw-in, travelling dots, highlights, dimming, staggered cascades) from typed steps, store it on the page, and export a verified animated SVG plus a storyboard PNG sampled from visual batch end states. |
|
|
156
158
|
| `drawio_validate` | Deterministic lint for XML structure, geometry, page/container bounds, margins, overlap, explicit route-through/crossings, anchors facing away from their route, edge-label collisions, labels on connector lines, small fonts, and unchecked auto-routes. Likely direct-path obstructions for auto-routed edges are preview-review observations. The readability score reports route-through, crossings, overlaps, and anchors separately. |
|
|
157
159
|
| `drawio_fit_canvas` | Fit each page's canvas to its content plus a margin (default 40px): grows cramped pages, tightens oversized ones, and shifts content to the margin origin — instead of shrinking or cramming elements. Deterministic, no CLI. |
|
|
158
160
|
| `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. |
|
|
159
|
-
| `drawio_from_mermaid` | Convert Mermaid
|
|
160
|
-
| `drawio_layout` | Re-place nodes / route edges with an ELK preset (`verticalFlow`, `horizontalFlow`, `verticalTree`, `horizontalTree`, `radialTree`, `organic`) for large graphs. Requires draw.io **
|
|
161
|
+
| `drawio_from_mermaid` | Convert exactly one Mermaid source (inline text or a `.mmd` file) to a native `.drawio` with automatic layout. Requires draw.io **30.2.4 or newer**. |
|
|
162
|
+
| `drawio_layout` | Re-place nodes / route edges with an ELK preset (`verticalFlow`, `horizontalFlow`, `verticalTree`, `horizontalTree`, `radialTree`, `organic`) for large graphs. Requires draw.io **30.2.4 or newer**. |
|
|
161
163
|
| `drawio_explain` | Describe an existing `.drawio` as structured Markdown (components by container, relations) — for READMEs/PR summaries or model read-back. |
|
|
162
164
|
| `drawio_open` | Open a `.drawio`/export in the OS default app (draw.io desktop) for fine-tuning. |
|
|
163
165
|
|
|
@@ -177,54 +179,56 @@ The extension factory in `src/index.ts` registers the tools and commands. Render
|
|
|
177
179
|
|
|
178
180
|
`/drawme` injects a guided nine-step workflow that the model follows using the tools above:
|
|
179
181
|
|
|
180
|
-
1. **Check** — the command itself resolves the CLI and embeds the result plus the authoring references into the workflow message
|
|
182
|
+
1. **Check** — the command itself resolves the CLI and embeds the result plus the authoring references into the workflow message, including whether conversion and layout are supported, so the run starts with everything in context — no upfront tool calls or file reads.
|
|
181
183
|
2. **Plan** — pick the diagram type, relationships, finite canvas, and layout direction; motion requests plan an animated SVG plus a static fallback.
|
|
182
|
-
3. **Author** — write editable uncompressed XML (or Mermaid
|
|
183
|
-
4. **Validate after every edit** — fix all errors; fix each warning or record why it is reviewed and acceptable. Malformed animation, dangling targets, invalid timing, and standalone-SVG-incompatible effects are diagnosed before export.
|
|
184
|
+
3. **Author** — write editable uncompressed XML (or Mermaid when supported), using exact searched shapes and optional ELK layout. Fit the finite canvas after authoring, conversion, or layout. Animation may use stored DrawMe motion, persistent connector flow, or portable native page sequences.
|
|
185
|
+
4. **Validate after every edit** — fix all errors; fix each warning or record why it is reviewed and acceptable. An incomplete report is not clean. Malformed animation, dangling targets, invalid timing, and standalone-SVG-incompatible effects are diagnosed before export.
|
|
184
186
|
5. **Visual review in gated passes** — with the preview image attached (one preview per page for multi-page files), the model runs three focused passes, each answering explicit questions on its own preview: **fit and sizing** (does the diagram fit its page; does the canvas or an element need resizing), **element placement** (is every element positioned correctly; is there a visibly better arrangement), and **connections** (is every connection correct, cleanly routed, symmetric where the layout is symmetric, and anchored to the middle of the facing element side where possible). A fourth **holistic pass** reads every label word for word, checks contrast, semantics, and the diagram type's own review checklist, and re-checks the earlier passes for regressions. Concrete defects to hunt (overlapping or clipped text, labels struck through by lines, floating endpoints, edges through unrelated shapes, …) are spelled out per pass, and each finding lands in a numbered ledger naming the affected cells and planned fix. Without the image, the model reviews structurally with validation and explanation instead of describing renders.
|
|
185
|
-
6. **Fix and verify before the next pass** — a pass's findings become targeted edits, validation, and a replacement preview; the
|
|
187
|
+
6. **Fix and verify before the next pass** — a pass's findings become targeted edits, validation, and a replacement preview; compare only when the tool reports a comparable prior attachment for that page is still in model context. Otherwise inspect the new image against the written findings. Every addressed finding gets an explicit verdict (fixed / not fixed / regressed) — a fix counts only when the new render shows the defect gone, and the next pass starts only when the current pass's findings are fixed or explicitly accepted (except at the correction limit).
|
|
186
188
|
7. **Bound corrections** — pass inspection previews do not count as retries; permit at most eight targeted edit → validation → replacement-preview correction retries total. If a finding is still open at the limit, the run keeps the best validated state, finishes the remaining passes as inspection-only, continues to final export, and names the unresolved finding, its pass, and its last verdict in the report; `drawio_open` is offered afterwards for manual fine-tuning.
|
|
187
189
|
8. **No human gate** — the run never pauses for approval or feedback; if the user interrupts with feedback, it is handled as new critique findings and the run continues.
|
|
188
|
-
9. **Final export** — immediately after the holistic confirmation, export requested
|
|
190
|
+
9. **Final export** — immediately after the holistic confirmation, export the requested formats (each page of a multi-page file separately). Use `drawio_animate` for DrawMe motion or `animated:true` for native motion, and normally include a static PNG fallback. Final export reports deliverables, animation verification, unresolved findings, and preview cleanup warnings.
|
|
191
|
+
|
|
192
|
+
Review each page, but don't count on keeping a file per page: a successful preview or final export may retire tracked previews for the same source, including other pages. DrawMe does not reconstruct preview tracking after restart. Transcript attachments are separate from files; see [preview behavior](docs/reference.md#preview-attachments-and-cleanup).
|
|
189
193
|
|
|
190
|
-
Deterministic checks cover XML contracts, IDs/references, finite page and container bounds, outer margins, overlaps, explicit waypoint routes, edge-label placement, conservative font/wrapping cases, and pinned anchors that face away from their adjacent waypoint or auto-routed peer. Auto-routed edges remain renderer-dependent: validation warns that their route is unchecked and adds a focused observation when the direct connection line pierces a shape, but the preview remains the final arbiter. Rendered clipping and wrapping, contrast, typography at full-diagram scale, visual balance, semantics, and draw.io's automatic connector routes
|
|
194
|
+
Deterministic checks cover XML contracts, IDs/references, finite page and container bounds, outer margins, overlaps, explicit waypoint routes, edge-label placement, conservative font/wrapping cases, and pinned anchors that face away from their adjacent waypoint or auto-routed peer. Auto-routed edges remain renderer-dependent: validation warns that their route is unchecked and adds a focused observation when the direct connection line pierces a shape, but the preview remains the final arbiter. Rendered clipping and wrapping, contrast, typography at full-diagram scale, visual balance, semantics, and draw.io's automatic connector routes need rendered inspection, so the model critiques them only if a preview image is attached and reports them as unverified otherwise. Vision's job in the loop is to narrow every rendered defect down to specific cells (the authoring reference maps each defect to a source fix) and then to confirm from the replacement image that the defect is actually gone. A 2000px preview that makes labels unreadable requires a tighter/simpler layout, page splitting, or a focused re-export — it must never be accepted as-is.
|
|
191
195
|
|
|
192
196
|
## Bundled References and Assets
|
|
193
197
|
|
|
194
|
-
These stay plain Markdown files for easy editing. `/drawme` embeds the diagram-types, XML-authoring, and (
|
|
198
|
+
These stay plain Markdown files for easy editing. `/drawme` embeds the diagram-types, XML-authoring, style presets, and (when conversion is supported) Mermaid references directly into its workflow message, so the model starts with them in context; the troubleshooting reference is read on demand when an export fails.
|
|
195
199
|
|
|
196
200
|
- `docs/reference.md` — catalog of commands, tool options, defaults, output behavior, and limitations (documentation only; not read at runtime).
|
|
197
201
|
- `assets/references/xml-authoring.md` — `.drawio` skeleton, cell/edge forms, containers, palette, spacing.
|
|
198
202
|
- `assets/references/diagram-types.md` — per-type presets (ERD, UML, sequence, C4, architecture, ML, flowchart, SysML, BPMN, network, swimlane).
|
|
199
|
-
- `assets/references/mermaid-authoring.md` — Mermaid authoring for
|
|
203
|
+
- `assets/references/mermaid-authoring.md` — Mermaid authoring for supported renderers.
|
|
200
204
|
- `assets/references/troubleshooting.md` — export/render failure recovery.
|
|
201
205
|
- `assets/data/shape-index.json.gz` — the vendored draw.io shape index behind `drawio_shapesearch` (see its notice).
|
|
202
206
|
|
|
203
207
|
## Requirements and Compatibility
|
|
204
208
|
|
|
205
209
|
- **Node.js** ≥ 22.19.
|
|
206
|
-
- **draw.io desktop CLI** on PATH (or a known app path)
|
|
207
|
-
- **draw.io
|
|
208
|
-
- **Headless Linux:**
|
|
210
|
+
- **draw.io desktop CLI** on PATH (or a known app path). On WSL, install a native Linux draw.io renderer inside WSL; the Windows executable is not supported there. See [CLI discovery](docs/reference.md#drawio_check) for custom installations.
|
|
211
|
+
- **draw.io 30.2.4 or newer** for Mermaid conversion and ELK layout; **32.4.1 or newer** for exports or animations that explicitly pass `pageIndex`. The indexed-export requirement does not apply when `pageIndex` is omitted.
|
|
212
|
+
- **Headless Linux:** install Xvfb (`xvfb-run`) if no display is present. Run Pi as an unprivileged user; DrawMe refuses to run the renderer as root.
|
|
209
213
|
|
|
210
214
|
## Security
|
|
211
215
|
|
|
212
216
|
DrawMe works with diagram files and may launch the draw.io CLI, `xvfb-run` on headless Linux, or the OS
|
|
213
|
-
file opener
|
|
217
|
+
[file opener](docs/reference.md#drawio_open). Pi extensions inherit the permissions of the Pi process, so
|
|
214
218
|
install only packages you trust. See [`SECURITY.md`](SECURITY.md) for runtime and dependency details.
|
|
215
219
|
|
|
216
220
|
## Examples
|
|
217
221
|
|
|
218
|
-
Editable sources and rendered examples live in [`example/`](example
|
|
222
|
+
Editable sources and rendered examples live in [`example/`](https://github.com/senad-d/DrawMe/tree/main/example). The showcase spans three presets: **Multi-color** for the user journey (blue authoring, purple quality, green delivery), **Dark** for the animated AWS architecture, and **Light** for the installation and reference diagrams. All use deliberate typography, native shapes, generous spacing, and explicitly routed connectors.
|
|
219
223
|
|
|
220
224
|
| Example | Editable source | Render |
|
|
221
225
|
| --- | --- | --- |
|
|
222
|
-
| Multi-color user journey, four review passes, and CLI/vision fallbacks | [Source](example/drawme-how-it-works.drawio) | [PNG](example/drawme-how-it-works.drawio.png) |
|
|
223
|
-
| Light installation guide: scopes, trust, CLI check, and first request | [Source](example/drawme-installation-guide.drawio) | [PNG](example/drawme-installation-guide.drawio.png) |
|
|
224
|
-
| Architecture and responsibilities of all ten tools | [Source](example/drawme-architecture.drawio) | [PNG](example/drawme-architecture.drawio.png) |
|
|
225
|
-
| Structural gates and bounded, pass-by-pass correction | [Source](example/drawme-validation-decision-tree.drawio) | [PNG](example/drawme-validation-decision-tree.drawio.png) |
|
|
226
|
-
| Dark AWS architecture: transactional outbox, SNS/SQS fan-out, consumers, and dead letters | [Source](example/event-driven-orders.drawio) | [Animated SVG](example/event-driven-orders.animated.svg) · [PNG](example/event-driven-orders.drawio.png) · [Storyboard](example/event-driven-orders.storyboard.png) |
|
|
227
|
-
| Git branching and merges (classic, retained example) | [Source](example/git-graph-example.drawio) | [PNG](example/git-graph-example.drawio.png) |
|
|
226
|
+
| Multi-color user journey, four review passes, and CLI/vision fallbacks | [Source](example/drawme-how-it-works.drawio) | [PNG](https://github.com/senad-d/DrawMe/blob/main/example/drawme-how-it-works.drawio.png) |
|
|
227
|
+
| Light installation guide: scopes, trust, CLI check, and first request | [Source](example/drawme-installation-guide.drawio) | [PNG](https://github.com/senad-d/DrawMe/blob/main/example/drawme-installation-guide.drawio.png) |
|
|
228
|
+
| Architecture and responsibilities of all ten tools | [Source](example/drawme-architecture.drawio) | [PNG](https://github.com/senad-d/DrawMe/blob/main/example/drawme-architecture.drawio.png) |
|
|
229
|
+
| Structural gates and bounded, pass-by-pass correction | [Source](example/drawme-validation-decision-tree.drawio) | [PNG](https://github.com/senad-d/DrawMe/blob/main/example/drawme-validation-decision-tree.drawio.png) |
|
|
230
|
+
| Dark AWS architecture: transactional outbox, SNS/SQS fan-out, consumers, and dead letters | [Source](example/event-driven-orders.drawio) | [Animated SVG](https://github.com/senad-d/DrawMe/blob/main/example/event-driven-orders.animated.svg) · [PNG](https://github.com/senad-d/DrawMe/blob/main/example/event-driven-orders.drawio.png) · [Storyboard](https://github.com/senad-d/DrawMe/blob/main/example/event-driven-orders.storyboard.png) |
|
|
231
|
+
| Git branching and merges (classic, retained example) | [Source](example/git-graph-example.drawio) | [PNG](https://github.com/senad-d/DrawMe/blob/main/example/git-graph-example.drawio.png) |
|
|
228
232
|
|
|
229
233
|
### Animated example — Dark
|
|
230
234
|
|
|
@@ -232,15 +236,17 @@ Editable sources and rendered examples live in [`example/`](example/README.md).
|
|
|
232
236
|
<img src="https://raw.githubusercontent.com/senad-d/DrawMe/main/example/event-driven-orders.animated.svg" alt="Animated order processing: publish committed outbox events, fan out to fulfillment and notifications, then persist shipments and send email" width="900">
|
|
233
237
|
</p>
|
|
234
238
|
|
|
235
|
-
This Dark-theme showcase uses 13 official AWS4 components across four zones, including API Gateway, Lambda, DynamoDB, SNS, SQS, and SES. Its verified standalone SVG demonstrates pop/slide entrances, connector draw-in, travelling dots, highlights, and staggered reveals in a 12.56-second loop. Reduced-motion viewers see the static diagram. If your SVG host sanitizes animation, use the [PNG fallback](example/event-driven-orders.drawio.png). The [storyboard](example/event-driven-orders.storyboard.png) shows
|
|
239
|
+
This Dark-theme showcase uses 13 official AWS4 components across four zones, including API Gateway, Lambda, DynamoDB, SNS, SQS, and SES. Its verified standalone SVG demonstrates pop/slide entrances, connector draw-in, travelling dots, highlights, and staggered reveals in a 12.56-second loop. Reduced-motion viewers see the static diagram. If your SVG host sanitizes animation, use the [PNG fallback](https://github.com/senad-d/DrawMe/blob/main/example/event-driven-orders.drawio.png). The [storyboard](https://github.com/senad-d/DrawMe/blob/main/example/event-driven-orders.storyboard.png) shows sampled visual states, not temporal playback.
|
|
236
240
|
|
|
237
241
|
## Development
|
|
238
242
|
|
|
239
243
|
```bash
|
|
240
244
|
npm ci --ignore-scripts # install the locked dependency set
|
|
241
|
-
npm run validate # golden check + lint + tests
|
|
245
|
+
npm run validate # golden check + lint + tests + package contents check
|
|
242
246
|
```
|
|
243
247
|
|
|
248
|
+
See the [contributor guide](https://github.com/senad-d/DrawMe/blob/main/CONTRIBUTING.md) for the full gate and asset-update conventions.
|
|
249
|
+
|
|
244
250
|
Individual checks:
|
|
245
251
|
|
|
246
252
|
```bash
|
|
@@ -249,6 +255,7 @@ npm run lint:eslint # eslint . --max-warnings=0
|
|
|
249
255
|
npm run format:check # LF endings, no trailing whitespace, final newline, valid JSON
|
|
250
256
|
npm run check:golden # SHA-256 integrity of bundled assets (--update to re-baseline)
|
|
251
257
|
npm test # vitest run
|
|
258
|
+
npm run check:pack # verify package contents
|
|
252
259
|
npm run coverage # vitest run --coverage
|
|
253
260
|
pi --no-extensions -e . # load this checkout in Pi
|
|
254
261
|
```
|
|
@@ -256,7 +263,8 @@ pi --no-extensions -e . # load this checkout in Pi
|
|
|
256
263
|
Source layout:
|
|
257
264
|
|
|
258
265
|
- `src/index.ts` — registers the tools and commands.
|
|
259
|
-
- `src/drawio.ts` —
|
|
266
|
+
- `src/drawio.ts` — export orchestration and the facade for renderer, export policy, and editable import.
|
|
267
|
+
- `src/renderer.ts`, `src/export-plan.ts`, `src/editable-import.ts` — CLI discovery and invocation, export planning, and Mermaid conversion/ELK layout.
|
|
260
268
|
- `src/animation.ts` — native animation analysis, portable page-sequence compilation, reduced-motion CSS, and animated-SVG verification.
|
|
261
269
|
- `src/validate.ts` — structural and animation linter.
|
|
262
270
|
- `src/shapesearch.ts` — shape search over the bundled index.
|
|
@@ -267,16 +275,9 @@ Source layout:
|
|
|
267
275
|
|
|
268
276
|
## Publishing
|
|
269
277
|
|
|
270
|
-
DrawMe publishes to npm as `@senad-d/drawme
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
npm login
|
|
274
|
-
npm run validate
|
|
275
|
-
npm version <version>
|
|
276
|
-
npm publish --access public
|
|
277
|
-
```
|
|
278
|
+
DrawMe publishes to npm as `@senad-d/drawme` through the [Publish to npm workflow](https://github.com/senad-d/DrawMe/blob/main/.github/workflows/publish.yml). Run it from the repository's exact default branch, not from a tag.
|
|
278
279
|
|
|
279
|
-
|
|
280
|
+
Before a release, a repository administrator must verify in GitHub settings that the `npm` environment uses **Selected branches and tags** with exactly one branch rule: the literal default branch name. Do not allow tag rules, wildcards, or other branches. The workflow's `environment: npm` declaration does not verify those settings.
|
|
280
281
|
|
|
281
282
|
## License
|
|
282
283
|
|
package/SECURITY.md
CHANGED
|
@@ -9,7 +9,7 @@ launch:
|
|
|
9
9
|
|
|
10
10
|
- the **draw.io desktop CLI** for conversion, layout, rendering, and export;
|
|
11
11
|
- **`xvfb-run`** for draw.io on headless Linux;
|
|
12
|
-
- the **OS file opener
|
|
12
|
+
- the **[OS file opener](docs/reference.md#drawio_open)** when `drawio_open` is requested for a supported document.
|
|
13
13
|
|
|
14
14
|
Child processes are invoked with argument lists rather than through a shell. Shape lookup uses the
|
|
15
15
|
bundled `assets/data/shape-index.json.gz` file.
|
|
@@ -10,7 +10,7 @@ Read this file when:
|
|
|
10
10
|
|
|
11
11
|
## ERD (Entity-Relationship Diagram)
|
|
12
12
|
|
|
13
|
-
For SQL DDL, derive tables, primary keys, foreign keys, and crow's-foot relations from the schema before authoring. Mermaid ER conversion is suitable for a standard ERD
|
|
13
|
+
For SQL DDL, derive tables, primary keys, foreign keys, and crow's-foot relations from the schema before authoring. Mermaid ER conversion is suitable for a standard ERD if the CLI reports Mermaid support (draw.io 30.2.4 or newer); use XML with the styles below if conversion is unavailable or exact table styling or placement is required.
|
|
14
14
|
|
|
15
15
|
| Element | Style | Notes |
|
|
16
16
|
|---------|-------|-------|
|
|
@@ -38,7 +38,7 @@ For SQL DDL, derive tables, primary keys, foreign keys, and crow's-foot relation
|
|
|
38
38
|
|
|
39
39
|
## Sequence Diagram
|
|
40
40
|
|
|
41
|
-
Prefer Mermaid conversion for a standard sequence diagram
|
|
41
|
+
Prefer Mermaid conversion for a standard sequence diagram only when the CLI reports Mermaid support (draw.io 30.2.4 or newer). Use the styles below for XML diagrams when conversion is unavailable or exact lifelines, activation bars, message placement, or interaction frames are required.
|
|
42
42
|
|
|
43
43
|
| Element | Style | Notes |
|
|
44
44
|
|---------|-------|-------|
|
|
@@ -53,7 +53,7 @@ Prefer Mermaid conversion for a standard sequence diagram on draw.io 30+. Use th
|
|
|
53
53
|
|
|
54
54
|
## C4 Model (System Context / Container / Component)
|
|
55
55
|
|
|
56
|
-
Use the styles below for C4 diagrams. A Mermaid C4 sketch works for a standard single view
|
|
56
|
+
Use the styles below for C4 diagrams. A Mermaid C4 sketch works for a standard single view if the CLI reports Mermaid support (draw.io 30.2.4 or newer); use XML if conversion is unavailable or exact C4 styling, multiple pages, or drill-down links are required:
|
|
57
57
|
|
|
58
58
|
| Element | Style | Notes |
|
|
59
59
|
|---------|-------|-------|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Mermaid authoring → native .drawio
|
|
2
2
|
|
|
3
|
-
Use Mermaid when the diagram is a standard type with no custom styling requirements and the
|
|
4
|
-
|
|
5
|
-
initial layout.
|
|
3
|
+
Use Mermaid when the diagram is a standard type with no custom styling requirements and the CLI
|
|
4
|
+
supports Mermaid conversion (draw.io 30.2.4 or newer). Mermaid keeps the input focused on structure
|
|
5
|
+
while draw.io supplies the initial layout.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Use the workflow's CLI status (or call `drawio_check` if it is not already known), then convert with:
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
10
|
drawio_from_mermaid({
|
|
@@ -13,7 +13,7 @@ drawio_from_mermaid({
|
|
|
13
13
|
})
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Provide exactly one nonblank source: inline `mermaid` or an `input` `.mmd` file. If conversion isn't supported, author uncompressed `.drawio` XML instead.
|
|
17
17
|
|
|
18
18
|
## When to prefer each authoring mode
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ On draw.io 29 or older, skip Mermaid conversion and author uncompressed `.drawio
|
|
|
21
21
|
|---|---|---|
|
|
22
22
|
| **Mermaid → `drawio_from_mermaid`** | Flowchart, sequence, class, state, ER, gantt, mind map, timeline, journey, and similar standard diagrams | Concise structure and automatic initial layout |
|
|
23
23
|
| **Uncompressed XML** | Official vendor icons, exact UML/BPMN notation, custom styling, swimlanes, containers, precise routing, or multi-page output | Full control over draw.io cells, styles, geometry, and pages |
|
|
24
|
-
| **XML → `drawio_layout`** | Large or graph-heavy hand-authored diagrams | Repositions nodes and routes edges with an allowlisted ELK preset |
|
|
24
|
+
| **XML → `drawio_layout`** | Large or graph-heavy hand-authored diagrams when the CLI supports layout | Repositions nodes and routes edges with an allowlisted ELK preset |
|
|
25
25
|
|
|
26
26
|
If the user requests Mermaid source rather than a `.drawio` deliverable, do not convert it unless they
|
|
27
27
|
also ask for a draw.io file.
|
|
@@ -40,12 +40,13 @@ also ask for a draw.io file.
|
|
|
40
40
|
- Match label language to the user's language.
|
|
41
41
|
- Never apply `drawio_layout` to a Mermaid-converted file; conversion already lays it out.
|
|
42
42
|
|
|
43
|
-
After conversion, treat the `.drawio` as the source of truth.
|
|
44
|
-
|
|
43
|
+
After conversion, treat the `.drawio` as the source of truth. Fit the finite canvas with
|
|
44
|
+
`drawio_fit_canvas`, validate again, review a preview, then create the requested final exports.
|
|
45
45
|
|
|
46
46
|
## ELK layout for XML-authored diagrams
|
|
47
47
|
|
|
48
|
-
For rough XML geometry
|
|
48
|
+
For rough XML geometry, use `drawio_layout` only when the CLI reports `--layout` support
|
|
49
|
+
(draw.io 30.2.4 or newer), with one of these presets:
|
|
49
50
|
|
|
50
51
|
| Preset | Layout |
|
|
51
52
|
|---|---|
|
|
@@ -17,32 +17,10 @@ Read this when something looks wrong in the output (rendering, export, layout, e
|
|
|
17
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
18
|
| Export command not found on macOS | Try full path `/Applications/draw.io.app/Contents/MacOS/draw.io` |
|
|
19
19
|
| Vision reports that the preview dimensions are too large | Re-export with `drawio_export` in preview mode and set a smaller `width`. If a 2000px full-diagram preview makes labels unreadable, tighten the canvas, simplify or split the layout, or use a focused review artifact. |
|
|
20
|
-
| Linux:
|
|
21
|
-
| Linux:
|
|
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) |
|
|
20
|
+
| Linux: renderer unavailable without a display | Install `xvfb-run` and use stock draw.io. DrawMe uses Xvfb for headless discovery and rendering when available. |
|
|
21
|
+
| Linux: DrawMe refuses to run draw.io as root | Run Pi as an unprivileged user with a writable home directory. Keep the renderer sandbox enabled. |
|
|
24
22
|
| PDF export fails | Ensure Chromium is available (draw.io bundles it on desktop) |
|
|
25
23
|
| Background color wrong in CLI export | Known CLI bug; add `--transparent` flag or set background via style |
|
|
26
|
-
|
|
|
27
|
-
| Final embedded PNG won't open in image viewers | Export it again with `drawio_export` in final mode.
|
|
28
|
-
|
|
|
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
|
-
|
|
31
|
-
## WSL2 / Windows specifics
|
|
32
|
-
|
|
33
|
-
**Locate the CLI.** Detect WSL2 with `grep -qi microsoft /proc/version`. On WSL2 the
|
|
34
|
-
export CLI is the Windows desktop exe, reached through `/mnt/c` (quote the path —
|
|
35
|
-
it contains a space):
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
"/mnt/c/Program Files/draw.io/draw.io.exe" --version
|
|
39
|
-
# per-user install fallback:
|
|
40
|
-
"/mnt/c/Users/$USER/AppData/Local/Programs/draw.io/draw.io.exe" --version
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
**Open a file.** Convert the WSL path to a Windows path first; `cmd.exe` cannot
|
|
44
|
-
follow `/mnt/c/...`:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
cmd.exe /c start "" "$(wslpath -w diagram.drawio.png)"
|
|
48
|
-
```
|
|
24
|
+
| Preview image not attached | Read the tool's result. Check whether the model supports images and whether the preview succeeded. Previews never embed XML. If there is no image, review structurally instead of judging the render. |
|
|
25
|
+
| Final embedded PNG won't open in image viewers | Export it again with `drawio_export` in final mode. DrawMe repairs a missing or truncated IEND tail only on otherwise valid PNG data. |
|
|
26
|
+
| WSL: renderer unavailable | Install native Linux draw.io inside WSL. DrawMe does not use the Windows `.exe` renderer from WSL. |
|
|
@@ -189,12 +189,14 @@ Use `drawio_animate` for any animation beyond continuous connector flow. Author
|
|
|
189
189
|
| `travel` | visible connector | A dot runs along the connector in `color` |
|
|
190
190
|
| `wait` | none | Pause for `duration` ms |
|
|
191
191
|
|
|
192
|
-
- Steps run one after another; `parallel: true` starts a step with the previous one. `stagger` offsets consecutive cells of one step for a cascade.
|
|
193
|
-
-
|
|
192
|
+
- Steps run one after another; `parallel: true` starts a step with the previous one in the same batch. `stagger` offsets consecutive cells of one step for a cascade.
|
|
193
|
+
- Use at most 200 steps. `hold`, `stagger`, and wait duration accept 0–60,000 ms; timed visual effects accept greater than 0 through 60,000 ms (0.5 ms is valid). The pre-hold timeline may be at most 300,000 ms.
|
|
194
|
+
- A cell whose first effect is an entrance (`fadeIn`, `popIn`, `slideIn`, `drawIn`) starts hidden. Other cells start in their authored state. A dimmed visible cell can `fadeIn` to full opacity, but a fully visible cell cannot enter again.
|
|
194
195
|
- `drawIn` needs a solid connector without `flowAnimation=1`; use `fadeIn` for dashed or flowing connectors.
|
|
195
196
|
- `loop` (default true) repeats the sequence after `hold` ms (default 1600) on the final state.
|
|
196
197
|
- The tool stores the steps on the page root cell (`drawmeMotion`), so a later call without `steps` re-exports the same motion after layout edits. `drawio_validate` checks the stored steps against the page.
|
|
197
|
-
-
|
|
198
|
+
- The storyboard samples at most 12 captioned visual batch ends evenly, keeping the first and last. Parallel steps share a frame; wait-only batches consume time but add no frame. Use it to check order and visibility, not easing or dot movement.
|
|
199
|
+
- Page 1 exported to the default `<name>.animated.svg` gets `<name>.storyboard.png`. Otherwise, append `.page-<index>.frames.png` to the full SVG output path. Use distinct SVG outputs to keep animations of multiple pages. A valid storyboard remains on disk even if it is too large to attach for review.
|
|
198
200
|
- The motion plays in browsers and wherever the SVG is shown as an image (for example a README). draw.io itself does not play it.
|
|
199
201
|
|
|
200
202
|
Example: reveal a three-hop flow, run traffic through it, then focus on the service.
|