@senad-d/drawme 0.1.4 → 0.1.5

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 CHANGED
@@ -6,8 +6,41 @@ All notable changes to this project are documented here. The format is based on
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Added
10
+
11
+ - New `drawio_fit_canvas` tool: deterministically resizes each page's canvas to its visible content plus
12
+ a margin (default 40px) and shifts content to the margin origin — the fix for cramped pages where
13
+ elements overlap because they were squeezed into a too-small canvas. The workflow now defers page
14
+ dimensions until content exists (author with generous spacing → fit the canvas), and validation/docs
15
+ direct overlap and bounds findings to "spread elements, then refit" instead of shrinking content.
16
+ Shared `.drawio` geometry moved into `src/geometry.ts`.
17
+
9
18
  ### Changed
10
19
 
20
+ - `/drawme` now pre-loads its context: the command handler resolves the draw.io CLI itself and embeds the
21
+ check result plus the diagram-types, XML-authoring, and (v30+) Mermaid references directly into the
22
+ injected workflow message. The references remain editable Markdown files under `assets/references/`;
23
+ they are just no longer read via tool calls at run start. Only the rarely needed troubleshooting
24
+ reference stays on-demand.
25
+
26
+ - `drawio_export` previews are now vision-aware: the PNG image block is attached only when the active
27
+ model can view images (checked per call via the extension context, failing open for unknown models),
28
+ the result text always states whether it was attached, and `details.imageAttached` reports the outcome.
29
+ - Replaced the five mandatory visual passes with a critique-first review: one holistic preview with a
30
+ structured all-category critique, focused re-previews only for categories with findings, and a final
31
+ holistic confirmation. Models that cannot view images get an explicit structural-review path
32
+ (`drawio_validate` + `drawio_explain`) instead of a silent image placeholder.
33
+ - Rewrote the packaged extension reference and workflow text in second person without agent terminology.
34
+ - The `/drawme` run is now fully autonomous: the human approval gate before final export is removed.
35
+ After the holistic confirmation (or on hitting the five-retry correction limit, reporting the unresolved
36
+ finding), the workflow proceeds straight to final export; mid-run user feedback is treated as new
37
+ critique findings rather than a pause point. Docs, packaged troubleshooting guidance, and the example
38
+ diagrams were updated to match, and the golden asset baseline was intentionally refreshed.
39
+ - The `/drawme` workflow no longer instructs a mandatory reference read: the injected message plus the
40
+ registered tool descriptions are self-contained (the failure-text and compressed-page rules moved into
41
+ them), saving a file read and several thousand tokens per run. `docs/agent-guide.md` became
42
+ `docs/reference.md`, a pure command/tool catalog for other projects; topic references under
43
+ `assets/references/` are still read on demand.
11
44
  - Added focused visual quality passes, stronger deterministic canvas/edge/readability checks, attached PNG
12
45
  previews, warning-resolution gates, and explicit approval before final export.
13
46
  - Intentionally re-baselined the golden asset hash after adding finite-page sizing, typography, preview
package/README.md CHANGED
@@ -17,7 +17,7 @@
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 on draw.io v30+), lints every source revision, runs ordered visual quality passes, and exports only after approval.
20
+ DrawMe is a native Pi **extension** for diagram authoring. Describe a diagram and Pi plans it, writes editable `.drawio` XML (or Mermaid on draw.io v30+), 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
21
 
22
22
  <table align="center">
23
23
  <tr>
@@ -28,12 +28,17 @@ DrawMe is a native Pi **extension** for diagram authoring. Describe a diagram an
28
28
  <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">
29
29
  </td>
30
30
  </tr>
31
+ <tr>
32
+ <td align="center">
33
+ <img src="https://raw.githubusercontent.com/senad-d/DrawMe/main/example/drawme-installation-guide.drawio.png" alt="DrawMe: Installation guide" title="DrawMe" width="820">
34
+ </td>
35
+ </tr>
31
36
  </table>
32
37
 
33
38
  - **Natural-language authoring:** flowcharts, architecture, UML, BPMN, ERD, C4, network, ML — as native `.drawio`, or as Mermaid with automatic layout on v30+.
34
- - **Guided workflow:** CLI detection, planning, authoring, validation, focused canvas/node/connector/semantic passes, holistic regression review, approval, and final export are coordinated from `/drawme`.
39
+ - **Guided workflow:** CLI detection, planning, authoring, validation, a critique-first visual review across canvas/node/connector/semantic categories, and final export run end to end from a single `/drawme` — no approval pauses.
35
40
  - **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.
36
- - **Preview in the tool result:** successful PNG previews return text/metadata plus the actual image; each replacement removes the previous same-source preview file so only the latest remains on disk.
41
+ - **Vision-aware previews:** successful PNG previews attach the actual image only when the active model can view images — the result text says which case applies — so text-only models get an honest structural-review path instead of a placeholder; each replacement removes the previous same-source preview file so only the latest remains on disk.
37
42
  - **Exact shapes, not guesses:** search 10k+ official AWS/Azure/GCP/Cisco/Kubernetes/UML/BPMN styles from a bundled local index.
38
43
  - **Editable source of truth:** final PNG/SVG/PDF exports embed the diagram XML, the truncated `-e` PNG chunk is auto-repaired, and final export removes the one remaining latest preview.
39
44
 
@@ -42,7 +47,7 @@ DrawMe is a native Pi **extension** for diagram authoring. Describe a diagram an
42
47
  ## Table of Contents
43
48
 
44
49
  - [Implementation Status](#implementation-status)
45
- - [Agent Reference](#agent-reference)
50
+ - [Extension Reference](#extension-reference)
46
51
  - [Quick Start](#quick-start)
47
52
  - [Installation](#installation)
48
53
  - [Commands](#commands)
@@ -63,15 +68,15 @@ DrawMe is a native Pi **extension** for diagram authoring. Describe a diagram an
63
68
 
64
69
  This checkout implements the DrawMe core loop as a Pi extension:
65
70
 
66
- - 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`).
67
- - A guided `/drawme` workflow that steers authoring, validation after every edit, five focused visual passes, human approval, and final multi-format export.
71
+ - Nine model-callable tools (`drawio_check`, `drawio_export`, `drawio_validate`, `drawio_fit_canvas`, `drawio_shapesearch`, `drawio_from_mermaid`, `drawio_layout`, `drawio_explain`, `drawio_open`) and three commands (`/drawme`, `/drawme-check`, `/drawme-export`).
72
+ - A guided `/drawme` workflow that steers authoring, validation after every edit, a critique-first visual review, and autonomous final multi-format export.
68
73
  - Pure-TypeScript structural linting, `-e` PNG IEND repair, shape search over a bundled index, and diagram-to-Markdown description — no Python runtime required.
69
74
  - 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+).
70
75
  - Validation pipeline: golden asset-integrity check, TypeScript typecheck, ESLint, a custom format check, and unit + real-CLI integration tests.
71
76
 
72
- ## Agent Reference
77
+ ## Extension Reference
73
78
 
74
- [`docs/agent-guide.md`](docs/agent-guide.md) is the official operational reference for AI agents. It documents every command, tool option, default, authoring mode, workflow, output behavior, and functional limitation. The `/drawme` command instructs the agent to read this packaged reference before starting.
79
+ [`docs/reference.md`](docs/reference.md) catalogs the extension's public surface — every command, tool option, default, output behavior, and functional limitation — for other projects and integrations that use DrawMe. It is documentation, not runtime input: the `/drawme` workflow and the registered tool descriptions carry the complete operational instructions themselves.
75
80
 
76
81
  ## Quick Start
77
82
 
@@ -108,7 +113,7 @@ Inside Pi:
108
113
  /drawme a flowchart of a user login: enter credentials, validate, then success or retry
109
114
  ```
110
115
 
111
- Pi checks the CLI, plans and writes the `.drawio`, validates every revision, inspects focused preview PNGs, performs a holistic regression check, and — only after your explicit approval — exports the final editable deliverable.
116
+ Pi checks the CLI, plans and writes the `.drawio`, validates every revision, critiques the rendered preview when the active model can view images (or reviews structurally when it cannot), and exports the final editable deliverable — all in one run, without asking for approval along the way.
112
117
 
113
118
  ### Run from a source checkout
114
119
 
@@ -134,7 +139,7 @@ pi --no-extensions -e .
134
139
 
135
140
  | Command | Description |
136
141
  | --- | --- |
137
- | `/drawme <description>` | Kick off authoring, per-edit validation, focused quality passes, holistic review, approval, and final export. |
142
+ | `/drawme <description>` | Kick off authoring, per-edit validation, critique-first visual review, and autonomous final export. |
138
143
  | `/drawme-check` | Report whether the draw.io CLI is available, its version, and v30+ feature support. |
139
144
  | `/drawme-export <file> [png\|svg\|pdf\|jpg]` | One-shot final export of an existing `.drawio`. |
140
145
 
@@ -145,8 +150,9 @@ Registered for the model to call directly.
145
150
  | Tool | Purpose |
146
151
  | --- | --- |
147
152
  | `drawio_check` | Resolve the draw.io binary, version, and whether it supports Mermaid import / `--layout` (v30+). |
148
- | `drawio_export` | Export a `.drawio` to PNG/SVG/PDF/JPG. `mode:"preview"` → clean width-capped PNG returned as text/metadata plus an image block; each successful preview removes the previous same-source preview file so only the latest remains. `mode:"final"` → embedded editable deliverable, with truncated PNG repair and cleanup of the remaining preview. |
153
+ | `drawio_export` | Export a `.drawio` to PNG/SVG/PDF/JPG. `mode:"preview"` → clean width-capped PNG returned as text/metadata, with the image block attached when the active model can view images (the text states which); each successful preview removes the previous same-source preview file so only the latest remains. `mode:"final"` → embedded editable deliverable, with truncated PNG repair and cleanup of the remaining preview. |
149
154
  | `drawio_validate` | Deterministic lint: dangling edges, duplicate/reserved ids, broken parents, malformed vertex/edge geometry; warnings for page/container bounds, margins, conservative readability, overlap, and explicit routes through/crossing shapes; observations and readability score are reported separately. |
155
+ | `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. |
150
156
  | `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. |
151
157
  | `drawio_from_mermaid` | Convert Mermaid text (inline or a `.mmd`) to a native `.drawio` with automatic layout. Requires draw.io **v30+**. |
152
158
  | `drawio_layout` | Re-place nodes / route edges with an ELK preset (`verticalFlow`, `horizontalFlow`, `verticalTree`, `horizontalTree`, `radialTree`, `organic`) for large graphs. Requires draw.io **v30+**. |
@@ -167,24 +173,25 @@ The extension factory in `src/index.ts` registers the tools and commands. Render
167
173
 
168
174
  ## The /drawme Workflow
169
175
 
170
- `/drawme` injects a guided eight-step workflow that the model follows using the tools above:
176
+ `/drawme` injects a guided nine-step workflow that the model follows using the tools above:
171
177
 
172
- 1. **Check** — resolve the CLI and note the version (v30+ unlocks Mermaid conversion and ELK layout).
178
+ 1. **Check** — the command itself resolves the CLI and embeds the result plus the authoring references into the workflow message (v30+ unlocks Mermaid conversion and ELK layout), so the run starts with everything in context — no upfront tool calls or file reads.
173
179
  2. **Plan** — pick the diagram type, relationships, finite canvas, and layout direction.
174
180
  3. **Author** — write editable uncompressed XML (or Mermaid on v30+), using exact searched shapes and optional ELK layout.
175
181
  4. **Validate after every edit** — fix all errors; fix each warning or record why it is reviewed and acceptable.
176
- 5. **Focused quality passes** — inspect one named preview at a time: canvas/composition, nodes/typography, connectors, semantics/final polish, then a holistic regression check. Each successful pass preview removes the previous preview file, leaving only the current image.
177
- 6. **Bound corrections** — the five required inspections do not count as retries; permit at most five targeted edit → validation → replacement-preview correction retries total, then request focused feedback or offer `drawio_open`.
178
- 7. **Human review** — feedback returns through validation, the affected focused pass, and a holistic preview; obtain explicit approval.
179
- 8. **Final export** — only after approval, export requested embedded/editable formats, remove the one remaining latest review preview, and report deliverables plus cleanup warnings.
182
+ 5. **Visual review, critique first** — export one holistic preview; the tool result states whether the image is attached. With the image, the model walks all four categories (canvas/composition, nodes/typography, connectors, semantics) and records findings or explicit pass reasons before editing. Without it, the model reviews structurally with validation and explanation instead of describing renders.
183
+ 6. **Fix and confirm** — each finding becomes a targeted edit, validation, and a focused category preview; a final holistic preview confirms no regressions. Each successful preview removes the previous preview file, leaving only the current image.
184
+ 7. **Bound corrections** — the initial critique and final confirmation do not count as retries; permit at most five targeted edit → validation → replacement-preview correction retries total, then request focused feedback or offer `drawio_open`.
185
+ 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.
186
+ 9. **Final export** — immediately after the holistic confirmation, export requested embedded/editable formats, remove the one remaining latest review preview, and report deliverables (including any unresolved finding from the correction limit) plus cleanup warnings.
180
187
 
181
- Deterministic checks cover XML contracts, IDs/references, finite page and container bounds, outer margins, overlaps, explicit waypoint routes, and conservative font/wrapping cases. Vision remains responsible for rendered clipping and wrapping, contrast, typography at full-diagram scale, visual balance, semantics, and draw.io's automatic connector routes. A 2000px preview that makes labels unreadable requires a tighter/simpler layout, page splitting, or focused review—not automatic approval.
188
+ Deterministic checks cover XML contracts, IDs/references, finite page and container bounds, outer margins, overlaps, explicit waypoint routes, and conservative font/wrapping cases. Rendered clipping and wrapping, contrast, typography at full-diagram scale, visual balance, semantics, and draw.io's automatic connector routes can only be judged from the preview image, so they are critiqued when the active model can view images and reported as unverified when it cannot. 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.
182
189
 
183
190
  ## Bundled References and Assets
184
191
 
185
- The model reads these packaged references and assets on demand.
192
+ These stay plain Markdown files for easy editing. `/drawme` embeds the diagram-types, XML-authoring, and (on v30+) 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.
186
193
 
187
- - `docs/agent-guide.md` — official agent-facing command, tool, option, workflow, output, and limitation reference.
194
+ - `docs/reference.md` — catalog of commands, tool options, defaults, output behavior, and limitations (documentation only; not read at runtime).
188
195
  - `assets/references/xml-authoring.md` — `.drawio` skeleton, cell/edge forms, containers, palette, spacing.
189
196
  - `assets/references/diagram-types.md` — per-type presets (ERD, UML, sequence, C4, architecture, ML, flowchart, SysML, BPMN, network, swimlane).
190
197
  - `assets/references/mermaid-authoring.md` — Mermaid authoring for the v30+ conversion path.
@@ -10,10 +10,10 @@ Read this when something looks wrong in the output (rendering, export, layout, e
10
10
  | `--` inside XML comments | Illegal per XML spec — use single hyphens or rephrase |
11
11
  | Special characters in `value` | Use XML entities: `&amp;` `&lt;` `&gt;` `&quot;` |
12
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 |
13
+ | Overlapping shapes | Scale spacing with complexity (200–350px) and leave routing corridors; move elements apart and run `drawio_fit_canvas` so the page grows around the content — never shrink elements to fit the page |
14
14
  | Edges crossing through shapes | Add waypoints, distribute entry/exit points, or increase spacing |
15
15
  | Arrowhead overlaps bend | Final edge segment before target must be ≥20px — increase spacing or add waypoints |
16
- | Automatic correction loop reaches its limit | The five required focused inspection passes do not consume retries. Allow at most **5 correction retries total**; each retry is one targeted source edit → `drawio_validate` → replacement preview cycle. If a finding remains, stop, identify its review category, request focused user feedback, and offer `drawio_open`. |
16
+ | Automatic correction loop reaches its limit | The initial critique pass and the final holistic confirmation do not consume retries. Allow at most **5 correction retries total**; each retry is one targeted source edit → `drawio_validate` → replacement preview cycle. If a finding remains at the limit, stop editing, keep the best validated state, continue to final export, and name the unresolved finding and its category in the final report — never loop or wait for input. |
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. |
@@ -33,15 +33,11 @@ Read this **before hand-writing any `.drawio` XML** (workflow step 3). Skip it w
33
33
 
34
34
  ### Canvas sizing and content bounds
35
35
 
36
- Choose the page from the layout rather than leaving a large default canvas:
36
+ The page follows from the layout, never the reverse: author elements with generous spacing first, then run `drawio_fit_canvas` to resize `pageWidth`/`pageHeight` to the visible content plus a margin (default 40px) and shift content to the margin origin. Run it again after every move, resize, container change, layout pass, legend addition, or waypoint edit, and treat each run as a source edit to validate.
37
37
 
38
- 1. Compute every visible top-level vertex/container rectangle as `(x, y, x + width, y + height)`. For a nested child, add every ancestor container's `x` and `y` to the child's local coordinates.
39
- 2. Expand the bounds for separately sized edge labels and explicit waypoints when their positions are known. Automatic edge routes still need preview inspection.
40
- 3. Shift top-level content so the minimum `x` and `y` leave a **40px recommended outer margin**; DrawMe warns below the **20px minimum**.
41
- 4. Set `pageWidth` to the rightmost visible coordinate plus 40px and `pageHeight` to the bottommost visible coordinate plus 40px. Round both up to a multiple of 10. Keep `pageScale="1"` unless a deliberately scaled page is required.
42
- 5. After every move, resize, container change, layout pass, legend addition, or waypoint edit, recalculate the bounds and resize the page. A page much larger than content creates unreadable full-diagram previews and triggers an excessive-empty-space warning.
38
+ When elements overlap or cannot fit, do not shrink or cram them to preserve the current page: move them apart with proper spacing and refit the canvas so the page grows around them. The reverse problem — a page much larger than content — creates unreadable full-diagram previews and an excessive-empty-space warning; the same fit run tightens it.
43
39
 
44
- Example: content spanning `x=40..1160` and `y=40..720` should normally use `pageWidth="1200"` and `pageHeight="760"`. Do not count invisible helpers or intentional relative border ports as page-extending content.
40
+ Background for manual sizing (what the fit computes): visible top-level vertex/container rectangles as `(x, y, x + width, y + height)` with ancestor container offsets added for nested children, expanded by separately sized edge labels and explicit waypoints; content shifted so minimum `x`/`y` sit at the margin (DrawMe warns below the **20px minimum**); `pageWidth`/`pageHeight` set to the bounds plus the margin on each side. Automatic edge routes still need preview inspection, and invisible helpers or intentional relative border ports never count as page-extending content.
45
41
 
46
42
  ### Typography, padding, and labels
47
43
 
@@ -50,7 +46,7 @@ Example: content spanning `x=40..1160` and `y=40..720` should normally use `page
50
46
  - Size a node for the rendered lines, not only character count. A conservative height is `line count × (fontSize × 1.25) + top/bottom padding`; allow additional room for container title bands and icon shapes.
51
47
  - Estimate width from the longest line (`characters × fontSize × 0.6 + left/right padding`), then verify by preview. Insert deliberate `&#xa;` breaks for long labels rather than forcing a very wide node.
52
48
  - Prefer two or three concise lines. If a label remains long, enlarge the node, shorten the wording without changing meaning, or split details into a note/legend. Never reduce important body text merely to fit existing geometry.
53
- - A 2000px full-diagram preview scales the entire page. If labels become unreadable at that width, simplify the layout, tighten the canvas, split the diagram into pages, or use a focused review export; do not treat an unreadable full view as typography approval.
49
+ - A 2000px full-diagram preview scales the entire page. If labels become unreadable at that width, simplify the layout, tighten the canvas, split the diagram into pages, or use a focused review export; never accept an unreadable full view as passing typography.
54
50
 
55
51
  ### Shape types (vertex)
56
52
 
@@ -210,7 +206,7 @@ Rules: swatch colors come from the active palette (preset or the table above) wi
210
206
  **Grid alignment:** snap all `x`, `y`, `width`, `height` values to **multiples of 10** — this ensures shapes align cleanly on draw.io's default grid and makes manual editing easier.
211
207
 
212
208
  **General rules:**
213
- - Recalculate visible content bounds and update `pageWidth`/`pageHeight` after every layout change; retain at least the 20px minimum outer margin (40px recommended)
209
+ - Run `drawio_fit_canvas` after every layout change so `pageWidth`/`pageHeight` track the content; it keeps the recommended 40px outer margin (DrawMe warns below the 20px minimum)
214
210
  - Plan a grid before assigning x/y coordinates — sketch node positions on paper/mentally first
215
211
  - Group related nodes in the same horizontal or vertical band
216
212
  - Use `swimlane` cells for logical grouping with visible borders
@@ -1,24 +1,10 @@
1
- # DrawMe Extension Agent Reference
1
+ # DrawMe Extension Reference
2
2
 
3
- > Official operational reference for AI agents using the DrawMe Pi extension.
3
+ > Catalog of the commands and tools the DrawMe Pi extension provides, for any project or session that uses it.
4
4
 
5
5
  DrawMe turns diagram requirements into editable `.drawio` sources and local PNG, SVG, PDF, or JPG exports. The extension provides commands that start guided workflows and tools for CLI detection, Mermaid conversion, XML layout, structural validation, shape lookup, export, explanation, and file opening.
6
6
 
7
- This document defines the extension's public functionality, options, defaults, decision rules, and expected agent behavior.
8
-
9
- ## Core operating rules
10
-
11
- 1. Treat the `.drawio` file as the source of truth. Exports are derived artifacts.
12
- 2. Call `drawio_check` once before conversion, layout, preview, or final export.
13
- 3. Use DrawMe tools for draw.io CLI operations; do not invoke `drawio` through a shell.
14
- 4. Use `drawio_shapesearch` instead of guessing official shape styles.
15
- 5. Keep hand-authored XML uncompressed and structurally valid.
16
- 6. Run `drawio_validate` after every source edit. Fix every error; fix each warning or explicitly record why it was reviewed and accepted.
17
- 7. Inspect one visual category at a time in this order: canvas/composition, nodes/typography, connectors, semantics/polish, then a holistic regression check.
18
- 8. Use `drawio_export` with `mode: "preview"` for visual inspection. A successful PNG preview returns both text/metadata and the actual image; the text path remains the fallback when a model or run mode cannot consume images.
19
- 9. Require explicit user approval before `mode: "final"`. Each successful preview export removes the previous preview file for the same source, leaving only the latest; a successful final export removes that remaining preview. Cleanup warnings do not invalidate the new export.
20
- 10. Inspect every tool's text result. Several tools return failure text rather than throwing a tool-call error.
21
- 11. Offer `drawio_open` for manual fine-tuning; call it only when the user wants a desktop application opened.
7
+ This document lists the extension's public surface: commands, tools, options, defaults, output behavior, and limitations. It is not a workflow guide — the `/drawme` command injects the full authoring workflow itself, and the registered tool descriptions carry the operational rules. Two conventions apply everywhere: the `.drawio` file is the source of truth (exports are derived artifacts), and several tools report failures as a text result (`Export failed`, `Layout failed`, `Mermaid conversion failed`, `Fit canvas failed`, `Explain failed`, `Open failed`) rather than a tool-call error, so results must always be read.
22
8
 
23
9
  ## Functional availability
24
10
 
@@ -26,6 +12,7 @@ This document defines the extension's public functionality, options, defaults, d
26
12
  | --- | --- | --- |
27
13
  | Write or edit uncompressed `.drawio` XML with normal file tools | No | No |
28
14
  | `drawio_validate` | No | No |
15
+ | `drawio_fit_canvas` | No | No |
29
16
  | `drawio_shapesearch` | No | No |
30
17
  | `drawio_explain` | No | No |
31
18
  | `drawio_open` | No CLI check; requires an OS file handler | No |
@@ -33,17 +20,17 @@ This document defines the extension's public functionality, options, defaults, d
33
20
  | `drawio_from_mermaid` | Yes | Yes |
34
21
  | `drawio_layout` | Yes | Yes |
35
22
 
36
- When the CLI is unavailable, an agent can still author, edit, validate, explain, and search for shapes. It must skip conversion, layout, preview, and final export.
23
+ When the CLI is unavailable, you can still author, edit, validate, explain, and search for shapes. Skip conversion, layout, preview, and final export.
37
24
 
38
25
  When the CLI is older than version 30, export remains available. Mermaid conversion and ELK layout do not.
39
26
 
40
27
  ## Commands
41
28
 
42
- Commands are user-facing shortcuts. Agents should use model-callable tools when they need explicit options or structured results.
29
+ Commands are user-facing shortcuts. Use the model-callable tools when you need explicit options or structured results.
43
30
 
44
31
  | Command | Functionality |
45
32
  | --- | --- |
46
- | `/drawme <description>` | Starts the full workflow: check, plan, author, validate, focused quality passes, holistic regression review, approval, and final export. |
33
+ | `/drawme <description>` | Starts the full autonomous workflow: check, plan, author, validate, critique-first visual review, and final export — no human intervention once started. The command pre-resolves the draw.io CLI and embeds the diagram-types, XML-authoring, and (on v30+) Mermaid references into the injected message, so the run starts without tool calls or file reads; only the troubleshooting reference is read on demand. |
47
34
  | `/drawme-check` | Displays the detected draw.io path and version, or reports that the CLI is unavailable. |
48
35
  | `/drawme-export <file> [png\|svg\|pdf\|jpg]` | Performs a final export of an existing `.drawio`; format defaults to PNG. |
49
36
 
@@ -51,7 +38,7 @@ Commands are user-facing shortcuts. Agents should use model-callable tools when
51
38
 
52
39
  ## Tools
53
40
 
54
- DrawMe registers eight model-callable tools.
41
+ DrawMe registers nine model-callable tools.
55
42
 
56
43
  ### `drawio_check`
57
44
 
@@ -123,7 +110,7 @@ Additional behavior:
123
110
  - An explicit `width` replaces raster scaling.
124
111
  - `scale` is ignored in preview mode and for vector formats.
125
112
  - `transparent` has no effect outside PNG.
126
- - Preview mode defaults to unembedded output suitable for vision inspection. A successful PNG preview tool result contains its normal text/metadata block followed by an `image/png` base64 image block. Text-only models and non-image run modes still receive the usable output path.
113
+ - Preview mode defaults to unembedded output suitable for visual inspection. When the current model can view images, a successful PNG preview tool result contains its normal text/metadata block followed by an `image/png` base64 image block; otherwise the image is omitted. The result text always states which case applies, and the output path in the text stays usable either way.
127
114
  - Final exports stay text-only; final PNG, SVG, and PDF default to embedded/editable output.
128
115
  - JPG cannot carry editable XML; never set `embed: true` for JPG.
129
116
  - Embedded PNG exports are checked for draw.io's known truncated IEND chunk and repaired automatically when necessary.
@@ -133,7 +120,7 @@ Additional behavior:
133
120
  #### Use
134
121
 
135
122
  ```text
136
- # Vision-safe inspection artifact
123
+ # Inspection preview (image attached when the current model can view images)
137
124
  drawio_export({ "input": "architecture.drawio", "mode": "preview" })
138
125
 
139
126
  # Editable final SVG
@@ -207,7 +194,39 @@ Fix every error and rerun validation. Fix each warning or record an explicit rev
207
194
  drawio_validate({ "input": "architecture.drawio" })
208
195
  ```
209
196
 
210
- Validation is structural rather than rendered. Its static typography checks are deliberately conservative: it cannot guarantee label fit, correct semantic content, valid rendering of a guessed shape, color contrast, visual balance, or clear auto-routed edges. It does not replace focused preview inspection.
197
+ Validation is structural rather than rendered. Its static typography checks are deliberately conservative: it cannot guarantee label fit, correct semantic content, valid rendering of a guessed shape, color contrast, visual balance, or clear auto-routed edges. It does not replace preview inspection when the current model can view images.
198
+
199
+ ---
200
+
201
+ ### `drawio_fit_canvas`
202
+
203
+ Resizes each page's canvas to its visible content plus an outer margin, without launching draw.io.
204
+
205
+ #### Options
206
+
207
+ | Option | Type | Required | Default | Description |
208
+ | --- | --- | --- | --- | --- |
209
+ | `input` | string | Yes | — | Path to the `.drawio` file. |
210
+ | `margin` | number | No | `40` | Outer margin in px between content and page edge. |
211
+ | `output` | string | No | Overwrites `input` | Destination path. |
212
+
213
+ #### Behavior
214
+
215
+ Per page:
216
+
217
+ - computes the visible content bounding box (nested containers, explicit edge waypoints, and separately sized edge labels included);
218
+ - sets `pageWidth`/`pageHeight` to the content size plus twice the margin, honoring `pageScale`;
219
+ - shifts top-level content (absolute vertices, edge waypoints, floating edge endpoints) so the content origin lands exactly at the margin — children of containers and relative geometry move with their parents and are untouched;
220
+ - grows cramped pages and tightens oversized ones; element sizes and relative positions never change;
221
+ - skips compressed pages, intentional infinite canvases (`page="0"`), and pages without measurable content;
222
+ - reports old → new dimensions and any applied shift per page.
223
+
224
+ The result is a source edit: validate afterwards and re-export previews. Use it whenever content overflows the page, margins fall below the minimum, the canvas has excessive empty space, or elements need more room — spread elements apart and refit the canvas instead of shrinking content.
225
+
226
+ ```text
227
+ drawio_fit_canvas({ "input": "architecture.drawio" })
228
+ drawio_fit_canvas({ "input": "architecture.drawio", "margin": 60 })
229
+ ```
211
230
 
212
231
  ---
213
232
 
@@ -254,7 +273,7 @@ drawio_from_mermaid({
254
273
  })
255
274
  ```
256
275
 
257
- Continue with validation, the ordered focused visual passes, holistic regression review, explicit approval, and final export.
276
+ The converted file is a normal `.drawio` source: it can be validated, previewed, and exported like any other.
258
277
 
259
278
  ---
260
279
 
@@ -386,112 +405,14 @@ drawio_open({ "path": "architecture.drawio" })
386
405
  | Existing diagram only needs validation | `drawio_validate`; no CLI check is necessary. |
387
406
  | Existing diagram only needs export | `drawio_check` → `drawio_export`; do not rebuild it. |
388
407
 
389
- DrawMe does not expose a single natural-language-to-file tool. The agent authors or edits Mermaid/XML with normal file tools, then uses DrawMe for conversion, layout, validation, rendering, explanation, or opening.
390
-
391
- ## Creation workflow
392
-
393
- ### 1. Check
394
-
395
- Call `drawio_check` and record whether export is available and whether Mermaid/layout features are supported.
396
-
397
- ### 2. Plan
398
-
399
- Choose:
400
-
401
- - diagram type;
402
- - components and relations;
403
- - groups or containers;
404
- - top-to-bottom or left-to-right direction;
405
- - Mermaid or XML authoring mode;
406
- - source path, finite page dimensions (or an intentional infinite canvas), pages, and final formats.
407
-
408
- Call `drawio_shapesearch` during planning whenever an exact library shape is required.
409
-
410
- ### 3. Author
411
-
412
- For Mermaid, write concise valid Mermaid and convert it with `drawio_from_mermaid`.
413
-
414
- For XML, use an uncompressed `<mxGraphModel>`. The minimum authoring contract is:
415
-
416
- - include root cells `id="0"` and `id="1"`;
417
- - reserve IDs `0` and `1` for those root cells;
418
- - assign every other cell a unique ID and valid parent;
419
- - assign every vertex positive geometry;
420
- - use explicit `page="1"`, `pageScale="1"`, `pageWidth`, and `pageHeight` for deliverables, sized to visible content with at least 20px outer margin (40px recommended); use `page="0"` only for an intentional infinite canvas;
421
- - assign every edge valid source and target IDs;
422
- - include `<mxGeometry relative="1" as="geometry" />` in every edge;
423
- - escape XML attribute characters and use `&#xa;` for label line breaks;
424
- - use coordinates relative to the actual parent container;
425
- - leave spacing and routing corridors for labels, edges, and arrowheads.
426
-
427
- For large XML graphs on draw.io 30+, run `drawio_layout` and continue using its returned path.
428
-
429
- ### 4. Validate after every source edit
430
-
431
- Run `drawio_validate` immediately after initial authoring, Mermaid conversion, layout, and every later XML/source edit. Fix every error before previewing. Every warning must be fixed or explicitly recorded as reviewed and acceptable with a reason; unresolved or unreviewed warnings block final export.
432
-
433
- ### 5. Focused visual quality passes
434
-
435
- Inspect exactly one category at a time and keep this order. For each pass, export its predictable PNG, inspect only its listed acceptance checks, make a targeted source correction if needed, validate, then replace/re-export that pass preview before advancing:
436
-
437
- 1. **Canvas and composition** — `<name>.review-canvas.png`: page bounds, margins, clipping, excessive empty space, aspect ratio, major alignment, and balance.
438
- 2. **Nodes and typography** — `<name>.review-nodes.png`: overlap, clipping, wrapping, font readability, contrast, padding, sizing, and alignment.
439
- 3. **Connectors** — `<name>.review-connectors.png`: endpoints, arrowheads, line stacking, crossings, routes through unrelated elements, connector labels, and routing corridors.
440
- 4. **Semantics and final polish** — `<name>.review-semantics.png`: requested components/relationships, hierarchy, consistency, legends, grouping, and remaining regressions.
441
- 5. **Holistic regression check** — `<name>.review.png`: recheck all prior categories and confirm later fixes introduced no regression. This is the one review image retained for approval.
442
-
443
- A successful PNG preview result already includes the image block. If the selected model/run mode cannot consume it, use the text path to read or present the artifact. When a new preview for the same source succeeds, the prior preview file is removed automatically; at any point only the latest review artifact should remain. A full-diagram preview is capped at 2000px; if that scaling makes labels unreadable, tighten/simplify the layout, split pages, or use focused review rather than approving unreadable typography.
444
-
445
- The five required inspection passes do not consume correction retries. Allow at most **5 automatic correction retries total** across the workflow. One retry is exactly one targeted source edit → `drawio_validate` → replacement preview cycle. Count retries explicitly. At the limit, stop automatic editing, identify the unresolved category, request focused feedback, and offer `drawio_open` instead of looping.
446
-
447
- ### 6. Human approval and final export
448
-
449
- Present the holistic preview, validation status, and reasons for any reviewed/accepted warnings. User feedback triggers a targeted edit, validation, the affected focused pass, and another holistic regression preview. Receive explicit user approval before calling `drawio_export` with `mode: "final"`.
450
-
451
- After approval, export each requested format and page. The first successful final export automatically removes the one remaining latest preview for that source. Report:
452
-
453
- - source `.drawio` path;
454
- - validation status and reasons for retained reviewed warnings;
455
- - focused-pass and holistic-regression outcomes;
456
- - every final output path and format;
457
- - whether each output embeds editable XML;
458
- - preview cleanup warnings, plus any unavailable or skipped functionality.
459
-
460
- ## Existing-diagram workflows
461
-
462
- ### Explain
463
-
464
- Use `drawio_explain` for a structured read-back. For exact edits, inspect the XML after obtaining the summary.
465
-
466
- ### Validate
467
-
468
- Use `drawio_validate` directly. A CLI check is unnecessary unless an export will follow.
469
-
470
- ### Edit
471
-
472
- 1. Preserve the original unless replacement was requested.
473
- 2. Explain and inspect the source.
474
- 3. Make the smallest targeted XML change.
475
- 4. Validate the edited source and resolve/review every warning.
476
- 5. Rerun the affected focused preview, then a holistic regression preview.
477
- 6. Obtain explicit approval and export to a new path unless in-place replacement was requested.
478
-
479
- Do not blindly edit compressed pages. The validator and explainer cannot inspect them; they must first be saved as uncompressed XML through a compatible editor.
480
-
481
- ### Export
482
-
483
- Check the CLI, then call `drawio_export` with the requested format and options. Do not reconstruct a valid existing source merely to export it.
484
-
485
- ### Re-layout
486
-
487
- Use `drawio_layout` only for XML-authored or existing native diagrams on draw.io 30+. Preserve the original by using a distinct output unless replacement is intentional. Validate and preview the layout result.
408
+ DrawMe does not expose a single natural-language-to-file tool. Author or edit Mermaid/XML with normal file tools, then use DrawMe for conversion, layout, validation, rendering, explanation, or opening.
488
409
 
489
410
  ## Output and editability semantics
490
411
 
491
412
  - `.drawio` is always the canonical editable source.
492
413
  - Final PNG, SVG, and PDF embed XML by default and can be reopened in draw.io where supported.
493
414
  - JPG cannot embed XML.
494
- - Preview PNG is intentionally clean and unembedded for vision compatibility. Its successful tool result includes the actual image plus a text-path fallback. Each successful replacement removes the prior same-source preview file, and final export removes the latest remaining preview.
415
+ - Preview PNG is intentionally clean and unembedded for visual inspection. Its successful tool result includes the image when the current model can view images, and the text always states whether it was attached and reports the output path. Each successful replacement removes the prior same-source preview file, and final export removes the latest remaining preview.
495
416
  - A final embedded PNG normally uses the `.drawio.png` double extension.
496
417
  - Multi-page exports should use `pageIndex` and explicit unique output names.
497
418
  - `drawio_explain` returns Markdown as text; it does not write a documentation file.
@@ -502,7 +423,7 @@ Use `drawio_layout` only for XML-authored or existing native diagrams on draw.io
502
423
 
503
424
  - Validation cannot inspect compressed pages.
504
425
  - Explanation cannot describe compressed pages.
505
- - Deterministic validation cannot replace focused visual inspection; rendered clipping, wrapping, contrast, and automatic routes remain vision concerns.
426
+ - Deterministic validation cannot replace visual inspection; rendered clipping, wrapping, contrast, and automatic routes can only be judged from the preview image. When the current model cannot view images, these remain unverified and must be reported as such.
506
427
  - Removing a superseded preview file does not rewrite Pi session history: image blocks already stored in earlier tool-result messages can remain visible in the transcript even though only the latest preview file remains on disk.
507
428
  - Route-through and crossing analysis is limited to edges with explicit waypoints; dense auto-routed graphs can validate without connector-route warnings.
508
429
  - Shape search covers bundled official draw.io shapes, not arbitrary third-party logos.
@@ -190,7 +190,7 @@ Acceptance criteria:
190
190
  Files:
191
191
 
192
192
  - `README.md`
193
- - `docs/agent-guide.md`
193
+ - `docs/reference.md`
194
194
  - `CHANGELOG.md`
195
195
  - `example/drawme-how-it-works.drawio`
196
196
  - `example/drawme-how-it-works.drawio.png`
@@ -0,0 +1,72 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <mxfile host="drawio" version="31.1.5">
3
+ <diagram id="drawme-waterfall" name="High-level overview">
4
+ <mxGraphModel dx="1640" dy="1040" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1640" pageHeight="1040" math="0" shadow="0">
5
+ <root>
6
+ <mxCell id="0" />
7
+ <mxCell id="1" parent="0" />
8
+
9
+ <mxCell id="title" value="DrawMe Pi Extension" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;fontSize=30;fontStyle=1;fontColor=#173B67;strokeColor=none;fillColor=none;spacing=0;" vertex="1" parent="1">
10
+ <mxGeometry x="60" y="40" width="900" height="40" as="geometry" />
11
+ </mxCell>
12
+ <mxCell id="subtitle" value="High-level waterfall overview | request &#8594; governed authoring &#8594; editable deliverables" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=middle;fontSize=16;fontColor=#52657A;strokeColor=none;fillColor=none;spacing=0;" vertex="1" parent="1">
13
+ <mxGeometry x="60" y="90" width="980" height="30" as="geometry" />
14
+ </mxCell>
15
+ <mxCell id="cli-badge" value="draw.io CLI 31.1.5 | v30+ features active" style="rounded=1;arcSize=24;whiteSpace=wrap;html=1;align=center;verticalAlign=middle;fontSize=13;fontStyle=1;fontColor=#23623B;fillColor=#E8F6EC;strokeColor=#3A9D5D;strokeWidth=1;spacing=8;" vertex="1" parent="1">
16
+ <mxGeometry x="1300" y="50" width="300" height="40" as="geometry" />
17
+ </mxCell>
18
+
19
+ <mxCell id="stage-01" value="&lt;b&gt;&lt;font style=&quot;font-size:18px&quot;&gt;01&lt;/font&gt;&#160;&#160;Request&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#40566F&quot;&gt;Natural-language intent arrives through &lt;b&gt;/drawme&lt;/b&gt; in the Pi agent.&lt;/font&gt;" style="rounded=1;arcSize=18;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=14;fontColor=#173B67;fillColor=#EAF2FF;strokeColor=#4C78C2;strokeWidth=2;spacing=14;shadow=1;" vertex="1" parent="1">
20
+ <mxGeometry x="60" y="170" width="280" height="110" as="geometry" />
21
+ </mxCell>
22
+ <mxCell id="stage-02" value="&lt;b&gt;&lt;font style=&quot;font-size:18px&quot;&gt;02&lt;/font&gt;&#160;&#160;Guided orchestration&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#40566F&quot;&gt;&lt;b&gt;workflow.ts&lt;/b&gt; injects the nine-step autonomous process.&lt;/font&gt;" style="rounded=1;arcSize=18;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=14;fontColor=#173B67;fillColor=#EAF2FF;strokeColor=#4C78C2;strokeWidth=2;spacing=14;shadow=1;" vertex="1" parent="1">
23
+ <mxGeometry x="270" y="290" width="280" height="110" as="geometry" />
24
+ </mxCell>
25
+ <mxCell id="stage-03" value="&lt;b&gt;&lt;font style=&quot;font-size:18px&quot;&gt;03&lt;/font&gt;&#160;&#160;Author editable source&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#6B4A21&quot;&gt;Uncompressed XML or Mermaid; exact shape search and optional ELK layout.&lt;/font&gt;" style="rounded=1;arcSize=18;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=14;fontColor=#7A4515;fillColor=#FFF1E6;strokeColor=#E67E22;strokeWidth=2;spacing=14;shadow=1;" vertex="1" parent="1">
26
+ <mxGeometry x="480" y="410" width="280" height="110" as="geometry" />
27
+ </mxCell>
28
+ <mxCell id="stage-04" value="&lt;b&gt;&lt;font style=&quot;font-size:18px&quot;&gt;04&lt;/font&gt;&#160;&#160;Validate every revision&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#66551D&quot;&gt;&lt;b&gt;validate.ts&lt;/b&gt; blocks broken IDs, geometry, bounds, overlap, and explicit routes.&lt;/font&gt;" style="rounded=1;arcSize=18;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=14;fontColor=#66500E;fillColor=#FFF8DD;strokeColor=#C89B1D;strokeWidth=2;spacing=14;shadow=1;" vertex="1" parent="1">
29
+ <mxGeometry x="690" y="530" width="280" height="110" as="geometry" />
30
+ </mxCell>
31
+ <mxCell id="stage-05" value="&lt;b&gt;&lt;font style=&quot;font-size:18px&quot;&gt;05&lt;/font&gt;&#160;&#160;Preview, critique, refine&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#66551D&quot;&gt;Clean PNG review across four categories; targeted fixes are revalidated (max 5).&lt;/font&gt;" style="rounded=1;arcSize=18;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=14;fontColor=#66500E;fillColor=#FFF8DD;strokeColor=#C89B1D;strokeWidth=2;spacing=14;shadow=1;" vertex="1" parent="1">
32
+ <mxGeometry x="900" y="650" width="280" height="110" as="geometry" />
33
+ </mxCell>
34
+ <mxCell id="stage-06" value="&lt;b&gt;&lt;font style=&quot;font-size:18px&quot;&gt;06&lt;/font&gt;&#160;&#160;Holistic confirmation&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#66551D&quot;&gt;The latest holistic preview is re-checked across all categories; the run continues straight to final export.&lt;/font&gt;" style="rounded=1;arcSize=18;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=14;fontColor=#66500E;fillColor=#FFF8DD;strokeColor=#C89B1D;strokeWidth=2;spacing=14;shadow=1;" vertex="1" parent="1">
35
+ <mxGeometry x="1110" y="770" width="280" height="110" as="geometry" />
36
+ </mxCell>
37
+ <mxCell id="stage-07" value="&lt;b&gt;&lt;font style=&quot;font-size:18px&quot;&gt;07&lt;/font&gt;&#160;&#160;Export deliverables&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#2B5D3C&quot;&gt;&lt;b&gt;drawio.ts&lt;/b&gt; invokes the local CLI &#8594; editable PNG / SVG / PDF / JPG and preview cleanup.&lt;/font&gt;" style="rounded=1;arcSize=18;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=14;fontColor=#23623B;fillColor=#E8F6EC;strokeColor=#3A9D5D;strokeWidth=2;spacing=14;shadow=1;" vertex="1" parent="1">
38
+ <mxGeometry x="1320" y="890" width="280" height="110" as="geometry" />
39
+ </mxCell>
40
+
41
+ <mxCell id="edge-01-02" value="" style="edgeStyle=none;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=blockThin;endFill=1;endSize=10;strokeColor=#60738A;strokeWidth=2;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="stage-01" target="stage-02">
42
+ <mxGeometry relative="1" as="geometry" />
43
+ </mxCell>
44
+ <mxCell id="edge-02-03" value="" style="edgeStyle=none;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=blockThin;endFill=1;endSize=10;strokeColor=#60738A;strokeWidth=2;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="stage-02" target="stage-03">
45
+ <mxGeometry relative="1" as="geometry" />
46
+ </mxCell>
47
+ <mxCell id="edge-03-04" value="" style="edgeStyle=none;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=blockThin;endFill=1;endSize=10;strokeColor=#60738A;strokeWidth=2;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="stage-03" target="stage-04">
48
+ <mxGeometry relative="1" as="geometry" />
49
+ </mxCell>
50
+ <mxCell id="edge-04-05" value="" style="edgeStyle=none;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=blockThin;endFill=1;endSize=10;strokeColor=#60738A;strokeWidth=2;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="stage-04" target="stage-05">
51
+ <mxGeometry relative="1" as="geometry" />
52
+ </mxCell>
53
+ <mxCell id="edge-05-06" value="" style="edgeStyle=none;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=blockThin;endFill=1;endSize=10;strokeColor=#60738A;strokeWidth=2;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="stage-05" target="stage-06">
54
+ <mxGeometry relative="1" as="geometry" />
55
+ </mxCell>
56
+ <mxCell id="edge-06-07" value="" style="edgeStyle=none;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;endArrow=blockThin;endFill=1;endSize=10;strokeColor=#60738A;strokeWidth=2;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="stage-06" target="stage-07">
57
+ <mxGeometry relative="1" as="geometry" />
58
+ </mxCell>
59
+
60
+ <mxCell id="surface-note" value="&lt;b&gt;&lt;font style=&quot;font-size:17px&quot;&gt;Extension surface&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;3 commands&lt;/b&gt; /drawme &#183; /drawme-check &#183; /drawme-export&lt;br&gt;&lt;b&gt;8 model tools&lt;/b&gt; check &#183; export &#183; validate &#183; shapes &#183; Mermaid &#183; layout &#183; explain &#183; open&lt;br&gt;&lt;b&gt;Pure TypeScript&lt;/b&gt; validation &#183; shape search &#183; explanation&lt;br&gt;&lt;b&gt;CLI adapter&lt;/b&gt; render &#183; convert &#183; layout &#183; open &#183; PNG repair" style="rounded=1;arcSize=12;whiteSpace=wrap;html=1;align=left;verticalAlign=top;fontSize=13;fontColor=#34495E;fillColor=#F7F9FC;strokeColor=#A9B7C6;strokeWidth=1;spacing=16;shadow=0;" vertex="1" parent="1">
61
+ <mxGeometry x="60" y="450" width="400" height="220" as="geometry" />
62
+ </mxCell>
63
+ <mxCell id="legend" value="&lt;b&gt;Color key&lt;/b&gt;&lt;br&gt;&lt;font color=&quot;#4C78C2&quot;&gt;&#9632;&lt;/font&gt; Interface and control&#160;&#160;&#160;&lt;font color=&quot;#E67E22&quot;&gt;&#9632;&lt;/font&gt; Authoring&lt;br&gt;&lt;font color=&quot;#C89B1D&quot;&gt;&#9632;&lt;/font&gt; Quality and confirmation&#160;&#160;&#160;&lt;font color=&quot;#3A9D5D&quot;&gt;&#9632;&lt;/font&gt; Deliverable" style="rounded=1;arcSize=12;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=13;fontColor=#34495E;fillColor=#FFFFFF;strokeColor=#C8D1DC;strokeWidth=1;spacing=14;" vertex="1" parent="1">
64
+ <mxGeometry x="60" y="710" width="420" height="100" as="geometry" />
65
+ </mxCell>
66
+ <mxCell id="trust-note" value="&lt;b&gt;Trust boundary&lt;/b&gt;&lt;br&gt;Pi may use the configured model; diagram files, structural validation, the shape index, and draw.io CLI execution remain on the local machine." style="rounded=1;arcSize=12;whiteSpace=wrap;html=1;align=left;verticalAlign=middle;fontSize=13;fontColor=#44546A;fillColor=#F4F6F8;strokeColor=#8996A5;strokeWidth=1;dashed=1;dashPattern=6 4;spacing=14;" vertex="1" parent="1">
67
+ <mxGeometry x="60" y="850" width="720" height="100" as="geometry" />
68
+ </mxCell>
69
+ </root>
70
+ </mxGraphModel>
71
+ </diagram>
72
+ </mxfile>