agentic-mermaid 0.4.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_NATIVE.md +94 -627
- package/CHANGELOG.md +651 -0
- package/Instructions_for_agents.md +44 -23
- package/LICENSES/Khroma-MIT.txt +21 -0
- package/LICENSES/Mermaid-MIT.txt +21 -0
- package/LICENSES/es-toolkit-MIT.txt +21 -0
- package/LICENSES/pele-MIT.txt +40 -0
- package/LICENSES/zenuml-core-MIT.txt +21 -0
- package/README.md +93 -50
- package/SECURITY.md +28 -12
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/assets/hero.png +0 -0
- package/dist/agent-core.d.ts +478 -210
- package/dist/agent-core.js +1 -396
- package/dist/agent.d.ts +17 -8
- package/dist/agent.js +1 -408
- package/dist/agentic-mermaid-mcp.js +1 -11
- package/dist/am.js +1 -34562
- package/dist/browser-lazy/chunks/agentic-producer-core-CC6OOLDW.js +1 -0
- package/dist/browser-lazy/chunks/architecture-QUFVKYJR.js +13 -0
- package/dist/browser-lazy/chunks/block-6J3Q63BO.js +11 -0
- package/dist/browser-lazy/chunks/builtin-backends-7SOZZHPF.js +12 -0
- package/dist/browser-lazy/chunks/c4-SQVBZAKJ.js +10 -0
- package/dist/browser-lazy/chunks/chunk-2GPK4VFF.js +5 -0
- package/dist/browser-lazy/chunks/chunk-2I4UPL7Q.js +3 -0
- package/dist/browser-lazy/chunks/chunk-2SH76OTH.js +1 -0
- package/dist/browser-lazy/chunks/chunk-2UIA2IME.js +3 -0
- package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5B2Z7575.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5FQ534HP.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5UVGUSD6.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5X6MJX3H.js +1 -0
- package/dist/browser-lazy/chunks/chunk-AMJLVPUB.js +4 -0
- package/dist/browser-lazy/chunks/chunk-BU5LHXNJ.js +3 -0
- package/dist/browser-lazy/chunks/chunk-BY2CPG6B.js +1 -0
- package/dist/browser-lazy/chunks/chunk-CN7WTBWB.js +1 -0
- package/dist/browser-lazy/chunks/chunk-CQE4HQEW.js +1 -0
- package/dist/browser-lazy/chunks/chunk-CSFUKSU6.js +1 -0
- package/dist/browser-lazy/chunks/chunk-DF6765YX.js +17 -0
- package/dist/browser-lazy/chunks/chunk-E2WMJZNM.js +1 -0
- package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +6 -0
- package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +1 -0
- package/dist/browser-lazy/chunks/chunk-HLWUNUCM.js +1 -0
- package/dist/browser-lazy/chunks/chunk-ICC7HBJX.js +1 -0
- package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +20 -0
- package/dist/browser-lazy/chunks/chunk-J7FFAFQF.js +1 -0
- package/dist/browser-lazy/chunks/chunk-LH7HUDKW.js +1 -0
- package/dist/browser-lazy/chunks/chunk-N5ELX7LR.js +2 -0
- package/dist/browser-lazy/chunks/chunk-NMQQMRIR.js +1 -0
- package/dist/browser-lazy/chunks/chunk-NO7ZIVRU.js +1 -0
- package/dist/browser-lazy/chunks/chunk-OZ443IVJ.js +16 -0
- package/dist/browser-lazy/chunks/chunk-PQGPS2YV.js +7 -0
- package/dist/browser-lazy/chunks/chunk-QA6GJQ4X.js +1 -0
- package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +1 -0
- package/dist/browser-lazy/chunks/chunk-SZELX2EJ.js +1 -0
- package/dist/browser-lazy/chunks/chunk-TYZOZXUJ.js +22 -0
- package/dist/browser-lazy/chunks/chunk-UL6NDWLL.js +1 -0
- package/dist/browser-lazy/chunks/chunk-VQYYGAXP.js +1 -0
- package/dist/browser-lazy/chunks/chunk-VWVZGQE2.js +1 -0
- package/dist/browser-lazy/chunks/chunk-X2UYKWKM.js +4 -0
- package/dist/browser-lazy/chunks/chunk-YCEICNM6.js +1 -0
- package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +20 -0
- package/dist/browser-lazy/chunks/class-5QA4SCTS.js +13 -0
- package/dist/browser-lazy/chunks/decode-63UIZGD2.js +1 -0
- package/dist/browser-lazy/chunks/elk.bundled-L4CADV5W.js +24 -0
- package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +11 -0
- package/dist/browser-lazy/chunks/eventmodeling-2BPLHWRN.js +19 -0
- package/dist/browser-lazy/chunks/flowchart-NEIMZTB5.js +4 -0
- package/dist/browser-lazy/chunks/forest-implementation-AEP24AIP.js +1 -0
- package/dist/browser-lazy/chunks/gantt-RDPIFYAF.js +11 -0
- package/dist/browser-lazy/chunks/gitgraph-N4Y5RYB7.js +9 -0
- package/dist/browser-lazy/chunks/ishikawa-LD3YBDJN.js +6 -0
- package/dist/browser-lazy/chunks/journey-6YQR5DJX.js +16 -0
- package/dist/browser-lazy/chunks/kanban-PLMJ7NBW.js +20 -0
- package/dist/browser-lazy/chunks/mermaid-yaml-runtime-QVYX4EWK.js +136 -0
- package/dist/browser-lazy/chunks/mindmap-K2UBFO3Y.js +12 -0
- package/dist/browser-lazy/chunks/packet-CUW4QY6Y.js +7 -0
- package/dist/browser-lazy/chunks/pie-7F7UUCG3.js +15 -0
- package/dist/browser-lazy/chunks/quadrant-TOONO2WC.js +10 -0
- package/dist/browser-lazy/chunks/radar-J6JVWVAX.js +16 -0
- package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +3 -0
- package/dist/browser-lazy/chunks/requirement-CMAKDJPO.js +19 -0
- package/dist/browser-lazy/chunks/sankey-AWXQEP3F.js +13 -0
- package/dist/browser-lazy/chunks/sequence-Q2RJRB4L.js +5 -0
- package/dist/browser-lazy/chunks/state-WRBFQEDX.js +4 -0
- package/dist/browser-lazy/chunks/timeline-D2KILFXM.js +6 -0
- package/dist/browser-lazy/chunks/treemap-N3VYX5D4.js +6 -0
- package/dist/browser-lazy/chunks/xychart-G73OGK66.js +16 -0
- package/dist/browser-lazy/chunks/zenuml-H4BXNYXR.js +16 -0
- package/dist/browser-lazy/index.d.ts +544 -275
- package/dist/browser-lazy/index.js +1 -1
- package/dist/browser.global.js +802 -565
- package/dist/chunk-3LGLPG33.js +2 -0
- package/dist/chunk-7CRDX2QR.js +2 -0
- package/dist/chunk-7PPW2BMO.js +2 -0
- package/dist/chunk-DQDKA5ND.js +2 -0
- package/dist/chunk-EHCMJUMD.js +52 -0
- package/dist/chunk-GVCHLSHH.js +4 -0
- package/dist/chunk-H3NCS2XZ.js +19 -0
- package/dist/chunk-JZOJ4YGS.js +201 -0
- package/dist/chunk-MKE7GNYU.js +146 -0
- package/dist/chunk-NKNFOREZ.js +2 -0
- package/dist/chunk-O7H2UX5K.js +2 -0
- package/dist/chunk-OMY6NRQD.js +58 -0
- package/dist/chunk-UA234O4M.js +4 -0
- package/dist/chunk-VUFVLGTH.js +2 -0
- package/dist/chunk-XU5LPD2D.js +2 -0
- package/dist/cli-YGGTJZH7.js +226 -0
- package/dist/elk-constructor.js +2 -0
- package/dist/elk-constructor.node.js +11 -0
- package/dist/index-EeXqJXr5.d.ts +1223 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -334
- package/dist/jsonl-RPJY6YWO.js +2 -0
- package/dist/mcp-cli-63DYXTVD.js +2 -0
- package/dist/{index-BGA_-6LV.d.ts → paint-certification-6rwQjIv_.d.ts} +5283 -6173
- package/dist/server-5NEOHOFS.js +524 -0
- package/dist/svg-styles-BdnoM7AT.d.ts +724 -0
- package/dist/svg-styles.d.ts +1 -0
- package/dist/svg-styles.js +2 -0
- package/dist/svg.d.ts +13 -0
- package/dist/svg.js +2 -0
- package/dist/types-BcS52Mjt.d.ts +1360 -0
- package/dist/zenuml/chunks/appearance-UOQ5KA6O.js +1 -0
- package/dist/zenuml/chunks/builtin-backends-KDKE7YHO.js +12 -0
- package/dist/zenuml/chunks/chunk-42DXZ5C6.js +4 -0
- package/dist/zenuml/chunks/chunk-7TVYPTDW.js +1 -0
- package/dist/zenuml/chunks/chunk-EVPSMEKN.js +1 -0
- package/dist/zenuml/chunks/chunk-OXQWRSBM.js +20 -0
- package/dist/zenuml/chunks/chunk-QWX77U7G.js +2 -0
- package/dist/zenuml/chunks/chunk-RLJEI7YN.js +29 -0
- package/dist/zenuml/chunks/chunk-RZ6XK5CD.js +29 -0
- package/dist/zenuml/chunks/decode-BWERFDGK.js +1 -0
- package/dist/zenuml/chunks/mermaid-yaml-runtime-KZVU74WU.js +136 -0
- package/dist/zenuml/chunks/render-core-V5RQ737O.js +3 -0
- package/dist/zenuml/chunks/zenuml-EA2ZFRUX.js +20 -0
- package/dist/zenuml-frame.global.js +3626 -0
- package/dist/zenuml.d.ts +83 -0
- package/dist/zenuml.js +1 -0
- package/docs/MCP-DIRECTORY-LISTINGS.md +5 -1
- package/docs/README.md +59 -103
- package/docs/agent-api-cookbook.md +26 -16
- package/docs/agent-mutation-policy.md +86 -15
- package/docs/agent-workflow-examples.md +1 -1
- package/docs/api-advanced.md +385 -0
- package/docs/api.md +320 -366
- package/docs/ascii.md +40 -4
- package/docs/browser.md +46 -7
- package/docs/choosing-a-diagram.md +148 -0
- package/docs/code-mode-impact.md +1 -0
- package/docs/comparison.md +244 -28
- package/docs/computational-aesthetics-prototype-plan.md +10 -10
- package/docs/config.md +60 -2
- package/docs/custom-fonts.md +78 -21
- package/docs/diagram-families.md +160 -10
- package/docs/eventmodeling-and-zenuml.md +165 -0
- package/docs/features.md +21 -19
- package/docs/fork-differences.md +105 -32
- package/docs/getting-started.md +56 -51
- package/docs/layout-certification.md +126 -0
- package/docs/mcp-code-mode-rationale.md +20 -12
- package/docs/mcp-http-transport.md +14 -8
- package/docs/quality.md +145 -15
- package/docs/react.md +76 -31
- package/docs/style-authoring.md +23 -11
- package/docs/svg-semantic-contract.md +104 -4
- package/docs/testing-strategy.md +684 -126
- package/docs/theming.md +27 -8
- package/examples/styles/readme-hero.md +25 -0
- package/examples/styles/readme-hero.mmd +13 -0
- package/examples/styles/readme-hero.style.json +7 -0
- package/package.json +114 -57
- package/server.json +2 -2
- package/skills/agentic-mermaid-diagram-workflow/SKILL.md +26 -8
- package/skills/agentic-mermaid-diagram-workflow/references/cli.md +13 -3
- package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +2 -1
- package/skills/agentic-mermaid-diagram-workflow/references/flowchart.md +9 -6
- package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +1 -0
- package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +4 -3
- package/skills/agentic-mermaid-diagram-workflow/references/timeline.md +7 -6
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/agentflow.md +574 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/architecture.md +10 -2
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/c4.md +18 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/classDiagram.md +123 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/cynefin.md +6 -1
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/entityRelationshipDiagram.md +129 -9
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/eventmodeling.md +22 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/flowchart.md +188 -60
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/gitgraph.md +13 -7
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/mindmap.md +110 -1
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/packet.md +38 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/requirementDiagram.md +115 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/sequenceDiagram.md +101 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/stateDiagram.md +87 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/swimlanes.md +105 -2
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/timeline.md +12 -6
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/usecase.md +953 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/venn.md +77 -0
- package/skills/agentic-mermaid-diagram-workflow/references/upstream/xyChart.md +1 -1
- package/dist/browser-lazy/chunks/architecture-KTHE2HX3.js +0 -31
- package/dist/browser-lazy/chunks/chunk-2XCPFAD5.js +0 -46
- package/dist/browser-lazy/chunks/chunk-3H4F7RBT.js +0 -1
- package/dist/browser-lazy/chunks/chunk-4EVLW2NJ.js +0 -1
- package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +0 -1
- package/dist/browser-lazy/chunks/chunk-6OAPWSDO.js +0 -1
- package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +0 -143
- package/dist/browser-lazy/chunks/chunk-C7FJO2I3.js +0 -4
- package/dist/browser-lazy/chunks/chunk-D3XXDKIO.js +0 -1
- package/dist/browser-lazy/chunks/chunk-DXA5WL7H.js +0 -4
- package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +0 -1
- package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +0 -2
- package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +0 -2
- package/dist/browser-lazy/chunks/chunk-G6OLSHRG.js +0 -7
- package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
- package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +0 -1
- package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +0 -1
- package/dist/browser-lazy/chunks/chunk-L227EPFP.js +0 -11
- package/dist/browser-lazy/chunks/chunk-LNIHDJSF.js +0 -1
- package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +0 -1
- package/dist/browser-lazy/chunks/chunk-NZRUMODH.js +0 -1
- package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +0 -1
- package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +0 -1
- package/dist/browser-lazy/chunks/chunk-PXKL3O6H.js +0 -1
- package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +0 -1
- package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +0 -1
- package/dist/browser-lazy/chunks/chunk-SUFMSWTX.js +0 -1
- package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +0 -3
- package/dist/browser-lazy/chunks/chunk-UAEZO5VL.js +0 -1
- package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +0 -1
- package/dist/browser-lazy/chunks/chunk-X64T74C5.js +0 -24
- package/dist/browser-lazy/chunks/class-F7R6TJ73.js +0 -9
- package/dist/browser-lazy/chunks/er-BDK7CM5L.js +0 -9
- package/dist/browser-lazy/chunks/flowchart-KFU6XV7S.js +0 -4
- package/dist/browser-lazy/chunks/gantt-I64VVDSP.js +0 -28
- package/dist/browser-lazy/chunks/gitgraph-EDUVJ5IJ.js +0 -8
- package/dist/browser-lazy/chunks/journey-TLO2RNM3.js +0 -40
- package/dist/browser-lazy/chunks/mindmap-OJCNDYPM.js +0 -9
- package/dist/browser-lazy/chunks/pie-HVG6XO7K.js +0 -19
- package/dist/browser-lazy/chunks/quadrant-U6S2L4MJ.js +0 -24
- package/dist/browser-lazy/chunks/radar-ZDLOBTVG.js +0 -32
- package/dist/browser-lazy/chunks/render-core-Y2DFNMQG.js +0 -12
- package/dist/browser-lazy/chunks/sequence-Z4WFS3VB.js +0 -12
- package/dist/browser-lazy/chunks/state-2HV2YGN3.js +0 -4
- package/dist/browser-lazy/chunks/timeline-XM4UFPOC.js +0 -20
- package/dist/browser-lazy/chunks/xychart-7JDHWTQY.js +0 -36
- package/dist/chunk-GGXCNCNA.js +0 -4118
- package/dist/chunk-IVD4NXNE.js +0 -615
- package/dist/chunk-JDMRPUAG.js +0 -37
- package/dist/chunk-JWAAW3FH.js +0 -149
- package/dist/chunk-LCGBT32P.js +0 -62036
- package/dist/chunk-RWMZRUIC.js +0 -4715
- package/dist/mcp-cli-4MLKC3ZH.js +0 -17
- package/docs/mutation-testing.md +0 -285
|
@@ -10,7 +10,16 @@ Do not use the hosted MCP for private diagrams; use the local library, CLI, or s
|
|
|
10
10
|
|
|
11
11
|
## Quick start
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
<!-- BEGIN GENERATED: family-narrowing -->
|
|
14
|
+
Narrowing selects a structured, typed family with an as* helper. It does not select one element or freeze layout coordinates.
|
|
15
|
+
<!-- END GENERATED: family-narrowing -->
|
|
16
|
+
|
|
17
|
+
Use the [library vocabulary](https://agentic-mermaid.dev/docs/api/#vocabulary)
|
|
18
|
+
for family, Scene part and resolved primitive. Keep source objects distinct
|
|
19
|
+
from drawing parts.
|
|
20
|
+
|
|
21
|
+
<!-- complete: hosted-mcp-tools -->
|
|
22
|
+
Choose the narrowest channel. <!-- BEGIN GENERATED: agent-workflow -->New diagrams: author Mermaid source directly, then parse → verify → render or return it. `buildMermaid(kind, ops)` / `createMermaid(kind)` build a diagram from typed ops when you are generating one programmatically (for example, from data). Existing structured diagrams: parse → narrow → mutate → verify → serialize.<!-- END GENERATED: agent-workflow --> Local MCP exposes `mutate` and `build` for atomic JSON edit batches; use `execute` or the library for custom logic. CLI is best for one-shot verify/render/preview. Code Mode exposes `mermaid.*`; library users import the same names from `agentic-mermaid/agent` — including `describeOps(family)` and `opSignatures(family)`, which return each op's exact fields, required-ness, inlined enum values, and constraint/default notes (e.g. journey score `finite number 1..5`, flowchart shape `default: rectangle`) so you can look up an unfamiliar op instead of guessing; use `describeMermaidFacts` / `checkMermaid` when you need semantic read-back such as `edge Processing -> [*] : done`, `member Duck +quack()`, or `task Docs start after core`. A hosted MCP at `agentic-mermaid.dev/mcp` (stateless Streamable HTTP JSON-RPC) exposes `execute` (Code Mode), `describe_sdk` (one family's mutation schema on demand), `render_svg`, `render_ascii`, `render_png`, `verify`, `describe`, and the declarative `mutate` (edit a `source`) and `build` (author from a `family`) — which apply a JSON op list and return `{ok,family,source,verify}`, prescriptive `{ok:false,…,error}` on a bad op; prefer them for structured edits and reserve `execute` for logic the ops do not express — all with 64KB input caps; the call shape is a plain POST (stateless, no initialize handshake): `POST /mcp` with `content-type: application/json` and body `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"verify","arguments":{"source":"flowchart TD\n A --> B"}}}`. Prefer the local library, CLI, or a self-hosted MCP and reach for the hosted endpoint only when you cannot install. Agentic Mermaid outputs ASCII, PNG, and SVG; Unicode text and JSON layout are also available. Flowchart authoring facts: quote any label carrying punctuation (`id["HTTPS /api/sessions*"]`); `\n` inside a quoted label is a line break and canonicalizes to `<br>` on serialize; `subgraph id["Title"] … end` groups nodes; labeled and dotted edges are `A -- "label" --> B`, `A -.-> B`, and `A -. "label" .-> B`. For every other family, read that family's exact header, edge, and relationship syntax from its `example` in `am capabilities --json` (`capabilities.json` `families[].example`) rather than assuming flowchart syntax — e.g. class inheritance `Base <|-- Derived`, ER cardinality `A ||--o{ B : label`, architecture edges `api:R --> L:db`.
|
|
14
23
|
|
|
15
24
|
```ts
|
|
16
25
|
const source = 'flowchart TD\n API --> DB'
|
|
@@ -29,52 +38,64 @@ if (!verify.ok) return { phase: 'verify', warnings: verify.warnings }
|
|
|
29
38
|
return { source: mermaid.serializeMermaid(d1.value) }
|
|
30
39
|
```
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
A new diagram is authored as source, parsed, and verified — no mutation ceremony:
|
|
33
42
|
|
|
34
43
|
```ts
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!built.ok) return { phase: 'build', error: built.error }
|
|
41
|
-
|
|
42
|
-
const check = mermaid.verifyMermaid(built.value)
|
|
44
|
+
const source = 'flowchart LR\n API --> DB'
|
|
45
|
+
const parsed = mermaid.parseRegisteredMermaid(source)
|
|
46
|
+
if (!parsed.ok) return { phase: 'parse', errors: parsed.error }
|
|
47
|
+
|
|
48
|
+
const check = mermaid.verifyMermaid(parsed.value)
|
|
43
49
|
if (!check.ok) return { phase: 'verify', warnings: check.warnings }
|
|
44
50
|
|
|
45
|
-
return { source
|
|
51
|
+
return { source }
|
|
46
52
|
```
|
|
47
53
|
|
|
48
54
|
Before mutating an existing diagram, use the matching narrower advertised by `am capabilities --json` or `describe_sdk` (for example, `asFlowchart` or `asState`). State diagrams own a dedicated body: `asState` narrows them — including concurrency regions, notes, `<<fork>>`/`<<join>>`/`<<choice>>`, history pseudostates, and class/inline paint — and state-shaped ops (`add_state`, `add_transition`, `make_composite`, `add_note`, `set_state_class`, …) apply; `asFlowchart` returns null on a state diagram. Sequence diagrams are segment-preserving: `alt`/`opt`/`loop`/`par` fragments are typed, their messages appear in describe/facts/verify, and fragment/branch/message mutation ops can author and edit them. Other constructs such as `Note`/`box`/`critical`/`activate`/`autonumber`/`title` ride along verbatim; top-level `remove_message`/`set_message_text` indexes remain separate from fragment messages. Only an un-segmentable sequence (e.g. an unbalanced `end`) falls back to opaque. Gantt charts are segment-preserving too: title/section/task ops stay live while calendar directives (`dateFormat`, `excludes`, …), `click` lines, and comments ride along verbatim; gantt rendering never reads the wall clock — pass `ganttToday` to draw the today marker — and the opt-in `gantt.dependencyArrows`/`gantt.criticalPath` render options overlay dependency arrows and critical-path emphasis without any new Mermaid syntax. In Code Mode, SDK-returned diagrams are read-only; structured edits must go through `mermaid.mutate`. Opaque-fallback bodies (any unmodeled syntax) round-trip losslessly as source-level bodies but do not expose structured mutation; return an unsupported-family result unless the task explicitly asks for source-level editing, then re-parse and verify before returning.
|
|
49
55
|
|
|
56
|
+
For an explicitly requested source-level edit of an opaque Class or Flowchart,
|
|
57
|
+
use `mermaid.mutatePreservingSource(diagram, op)` (library: the same export).
|
|
58
|
+
Supported operations are Class `add_member`/`remove_member` and Flowchart
|
|
59
|
+
`set_label`/`rename_node`; removal requires an unambiguous whole member line,
|
|
60
|
+
and renames refuse unsupported class/style/click/href dependencies or colliding
|
|
61
|
+
group identities. Save `value.source` exactly after inspecting
|
|
62
|
+
`verifyMermaid(value.diagram)`. The diagram stays opaque and its portability
|
|
63
|
+
warning remains; portable Mermaid export is not promised. Atomic batches use
|
|
64
|
+
`applyOps({ source, ops, mode: 'source-preserving' })`, or MCP `mutate` with
|
|
65
|
+
`mode: 'source-preserving'`. The editor adapter exposes programmatic
|
|
66
|
+
`applyOps(source, ops, 'source-preserving')` through its worker. Unsupported or
|
|
67
|
+
ambiguous ownership refuses without emitting partial edited source; builders
|
|
68
|
+
do not accept this mode.
|
|
69
|
+
|
|
50
70
|
## The verify-before-commit rule
|
|
51
71
|
|
|
52
|
-
Run `verifyMermaid` at every commit point — anywhere the result would be saved, sent, or shown. For new diagrams, verify the authored source. For existing diagrams, verify after mutation and before serializing. You may batch several `mutate` calls between verifications, but never serialize a `ValidDiagram` whose `verify` result you have not inspected. `verify.ok`
|
|
72
|
+
Run `verifyMermaid` at every commit point — anywhere the result would be saved, sent, or shown. For new diagrams, verify the authored source. For existing diagrams, verify after mutation and before serializing. You may batch several `mutate` calls between verifications, but never serialize a `ValidDiagram` whose `verify` result you have not inspected. `verify.ok` means no unsuppressed error was detected, including measured content occlusion; it is not a visual-quality or semantic-correctness score. For task-critical meaning, inspect `describeMermaidFacts(d)` or call `checkMermaid(d, requiredFacts)` before returning.
|
|
53
73
|
|
|
54
74
|
## Tier 1 vs Tier 2 vs Tier 3 warnings
|
|
55
75
|
|
|
56
|
-
Tier 1 (structural, reliable, universal):
|
|
76
|
+
Tier 1 (structural, reliable, universal): <!-- BEGIN GENERATED: warning-summaries:structural -->`EMPTY_DIAGRAM`, `EDGE_MISANCHORED`, `OFF_CANVAS`, `GROUP_BREACH`, `UNKNOWN_SHAPE`, `LABEL_OVERFLOW`, `UNRESOLVABLE_SCHEDULE`, `RENDER_FAILED`, `INTERNAL_ERROR`. `LABEL_OVERFLOW` means a label's longest displayed line is over the char cap — `<br>`/`\n` split lines, XML entities decode to one char, formatting tags strip (families that draw text literally count them); default cap 40, raise via `labelCharCap` / `am verify --label-cap N` when long labels are intentional instead of truncating the user's text. `UNRESOLVABLE_SCHEDULE` means a gantt parses but its schedule cannot resolve, so render would fail; `reason` names the `GANTT_*` error. `RENDER_FAILED` means the parser, the strict render parser, layout, or theme colors reject the source or its configuration (any family; `origin` says which), so rendering would fail; `reason` carries the renderer error — a clean verify proves the diagram actually renders. `INTERNAL_ERROR` means Agentic Mermaid hit an internal defect, not caused by the source; `defaultRender` is `succeeds-unchecked` when an ordinary render still produces output that the failed consistency checks cannot vouch for, or `fails` when rendering throws — do not rewrite the diagram to work around it; report it with the source.<!-- END GENERATED: warning-summaries:structural --> Applies to every family. Never suppress Tier 1 errors.
|
|
57
77
|
|
|
58
|
-
Tier 2 (geometric
|
|
78
|
+
Tier 2 (geometric): <!-- BEGIN GENERATED: warning-summaries:geometric -->`NODE_OVERLAP`, `CONTENT_OCCLUDED`, `LAYOUT_LIMIT_EXCEEDED`, `ROUTE_SELF_CROSS`, `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`.<!-- END GENERATED: warning-summaries:geometric --> `CONTENT_OCCLUDED` fails verification when measured paint hides content. `LAYOUT_LIMIT_EXCEEDED` reports an unmet budget while retaining content. The `ROUTE_*` codes are route-contract tripwires (docs/design/system/route-contracts.md — the layout pipeline upholds these itself, so they fire only on pipeline regressions). Route tripwires fire for flowchart/state. `NODE_OVERLAP` also checks class, ER, journey, timeline and sequence boxes, and class/ER add boundary-anchor checks (`ROUTE_SHAPE_MISANCHOR`). Other geometric concerns surface via perceptual metrics (`measureQuality(layoutMermaid(d))`). See `docs/quality.md`. Gate on error severity; use the remaining geometric warnings to assess layout quality.
|
|
59
79
|
|
|
60
|
-
Tier 3 (lint and inspect-only policy):
|
|
80
|
+
Tier 3 (lint and inspect-only policy): <!-- BEGIN GENERATED: warning-summaries:lint -->`DUPLICATE_EDGE`, `UNREACHABLE_NODE`, `DECISION_BRANCH_UNLABELED`, `FLOW_IMBALANCE`, `COMMENT_DROPPED`, `UNSUPPORTED_SYNTAX`, `CONTENT_DROPPED_ON_ROUNDTRIP`, `EVENT_SOURCE_TYPE`, `INEFFECTIVE_CONFIG`, `LOW_CONTRAST`, `LABELS_HIDDEN`, `SCALE_RANGE_EXCLUDES_ZERO`, `BAR_RANGE_EXCLUDES_ZERO`, `VALUES_OUTSIDE_RANGE`, `BRAND_CONSTRAINT_WARNING`, `BRAND_CONSTRAINT_ERROR`. `DECISION_BRANCH_UNLABELED` means a multi-exit decision diamond has an unlabeled branch. `FLOW_IMBALANCE` means a sankey intermediate node receives a different total than it emits — conservation across stages is the domain's defining property, so the warning names the node, its inflow, its outflow, and the unaccounted amount (which otherwise renders silently as node height); balance the flows or add an explicit remainder link. `COMMENT_DROPPED` means a payload carries known comment loss; current serializers retain detected comments, but cannot recover text already omitted from an older payload. `UNSUPPORTED_SYNTAX` means either a Mermaid construct (for example flowchart edge IDs, edge metadata, click/href, or markdown strings) is preserved losslessly as source but is not fully modeled by local structured mutation/render semantics, or `syntax: "empty_layout"` means the source carries content but the local layout produced a 0x0 canvas with no nodes, edges, or groups. Inspect the warning message and `verify.layout` before accepting the artifact. `CONTENT_DROPPED_ON_ROUNDTRIP` means the structured node/edge/group tally changed across a parse → serialize → re-parse cycle — canonical serialization is silently dropping or duplicating content even though the bytes may re-parse; treat it as a faithfulness bug to report. `EVENT_SOURCE_TYPE` means inspect the named Event Modeling source and target frame types; rendering preserves the authored connection. `INEFFECTIVE_CONFIG` means a Mermaid config field has no effect on this family's output — it was accepted for compatibility but is not wired, is unknown to the family, or has an invalid value (the warning names the field). `LOW_CONTRAST` means a concrete authored paint remains authoritative but misses a measurable contrast threshold against the final resolved opaque background; the warning reports both colors, the measured ratio, and the minimum without repainting. Transparent output is not measured because its host backdrop is unknown. `LABELS_HIDDEN` means a chart left out text the source asked for because it did not fit: for an XY chart, `target: "x-axis"` lists the category names the axis does not draw (thinned or dropped) and `target: "data-labels"` lists the bars whose value label has no room (shorten the names, flip the chart with `set_orientation {horizontal: true}`, or widen the value range); for a quadrant chart, `target: "point-labels"` lists the points whose label collides with labels placed first (spread the points, shorten the names, or enlarge the chart). `BAR_RANGE_EXCLUDES_ZERO` means an XY chart with bar series has an authored y-axis range that excludes zero, so bars start at the reported `baseline` and their lengths are not proportional to their values; include zero with `set_y_axis`, or draw the series as a line. `VALUES_OUTSIDE_RANGE` means an XY chart series has values outside the authored y-axis range: a bar stops at the edge of the range, so its length understates the value, and a line point is drawn past the plot; the warning names the `series` and its `values` outside the `range`. Widen the range with `set_y_axis`, or remove it.<!-- END GENERATED: warning-summaries:lint --> Advisory lint never flips `verify.ok`; a caller-authored Brand constraint with `action: "error"` emits `BRAND_CONSTRAINT_ERROR` and does. Brand constraints inspect final contrast, accent area, or monochrome role paint without repainting or relayout.
|
|
61
81
|
|
|
62
82
|
## CLI verbs
|
|
63
83
|
|
|
64
|
-
|
|
65
|
-
`am
|
|
66
|
-
`am
|
|
84
|
+
<!-- complete: cli-verbs -->
|
|
85
|
+
`am capabilities --json` — JSON envelope listing families, `families[].editPolicy`, `families[].mutationOps`, warning codes, output formats (<!-- BEGIN GENERATED: render-formats -->`svg`, `ascii`, `unicode`, `png`, `layout`<!-- END GENERATED: render-formats -->). Schema-stable; use it to self-discover.
|
|
86
|
+
`am batch --jsonl` — JSONL stdin → JSONL stdout for render/verify/parse/serialize/mutate. Mutation requests opt into bounded source edits with `preserveSource: true`. Malformed lines surface error but don't abort the stream.
|
|
87
|
+
`am render <file…> --format svg|ascii|unicode|layout [--security strict] [--style <names|file.json>] [--seed N]` — layout emits the JSON layout shape; --security strict = no external-fetch refs; `--style` takes a stack (comma-separated names and/or .json spec files, merged left → right, e.g. `--style hand-drawn,dracula`) and applies to graphical and terminal projection; `--seed` re-rolls styled ink. Multiple files → results array for non-PNG formats. `--watch` is single-file/non-PNG only. PNG uses `--format png --output file.png` for one input and does not support watch/multi-input; `--fit-width`/`--fit-height` constrain raster size and `--min-label-px` emits `BELOW_READABLE_SIZE` when measurable configured text falls below the selected effective-pixel floor (provisional default 9; `0` disables).
|
|
67
88
|
`am preview <file|-> [--output out.html] [--open] [--json] [--security strict]` — standalone strict-mode HTML preview for human inspection.
|
|
68
|
-
`am mutate <file|-> (--op '<JSON>'|--ops '<JSON array|file>') [--json]` — apply mutation(s), run verify, emit source only if verify succeeds. JSON success includes `{ok,source,verify}
|
|
89
|
+
`am mutate <file|-> (--op '<JSON>'|--ops '<JSON array|file>') [--preserve-source] [--json]` — apply mutation(s), run verify, emit source only if verify succeeds, or if its only errors are `INTERNAL_ERROR` defects the input already had (same reason and `defaultRender`; `verify` then still reports them). `--preserve-source` opts into the bounded opaque Class/Flowchart edits above. JSON success includes `{ok,source,verify}` and `mode: 'source-preserving'` when selected; verify failure exits 3 (4 when every error is `INTERNAL_ERROR`) and omits source.
|
|
69
90
|
`am verify <file|-> [--json] [--label-cap N] [--suppress CODES] [--style <names|file.json>]` — full tiered verify; `--style` evaluates inspect-only Brand constraints against the same styled Scene used by render; exit 3 only on error-severity findings. `am parse` (ValidDiagram JSON), `am serialize` (ValidDiagram JSON on stdin → canonical source), and `am format` (idempotent reformat) round out the loop.
|
|
70
|
-
`am describe <file|-> [--format text|json|facts]` — prose summary, structured AX tree (`{nodes,edges,entryPoints,sinks}`, #7349), or semantic fact lines. Library: `describeMermaid(d, {format})`, `describeMermaidFacts(d)`, `checkMermaid(d, facts)`.
|
|
91
|
+
`am describe <file|-> [--format text|json|facts]` — prose summary, structured AX tree (`{kind,nodes,edges,entryPoints,sinks}`, #7349), or semantic fact lines. Library: `describeMermaid(d, {format})`, `describeMermaidFacts(d)`, `checkMermaid(d, facts)`.
|
|
71
92
|
`am styles [--json]` — list registered styles: the default, full looks, and palette-only themes, with backends and blurbs.
|
|
72
93
|
`am llms-txt` — agent-discovery digest (llms.txt convention).
|
|
73
94
|
`am init-agent [--dir .] [--force]` — writes a non-clobbering AGENTS.md section, root skills/ bundle, and .mcp.json sample into a consumer repo.
|
|
74
95
|
`am render-markdown <file.md> [--ascii]` — render each Mermaid fenced block; skips invalid diagrams, never aborts the file. JSON: `{blocks:[{index,ok,output|error}]}`.
|
|
75
|
-
Exit codes: `0` ok, `2` arg/parse/mutation error, `3` verify-failed, `4` internal. Parse and verify-failure errors carry `error.details` arrays, not stringified blobs.
|
|
96
|
+
Exit codes: `0` ok, `2` arg/parse/mutation error, `3` verify-failed, `4` internal (including a verify whose errors are all `INTERNAL_ERROR`). Parse and verify-failure errors carry `error.details` arrays, not stringified blobs.
|
|
76
97
|
|
|
77
|
-
Library extras: `renderMermaidPNG(src,{fitTo,background,style,seed,fontDirs})` returns PNG bytes
|
|
98
|
+
Library extras: `renderMermaidPNG(src,{fitTo,background,minLabelPx,onWarning,style,seed,fontDirs})` returns PNG bytes and reports bounded raster warnings through `onWarning`; `BELOW_READABLE_SIZE` is evidence of configured-text shrinkage, not a general readability verdict. `renderMermaidASCIIWithMeta(src)` → `{ascii,regions,actions,warnings,routeParity}` for TUI click-mapping; `describeMermaidFacts(d)` / `checkMermaid(d, facts)` expose deterministic semantic facts; `analyzeMermaid(d)` / `analyzeMermaidSource(source)` returns non-rendering feedback/action/Gantt analysis; `asciiToMermaid(ascii)` reverses flowchart ASCII (best-effort, lossy); `verifyNoExternalRefs(svg)` asserts no external fetch; `renderMermaidSVG(src,{idPrefix})` namespaces def ids for multi-diagram pages. See SECURITY.md.
|
|
78
99
|
|
|
79
100
|
## Styles
|
|
80
101
|
|
|
@@ -85,5 +106,5 @@ Every library render call accepts `style`: a registered Look or Palette discover
|
|
|
85
106
|
- Regenerating an existing parsed diagram instead of mutating it. Defeats round-trip; produces noise.
|
|
86
107
|
- Verifying only after a long risky edit chain. Loses precision about which op broke it.
|
|
87
108
|
- Serializing before reading `verify.ok` / `verify.warnings` / `verify.layout`.
|
|
88
|
-
- Concatenating source to edit an existing structured diagram when a typed `mutate` op exists.
|
|
109
|
+
- Concatenating source to edit an existing structured diagram when a typed `mutate` op exists. (Authoring a new diagram as source is the default path, not an anti-pattern.)
|
|
89
110
|
- Calling `mutate` on an opaque-fallback body; the structured-family narrower returns null for unmodeled syntax, so edit its preserved source instead.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-present Fabio Spampinato, Andrew Maney
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
6
|
+
copy of this software and associated documentation files (the "Software"),
|
|
7
|
+
to deal in the Software without restriction, including without limitation
|
|
8
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
9
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
|
10
|
+
Software is furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
21
|
+
DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 - 2022 Knut Sveidqvist
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Viva Republica, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kepano
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
The reset icon of the zoom controls is "rotate-ccw" from Lucide v1.14.0
|
|
26
|
+
(https://lucide.dev), under the ISC License:
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
29
|
+
|
|
30
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
31
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
32
|
+
copyright notice and this permission notice appear in all copies.
|
|
33
|
+
|
|
34
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
35
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
36
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
37
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
38
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
39
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
40
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Peng Xiao
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,21 +4,30 @@
|
|
|
4
4
|
|
|
5
5
|
**Beautiful diagrams, made with your agent.**
|
|
6
6
|
|
|
7
|
-
Agentic Mermaid
|
|
7
|
+
Agentic Mermaid helps coding agents create styled diagrams from Mermaid source and edit existing diagrams through typed operations. Export SVG or PNG for documents, and ASCII or Unicode for terminal review.
|
|
8
8
|
|
|
9
|
-
It is forked from [`lukilabs/beautiful-mermaid`](https://github.com/lukilabs/beautiful-mermaid). Published on npm as `agentic-mermaid`; the GitHub repository is `adewale/agentic-mermaid`; the
|
|
9
|
+
It is forked from [`lukilabs/beautiful-mermaid`](https://github.com/lukilabs/beautiful-mermaid). Published on npm as `agentic-mermaid`; the GitHub repository is `adewale/agentic-mermaid`; the live site is [`agentic-mermaid.dev`](https://agentic-mermaid.dev/).
|
|
10
10
|
|
|
11
|
-

|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
A login flow with MFA, rendered directly by Agentic Mermaid.
|
|
14
|
+
[Mermaid source](examples/styles/readme-hero.mmd) · [Style and reproduction command](examples/styles/readme-hero.md)
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
[Live Demo & Samples](https://agentic-mermaid.dev/) · [Live Editor](https://agentic-mermaid.dev/editor)
|
|
16
17
|
|
|
17
18
|
</div>
|
|
18
19
|
|
|
20
|
+
**Ask your coding agent:**
|
|
21
|
+
|
|
22
|
+
> Read `Instructions_for_agents.md` in this repository, or https://agentic-mermaid.dev/llms.txt if you don't have a checkout. Draw Browser → API → Database using the hand-drawn style and nord-light palette. Verify it, then return the Mermaid source and an SVG.
|
|
23
|
+
|
|
24
|
+
[Agent setup and skills](#agent-quick-start) · [Try the same diagram in JavaScript](#svg)
|
|
25
|
+
|
|
26
|
+
Docs: [docs index](./docs/) · [getting started](./docs/getting-started.md) · [agent guide](./Instructions_for_agents.md) · [agent API cookbook](./docs/agent-api-cookbook.md) · [design system](https://github.com/adewale/agentic-mermaid/blob/main/DESIGN.md) · [skills](./skills/) · [fork differences](./docs/fork-differences.md) · [vs Mermaid & Beautiful Mermaid](./docs/comparison.md) · [changelog](./CHANGELOG.md)
|
|
27
|
+
|
|
19
28
|
## Why Agentic Mermaid
|
|
20
29
|
|
|
21
|
-
|
|
30
|
+
Choose a built-in style, or keep your diagram's colors and fonts in a JSON style file. Inspect the rendered result before publishing.
|
|
22
31
|
|
|
23
32
|
| You want | Agentic Mermaid gives you |
|
|
24
33
|
|---|---|
|
|
@@ -32,40 +41,27 @@ The agent workflow is the guardrail behind the polish: agents should not guess f
|
|
|
32
41
|
|
|
33
42
|
## Highlights
|
|
34
43
|
|
|
35
|
-
- **
|
|
36
|
-
- **SVG, PNG, ASCII, Unicode, JSON** —
|
|
37
|
-
- **
|
|
38
|
-
- **Composable styles** — `{ style: ['hand-drawn', 'dracula'] }`
|
|
39
|
-
- **
|
|
40
|
-
- **Agent-native editing** — typed
|
|
41
|
-
- **CLI + MCP + library** — `am`, `agentic-mermaid-mcp`,
|
|
44
|
+
- **Discover supported diagrams and edits** — `am capabilities --json` reports what the installed version supports, including registered extensions.
|
|
45
|
+
- **SVG, PNG, ASCII, Unicode, JSON** — export images, review diagrams in the terminal, or inspect positions as JSON layout.
|
|
46
|
+
- **Render SVG without a browser** — the synchronous JavaScript API runs without a DOM or Puppeteer.
|
|
47
|
+
- **Composable styles** — `{ style: ['hand-drawn', 'dracula'] }` combines a look with a palette. Set colors, fonts, strokes, fills and backdrops in a [JSON style](./docs/style-authoring.md). `seed` re-rolls the ink, never the layout.
|
|
48
|
+
- **Match your editor's colors** — choose a built-in palette, theme from two colors, or adapt a VS Code theme with Shiki.
|
|
49
|
+
- **Agent-native editing** — use typed operations for modeled syntax. Inputs with unmodeled syntax retain their source; [source-preserving edits](./docs/agent-mutation-policy.md) cover selected Class and Flowchart operations.
|
|
50
|
+
- **CLI + MCP + library** — use `am`, connect `agentic-mermaid-mcp`, or import `agentic-mermaid/agent` for rendering and editing. See the [API reference](./docs/api.md) for the other library and browser entry points.
|
|
42
51
|
|
|
43
52
|
## Installation
|
|
44
53
|
|
|
54
|
+
Requires **Node.js 22 or later**, or **Bun 1.4.0 or later**. The package is ESM-only; use `import`, or dynamic `import()` from CommonJS.
|
|
55
|
+
|
|
45
56
|
```bash
|
|
46
57
|
npm install agentic-mermaid # or: bun add agentic-mermaid / pnpm add agentic-mermaid
|
|
47
58
|
npx --no-install agentic-mermaid --help
|
|
48
|
-
npx --no-install agentic-mermaid mcp
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
For repository development, install from source and run the Bun entrypoints:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
git clone https://github.com/adewale/agentic-mermaid
|
|
55
|
-
cd agentic-mermaid
|
|
56
|
-
bun install
|
|
57
|
-
bun run build
|
|
58
|
-
bun run bin/am.ts --help
|
|
59
|
-
bun run bin/agentic-mermaid-mcp.ts # MCP stdio server
|
|
60
59
|
```
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
> install, invoke it from a shell as `npx --no-install agentic-mermaid …` (or
|
|
67
|
-
> from an npm script as `am …`). From a source checkout, use
|
|
68
|
-
> `bun run bin/am.ts …` instead.
|
|
61
|
+
The `am …` examples below name the published bin. After a project-local npm
|
|
62
|
+
install, invoke it from a shell as `npx --no-install agentic-mermaid …` (or
|
|
63
|
+
from an npm script as `am …`). From a source checkout, use
|
|
64
|
+
`bun run bin/am.ts …` instead.
|
|
69
65
|
|
|
70
66
|
## Output quick starts
|
|
71
67
|
|
|
@@ -73,13 +69,27 @@ Use `agentic-mermaid/agent` when you want one import path for styled renders, ou
|
|
|
73
69
|
|
|
74
70
|
### SVG
|
|
75
71
|
|
|
76
|
-
|
|
72
|
+
Save this as `diagram.mjs`:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
import { writeFileSync } from 'node:fs'
|
|
77
76
|
import { renderMermaidSVG } from 'agentic-mermaid/agent'
|
|
78
77
|
|
|
79
|
-
const svg = renderMermaidSVG(`flowchart
|
|
80
|
-
|
|
78
|
+
const svg = renderMermaidSVG(`flowchart LR
|
|
79
|
+
Browser --> API --> Database`, {
|
|
80
|
+
style: ['hand-drawn', 'nord-light'],
|
|
81
|
+
security: 'strict',
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
writeFileSync('diagram.svg', svg)
|
|
81
85
|
```
|
|
82
86
|
|
|
87
|
+
```bash
|
|
88
|
+
node diagram.mjs
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Open `diagram.svg` to see **Browser → API → Database** in the hand-drawn style with the `nord-light` palette.
|
|
92
|
+
|
|
83
93
|
### PNG
|
|
84
94
|
|
|
85
95
|
```ts
|
|
@@ -125,28 +135,33 @@ If it only has shell access:
|
|
|
125
135
|
am --agent-instructions
|
|
126
136
|
am capabilities --json
|
|
127
137
|
am preview diagram.mmd --security strict --open
|
|
128
|
-
am mutate diagram.mmd --op '{"kind":"
|
|
138
|
+
am mutate diagram.mmd --op '{"kind":"set_label","target":"API","label":"API gateway"}' --json
|
|
129
139
|
```
|
|
130
140
|
|
|
131
|
-
|
|
141
|
+
For an existing diagram, follow parse → narrow → mutate → verify → serialize. For a new diagram, author Mermaid source, then parse and verify it. To wire Agentic Mermaid into another repo, run `npx agentic-mermaid init-agent` (or `bun run bin/am.ts init-agent` from a source checkout); it writes a non-clobbering `AGENTS.md` section, root `skills/` bundle, and `.mcp.json` sample.
|
|
132
142
|
|
|
133
143
|
Use strict `preview` for human inspection and `mutate --op/--ops` for verified one-shot or batched edits.
|
|
134
144
|
|
|
135
|
-
For multi-step MCP edits,
|
|
145
|
+
For multi-step MCP edits, use Code Mode `execute(code)` with the same `mermaid.*` SDK names. See the [agent API cookbook](./docs/agent-api-cookbook.md) for library, CLI and MCP recipes.
|
|
136
146
|
|
|
137
147
|
## MCP server
|
|
138
148
|
|
|
139
149
|
Agentic Mermaid ships a Model Context Protocol server so MCP-capable agents can render and safely edit diagrams without shelling out.
|
|
140
150
|
|
|
141
|
-
|
|
142
|
-
|
|
151
|
+
After installation, start the local stdio server:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npx --no-install agentic-mermaid mcp
|
|
155
|
+
```
|
|
143
156
|
|
|
144
|
-
|
|
157
|
+
Use the library, CLI or local MCP for private diagrams, offline work, larger inputs or local PNG files. The [MCP transport guide](./docs/mcp-http-transport.md) covers HTTP/SSE and file/URL artifacts; [agent setup](#agent-quick-start) shows how to generate a sample client configuration. The [tool reference and Code Mode guide](./docs/mcp-code-mode-rationale.md) explains the available tools and multi-step edits.
|
|
145
158
|
|
|
146
|
-
|
|
159
|
+
An optional public, unauthenticated MCP endpoint runs at `https://agentic-mermaid.dev/mcp`. It accepts MCP JSON-RPC rather than REST render requests, caps inputs at 64 KB and returns PNG as base64. Hosted calls send your source or code to the server; see the [privacy notice](./docs/MCP-PRIVACY.md). Directory maintainers can use the [MCP listing record](./docs/MCP-DIRECTORY-LISTINGS.md).
|
|
147
160
|
|
|
148
161
|
## Structured edit example
|
|
149
162
|
|
|
163
|
+
Change the API node's displayed label while keeping its connection to DB:
|
|
164
|
+
|
|
150
165
|
```ts
|
|
151
166
|
import { parseRegisteredMermaid, asFlowchart, mutate, verifyMermaid, serializeMermaid } from 'agentic-mermaid/agent'
|
|
152
167
|
|
|
@@ -156,39 +171,49 @@ if (!parsed.ok) throw new Error('parse failed')
|
|
|
156
171
|
const flow = asFlowchart(parsed.value)
|
|
157
172
|
if (!flow) throw new Error(`not a structured flowchart: ${parsed.value.kind}`)
|
|
158
173
|
|
|
159
|
-
const next = mutate(flow, { kind: '
|
|
174
|
+
const next = mutate(flow, { kind: 'set_label', target: 'API', label: 'API gateway' })
|
|
160
175
|
if (!next.ok) throw new Error(next.error.message)
|
|
161
176
|
|
|
162
177
|
const verify = verifyMermaid(next.value)
|
|
163
178
|
if (!verify.ok) throw new Error(JSON.stringify(verify.warnings, null, 2))
|
|
164
179
|
|
|
165
180
|
const source = serializeMermaid(next.value)
|
|
181
|
+
console.log(source)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Output:
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
flowchart TD
|
|
188
|
+
API[API gateway] --> DB
|
|
166
189
|
```
|
|
167
190
|
|
|
191
|
+
The node ID is still `API`; its displayed label is now `API gateway`, and the `API → DB` connection remains. Verification checks for structural and geometry problems; review the rendered result and confirm it expresses your intent before saving.
|
|
192
|
+
|
|
168
193
|
Rules:
|
|
169
194
|
|
|
170
195
|
- Use the matching exported `as<Family>` narrower before mutating an existing structured diagram.
|
|
171
196
|
- Mutation ops use `kind`, not `type`.
|
|
172
197
|
- Run `verifyMermaid` before every commit point.
|
|
173
198
|
- Do not call `mutate` on opaque fallback bodies; the narrower returns `null` for unmodeled syntax.
|
|
199
|
+
- For opaque Class/Flowchart inputs, bounded [source-preserving edits](./docs/agent-mutation-policy.md) support Class `add_member`/`remove_member` and Flowchart `set_label`/`rename_node`. Use `mutatePreservingSource`, `applyOps` with `mode: 'source-preserving'`, or CLI `--preserve-source`; MCP and the editor worker expose the same explicit mode. Save exact source and inspect the retained portability diagnostics; ambiguous ownership and unsupported dependencies refuse atomically.
|
|
174
200
|
|
|
175
201
|
## Supported diagram families
|
|
176
202
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
See [diagram families](./docs/diagram-families.md) for syntax examples and
|
|
181
|
-
compatibility notes.
|
|
203
|
+
Run `am capabilities --json` for the supported families and edit operations in
|
|
204
|
+
your installed version. See [diagram families](./docs/diagram-families.md) for
|
|
205
|
+
syntax examples and compatibility notes.
|
|
182
206
|
|
|
183
207
|
## More documentation
|
|
184
208
|
|
|
185
|
-
- [System architecture](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/README.md) —
|
|
209
|
+
- [System architecture](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/system/README.md) — how Mermaid source becomes a diagram, from parsing to layout and output.
|
|
186
210
|
- [API reference](./docs/api.md) — renderers, agent API, options, CLI/MCP pointers.
|
|
211
|
+
- [Vocabulary](./docs/api.md#vocabulary) — families, source objects, Scene parts, resolved primitives and typed-family narrowing.
|
|
187
212
|
- [Agent API cookbook](./docs/agent-api-cookbook.md) — practical recipes for agents.
|
|
188
213
|
- [Theming](./docs/theming.md) — two-color themes, built-ins, Shiki compatibility.
|
|
189
214
|
- [Custom style cookbook](./docs/custom-style-cookbook.md) — JSON style files, screenshots, schema usage, and CLI commands.
|
|
190
215
|
- [Fonts in custom styles](./docs/custom-fonts.md) — font selection, SVG declarations, PNG directories, fallbacks, and browser usage.
|
|
191
|
-
- [React integration](./docs/react.md) —
|
|
216
|
+
- [React integration](./docs/react.md) — browser-safe, family-loaded rendering.
|
|
192
217
|
- [ASCII output](./docs/ascii.md) — terminal output, color modes, XY charts.
|
|
193
218
|
- [Mermaid config](./docs/config.md) — frontmatter, init directives, runtime config.
|
|
194
219
|
- [Features](./docs/features.md), [quality](./docs/quality.md), [security](./SECURITY.md), [fork differences](./docs/fork-differences.md).
|
|
@@ -202,6 +227,21 @@ compatibility notes.
|
|
|
202
227
|
- [`examples/mcp-vs-cli-complex-diagrams.ts`](https://github.com/adewale/agentic-mermaid/blob/main/examples/mcp-vs-cli-complex-diagrams.ts)
|
|
203
228
|
- [`examples/agent-improve-auth-flow.ts`](https://github.com/adewale/agentic-mermaid/blob/main/examples/agent-improve-auth-flow.ts)
|
|
204
229
|
|
|
230
|
+
## Contributing and reporting bugs
|
|
231
|
+
|
|
232
|
+
[Report a bug](https://github.com/adewale/agentic-mermaid/issues) with the Mermaid source, render options and the result you expected. For changes to the project, read the [contributor instructions](https://github.com/adewale/agentic-mermaid/blob/main/CLAUDE.md) for implementation and testing rules.
|
|
233
|
+
|
|
234
|
+
To work from a source checkout, use Bun 1.4.0 or later:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
git clone https://github.com/adewale/agentic-mermaid
|
|
238
|
+
cd agentic-mermaid
|
|
239
|
+
bun install
|
|
240
|
+
bun run build
|
|
241
|
+
bun run bin/am.ts --help
|
|
242
|
+
bun run bin/agentic-mermaid-mcp.ts # MCP stdio server
|
|
243
|
+
```
|
|
244
|
+
|
|
205
245
|
## Attribution
|
|
206
246
|
|
|
207
247
|
Agentic Mermaid is a fork of Beautiful Mermaid by [Luki Labs](https://github.com/lukilabs/beautiful-mermaid). The ASCII rendering engine is based on [`mermaid-ascii`](https://github.com/AlexanderGrooff/mermaid-ascii) by Alexander Grooff and extended for Agentic Mermaid.
|
|
@@ -209,3 +249,6 @@ Agentic Mermaid is a fork of Beautiful Mermaid by [Luki Labs](https://github.com
|
|
|
209
249
|
## License
|
|
210
250
|
|
|
211
251
|
MIT
|
|
252
|
+
|
|
253
|
+
Native Event Modeling and ZenUML authoring and rendering have documented
|
|
254
|
+
[capability and runtime contracts](docs/eventmodeling-and-zenuml.md).
|