agentic-mermaid 0.4.1 → 0.5.3

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.
Files changed (253) hide show
  1. package/AGENT_NATIVE.md +94 -627
  2. package/CHANGELOG.md +651 -0
  3. package/Instructions_for_agents.md +44 -23
  4. package/LICENSES/Khroma-MIT.txt +21 -0
  5. package/LICENSES/Mermaid-MIT.txt +21 -0
  6. package/LICENSES/es-toolkit-MIT.txt +21 -0
  7. package/LICENSES/pele-MIT.txt +40 -0
  8. package/LICENSES/zenuml-core-MIT.txt +21 -0
  9. package/README.md +93 -50
  10. package/SECURITY.md +28 -12
  11. package/THIRD_PARTY_NOTICES.md +60 -0
  12. package/assets/hero.png +0 -0
  13. package/dist/agent-core.d.ts +478 -210
  14. package/dist/agent-core.js +1 -396
  15. package/dist/agent.d.ts +17 -8
  16. package/dist/agent.js +1 -408
  17. package/dist/agentic-mermaid-mcp.js +1 -11
  18. package/dist/am.js +1 -34562
  19. package/dist/browser-lazy/chunks/agentic-producer-core-CC6OOLDW.js +1 -0
  20. package/dist/browser-lazy/chunks/architecture-QUFVKYJR.js +13 -0
  21. package/dist/browser-lazy/chunks/block-6J3Q63BO.js +11 -0
  22. package/dist/browser-lazy/chunks/builtin-backends-7SOZZHPF.js +12 -0
  23. package/dist/browser-lazy/chunks/c4-SQVBZAKJ.js +10 -0
  24. package/dist/browser-lazy/chunks/chunk-2GPK4VFF.js +5 -0
  25. package/dist/browser-lazy/chunks/chunk-2I4UPL7Q.js +3 -0
  26. package/dist/browser-lazy/chunks/chunk-2SH76OTH.js +1 -0
  27. package/dist/browser-lazy/chunks/chunk-2UIA2IME.js +3 -0
  28. package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +1 -0
  29. package/dist/browser-lazy/chunks/chunk-5B2Z7575.js +1 -0
  30. package/dist/browser-lazy/chunks/chunk-5FQ534HP.js +1 -0
  31. package/dist/browser-lazy/chunks/chunk-5UVGUSD6.js +1 -0
  32. package/dist/browser-lazy/chunks/chunk-5X6MJX3H.js +1 -0
  33. package/dist/browser-lazy/chunks/chunk-AMJLVPUB.js +4 -0
  34. package/dist/browser-lazy/chunks/chunk-BU5LHXNJ.js +3 -0
  35. package/dist/browser-lazy/chunks/chunk-BY2CPG6B.js +1 -0
  36. package/dist/browser-lazy/chunks/chunk-CN7WTBWB.js +1 -0
  37. package/dist/browser-lazy/chunks/chunk-CQE4HQEW.js +1 -0
  38. package/dist/browser-lazy/chunks/chunk-CSFUKSU6.js +1 -0
  39. package/dist/browser-lazy/chunks/chunk-DF6765YX.js +17 -0
  40. package/dist/browser-lazy/chunks/chunk-E2WMJZNM.js +1 -0
  41. package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +6 -0
  42. package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +1 -0
  43. package/dist/browser-lazy/chunks/chunk-HLWUNUCM.js +1 -0
  44. package/dist/browser-lazy/chunks/chunk-ICC7HBJX.js +1 -0
  45. package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +20 -0
  46. package/dist/browser-lazy/chunks/chunk-J7FFAFQF.js +1 -0
  47. package/dist/browser-lazy/chunks/chunk-LH7HUDKW.js +1 -0
  48. package/dist/browser-lazy/chunks/chunk-N5ELX7LR.js +2 -0
  49. package/dist/browser-lazy/chunks/chunk-NMQQMRIR.js +1 -0
  50. package/dist/browser-lazy/chunks/chunk-NO7ZIVRU.js +1 -0
  51. package/dist/browser-lazy/chunks/chunk-OZ443IVJ.js +16 -0
  52. package/dist/browser-lazy/chunks/chunk-PQGPS2YV.js +7 -0
  53. package/dist/browser-lazy/chunks/chunk-QA6GJQ4X.js +1 -0
  54. package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +1 -0
  55. package/dist/browser-lazy/chunks/chunk-SZELX2EJ.js +1 -0
  56. package/dist/browser-lazy/chunks/chunk-TYZOZXUJ.js +22 -0
  57. package/dist/browser-lazy/chunks/chunk-UL6NDWLL.js +1 -0
  58. package/dist/browser-lazy/chunks/chunk-VQYYGAXP.js +1 -0
  59. package/dist/browser-lazy/chunks/chunk-VWVZGQE2.js +1 -0
  60. package/dist/browser-lazy/chunks/chunk-X2UYKWKM.js +4 -0
  61. package/dist/browser-lazy/chunks/chunk-YCEICNM6.js +1 -0
  62. package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +20 -0
  63. package/dist/browser-lazy/chunks/class-5QA4SCTS.js +13 -0
  64. package/dist/browser-lazy/chunks/decode-63UIZGD2.js +1 -0
  65. package/dist/browser-lazy/chunks/elk.bundled-L4CADV5W.js +24 -0
  66. package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +11 -0
  67. package/dist/browser-lazy/chunks/eventmodeling-2BPLHWRN.js +19 -0
  68. package/dist/browser-lazy/chunks/flowchart-NEIMZTB5.js +4 -0
  69. package/dist/browser-lazy/chunks/forest-implementation-AEP24AIP.js +1 -0
  70. package/dist/browser-lazy/chunks/gantt-RDPIFYAF.js +11 -0
  71. package/dist/browser-lazy/chunks/gitgraph-N4Y5RYB7.js +9 -0
  72. package/dist/browser-lazy/chunks/ishikawa-LD3YBDJN.js +6 -0
  73. package/dist/browser-lazy/chunks/journey-6YQR5DJX.js +16 -0
  74. package/dist/browser-lazy/chunks/kanban-PLMJ7NBW.js +20 -0
  75. package/dist/browser-lazy/chunks/mermaid-yaml-runtime-QVYX4EWK.js +136 -0
  76. package/dist/browser-lazy/chunks/mindmap-K2UBFO3Y.js +12 -0
  77. package/dist/browser-lazy/chunks/packet-CUW4QY6Y.js +7 -0
  78. package/dist/browser-lazy/chunks/pie-7F7UUCG3.js +15 -0
  79. package/dist/browser-lazy/chunks/quadrant-TOONO2WC.js +10 -0
  80. package/dist/browser-lazy/chunks/radar-J6JVWVAX.js +16 -0
  81. package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +3 -0
  82. package/dist/browser-lazy/chunks/requirement-CMAKDJPO.js +19 -0
  83. package/dist/browser-lazy/chunks/sankey-AWXQEP3F.js +13 -0
  84. package/dist/browser-lazy/chunks/sequence-Q2RJRB4L.js +5 -0
  85. package/dist/browser-lazy/chunks/state-WRBFQEDX.js +4 -0
  86. package/dist/browser-lazy/chunks/timeline-D2KILFXM.js +6 -0
  87. package/dist/browser-lazy/chunks/treemap-N3VYX5D4.js +6 -0
  88. package/dist/browser-lazy/chunks/xychart-G73OGK66.js +16 -0
  89. package/dist/browser-lazy/chunks/zenuml-H4BXNYXR.js +16 -0
  90. package/dist/browser-lazy/index.d.ts +544 -275
  91. package/dist/browser-lazy/index.js +1 -1
  92. package/dist/browser.global.js +802 -565
  93. package/dist/chunk-3LGLPG33.js +2 -0
  94. package/dist/chunk-7CRDX2QR.js +2 -0
  95. package/dist/chunk-7PPW2BMO.js +2 -0
  96. package/dist/chunk-DQDKA5ND.js +2 -0
  97. package/dist/chunk-EHCMJUMD.js +52 -0
  98. package/dist/chunk-GVCHLSHH.js +4 -0
  99. package/dist/chunk-H3NCS2XZ.js +19 -0
  100. package/dist/chunk-JZOJ4YGS.js +201 -0
  101. package/dist/chunk-MKE7GNYU.js +146 -0
  102. package/dist/chunk-NKNFOREZ.js +2 -0
  103. package/dist/chunk-O7H2UX5K.js +2 -0
  104. package/dist/chunk-OMY6NRQD.js +58 -0
  105. package/dist/chunk-UA234O4M.js +4 -0
  106. package/dist/chunk-VUFVLGTH.js +2 -0
  107. package/dist/chunk-XU5LPD2D.js +2 -0
  108. package/dist/cli-YGGTJZH7.js +226 -0
  109. package/dist/elk-constructor.js +2 -0
  110. package/dist/elk-constructor.node.js +11 -0
  111. package/dist/index-EeXqJXr5.d.ts +1223 -0
  112. package/dist/index.d.ts +4 -1
  113. package/dist/index.js +1 -334
  114. package/dist/jsonl-RPJY6YWO.js +2 -0
  115. package/dist/mcp-cli-63DYXTVD.js +2 -0
  116. package/dist/{index-BGA_-6LV.d.ts → paint-certification-6rwQjIv_.d.ts} +5283 -6173
  117. package/dist/server-5NEOHOFS.js +524 -0
  118. package/dist/svg-styles-BdnoM7AT.d.ts +724 -0
  119. package/dist/svg-styles.d.ts +1 -0
  120. package/dist/svg-styles.js +2 -0
  121. package/dist/svg.d.ts +13 -0
  122. package/dist/svg.js +2 -0
  123. package/dist/types-BcS52Mjt.d.ts +1360 -0
  124. package/dist/zenuml/chunks/appearance-UOQ5KA6O.js +1 -0
  125. package/dist/zenuml/chunks/builtin-backends-KDKE7YHO.js +12 -0
  126. package/dist/zenuml/chunks/chunk-42DXZ5C6.js +4 -0
  127. package/dist/zenuml/chunks/chunk-7TVYPTDW.js +1 -0
  128. package/dist/zenuml/chunks/chunk-EVPSMEKN.js +1 -0
  129. package/dist/zenuml/chunks/chunk-OXQWRSBM.js +20 -0
  130. package/dist/zenuml/chunks/chunk-QWX77U7G.js +2 -0
  131. package/dist/zenuml/chunks/chunk-RLJEI7YN.js +29 -0
  132. package/dist/zenuml/chunks/chunk-RZ6XK5CD.js +29 -0
  133. package/dist/zenuml/chunks/decode-BWERFDGK.js +1 -0
  134. package/dist/zenuml/chunks/mermaid-yaml-runtime-KZVU74WU.js +136 -0
  135. package/dist/zenuml/chunks/render-core-V5RQ737O.js +3 -0
  136. package/dist/zenuml/chunks/zenuml-EA2ZFRUX.js +20 -0
  137. package/dist/zenuml-frame.global.js +3626 -0
  138. package/dist/zenuml.d.ts +83 -0
  139. package/dist/zenuml.js +1 -0
  140. package/docs/MCP-DIRECTORY-LISTINGS.md +5 -1
  141. package/docs/README.md +59 -103
  142. package/docs/agent-api-cookbook.md +26 -16
  143. package/docs/agent-mutation-policy.md +86 -15
  144. package/docs/agent-workflow-examples.md +1 -1
  145. package/docs/api-advanced.md +385 -0
  146. package/docs/api.md +320 -366
  147. package/docs/ascii.md +40 -4
  148. package/docs/browser.md +46 -7
  149. package/docs/choosing-a-diagram.md +148 -0
  150. package/docs/code-mode-impact.md +1 -0
  151. package/docs/comparison.md +244 -28
  152. package/docs/computational-aesthetics-prototype-plan.md +10 -10
  153. package/docs/config.md +60 -2
  154. package/docs/custom-fonts.md +78 -21
  155. package/docs/diagram-families.md +160 -10
  156. package/docs/eventmodeling-and-zenuml.md +165 -0
  157. package/docs/features.md +21 -19
  158. package/docs/fork-differences.md +105 -32
  159. package/docs/getting-started.md +56 -51
  160. package/docs/layout-certification.md +126 -0
  161. package/docs/mcp-code-mode-rationale.md +20 -12
  162. package/docs/mcp-http-transport.md +14 -8
  163. package/docs/quality.md +145 -15
  164. package/docs/react.md +76 -31
  165. package/docs/style-authoring.md +23 -11
  166. package/docs/svg-semantic-contract.md +104 -4
  167. package/docs/testing-strategy.md +684 -126
  168. package/docs/theming.md +27 -8
  169. package/examples/styles/readme-hero.md +25 -0
  170. package/examples/styles/readme-hero.mmd +13 -0
  171. package/examples/styles/readme-hero.style.json +7 -0
  172. package/package.json +114 -57
  173. package/server.json +2 -2
  174. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +26 -8
  175. package/skills/agentic-mermaid-diagram-workflow/references/cli.md +13 -3
  176. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +2 -1
  177. package/skills/agentic-mermaid-diagram-workflow/references/flowchart.md +9 -6
  178. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +1 -0
  179. package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +4 -3
  180. package/skills/agentic-mermaid-diagram-workflow/references/timeline.md +7 -6
  181. package/skills/agentic-mermaid-diagram-workflow/references/upstream/agentflow.md +574 -0
  182. package/skills/agentic-mermaid-diagram-workflow/references/upstream/architecture.md +10 -2
  183. package/skills/agentic-mermaid-diagram-workflow/references/upstream/c4.md +18 -0
  184. package/skills/agentic-mermaid-diagram-workflow/references/upstream/classDiagram.md +123 -0
  185. package/skills/agentic-mermaid-diagram-workflow/references/upstream/cynefin.md +6 -1
  186. package/skills/agentic-mermaid-diagram-workflow/references/upstream/entityRelationshipDiagram.md +129 -9
  187. package/skills/agentic-mermaid-diagram-workflow/references/upstream/eventmodeling.md +22 -0
  188. package/skills/agentic-mermaid-diagram-workflow/references/upstream/flowchart.md +188 -60
  189. package/skills/agentic-mermaid-diagram-workflow/references/upstream/gitgraph.md +13 -7
  190. package/skills/agentic-mermaid-diagram-workflow/references/upstream/mindmap.md +110 -1
  191. package/skills/agentic-mermaid-diagram-workflow/references/upstream/packet.md +38 -0
  192. package/skills/agentic-mermaid-diagram-workflow/references/upstream/requirementDiagram.md +115 -0
  193. package/skills/agentic-mermaid-diagram-workflow/references/upstream/sequenceDiagram.md +101 -0
  194. package/skills/agentic-mermaid-diagram-workflow/references/upstream/stateDiagram.md +87 -0
  195. package/skills/agentic-mermaid-diagram-workflow/references/upstream/swimlanes.md +105 -2
  196. package/skills/agentic-mermaid-diagram-workflow/references/upstream/timeline.md +12 -6
  197. package/skills/agentic-mermaid-diagram-workflow/references/upstream/usecase.md +953 -0
  198. package/skills/agentic-mermaid-diagram-workflow/references/upstream/venn.md +77 -0
  199. package/skills/agentic-mermaid-diagram-workflow/references/upstream/xyChart.md +1 -1
  200. package/dist/browser-lazy/chunks/architecture-KTHE2HX3.js +0 -31
  201. package/dist/browser-lazy/chunks/chunk-2XCPFAD5.js +0 -46
  202. package/dist/browser-lazy/chunks/chunk-3H4F7RBT.js +0 -1
  203. package/dist/browser-lazy/chunks/chunk-4EVLW2NJ.js +0 -1
  204. package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +0 -1
  205. package/dist/browser-lazy/chunks/chunk-6OAPWSDO.js +0 -1
  206. package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +0 -143
  207. package/dist/browser-lazy/chunks/chunk-C7FJO2I3.js +0 -4
  208. package/dist/browser-lazy/chunks/chunk-D3XXDKIO.js +0 -1
  209. package/dist/browser-lazy/chunks/chunk-DXA5WL7H.js +0 -4
  210. package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +0 -1
  211. package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +0 -2
  212. package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +0 -2
  213. package/dist/browser-lazy/chunks/chunk-G6OLSHRG.js +0 -7
  214. package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
  215. package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +0 -1
  216. package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +0 -1
  217. package/dist/browser-lazy/chunks/chunk-L227EPFP.js +0 -11
  218. package/dist/browser-lazy/chunks/chunk-LNIHDJSF.js +0 -1
  219. package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +0 -1
  220. package/dist/browser-lazy/chunks/chunk-NZRUMODH.js +0 -1
  221. package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +0 -1
  222. package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +0 -1
  223. package/dist/browser-lazy/chunks/chunk-PXKL3O6H.js +0 -1
  224. package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +0 -1
  225. package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +0 -1
  226. package/dist/browser-lazy/chunks/chunk-SUFMSWTX.js +0 -1
  227. package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +0 -3
  228. package/dist/browser-lazy/chunks/chunk-UAEZO5VL.js +0 -1
  229. package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +0 -1
  230. package/dist/browser-lazy/chunks/chunk-X64T74C5.js +0 -24
  231. package/dist/browser-lazy/chunks/class-F7R6TJ73.js +0 -9
  232. package/dist/browser-lazy/chunks/er-BDK7CM5L.js +0 -9
  233. package/dist/browser-lazy/chunks/flowchart-KFU6XV7S.js +0 -4
  234. package/dist/browser-lazy/chunks/gantt-I64VVDSP.js +0 -28
  235. package/dist/browser-lazy/chunks/gitgraph-EDUVJ5IJ.js +0 -8
  236. package/dist/browser-lazy/chunks/journey-TLO2RNM3.js +0 -40
  237. package/dist/browser-lazy/chunks/mindmap-OJCNDYPM.js +0 -9
  238. package/dist/browser-lazy/chunks/pie-HVG6XO7K.js +0 -19
  239. package/dist/browser-lazy/chunks/quadrant-U6S2L4MJ.js +0 -24
  240. package/dist/browser-lazy/chunks/radar-ZDLOBTVG.js +0 -32
  241. package/dist/browser-lazy/chunks/render-core-Y2DFNMQG.js +0 -12
  242. package/dist/browser-lazy/chunks/sequence-Z4WFS3VB.js +0 -12
  243. package/dist/browser-lazy/chunks/state-2HV2YGN3.js +0 -4
  244. package/dist/browser-lazy/chunks/timeline-XM4UFPOC.js +0 -20
  245. package/dist/browser-lazy/chunks/xychart-7JDHWTQY.js +0 -36
  246. package/dist/chunk-GGXCNCNA.js +0 -4118
  247. package/dist/chunk-IVD4NXNE.js +0 -615
  248. package/dist/chunk-JDMRPUAG.js +0 -37
  249. package/dist/chunk-JWAAW3FH.js +0 -149
  250. package/dist/chunk-LCGBT32P.js +0 -62036
  251. package/dist/chunk-RWMZRUIC.js +0 -4715
  252. package/dist/mcp-cli-4MLKC3ZH.js +0 -17
  253. package/docs/mutation-testing.md +0 -285
package/docs/theming.md CHANGED
@@ -21,6 +21,23 @@ const svg = renderMermaidSVG(source, {
21
21
 
22
22
  From those colors the renderer derives contrast-aware node fills, labels, edges, and accents. This is the safest default for agents: pick readable foreground/background colors and let the renderer complete the palette.
23
23
 
24
+ Automatic card and boundary outlines adjust the palette's `border` candidate
25
+ to reach at least 3:1 contrast against a known opaque diagram background. This
26
+ shared rule also applies when a look and palette are stacked. Authored strokes
27
+ and `roles.node.borderColor` / `roles.group.borderColor` keep their exact paint,
28
+ including intentionally hidden or zero-width outlines.
29
+
30
+ Opaque literal background and foreground colors (hex, RGB, HSL and named
31
+ colors) share concrete contrast resolution for outlines, text and connectors.
32
+ Palette tokens and host-controlled CSS variable references remain authored.
33
+
34
+ This background comparison does not certify contrast against nested custom
35
+ fills or an arbitrary host behind a transparent SVG. Unresolved CSS colors and
36
+ translucent outline/background colors retain their supplied values; choose and
37
+ check those paints against the actual embedding surface.
38
+ The ratio compares source paint colors. Check thin outlines at the intended
39
+ PNG size, since antialiasing changes individual pixels.
40
+
24
41
  ## Enriched mode
25
42
 
26
43
  Use extra slots when your product already has semantic tokens:
@@ -127,23 +144,25 @@ For per-element emphasis, keep using Mermaid-native directives such as `classDef
127
144
 
128
145
  ## Security and fonts
129
146
 
130
- Default SVG output can include Google Fonts `@import` rules. The selected font
131
- gets one only when it is a single plain family name; class and ER diagrams can
132
- also import JetBrains Mono for monospace labels. CSS-variable references and
133
- font stacks do not produce an import for the selected family. For offline,
134
- strict, or agent-generated artifacts, use either:
147
+ Default SVG output makes no font requests. Google Fonts `@import` rules are
148
+ opt-in via `embedFontImport: true`; the selected font then gets one only when it
149
+ is a single plain family name, and class and ER diagrams can also import
150
+ JetBrains Mono for monospace labels. CSS-variable references and font stacks do
151
+ not produce an import for the selected family.
135
152
 
136
153
  ```ts
137
- renderMermaidSVG(source, { embedFontImport: false })
154
+ renderMermaidSVG(source, { embedFontImport: true })
138
155
  ```
139
156
 
140
- or strict mode:
157
+ For untrusted diagrams, use strict mode:
141
158
 
142
159
  ```ts
143
160
  renderMermaidSVG(source, { security: 'strict' })
144
161
  ```
145
162
 
146
- `security: 'strict'` disables external-fetch references and is the recommended default for untrusted diagrams.
163
+ `security: 'strict'` disables external-fetch references, including font imports
164
+ requested with `embedFontImport: true`, and is the recommended default for
165
+ untrusted diagrams.
147
166
 
148
167
  For custom Style font selection, browser faces, PNG `fontDirs`, fallbacks, and
149
168
  output-surface differences, see [Fonts in custom styles](./custom-fonts.md).
@@ -0,0 +1,25 @@
1
+ # README hero: login with MFA
2
+
3
+ The hero is a direct Agentic Mermaid PNG render of
4
+ [`readme-hero.mmd`](readme-hero.mmd). The source includes credential validation,
5
+ an MFA decision and two labeled retry paths to sign-in. Its authored classes
6
+ color the MFA check and the successful session path.
7
+
8
+ The style stack is `hand-drawn`, `nord-light`, then
9
+ [`readme-hero.style.json`](readme-hero.style.json), which increases node and edge
10
+ label sizes. The drawing seed is 11. No other artwork or text is added to the
11
+ renderer output.
12
+
13
+ From a source checkout with dependencies installed, generate the PNG directly:
14
+
15
+ ```sh
16
+ bun run bin/am.ts render examples/styles/readme-hero.mmd --format png \
17
+ --style hand-drawn,nord-light,examples/styles/readme-hero.style.json \
18
+ --seed 11 --fit-width 1600 --security strict --output assets/hero.png
19
+ ```
20
+
21
+ `bun run hero` uses the same source and options through `renderMermaidPNG` and
22
+ updates the existing SVG freshness record. `bun run hero:check` checks that
23
+ record against fresh renderer output; inspect the PNG after regeneration.
24
+
25
+ This is an illustrative login flow, not a complete authentication design.
@@ -0,0 +1,13 @@
1
+ flowchart LR
2
+ User([User]) --> Login[Sign in]
3
+ Login --> Credentials{Valid?}
4
+ Credentials -->|no| Login
5
+ Credentials -->|yes| MFA{MFA passed?}
6
+ MFA -->|no| Login
7
+ MFA -->|yes| Session[Create session]
8
+ Session --> Dashboard([Dashboard])
9
+
10
+ classDef challenge fill:#ebcb8b,stroke:#5e81ac,color:#2e3440
11
+ classDef success fill:#a3be8c,stroke:#4c566a,color:#2e3440
12
+ class MFA challenge
13
+ class Session,Dashboard success
@@ -0,0 +1,7 @@
1
+ {
2
+ "formatVersion": 1,
3
+ "roles": {
4
+ "node": { "fontSize": 20, "paddingX": 18, "paddingY": 12 },
5
+ "edge": { "fontSize": 16, "lineWidth": 1.8, "bendRadius": 8 }
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentic-mermaid",
3
3
  "mcpName": "io.github.adewale/agentic-mermaid",
4
- "version": "0.4.1",
4
+ "version": "0.5.3",
5
5
  "license": "MIT",
6
6
  "description": "Agentic Mermaid: render, verify, and safely edit Mermaid diagrams as ASCII, PNG, SVG, or structured agent workflows — with composable styles (hand-drawn, excalidraw, watercolor, or your own as JSON).",
7
7
  "type": "module",
@@ -24,23 +24,45 @@
24
24
  "default": "./dist/agent-core.js"
25
25
  },
26
26
  "./browser": "./dist/browser.global.js",
27
+ "./svg": {
28
+ "types": "./dist/svg.d.ts",
29
+ "import": "./dist/svg.js",
30
+ "default": "./dist/svg.js"
31
+ },
32
+ "./svg/styles": {
33
+ "types": "./dist/svg-styles.d.ts",
34
+ "import": "./dist/svg-styles.js",
35
+ "default": "./dist/svg-styles.js"
36
+ },
27
37
  "./browser/lazy": {
28
38
  "types": "./dist/browser-lazy/index.d.ts",
29
39
  "import": "./dist/browser-lazy/index.js",
30
40
  "default": "./dist/browser-lazy/index.js"
31
41
  },
32
42
  "./style-spec.schema.json": "./docs/schemas/style-spec.schema.json",
33
- "./package.json": "./package.json"
43
+ "./package.json": "./package.json",
44
+ "./zenuml": {
45
+ "types": "./dist/zenuml.d.ts",
46
+ "import": "./dist/zenuml.js",
47
+ "default": "./dist/zenuml.js"
48
+ }
34
49
  },
35
50
  "unpkg": "./dist/browser.global.js",
36
51
  "jsdelivr": "./dist/browser.global.js",
52
+ "imports": {
53
+ "#elk-constructor": {
54
+ "node": "./dist/elk-constructor.node.js",
55
+ "default": "./dist/elk-constructor.js"
56
+ }
57
+ },
37
58
  "bin": {
38
59
  "am": "dist/am.js",
39
60
  "agentic-mermaid": "dist/am.js",
40
61
  "agentic-mermaid-mcp": "dist/agentic-mermaid-mcp.js"
41
62
  },
42
63
  "engines": {
43
- "node": ">=22"
64
+ "node": ">=22",
65
+ "bun": ">=1.4.0"
44
66
  },
45
67
  "publishConfig": {
46
68
  "access": "public",
@@ -80,6 +102,14 @@
80
102
  "mindmap",
81
103
  "git-graph",
82
104
  "radar-chart",
105
+ "sankey-diagram",
106
+ "c4-diagram",
107
+ "packet-diagram",
108
+ "kanban",
109
+ "requirement-diagram",
110
+ "treemap",
111
+ "ishikawa",
112
+ "block-diagram",
83
113
  "visualization",
84
114
  "theming",
85
115
  "styles",
@@ -95,6 +125,7 @@
95
125
  "assets/fonts/",
96
126
  "assets/hero.png",
97
127
  "docs/*.md",
128
+ "!docs/community-benchmark-ranking.md",
98
129
  "docs/schemas/style-spec.schema.json",
99
130
  "examples/styles/",
100
131
  "skills/",
@@ -111,61 +142,57 @@
111
142
  "!dist/metafile-esm.json"
112
143
  ],
113
144
  "scripts": {
114
- "test": "bun test --coverage --timeout 30000 src/__tests__/",
145
+ "test": "bun test --timeout 30000 src/__tests__/ eval/family-usage/count.test.ts eval/endpoint-marker/architecture-metrics.test.ts",
146
+ "test:coverage": "bun run test -- --coverage",
115
147
  "typecheck": "bun run typecheck:core && bun run typecheck:repo",
116
148
  "typecheck:core": "tsc --noEmit -p tsconfig.json",
117
- "typecheck:repo": "tsc --noEmit -p tsconfig.repo.json",
149
+ "typecheck:repo": "bun eval/trident/prepare.ts && tsc --noEmit -p tsconfig.repo.json",
118
150
  "quality:check": "bun run scripts/ci/quality-gates.ts",
119
- "evidence:check": "bun run scripts/ci/quality-gates.ts --evidence-only",
151
+ "generate": "bun run generate:sdk && bun run generate:browser-families && bun run doc-blocks && bun run agent-doc-artifacts && bun run style-spec-artifacts",
120
152
  "format": "biome format --write .",
121
153
  "format:changed": "biome format --write --changed",
122
154
  "test:browser": "bun run e2e/run-browser-contracts.ts",
123
155
  "editor": "bun run scripts/site/editor.ts",
124
156
  "dev": "bun run website:dev",
125
- "bench": "bun run eval/benchmark/sample-bench.ts",
126
- "benchmark:palette": "bun run eval/palette-performance/run.ts --record",
127
- "benchmark:palette:check": "bun run eval/palette-performance/run.ts --check",
157
+ "bench": "bun eval/benchmark/commands.ts bench",
158
+ "bench:samples": "bun eval/benchmark/commands.ts bench:samples",
159
+ "bench:dave": "bun eval/benchmark/commands.ts bench:dave",
160
+ "bench:micro": "bun eval/benchmark/commands.ts bench:micro",
161
+ "bench:experiments": "bun eval/benchmark/commands.ts bench:experiments",
162
+ "bench:pipeline": "bun eval/benchmark/commands.ts bench:pipeline",
163
+ "bench:peers": "bun eval/benchmark/commands.ts bench:peers",
164
+ "bench:peers:qualify": "bun eval/benchmark/commands.ts bench:peers:qualify",
165
+ "bench:release": "bun eval/benchmark/commands.ts bench:release",
166
+ "bench:release:browser": "bun eval/benchmark/commands.ts bench:release:browser",
128
167
  "harvest:upstream": "bun run eval/mermaid-upstream-suite-bench/harvest.ts",
129
168
  "harvest:upstream:refresh-check": "bun run eval/mermaid-upstream-suite-bench/refresh-check.ts",
130
- "build": "tsup && bun run build:browser && bun run build:browser:lazy",
169
+ "build": "bun run generate:sdk && tsup && bun run build:browser && bun run build:browser:lazy && bun run build:zenuml",
131
170
  "build:browser": "tsup --config tsup.browser.config.ts",
132
- "build:browser:lazy": "bun run scripts/build/clean-browser-lazy.ts && bun run generate:browser-families && tsup --config tsup.browser-lazy.config.ts && bun run check:browser-lazy",
171
+ "build:browser:lazy": "bun run scripts/build/clean-browser-lazy.ts && bun run generate:browser-families && tsup --config tsup.browser-lazy.config.ts",
133
172
  "check:browser-lazy": "bun run scripts/build/browser-lazy-report.ts",
173
+ "generate:sdk": "bun run scripts/build/generate-sdk-declarations.ts",
134
174
  "generate:browser-families": "bun run scripts/build/generate-browser-family-catalog.ts",
135
175
  "check:browser-families": "bun run scripts/build/generate-browser-family-catalog.ts --check",
176
+ "check:output-identity": "bun eval/benchmark/commands.ts check:output-identity",
136
177
  "build:binary": "bun build ./bin/am.ts --compile --outfile dist/am",
137
- "website": "bun run website/build.ts",
178
+ "website": "bun run generate:sdk && bun run website/build.ts",
138
179
  "website:check": "bun run website/build.ts --check",
139
- "website:payload:write": "bun run scripts/site/website-payload-report.ts --write",
140
180
  "website:payload:check": "bun run scripts/site/website-payload-report.ts --check",
141
181
  "website:dev": "cd website && WRANGLER_SEND_METRICS=false ../node_modules/.bin/wrangler dev --local --host 127.0.0.1 --port 9095 --ip 127.0.0.1",
142
182
  "deploy": "gh workflow run deploy-cloudflare.yml --ref main",
143
183
  "prepublishOnly": "npm run build",
144
184
  "goldens:ascii": "bun run scripts/update-ascii-goldens.ts",
145
- "goldens:ascii:check": "bun run scripts/update-ascii-goldens.ts --check",
146
185
  "hero": "bun run scripts/site/hero.ts",
147
186
  "hero:check": "bun run scripts/site/hero.ts --check",
148
- "style:audit": "bun test src/__tests__/style-role-audit.test.ts",
187
+ "style:audit": "bun test --timeout 60000 src/__tests__/style-options.test.ts src/__tests__/styled-output.test.ts",
149
188
  "sketch:check": "bun test scripts/sketch-prototype/styles.test.ts && bun run scripts/sketch-prototype/contrast-audit.ts",
150
- "characterization:check": "bun run scripts/characterization/contact-sheet.ts --check && bun run scripts/characterization/contact-sheet-families.ts --check && bun run scripts/characterization/visual-quality.ts --check",
189
+ "doc-blocks": "bun run scripts/generate-doc-blocks.ts",
151
190
  "agent-doc-artifacts": "bun run scripts/generate-agent-doc-artifacts.ts",
152
- "agent-doc-artifacts:check": "bun run scripts/generate-agent-doc-artifacts.ts --check",
153
- "section-a-report": "bun run scripts/generate-section-a-capability-report.ts",
154
- "section-a-report:check": "bun run scripts/generate-section-a-capability-report.ts --check",
155
- "section-b-report": "bun run scripts/generate-section-b-capability-report.ts",
156
- "section-b-report:check": "bun run scripts/generate-section-b-capability-report.ts --check",
157
- "render-options-docs": "bun run scripts/generate-render-options-docs.ts",
158
- "render-options-docs:check": "bun run scripts/generate-render-options-docs.ts --check",
159
191
  "style-spec-artifacts": "bun run scripts/generate-style-spec-artifacts.ts",
160
- "style-spec-artifacts:check": "bun run scripts/generate-style-spec-artifacts.ts --check",
161
- "upstream-manifest": "bun run scripts/generate-upstream-mermaid-manifest.ts",
162
- "upstream-manifest:check": "bun run scripts/generate-upstream-mermaid-manifest.ts --check",
163
- "mutation-test": "bun run scripts/quality/mutation-profile.ts",
164
- "sabotage:routes": "bun run eval/sabotage/route-regressions.ts",
165
- "test:family-elevation-reverts": "bun run scripts/quality/family-elevation-revert-probes.ts",
166
- "lint": "bun run lint:biome && bun run lint:contracts",
192
+ "upstream-family-index": "bun run scripts/generate-upstream-family-index.ts",
193
+ "lint": "bun run lint:biome",
167
194
  "lint:biome": "biome lint .",
168
- "lint:contracts": "bun test src/__tests__/agent-substrate-lint.test.ts src/__tests__/test-quality-lint.test.ts",
195
+ "lint:package": "publint --strict && attw --pack . --profile esm-only --exclude-entrypoints ./browser",
169
196
  "eval:agent-live": "bun run eval/agent-usage/live.ts",
170
197
  "eval:agent-subagent": "bun run eval/agent-usage/capture-subagent-prompt-eval.ts",
171
198
  "eval:mcp-conformance": "bun run scripts/ci/mcp-conformance.ts",
@@ -176,69 +203,99 @@
176
203
  "eval:skill:bundle-evidence": "bun run scripts/eval/bundle-skill-evidence.ts",
177
204
  "eval:skill:materialize-codex-output": "bun run scripts/eval/materialize-codex-output.ts",
178
205
  "eval:skill:summarize-evidence": "bun run scripts/eval/summarize-skill-evidence.ts",
179
- "eval:skill:sabotage": "bun run scripts/ci/skill-eval-sabotage.ts",
180
206
  "eval:family-portfolio": "bun run eval/mermaid-family-portfolio/build.ts",
181
- "eval:family-portfolio:check": "bun run eval/mermaid-family-portfolio/build.ts --check",
207
+ "eval:mermaid-assertions": "bun run eval/mermaid-upstream-assertions/run.ts",
208
+ "eval:mermaid-modern": "bun run eval/mermaid-modern-compat/run.ts",
209
+ "eval:mermaid-grammar": "bun run eval/mermaid-modern-compat/grammar-run.ts",
210
+ "reference:mermaid": "bash scripts/setup-mermaid-reference.sh",
211
+ "test:mermaid-modern": "bun test --timeout 30000 eval/mermaid-modern-compat/semantic.test.ts eval/mermaid-modern-compat/native-operations.test.ts eval/mermaid-modern-compat/grammar-regressions.test.ts",
182
212
  "eval:degenerate-routes": "bun run eval/degenerate-etn/enumerate.ts",
183
213
  "rubric:visual": "bun run eval/visual-rubric/run.ts",
184
214
  "contact:sheet": "bun run eval/visual-rubric/contact-sheet.ts",
185
- "contact:sheet:test-portfolio": "bun run scripts/pr-assets/test-portfolio-contact-sheet.ts",
186
- "contact:sheet:test-portfolio:review": "bun run scripts/ci/test-portfolio-visual-review.ts",
187
215
  "gallery:custom-styles": "bun run scripts/docs/custom-style-cookbook.ts",
188
- "gallery:custom-styles:check": "bun run scripts/docs/custom-style-cookbook.ts --check",
189
216
  "gallery:linkrank-feedback-packing": "bun run scripts/pr-assets/linkrank-feedback-packing-evidence.ts",
190
- "gallery:linkrank-feedback-packing:check": "bun run scripts/pr-assets/linkrank-feedback-packing-evidence.ts --check",
191
217
  "gallery:mindmap-gitgraph": "bun run scripts/pr-assets/mindmap-gitgraph-content-gallery.ts",
192
- "gallery:mindmap-gitgraph:check": "bun run scripts/pr-assets/mindmap-gitgraph-content-gallery.ts --check",
193
218
  "gallery:mermaid-docs": "bun run scripts/pr-assets/mermaid-doc-showcase-gallery.ts",
194
- "gallery:mermaid-docs:check": "bun run scripts/pr-assets/mermaid-doc-showcase-gallery.ts --check",
195
219
  "gallery:style-switch": "bun run scripts/pr-assets/style-switch-contact-sheet.ts",
196
- "gallery:style-switch:check": "bun run scripts/pr-assets/style-switch-contact-sheet.ts --check",
197
220
  "gallery:pie-highlight": "bun run scripts/pr-assets/pie-highlightslice-evidence.ts",
198
- "gallery:pie-highlight:check": "bun run scripts/pr-assets/pie-highlightslice-evidence.ts --check",
199
- "gallery:palette-rollout:baseline": "bun run scripts/pr-assets/palette-rollout-evidence.ts --record-baseline",
200
- "gallery:palette-rollout": "bun run scripts/pr-assets/palette-rollout-evidence.ts",
201
- "gallery:palette-rollout:check": "bun run scripts/pr-assets/palette-rollout-evidence.ts --check",
202
- "gallery:palette-harmony": "bun run scripts/pr-assets/palette-harmony-experiment.ts",
203
- "gallery:palette-harmony:check": "bun run scripts/pr-assets/palette-harmony-experiment.ts --check",
221
+ "gallery:sankey-comparison": "bun run scripts/pr-assets/sankey-mermaid-comparison.ts",
204
222
  "gallery:section-b": "bun run scripts/pr-assets/section-b-brand-evidence.ts",
205
- "gallery:section-b:check": "bun run scripts/pr-assets/section-b-brand-evidence.ts --check",
206
223
  "track": "bun run eval/heuristic-tracker/run.ts",
207
224
  "audit:ugly": "bun run eval/ugly-detector/audit.ts",
208
- "audit:dependencies": "bun audit --audit-level=high"
225
+ "audit:dependencies": "bun audit --audit-level=high",
226
+ "bench:all": "bun eval/benchmark/commands.ts bench:all",
227
+ "bench:families": "bun eval/benchmark/commands.ts bench:families",
228
+ "bench:invocations": "bun eval/benchmark/commands.ts bench:invocations",
229
+ "bench:community": "bun eval/benchmark/commands.ts bench:community",
230
+ "bench:pinned-mermaid": "bun eval/benchmark/commands.ts bench:pinned-mermaid",
231
+ "bench:prs": "bun eval/benchmark/commands.ts bench:prs",
232
+ "bench:test": "bun eval/benchmark/commands.ts bench:test",
233
+ "bench:typecheck": "bun eval/benchmark/commands.ts bench:typecheck",
234
+ "bench:lint": "bun eval/benchmark/commands.ts bench:lint",
235
+ "bench:community:update": "bun run eval/trident/run.ts community:update",
236
+ "bench:portable": "bun run eval/trident/run.ts portable",
237
+ "bench:portable:build": "bun run eval/trident/run.ts build",
238
+ "bench:performance-profile": "bun eval/benchmark/commands.ts bench:performance-profile",
239
+ "bench:endpoint-marker": "bun eval/benchmark/commands.ts bench:endpoint-marker",
240
+ "bench:modern-summary": "bun eval/benchmark/commands.ts bench:modern-summary",
241
+ "bench:corpus:export": "bun eval/benchmark/commands.ts corpus:export",
242
+ "bench:results": "bun eval/trident/run.ts results:publish",
243
+ "build:zenuml": "tsup --config tsup.zenuml.config.ts"
209
244
  },
210
245
  "dependencies": {
211
246
  "@resvg/resvg-js": "2.6.2",
212
247
  "acorn": "8.16.0",
213
- "elkjs": "^0.11.0",
248
+ "d3-format": "3.1.0",
249
+ "d3-sankey": "0.12.3",
250
+ "elkjs": "0.11.1",
214
251
  "entities": "^7.0.1",
215
252
  "yaml": "^2.8.3"
216
253
  },
217
254
  "overrides": {
218
- "brace-expansion": "5.0.8",
255
+ "@hono/node-server": "1.19.17",
256
+ "body-parser": "2.4.0",
257
+ "brace-expansion": "5.0.9",
258
+ "browserslist": "4.28.9",
259
+ "dompurify": "3.4.17",
219
260
  "esbuild": "0.28.1",
220
- "fast-uri": "3.1.4",
261
+ "fast-uri": "3.1.8",
262
+ "ip-address": "10.7.1",
263
+ "hono": "4.13.13",
264
+ "katex": "0.18.2",
221
265
  "lodash-es": "4.18.1",
222
266
  "picomatch": "4.0.5",
223
- "qs": "6.15.3"
267
+ "qs": "6.16.1",
268
+ "proxy-addr": "2.0.8",
269
+ "sharp": "0.35.5",
270
+ "undici": "7.30.1",
271
+ "zod": "4.6.6"
224
272
  },
225
273
  "devDependencies": {
274
+ "@arethetypeswrong/cli": "0.18.5",
226
275
  "@biomejs/biome": "2.5.5",
227
- "@modelcontextprotocol/sdk": "1.29.0",
276
+ "@mermaid-js/mermaid-zenuml": "1.0.1",
277
+ "@modelcontextprotocol/sdk": "1.32.1",
228
278
  "@resvg/resvg-wasm": "2.6.2",
229
- "@stryker-mutator/core": "^9.6.1",
279
+ "@swc/core": "1.15.8",
230
280
  "@types/bun": "^1.3.9",
281
+ "@types/d3-format": "3.0.4",
282
+ "@types/d3-sankey": "^0.12.5",
283
+ "@zenuml/core": "3.47.9",
231
284
  "beautiful-mermaid": "1.1.3",
232
285
  "fast-check": "^4.6.0",
233
- "mermaid": "11.16.0",
286
+ "jsdom": "26.1.0",
287
+ "mermaid": "12.2.0",
234
288
  "mermaid-ast": "0.8.2",
235
- "playwright": "^1.58.2",
236
289
  "perfect-freehand": "1.2.3",
290
+ "playwright": "^1.58.2",
291
+ "publint": "0.3.24",
237
292
  "roughjs": "4.6.6",
293
+ "saxes": "6.0.0",
238
294
  "shiki": "^3.19.0",
239
295
  "tsup": "^8.5.1",
240
296
  "typescript": "^5.9.3",
241
297
  "upng-js": "^2.1.0",
242
- "wrangler": "4.114.0"
298
+ "vitest": "4.1.11",
299
+ "wrangler": "4.149.0"
243
300
  }
244
301
  }
package/server.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "url": "https://github.com/adewale/agentic-mermaid",
8
8
  "source": "github"
9
9
  },
10
- "version": "0.4.1",
10
+ "version": "0.5.3",
11
11
  "websiteUrl": "https://agentic-mermaid.dev/",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "agentic-mermaid",
16
- "version": "0.4.1",
16
+ "version": "0.5.3",
17
17
  "runtimeHint": "npx",
18
18
  "runtimeArguments": [
19
19
  {
@@ -12,7 +12,7 @@ An agent-agnostic typed editing surface for Mermaid. New diagrams can be authore
12
12
  - `agentic-mermaid-mcp` connected → **Code Mode** (`references/code-mode.md`). Multi-step edits in one round-trip.
13
13
  - Can run JS/TS with imports → **library** (`agentic-mermaid/agent`). Same SDK.
14
14
  - Shell only → **CLI** (`references/cli.md`).
15
- - No local install, network only → **hosted MCP** at `https://agentic-mermaid.dev/mcp` (stateless Streamable HTTP JSON-RPC; `execute`, `describe_sdk`, `render_svg`, `render_ascii`, `render_png`, `verify`, `describe`, `mutate`, and `build` tools — 64 KB input cap). Read `references/hosted-mcp.md` before composing a hosted request. Use the named direct tool and its exact argument object; do not substitute library APIs or local Code Mode for a hosted direct-tool task.
15
+ - No local install, network only → **hosted MCP** at `https://agentic-mermaid.dev/mcp` (stateless Streamable HTTP JSON-RPC; <!-- BEGIN GENERATED: hosted-mcp-tools -->`execute`, `describe_sdk`, `render_svg`, `render_ascii`, `render_png`, `verify`, `describe`, `mutate`, and `build`<!-- END GENERATED: hosted-mcp-tools --> tools — 64 KB input cap). Read `references/hosted-mcp.md` before composing a hosted request. Use the named direct tool and its exact argument object; do not substitute library APIs or local Code Mode for a hosted direct-tool task.
16
16
 
17
17
  For hosted MCP, choose the least-powerful tool that completes the task:
18
18
 
@@ -51,10 +51,9 @@ fenced block and recheck every op `kind` and field against this skill or
51
51
 
52
52
  Run `am capabilities --json` (or call the equivalent SDK capability API) before
53
53
  choosing a family or mutation. Its registry-derived family entries expose the
54
- current narrower, operation schema, edit policy, output support, and minimal
55
- source example; the generated Section A matrix supplies explicit native,
56
- source-preserved, diagnosed, and absent states. This skill intentionally does
57
- not maintain a second family or operation table.
54
+ current narrower, operation schema, edit policy, output support, per-family
55
+ conformance, and minimal source example. This skill intentionally does not
56
+ maintain a second family or operation table.
58
57
 
59
58
  On hosted MCP, inspect the connected server's `tools/list` for its tool surface
60
59
  and call `describe_sdk({ family, detail: 'fields' })` for mutation fields. There
@@ -68,9 +67,20 @@ Gantt diagrams are segment-preserving: `asGantt` keeps title/section/task ops li
68
67
 
69
68
  `references/upstream/` documents Mermaid syntax for many more families than this renderer accepts; it is authoring reference only. `am capabilities --json` is the authoritative list of renderable families.
70
69
 
70
+ ## Choosing a family
71
+
72
+ Choose the family from the reader's task; the family is the result of that decision, not the starting point. The full task router, with per-family anti-patterns and the verify codes that check each choice, is `docs/choosing-a-diagram.md`. The routes agents most often miss:
73
+
74
+ - Steps and decisions toward an outcome: flowchart. A system moving between modes in response to events: state.
75
+ - Ordered messages between actors: sequence. A flowchart arrow reads as causality, not time.
76
+ - Dated work with durations and dependencies: gantt. Undated eras: timeline. One person's scored experience of a process: journey.
77
+ - Quantities that must balance across stages: sankey. Parts of one whole at one moment: pie. Measured series across categories or time: xychart.
78
+
79
+ Renderability and edit policy still come from `am capabilities --json`, not from this routing.
80
+
71
81
  ## Workflow
72
82
 
73
- For new diagrams, author Mermaid source directly, then `parseRegisteredMermaid` / `verifyMermaid` / render. For existing modeled diagrams:
83
+ <!-- BEGIN GENERATED: new-diagram-policy -->New diagrams: author Mermaid source directly, then parse → verify → render or return it. `buildMermaid(kind, ops)` / `createMermaid(kind)` build a diagram from typed ops when you are generating one programmatically (for example, from data).<!-- END GENERATED: new-diagram-policy --> For existing modeled diagrams:
74
84
 
75
85
  1. `parseRegisteredMermaid(source)` → `ValidDiagram`.
76
86
  2. Use the family entry's advertised narrower (for example `asFlowchart(d)` or
@@ -136,12 +146,20 @@ Output artifact pattern:
136
146
  const verify = verifyMermaid(cur)
137
147
  if (!verify.ok) return { phase: 'verify', warnings: verify.warnings }
138
148
  const svg = renderMermaidSVG(cur, { security: 'strict' })
139
- const png = renderMermaidPNG(cur, { fitTo: { width: 1200 }, background: '#fff' })
149
+ const png = renderMermaidPNG(cur, {
150
+ fitTo: { width: 1200 },
151
+ background: '#fff',
152
+ minLabelPx: 9,
153
+ onWarning: warning => console.warn(warning.code, warning.message),
154
+ })
140
155
  const ascii = renderMermaidASCII(cur, { useAscii: true })
141
156
  const unicode = renderMermaidASCII(cur, { useAscii: false })
142
157
  const layout = verify.layout
143
158
  ```
144
159
 
145
- CLI PNG: `am render diagram.mmd --format png --output diagram.png`.
160
+ CLI PNG: `am render diagram.mmd --format png --output diagram.png
161
+ --min-label-px 9`. `BELOW_READABLE_SIZE` is a bounded shrinkage warning, not
162
+ proof of readability; choose a task-specific floor when viewing conditions are
163
+ known, or pass `0` to disable it.
146
164
 
147
165
  See `references/flowchart.md`, `references/sequence.md`, `references/timeline.md`, `references/upstream/gantt.md`, and the repository cookbook at `docs/agent-api-cookbook.md`.
@@ -2,9 +2,10 @@
2
2
 
3
3
  Agentic Mermaid outputs SVG, PNG, ASCII, Unicode, and JSON layout through the CLI.
4
4
 
5
+ <!-- complete: cli-verbs -->
5
6
  ```text
6
7
  am render <file|-> --format svg|ascii|unicode|layout
7
- am render <file> --format png --output file.png # one-shot only; no watch/multi-input
8
+ am render <file> --format png --output file.png [--fit-width PX|--fit-height PX] [--min-label-px PX]
8
9
  am preview <file|-> [--output preview.html] [--open] [--json] [--security strict] # strict standalone HTML
9
10
  am verify <file|-> structured JSON warnings (exit 3 if not ok)
10
11
  am parse <file|-> ValidDiagram JSON
@@ -14,6 +15,7 @@ am mutate <file|-> --ops JSON|file many MutationOps → verify → new source
14
15
  am format <file|-> idempotent reformat
15
16
  am describe <file|-> prose summary, --format json AX tree, or --format facts semantic facts
16
17
  am capabilities --json families, editPolicy, mutationOps, warning codes, formats
18
+ am styles [--json] registered styles, looks, and palette-only themes
17
19
  am batch --jsonl JSONL stdin → JSONL envelopes (render/verify/parse/serialize/mutate)
18
20
  am render-markdown <file.md> [--ascii] render fenced Mermaid blocks
19
21
  am llms-txt agent discovery digest
@@ -25,7 +27,10 @@ am <cmd> --help per-command help
25
27
  `am verify` always emits JSON. `am mutate` dispatches across the live mutable
26
28
  family roster reported by `am capabilities --json`; opaque fallback bodies
27
29
  return a structured `UNSUPPORTED_FAMILY` error. `am mutate` verifies before emitting source; verify
28
- failure exits 3 and omits `source`. Use direct Mermaid source authoring plus
30
+ failure exits 3 and omits `source`. A verify whose errors are all `INTERNAL_ERROR`
31
+ (an Agentic Mermaid defect, not the diagram) exits 4 instead; report it with the source.
32
+ An edit is still emitted when its only errors are `INTERNAL_ERROR` defects the input
33
+ already had (same reason and `defaultRender`). Use direct Mermaid source authoring plus
29
34
  `am verify`/`am render` for brand-new diagrams; reserve `am mutate` for
30
35
  existing structured diagrams. `am parse | am serialize` round-trips through JSON.
31
36
 
@@ -40,4 +45,9 @@ am mutate flow.mmd --op '{"kind":"rename_node","from":"X","to":"Y"}'
40
45
  am mutate seq.mmd --op '{"kind":"add_message","from":"A","to":"B","text":"Hi"}'
41
46
  ```
42
47
 
43
- Exit codes: 0 ok, 2 arg/parse/mutation error, 3 verify failed, 4 internal.
48
+ Exit codes: 0 ok, 2 arg/parse/mutation error, 3 verify failed, 4 internal (including a verify whose errors are all `INTERNAL_ERROR`).
49
+
50
+ PNG emits `BELOW_READABLE_SIZE` when the smallest measurable configured text
51
+ lands below `--min-label-px` after final raster sizing. The provisional default
52
+ is 9px; pass `0` to disable it. Treat the warning as evidence of one bounded
53
+ shrinkage condition, not proof that the whole image is or is not readable.
@@ -1,5 +1,6 @@
1
1
  # Code Mode (structured edit channel)
2
2
 
3
+ <!-- complete: local-mcp-tools -->
3
4
  `agentic-mermaid-mcp` exposes a primary Code Mode tool, `execute(code)`, plus
4
5
  narrow `describe_sdk`, `render_png`, and `describe` helpers. The initial
5
6
  `execute` declaration contains only the core SDK. Call
@@ -29,7 +30,7 @@ mermaid.renderMermaidASCII(input, { useAscii?: boolean, ganttToday?: string, mer
29
30
  mermaid.renderMermaidSVG(input, { security?: 'default'|'strict', idPrefix?, ganttToday?: string, mermaidConfig?: MermaidRuntimeConfig }): string
30
31
  ```
31
32
 
32
- Agentic Mermaid outputs SVG, PNG, ASCII, Unicode, and JSON layout. In Code Mode, render SVG and text through `mermaid.*`: `renderMermaidASCII(input, { useAscii: true })` returns ASCII and `useAscii: false` returns Unicode box-drawing text. Use the narrow MCP `render_png` helper or host/library code for PNG binary output; JSON layout is available on `verifyMermaid(...).layout` and through the CLI/library layout APIs. `MermaidRuntimeConfig` matches the runtime config surface: arbitrary Mermaid config keys plus `theme`, `fontFamily`, `themeVariables`, `timeline`, `xyChart`, `gantt`, `mindmap`, `gitGraph`, `useMaxWidth`, `useWidth`, and `themeCSS`. `ganttToday` is a render option, not a clock read; pass it when a Gantt `todayMarker` should render.
33
+ Agentic Mermaid outputs SVG, PNG, ASCII, Unicode, and JSON layout. In Code Mode, render SVG and text through `mermaid.*`: `renderMermaidASCII(input, { useAscii: true })` returns ASCII and `useAscii: false` returns Unicode box-drawing text. Use the narrow MCP `render_png` helper or host/library code for PNG binary output; JSON layout is available on `verifyMermaid(...).layout` and through the CLI/library layout APIs. `MermaidRuntimeConfig` matches the runtime config surface: arbitrary Mermaid config keys plus `theme`, `fontFamily`, `themeVariables`, `timeline`, `xyChart`, `gantt`, `mindmap`, `gitGraph`, `useMaxWidth`, and `useWidth`, plus the other per-family sections the SDK declaration lists. Raw `themeCSS` is rejected by the public renderers in default security mode; style with `style` (a Look, Palette, inline spec, or stack) instead. `ganttToday` is a render option, not a clock read; pass it when a Gantt `todayMarker` should render.
33
34
 
34
35
  All SDK methods are synchronous and pure. Code Mode does not support `async`/`await`, Promise jobs, or dynamic import. Layout is deterministic; there is no layout seed (the render option `seed` only re-rolls ink of styled looks — `style: name | record | stack` — and never moves geometry).
35
36
 
@@ -8,10 +8,13 @@ Shapes: `[rect]` `(round)` `([stadium])` `[[subroutine]]` `[(cylinder)]`
8
8
 
9
9
  Edges: `-->` `---` `-.->` `==>` `--o` `--x` `<-->` `-->|label|`.
10
10
 
11
- MutationOps (6): add_node, remove_node, rename_node, set_label, add_edge,
12
- remove_edge. remove_node cascades to incident edges; add_edge implicit-declares
13
- missing endpoints.
11
+ MutationOps: the live list and field shapes come from `am capabilities --json`
12
+ (`families[].mutationOps` / `opFields`) or `describeOps('flowchart')` — node,
13
+ edge, shape, direction, subgraph, and class/style ops. remove_node cascades to
14
+ incident edges; add_edge implicit-declares missing endpoints.
14
15
 
15
- Verify Tier 1: EMPTY_DIAGRAM, EDGE_MISANCHORED, OFF_CANVAS, GROUP_BREACH,
16
- UNKNOWN_SHAPE, LABEL_OVERFLOW (char-cap, default 40).
17
- Tier 2: NODE_OVERLAP, ROUTE_SELF_CROSS, ROUTE_HITCH, ROUTE_UNEXPLAINED_BEND, ROUTE_LABEL_ON_SHARED_TRUNK, ROUTE_CONTAINER_MISANCHOR, ROUTE_SHAPE_MISANCHOR, ROUTE_STALE_AFTER_NODE_MOVE.
16
+ Verify: every Tier 1 code except the Gantt-only UNRESOLVABLE_SCHEDULE can fire
17
+ on a flowchart (LABEL_OVERFLOW caps a label line at 40 characters by default),
18
+ and so can every Tier 2 geometric code. `am capabilities --json` lists the codes
19
+ by tier (`warningCodes`); each code's page under
20
+ https://agentic-mermaid.dev/warnings/ says what triggers it and how to clear it.
@@ -44,6 +44,7 @@ synonym is still an invalid call.
44
44
 
45
45
  ## Direct tools
46
46
 
47
+ <!-- complete: hosted-mcp-tools -->
47
48
  - `verify({ source })` returns structural `ok`, detected `family`, `summary`,
48
49
  `warnings`, and layout counts. Confirm the family as well as `ok`.
49
50
  - `describe({ source, format })` uses `text` for prose, `json` for an AX tree,
@@ -26,8 +26,9 @@ participant and top-level message ops remain live. Only an un-segmentable
26
26
  diagram (a stray `end`, an unclosed block) falls back to a whole-body OPAQUE
27
27
  body. Either way the parser never silently drops constructs.
28
28
 
29
- Verify Tier 1 only (no layout engine): EMPTY_DIAGRAM, EDGE_MISANCHORED
30
- (message references missing participant), LABEL_OVERFLOW (participant label or
31
- message text over char cap).
29
+ Verify: Tier 1 EMPTY_DIAGRAM, EDGE_MISANCHORED (message references missing
30
+ participant), LABEL_OVERFLOW (participant label or message text over char cap);
31
+ layout-geometry checks on the sequence layout (OFF_CANVAS, GROUP_BREACH,
32
+ NODE_OVERLAP); and UNSUPPORTED_SYNTAX naming verbatim segments.
32
33
 
33
34
  Upstream: https://mermaid.js.org/syntax/sequenceDiagram.html
@@ -14,16 +14,17 @@ Lines: `title <text>`, `section <label>`, `<period-label> : <event>`
14
14
  (multi-event via `: <event2> : <event3>`), and continuation `: <event>`
15
15
  that adds an event to the previous period.
16
16
 
17
- MutationOps (10): set_title (pass `null` to clear), add_section,
18
- remove_section, set_section_label, add_period, remove_period,
19
- set_period_label, add_event, remove_event, set_event_text.
17
+ MutationOps: the live list and field shapes come from `am capabilities --json`
18
+ or `describeOps('timeline')` — title, section, period, and event add/remove/
19
+ relabel ops, move ops (order is the chronology), and accessibility title/
20
+ description. `set_title` takes `null` to clear.
20
21
 
21
22
  Sections/periods/events are referenced by integer index. Indices shift
22
23
  after a remove — re-parse if you batch deletes.
23
24
 
24
- Fidelity fallback: a timeline with unmodeled syntax (anything beyond
25
- title/section/period/event/continuation) falls back to opaque body
26
- (`asTimeline` returns null). Round-trips losslessly via preserved `body.source`.
25
+ Fidelity fallback: a timeline with syntax the parser does not model falls back
26
+ to an opaque body (`asTimeline` returns null; `accTitle`/`accDescr` are
27
+ modeled). Round-trips losslessly via preserved `body.source`.
27
28
 
28
29
  Verify Tier 1: EMPTY_DIAGRAM (no title + no periods), LABEL_OVERFLOW on
29
30
  title / section / period / event over the char cap.