agentic-mermaid 0.1.0 → 0.1.2

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 (333) hide show
  1. package/CHANGELOG.md +149 -4
  2. package/LICENSES/Apache-2.0.txt +202 -0
  3. package/README.md +25 -32
  4. package/THIRD_PARTY_NOTICES.md +29 -0
  5. package/assets/fonts/FONT-LICENSES.md +9 -5
  6. package/assets/fonts/Inter-Bold.ttf +0 -0
  7. package/assets/fonts/Inter-Medium.ttf +0 -0
  8. package/assets/fonts/Inter-Regular.ttf +0 -0
  9. package/assets/fonts/Inter-SemiBold.ttf +0 -0
  10. package/dist/agent-core.d.ts +463 -0
  11. package/dist/agent-core.js +397 -0
  12. package/dist/agent.d.ts +81 -1822
  13. package/dist/agent.js +336 -36839
  14. package/dist/agentic-mermaid-mcp.js +7 -37908
  15. package/dist/am.js +33638 -36261
  16. package/dist/chunk-4QECACIA.js +4702 -0
  17. package/dist/chunk-CDPKJ2BQ.js +37 -0
  18. package/dist/chunk-QKDLMOJJ.js +3487 -0
  19. package/dist/chunk-WI35L7IR.js +615 -0
  20. package/dist/chunk-WN3YDOBG.js +149 -0
  21. package/dist/chunk-ZYMMKQ3I.js +62637 -0
  22. package/dist/index-D54dqSdC.d.ts +6777 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +310 -32836
  25. package/dist/mcp-cli-SBQSTJFC.js +17 -0
  26. package/docs/README.md +14 -6
  27. package/docs/schemas/style-spec.schema.json +1221 -30
  28. package/examples/styles/catalog.json +54 -0
  29. package/examples/styles/cloudflare-workers-inspired-prototype.mmd +9 -0
  30. package/examples/styles/cloudflare-workers-inspired-prototype.style.json +110 -0
  31. package/examples/styles/cupertino-prototype.mmd +10 -0
  32. package/examples/styles/cupertino-prototype.style.json +63 -0
  33. package/examples/styles/mid-century-report.style.json +2 -2
  34. package/examples/styles/star-chart-atlas.style.json +2 -1
  35. package/examples/styles/transit-route-map.style.json +2 -2
  36. package/examples/styles/vercel-inspired-prototype.mmd +6 -0
  37. package/examples/styles/vercel-inspired-prototype.style.json +87 -0
  38. package/package.json +70 -43
  39. package/server.json +41 -0
  40. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +17 -36
  41. package/skills/agentic-mermaid-diagram-workflow/references/cli.md +4 -5
  42. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +15 -31
  43. package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +10 -14
  44. package/skills/agentic-mermaid-live-editor/SKILL.md +100 -206
  45. package/AGENT_NATIVE.md +0 -602
  46. package/Instructions_for_agents.md +0 -83
  47. package/TODO.md +0 -662
  48. package/assets/hero.png +0 -0
  49. package/dist/index-x2Cj1dVv.d.ts +0 -1089
  50. package/docs/agent-api-cookbook.md +0 -308
  51. package/docs/agent-mutation-policy.md +0 -104
  52. package/docs/agent-workflow-examples.md +0 -46
  53. package/docs/api.md +0 -203
  54. package/docs/ascii.md +0 -103
  55. package/docs/assets/improvements/box-start-connector.png +0 -0
  56. package/docs/assets/improvements/comment-dropped-lint.png +0 -0
  57. package/docs/assets/improvements/er-content-loss.png +0 -0
  58. package/docs/assets/improvements/fan-in-trunks.png +0 -0
  59. package/docs/assets/improvements/gantt-family.png +0 -0
  60. package/docs/assets/improvements/gantt-milestone-clamp.png +0 -0
  61. package/docs/assets/improvements/gantt-verify-seam.png +0 -0
  62. package/docs/assets/improvements/subgraph-container-edges.png +0 -0
  63. package/docs/assets/improvements/wrapper-frontmatter.png +0 -0
  64. package/docs/assets/improvements/wrapper-init-directive.png +0 -0
  65. package/docs/assets/improvements/wrapper-leading-comment.png +0 -0
  66. package/docs/assets/style-cookbook/mid-century-report.png +0 -0
  67. package/docs/assets/style-cookbook/star-chart-atlas.png +0 -0
  68. package/docs/assets/style-cookbook/transit-route-map.png +0 -0
  69. package/docs/comparison.md +0 -94
  70. package/docs/config.md +0 -105
  71. package/docs/contributing/adding-diagram-types.md +0 -144
  72. package/docs/contributing/diagram-family-citizenship.matrix.json +0 -2127
  73. package/docs/contributing/diagram-family-citizenship.md +0 -82
  74. package/docs/contributing/harvesting-upstream-tests.md +0 -126
  75. package/docs/contributing/lessons-learned.md +0 -276
  76. package/docs/contributing/releasing.md +0 -71
  77. package/docs/contributing/visual-review-evidence.md +0 -53
  78. package/docs/custom-style-cookbook.md +0 -154
  79. package/docs/design/families/README.md +0 -26
  80. package/docs/design/families/architecture-beta.md +0 -48
  81. package/docs/design/families/flowchart-parser-conformance.md +0 -22
  82. package/docs/design/families/gantt-research.md +0 -137
  83. package/docs/design/families/gantt.md +0 -329
  84. package/docs/design/families/journey-agentic-cards-before.png +0 -0
  85. package/docs/design/families/journey-mermaid-classic-implementation.png +0 -0
  86. package/docs/design/families/journey-mermaid-classic-prototype.png +0 -0
  87. package/docs/design/families/journey-mermaid-classic-prototype.svg +0 -163
  88. package/docs/design/families/journey-mermaid-classic-prototype.svg.png +0 -0
  89. package/docs/design/families/journey-migration-parity.md +0 -433
  90. package/docs/design/families/journey-usage-research.md +0 -423
  91. package/docs/design/families/journey.md +0 -125
  92. package/docs/design/families/xychart.md +0 -85
  93. package/docs/design/system/README.md +0 -45
  94. package/docs/design/system/abstraction-audit.md +0 -224
  95. package/docs/design/system/abstraction-recommendations.md +0 -655
  96. package/docs/design/system/architecture.mmd +0 -29
  97. package/docs/design/system/architecture.svg +0 -137
  98. package/docs/design/system/layout-guarantees-and-robustness.md +0 -351
  99. package/docs/design/system/layout-rubric.md +0 -138
  100. package/docs/design/system/route-contracts.md +0 -848
  101. package/docs/design/system/source-preservation-ladder.md +0 -52
  102. package/docs/design/system/styles-rollout.md +0 -216
  103. package/docs/design/system/ugly-layouts.md +0 -119
  104. package/docs/diagram-families.md +0 -193
  105. package/docs/features.md +0 -147
  106. package/docs/fork-differences.md +0 -130
  107. package/docs/getting-started.md +0 -175
  108. package/docs/issue-derived-test-cases.md +0 -156
  109. package/docs/layout-characterization/README.md +0 -245
  110. package/docs/layout-characterization/contact-sheet-families.md +0 -496
  111. package/docs/layout-characterization/contact-sheet.md +0 -638
  112. package/docs/layout-characterization/properties.md +0 -281
  113. package/docs/layout-characterization/visual-quality.md +0 -160
  114. package/docs/layout-characterization/visual-snapshots/architecture.svg +0 -79
  115. package/docs/layout-characterization/visual-snapshots/class.svg +0 -60
  116. package/docs/layout-characterization/visual-snapshots/er.svg +0 -61
  117. package/docs/layout-characterization/visual-snapshots/flowchart.svg +0 -58
  118. package/docs/layout-characterization/visual-snapshots/gantt.svg +0 -52
  119. package/docs/layout-characterization/visual-snapshots/journey.svg +0 -118
  120. package/docs/layout-characterization/visual-snapshots/pie.svg +0 -36
  121. package/docs/layout-characterization/visual-snapshots/quadrant.svg +0 -47
  122. package/docs/layout-characterization/visual-snapshots/sequence.svg +0 -59
  123. package/docs/layout-characterization/visual-snapshots/state.svg +0 -52
  124. package/docs/layout-characterization/visual-snapshots/timeline.svg +0 -64
  125. package/docs/layout-characterization/visual-snapshots/xychart.svg +0 -97
  126. package/docs/mcp-code-mode-rationale.md +0 -101
  127. package/docs/mcp-http-transport.md +0 -223
  128. package/docs/mermaid-layout-complaints.md +0 -837
  129. package/docs/mutation-testing.md +0 -206
  130. package/docs/project/divergences.md +0 -98
  131. package/docs/project/dogfooding-docs-strategy.md +0 -66
  132. package/docs/project/hosted-mcp-cloudflare-plan.md +0 -338
  133. package/docs/project/lessons-learned.md +0 -1019
  134. package/docs/project/remove-role-styling-plan.md +0 -176
  135. package/docs/quality.md +0 -212
  136. package/docs/react.md +0 -97
  137. package/docs/style-authoring.md +0 -133
  138. package/docs/testing-strategy.md +0 -335
  139. package/docs/theming.md +0 -162
  140. package/examples/agent-improve-auth-flow.ts +0 -206
  141. package/examples/agent-loop.ts +0 -53
  142. package/examples/mcp-vs-cli-complex-diagrams.ts +0 -133
  143. package/llms.txt +0 -104
  144. package/skill-evals/README.md +0 -77
  145. package/skill-evals/fixtures/architecture-cache/input.mmd +0 -5
  146. package/skill-evals/fixtures/class-payment/input.mmd +0 -4
  147. package/skill-evals/fixtures/er-orders/input.mmd +0 -10
  148. package/skill-evals/fixtures/flowchart-cache/input.mmd +0 -3
  149. package/skill-evals/fixtures/gantt-release/input.mmd +0 -7
  150. package/skill-evals/fixtures/journey-checkout/input.mmd +0 -6
  151. package/skill-evals/fixtures/pie-exports/input.mmd +0 -5
  152. package/skill-evals/fixtures/quadrant-priorities/input.mmd +0 -11
  153. package/skill-evals/fixtures/sequence-retry/input.mmd +0 -8
  154. package/skill-evals/fixtures/state-lifecycle/input.mmd +0 -5
  155. package/skill-evals/fixtures/timeline-release/input.mmd +0 -6
  156. package/skill-evals/fixtures/xychart-growth/input.mmd +0 -5
  157. package/skill-evals/shared-benchmark.json +0 -510
  158. package/src/agent/analyze.ts +0 -157
  159. package/src/agent/apply.ts +0 -146
  160. package/src/agent/architecture-body.ts +0 -458
  161. package/src/agent/certificates.ts +0 -110
  162. package/src/agent/class-body.ts +0 -319
  163. package/src/agent/core.ts +0 -207
  164. package/src/agent/create.ts +0 -106
  165. package/src/agent/describe.ts +0 -364
  166. package/src/agent/er-body.ts +0 -224
  167. package/src/agent/facts.ts +0 -337
  168. package/src/agent/families-builtin.ts +0 -934
  169. package/src/agent/families.ts +0 -232
  170. package/src/agent/family-layouts.ts +0 -826
  171. package/src/agent/flowchart-body.ts +0 -372
  172. package/src/agent/flowchart-unsupported.ts +0 -243
  173. package/src/agent/gantt-body.ts +0 -495
  174. package/src/agent/index.ts +0 -10
  175. package/src/agent/journey-body.ts +0 -414
  176. package/src/agent/label-metrics.ts +0 -28
  177. package/src/agent/layout-to-rendered.ts +0 -63
  178. package/src/agent/mutate.ts +0 -97
  179. package/src/agent/mutation-ops.ts +0 -51
  180. package/src/agent/op-schema.ts +0 -439
  181. package/src/agent/parse.ts +0 -223
  182. package/src/agent/pie-body.ts +0 -270
  183. package/src/agent/png.ts +0 -117
  184. package/src/agent/quadrant-body.ts +0 -336
  185. package/src/agent/quality.ts +0 -363
  186. package/src/agent/readability-audit.ts +0 -92
  187. package/src/agent/rendered-route-audit.ts +0 -61
  188. package/src/agent/sequence-body.ts +0 -345
  189. package/src/agent/serialize.ts +0 -214
  190. package/src/agent/state-body.ts +0 -589
  191. package/src/agent/structural-count.ts +0 -150
  192. package/src/agent/timeline-body.ts +0 -280
  193. package/src/agent/trace-log.ts +0 -43
  194. package/src/agent/types.ts +0 -979
  195. package/src/agent/verify.ts +0 -571
  196. package/src/agent/xychart-body.ts +0 -472
  197. package/src/architecture/config.ts +0 -282
  198. package/src/architecture/layout.ts +0 -496
  199. package/src/architecture/parser.ts +0 -375
  200. package/src/architecture/renderer.ts +0 -611
  201. package/src/architecture/types.ts +0 -113
  202. package/src/ascii/ansi.ts +0 -423
  203. package/src/ascii/architecture.ts +0 -210
  204. package/src/ascii/canvas.ts +0 -443
  205. package/src/ascii/class-diagram.ts +0 -697
  206. package/src/ascii/converter.ts +0 -475
  207. package/src/ascii/draw.ts +0 -1693
  208. package/src/ascii/edge-bundling.ts +0 -328
  209. package/src/ascii/edge-routing.ts +0 -330
  210. package/src/ascii/er-diagram.ts +0 -439
  211. package/src/ascii/gantt.ts +0 -276
  212. package/src/ascii/grid.ts +0 -747
  213. package/src/ascii/index.ts +0 -196
  214. package/src/ascii/journey.ts +0 -189
  215. package/src/ascii/meta.ts +0 -244
  216. package/src/ascii/multiline-utils.ts +0 -80
  217. package/src/ascii/pathfinder.ts +0 -301
  218. package/src/ascii/pie.ts +0 -67
  219. package/src/ascii/quadrant.ts +0 -158
  220. package/src/ascii/reverse.ts +0 -216
  221. package/src/ascii/sequence.ts +0 -499
  222. package/src/ascii/shapes/circle.ts +0 -27
  223. package/src/ascii/shapes/corners.ts +0 -143
  224. package/src/ascii/shapes/diamond.ts +0 -27
  225. package/src/ascii/shapes/hexagon.ts +0 -27
  226. package/src/ascii/shapes/index.ts +0 -106
  227. package/src/ascii/shapes/rectangle.ts +0 -168
  228. package/src/ascii/shapes/rounded.ts +0 -27
  229. package/src/ascii/shapes/special.ts +0 -332
  230. package/src/ascii/shapes/stadium.ts +0 -110
  231. package/src/ascii/shapes/state.ts +0 -192
  232. package/src/ascii/shapes/types.ts +0 -73
  233. package/src/ascii/timeline.ts +0 -128
  234. package/src/ascii/types.ts +0 -312
  235. package/src/ascii/validate.ts +0 -120
  236. package/src/ascii/width.ts +0 -81
  237. package/src/ascii/xychart.ts +0 -919
  238. package/src/browser.ts +0 -29
  239. package/src/class/layout.ts +0 -240
  240. package/src/class/parser.ts +0 -332
  241. package/src/class/renderer.ts +0 -638
  242. package/src/class/types.ts +0 -129
  243. package/src/cli/agent-instructions.ts +0 -1
  244. package/src/cli/am-bin.ts +0 -6
  245. package/src/cli/exit-codes.ts +0 -18
  246. package/src/cli/index.ts +0 -1117
  247. package/src/cli/init-agent.ts +0 -147
  248. package/src/color-resolver.ts +0 -152
  249. package/src/elk-instance.ts +0 -114
  250. package/src/er/layout.ts +0 -187
  251. package/src/er/parser.ts +0 -226
  252. package/src/er/renderer.ts +0 -792
  253. package/src/er/types.ts +0 -99
  254. package/src/font-manifest.ts +0 -27
  255. package/src/gantt/layout.ts +0 -365
  256. package/src/gantt/parser.ts +0 -282
  257. package/src/gantt/pipeline.ts +0 -27
  258. package/src/gantt/renderer.ts +0 -414
  259. package/src/gantt/schedule.ts +0 -513
  260. package/src/gantt/types.ts +0 -255
  261. package/src/index.ts +0 -368
  262. package/src/journey/layout.ts +0 -520
  263. package/src/journey/parser.ts +0 -218
  264. package/src/journey/renderer.ts +0 -811
  265. package/src/journey/types.ts +0 -144
  266. package/src/layout/geometry.ts +0 -182
  267. package/src/layout/pass.ts +0 -142
  268. package/src/layout/passes/index.ts +0 -3916
  269. package/src/layout-engine.ts +0 -1565
  270. package/src/layout-rubric.ts +0 -659
  271. package/src/mcp/artifacts.ts +0 -137
  272. package/src/mcp/dynamic-harness.ts +0 -31
  273. package/src/mcp/dynamic-modules.d.ts +0 -7
  274. package/src/mcp/facade.ts +0 -608
  275. package/src/mcp/harness-runtime.ts +0 -203
  276. package/src/mcp/hosted-server.ts +0 -468
  277. package/src/mcp/mcp-bin.ts +0 -3
  278. package/src/mcp/mcp-cli.ts +0 -82
  279. package/src/mcp/protocol.ts +0 -13
  280. package/src/mcp/sandbox.ts +0 -195
  281. package/src/mcp/sdk-decl.ts +0 -387
  282. package/src/mcp/server.ts +0 -362
  283. package/src/mcp/tool-surface.ts +0 -146
  284. package/src/mermaid-source.ts +0 -655
  285. package/src/multiline-utils.ts +0 -228
  286. package/src/parser.ts +0 -1031
  287. package/src/pie/layout.ts +0 -168
  288. package/src/pie/parser.ts +0 -136
  289. package/src/pie/renderer.ts +0 -234
  290. package/src/pie/types.ts +0 -82
  291. package/src/quadrant/layout.ts +0 -191
  292. package/src/quadrant/parser.ts +0 -183
  293. package/src/quadrant/renderer.ts +0 -322
  294. package/src/quadrant/types.ts +0 -113
  295. package/src/render-family-hooks.ts +0 -244
  296. package/src/renderer.ts +0 -1099
  297. package/src/route-contracts.ts +0 -2723
  298. package/src/scene/backend.ts +0 -76
  299. package/src/scene/fidelity.ts +0 -183
  300. package/src/scene/hybrid-backend.ts +0 -174
  301. package/src/scene/ir.ts +0 -181
  302. package/src/scene/marks.ts +0 -127
  303. package/src/scene/rough-backend.ts +0 -378
  304. package/src/scene/seed.ts +0 -46
  305. package/src/scene/style-registry.ts +0 -556
  306. package/src/sequence/layout.ts +0 -456
  307. package/src/sequence/parser.ts +0 -255
  308. package/src/sequence/renderer.ts +0 -604
  309. package/src/sequence/types.ts +0 -154
  310. package/src/shape-clipping.ts +0 -351
  311. package/src/shared/accessibility-directives.ts +0 -22
  312. package/src/shared/batched.ts +0 -61
  313. package/src/shared/color-math.ts +0 -72
  314. package/src/shared/svg-a11y.ts +0 -29
  315. package/src/shared/syntax-error.ts +0 -17
  316. package/src/shared/unicode-ranges.ts +0 -135
  317. package/src/styles.ts +0 -318
  318. package/src/svg-paths.ts +0 -28
  319. package/src/text-metrics.ts +0 -248
  320. package/src/theme.ts +0 -639
  321. package/src/timeline/layout.ts +0 -381
  322. package/src/timeline/parser.ts +0 -215
  323. package/src/timeline/renderer.ts +0 -538
  324. package/src/timeline/types.ts +0 -105
  325. package/src/types.ts +0 -454
  326. package/src/website-worker-modules.d.ts +0 -18
  327. package/src/xychart/axis-utils.ts +0 -109
  328. package/src/xychart/colors.ts +0 -124
  329. package/src/xychart/config.ts +0 -88
  330. package/src/xychart/layout.ts +0 -656
  331. package/src/xychart/parser.ts +0 -504
  332. package/src/xychart/renderer.ts +0 -640
  333. package/src/xychart/types.ts +0 -282
package/TODO.md DELETED
@@ -1,662 +0,0 @@
1
- # Project Backlog
2
-
3
- `TODO.md` is the only active backlog. No other root doc may carry unchecked
4
- project TODOs. Docs map: `docs/features.md` = current capabilities;
5
- `docs/project/divergences.md` = implementation history;
6
- `docs/project/lessons-learned.md` = cumulative fork narrative (loops 1–22);
7
- `docs/contributing/lessons-learned.md` = dated contributor process lessons;
8
- `AGENT_NATIVE.md` = architecture/spec rationale; `Instructions_for_agents.md`
9
- = runtime guide; `CHANGELOG.md` = user-facing release notes; `docs/README.md`
10
- = documentation index; `docs/issue-derived-test-cases.md` = evidence
11
- inventory, not backlog; `docs/mcp-code-mode-rationale.md` = MCP surface
12
- rationale, not backlog; `docs/agent-workflow-examples.md` = runnable example
13
- index, not backlog.
14
-
15
- Status legend: `todo` | `blocked` | `owner-decision` | `parked` | `done`
16
- (checked items record recently completed backlog with their evidence; prune
17
- them once the next release ships).
18
-
19
- Items within each section are sorted by dependencies: prerequisites first,
20
- dependents after. IDs are stable names, not an ordering.
21
-
22
- ## 0. Release / owner decisions
23
-
24
- - [ ] **DEC-1 — Get one real external consumer** (`todo`). Validate
25
- `agentic-mermaid/agent`, `am`, or `agentic-mermaid-mcp` in a real agent,
26
- TUI, CI gate, or editor integration outside this repo. Unblocked
27
- substantially by BUILD-7 (remote MCP reachability).
28
- - [ ] **DEC-2 — Add the WAF rate-limit rule on `POST /mcp` before broadly
29
- promoting the hosted endpoint** (`owner-decision`). The hosted MCP (`#94`,
30
- `https://agentic-mermaid.dev/mcp`) is public, unauthenticated compute. Body /
31
- input / output caps, the batch fan-out cap, edge caching, isolate CPU
32
- budgets, and CORS Origin validation bound each request in code, but the abuse
33
- backstop is a **dashboard** WAF rate-limit rule (e.g. 60 req/min per IP) that
34
- cannot live in the repo. Don't market or broadly promote the endpoint until it
35
- is live. See the promotion checklist in `website/README.md`.
36
- - [x] **DEC-3 — Verify the `worker_loaders` (`LOADER`) binding resolves in
37
- production** (`done`). Live probe against `https://agentic-mermaid.dev/mcp`
38
- on 2026-07-07: `tools/call execute` with code `1 + 41` returned
39
- `{ "ok": true, "value": 42, "logs": [] }`, proving the production Dynamic
40
- Workers `LOADER` binding resolves for hosted Code Mode. The pure tools are no
41
- longer the only production evidence.
42
- - [ ] **DEC-4 — Submit the sitemap to Google and Bing** (`owner-decision`).
43
- After the first deploy that serves `https://agentic-mermaid.dev/sitemap.xml`
44
- (generated by `website/build.ts`, validated against the sitemaps.org 0.9
45
- XSD), submit it manually in Google Search Console → Sitemaps and Bing
46
- Webmaster Tools → Sitemaps. Both require a signed-in, ownership-verified
47
- account, and the anonymous ping endpoints are retired, so this cannot be
48
- automated in the repo.
49
- - [ ] **DEC-5 — Add the `Sitemap:` line in the Cloudflare dashboard**
50
- (`owner-decision`). Production serves Cloudflare's *managed* content-signals
51
- `robots.txt` (verified live: the "content signals" template, no `Sitemap:`
52
- line), which the edge is likely to serve in preference to any repo
53
- `website/public/robots.txt`. So the reliable way to make the sitemap
54
- auto-discoverable is to add `Sitemap: https://agentic-mermaid.dev/sitemap.xml`
55
- via the Cloudflare dashboard's managed robots.txt (Manage robots.txt), which
56
- also keeps the content-signals reservation intact. The repo deliberately ships
57
- no `robots.txt` (it would only collide with the managed one), so the dashboard
58
- is the single source for this line.
59
-
60
- ## 1. Security backlog
61
-
62
- - [ ] **SEC-1 — Sanitize editor share/draft render config before SVG insertion** (`todo`). Audit on 2026-07-09 found that `/editor/` accepts hash/draft `config`, merges it into render options, and inserts rendered SVG with `innerHTML`; malicious color/font/style values can break out of the SVG root `style` attribute and create executable SVG markup under the current CSP. Fix by allowlisting editor-restorable config keys/values, escaping SVG root styles/attrs in `svgOpenTag`, sanitizing preview SVG before insertion, and adding hostile hash/draft/browser regression tests.
63
- - [ ] **SEC-2 — Cap editor share-link decompression and draft restore size** (`todo`). Deflated share links and localStorage drafts currently decode/read without a byte cap, so a crafted hash or stale draft can hang the browser. Add encoded/decoded size limits, streaming abort on overflow, visible too-large errors, and tests for corrupt/oversized links and missing `DecompressionStream`.
64
- - [ ] **SEC-3 — Make editor autosave privacy explicit** (`todo`). The editor persists diagram source, render config, style, and seed in plaintext `localStorage` by default. Add a visible disclosure plus a clear/private-mode option or switch persistent drafts to opt-in/session-only storage.
65
-
66
- ## 2. Ready build backlog
67
-
68
- - [x] **BUILD-7 — MCP reachability: streamable-HTTP/SSE transport + file/URL
69
- outputs** (`done`). Added opt-in HTTP/SSE transport with loopback-default
70
- binding, `--transport http`, direct `/rpc` test endpoint, SSE `/sse` +
71
- `/message` session flow, `/health`, JSON content-type/Origin gates,
72
- remote-bind bearer token requirement, capped request/sandbox sizes, and
73
- managed `/artifacts/<name>` serving. `render_png` now supports
74
- `output: "base64"|"file"|"url"`; file/URL artifacts are generated under a
75
- managed store with safe tracked names, MIME type, byte count, SHA-256, size
76
- limit, and TTL checks. Tests cover file output, URL fetch-back, auth/body
77
- gates, tracked artifact serving, and SSE session lifecycle.
78
- - [ ] **BUILD-27 — MCP Apps support** (`todo`). Expose an interactive
79
- in-agent diagram UI through MCP Apps: `ui://` resources, correct
80
- `text/html;profile=mcp-app` resource MIME type, tool `_meta.ui.resourceUri`
81
- wiring, CSP for the view, and tests that the resources are reachable without
82
- leaking secrets. Start with a read-only preview/verify view before adding any
83
- editable surface.
84
- - [ ] **BUILD-28 — WebMCP support** (`todo`). Track and implement the WebMCP
85
- browser-discovery path once the draft stabilizes enough to commit to a public
86
- contract. Scope should cover `/.well-known/mcp` compatibility, browser-safe
87
- CORS/Origin handling, and parity with the hosted Streamable HTTP tool surface.
88
- - [ ] **BUILD-29 — ChatGPT app listing** (`todo`). Prepare a ChatGPT app
89
- listing once Agentic Mermaid has a stable in-agent UI surface. Package the
90
- public description, icon, privacy/security notes, hosted MCP/App endpoints,
91
- and reviewer-ready examples; do not submit until the MCP Apps/WebMCP surface
92
- is production-ready.
93
- - [ ] **BUILD-25 — Structured coverage for the last silent-opaque constructs**
94
- (`todo`, needs legacy-renderer support first; tracked as **#118**). The systemic `UNSUPPORTED_SYNTAX`
95
- warning (2026-07) now announces every opaque fallback, so these are visible but
96
- still source-only. Promoting them to structured is blocked on the LEGACY parser/
97
- renderer, which drops them today (verified): class generic type params
98
- (`class Box~T~` → `parseClassDiagram` returns empty), class `namespace {…}`,
99
- state `note … / end note` and `<<choice>>/<<fork>>/<<join>>` pseudostates
100
- (`state-body.ts:27-31` documents the legacy drop). Each needs the legacy
101
- parser/renderer taught first, then a body-type + parser + serializer + mutator +
102
- round-trip test — one family per PR to preserve the determinism/render-parity
103
- contract. NON-goal: accepting UNQUOTED pie labels — Mermaid's pie grammar
104
- requires quotes, so that would accept invalid Mermaid (the fork rejects what
105
- Mermaid rejects); the systemic warning already covers the bare-label trap.
106
- - [ ] **BUILD-24 — Layout hints: rank/group pinning and edge-length
107
- preferences** (`todo`). Direct agent feedback (2026-07): an agent deleted a
108
- real edge because the auto-layout drew its feedback loop as a long,
109
- confusing route — the only lever it had was removing information. Give
110
- agents structural levers instead: per-node rank/layer pinning, "keep these
111
- nodes adjacent" grouping hints, and a "keep this edge short" preference,
112
- carried as typed metadata (not source hacks) and honored by the ELK
113
- pipeline deterministically. Design questions: hint syntax in Mermaid source
114
- (frontmatter? comment directives?) vs. render-option-only; interaction with
115
- the determinism contract (hints must be part of the input, never ambient);
116
- which ELK knobs (`org.eclipse.elk.layered.layering.*`, `priority`,
117
- `desiredEdgeLength`) map cleanly. Scope the first slice to flowchart/state.
118
- - [ ] **BUILD-2 — `process --mode validate|canonicalize` triage** (`todo`).
119
- Current verbs are `verify` and `format`; do not add another command until it
120
- proves agent value. Needed: inventory overlap with `verify`, `format`,
121
- `parse`, `serialize`, `mutate`, and `batch`; write the exact JSON/exit-code
122
- contract for `validate` and `canonicalize`; test whether it reduces agent
123
- routing errors in docs/evals; then either implement as a thin, schema-tested
124
- wrapper or explicitly park/decline it. Independent of other items.
125
- - [ ] **BUILD-26 — Ecosystem issue harvest: Mermaid / Mermaid ASCII /
126
- Beautiful Mermaid migration fixtures** (`todo`). Six-month issue harvest
127
- (created since 2026-01-07) found 214 Mermaid issues, 10 Mermaid ASCII issues,
128
- and 61 Beautiful Mermaid issues; capture them as **fixture seeds and parity
129
- gaps**, not as blanket scope expansion. Priority is direct Agentic Mermaid
130
- relevance: supported-family syntax parity, ASCII semantic preservation,
131
- deterministic layout/text/theming/security, and workflow/API ergonomics.
132
- - **Flowchart syntax + subgraphs**: typed metadata/style interop and parser
133
- safety (`mermaid-js/mermaid#7826`, `#7596`; `lukilabs/beautiful-mermaid#125`),
134
- subgraph direction/order/limits (`mermaid-js/mermaid#7946`, `#7477`, `#7741`,
135
- `#7848`; `lukilabs/beautiful-mermaid#55`). Feed #44 / BUILD-23 and the
136
- subgraph-direction/layout fixture matrix.
137
- - **ER/class/sequence/Gantt/chart parity**: ER aliases/directions/cardinality/
138
- subgraphs (`mermaid-js/mermaid#7482`, `#7472`, `#7351`, `#7417`;
139
- `lukilabs/beautiful-mermaid#131`, `#129`, `#124`); class generics/
140
- namespaces/annotations (`mermaid-js/mermaid#7648`, `#7480`, `#7753`, `#7618`;
141
- feeds BUILD-25/#118); sequence notes/fragments/async arrows (`AlexanderGrooff/mermaid-ascii#69`,
142
- `#68`, `#62`; `mermaid-js/mermaid#7681`, `#7664`, `#7687`;
143
- `lukilabs/beautiful-mermaid#107`, `#108`); Gantt scheduling/compact/
144
- multiline/vertical-marker gaps (`mermaid-js/mermaid#7714`, `#7407`, `#7603`,
145
- `#7602`, `#7564`, `#7339`, `#7300`); XY/pie/quadrant/architecture text or
146
- feature gaps (`mermaid-js/mermaid#7650`, `#7599`, `#7392`, `#7607`, `#7325`,
147
- `#7608`, `#7487`, `#7308`, `#7301`).
148
- - **ASCII/Unicode semantic preservation**: import or reproduce terminal
149
- fixtures for dropped labels, multiple edges, ID-vs-label parsing,
150
- international/fullwidth text, arrowhead attachment, fan-out trunks, ER/class
151
- labels, and semicolon/line-break parsing (`AlexanderGrooff/mermaid-ascii#70`,
152
- `#63`, `#59`, `#56`, `#46`; `lukilabs/beautiful-mermaid#122`, `#121`,
153
- `#119`, `#112`, `#111`, `#109`, `#61`, `#13`, `#12`, `#7`, `#5`). Treat
154
- these as semantic-loss blockers before visual polish.
155
- - **Layout/text/theming/security/workflow**: use Mermaid/Beautiful issues as
156
- quality-rubric seeds for spacing, subgraph overflow, edge crossings, long
157
- text/CJK/PNG clipping, html-label wrapping, consistent theme variables,
158
- contrast, CSS class emission, CSP/Trusted Types, external image blocking,
159
- CLI/API/package exports, minified/output options, and post-render mutation
160
- signals (`mermaid-js/mermaid#7901`, `#7930`, `#7932`, `#7911`, `#7827`,
161
- `#7505`, `#7496`, `#7354`, `#7341`, `#7359`, `#7565`, `#7555`, `#7794`,
162
- `#7873`, `#7815`, `#7695`, `#7645`, `#7517`, `#7556`; `lukilabs/beautiful-mermaid#83`,
163
- `#68`, `#65`, `#64`, `#56`, `#32`, `#25`, `#11`, `#89`, `#43`, `#14`,
164
- `#115`, `#130`, `#100`, `#101`, `#80`, `#79`, `#18`, `#1`, `#20`, `#33`,
165
- `#45`, `#73`, `#76`).
166
- - **Strategic new-family watchlist**: TreeView/filetree, C4/ArchiMate,
167
- mindmap, swimlane, and newer requested families (Domain Storytelling,
168
- Cynefin, DITAA, BPMN, RASCI, Data Pipeline, Use Case, PERT/CPM, Org Chart,
169
- Info) are roadmap signals only. Route TreeView through BUILD-6 first;
170
- do not expand family scope without a focused issue and evidence.
171
- - [x] **BUILD-3 — Family-plugin consolidation** (`done`). parse/serialize/
172
- mutate for sequence, timeline, class, ER, and journey now dispatch through
173
- `FamilyPlugin` hooks registered in `src/agent/families-builtin.ts`; each
174
- family lives in one body module (`sequence-body.ts`, `timeline-body.ts`,
175
- `class-body.ts`, `er-body.ts`, `journey-body.ts`). Flowchart/state remain
176
- registered via `flowchartFamilyHooks` (two plugins, one implementation,
177
- header bound per kind) after the contract gained canonicalSource/
178
- multi-error parse and a buildSourceMap hook — no in-tree exception
179
- remains. Mutation rebuilds `canonicalSource` uniformly. Unblocks
180
- BUILD-5/BUILD-6/BUILD-11 and the mutation roadmap.
181
- - [ ] **BUILD-5 — Common-README family coverage: pie, gantt, mindmap,
182
- gitgraph** (`in-progress`). These families are common in
183
- real-world READMEs/docs and already have authoring syntax references in
184
- `skills/agentic-mermaid-diagram-workflow/references/upstream/`, but the
185
- renderer does not accept them. No public usage statistics exist, so first
186
- gather evidence (count fenced ` ```mermaid ` header families across a
187
- GitHub README corpus), then implement in evidence order. Each addition
188
- follows `docs/contributing/adding-diagram-types.md` and ships
189
- parse/verify/render/round-trip (source-level body is acceptable; structured
190
- mutation only where the IR can preserve semantics). The corpus count also
191
- feeds BUILD-11.
192
- - [x] Evidence step: `eval/family-usage/` counts fenced ` ```mermaid `
193
- header families over a directory of markdown. Golden-fixture tested; smoke
194
- run over the in-repo corpus recorded in `eval/family-usage/RESULTS.md`
195
- with an explicit caveat that the decision-grade README corpus run needs
196
- network (see `eval/family-usage/README.md`).
197
- - [x] Pie family (cheapest target): `src/pie/` (types/parser/layout/SVG +
198
- `src/ascii/pie.ts`), routing, agent surface (detect + extractLabels),
199
- showcase samples, docs, and goldens. Now promoted to structured mutation —
200
- `src/agent/pie-body.ts`, `asPie`, 7 ops (see Unreleased changelog).
201
- - [x] Gantt family (per the [docs/design/families/gantt.md](./docs/design/families/gantt.md)
202
- spec from PR #24): `src/gantt/` (types/parser/schedule/layout/SVG +
203
- `src/ascii/gantt.ts`), routing, segment-preserving typed mutation from day
204
- one (`src/agent/gantt-body.ts`, `asGantt`, 9 ops), pure wall-clock-free
205
- scheduler with named `GANTT_*` errors, critical-path analysis in
206
- `describe`, showcase samples, docs, ASCII/Unicode + SVG goldens,
207
- fast-check properties, a `mermaid-ast` differential, and a targeted
208
- Stryker config (`mutation-test:gantt`).
209
- - [ ] mindmap, gitgraph: still to implement. Order the remaining
210
- two by the real README corpus run (network required) per the evidence
211
- step above — `eval/family-usage/RESULTS.md` does not assert that ordering.
212
- - [x] **BUILD-20 — Upstream test-suite harvests for every current renderable family.** Apply
213
- [docs/contributing/harvesting-upstream-tests.md](./docs/contributing/harvesting-upstream-tests.md)
214
- (the method piloted by `eval/mermaid-gantt-bench/`, which found one real
215
- compat bug, one semantic boundary divergence, and the verify/render seam
216
- that became `UNRESOLVABLE_SCHEDULE`) to the remaining current families. The
217
- [`eval/mermaid-upstream-suite-bench/`](./eval/mermaid-upstream-suite-bench/)
218
- bench now pins upstream Mermaid at `a2d9686451df7c4644a3eeca20535bbd4c5776b0`,
219
- provides `bun run harvest:upstream` and `bun run harvest:upstream:refresh-check`,
220
- records a family-by-family manifest for all 1,170 considered parser/DB
221
- blocks, imports 658 source blocks, accounts for 512 exclusions, and leaves
222
- 0 deferred blocks. The executable gate covers 648 cases including the
223
- 68-case Gantt companion bench. Local compatibility exclusions carry BUILD-20
224
- tracking metadata, exact case assertions are enforced, and `ratchet.json`
225
- prevents imported coverage from falling or local-gap budgets from growing.
226
- - [x] flowchart, state, sequence, class, ER, timeline, journey,
227
- architecture, xychart, pie, quadrant, and gantt all have checked
228
- cases/exclusions/manifest accounting.
229
- - [ ] mindmap, gitgraph: harvest BEFORE implementing (BUILD-5) — these are
230
- future families, so they are outside the current renderable-family BUILD-20
231
- closure.
232
- - [x] **BUILD-22 — Diagram-family citizenship gap backfill** (`done`). The
233
- checked matrix in
234
- [`docs/contributing/diagram-family-citizenship.matrix.json`](./docs/contributing/diagram-family-citizenship.matrix.json)
235
- now has **zero exceptions** across registered renderable families. The
236
- docs-corpus citizenship backfill regenerated the official Mermaid syntax-doc
237
- corpus (271 examples, now including pie/quadrant), added an executable
238
- `eval/mermaid-docs-corpus/divergences.json` ledger, fixed the discovered
239
- flowchart compact-target round-trip bug, and upgraded the matrix/test ratchet
240
- so future gaps fail loudly.
241
- - [x] Stable ASCII/TUI/editor region assertions for every family are pinned
242
- in `src/__tests__/agent-ascii-meta.test.ts`; `src/ascii/meta.ts` now emits
243
- regions for state, timeline, class, ER, journey, architecture, xychart,
244
- pie, quadrant, and Gantt in addition to the earlier flowchart/sequence
245
- coverage.
246
- - [x] Targeted mutation lanes exist for state, sequence, timeline, class,
247
- ER, journey, pie, and quadrant (`stryker.<family>.config.json` plus
248
- `mutation-test:<family>` scripts). Flowchart/link routing,
249
- xychart/architecture, and Gantt keep their existing focused lanes.
250
- - [x] Executable docs-corpus divergence ledger exists for current known
251
- non-Gantt Mermaid-docs divergences; the cross-family parser/DB bench now
252
- accounts for every current renderable-family BUILD-20 upstream block.
253
- - [x] Generated-site/sample family coverage is tied to
254
- `BUILTIN_FAMILY_METADATA` by the existing property generator tests,
255
- including explicit gallery affordance/prefix checks for Pie, Quadrant, and
256
- Gantt.
257
- - [x] **BUILD-11 — QuadrantChart family** (`done`). Promoted
258
- from the PARK-3 fork-audit list. Quadrant charts are missing across the
259
- entire beautiful-mermaid fork network (no port exists upstream or in any
260
- fork), so this is cheap differentiation. Axis/quadrant layout is closer to
261
- xychart than to graph families; shipped as a render body, since promoted to
262
- structured mutation (`src/agent/quadrant-body.ts`, `asQuadrant`, 7 ops).
263
- Evidence: `src/quadrant/` (types/parser/layout/SVG renderer) +
264
- `src/ascii/quadrant.ts`; routing in `src/mermaid-source.ts`, `src/index.ts`,
265
- `src/ascii/index.ts`; agent surface in `src/agent/families-builtin.ts`
266
- (`quadrant` detect + `extractQuadrantLabels`) and `DiagramKind` in
267
- `src/agent/types.ts`. Quadrant numbering matches Mermaid core (upstream
268
- `quadrantChart.md`: 1=top-right, 2=top-left, 3=bottom-left, 4=bottom-right).
269
- Tests: `src/__tests__/quadrant.test.ts` (parser happy/sad, per-quadrant
270
- geometry, deterministic SVG, fast-check property, agent surface) + 2 unicode
271
- / 2 ascii goldens (`testdata/{unicode,ascii}/quadrant_*.txt`). Malformed
272
- lines (out-of-range/non-numeric coords, missing brackets, duplicate labels,
273
- `classDef`/`:::` styling) error loudly. Docs/showcase/CHANGELOG/llms.txt
274
- updated; the then-current family count assertions and detector-drift case
275
- were bumped.
276
- - [ ] **BUILD-6 — New upstream Mermaid families (11.4–11.15)** (`todo`). Mermaid added kanban (11.4), radar (11.6), treemap
277
- (~11.9), Venn (beta, 11.13), Ishikawa/fishbone (beta, 11.13), Wardley Maps
278
- (beta, 11.14), TreeView (11.14), and Event Modeling (11.15). Upstream
279
- syntax references for these already ship in the skill bundle. Prioritize
280
- TreeView first: it is hierarchical, ASCII-friendly, and requested against
281
- the upstream fork network (lukilabs/beautiful-mermaid#114). Treat
282
- beta-grammar families (Venn, Ishikawa, Wardley) as watch-and-wait until
283
- upstream syntax stabilizes. C4 belongs here too: the layout-aesthetic
284
- complaint mermaid-js/mermaid#7492 (C4 overlapping labels/text overflow/
285
- crossing arrows) cannot get a regression fixture until C4 is rendered — the
286
- aesthetic-issue coverage audit
287
- (`docs/issue-derived-test-cases.md`) defers it to this item.
288
- - [x] **BUILD-15 — Journey structured mutation (pilot)** (`done`). Typed
289
- `JourneyBody` (title/sections/tasks with 1..5 scores and actors), 10 ops,
290
- `asJourney` narrower, verify hook, lossless opaque fallback for unmodeled
291
- syntax, round-trip property tests (`agent-journey.test.ts`), and sync
292
- across CLI capabilities, MCP SDK declaration, `Instructions_for_agents.md`,
293
- llms.txt, the skill, and the spec. The per-family checklist it validated
294
- is the template for BUILD-16/BUILD-17.
295
- - [x] **BUILD-16 — XY chart structured mutation** (`done`). Typed `XyChartBody`
296
- (bare title, named/categorical/range x-axis, named/range y-axis, `bar`/`line`
297
- series with optional names + finite values; `horizontal` orientation modeled
298
- from the header), 8 ops (`set_title`, `set_x_axis`, `set_y_axis`, `add_series`,
299
- `remove_series`, `set_series_values`, `set_series_name`, `reorder_series`),
300
- `asXyChart` narrower, verify hook (EMPTY_DIAGRAM + LABEL_OVERFLOW on
301
- title/axis-name/series-name), lossless opaque fallback for quoted text /
302
- multi-statement `;` lines / accTitle/accDescr / `curve basis` / non-orientation
303
- header suffixes, and the `SERIES_NOT_FOUND` error code. Number format is
304
- `String(n)` (finite-only), proven byte-identical round-trip plus a
305
- **differential test** that the canonical output re-parses identically under the
306
- legacy `parseXYChart`. Category/series length mismatch is allowed (legacy
307
- renderer accepts it) and tested. Evidence: `src/agent/xychart-body.ts`,
308
- `src/__tests__/agent-xychart.test.ts` (29 tests, 216 assertions; sabotage check
309
- flipped 19 of 29 red), plus sync across CLI capabilities, MCP SDK declaration,
310
- `Instructions_for_agents.md` + mirror, llms.txt, SKILL.md, and the spec.
311
- Followed the BUILD-15/BUILD-17 checklist verbatim.
312
- - [x] **BUILD-17 — Architecture structured mutation** (`done`). Typed
313
- `ArchitectureBody` (groups/services/junctions + anchored `id:SIDE arrow SIDE:id`
314
- edges), 10 ops (`add_service`, `remove_service` [cascades edges],
315
- `rename_service` [updates edges], `set_service_label`, `set_service_icon`,
316
- `move_service`, `add_group`, `remove_group` [refuses non-empty], `add_edge`,
317
- `remove_edge` [by index or `from->to` id]), `asArchitecture` narrower, verify
318
- hook (EMPTY_DIAGRAM + LABEL_OVERFLOW), lossless opaque fallback for the
319
- `{group}` boundary modifier and accTitle/accDescr, round-trip + fast-check
320
- property tests (`agent-architecture.test.ts`), and sync across CLI
321
- capabilities, MCP SDK declaration, `Instructions_for_agents.md`, llms.txt, the
322
- skill, and the spec. Followed the BUILD-15 journey checklist verbatim.
323
- - [x] **BUILD-18 — Segment-preserving structured body** (`done`, sequence). Ended the
324
- structured-or-opaque cliff for sequence: one unmodeled construct (e.g. a
325
- sequence `alt` block) no longer forces the whole diagram opaque. `SequenceBody`
326
- now carries an ordered `statements: SequenceStatement[]` list that interleaves
327
- structured `participant`/`message` statements (refs into the existing
328
- `participants`/`messages` arrays) with verbatim `opaque-block` segments
329
- preserved positionally, so participant/message ops stay available while
330
- `Note`/`alt`/`loop`/`par`/`activate`/`autonumber`/`title` ride along untouched.
331
- Block constructs are captured start→matching-`end` with nesting tracking;
332
- `remove_message`/`set_message_text` indexes address only top-level messages
333
- (messages inside an opaque block are never touched); un-segmentable input
334
- (stray `end`, unclosed block) still falls back to whole-body opaque. Shipped a
335
- segment-aware parser, order-preserving idempotent serializer, segment-respecting
336
- ops, fast-check properties (interleave round-trip in order; `remove_message`
337
- leaves opaque-block bytes unchanged; segments-or-opaque always lossless), and a
338
- sabotage check on the nesting-depth tracker. MermaidSeqBench (132) and the
339
- mermaid-docs sequence corpus stay 100% lossless.
340
- - [ ] Follow-up: apply the same segment-preserving body to class/ER/timeline
341
- unmodeled-syntax fallbacks. This is the path to "typed mutation for all
342
- diagrams" without ever violating the no-loss guarantee. Also the 2A
343
- destination for in-body `%%` comments in flowchart/state (BUILD-21 ships
344
- the announced-drop interim via the `COMMENT_DROPPED` lint): comments
345
- become positionally-anchored opaque segments that ride through mutations.
346
- - [x] **BUILD-19 — Dedicated `StateBody` IR for state diagrams** (`done`).
347
- State diagrams now own a dedicated structured-or-opaque `StateBody`
348
- (`body.kind: 'state'`) — states, transitions with `[*]` start/end
349
- pseudostates (scoped per composite level), nestable composites, and
350
- `direction` — replacing the flowchart projection. `src/agent/state-body.ts`
351
- ships parse/serialize/mutate/verify; `families-builtin` registers state via
352
- `structuredFamilyHooks('state', …)`. Evidence:
353
- - **Modeled-vs-opaque, legacy-probed**: probed `parseStateDiagram` empirically
354
- (definition-before-use label ordering, `[*]` → `_start`/`_end`, composite
355
- `[\w\p{L}]+` ids reject hyphens, bare `stateId`/notes/`<<fork>>`/`--`/
356
- `classDef`/`:::` are DROPPED by the legacy parser → modeled subset is exactly
357
- what re-parses identically; everything else stays lossless-opaque).
358
- - **8 ops** (`add_state`, `remove_state` [cascade + refuse non-empty composite],
359
- `rename_state` [rewrites transitions], `set_state_label`, `add_transition`,
360
- `remove_transition` [index or from/to], `set_transition_label`,
361
- `make_composite`). New error codes `STATE_NOT_FOUND`, `TRANSITION_NOT_FOUND`,
362
- `DUPLICATE_STATE`.
363
- - **Verify-projection proof**: `verify.ts` projects `StateBody` → `MermaidGraph`
364
- via `stateBodyToGraph` and runs the shared `verifyGraph` (Tier 1 + Tier 2);
365
- differential test proves canonical source re-parses 1:1 under the legacy
366
- parser (states ↔ nodes, transitions ↔ edges, composites ↔ subgraphs).
367
- - **Corpus delta**: state round-trip 5% → 100% (all 20 mermaid-docs samples),
368
- verify floor 0.70 → 0.80; floors raised in `agent-mermaid-corpus.test.ts`.
369
- - `asState` narrower; `asFlowchart` now returns `null` on state (breaking flip,
370
- documented across every agent surface + CHANGELOG breaking note). Tests:
371
- `src/__tests__/agent-state.test.ts` (42 tests: parse, narrow, round-trip,
372
- opaque-fallback table, error-path table, differential, fast-check, verify
373
- projection); state pins in `agent.test.ts` and doc-sync guard flipped.
374
- - [x] **BUILD-13 — Layout before/after comparison harness** (`done`).
375
- Prerequisite for all visual/layout work (BUILD-10, BUILD-9, BUILD-12,
376
- BUILD-1): render the corpus + targeted fixtures on two git states and emit
377
- a side-by-side HTML report with perceptual-metric deltas. Shipped as
378
- `eval/layout-compare/run.ts` (snapshot/report subcommands, regression
379
- exit code), fixtures in `eval/layout-compare/fixtures/`, tests in
380
- `src/__tests__/layout-compare.test.ts`.
381
- - [x] **BUILD-10 — Fan-out trunk sharing / connector alignment** (`done`).
382
- Upstream issue <https://github.com/lukilabs/beautiful-mermaid/issues/111>
383
- (sibling edges from one source don't share a trunk; related connector
384
- displacement is issue #112, upstream fix PR is #113).
385
- The #112 box-start displacement was already fixed (connector anchored on the
386
- node border via `getNodeAttachmentPoint`; `ascii-box-start.test.ts`). The
387
- #111-class TB fan-out detour (a labelled sibling edge took an L-shaped wander
388
- with its label on the horizontal run) is now fixed. Evidence: golden
389
- `src/__tests__/testdata/unicode/td_fanout_labeled.txt` matches the upstream
390
- shape exactly; charset-independent invariants in
391
- `src/__tests__/ascii-fanout-trunk-labeled.test.ts` (single trunk with ┬ tees,
392
- each label on its own vertical drop, no `─label─`, no stray `+`/`◢`).
393
- Port outcome (the Loop 17 lesson, confirmed again): of upstream PR #113's four
394
- parts, only TWO were load-bearing in this fork and only those shipped —
395
- (1a) deterministic FIFO tie-breaking in the pathfinder MinHeap
396
- (`src/ascii/pathfinder.ts`), and (3b) label placement preferring the
397
- per-sibling vertical drop in TD (`determineLabelLine` in
398
- `src/ascii/edge-routing.ts`). The other two — (1b) `preferredDir` A* neighbour
399
- reordering and (2) explicit branch-point re-routing — DESTABILISED trunk
400
- rendering here (stray `+`, `◢` arrowheads, regressed the LR box-start repro),
401
- because this fork already has the trunk machinery upstream lacked
402
- (edge-bundling for unlabelled siblings) plus FIFO determinism, so the reorder
403
- fought the existing routing. `preferredDir` is kept as an unused pathfinder
404
- capability (covered by `ascii-pathfinder-determinism.test.ts`); the re-routing
405
- was dropped. Part (4) collinear-corner-skip in `drawCorners` shipped as a
406
- defensive guard. Corpus delta (BUILD-13): 0 SVG / 0 ASCII / 0 metric changes
407
- across 251 samples (the labelled-fan-out pattern isn't in the corpus). Sabotage
408
- check: reversing the FIFO tie-break re-introduces the `─center*─` detour.
409
- - [x] **BUILD-9 — Fan-in grouping** (`done`). Promoted from PARK-1; upstream
410
- PR <https://github.com/lukilabs/beautiful-mermaid/pull/69>. Implemented in
411
- `src/ascii/grid.ts` `createMapping`: roots grouped contiguously by first
412
- downstream target, fan-in targets aligned under their root group, with
413
- self-loops and 2-cycle toggles excluded from the in-degree (a blanket
414
- in-degree check regressed state-machine corpora — caught by BUILD-13).
415
- Corpus impact: 1 sample improved, 0 regressed. Tests:
416
- `src/__tests__/ascii-fan-in-grouping.test.ts`.
417
- - [x] **BUILD-12 — Subgraph `direction` support** (`done` — it was already
418
- implemented; now pinned). Mermaid ignores `direction` inside a subgraph
419
- when an inner node links outward
420
- (<https://github.com/mermaid-js/mermaid/issues/2509>,
421
- <https://github.com/mermaid-js/mermaid/issues/6438>); our ELK SEPARATE
422
- hierarchy handling and the ASCII grid layout both honor it, including the
423
- #2509 external-link case. Geometry tests pin the differentiator:
424
- `src/__tests__/subgraph-direction.test.ts`.
425
- - [x] **BUILD-14 — ASCII: edges to a subgraph id create a phantom node**
426
- (`done`). `Start --> Pipeline` where `Pipeline` is a subgraph used to render
427
- a duplicate floating node box labeled `Pipeline` instead of attaching the
428
- edge to the container. Fixed in the ASCII converter + draw layer: the
429
- converter (`src/ascii/converter.ts` `resolveSubgraphEdges`) detects phantom
430
- subgraph-id nodes, drops them, and retargets each touching edge onto a
431
- representative container member for routing; the draw layer
432
- (`src/ascii/draw.ts` `drawContainerEdge`) clips the visible polyline to the
433
- container's border rectangle and draws the arrowhead on the border, so the
434
- edge attaches to the container — matching the SVG/ELK hierarchical-port
435
- behavior. Edge semantics are preserved (visible terminal is the container
436
- border, never an arbitrary member node). Evidence: red→green repro suite
437
- `src/__tests__/ascii-subgraph-edge.test.ts` (5 tests, incl. the mermaid#2509
438
- case and an id-collision sad path), golden
439
- `src/__tests__/testdata/unicode/subgraph_edge_to_container.txt`, and the
440
- BUILD-13 layout-compare harness shows 4 ASCII-only changed corpus/fixture
441
- samples (flowchart/96, flowchart/97, flowchart/98, subgraph-direction.mmd)
442
- with 0 regressions / 0 faithfulness deltas. Repro:
443
- `eval/layout-compare/fixtures/subgraph-direction.mmd`.
444
- - [x] **BUILD-21 — Source-wrapper fidelity (1C) + announced in-body comment
445
- policy (2C)** (`done`). Probing the official Mermaid syntax-reference
446
- examples through parse → serialize found three wrapper-fidelity gaps:
447
- `config:`-nested frontmatter flattened to top-level keys Mermaid cannot
448
- read back, `%%{init}%%` directives duplicated into a synthesized
449
- frontmatter block, and leading `%%` comments dropped. Owner decisions:
450
- **1C** (wrapper round-trips byte-verbatim by default — `meta.wrapperSource`
451
- — with canonical config-nested synthesis opt-in via
452
- `serializeMermaid(d, { wrapper: 'canonical' })` / `am format
453
- --canonical-wrapper`) and **2C** (in-body comments remain canonicalized
454
- away by structured bodies but the loss is announced via the new Tier 3
455
- `COMMENT_DROPPED` lint computed by diffing parse comments against the
456
- serialized output; wrapper comments and opaque bodies/segments preserve
457
- comments and never warn). Evidence:
458
- `src/__tests__/agent-wrapper-fidelity.test.ts` (14 tests: verbatim
459
- round-trip per wrapper form incl. multiline directives, mutation keeps the
460
- wrapper, canonical nesting/folding incl. the unparseable-directive raw
461
- fallback, CLI flag e2e, lint fires/doesn't-fire matrix); wrapper law + 2C
462
- policy stated in `docs/contributing/adding-diagram-types.md`; warning code
463
- synced across types/capabilities/llms.txt/SDK declaration/agent guides.
464
- The 2A destination (segment-preserving comment retention) is tracked under
465
- the BUILD-18 follow-up below.
466
- - [x] **BUILD-23 — `@{ ... }` node metadata safety floor** (`done`). Issue
467
- <https://github.com/adewale/agentic-mermaid/issues/29>. Mermaid v11.3+
468
- typed-shape syntax no longer silently drops edges/targets or fabricates
469
- phantom metadata-key nodes in the covered repros: parser/tokenization keeps
470
- metadata attached to the intended node or preserves unsupported forms
471
- opaquely; `src/__tests__/flowchart-metadata.test.ts` pins inline,
472
- standalone, and multiline safety cases plus round-trip behavior. Modeled
473
- support for the full v11 typed-shape vocabulary (ISO 5807/ANSI X3.5 symbols
474
- mapped onto `NodeShape`) remains separate (#44). BUILD-1 still needs
475
- compatible `@{ view: collapsed }` semantics, but no longer starts from a
476
- silent-loss parser floor.
477
- - [ ] **BUILD-1 — Collapsible subgraphs (#7785)** (`todo`, after BUILD-23 metadata safety floor; independent of BUILD-20 harvest). Track Mermaid PR
478
- <https://github.com/mermaid-js/mermaid/pull/7785> (`@{ view: collapsed }`
479
- metadata syntax) and stay syntax-compatible. Large, but a real readability
480
- win for agent-generated architecture diagrams; pairs naturally with typed
481
- `collapse`/`expand` mutation ops. Measure with BUILD-13. (BUILD-14, the
482
- ASCII phantom-node bug that would have interfered with collapsed-subgraph
483
- edge attachment, is now fixed.)
484
- - [x] **BUILD-8 — Tier 3 lint catalogue** (`done`). Added advisory
485
- flowchart/state lint warnings for `DUPLICATE_EDGE` and `UNREACHABLE_NODE`,
486
- exposed them through `WarningCode`, `WARNING_TIER`, `am capabilities`,
487
- `llms.txt`, MCP SDK declarations, tests, and agent-facing docs. Candidates
488
- came from EVAL-2's captured/curated real-agent failure corpus.
489
- - [x] **BUILD-4 — Cloudflare Workers website + hosted MCP** (`done`). The
490
- canonical site runs from `website/` on Cloudflare Workers Static Assets with
491
- `run_worker_first: true`, custom domains, and a stateless hosted MCP endpoint
492
- at `https://agentic-mermaid.dev/mcp`. The MCP surface decision is now pinned:
493
- no REST render API; local MCP stays Code Mode-first (`execute`, `render_png`,
494
- `describe`); hosted MCP exposes eight bounded JSON-RPC tools — `execute`
495
- inside a per-code Dynamic Worker isolate, pure `render_svg` / `render_ascii` /
496
- `render_png` / `verify` / `describe`, and declarative structured-edit
497
- `mutate` / `build`. Hosted file/URL artifacts, accounts, tokens, persistence,
498
- outbound network access from `execute`, and arbitrary REST endpoints remain
499
- non-goals. Remaining dashboard/ops work is tracked by DEC-2 (WAF rate limit);
500
- DEC-3's production `LOADER`/Dynamic Workers execute probe and the shared MCP
501
- code dedup work in CONS-23/CONS-24 are complete.
502
-
503
- - [x] **QUAL-1 — Perceptual-quality coverage for non-graph families**
504
- (`done`). `layoutMermaid` now has `RenderedLayout` adapters for EVERY
505
- renderable family — class, ER, journey, architecture, xychart, pie,
506
- quadrant, and gantt join flowchart/state/sequence/timeline — so `measureQuality` /
507
- `checkQuality` and the BUILD-13 harness see real geometry (not bytes-only)
508
- for each. Adapters live in `src/agent/family-layouts.ts`; they parse
509
- `d.canonicalSource` via the legacy per-family parser+layouter (the same
510
- geometry the SVG renderer draws), so opaque-but-renderable bodies are still
511
- measured and invalid opaque bodies degrade to an empty layout instead of
512
- throwing. Wired into `layoutMermaid` (`src/agent/index.ts`) and `verify.ts`
513
- (verify.layout is now truthful for these families). Evidence: red-green +
514
- property + determinism + opaque-no-throw tests in
515
- `src/__tests__/agent-family-layouts.test.ts`; the harness gained a fixture per
516
- family (`eval/layout-compare/fixtures/`) — every fixture's metrics.nodeCount
517
- > 0 — and `compareSample` now treats an empty→measured transition as an
518
- improvement, not a regression (`src/__tests__/layout-compare.test.ts`). A
519
- before/after run against the base commit shows 0 regressions, 57 improvements,
520
- and zero SVG/ASCII byte changes on the 243 shared corpus samples (measurement
521
- only, no rendering change). `docs/quality.md` honest-gap + LLM-judge grid
522
- updated (now 12 families, including gantt).
523
- - Remaining sub-gaps (kept unchecked — need a non-sandbox browser run):
524
- - [x] mermaid-docs corpus regen to include pie/quadrant docs examples.
525
- `corpus.json` was regenerated from a real `mermaid-js/mermaid` clone and
526
- now includes all 12 registered families (271 examples total). Corpus
527
- entries are never fabricated.
528
- - [ ] the new families have no browser screenshot baselines (needs a local
529
- browser run).
530
-
531
- ## 3. Agent-usage verification backlog
532
-
533
- - [x] **EVAL-1 — Capture subagent-backed release-model transcripts** (`done`).
534
- `eval/agent-usage/transcripts/pi-subagent-release-2026-06-10/` captures a
535
- fresh subagent-backed release-model pass across the six default cases. The
536
- committed transcript replay test gates every pi-subagent transcript directory
537
- through the deterministic sandbox, task oracle, and trace linter. Direct
538
- API-backed Anthropic/OpenAI-compatible captures remain available on demand via
539
- `bun run eval:agent-live` when credentials are present.
540
- - [x] **EVAL-2 — Expand captured real-agent failure corpus** (`done`). Added
541
- `eval/agent-usage/failure-corpus/` with captured pi-subagent failures and
542
- curated executable regressions for markdown-only answers, whole-source
543
- regeneration, CLI misuse, serialize-without-verify, ignored verify results,
544
- and opaque mutation attempts. `agent-usage.test.ts` now classifies/replays
545
- the corpus so known-bad paths stay failing. Fed BUILD-8 lint-code selection.
546
- - [ ] **EVAL-3 — Eval the `agentic-mermaid-diagram-workflow` skill for
547
- helpfulness** (`todo`). The public skill
548
- (`website/public/skills/agentic-mermaid-diagram-workflow/SKILL.md` +
549
- `references/`) is the site's main agent call-to-action, now linked from the
550
- footer. Verify it actually improves outcomes: run agent-usage cases with vs.
551
- without the skill loaded and compare on task success, verify-before-return
552
- discipline, Code-Mode vs. prose answers, and source-level-vs-structured edit
553
- choice — reuse the EVAL-1/EVAL-2 sandbox, task oracle, and trace linter.
554
- Fold any skill gaps back into `SKILL.md`/`references/`; keep or cut the
555
- footer link based on whether it demonstrably helps.
556
-
557
- ## 4. Blocked / external resource needed
558
-
559
- _No active blocked items._
560
-
561
- ## 5. Parked / evidence-required ideas
562
-
563
- - [ ] **PARK-2 — `.well-known/skills` discovery** (`parked`). Watch the
564
- ecosystem; do not implement until a standard settles.
565
- - [ ] **PARK-3 — Fork feature ports** (`parked`). Vercel themes,
566
- browser/package export tweaks, C4, ArchiMate (upstream PR #34), and
567
- animation remain fork-audit ideas. Promote one only with a focused issue
568
- and owner. (QuadrantChart was promoted to BUILD-11; fan-in grouping was
569
- PARK-1, promoted to BUILD-9.)
570
-
571
- ## 6. Consolidation / dedup backlog
572
-
573
- Open items carried over from the 2026-07 consolidation audit (the audit doc has
574
- been retired; its landed items shipped, these remain). Each is a
575
- zero-behavior-change or bounded dedup with a red→green or byte-equivalence gate
576
- expected. `consolidation-gate.test.ts` pins the already-single-sourced
577
- invariants against recurrence.
578
-
579
- - [ ] **CONS-11 — One shape-outline module** (`todo`). Every non-rectangular
580
- flowchart silhouette is authored twice: the emitter in `src/renderer.ts` and
581
- the edge clipper in `src/shape-clipping.ts` (hexagon `h/4`, cylinder `ry=7`,
582
- trapezoid `w*0.15`, asymmetric `12`, diamond, stadium). Extract one
583
- `shapeOutline(shape, x, y, w, h)` returning canonical vertices/cap radii;
584
- renderer maps to SVG, clipper ray-intersects the same vertices.
585
- - [ ] **CONS-16 — Modeling `accTitle`/`accDescr` parser** (`todo`). The
586
- directive regex has drifted (`xychart`/`agent` accept optional colon;
587
- `architecture`/`timeline`/`gantt` require it) and the `accDescr { … }` block
588
- scan is copy-pasted. Extend `src/shared/accessibility-directives.ts` with a
589
- modeling `parseAccessibilityDirective(lines, i)` used by all parsers; pick one
590
- colon rule consciously.
591
- - [x] **CONS-23 — Shared MCP tool descriptions/dispatch** (`done`). Extracted
592
- `src/mcp/tool-surface.ts`: shared MCP server name/version, common JSON-RPC
593
- method dispatch (`initialize`, notifications, `ping`, `tools/list`,
594
- `tools/call`, empty prompts/resources), and shared `execute`, `render_png`,
595
- and `describe` tool definition builders. Local and hosted servers now supply
596
- only their intentional behavior differences and tool handlers.
597
- - [x] **CONS-24 — MCP bin shim** (`done`). Extracted `src/mcp/mcp-cli.ts` with
598
- `runMcpCli(argv)`, shared help text, shared flag parsing, and parseable
599
- `parseMcpCliOptions`; both `src/mcp/mcp-bin.ts` and
600
- `bin/agentic-mermaid-mcp.ts` are thin shebang shims, matching the `am` bin
601
- pattern while preserving stdio process-drain behavior.
602
- - [ ] **CONS-26 — Unify agent vs legacy per-family parsers** (`owner-decision`,
603
- architectural). The agent `*-body.ts` parsers re-encode grammars that
604
- `src/<family>/parser.ts` already owns, kept in sync only by differential
605
- tests. Build agent bodies as a projection of the legacy parser's AST so the
606
- legacy parser is the single grammar authority. Schedule separately.
607
- - [ ] **CONS-27 — Canonical minimal diagram per family** (`todo`). The
608
- "minimal diagram" is authored in 5 places (`families.ts` `example`,
609
- `editor/js/examples.js`, `website/build.ts` `COMPARISON_CASES`, two test
610
- fixture helpers) and has drifted. Make `BUILTIN_FAMILY_METADATA[].example`
611
- canonical and derive `COMPARISON_CASES` + fixtures from it.
612
- - [ ] **CONS-30 — `agent/body-utils.ts` extraction** (`todo`). Mechanical,
613
- high-confidence dedup inside `src/agent/`: the LABEL_OVERFLOW closure (×6), the
614
- id allocator (×5), byte-identical `set_title` (×7), `pie-body` ≡ `quadrant-body`
615
- collection ops, the source-map builders, and the `extractLabels` frame (~12×).
616
- Also FNV-1a hash re-rolled in 6 family renderers → import `seedFrom`
617
- (`scene/seed.ts`), and ~47 hand-built `color-mix(in srgb, …)` strings → a
618
- shared `cssMix`.
619
- - [ ] **CONS-40 — Generate the per-family stryker configs** (`todo`). The ~16
620
- `stryker.<family>.config.json` lanes are pure `family → globs → tests` data.
621
- Generate them from the citizenship matrix. Caveat: the citizenship test and
622
- matrix hard-code the config filenames, so a generator must keep on-disk names
623
- or update both in lockstep.
624
- - [x] **CONS-90 — Website pipelines: Cloudflare chosen as canonical** (`done`).
625
- agentic-mermaid.dev (Cloudflare Workers, `website/build.ts`) is now the
626
- canonical live site: homepage/links/`HOSTED_BASE` repointed,
627
- `.github/workflows/deploy-cloudflare.yml` added (auto-deploys on `main`; needs
628
- `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` repo secrets), and the GitHub
629
- Pages deploy (`pages.yml`, `build:site`) retired. The `scripts/site/*`
630
- generators stay as dev/preview tools (still used by `bun run dev` and
631
- `e2e/browser.test.ts`). (Related audit Tier-4 items already resolved:
632
- `mockups/` deleted, `evals/`→`skill-evals/` renamed, dead scripts +
633
- `stryker.linkrank` removed, `pr11-reviewer-guide.md` retired.)
634
- - [x] **CONS-91b — Un-commit the `website/public` bundle** (`done`). The 6.8MB
635
- Cloudflare bundle is now gitignored and built on demand: at deploy by
636
- `deploy-cloudflare.yml`, and for the five tests that read it by the preload
637
- `src/__tests__/website-public.preload.ts`. `website:check` now pins only the
638
- committed `website/src/generated` worker inputs.
639
- - [x] **CONS-91a-partial — Delete the low-coupling Pages generators** (`done`).
640
- Removed `scripts/site/differences.ts`, `xychart-test.ts`, and their exclusive
641
- data (`xychart-samples-data.ts`, `upstream-layout-snapshots.json`,
642
- `capture-upstream-layout.ts`); rewrote `comparison-differences-sync.test.ts`
643
- to keep the `comparison.md`↔registry guard.
644
- - [x] **CONS-91c — Retire `scripts/site/generate.ts` (samples gallery)**
645
- (`done`). Migrated `e2e/browser.test.ts` down to the editor-only suite (the
646
- editor is built by `editor.ts`, which stays; the gallery-specific blocks were
647
- removed — validated at 10 browser tests passing), pointed `bun run dev` at
648
- `website:dev`, and deleted `generate.ts`, `client-color.ts`, `scripts/dev.ts`,
649
- and `property-html-generator.test.ts` (+ the `samples` script). The
650
- citizenship matrix's `generatedSite` evidence now cites `website/build.ts` +
651
- `website-build.test.ts`. `samples-data.ts` stays (shared with eval tooling).
652
- The GitHub Pages pipeline is fully retired.
653
-
654
- ## 7. Non-goals
655
-
656
- - Do not port Vercel-specific package rename, committed `dist/`, `.vercel`, or Vercel branding.
657
- - Do not fold `zhenhuaa/mdv` wholesale into this package; terminal Markdown
658
- viewing belongs in a separate tool or companion package.
659
- - Do not port old dagre-specific layout code directly; translate only ideas
660
- that still apply to the current ELK/layout-engine architecture.
661
- - Do not treat historical `docs/project/divergences.md` or process notes as
662
- backlog unless an item is promoted here with an ID.