agentic-mermaid 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_NATIVE.md +155 -91
- package/CHANGELOG.md +163 -4
- package/Instructions_for_agents.md +10 -10
- package/LICENSES/Apache-2.0.txt +202 -0
- package/README.md +31 -38
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/assets/hero.png +0 -0
- package/dist/agent-core.d.ts +463 -0
- package/dist/agent-core.js +397 -0
- package/dist/agent.d.ts +73 -1868
- package/dist/agent.js +336 -37325
- package/dist/agentic-mermaid-mcp.js +7 -38399
- package/dist/am.js +33626 -40446
- package/dist/chunk-2P5FKUQC.js +3485 -0
- package/dist/chunk-2S3VSS6I.js +149 -0
- package/dist/chunk-2SILJDW2.js +37 -0
- package/dist/chunk-BJYMBT4I.js +61963 -0
- package/dist/chunk-FDM43XU7.js +615 -0
- package/dist/chunk-MYPDVZCO.js +4702 -0
- package/dist/index-DWPa2MJs.d.ts +6780 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +310 -33014
- package/dist/mcp-cli-5J47WEY3.js +17 -0
- package/docs/README.md +39 -31
- package/docs/agent-api-cookbook.md +44 -35
- package/docs/agent-mutation-policy.md +1 -1
- package/docs/agent-workflow-examples.md +2 -2
- package/docs/api.md +284 -77
- package/docs/ascii.md +26 -16
- package/docs/code-mode-impact.md +214 -0
- package/docs/comparison.md +23 -11
- package/docs/computational-aesthetics-prototype-plan.md +252 -0
- package/docs/config.md +26 -10
- package/docs/custom-fonts.md +265 -0
- package/docs/custom-style-cookbook.md +130 -9
- package/docs/diagram-families.md +48 -23
- package/docs/features.md +59 -52
- package/docs/fork-differences.md +6 -3
- package/docs/getting-started.md +23 -16
- package/docs/issue-derived-test-cases.md +29 -22
- package/docs/mcp-code-mode-rationale.md +13 -6
- package/docs/mcp-http-transport.md +20 -13
- package/docs/mermaid-layout-complaints.md +66 -52
- package/docs/mutation-testing.md +145 -66
- package/docs/quality.md +23 -14
- package/docs/react.md +2 -2
- package/docs/schemas/style-spec.schema.json +1221 -30
- package/docs/style-authoring.md +241 -38
- package/docs/svg-semantic-contract.md +49 -0
- package/docs/testing-strategy.md +166 -58
- package/docs/theming.md +19 -32
- package/examples/styles/catalog.json +54 -0
- package/examples/styles/cloudflare-workers-inspired-prototype.mmd +9 -0
- package/examples/styles/cloudflare-workers-inspired-prototype.style.json +110 -0
- package/examples/styles/cupertino-prototype.mmd +10 -0
- package/examples/styles/cupertino-prototype.style.json +63 -0
- package/examples/styles/mid-century-report.style.json +2 -2
- package/examples/styles/star-chart-atlas.style.json +2 -1
- package/examples/styles/transit-route-map.style.json +2 -2
- package/examples/styles/vercel-inspired-prototype.mmd +6 -0
- package/examples/styles/vercel-inspired-prototype.style.json +87 -0
- package/package.json +85 -45
- package/server.json +2 -2
- package/skills/agentic-mermaid-diagram-workflow/SKILL.md +17 -36
- package/skills/agentic-mermaid-diagram-workflow/references/cli.md +4 -5
- package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +15 -31
- package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +10 -14
- package/skills/agentic-mermaid-live-editor/SKILL.md +100 -206
- package/TODO.md +0 -684
- package/dist/index-wjRjbsP-.d.ts +0 -1102
- package/docs/assets/improvements/box-start-connector.png +0 -0
- package/docs/assets/improvements/comment-dropped-lint.png +0 -0
- package/docs/assets/improvements/er-content-loss.png +0 -0
- package/docs/assets/improvements/fan-in-trunks.png +0 -0
- package/docs/assets/improvements/gantt-family.png +0 -0
- package/docs/assets/improvements/gantt-milestone-clamp.png +0 -0
- package/docs/assets/improvements/gantt-verify-seam.png +0 -0
- package/docs/assets/improvements/subgraph-container-edges.png +0 -0
- package/docs/assets/improvements/wrapper-frontmatter.png +0 -0
- package/docs/assets/improvements/wrapper-init-directive.png +0 -0
- package/docs/assets/improvements/wrapper-leading-comment.png +0 -0
- package/docs/assets/style-cookbook/mid-century-report.png +0 -0
- package/docs/assets/style-cookbook/star-chart-atlas.png +0 -0
- package/docs/assets/style-cookbook/transit-route-map.png +0 -0
- package/docs/contributing/adding-diagram-types.md +0 -144
- package/docs/contributing/diagram-family-citizenship.matrix.json +0 -2127
- package/docs/contributing/diagram-family-citizenship.md +0 -82
- package/docs/contributing/harvesting-upstream-tests.md +0 -126
- package/docs/contributing/lessons-learned.md +0 -276
- package/docs/contributing/releasing.md +0 -82
- package/docs/contributing/visual-review-evidence.md +0 -53
- package/docs/design/families/README.md +0 -26
- package/docs/design/families/architecture-beta.md +0 -48
- package/docs/design/families/flowchart-parser-conformance.md +0 -22
- package/docs/design/families/gantt-research.md +0 -137
- package/docs/design/families/gantt.md +0 -329
- package/docs/design/families/journey-agentic-cards-before.png +0 -0
- package/docs/design/families/journey-experience-curve-implementation.png +0 -0
- package/docs/design/families/journey-mermaid-classic-implementation.png +0 -0
- package/docs/design/families/journey-mermaid-classic-prototype.png +0 -0
- package/docs/design/families/journey-mermaid-classic-prototype.svg +0 -163
- package/docs/design/families/journey-mermaid-classic-prototype.svg.png +0 -0
- package/docs/design/families/journey-migration-parity.md +0 -439
- package/docs/design/families/journey-section-overlap-after.png +0 -0
- package/docs/design/families/journey-section-overlap-before.png +0 -0
- package/docs/design/families/journey-usage-research.md +0 -423
- package/docs/design/families/journey.md +0 -153
- package/docs/design/families/xychart.md +0 -85
- package/docs/design/system/README.md +0 -45
- package/docs/design/system/abstraction-audit.md +0 -224
- package/docs/design/system/abstraction-recommendations.md +0 -655
- package/docs/design/system/architecture.mmd +0 -29
- package/docs/design/system/architecture.svg +0 -137
- package/docs/design/system/layout-guarantees-and-robustness.md +0 -351
- package/docs/design/system/layout-rubric.md +0 -138
- package/docs/design/system/route-contracts.md +0 -848
- package/docs/design/system/source-preservation-ladder.md +0 -52
- package/docs/design/system/styles-rollout.md +0 -216
- package/docs/design/system/ugly-layouts.md +0 -119
- package/docs/layout-characterization/README.md +0 -245
- package/docs/layout-characterization/contact-sheet-families.md +0 -498
- package/docs/layout-characterization/contact-sheet.md +0 -638
- package/docs/layout-characterization/properties.md +0 -281
- package/docs/layout-characterization/visual-quality.md +0 -160
- package/docs/layout-characterization/visual-snapshots/architecture.svg +0 -79
- package/docs/layout-characterization/visual-snapshots/class.svg +0 -60
- package/docs/layout-characterization/visual-snapshots/er.svg +0 -61
- package/docs/layout-characterization/visual-snapshots/flowchart.svg +0 -58
- package/docs/layout-characterization/visual-snapshots/gantt.svg +0 -52
- package/docs/layout-characterization/visual-snapshots/journey.svg +0 -98
- package/docs/layout-characterization/visual-snapshots/pie.svg +0 -36
- package/docs/layout-characterization/visual-snapshots/quadrant.svg +0 -47
- package/docs/layout-characterization/visual-snapshots/sequence.svg +0 -59
- package/docs/layout-characterization/visual-snapshots/state.svg +0 -52
- package/docs/layout-characterization/visual-snapshots/timeline.svg +0 -64
- package/docs/layout-characterization/visual-snapshots/xychart.svg +0 -97
- package/docs/project/divergences.md +0 -98
- package/docs/project/dogfooding-docs-strategy.md +0 -66
- package/docs/project/hosted-mcp-cloudflare-plan.md +0 -338
- package/docs/project/lessons-learned.md +0 -1019
- package/docs/project/remove-role-styling-plan.md +0 -176
- package/examples/agent-improve-auth-flow.ts +0 -206
- package/examples/agent-loop.ts +0 -53
- package/examples/mcp-vs-cli-complex-diagrams.ts +0 -133
- package/llms.txt +0 -104
- package/skill-evals/README.md +0 -77
- package/skill-evals/fixtures/architecture-cache/input.mmd +0 -5
- package/skill-evals/fixtures/class-payment/input.mmd +0 -4
- package/skill-evals/fixtures/er-orders/input.mmd +0 -10
- package/skill-evals/fixtures/flowchart-cache/input.mmd +0 -3
- package/skill-evals/fixtures/gantt-release/input.mmd +0 -7
- package/skill-evals/fixtures/journey-checkout/input.mmd +0 -6
- package/skill-evals/fixtures/pie-exports/input.mmd +0 -5
- package/skill-evals/fixtures/quadrant-priorities/input.mmd +0 -11
- package/skill-evals/fixtures/sequence-retry/input.mmd +0 -8
- package/skill-evals/fixtures/state-lifecycle/input.mmd +0 -5
- package/skill-evals/fixtures/timeline-release/input.mmd +0 -6
- package/skill-evals/fixtures/xychart-growth/input.mmd +0 -5
- package/skill-evals/shared-benchmark.json +0 -510
- package/src/agent/analyze.ts +0 -157
- package/src/agent/apply.ts +0 -146
- package/src/agent/architecture-body.ts +0 -458
- package/src/agent/certificates.ts +0 -110
- package/src/agent/class-body.ts +0 -319
- package/src/agent/core.ts +0 -207
- package/src/agent/create.ts +0 -106
- package/src/agent/describe.ts +0 -368
- package/src/agent/er-body.ts +0 -224
- package/src/agent/facts.ts +0 -360
- package/src/agent/families-builtin.ts +0 -920
- package/src/agent/families.ts +0 -232
- package/src/agent/family-layouts.ts +0 -832
- package/src/agent/flowchart-body.ts +0 -372
- package/src/agent/flowchart-unsupported.ts +0 -243
- package/src/agent/font-coverage.ts +0 -288
- package/src/agent/gantt-body.ts +0 -495
- package/src/agent/index.ts +0 -10
- package/src/agent/journey-body.ts +0 -374
- package/src/agent/label-metrics.ts +0 -28
- package/src/agent/layout-to-rendered.ts +0 -63
- package/src/agent/mutate.ts +0 -97
- package/src/agent/mutation-ops.ts +0 -51
- package/src/agent/op-schema.ts +0 -443
- package/src/agent/parse.ts +0 -223
- package/src/agent/pie-body.ts +0 -270
- package/src/agent/png.ts +0 -171
- package/src/agent/quadrant-body.ts +0 -336
- package/src/agent/quality.ts +0 -363
- package/src/agent/readability-audit.ts +0 -92
- package/src/agent/rendered-route-audit.ts +0 -61
- package/src/agent/sequence-body.ts +0 -345
- package/src/agent/serialize.ts +0 -214
- package/src/agent/state-body.ts +0 -589
- package/src/agent/structural-count.ts +0 -150
- package/src/agent/timeline-body.ts +0 -280
- package/src/agent/trace-log.ts +0 -43
- package/src/agent/types.ts +0 -995
- package/src/agent/verify.ts +0 -603
- package/src/agent/xychart-body.ts +0 -472
- package/src/architecture/config.ts +0 -282
- package/src/architecture/layout.ts +0 -496
- package/src/architecture/parser.ts +0 -375
- package/src/architecture/renderer.ts +0 -611
- package/src/architecture/types.ts +0 -113
- package/src/ascii/ansi.ts +0 -423
- package/src/ascii/architecture.ts +0 -210
- package/src/ascii/canvas.ts +0 -443
- package/src/ascii/class-diagram.ts +0 -697
- package/src/ascii/converter.ts +0 -475
- package/src/ascii/draw.ts +0 -1693
- package/src/ascii/edge-bundling.ts +0 -328
- package/src/ascii/edge-routing.ts +0 -330
- package/src/ascii/er-diagram.ts +0 -439
- package/src/ascii/gantt.ts +0 -276
- package/src/ascii/grid.ts +0 -747
- package/src/ascii/index.ts +0 -196
- package/src/ascii/journey.ts +0 -169
- package/src/ascii/meta.ts +0 -244
- package/src/ascii/multiline-utils.ts +0 -80
- package/src/ascii/pathfinder.ts +0 -301
- package/src/ascii/pie.ts +0 -67
- package/src/ascii/quadrant.ts +0 -158
- package/src/ascii/reverse.ts +0 -216
- package/src/ascii/sequence.ts +0 -499
- package/src/ascii/shapes/circle.ts +0 -27
- package/src/ascii/shapes/corners.ts +0 -143
- package/src/ascii/shapes/diamond.ts +0 -27
- package/src/ascii/shapes/hexagon.ts +0 -27
- package/src/ascii/shapes/index.ts +0 -106
- package/src/ascii/shapes/rectangle.ts +0 -168
- package/src/ascii/shapes/rounded.ts +0 -27
- package/src/ascii/shapes/special.ts +0 -332
- package/src/ascii/shapes/stadium.ts +0 -110
- package/src/ascii/shapes/state.ts +0 -192
- package/src/ascii/shapes/types.ts +0 -73
- package/src/ascii/timeline.ts +0 -141
- package/src/ascii/types.ts +0 -312
- package/src/ascii/validate.ts +0 -120
- package/src/ascii/width.ts +0 -81
- package/src/ascii/wrap.ts +0 -131
- package/src/ascii/xychart.ts +0 -919
- package/src/browser.ts +0 -29
- package/src/class/layout.ts +0 -240
- package/src/class/parser.ts +0 -332
- package/src/class/renderer.ts +0 -638
- package/src/class/types.ts +0 -129
- package/src/cli/agent-instructions.ts +0 -1
- package/src/cli/am-bin.ts +0 -6
- package/src/cli/exit-codes.ts +0 -18
- package/src/cli/index.ts +0 -1132
- package/src/cli/init-agent.ts +0 -147
- package/src/cli/run-entrypoint.ts +0 -10
- package/src/color-resolver.ts +0 -152
- package/src/elk-instance.ts +0 -114
- package/src/er/layout.ts +0 -187
- package/src/er/parser.ts +0 -226
- package/src/er/renderer.ts +0 -792
- package/src/er/types.ts +0 -99
- package/src/family-rubric.ts +0 -425
- package/src/font-manifest.ts +0 -31
- package/src/gantt/layout.ts +0 -365
- package/src/gantt/parser.ts +0 -282
- package/src/gantt/pipeline.ts +0 -27
- package/src/gantt/renderer.ts +0 -414
- package/src/gantt/schedule.ts +0 -513
- package/src/gantt/types.ts +0 -255
- package/src/index.ts +0 -368
- package/src/journey/layout.ts +0 -554
- package/src/journey/parse-core.ts +0 -251
- package/src/journey/parser.ts +0 -101
- package/src/journey/renderer.ts +0 -917
- package/src/journey/types.ts +0 -144
- package/src/layout/geometry.ts +0 -182
- package/src/layout/pass.ts +0 -142
- package/src/layout/passes/index.ts +0 -3916
- package/src/layout-engine.ts +0 -1565
- package/src/layout-rubric.ts +0 -659
- package/src/mcp/artifacts.ts +0 -137
- package/src/mcp/dynamic-harness.ts +0 -31
- package/src/mcp/dynamic-modules.d.ts +0 -7
- package/src/mcp/facade.ts +0 -608
- package/src/mcp/harness-runtime.ts +0 -203
- package/src/mcp/hosted-server.ts +0 -468
- package/src/mcp/mcp-bin.ts +0 -3
- package/src/mcp/mcp-cli.ts +0 -82
- package/src/mcp/protocol.ts +0 -13
- package/src/mcp/sandbox.ts +0 -195
- package/src/mcp/sdk-decl.ts +0 -391
- package/src/mcp/server.ts +0 -362
- package/src/mcp/tool-surface.ts +0 -146
- package/src/mermaid-source.ts +0 -655
- package/src/multiline-utils.ts +0 -228
- package/src/parser.ts +0 -1031
- package/src/pie/layout.ts +0 -168
- package/src/pie/parser.ts +0 -136
- package/src/pie/renderer.ts +0 -234
- package/src/pie/types.ts +0 -82
- package/src/quadrant/layout.ts +0 -191
- package/src/quadrant/parser.ts +0 -183
- package/src/quadrant/renderer.ts +0 -322
- package/src/quadrant/types.ts +0 -113
- package/src/render-family-hooks.ts +0 -244
- package/src/renderer.ts +0 -1099
- package/src/route-contracts.ts +0 -2723
- package/src/scene/backend.ts +0 -76
- package/src/scene/fidelity.ts +0 -183
- package/src/scene/hybrid-backend.ts +0 -174
- package/src/scene/ir.ts +0 -181
- package/src/scene/marks.ts +0 -127
- package/src/scene/rough-backend.ts +0 -378
- package/src/scene/seed.ts +0 -46
- package/src/scene/style-registry.ts +0 -556
- package/src/sequence/layout.ts +0 -456
- package/src/sequence/parser.ts +0 -255
- package/src/sequence/renderer.ts +0 -604
- package/src/sequence/types.ts +0 -154
- package/src/shape-clipping.ts +0 -351
- package/src/shared/accessibility-directives.ts +0 -22
- package/src/shared/batched.ts +0 -61
- package/src/shared/color-math.ts +0 -93
- package/src/shared/svg-a11y.ts +0 -29
- package/src/shared/syntax-error.ts +0 -17
- package/src/shared/unicode-ranges.ts +0 -135
- package/src/styles.ts +0 -318
- package/src/svg-paths.ts +0 -28
- package/src/text-metrics.ts +0 -248
- package/src/theme.ts +0 -710
- package/src/timeline/layout.ts +0 -381
- package/src/timeline/parser.ts +0 -215
- package/src/timeline/renderer.ts +0 -538
- package/src/timeline/types.ts +0 -105
- package/src/types.ts +0 -462
- package/src/website-worker-modules.d.ts +0 -18
- package/src/xychart/axis-utils.ts +0 -109
- package/src/xychart/colors.ts +0 -124
- package/src/xychart/config.ts +0 -88
- package/src/xychart/layout.ts +0 -656
- package/src/xychart/parser.ts +0 -504
- package/src/xychart/renderer.ts +0 -640
- package/src/xychart/types.ts +0 -282
package/docs/features.md
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
1
|
# Features — capability inventory
|
|
2
2
|
|
|
3
|
-
What Agentic Mermaid can do, organized by capability area. The npm import paths are `agentic-mermaid` and `agentic-mermaid/agent`;
|
|
3
|
+
What Agentic Mermaid can do, organized by capability area. The npm import paths are `agentic-mermaid` and `agentic-mermaid/agent`; audit and trusted host-resource helpers remain repository tooling. Implementation history lives in [`project/divergences.md`](./project/divergences.md); active backlog is only [`../TODO.md`](../TODO.md).
|
|
4
4
|
|
|
5
5
|
## Core IR & editing loop
|
|
6
6
|
|
|
7
7
|
- **Typed `ValidDiagram` IR** — parse Mermaid into a sealed, typed value.
|
|
8
|
-
- **`
|
|
8
|
+
- **`parseRegisteredMermaid(source)`** → `Result<ValidDiagram, ParseError[]>`. Never
|
|
9
9
|
throws on malformed input; structured errors.
|
|
10
|
-
- **`mutate(d, op)`** — family-overloaded typed mutation.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- **`verifyMermaid(d, opts)`** — structural verification
|
|
10
|
+
- **`mutate(d, op)`** — family-overloaded typed mutation. The generated
|
|
11
|
+
`am capabilities --json` response and SDK declaration expose the authoritative
|
|
12
|
+
operation menu for every registered family.
|
|
13
|
+
- **`verifyMermaid(d, opts)`** — structural and geometric verification plus a
|
|
14
|
+
strict render-parity gate, with deterministic semantic facts available for
|
|
15
|
+
meaning-level checks.
|
|
14
16
|
- **`serializeMermaid(d)`** — back to canonical source.
|
|
15
17
|
- **Round-trip** — structured bodies serialize to canonical, idempotent
|
|
16
18
|
source; opaque bodies preserve original indentation/comments verbatim.
|
|
17
|
-
- **Narrowers** —
|
|
18
|
-
`
|
|
19
|
-
|
|
20
|
-
off the unsafe path
|
|
21
|
-
|
|
22
|
-
## Diagram families
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| Journey | ✅ | ✅ (10 ops via `asJourney`) |
|
|
33
|
-
| XY chart | ✅ | ✅ (8 ops via `asXyChart`) |
|
|
34
|
-
| Architecture | ✅ | ✅ (10 ops via `asArchitecture`) |
|
|
35
|
-
| Pie | ✅ | ✅ (7 ops via `asPie`) |
|
|
36
|
-
| Quadrant | ✅ | ✅ (7 ops via `asQuadrant`) |
|
|
37
|
-
| Gantt | ✅ | ✅ (9 ops via `asGantt`; calendar directives/click/comments ride along verbatim as segments) |
|
|
19
|
+
- **Narrowers** — each family descriptor owns its generated SDK narrower;
|
|
20
|
+
discover the current names through `am capabilities --json`. A narrower
|
|
21
|
+
returns `null` on a non-matching or source-level/opaque body, steering agents
|
|
22
|
+
off the unsafe path without maintaining a second family roster here.
|
|
23
|
+
|
|
24
|
+
## Diagram families
|
|
25
|
+
|
|
26
|
+
The canonical `FamilyDescriptor` registry owns headers, discovery, examples,
|
|
27
|
+
operations, rendering hooks, positioned projections, semantic roles, and
|
|
28
|
+
capability evidence. Run `am capabilities --json` for the current roster and
|
|
29
|
+
per-family operation shapes; the generated Section A matrix records native,
|
|
30
|
+
source-preserved, diagnosed, and not-applicable capabilities without a copied
|
|
31
|
+
table. `absent` belongs to the validation vocabulary but is rejected from the
|
|
32
|
+
shipped syntax ledger:
|
|
33
|
+
[`project/section-a-capability-report.md`](./project/section-a-capability-report.md).
|
|
38
34
|
|
|
39
35
|
**Structured-or-opaque rule:** every family either has a structured body
|
|
40
36
|
or preserves source verbatim. Constructs are never silently dropped.
|
|
@@ -43,27 +39,33 @@ or preserves source verbatim. Constructs are never silently dropped.
|
|
|
43
39
|
|
|
44
40
|
Agentic Mermaid outputs **SVG, PNG, ASCII, Unicode, and JSON layout** from the same renderer foundation.
|
|
45
41
|
|
|
46
|
-
- **Styles** — every SVG/PNG render accepts `style`:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`status-dashboard`, `ops-schematic`, `chalkboard`, `risograph`,
|
|
50
|
-
`architectural-plan`, `publication-figure`), any theme name (a theme is a
|
|
51
|
-
palette-only style), an inline JSON record, or a stack merged left → right
|
|
42
|
+
- **Styles** — every SVG/PNG render accepts `style`: any registered Look or
|
|
43
|
+
Palette discovered through `knownStyleDescriptors()`, an inline JSON record,
|
|
44
|
+
or a stack merged left → right
|
|
52
45
|
(`{ style: ['hand-drawn', 'dracula'] }`). `seed` re-rolls styled ink and
|
|
53
46
|
never moves layout. CLI: `am render --style … --seed N`, `am styles`;
|
|
54
47
|
MCP render tools take `style`/`seed`; RENDER_FAILED-gated verify means a
|
|
55
48
|
clean verify proves the styled source renders. Authoring guide, schema, and
|
|
56
49
|
cookbook: `docs/style-authoring.md`, `docs/schemas/style-spec.schema.json`,
|
|
57
|
-
and `docs/custom-style-cookbook.md`.
|
|
50
|
+
and `docs/custom-style-cookbook.md`. Custom font selection and resolution:
|
|
51
|
+
`docs/custom-fonts.md`.
|
|
58
52
|
|
|
59
53
|
- **SVG** — `renderMermaidSVG` (`compact`, `security:'strict'`, CSS
|
|
60
|
-
variable fonts, `
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
- **
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- **
|
|
54
|
+
variable fonts, all-family semantic `data-id`/`data-role` identities, typed
|
|
55
|
+
relation ARIA, and `idPrefix` namespacing for markers, filters, clip paths,
|
|
56
|
+
paints, hrefs, and ARIA references). CLI exposes `--security strict`.
|
|
57
|
+
- **ASCII / Unicode** — `renderMermaidASCII` uses grapheme/display-cell geometry
|
|
58
|
+
across every family. `targetWidth` is a hard bound with typed impossible-width
|
|
59
|
+
errors; deprecated `maxWidth` remains best-effort only.
|
|
60
|
+
- **PNG** — `renderMermaidPNG(source, { ...sharedRenderOptions, fitTo, background, fontDirs, loadSystemFonts, onWarning })` or `am render diagram.mmd --format png --output diagram.png` (offline `@resvg/resvg-js`; bundled Inter — the metrics font — with DejaVu fallback plus the built-in style faces,
|
|
61
|
+
cross-runtime deterministic on same-machine x86_64/ARM64 where Node + built `dist/` are present; explicit sRGB + cICP metadata with no conflicting ICC profile). Characters without bundled coverage (CJK, emoji) warn loudly; supply `--font-dirs <dir>` / `fontDirs` or `--system-fonts` / `loadSystemFonts: true`.
|
|
62
|
+
Trusted hosts can bind one registered graphical backend across SVG, native
|
|
63
|
+
PNG, and browser PNG with `createMermaidRenderer`,
|
|
64
|
+
`createMermaidPNGRenderer`, and `createMermaidBrowserPNGRenderer`; backend
|
|
65
|
+
selection is host policy and cannot be smuggled through serializable render
|
|
66
|
+
options or Styles.
|
|
67
|
+
- **JSON layout** — `layoutMermaid` / `am render --format layout`; add `--certificates` (or `layoutMermaid(d, { debug: true })`) to include opt-in graph route certificates, family edge-route certificates (class/ER/architecture/sequence), region-containment certificates (timeline/charts), V1 region/action sidecars, exact ports, and side/slot/role assignments where applicable.
|
|
68
|
+
- **ASCII with metadata** — `renderMermaidASCIIWithMeta` → `{ ascii, regions, actions, warnings, routeParity }`
|
|
67
69
|
for TUI click-mapping.
|
|
68
70
|
- **Reverse** — `asciiToMermaid` reconstructs flowchart source from ASCII
|
|
69
71
|
(best-effort, lossy, structural round-trip).
|
|
@@ -73,8 +75,8 @@ Agentic Mermaid outputs **SVG, PNG, ASCII, Unicode, and JSON layout** from the s
|
|
|
73
75
|
- **Tier 1 (structural, universal):** EMPTY_DIAGRAM, EDGE_MISANCHORED,
|
|
74
76
|
OFF_CANVAS, GROUP_BREACH, UNKNOWN_SHAPE, LABEL_OVERFLOW, UNRESOLVABLE_SCHEDULE,
|
|
75
77
|
RENDER_FAILED (a clean verify proves the source actually renders).
|
|
76
|
-
- **Tier 2 (geometric — route tripwires for flowchart/state, anchor/overlap checks for class/ER):** NODE_OVERLAP, ROUTE_SELF_CROSS, and the route-contract tripwires ROUTE_HITCH, ROUTE_UNEXPLAINED_BEND, ROUTE_LABEL_ON_SHARED_TRUNK, ROUTE_CONTAINER_MISANCHOR, ROUTE_SHAPE_MISANCHOR, ROUTE_STALE_AFTER_NODE_MOVE.
|
|
77
|
-
- **Tier 3 (lint
|
|
78
|
+
- **Tier 2 (geometric — route tripwires for flowchart/state, anchor/overlap checks for class/ER):** NODE_OVERLAP, ROUTE_SELF_CROSS, and the route-contract tripwires ROUTE_HITCH, ROUTE_UNEXPLAINED_BEND, ROUTE_LABEL_ON_SHARED_TRUNK, ROUTE_SELF_LOOP_OCCUPANCY, ROUTE_CONTAINER_MISANCHOR, ROUTE_SHAPE_MISANCHOR, ROUTE_STALE_AFTER_NODE_MOVE.
|
|
79
|
+
- **Tier 3 (lint and inspect-only policy):** DUPLICATE_EDGE, UNREACHABLE_NODE, DECISION_BRANCH_UNLABELED, COMMENT_DROPPED, UNSUPPORTED_SYNTAX, CONTENT_DROPPED_ON_ROUNDTRIP, INEFFECTIVE_CONFIG, LOW_CONTRAST, BRAND_CONSTRAINT_WARNING, BRAND_CONSTRAINT_ERROR. Brand constraints inspect final contrast, accent area, or monochrome role paint without repainting/relayout; only the caller-selected `action: "error"` code flips `verify.ok`.
|
|
78
80
|
- **Perceptual quality** — `measureQuality` / `checkQuality` (edge
|
|
79
81
|
crossings, label legibility, whitespace balance, …). See [`quality.md`](./quality.md).
|
|
80
82
|
|
|
@@ -89,7 +91,8 @@ Agentic Mermaid outputs **SVG, PNG, ASCII, Unicode, and JSON layout** from the s
|
|
|
89
91
|
## Security
|
|
90
92
|
|
|
91
93
|
- **Strict mode** (`security:'strict'`) — zero external-fetch references in
|
|
92
|
-
the SVG (no Google Fonts `@import`)
|
|
94
|
+
the SVG (no Google Fonts `@import`) after one shared transform plus residual
|
|
95
|
+
verification policy.
|
|
93
96
|
- **`verifyNoExternalRefs(svg)`** — scanner / CI gate / agent self-check.
|
|
94
97
|
- No `<image>`/`<script>`/external-href injection; click directives
|
|
95
98
|
sanitized. See [`../SECURITY.md`](../SECURITY.md).
|
|
@@ -99,7 +102,9 @@ Agentic Mermaid outputs **SVG, PNG, ASCII, Unicode, and JSON layout** from the s
|
|
|
99
102
|
`render` (svg/ascii/unicode/json with multi-input results; png uses one
|
|
100
103
|
input plus `--output`; `--security strict`, `--watch`), `render-markdown` (skip bad blocks),
|
|
101
104
|
`parse`, `verify`, `mutate` (`--op` or `--ops`), `preview` (strict standalone HTML + optional `--open`), `format`, `describe` (text/json),
|
|
102
|
-
`capabilities --json` (including `families[].editPolicy
|
|
105
|
+
`capabilities --json` (including `families[].editPolicy`,
|
|
106
|
+
`families[].mutationOps`, and the machine-readable `sectionA` contract matrix),
|
|
107
|
+
`batch --jsonl` (including mutate),
|
|
103
108
|
`llms-txt`, `init-agent`, `--agent-instructions`. `mutate` verifies before emitting source; `init-agent` writes a non-clobbering `AGENTS.md` section, root `skills/` bundle, and `.mcp.json` sample into a consumer repo.
|
|
104
109
|
Exit codes 0/2/3/4; parse and verify-failure errors include structured `error.details` arrays.
|
|
105
110
|
|
|
@@ -107,21 +112,23 @@ Exit codes 0/2/3/4; parse and verify-failure errors include structured `error.de
|
|
|
107
112
|
|
|
108
113
|
Local `agentic-mermaid-mcp` is Code Mode-first: `execute(code)` runs synchronous
|
|
109
114
|
JavaScript in a local `node:vm` sandbox with a typed `mermaid.*` SDK declaration,
|
|
110
|
-
plus narrow `render_png
|
|
115
|
+
plus narrow `describe_sdk`, `render_png`, and `describe` helpers. The initial
|
|
116
|
+
Code Mode declaration carries only the core SDK; `describe_sdk` returns one
|
|
117
|
+
family's mutation schema on demand. It supports stdio by default and
|
|
111
118
|
HTTP/SSE via `agentic-mermaid-mcp --transport http`; local `render_png` can
|
|
112
119
|
return base64 bytes or managed file/URL artifacts with MIME type, byte count, and
|
|
113
120
|
SHA-256 metadata.
|
|
114
121
|
|
|
115
122
|
The hosted endpoint at `https://agentic-mermaid.dev/mcp` is stateless
|
|
116
|
-
Streamable HTTP. It exposes
|
|
117
|
-
Cloudflare Dynamic Worker isolate, pure `
|
|
118
|
-
`render_png` / `verify` / `describe`, and declarative `mutate` / `build` for
|
|
123
|
+
Streamable HTTP. It exposes nine bounded MCP JSON-RPC tools: `execute` in a
|
|
124
|
+
Cloudflare Dynamic Worker isolate, pure `describe_sdk` / `render_svg` /
|
|
125
|
+
`render_ascii` / `render_png` / `verify` / `describe`, and declarative `mutate` / `build` for
|
|
119
126
|
structured edits. Hosted inputs are capped at 64 KB, PNG is base64-only, and the
|
|
120
127
|
endpoint is a convenience surface rather than a REST render API.
|
|
121
128
|
|
|
122
129
|
## Distribution
|
|
123
130
|
|
|
124
|
-
- npm library (`agentic-mermaid`
|
|
131
|
+
- npm library (`agentic-mermaid` and `agentic-mermaid/agent`) with Node-runnable bins (`am`, the package-runner alias `agentic-mermaid`, and `agentic-mermaid-mcp`).
|
|
125
132
|
- **Single binary** — `bun run build:binary` → `dist/am`, standalone
|
|
126
133
|
executable, no runtime dependency (#1018).
|
|
127
134
|
- **llms.txt** agent-discovery digest, derived from capabilities.
|
|
@@ -132,8 +139,8 @@ endpoint is a convenience surface rather than a REST render API.
|
|
|
132
139
|
SVG layout/ASCII; full-corpus ASCII repeated-run guard; cross-runtime guards
|
|
133
140
|
exist for bun ≡ node on same-machine x86_64/ARM64 when Node + built `dist/`
|
|
134
141
|
artifacts are present.
|
|
135
|
-
- **Corpus gates** —
|
|
136
|
-
|
|
142
|
+
- **Corpus gates** — pinned Mermaid documentation and MermaidSeqBench corpora,
|
|
143
|
+
gated in CI; their manifests, rather than this prose, own current counts.
|
|
137
144
|
- **Benchmarks** — `eval/benchmark/RESULTS.md` (measured vs mmdc, termaid).
|
|
138
145
|
- **Agent-usage validation** — `eval/agent-usage/` scenarios,
|
|
139
146
|
anti-pattern linter, sandbox trace instrumentation, and stored Code Mode eval runner.
|
package/docs/fork-differences.md
CHANGED
|
@@ -10,7 +10,7 @@ The canonical live site is **[agentic-mermaid.dev](https://agentic-mermaid.dev/)
|
|
|
10
10
|
- Live editor: <https://agentic-mermaid.dev/editor>
|
|
11
11
|
- Family comparisons (Mermaid vs Beautiful Mermaid vs Agentic Mermaid): <https://agentic-mermaid.dev/comparisons/>
|
|
12
12
|
|
|
13
|
-
Alongside the static surface (the public website, machine-readable manifests, schemas, recipes, and skill files), the Cloudflare Worker serves a stateless hosted MCP endpoint at `/mcp` (`https://agentic-mermaid.dev/mcp`) —
|
|
13
|
+
Alongside the static surface (the public website, machine-readable manifests, schemas, recipes, and skill files), the Cloudflare Worker serves a stateless hosted MCP endpoint at `/mcp` (`https://agentic-mermaid.dev/mcp`) — registry-checked tools: Code Mode `execute` in per-request Dynamic Worker isolates, `describe_sdk` for one family's mutation schema on demand, the `render_svg`/`render_ascii`/`render_png`/`verify`/`describe` pure tools, and the declarative `mutate`/`build` structured-edit tools. There is still no REST render API: `/mcp` speaks MCP JSON-RPC only.
|
|
14
14
|
|
|
15
15
|
GitHub Pages is no longer a deployed surface; its samples-gallery generator has been retired. The live editor is served at [agentic-mermaid.dev/editor](https://agentic-mermaid.dev/editor) and built by `scripts/site/editor.ts` (also used by `website/build.ts`), and is exercised in a real browser by `e2e/browser.test.ts`.
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ GitHub Pages is no longer a deployed surface; its samples-gallery generator has
|
|
|
18
18
|
|
|
19
19
|
Agentic Mermaid is published as `agentic-mermaid` and adds a typed editing surface for AI agents under the `agentic-mermaid/agent` subpath export, plus an `am` CLI and an `agentic-mermaid-mcp` Code Mode MCP server (stdio plus opt-in HTTP/SSE transport with managed render artifacts). A render-only library forces an agent to regenerate the whole diagram to change one node; here, new diagrams are authored as source then parsed/verified/rendered, while existing structured diagrams go parse → narrow → mutate → verify → serialize.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Every registered family is structured when narrowed; segment-preserving families retain unsupported statements in source order, and any whole-body fallback round-trips losslessly. Layout is deterministic and verified byte-identical across processes, and `verifyMermaid` returns structured structural, geometric, and lint warnings plus perceptual quality metrics covering every family. See [`AGENT_NATIVE.md`](../AGENT_NATIVE.md) and [`Instructions_for_agents.md`](../Instructions_for_agents.md). Upstream has no equivalent; for a three-way functionality view including Mermaid itself, see [`comparison.md`](./comparison.md).
|
|
22
22
|
|
|
23
23
|
## New and expanded diagram support
|
|
24
24
|
|
|
@@ -35,6 +35,9 @@ This fork renders a wider set of Mermaid families in both the gallery and editor
|
|
|
35
35
|
- Pie charts (`pie`, with `showData`)
|
|
36
36
|
- Quadrant charts (`quadrantChart`) — not yet rendered anywhere else in the beautiful-mermaid network
|
|
37
37
|
- Gantt charts (`gantt`) with date axes, sections, dependencies, milestones, exclusions, and vertical markers
|
|
38
|
+
- Mindmaps (`mindmap`) with indentation-sensitive hierarchy, shapes, icons, and classes
|
|
39
|
+
- Git graphs (`gitGraph`) with deterministic replayed commits, branches, merges, and cherry-picks
|
|
40
|
+
- Radar charts (`radar-beta`) — spider/star charts plotting multivariate profiles across equi-angular axes from a shared center
|
|
38
41
|
|
|
39
42
|
The live editor has registry-backed example coverage for every built-in family
|
|
40
43
|
(`src/__tests__/editor-examples.test.ts`). Browser E2E still spot-checks several
|
|
@@ -106,7 +109,7 @@ Users can discover fork features through:
|
|
|
106
109
|
Mermaid.js places `a2` inside `one` and `c1` inside `three`; this fork keeps `a2`
|
|
107
110
|
and `c1` at the top level (only `a1`/`c2` are inside those subgraphs). See it both
|
|
108
111
|
ways: [open in Mermaid Live](https://mermaid.live/edit#pako:eNp10DELwjAQBeC_Et7cDjpmcBBXJ50kyzW5NoU2V9KEIqX_XbSoRXB87z44eDOsOIZG3clkPcWkrkcTlFLK7sryQPs1jLlqIg1eSeC1oe2Zg_txaZK1qZ6u-u98ZN48tF-JAj3HnloHjdkgee7ZQBs4ril3yWBBAcpJLvdgoVPMXCBKbjx0Td3IBfLgKPGppSZS_yYDhZvIJ7Jrk8TzOsRrj-UBwvBYkQ)
|
|
109
|
-
· [open in the fork editor](https://agentic-mermaid.dev/editor
|
|
112
|
+
· [open in the fork editor](https://agentic-mermaid.dev/editor/#deflate:q1Yqzi8tSk5VslJKy8kvT85ILCpRCHGKyVNQUFBINtTVtUs0gnCKS5PSixILMhTy81IhIonI0ql5KWjqSsrzISJJIHVJuNVlFKVCTQRbmIxQqVQLAA).
|
|
110
113
|
|
|
111
114
|
This is a deliberate divergence, not a bug: it gives deterministic
|
|
112
115
|
*definition-scope* membership with no surprising re-parenting when a node is
|
package/docs/getting-started.md
CHANGED
|
@@ -25,8 +25,8 @@ cd agentic-mermaid && bun install && bun run build
|
|
|
25
25
|
## Render to SVG
|
|
26
26
|
|
|
27
27
|
`renderMermaidSVG` takes Mermaid source and returns a self-contained SVG string.
|
|
28
|
-
It supports
|
|
29
|
-
|
|
28
|
+
It supports every registered diagram family (including flowchart, sequence,
|
|
29
|
+
class, ER, state, Gantt, Mindmap, and GitGraph) — just pass the source.
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
import { renderMermaidSVG } from 'agentic-mermaid'
|
|
@@ -64,8 +64,11 @@ const png = renderMermaidPNG(`flowchart TD
|
|
|
64
64
|
writeFileSync('diagram.png', png)
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
`fitTo: { width
|
|
67
|
+
Portable PNG controls are `scale` (default `2`, for retina), `background`, and
|
|
68
|
+
the mutually exclusive `fitTo: { width? }` / `fitTo: { height? }`; the same
|
|
69
|
+
controls are available through the browser adapter, CLI, and local/hosted MCP.
|
|
70
|
+
Node/Bun additionally accepts trusted-host `fontDirs`, `loadSystemFonts`, and
|
|
71
|
+
the library-only `onWarning` callback.
|
|
69
72
|
|
|
70
73
|
## Render to ASCII / Unicode
|
|
71
74
|
|
|
@@ -85,21 +88,22 @@ See [`ascii.md`](./ascii.md) for supported families and cell-to-region metadata.
|
|
|
85
88
|
|
|
86
89
|
## Theming
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
Build a palette from two colors, or select one discovered through
|
|
92
|
+
`knownStyleDescriptors()` or `am styles`. Colors are applied
|
|
89
93
|
as CSS variables, so the SVG stays self-contained.
|
|
90
94
|
|
|
91
95
|
```ts
|
|
92
|
-
import { renderMermaidSVG
|
|
96
|
+
import { renderMermaidSVG } from 'agentic-mermaid'
|
|
93
97
|
|
|
94
|
-
// Two-color
|
|
98
|
+
// Two-color palette
|
|
95
99
|
const dark = renderMermaidSVG('flowchart TD\n A --> B', {
|
|
96
100
|
bg: '#1a1b26',
|
|
97
101
|
fg: '#a9b1d6',
|
|
98
102
|
})
|
|
99
103
|
|
|
100
|
-
// A built-in
|
|
104
|
+
// A built-in palette (zinc-light, tokyo-night, nord, dracula, catppuccin-mocha, …)
|
|
101
105
|
const themed = renderMermaidSVG('flowchart TD\n A --> B', {
|
|
102
|
-
|
|
106
|
+
style: 'tokyo-night',
|
|
103
107
|
})
|
|
104
108
|
|
|
105
109
|
// Transparent background, for embedding on any page
|
|
@@ -109,7 +113,7 @@ const transparent = renderMermaidSVG('flowchart TD\n A --> B', {
|
|
|
109
113
|
```
|
|
110
114
|
|
|
111
115
|
Common `RenderOptions`: `bg`, `fg`, `font`, `transparent`, and `security`. See
|
|
112
|
-
[`theming.md`](./theming.md) for custom
|
|
116
|
+
[`theming.md`](./theming.md) for custom Palettes and Shiki/VS Code theme import.
|
|
113
117
|
|
|
114
118
|
### Untrusted input
|
|
115
119
|
|
|
@@ -148,7 +152,7 @@ See [`react.md`](./react.md) for the zero-flash, live-theme-switching setup.
|
|
|
148
152
|
| SVG | `agentic-mermaid` |
|
|
149
153
|
| ASCII / Unicode | `agentic-mermaid` |
|
|
150
154
|
| PNG (native rasterizer) | `agentic-mermaid/agent` |
|
|
151
|
-
|
|
|
155
|
+
| Palettes (`knownStyleDescriptors`, `fromShikiTheme`) | `agentic-mermaid` |
|
|
152
156
|
| Everything in one path | `agentic-mermaid/agent` |
|
|
153
157
|
| Typed editing (parse/mutate/verify) | `agentic-mermaid/agent` |
|
|
154
158
|
|
|
@@ -157,15 +161,18 @@ single import path for all formats, import everything from there.
|
|
|
157
161
|
|
|
158
162
|
## Prefer the command line?
|
|
159
163
|
|
|
160
|
-
The same renderers ship as the `am` CLI — no code required
|
|
164
|
+
The same renderers ship as the `am` CLI — no code required. After the local
|
|
165
|
+
install above, use the package runner so the command resolves without a global
|
|
166
|
+
install:
|
|
161
167
|
|
|
162
168
|
```bash
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
169
|
+
npx --no-install agentic-mermaid render diagram.mmd --format svg
|
|
170
|
+
npx --no-install agentic-mermaid render diagram.mmd --format png --output diagram.png
|
|
171
|
+
npx --no-install agentic-mermaid render diagram.mmd --format ascii
|
|
166
172
|
```
|
|
167
173
|
|
|
168
|
-
Run `
|
|
174
|
+
Run `npx --no-install agentic-mermaid --help` for the full command set. Inside
|
|
175
|
+
an npm script, the shorter `am …` binary name is available automatically.
|
|
169
176
|
|
|
170
177
|
## Next steps
|
|
171
178
|
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
# Issue-derived
|
|
1
|
+
# Issue-derived coverage evidence
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Status: evidence and coverage inventory, not a fixture backlog. Root `TODO.md` is
|
|
4
|
+
the sole authority for scheduled work. Uncovered fixture and heuristic ideas
|
|
5
|
+
below are unscheduled unless a stable root TODO item promotes them.
|
|
6
|
+
|
|
7
|
+
These public Mermaid / Beautiful Mermaid issues explain what the existing
|
|
8
|
+
fixtures cover and preserve candidate evidence for future decisions. The goal is
|
|
9
|
+
not to clone every upstream bug; it is to retain representative examples that
|
|
10
|
+
teach the renderer/agent surface what users actually expect.
|
|
4
11
|
|
|
5
12
|
## Already covered or newly covered
|
|
6
13
|
|
|
@@ -35,7 +42,7 @@ These are public Mermaid / Beautiful Mermaid issues worth turning into small, ed
|
|
|
35
42
|
- Why it matters: ER/class ASCII labels and compartment text are semantic content, not decoration; long labels must not silently disappear when connectors are tight.
|
|
36
43
|
- Current coverage: exact ASCII/Unicode golden files cover class compartments/relationship labels and ER relationship labels. ER same-row layout now widens the inter-entity gap to preserve full labels.
|
|
37
44
|
|
|
38
|
-
##
|
|
45
|
+
## Candidate fixture evidence (unscheduled)
|
|
39
46
|
|
|
40
47
|
- [mermaid-js/mermaid#6271 — unexpected graph direction](https://github.com/mermaid-js/mermaid/issues/6271)
|
|
41
48
|
- Suggested fixture: a graph whose author order implies a clear primary direction but whose cross/back edges tempt the layout engine to flip ranks. Assert source-order progression and bounded aspect ratio.
|
|
@@ -44,7 +51,7 @@ These are public Mermaid / Beautiful Mermaid issues worth turning into small, ed
|
|
|
44
51
|
- [Mermaid v11.3+ `@{ shape: ... }` typed node metadata](https://mermaid.js.org/syntax/flowchart.html) — **safety floor fixed as BUILD-23 / [#29](https://github.com/adewale/agentic-mermaid/issues/29); full typed-shape vocabulary remains #44**
|
|
45
52
|
- Why it matters: this syntax carries the ISO 5807/ANSI X3.5 flowchart symbol vocabulary (manual input, document, delay, preparation, …); Mermaid's docs use it extensively, so agent-generated sources will contain it.
|
|
46
53
|
- Current behavior (June 2026): the three issue #29 repro classes are pinned by `src/__tests__/flowchart-metadata.test.ts`; they no longer silently drop targets/edges or fabricate `shape`/`label` phantom nodes. Unsupported forms preserve source opaquely; supported label metadata renders as a conservative rectangle fallback.
|
|
47
|
-
-
|
|
54
|
+
- Candidate coverage: #44 records the full Mermaid v11 typed-shape vocabulary without weakening the no-silent-loss safety floor; this ledger does not schedule it.
|
|
48
55
|
- [Mermaid frontmatter `config.layout`/`config.look`](https://mermaid.js.org/intro/syntax-reference.html) — **wrapper-fidelity gaps found by probing the official examples, fixed as BUILD-21**
|
|
49
56
|
- Why it mattered: round-tripping a diagram through the editor flattened `config:`-nested frontmatter to top-level keys Mermaid ignores (silently killing the author's layout/look request on interop), duplicated `%%{init}%%` directives into synthesized frontmatter, and dropped leading comments.
|
|
50
57
|
- Current coverage: `src/__tests__/agent-wrapper-fidelity.test.ts` pins byte-verbatim wrapper round-trip (frontmatter, directives incl. multiline, leading comments, combined), mutation wrapper preservation, canonical-mode config nesting + directive folding, and the `COMMENT_DROPPED` lint matrix.
|
|
@@ -58,19 +65,17 @@ A May 2026 GitHub issue/PR search found recurring layout-quality themes in both
|
|
|
58
65
|
- [mermaid-js/mermaid#5060 — Avoidable overlapping curves in flow-chart](https://github.com/mermaid-js/mermaid/issues/5060)
|
|
59
66
|
- Fixture status: `src/__tests__/aesthetic-issue-regressions.test.ts` renders repeated parallel labeled edges and asserts distinct edge paths, zero crossings, no hard defects, and separated label boxes.
|
|
60
67
|
- [mermaid-js/mermaid#6046 — subgraph links should affect positioning more than inter-graph links](https://github.com/mermaid-js/mermaid/issues/6046)
|
|
61
|
-
-
|
|
62
|
-
- [mermaid-js/mermaid#7492 — C4 overlapping labels/text overflow/crossing arrows](https://github.com/mermaid-js/mermaid/issues/7492)
|
|
63
|
-
- Fixture idea: labels near containers. Assert text stays inside boxes and edge labels keep minimum clearance from unrelated nodes.
|
|
68
|
+
- Candidate fixture evidence: nested subgraphs with invisible/loose links; group order follows source intent and cross-group edges do not dominate internal layout.
|
|
64
69
|
- [mermaid-js/mermaid#2792 — graph lines sometimes overlap boxes](https://github.com/mermaid-js/mermaid/issues/2792)
|
|
65
70
|
- Fixture status: `src/__tests__/aesthetic-issue-regressions.test.ts` renders a transitive route and asserts the ugly-detector reports no edge-through-node defect.
|
|
66
71
|
- [lukilabs/beautiful-mermaid#83 — TD/TB flowchart layout flipping horizontal](https://github.com/lukilabs/beautiful-mermaid/issues/83)
|
|
67
|
-
-
|
|
72
|
+
- Candidate fixture evidence: vertical process with repeated feedback edges; TD/TB diagrams remain height-dominant or within a bounded aspect ratio.
|
|
68
73
|
- [lukilabs/beautiful-mermaid#68 — fan-in groups not target-aware](https://github.com/lukilabs/beautiful-mermaid/issues/68)
|
|
69
|
-
-
|
|
74
|
+
- Candidate fixture evidence: multiple roots feeding separate targets; roots cluster by target and unrelated routes do not share misleading trunks.
|
|
70
75
|
- [lukilabs/beautiful-mermaid#63 — misleading edge overlap in routing](https://github.com/lukilabs/beautiful-mermaid/pull/63)
|
|
71
|
-
-
|
|
76
|
+
- Candidate fixture evidence: two fan-in edges followed by two fan-out edges; an outgoing branch does not visually reuse an unrelated incoming corridor.
|
|
72
77
|
- [lukilabs/beautiful-mermaid#89 — CJK subgraph title layout drift](https://github.com/lukilabs/beautiful-mermaid/issues/89)
|
|
73
|
-
-
|
|
78
|
+
- Candidate fixture evidence: fullwidth group labels; group header bounds account for CJK width.
|
|
74
79
|
- [lukilabs/beautiful-mermaid#121 — ER/class ASCII labels truncated/overlapping](https://github.com/lukilabs/beautiful-mermaid/issues/121)
|
|
75
80
|
- Fixture status: representative class/ER golden files now assert labels survive and connectors remain attached; keep this theme in the generated matrix for longer label/attribute variants.
|
|
76
81
|
|
|
@@ -100,14 +105,11 @@ deferred, and policy-out-of-scope cases remain recorded below.
|
|
|
100
105
|
whitespace + aspect — `agent-quality.test.ts`), `#1301` (long-range Gantt
|
|
101
106
|
axis labels stay clear of task bars — `gantt-layout.test.ts`), and `#1765` (activation/note/block
|
|
102
107
|
clearance — `sequence-layout.test.ts`).
|
|
103
|
-
- **`#
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
(adopt only if Mermaid core standardizes a `config:` key — see C6); `#5420`
|
|
109
|
-
is out of scope (the agent loop is the substitute — see C1). Neither is a
|
|
110
|
-
bug we can regression-guard, because not implementing them is the decision.
|
|
108
|
+
- **`#3723` (same-rank constraint)** — planned under `BUILD-24` as typed
|
|
109
|
+
request/mutation metadata, not new Mermaid syntax; its fixture lands with
|
|
110
|
+
that implementation. **`#5420` (manual node positioning)** remains out of
|
|
111
|
+
scope: arbitrary coordinates and dragging are distinct from structural
|
|
112
|
+
auto-layout constraints. There is therefore no #5420 regression fixture.
|
|
111
113
|
|
|
112
114
|
These guards assert "Agentic Mermaid does not exhibit the complaint," not
|
|
113
115
|
"the upstream Mermaid bug is fixed" — every cited issue is a defect in
|
|
@@ -125,7 +127,7 @@ Current useful heuristics:
|
|
|
125
127
|
- layout-quality heuristic tests for declared-direction progress (`TD`/`BT`/`LR`/`RL`), edge-vs-node collisions excluding attached endpoints, feedback-process cleanliness, root node vs top-level subgraph source order, and self-loop clearance;
|
|
126
128
|
- PNG/SVG screenshot comparison for artifacts that layout JSON cannot see, such as rounded-fill raster artifacts.
|
|
127
129
|
|
|
128
|
-
|
|
130
|
+
Candidate heuristic evidence (unscheduled):
|
|
129
131
|
|
|
130
132
|
- route corridor reuse by unrelated edge families;
|
|
131
133
|
- target-aware fan-in/fan-out clustering score;
|
|
@@ -145,12 +147,17 @@ practitioner guides consistently name these as the top flowchart mistakes):
|
|
|
145
147
|
fits issue #26 workstream 14 as an analysis fact alongside the existing
|
|
146
148
|
graph entry/feedback-edge outputs, not as a hard error.
|
|
147
149
|
|
|
148
|
-
|
|
150
|
+
If promoted through root `TODO.md`, these could drive a generated fixture matrix
|
|
151
|
+
varying direction, feedback-edge density, self-loops, parallel edges, label
|
|
152
|
+
length, CJK labels, nested subgraphs, fan-in/fan-out shape, and styling. Each
|
|
153
|
+
case would assert semantic preservation first, then one or more layout
|
|
154
|
+
heuristics; screenshot tests would be reserved for genuinely pixel/raster-level
|
|
155
|
+
artifacts.
|
|
149
156
|
|
|
150
157
|
## Test-design rules for issue fixtures
|
|
151
158
|
|
|
152
159
|
- Prefer smallest meaningful source examples over screenshots alone.
|
|
153
160
|
- Assert semantics first: labels, edges, groups, source-preserved metadata.
|
|
154
|
-
-
|
|
161
|
+
- Use screenshot/SVG regression only when geometry/visual polish is the bug.
|
|
155
162
|
- For unsupported Mermaid syntax, assert opaque/source-preserved fallback rather than lossy normalization.
|
|
156
163
|
- For security issues, assert both removal of dangerous refs and preservation of safe SVG output.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# MCP Code Mode rationale
|
|
2
2
|
|
|
3
|
-
Local `agentic-mermaid-mcp` is intentionally Code Mode first. Its primary tool is `execute(code)`, which runs synchronous JavaScript against the typed `mermaid.*` SDK in a local `node:vm` sandbox. This is a local implementation inspired by Code Mode as a product shape; it is not Cloudflare Codemode, not backed by `@cloudflare/codemode`, and not an OS/container security boundary. The local helper tools (`render_png
|
|
3
|
+
Local `agentic-mermaid-mcp` is intentionally Code Mode first. Its primary tool is `execute(code)`, which runs synchronous JavaScript against the typed `mermaid.*` SDK in a local `node:vm` sandbox. This is a local implementation inspired by Code Mode as a product shape; it is not Cloudflare Codemode, not backed by `@cloudflare/codemode`, and not an OS/container security boundary. The local helper tools (`describe_sdk`, `render_png`, and `describe`) are narrow conveniences, not a second full authoring API.
|
|
4
4
|
|
|
5
|
-
There is now also a **hosted** MCP at `https://agentic-mermaid.dev/mcp` (stateless Streamable HTTP; see [
|
|
5
|
+
There is now also a **hosted** MCP at `https://agentic-mermaid.dev/mcp` (stateless Streamable HTTP; see the [as-built record](./project/archive/hosted-mcp-cloudflare-plan.md)). It keeps `execute` but runs agent code in a per-request Cloudflare Dynamic Worker isolate (`globalOutbound: null`, empty env, `cpuMs` budget) instead of a local `node:vm` — there the isolate configuration *is* the security boundary — and adds `describe_sdk` plus direct `render_svg`/`render_ascii`/`render_png`/`verify`/`describe` tools so schema discovery and common render/verify paths avoid a billable isolate, plus the declarative `mutate`/`build` tools (see below). Both share the same hardened `mermaid.*` facade; their semantics are pinned against each other by a differential test suite, with one explicit host-policy divergence: both hosted `renderMermaidSVG*` execute methods and the direct `render_svg` tool force `security: 'strict'` and `embedFontImport: false`, even if agent code asks for weaker values. Local Code Mode retains the library's caller-selectable policy.
|
|
6
6
|
|
|
7
7
|
## Why the MCP server exists
|
|
8
8
|
|
|
@@ -41,14 +41,21 @@ gets wrong through `execute`. For everything richer, use `execute`, the CLI
|
|
|
41
41
|
|
|
42
42
|
## What the non-Code-Mode MCP tools are for
|
|
43
43
|
|
|
44
|
-
Local MCP keeps only
|
|
44
|
+
Local MCP keeps only three helpers:
|
|
45
45
|
|
|
46
|
-
- `
|
|
46
|
+
- `describe_sdk({ family, detail })` returns version-matched mutation operations for one family without running Code Mode. `detail: "signatures"` returns a compact menu; `detail: "fields"` returns the exact field schema. The initial `execute` declaration stays limited to the core SDK, while `mermaid.describeOps` and `mermaid.opSignatures` expose the same registry inside an execution.
|
|
47
|
+
|
|
48
|
+
- `render_png(source)` exists because PNG is binary output and returning base64 from a dedicated MCP tool is simpler than putting binary handling into Code Mode snippets. Local and hosted tools share portable `scale`, `background`, and mutually exclusive `fitTo.width`/`fitTo.height` controls; local additionally accepts trusted-host `fontDirs`/`loadSystemFonts` remedies and returns deterministic configuration/font-coverage warnings. For clients that cannot comfortably carry large base64 payloads, `render_png({source, output:"file"})` writes a managed local artifact and `output:"url"` returns an HTTP-served artifact when the server runs with HTTP/SSE transport. Because those modes create managed files, the local tool is annotated as non-read-only and non-idempotent.
|
|
47
49
|
- `describe(source)` exists because one-shot natural-language summaries are common for screen readers, docs, and context compaction.
|
|
48
50
|
|
|
49
|
-
The hosted endpoint adds direct pure tools (`render_svg`, `render_ascii`, `render_png`, `verify`, `describe`) because every hosted `execute`
|
|
51
|
+
The hosted endpoint adds the same direct discovery tool and direct pure tools (`render_svg`, `render_ascii`, `render_png`, `verify`, `describe`) because every hosted `execute` contacts a Dynamic Worker; schema discovery and common render/verify calls should be ordinary Worker invocations eligible for the private compute cache. Hosted `mutate` and `build` are the only declarative authoring tools, and they exist to apply typed op lists with the verify-before-emit contract without asking a weaker model to write JavaScript. They do not introduce a separate mutation engine.
|
|
52
|
+
|
|
53
|
+
Direct render tools accept shared render fields only through the canonical
|
|
54
|
+
nested `options` object, generated from the shared RenderOptions descriptors.
|
|
55
|
+
Palette selection uses `options.style`; `theme` and top-level
|
|
56
|
+
`bg`/`fg`/`style`/`seed` are not tool inputs.
|
|
50
57
|
|
|
51
|
-
Local managed artifacts are generated under
|
|
58
|
+
Local managed artifacts are generated under one exclusively owned server artifact directory with safe names, per-file and aggregate limits, persisted TTL cleanup, MIME type, byte count, and SHA-256 integrity metadata; they are not arbitrary user-chosen file writes. A second live owner fails closed instead of racing a stale manifest. Hosted `render_png` returns base64 only.
|
|
52
59
|
|
|
53
60
|
## Equivalence example
|
|
54
61
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
`agentic-mermaid-mcp` defaults to stdio for local MCP clients. Use HTTP/SSE only when a client needs a reachable endpoint or when PNG artifacts should be fetched by file/URL instead of returned as large base64 strings.
|
|
4
4
|
|
|
5
|
-
> Looking for a zero-setup endpoint? A **hosted** MCP already runs at `https://agentic-mermaid.dev/mcp` (`claude mcp add --transport http agentic-mermaid https://agentic-mermaid.dev/mcp`). It is a different implementation — stateless Streamable HTTP, Cloudflare-backed, tools `execute`/`render_svg`/`render_ascii`/`render_png`/`verify`/`describe`/`mutate`/`build`, inputs capped at 64KB, and no file/URL PNG artifacts (base64 only). See [
|
|
5
|
+
> Looking for a zero-setup endpoint? A **hosted** MCP already runs at `https://agentic-mermaid.dev/mcp` (`claude mcp add --transport http agentic-mermaid https://agentic-mermaid.dev/mcp`). It is a different implementation — stateless Streamable HTTP, Cloudflare-backed, tools `execute`/`describe_sdk`/`render_svg`/`render_ascii`/`render_png`/`verify`/`describe`/`mutate`/`build`, inputs capped at 64KB, and no file/URL PNG artifacts (base64 only). See the [as-built record](./project/archive/hosted-mcp-cloudflare-plan.md). Run the local server below when you need file/URL artifacts, larger inputs, offline use, or your own auth.
|
|
6
6
|
>
|
|
7
|
-
> **Privacy:** every hosted call (`execute`, `render_*`, `verify`, `describe`, `mutate`, `build`) sends your diagram source or code to the agentic-mermaid.dev server
|
|
7
|
+
> **Privacy and caching:** every hosted call (`execute`, `render_*`, `verify`, `describe`, `mutate`, `build`) sends your diagram source or code to the agentic-mermaid.dev server. Successful deterministic pure-tool results may be reused by a private server-side Workers Cache for up to 24 hours; `execute`, `mutate`, and `build` bypass it. The JSON-RPC HTTP response itself is always `cache-control: no-store`; `x-agentic-mermaid-compute-cache` reports `hit`, `miss`, `mixed`, `bypass`, or `disabled`. For diagrams that must not leave your machine, use the library, the CLI, or the local stdio/HTTP server on this page — the pipeline is fully local and needs no network.
|
|
8
8
|
|
|
9
9
|
## Which endpoint returns plain JSON?
|
|
10
10
|
|
|
@@ -40,11 +40,11 @@ HTTP endpoints:
|
|
|
40
40
|
|---|---|
|
|
41
41
|
| `GET /health` | Readiness probe, returns `{ "ok": true }`. |
|
|
42
42
|
| `GET /sse` | MCP SSE session endpoint. First event contains the `/message?sessionId=...` URL. |
|
|
43
|
-
| `POST /message?sessionId=...` | JSON-RPC requests for an SSE session.
|
|
43
|
+
| `POST /message?sessionId=...` | JSON-RPC requests for an SSE session. Requests get `202 {"ok":true}` while the JSON-RPC response is emitted on the SSE stream; notifications get an empty `202` and no stream frame. |
|
|
44
44
|
| `POST /rpc` | Direct JSON-RPC endpoint for tests/scripts/simple integrations. Replies with plain `application/json` (no SSE framing). |
|
|
45
45
|
| `GET /artifacts/<name>` | Fetch managed artifacts returned by `render_png` `output: "url"`. |
|
|
46
46
|
|
|
47
|
-
`/rpc` and `/message` require `content-type: application/json`; browser-simple `text/plain` form posts are rejected. Non-loopback hosts require `Authorization: Bearer <token
|
|
47
|
+
`/rpc` and `/message` require `content-type: application/json`; browser-simple `text/plain` form posts are rejected. Non-loopback hosts require `Authorization: Bearer <token>` on `/rpc`, `/sse`, `/message`, and `/artifacts/*`, and the same Origin check covers those routes. SSE sessions are capped (32 by default); an exhausted server returns `503` instead of retaining another session.
|
|
48
48
|
|
|
49
49
|
## Direct JSON-RPC examples: `render_png`
|
|
50
50
|
|
|
@@ -60,7 +60,9 @@ Request:
|
|
|
60
60
|
"params": {
|
|
61
61
|
"name": "render_png",
|
|
62
62
|
"arguments": {
|
|
63
|
-
"source": "flowchart TD\n A --> B"
|
|
63
|
+
"source": "flowchart TD\n A --> B",
|
|
64
|
+
"fontDirs": ["./fonts"],
|
|
65
|
+
"loadSystemFonts": false
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -84,7 +86,7 @@ Response shape:
|
|
|
84
86
|
"content": [
|
|
85
87
|
{
|
|
86
88
|
"type": "text",
|
|
87
|
-
"text": "{\"ok\":true,\"png_base64\":\"iVBORw0KGgo...\"}"
|
|
89
|
+
"text": "{\"ok\":true,\"png_base64\":\"iVBORw0KGgo...\",\"warnings\":[]}"
|
|
88
90
|
}
|
|
89
91
|
],
|
|
90
92
|
"isError": false
|
|
@@ -92,6 +94,8 @@ Response shape:
|
|
|
92
94
|
}
|
|
93
95
|
```
|
|
94
96
|
|
|
97
|
+
`warnings` always appears. `PNG_FONT_COVERAGE` names missing CJK/emoji coverage and points to `fontDirs`/`loadSystemFonts`; source configuration diagnostics use the same deterministic warning envelope.
|
|
98
|
+
|
|
95
99
|
### File output
|
|
96
100
|
|
|
97
101
|
Request:
|
|
@@ -166,7 +170,7 @@ Fetch the artifact:
|
|
|
166
170
|
curl -L -o diagram.png 'http://127.0.0.1:3000/artifacts/<name>.png'
|
|
167
171
|
```
|
|
168
172
|
|
|
169
|
-
If the server is behind a reverse proxy, set `--public-url https://example.com/artifacts` so returned URLs are externally reachable.
|
|
173
|
+
If the server is behind a reverse proxy, set `--public-url https://example.com/artifacts` so returned URLs are externally reachable. The URL must be absolute HTTP(S); its origin (here `https://example.com`) is also accepted by the `/rpc`, `/sse`, `/message`, and `/artifacts/*` browser-origin guard. Other browser origins remain forbidden.
|
|
170
174
|
|
|
171
175
|
## Sample SSE flow
|
|
172
176
|
|
|
@@ -202,14 +206,16 @@ data: {"jsonrpc":"2.0","id":4,"result":{}}
|
|
|
202
206
|
|
|
203
207
|
| Option | Default | Purpose |
|
|
204
208
|
|---|---:|---|
|
|
205
|
-
| `--transport stdio\|http` | `stdio` | Select stdio or HTTP
|
|
209
|
+
| `--transport stdio\|http` | `stdio` | Select stdio or HTTP transport. |
|
|
206
210
|
| `--host <host>` | `127.0.0.1` | HTTP bind host. Non-loopback hosts require `--auth-token`. |
|
|
207
211
|
| `--port <port>` | `3000` | HTTP bind port. Use `0` for an ephemeral test port. |
|
|
208
212
|
| `--artifact-dir <dir>` | OS temp dir | Directory for managed file/URL artifacts. Files use generated safe names. |
|
|
209
|
-
| `--public-url <url>` | `http://<host>:<port>/artifacts` |
|
|
210
|
-
| `--auth-token <token>` | unset | Bearer token required for
|
|
213
|
+
| `--public-url <url>` | `http://<host>:<port>/artifacts` | Absolute HTTP(S) prefix returned by `output: "url"`; its origin is accepted by the HTTP/SSE browser-origin guard. |
|
|
214
|
+
| `--auth-token <token>` | unset | Bearer token required for every non-health HTTP route when binding non-loopback. Optional on loopback. |
|
|
211
215
|
| `--max-artifact-bytes <n>` | `20971520` | Maximum bytes for a single managed artifact. |
|
|
212
|
-
| `--artifact-
|
|
216
|
+
| `--max-artifact-total-bytes <n>` | `209715200` | Aggregate byte budget for unexpired managed artifacts. |
|
|
217
|
+
| `--max-artifacts <n>` | `1000` | Maximum number of unexpired managed artifacts. |
|
|
218
|
+
| `--artifact-ttl-ms <n>` | `3600000` | How long managed artifacts remain fetchable. |
|
|
213
219
|
| `--max-rpc-body-bytes <n>` | `1048576` | Maximum HTTP JSON-RPC request body size. |
|
|
214
220
|
| `--max-sandbox-timeout-ms <n>` | `30000` | Maximum `execute` timeout accepted over any transport. |
|
|
215
221
|
|
|
@@ -217,7 +223,8 @@ data: {"jsonrpc":"2.0","id":4,"result":{}}
|
|
|
217
223
|
|
|
218
224
|
- HTTP binds to loopback by default.
|
|
219
225
|
- Non-loopback binding requires `--auth-token`.
|
|
220
|
-
- `/rpc` and `/message` reject non-JSON content types
|
|
226
|
+
- `/rpc` and `/message` reject non-JSON content types; every non-health route rejects browser origins other than the internal server or configured public origin.
|
|
221
227
|
- Request bodies and artifact sizes are bounded.
|
|
222
|
-
- URL/file artifacts
|
|
228
|
+
- URL/file artifacts use a persisted, integrity-checked manifest; aggregate quotas and TTL survive clean restarts, and cache headers never outlive the stored expiry.
|
|
229
|
+
- Exactly one live store owns an artifact directory. A second server fails before reading or writing state, preventing stale-manifest quota bypass. After an unclean stop, remove `.agentic-mermaid-artifacts-v1.lock` only after confirming no server still uses that directory.
|
|
223
230
|
- `execute(code)` still runs in local `node:vm`, not an OS/container security boundary. Do not expose HTTP/SSE to hostile users without an outer isolation layer.
|