Skip to content

Agent skill that turns natural language, code, Terraform/K8s, SQL, OpenAPI, AsyncAPI, Protobuf and GraphQL sources into editable, tested draw.io architecture diagrams: incremental sync, multi-view projection, drift diff, CI architecture tests, whiteboard derasterize, interactive HTML/PPTX/Mermaid exports.

fix: tighten XML-extraction spec (rule ordering, schema alignment, edge cases)

Agents365-ai26ac6aee897d
diff --git a/docs/superpowers/plans/2026-04-23-custom-styles.md b/docs/superpowers/plans/2026-04-23-custom-styles.md
index 4be098c..eceba19 100644
--- a/docs/superpowers/plans/2026-04-23-custom-styles.md
+++ b/docs/superpowers/plans/2026-04-23-custom-styles.md
@@ -523,11 +523,11 @@ Input: a `.drawio` file path. Output: candidate preset JSON. Deterministic, no L
3. **Extract palette.** For every vertex, take the `(fillColor, strokeColor)` pair (skip vertices with neither). Count frequency. Keep the top ≤7 pairs.
4. **Extract shape vocabulary + role mapping.** For each vertex determine a shape class by precedence:
`cylinder3 > ellipse > rhombus > swimlane > rounded=1 > rounded=0`.
- Then infer the semantic role:
+ Then infer the semantic role from the vertex's shape class and its `value` (label) attribute. **Evaluate the rules below in order; first match wins.**
- `cylinder3` → `database`
- `rhombus` → `decision`
- `swimlane` → `container`
- - `dashed=1` present + grey-family fill → `external`
+ - `dashed=1` present + **grey-family fill** (hex where the R, G, and B channels all fall within ±16 of each other, i.e., near-achromatic) → `external`
- label matches `/queue|bus|kafka|rabbit/i` → `queue`
- label matches `/gateway|api|lb|load/i` → `gateway`
- label matches `/auth|login|jwt|oauth/i` → `security`
@@ -542,10 +542,9 @@ Input: a `.drawio` file path. Output: candidate preset JSON. Deterministic, no L
Leftover color pairs (not claimed by any role-slot mapping) fill remaining empty palette slots in descending-frequency order.
- Record the shape class string used per role in `shapes[role]` (e.g., `shapes.database = "shape=cylinder3"`). This applies to all nine shape roles: `service`, `database`, `queue`, `decision`, `external`, `container`, plus `gateway`, `error`, `security` where their modal shape differs from `service`.
+ Record the shape class string used per role in `shapes[role]`. The six named shape keys are `service`, `database`, `queue`, `decision`, `external`, `container` — `gateway`, `error`, and `security` roles inherit `shapes.service` and do not get their own `shapes[...]` entry. Example: `shapes.database = "shape=cylinder3"`.
-5. **Extract fonts.** Modal `fontFamily`, `fontSize`, `fontStyle` across vertices.
- If a distinguishable subset uses a larger size + `fontStyle=1` (bold), treat that as titles: set `titleFontSize` and `titleBold: true`.
+5. **Extract fonts.** Compute modal `fontFamily` and `fontSize` across vertices; emit them as `font.fontFamily` and `font.fontSize`. Also track `fontStyle` per vertex as a **working variable** (not an output field — the schema has no top-level `font.fontStyle`). If a distinguishable subset of vertices uses a larger `fontSize` combined with `fontStyle=1` (bold), treat that subset as titles: set `font.titleFontSize` to their modal size and `font.titleBold: true`. Otherwise omit both title fields.
6. **Extract edge defaults.** Take the modal edge style string, but strip these per-edge coordinate keys before counting: `entryX`, `entryY`, `exitX`, `exitY`, `entryDx`, `entryDy`, `exitDx`, `exitDy`. Record arrow style from `endArrow`/`endFill` separately in `edges.arrow`.
If any edges have `dashed=1`, collect their `value` (label) attributes. If ≥2 share a common token (e.g., all are labeled "async" or "optional"), add that token to `edges.dashedFor`.
@@ -566,7 +565,7 @@ Input: a `.drawio` file path. Output: candidate preset JSON. Deterministic, no L
|---|---|
| Source has <3 distinct color pairs | Leave unfilled slots as `null`. Downgrade `confidence` to `"medium"`. Summary warns the user. |
| Source has >7 color pairs | Keep the top 7 by frequency. Summary warns that some colors were dropped. |
-| Non-standard `shape=` keywords (e.g., `shape=mxgraph.aws4.*`) | Record the literal string under the closest role. Note in summary. |
+| Non-standard `shape=` keywords (e.g., `shape=mxgraph.aws4.*`) | These do not match the Step 4 precedence ladder, so the vertex falls through to `rounded=0` for shape-class purposes. Iconography is lost; color, label, and edge style are still captured. Role inference still runs via the label-regex rules. Summary notes: *"Non-standard shape library detected — iconography not preserved in preset (color and label captured)."* |
| Non-English labels | The English-keyword regexes in step 4 will mostly miss; most vertices collapse to `service`. Palette/shapes/font/edges still captured correctly (they don't depend on label text). `confidence` stays `"high"`. Summary notes: *"Role labels not in English — `service`/`database`/`decision`/`container`/`external` inferred from shape class; other roles not mapped."* |
| File has no `<mxCell vertex="1">` at all | Stop. Refuse to save. Message: *"Nothing to learn from — source file has no shapes."* |
````
diff --git a/references/style-extraction.md b/references/style-extraction.md
index d41164b..cbd536a 100644
--- a/references/style-extraction.md
+++ b/references/style-extraction.md
@@ -120,11 +120,11 @@ Input: a `.drawio` file path. Output: candidate preset JSON. Deterministic, no L
3. **Extract palette.** For every vertex, take the `(fillColor, strokeColor)` pair (skip vertices with neither). Count frequency. Keep the top ≤7 pairs.
4. **Extract shape vocabulary + role mapping.** For each vertex determine a shape class by precedence:
`cylinder3 > ellipse > rhombus > swimlane > rounded=1 > rounded=0`.
- Then infer the semantic role:
+ Then infer the semantic role from the vertex's shape class and its `value` (label) attribute. **Evaluate the rules below in order; first match wins.**
- `cylinder3` → `database`
- `rhombus` → `decision`
- `swimlane` → `container`
- - `dashed=1` present + grey-family fill → `external`
+ - `dashed=1` present + **grey-family fill** (hex where the R, G, and B channels all fall within ±16 of each other, i.e., near-achromatic) → `external`
- label matches `/queue|bus|kafka|rabbit/i` → `queue`
- label matches `/gateway|api|lb|load/i` → `gateway`
- label matches `/auth|login|jwt|oauth/i` → `security`
@@ -139,10 +139,9 @@ Input: a `.drawio` file path. Output: candidate preset JSON. Deterministic, no L
Leftover color pairs (not claimed by any role-slot mapping) fill remaining empty palette slots in descending-frequency order.
- Record the shape class string used per role in `shapes[role]` (e.g., `shapes.database = "shape=cylinder3"`). This applies to all nine shape roles: `service`, `database`, `queue`, `decision`, `external`, `container`, plus `gateway`, `error`, `security` where their modal shape differs from `service`.
+ Record the shape class string used per role in `shapes[role]`. The six named shape keys are `service`, `database`, `queue`, `decision`, `external`, `container` — `gateway`, `error`, and `security` roles inherit `shapes.service` and do not get their own `shapes[...]` entry. Example: `shapes.database = "shape=cylinder3"`.
-5. **Extract fonts.** Modal `fontFamily`, `fontSize`, `fontStyle` across vertices.
- If a distinguishable subset uses a larger size + `fontStyle=1` (bold), treat that as titles: set `titleFontSize` and `titleBold: true`.
+5. **Extract fonts.** Compute modal `fontFamily` and `fontSize` across vertices; emit them as `font.fontFamily` and `font.fontSize`. Also track `fontStyle` per vertex as a **working variable** (not an output field — the schema has no top-level `font.fontStyle`). If a distinguishable subset of vertices uses a larger `fontSize` combined with `fontStyle=1` (bold), treat that subset as titles: set `font.titleFontSize` to their modal size and `font.titleBold: true`. Otherwise omit both title fields.
6. **Extract edge defaults.** Take the modal edge style string, but strip these per-edge coordinate keys before counting: `entryX`, `entryY`, `exitX`, `exitY`, `entryDx`, `entryDy`, `exitDx`, `exitDy`. Record arrow style from `endArrow`/`endFill` separately in `edges.arrow`.
If any edges have `dashed=1`, collect their `value` (label) attributes. If ≥2 share a common token (e.g., all are labeled "async" or "optional"), add that token to `edges.dashedFor`.
@@ -163,6 +162,6 @@ Input: a `.drawio` file path. Output: candidate preset JSON. Deterministic, no L
|---|---|
| Source has <3 distinct color pairs | Leave unfilled slots as `null`. Downgrade `confidence` to `"medium"`. Summary warns the user. |
| Source has >7 color pairs | Keep the top 7 by frequency. Summary warns that some colors were dropped. |
-| Non-standard `shape=` keywords (e.g., `shape=mxgraph.aws4.*`) | Record the literal string under the closest role. Note in summary. |
+| Non-standard `shape=` keywords (e.g., `shape=mxgraph.aws4.*`) | These do not match the Step 4 precedence ladder, so the vertex falls through to `rounded=0` for shape-class purposes. Iconography is lost; color, label, and edge style are still captured. Role inference still runs via the label-regex rules. Summary notes: *"Non-standard shape library detected — iconography not preserved in preset (color and label captured)."* |
| Non-English labels | The English-keyword regexes in step 4 will mostly miss; most vertices collapse to `service`. Palette/shapes/font/edges still captured correctly (they don't depend on label text). `confidence` stays `"high"`. Summary notes: *"Role labels not in English — `service`/`database`/`decision`/`container`/`external` inferred from shape class; other roles not mapped."* |
| File has no `<mxCell vertex="1">` at all | Stop. Refuse to save. Message: *"Nothing to learn from — source file has no shapes."* |