agentic-mermaid 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/AGENT_NATIVE.md +5 -9
  2. package/CHANGELOG.md +66 -0
  3. package/Instructions_for_agents.md +171 -97
  4. package/README.md +1 -1
  5. package/dist/agent-core.d.ts +7 -7
  6. package/dist/agent-core.js +1 -1
  7. package/dist/agent.d.ts +9 -10
  8. package/dist/agent.js +1 -1
  9. package/dist/agentic-mermaid-mcp.js +1 -1
  10. package/dist/am.js +1 -1
  11. package/dist/browser-lazy/chunks/{agentic-producer-core-ECZ3CMZM.js → agentic-producer-core-MYYZCUJS.js} +1 -1
  12. package/dist/browser-lazy/chunks/{architecture-H5LTMKQW.js → architecture-OHEIJI33.js} +6 -6
  13. package/dist/browser-lazy/chunks/{block-566X6FNV.js → block-DMBSQUFZ.js} +6 -6
  14. package/dist/browser-lazy/chunks/{builtin-backends-VAFEZXKY.js → builtin-backends-JTN3XG37.js} +3 -3
  15. package/dist/browser-lazy/chunks/{c4-ZXFDLBFK.js → c4-TK5GVVGU.js} +3 -3
  16. package/dist/browser-lazy/chunks/{chunk-7UFOFWBA.js → chunk-2R6M4CUH.js} +1 -1
  17. package/dist/browser-lazy/chunks/{chunk-YVNJDVQO.js → chunk-3K25OV6X.js} +1 -1
  18. package/dist/browser-lazy/chunks/{chunk-QVSZOF5M.js → chunk-3QXHJBE3.js} +1 -1
  19. package/dist/browser-lazy/chunks/{chunk-IUI4DYC3.js → chunk-4G652M75.js} +1 -1
  20. package/dist/browser-lazy/chunks/{chunk-LBXXKLIR.js → chunk-4WON4RCG.js} +3 -3
  21. package/dist/browser-lazy/chunks/{chunk-V6I2VGNQ.js → chunk-5SZ2YBKG.js} +9 -9
  22. package/dist/browser-lazy/chunks/{chunk-XHU3A432.js → chunk-CJZMMNPO.js} +1 -1
  23. package/dist/browser-lazy/chunks/{chunk-5LKPDHPC.js → chunk-F4CQMYR2.js} +4 -4
  24. package/dist/browser-lazy/chunks/{chunk-G4JBA7HU.js → chunk-GK5PSUKH.js} +3 -3
  25. package/dist/browser-lazy/chunks/{chunk-VRZKI33U.js → chunk-HAMXYU5V.js} +1 -1
  26. package/dist/browser-lazy/chunks/{chunk-Z7UHFVKN.js → chunk-IFUYPCDA.js} +6 -6
  27. package/dist/browser-lazy/chunks/{chunk-3JTYTXA6.js → chunk-ILCWDEZN.js} +4 -4
  28. package/dist/browser-lazy/chunks/{chunk-64JFHCJC.js → chunk-JJFXEH35.js} +1 -1
  29. package/dist/browser-lazy/chunks/{chunk-PXTLV57R.js → chunk-KOO3MCMJ.js} +1 -1
  30. package/dist/browser-lazy/chunks/{chunk-A7V5VDKN.js → chunk-LO25KEJY.js} +1 -1
  31. package/dist/browser-lazy/chunks/{chunk-TT5GR5EJ.js → chunk-MGB5QQEH.js} +1 -1
  32. package/dist/browser-lazy/chunks/{chunk-PSZEE64O.js → chunk-NVZKY7UI.js} +8 -8
  33. package/dist/browser-lazy/chunks/{chunk-6UOOATQR.js → chunk-PA7YKMP5.js} +1 -1
  34. package/dist/browser-lazy/chunks/{chunk-NKW2ZNCD.js → chunk-PS4HSV54.js} +1 -1
  35. package/dist/browser-lazy/chunks/{chunk-OBI5U5XU.js → chunk-QG67RIGQ.js} +1 -1
  36. package/dist/browser-lazy/chunks/{chunk-J57YRC2M.js → chunk-QOIFBX26.js} +1 -1
  37. package/dist/browser-lazy/chunks/chunk-QQCKPJF3.js +1 -0
  38. package/dist/browser-lazy/chunks/{chunk-O34YYEQV.js → chunk-QXSPMZ67.js} +1 -1
  39. package/dist/browser-lazy/chunks/{chunk-4NILRBC7.js → chunk-QYORAVMZ.js} +1 -1
  40. package/dist/browser-lazy/chunks/{chunk-OFOS57WQ.js → chunk-SC7LXD2V.js} +1 -1
  41. package/dist/browser-lazy/chunks/{chunk-EIYLJ4FI.js → chunk-SZAI2WB4.js} +12 -12
  42. package/dist/browser-lazy/chunks/{chunk-37FZNMPR.js → chunk-TXYQEDUF.js} +1 -1
  43. package/dist/browser-lazy/chunks/{chunk-2JQXRKBC.js → chunk-VR6YRNUZ.js} +1 -1
  44. package/dist/browser-lazy/chunks/{chunk-7TTFBJYA.js → chunk-WNTLLJPT.js} +1 -1
  45. package/dist/browser-lazy/chunks/{chunk-62MR3LWJ.js → chunk-YYF5TS6K.js} +1 -1
  46. package/dist/browser-lazy/chunks/{class-XIFNVBFE.js → class-QOJOM2XO.js} +8 -8
  47. package/dist/browser-lazy/chunks/{er-VEUYJBGG.js → er-2W6UXQT7.js} +6 -6
  48. package/dist/browser-lazy/chunks/{eventmodeling-G7DITZX7.js → eventmodeling-IVAFIO2U.js} +9 -9
  49. package/dist/browser-lazy/chunks/{flowchart-SSFIU4EU.js → flowchart-Y6OWQ46O.js} +1 -1
  50. package/dist/browser-lazy/chunks/{gantt-HQNVDX2B.js → gantt-BXTFJPZM.js} +6 -6
  51. package/dist/browser-lazy/chunks/{gitgraph-Z5MN6M6L.js → gitgraph-PW6R75SQ.js} +4 -4
  52. package/dist/browser-lazy/chunks/{ishikawa-UEERNFQV.js → ishikawa-GFX3XQQZ.js} +2 -2
  53. package/dist/browser-lazy/chunks/{journey-3BEWWGB5.js → journey-Q3M2GVKJ.js} +7 -7
  54. package/dist/browser-lazy/chunks/{kanban-2WFNCWLB.js → kanban-WVGVXROE.js} +11 -11
  55. package/dist/browser-lazy/chunks/{mindmap-R2C6SNYR.js → mindmap-CEDNSFJ6.js} +6 -6
  56. package/dist/browser-lazy/chunks/{packet-GMVCI5YZ.js → packet-Z56OVP2O.js} +3 -3
  57. package/dist/browser-lazy/chunks/{pie-WER45DKC.js → pie-FOJURIAM.js} +7 -7
  58. package/dist/browser-lazy/chunks/{quadrant-NCUPSFKN.js → quadrant-OGUQEK5C.js} +4 -4
  59. package/dist/browser-lazy/chunks/{radar-WLYS4YC5.js → radar-XTAUIQIJ.js} +9 -9
  60. package/dist/browser-lazy/chunks/render-core-QRFSDWGQ.js +3 -0
  61. package/dist/browser-lazy/chunks/{requirement-AK3NWMJ6.js → requirement-KEJ7ILX2.js} +7 -7
  62. package/dist/browser-lazy/chunks/{sankey-C2DY6WVU.js → sankey-ODWGDRAM.js} +8 -8
  63. package/dist/browser-lazy/chunks/{sequence-D4WJB44W.js → sequence-4ZNQR7S7.js} +1 -1
  64. package/dist/browser-lazy/chunks/{state-YUQVESE7.js → state-6IWPVJ4C.js} +2 -2
  65. package/dist/browser-lazy/chunks/{timeline-BMBJJXWR.js → timeline-LPJMPVPV.js} +4 -4
  66. package/dist/browser-lazy/chunks/{treemap-B66XBZZ6.js → treemap-2KFOQZRA.js} +4 -4
  67. package/dist/browser-lazy/chunks/xychart-KIPWFNVQ.js +16 -0
  68. package/dist/browser-lazy/chunks/{zenuml-62RLYFWP.js → zenuml-2ABFLOUP.js} +6 -6
  69. package/dist/browser-lazy/index.js +1 -1
  70. package/dist/browser.global.js +436 -436
  71. package/dist/chunk-3QC3FE2X.js +4 -0
  72. package/dist/{chunk-XU5LPD2D.js → chunk-5BYN55G4.js} +1 -1
  73. package/dist/chunk-5XKELJT2.js +2 -0
  74. package/dist/chunk-7HIKKNPP.js +150 -0
  75. package/dist/chunk-A5TX2FW5.js +2 -0
  76. package/dist/chunk-AS6A6XHE.js +2 -0
  77. package/dist/{chunk-DOFB572I.js → chunk-CGCGMO4U.js} +15 -15
  78. package/dist/chunk-GO4CS5KS.js +52 -0
  79. package/dist/{chunk-KXMANAST.js → chunk-JRLCGATA.js} +47 -47
  80. package/dist/{chunk-7XYB2LNC.js → chunk-K6TYUPTW.js} +2 -2
  81. package/dist/{chunk-HINRNKPO.js → chunk-QVP364DJ.js} +2 -2
  82. package/dist/chunk-V5RFODN6.js +2 -0
  83. package/dist/cli-PVKOWT4V.js +191 -0
  84. package/dist/elk-constructor.js +1 -1
  85. package/dist/{index-Bvhprdxz.d.ts → index-Bs7imZCS.d.ts} +14 -4
  86. package/dist/index.d.ts +4 -4
  87. package/dist/index.js +1 -1
  88. package/dist/{jsonl-RPJY6YWO.js → jsonl-5N4DTV7P.js} +2 -2
  89. package/dist/mcp-cli-EPIA7DTH.js +2 -0
  90. package/dist/{paint-certification-BoLyr006.d.ts → paint-certification-aIPtFDcn.d.ts} +2 -2
  91. package/dist/server-X6OFY2ZN.js +527 -0
  92. package/dist/{svg-styles-BnCoXyYe.d.ts → svg-styles-DfHloZTH.d.ts} +1 -1
  93. package/dist/svg-styles.d.ts +1 -1
  94. package/dist/svg-styles.js +1 -1
  95. package/dist/svg.d.ts +4 -4
  96. package/dist/svg.js +1 -1
  97. package/dist/{types-CLVJCaH2.d.ts → types-DkUbM48-.d.ts} +1 -1
  98. package/dist/zenuml/chunks/{appearance-5RM5MVM2.js → appearance-ROFRJDW7.js} +1 -1
  99. package/dist/zenuml/chunks/{builtin-backends-UTNWL4N3.js → builtin-backends-LM2A6WWK.js} +2 -2
  100. package/dist/zenuml/chunks/{chunk-ZNZRIISS.js → chunk-E6ZQYSVJ.js} +2 -2
  101. package/dist/zenuml/chunks/{chunk-IARQ24W3.js → chunk-KCHXQ5UA.js} +2 -2
  102. package/dist/zenuml/chunks/{chunk-3A6S6GNB.js → chunk-TEDVLVJM.js} +1 -1
  103. package/dist/zenuml/chunks/{chunk-CNLL4BGF.js → chunk-WD3ZPN3X.js} +1 -1
  104. package/dist/zenuml/chunks/{chunk-6J4BGPB2.js → chunk-WUHZDXTF.js} +24 -24
  105. package/dist/zenuml/chunks/{chunk-55WS466K.js → chunk-ZGLUBUQJ.js} +9 -9
  106. package/dist/zenuml/chunks/{render-core-ECIWU5ZS.js → render-core-WTHYSKBN.js} +2 -2
  107. package/dist/zenuml/chunks/{zenuml-N3LZMB2G.js → zenuml-3TCHUQJZ.js} +8 -8
  108. package/dist/zenuml.d.ts +2 -2
  109. package/dist/zenuml.js +1 -1
  110. package/docs/api.md +84 -4
  111. package/docs/quality.md +6 -3
  112. package/docs/style-authoring.md +23 -0
  113. package/docs/testing-strategy.md +59 -52
  114. package/examples/styles/readme-hero.md +4 -3
  115. package/package.json +4 -4
  116. package/server.json +2 -2
  117. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +19 -154
  118. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +12 -2
  119. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +5 -1
  120. package/dist/browser-lazy/chunks/chunk-6GPDLZFQ.js +0 -1
  121. package/dist/browser-lazy/chunks/render-core-42UVWIPF.js +0 -3
  122. package/dist/browser-lazy/chunks/xychart-HAVFROGT.js +0 -16
  123. package/dist/chunk-2DNGDTJD.js +0 -2
  124. package/dist/chunk-4F2UGYTM.js +0 -4
  125. package/dist/chunk-EHJI3QYE.js +0 -52
  126. package/dist/chunk-MKE7GNYU.js +0 -146
  127. package/dist/chunk-U4MT3RRE.js +0 -2
  128. package/dist/chunk-VUFVLGTH.js +0 -2
  129. package/dist/chunk-WYIB6BUR.js +0 -2
  130. package/dist/cli-ZYIDBYNS.js +0 -226
  131. package/dist/mcp-cli-YVDCORWA.js +0 -2
  132. package/dist/server-4JGAVXR3.js +0 -524
  133. package/docs/MCP-DIRECTORY-LISTINGS.md +0 -145
package/docs/quality.md CHANGED
@@ -214,9 +214,12 @@ The Auth Flow regression is the concrete example. Mermaid can choose a more
214
214
  compact-looking rendering for the feedback loops; Agentic Mermaid now
215
215
  prioritizes semantic LR source order (`A → B → C → ... → H`) and routes
216
216
  `No` loops backward. That preserves author intent and avoids the earlier
217
- misordered layout, but it also makes the diagram wider. `verify.ok` still
218
- only means structurally valid; visual quality needs layout metrics,
219
- geometry assertions, screenshot/PNG review, or human inspection.
217
+ misordered layout, but it also makes the diagram wider. Visual quality needs layout metrics, geometry assertions, screenshot/PNG
218
+ review, or human inspection.
219
+
220
+ <!-- BEGIN GENERATED: verify-result -->
221
+ `verify.ok` means no unsuppressed error was detected, including measured content occlusion and explicit error policies. It is not a visual-quality or semantic-correctness score.
222
+ <!-- END GENERATED: verify-result -->
220
223
 
221
224
  ## What we do NOT claim
222
225
 
@@ -111,6 +111,29 @@ color or an explicit readable fill; the renderer reports that configuration
111
111
  limit. Unresolved and translucent inks retain their authored values without a
112
112
  contrast guarantee.
113
113
 
114
+ ### Host contrast preferences
115
+
116
+ The renderer takes an explicit Style; it does not read OS preferences. A browser
117
+ host can select the existing high-contrast look before rendering:
118
+
119
+ ```ts
120
+ const preference = window.matchMedia('(prefers-contrast: more), (forced-colors: active)')
121
+ const svg = renderMermaidSVG(source, {
122
+ style: preference.matches ? 'accessible-high-contrast' : undefined,
123
+ security: 'strict',
124
+ })
125
+ ```
126
+
127
+ The host owns preference-change handling and re-rendering. The SVG keeps its
128
+ explicit palette when embedded as an image or exported to PNG/PDF, and identical
129
+ source and options still produce identical bytes. Explicit authored paint
130
+ remains authoritative; choosing this look is not a universal contrast guarantee.
131
+ Check the selected paint with the existing contrast constraints.
132
+
133
+ The [30 October evaluation](project/upstream-lessons-2026-10-30.md#contrast-preferences)
134
+ checked inline SVG and image embedding with Chromium media emulation on Linux.
135
+ It does not establish real Windows High Contrast or screen-reader behavior.
136
+
114
137
  ### Export and edit a built-in
115
138
 
116
139
  Built-ins dogfood this same record format. Export one with `getStyle`, validate
@@ -27,20 +27,39 @@ Run `bun run quality:check` to execute the complete GitHub **Quality gates**
27
27
  job locally. The command installs the frozen dependency graph and then runs
28
28
  the dependency audit, the font-subset, lazy browser-family catalog, and website
29
29
  regeneration checks, the whole-corpus audit, lint,
30
- repository-wide typechecking, and hero freshness (the
30
+ repository-wide typechecking (the
31
31
  list is `QUALITY_CHECKS` in `scripts/ci/quality-gates.ts`). The workflow calls
32
32
  this same entry point, so the local list and CI list cannot diverge.
33
33
 
34
- The E2E lanes build their own inputs and start alongside unit tests; only the
35
- final `CI complete` gate waits for every lane. Package manifest and export/type
36
- checks run after the Node 24 tarball consumer has built the package, rather
37
- than rebuilding all browser artifacts in a unit shard. Unit shards build only
38
- the Node bundle. Browser contracts run in two disjoint file shards, retaining
39
- one test process per file. Payload measurement has its own lane: each site
40
- build supplies the lazy bundle for comparison, so neither head nor base needs
41
- a second full package build. Generic PR render evidence is generated on demand
42
- with `scripts/pr-assets/meaning-preservation-evidence.ts BASE_SHA HEAD_SHA OUT_DIR`;
43
- automatic rendering of the same fixtures is no longer appended to every PR.
34
+ CI's artifact job builds the portable bundles, website fixture and verified
35
+ tarball once. Unit and E2E lanes consume those artifacts from the same checkout;
36
+ the final `CI complete` gate waits for every selected lane. Package manifest and
37
+ export/type checks inspect the packed artifact without rebuilding it in a unit
38
+ shard. Browser contracts run in two disjoint file shards, with one test process
39
+ per file. Payload measurement reuses the head build and builds the base website
40
+ separately for comparison.
41
+
42
+ The canonical unit collection is owned by `scripts/ci/unit-test-files.ts` and
43
+ shared with the order finder. `bun run test` prepares website fixtures before
44
+ starting its workers. Focused `bun test <file>` commands build on first use in
45
+ that process. Re-run the command after editing build inputs. For concurrent
46
+ focused commands in one checkout, prepare the fixture once and pass its owning
47
+ checkout explicitly:
48
+
49
+ ```bash
50
+ bun scripts/site/prepare-website-fixture.ts
51
+ AM_WEBSITE_FIXTURE_ROOT="$(pwd -P)" bun test <files> --parallel=2
52
+ ```
53
+
54
+ CI validates transferred fixtures with `--reuse`; `--reuse-lazy` is reserved for
55
+ the artifact producer immediately after its portable bundle build. No source
56
+ fingerprints or persistent freshness sentinels decide whether output is current.
57
+
58
+ The payload lane retains before/after witnesses for rendering changes; they can
59
+ also be generated on demand with
60
+ `scripts/pr-assets/meaning-preservation-evidence.ts BASE_SHA HEAD_SHA OUT_DIR`.
61
+ Scene comparisons cover the full selected corpus. Comparer fault checks run
62
+ once on the first eligible scene for each case, with progress logged per scene.
44
63
 
45
64
  Both tarball-consumer lanes also execute the Getting Started commands from the
46
65
  built website's shell blocks and `docs/getting-started.md`'s bash fences in fresh
@@ -57,8 +76,8 @@ gates: regenerate one with its `gallery:*` command when the rendering is
57
76
  reviewed again. Where an evidence script carried a real assertion, the unit
58
77
  suite now runs it against current code (for example the issue #87 link-rank
59
78
  gaps and the Section B sheet, which is regenerated in memory and
60
- byte-compared). Generated runtime modules are the narrow committed exception
61
- when production code imports them. Other derived discovery views are generated
79
+ byte-compared). Generated runtime modules and published reference documentation are committed
80
+ when one maintained source owns them. Other derived discovery views are generated
62
81
  at delivery: `am llms-txt` and the website use current registries, while the
63
82
  repository's authored `llms.txt` points readers to those sources. A second
64
83
  committed capability roster and its snapshot-freshness test are unnecessary.
@@ -129,9 +148,11 @@ establish representativeness; the interacting domain features do. See the
129
148
  [citizenship review contract](./contributing/diagram-family-citizenship.md#representative-examples-are-mandatory).
130
149
 
131
150
  **Runs:** every PR (`bun run test`, including the canonical 30-second per-test budget).
132
- **Does not prove:** that the diagram is *visually* good. `verify.ok` is
133
- structural only — stated repeatedly because it has burned us (the Auth
134
- Flow episode, Loop 15).
151
+ **Does not prove:** that the diagram is *visually* good.
152
+
153
+ <!-- BEGIN GENERATED: verify-result -->
154
+ `verify.ok` means no unsuppressed error was detected, including measured content occlusion and explicit error policies. It is not a visual-quality or semantic-correctness score.
155
+ <!-- END GENERATED: verify-result -->
135
156
 
136
157
  ## 2. Derived oracles — goldens and snapshots
137
158
 
@@ -492,22 +513,14 @@ mistake. Do not silently trim a generator or relax an assertion after it fails.
492
513
  Tests can be green while missing faults. The red-green-refactor cycle is the
493
514
  defence: write the test, watch it fail for the right reason, then fix.
494
515
 
495
- - **Red → green** (`scripts/ci/red-green.ts`, the `red-green` CI job) — when a
496
- pull request changes production source and tests, at least one changed test
497
- must produce an assertion failure attributed to a test location against base
498
- production. Missing imports, non-assertion setup errors, unlocated suite-hook
499
- assertions, timeouts and aborted runners are not
500
- behavioral evidence; the gate reads the pinned Bun runner's JUnit report.
501
- Unexpected production exceptions need an explicit `toThrow` / `not.toThrow`
502
- assertion. This mechanically
503
- checks the "tests that fail when the fix is reverted" rule for every PR,
504
- instead of a hand-written probe per fix. Pure refactors opt out with the
505
- `no-red-green` label. Like `payload-growth-approved`, it approves only the
506
- head it was applied to (`scripts/ci/label-approval.ts`): CI ignores a label
507
- applied before the latest push and removes it when new commits arrive.
508
- Bun's JUnit report cannot distinguish located per-test hook assertions from
509
- test-body assertions. Review their meaning: this gate is fault evidence, not
510
- a substitute for auditing whether each assertion exercises production behavior.
516
+ - **Red → green** is evidence for a bug fix, not a universal PR formality.
517
+ Run `bun scripts/ci/red-green.ts --base <sha>` when comparing changed tests
518
+ with base production helps demonstrate the intended regression. It is an
519
+ opt-in diagnostic: missing imports, setup failures, timeouts and aborted
520
+ runners do not count as behavioral evidence. A located assertion failure
521
+ still needs review; one unrelated red test cannot establish coverage for all
522
+ changed contracts. Refactors preserve behavior and need no failing-base
523
+ assertion or approval label.
511
524
 
512
525
  **Why this matters:** line coverage is collected weekly and on manual dispatch
513
526
  by `coverage.yml`, as one merged LCOV artifact assembled from three unit shards.
@@ -588,28 +601,22 @@ threads a golden anchor (reference-guided scoring).
588
601
  `ci.yml` is the source of truth for what gates each PR — read it rather than a
589
602
  table here, which would drift. In broad strokes:
590
603
 
591
- - **Per-PR (`ci.yml`):** the three-shard unit/property suite (`bun run test`) —
592
- Tier-1 verify, goldens, the differential + faithfulness + metamorphic gates,
593
- `measureQuality`/whole-corpus ugly-detector/layout-rubric, the heuristic-tracker ratchet,
594
- the corpus/seqbench/upstream benches — plus the high/critical dependency audit,
595
- type check, the hero check, the parallel browser/CLI/binary/fuzz e2e matrix (whose
596
- browser lane checks route payload budgets and, on pull requests, the gzip
597
- delta against the base branch built on the same runner), and the
598
- red → green changed-test check. Each unit shard runs its files with
599
- `--parallel=2` (isolated worker processes), so a test file cannot depend on
600
- another file's imports. CI prepares the shared website fixture in a separate
601
- two-minute step before starting those workers, so parallel consumers reuse
602
- a completed build instead of competing to generate it. A final `CI complete` job waits for the required
603
- test aggregate, every E2E matrix job and red → green, providing one
604
- protectable result that cannot turn green early.
604
+ - **Per change (`ci.yml`):** recognized Markdown-only edits run documentation,
605
+ executable-example and website checks. Other changes and manual dispatches run
606
+ full runtime qualification. Compatible consumers reuse built artifacts; native
607
+ builds and independent installations retain their own contracts. Required
608
+ checks must pass; additional passing checks do not invalidate the run.
609
+ - **Layout review:** relevant PR changes select the advisory image and generated
610
+ layout campaigns. A full manual dispatch can request them with `layout_evidence`.
611
+ - **Release and deployment:** follow the [release guide](contributing/releasing.md)
612
+ for full qualification and the distinction between CI success and delivery.
605
613
  - **Weekly (`contract-discovery.yml`):** one bounded model/grammar discovery job;
606
614
  findings remain replay artifacts for human triage, without automated issues.
607
- - **Per deploy (`deploy-cloudflare.yml`, release to-do):** when the deploy
608
- skips because `package.json` names a version that is not on npm, it opens
609
- one `release-todo` issue for that version, and a verified deploy of the
610
- version closes it (`scripts/ci/release-todo.ts`, tested with a fake `gh` in
611
- `release-todo.test.ts`). It adds no schedule and never fails a run. **Does
612
- not prove:** what production serves; it only reports the skip.
615
+ - **Per deploy (`deploy-cloudflare.yml`):** an unpublished package version
616
+ skips deployment with a warning and Actions summary. It opens no issues.
617
+ Verified promotion can close an existing release-to-do issue. Candidate
618
+ website/MCP probes, production identity checks and rollback protect actual
619
+ promotion; a green skipped workflow is not deployment evidence.
613
620
  - **Local performance campaigns:** benchmark suites are excluded from CI,
614
621
  scheduled workflows, hosted manual Actions and publication dependencies.
615
622
  `bun run bench:release` retains the matched Node corpus, scaling, agent edit,
@@ -18,8 +18,9 @@ bun run bin/am.ts render examples/styles/readme-hero.mmd --format png \
18
18
  --seed 11 --fit-width 1600 --security strict --output assets/hero.png
19
19
  ```
20
20
 
21
- `bun run hero` uses the same source and options through `renderMermaidPNG` and
22
- updates the existing SVG freshness record. `bun run hero:check` checks that
23
- record against fresh renderer output; inspect the PNG after regeneration.
21
+ `bun run hero` uses the same source and options through `renderMermaidPNG`.
22
+ Refresh it when changes to this example or its rendered appearance warrant a new
23
+ illustration, and inspect the PNG before committing it. It is a reviewed example,
24
+ not a byte-exact rendering baseline.
24
25
 
25
26
  This is an illustrative login flow, not a complete authentication design.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentic-mermaid",
3
3
  "mcpName": "io.github.adewale/agentic-mermaid",
4
- "version": "0.5.4",
4
+ "version": "0.5.6",
5
5
  "license": "MIT",
6
6
  "description": "Agentic Mermaid: render, verify, and safely edit Mermaid diagrams as ASCII, PNG, SVG, or structured agent workflows — with composable styles (hand-drawn, excalidraw, watercolor, or your own as JSON).",
7
7
  "type": "module",
@@ -142,7 +142,7 @@
142
142
  "!dist/metafile-esm.json"
143
143
  ],
144
144
  "scripts": {
145
- "test": "bun test --timeout 30000 src/__tests__/ eval/family-usage/count.test.ts eval/endpoint-marker/architecture-metrics.test.ts",
145
+ "test": "bun run scripts/ci/run-unit-tests.ts",
146
146
  "test:coverage": "bun run test -- --coverage",
147
147
  "typecheck": "bun run typecheck:core && bun run typecheck:repo",
148
148
  "typecheck:core": "tsc --noEmit -p tsconfig.json",
@@ -183,7 +183,6 @@
183
183
  "prepublishOnly": "npm run build",
184
184
  "goldens:ascii": "bun run scripts/update-ascii-goldens.ts",
185
185
  "hero": "bun run scripts/site/hero.ts",
186
- "hero:check": "bun run scripts/site/hero.ts --check",
187
186
  "style:audit": "bun test --timeout 60000 src/__tests__/style-options.test.ts src/__tests__/styled-output.test.ts",
188
187
  "sketch:check": "bun test scripts/sketch-prototype/styles.test.ts && bun run scripts/sketch-prototype/contrast-audit.ts",
189
188
  "doc-blocks": "bun run scripts/generate-doc-blocks.ts",
@@ -240,7 +239,8 @@
240
239
  "bench:modern-summary": "bun eval/benchmark/commands.ts bench:modern-summary",
241
240
  "bench:corpus:export": "bun eval/benchmark/commands.ts corpus:export",
242
241
  "bench:results": "bun eval/trident/run.ts results:publish",
243
- "build:zenuml": "tsup --config tsup.zenuml.config.ts"
242
+ "build:zenuml": "tsup --config tsup.zenuml.config.ts",
243
+ "release:prepare": "bun run scripts/prepare-release.ts"
244
244
  },
245
245
  "dependencies": {
246
246
  "@resvg/resvg-js": "2.6.2",
package/server.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "url": "https://github.com/adewale/agentic-mermaid",
8
8
  "source": "github"
9
9
  },
10
- "version": "0.5.4",
10
+ "version": "0.5.6",
11
11
  "websiteUrl": "https://agentic-mermaid.dev/",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "agentic-mermaid",
16
- "version": "0.5.4",
16
+ "version": "0.5.6",
17
17
  "runtimeHint": "npx",
18
18
  "runtimeArguments": [
19
19
  {
@@ -1,165 +1,30 @@
1
1
  ---
2
2
  name: agentic-mermaid-diagram-workflow
3
- description: Agent-agnostic skill for authoring and editing Mermaid diagrams with structured verification, typed mutation, round-trip serialization, and graphical, terminal, and layout outputs. The live capability registry identifies renderable and mutable families; unmodeled syntax remains source-preserved.
3
+ description: Create, edit, verify or render Mermaid diagrams with Agentic Mermaid. Read the operating guide, choose one available library, CLI or MCP channel, then use version-matched discovery for typed operations.
4
4
  ---
5
5
 
6
6
  # Agentic Mermaid — diagram workflow
7
7
 
8
- An agent-agnostic typed editing surface for Mermaid. New diagrams can be authored as Mermaid source and verified/rendered directly. Existing modeled diagrams can be parsed to a `ValidDiagram`, mutated with typed ops, verified structurally (not as subjective visual scoring), and serialized back to canonical source. Agentic Mermaid outputs SVG, PNG, ASCII, Unicode, and JSON layout; layout is deterministic — verified cross-process, no layout seed. Styled looks (`style` render option: name | spec | stack, e.g. `['hand-drawn', 'dracula']`) accept an ink `seed` that re-rolls wobble without ever moving layout; see docs/style-authoring.md.
8
+ Read the operating guide before diagram work:
9
9
 
10
- ## Pick a channel
10
+ - Installed CLI: `am --agent-instructions` (or `npx agentic-mermaid --agent-instructions`).
11
+ - This repository: `Instructions_for_agents.md` at the repository root.
12
+ - An `am init-agent` installation includes an offline copy at
13
+ `references/operating-guide.md` beside this skill.
14
+ - Without a local installation: [hosted operating guide](https://agentic-mermaid.dev/agent-instructions.md).
11
15
 
12
- - `agentic-mermaid-mcp` connected → **Code Mode** (`references/code-mode.md`). Multi-step edits in one round-trip.
13
- - Can run JS/TS with imports → **library** (`agentic-mermaid/agent`). Same SDK.
14
- - Shell only → **CLI** (`references/cli.md`).
15
- - No local install, network only → **hosted MCP** at `https://agentic-mermaid.dev/mcp` (stateless Streamable HTTP JSON-RPC; <!-- BEGIN GENERATED: hosted-mcp-tools -->`execute`, `describe_sdk`, `render_svg`, `render_ascii`, `render_png`, `verify`, `describe`, `mutate`, and `build`<!-- END GENERATED: hosted-mcp-tools --> tools — 64 KB input cap). Read `references/hosted-mcp.md` before composing a hosted request. Use the named direct tool and its exact argument object; do not substitute library APIs or local Code Mode for a hosted direct-tool task.
16
+ Follow the installed or connected version's guide and discovery. The online
17
+ guide describes production, which can differ from an older package. Choose
18
+ one channel and keep the diagram's source in the authorized environment.
16
19
 
17
- For hosted MCP, choose the least-powerful tool that completes the task:
20
+ Load only the relevant channel reference for exact call shapes:
18
21
 
19
- | Need | Tool | Required arguments |
20
- |---|---|---|
21
- | Structural validity, family, warnings, layout counts | `verify` | `{ source }` |
22
- | Prose, AX tree, or semantic fact inventory | `describe` | `{ source, format?: 'text' \| 'json' \| 'facts' }` |
23
- | Edit an existing diagram with known ops | `mutate` | `{ source, ops: [{ kind, ...fields }] }` |
24
- | Author a new modeled diagram with known ops | `build` | `{ family, ops: [{ kind, ...fields }] }` |
25
- | Discover one family's exact op fields | `describe_sdk` | `{ family, detail: 'fields' }` |
26
- | Custom synchronous control flow | `execute` | `{ code, timeoutMs? }` |
22
+ - [Code Mode](references/code-mode.md): synchronous `mermaid.*` SDK calls.
23
+ - [CLI](references/cli.md): shell commands and output files.
24
+ - [Hosted MCP](references/hosted-mcp.md): direct tools, JSON-RPC and request examples.
27
25
 
28
- Use `render_svg`, `render_ascii`, or `render_png` for a requested output; do not route a one-shot render, verify, describe, mutate, or build through `execute`.
29
- Mutation vocabularies are family-specific and are never interchangeable. In
30
- particular, a state diagram uses `add_state` and `add_transition`; never reuse
31
- the flowchart-only `add_node` or `add_edge` kinds for a state diagram. If the
32
- exact family op is not already known, call `describe_sdk` instead of borrowing
33
- an op name from another family. State `add_state` accepts `id`, optional
34
- `label`, `parent`, and `region`; it has no `terminal` field. Model an
35
- unsuccessful terminal state as an ordinary state reached by the requested
36
- labeled transition rather than inventing a convenience flag. For a class
37
- association, use `{ kind: 'add_relation', from, to, relKind: 'association' }`;
38
- there is no `add_relationship` op or `relation` field.
39
- The request envelope's `tool` is always one of the bare hosted names above.
40
- Never invent a provider-qualified name such as `hosted_agentic_mermaid_mcp.*`
41
- or a diagram-specific tool such as `update_state_diagram`.
42
- For a hosted task that asks for one final fenced JSON request, use this exact
43
- response order: (1) finish all explanation as prose or inline code, (2) emit
44
- the request in the answer's only fenced block, and (3) stop immediately after
45
- the closing fence. Never print a fenced request before the explanation, even as
46
- an example or draft, and never repeat it. Before emitting, count exactly one
47
- fenced block and recheck every op `kind` and field against this skill or
48
- `describe_sdk`; do not substitute a plausible synonym.
49
-
50
- ## Capability discovery
51
-
52
- Run `am capabilities --json` (or call the equivalent SDK capability API) before
53
- choosing a family or mutation. Its registry-derived family entries expose the
54
- current narrower, operation schema, edit policy, output support, per-family
55
- conformance, and minimal source example. This skill intentionally does not
56
- maintain a second family or operation table.
57
-
58
- On hosted MCP, inspect the connected server's `tools/list` for its tool surface
59
- and call `describe_sdk({ family, detail: 'fields' })` for mutation fields. There
60
- is no hosted tool named `capabilities`.
61
-
62
- Any diagram with constructs we don't model falls back to an **opaque** body: it still parses, renders, verifies, and round-trips losslessly — it just isn't offered for structured mutation (the narrower returns null). The parser never silently drops anything.
63
-
64
- State diagrams own a dedicated body: `asState` models states/transitions, `[*]`, composites, stereotypes/history, concurrency regions, notes, bare declarations, and class/inline paint. `asFlowchart` returns null on a state diagram.
65
-
66
- Gantt diagrams are segment-preserving: `asGantt` keeps title/section/task ops live while calendar directives (`dateFormat`, `axisFormat`, `excludes`, `includes`, `weekend`, `weekday`, `todayMarker`, `tickInterval`, `inclusiveEndDates`, `topAxis`), `click` lines, comments, and accessibility lines ride along verbatim. Gantt rendering is deterministic and never reads the wall clock; pass `ganttToday` when rendering if a `todayMarker` should be visible.
67
-
68
- `references/upstream/` documents Mermaid syntax for many more families than this renderer accepts; it is authoring reference only. `am capabilities --json` is the authoritative list of renderable families.
69
-
70
- ## Choosing a family
71
-
72
- Choose the family from the reader's task; the family is the result of that decision, not the starting point. The full task router, with per-family anti-patterns and the verify codes that check each choice, is `docs/choosing-a-diagram.md`. The routes agents most often miss:
73
-
74
- - Steps and decisions toward an outcome: flowchart. A system moving between modes in response to events: state.
75
- - Ordered messages between actors: sequence. A flowchart arrow reads as causality, not time.
76
- - Dated work with durations and dependencies: gantt. Undated eras: timeline. One person's scored experience of a process: journey.
77
- - Quantities that must balance across stages: sankey. Parts of one whole at one moment: pie. Measured series across categories or time: xychart.
78
-
79
- Renderability and edit policy still come from `am capabilities --json`, not from this routing.
80
-
81
- ## Workflow
82
-
83
- <!-- BEGIN GENERATED: new-diagram-policy -->New diagrams: author Mermaid source directly, then parse → verify → render or return it. `buildMermaid(kind, ops)` / `createMermaid(kind)` build a diagram from typed ops when you are generating one programmatically (for example, from data).<!-- END GENERATED: new-diagram-policy --> For existing modeled diagrams:
84
-
85
- 1. `parseRegisteredMermaid(source)` → `ValidDiagram`.
86
- 2. Use the family entry's advertised narrower (for example `asFlowchart(d)` or
87
- `asState(d)`) before mutating.
88
- 3. `mutate(d, op)` (typed per family).
89
- 4. `verifyMermaid(d)` — structured warnings; inspect `ok` / `warnings` / `layout`.
90
- 5. On `!ok`, revert to the previous `ValidDiagram`, try another op.
91
- 6. `serializeMermaid(d)` only after inspected verify passes.
92
-
93
- Do not regenerate or concatenate source to edit an existing structured diagram when a typed op exists. Direct source authoring is fine for new diagrams. Mutation ops use the discriminator field `kind` (not `type`). Edge removal uses ids such as `{ kind: 'remove_edge', id: 'API->DB' }`; verify before serializing.
94
-
95
- For `mutate` or `build`, treat the returned envelope as the commit boundary:
96
- accept `source` only when both top-level `ok` and `verify.ok` are true, and
97
- inspect `verify.warnings`. If an op fails, use its `opIndex` and `error`, call
98
- `describe_sdk` with `detail: 'fields'`, then retry with only the returned
99
- `kind` and fields. Never guess a hosted op name or fall back to source
100
- concatenation.
101
-
102
- When the user asks which embedded verification fields must pass, name the
103
- response paths exactly: require top-level `ok`, confirm top-level `family`,
104
- require `verify.ok`, and inspect `verify.warnings`. Do not replace those field
105
- paths with a paraphrase.
106
-
107
- In a hosted `mutate` request, `source` is the exact pre-edit input; do not apply
108
- the requested change to that string yourself. Express every change only in
109
- `ops`, and include no convenience fields that `describe_sdk` did not advertise.
110
- For file-backed input, inspect the bytes rather than relying on terminal display:
111
- preserve line endings and whether the file has a final newline. If the file ends
112
- in LF, the JSON `source` string must end in `\n` after its last visible line.
113
- Never trim or normalize the source; compare the JSON-decoded `source` bytes to
114
- the attachment before emitting the request.
115
-
116
- If a request such as “make this better” has no concrete quality goal, ask for
117
- the audience, output medium, and intended improvement before mutating. A
118
- read-only `verify`, `describe`, or render inspection is safe to offer, but do
119
- not invent an edit objective.
120
-
121
- Minimal existing-flowchart pattern:
122
-
123
- ```ts
124
- const parsed = parseRegisteredMermaid(source)
125
- if (!parsed.ok) return { phase: 'parse', errors: parsed.error }
126
- let cur = asFlowchart(parsed.value)
127
- if (!cur) return { phase: 'narrow', family: parsed.value.kind }
128
- for (const op of [
129
- { kind: 'remove_edge', id: 'API->DB' },
130
- { kind: 'add_node', id: 'Cache', label: 'Cache' },
131
- { kind: 'add_edge', from: 'API', to: 'Cache' },
132
- { kind: 'add_edge', from: 'Cache', to: 'DB' },
133
- ] as const) {
134
- const next = mutate(cur, op)
135
- if (!next.ok) return { phase: 'mutate', op, error: next.error }
136
- cur = next.value
137
- }
138
- const verify = verifyMermaid(cur)
139
- if (!verify.ok) return { phase: 'verify', warnings: verify.warnings }
140
- return { source: serializeMermaid(cur) }
141
- ```
142
-
143
- Output artifact pattern:
144
-
145
- ```ts
146
- const verify = verifyMermaid(cur)
147
- if (!verify.ok) return { phase: 'verify', warnings: verify.warnings }
148
- const svg = renderMermaidSVG(cur, { security: 'strict' })
149
- const png = renderMermaidPNG(cur, {
150
- fitTo: { width: 1200 },
151
- background: '#fff',
152
- minLabelPx: 9,
153
- onWarning: warning => console.warn(warning.code, warning.message),
154
- })
155
- const ascii = renderMermaidASCII(cur, { useAscii: true })
156
- const unicode = renderMermaidASCII(cur, { useAscii: false })
157
- const layout = verify.layout
158
- ```
159
-
160
- CLI PNG: `am render diagram.mmd --format png --output diagram.png
161
- --min-label-px 9`. `BELOW_READABLE_SIZE` is a bounded shrinkage warning, not
162
- proof of readability; choose a task-specific floor when viewing conditions are
163
- known, or pass `0` to disable it.
164
-
165
- See `references/flowchart.md`, `references/sequence.md`, `references/timeline.md`, `references/upstream/gantt.md`, and the repository cookbook at `docs/agent-api-cookbook.md`.
26
+ The operating guide owns authoring, typed edits, verification, semantic
27
+ read-back, source-preserving fallback and response rules. References add
28
+ channel and family syntax; they do not define a second workflow. Discover
29
+ family headers and operations with `am capabilities --json` or `describe_sdk`
30
+ rather than borrowing another family's vocabulary.
@@ -2,7 +2,8 @@
2
2
 
3
3
  <!-- complete: local-mcp-tools -->
4
4
  `agentic-mermaid-mcp` exposes a primary Code Mode tool, `execute(code)`, plus
5
- narrow `describe_sdk`, `render_png`, and `describe` helpers. The initial
5
+ narrow `describe_sdk`, `render_png`, and `describe` helpers, plus declarative
6
+ `mutate` and `build` tools. The initial
6
7
  `execute` declaration contains only the core SDK. Call
7
8
  `describe_sdk({ family, detail: 'fields' })` before an unfamiliar mutation to
8
9
  load that family's exact schema; use `detail: 'signatures'` for a compact menu.
@@ -102,4 +103,13 @@ return sources.map(src => {
102
103
  Conventions: return the final value; do not use imports or type annotations in
103
104
  Code Mode; do not use `async`/`await` or Promise jobs; for new diagrams, author
104
105
  source then parse/verify; for existing modeled diagrams, narrow before mutate and
105
- verify before every serialize; `verify.ok` is structural rather than visual or semantic, so inspect layout/render artifacts for visual tasks and use `checkMermaid` facts for task-critical meaning; for an opaque-fallback body (any unmodeled syntax, where the narrower returns null), return an explicit unsupported-family result unless the task requested source-level editing and you can re-parse + verify afterward.
106
+ verify before every serialize.
107
+
108
+ <!-- BEGIN GENERATED: verify-result -->
109
+ `verify.ok` means no unsuppressed error was detected, including measured content occlusion and explicit error policies. It is not a visual-quality or semantic-correctness score.
110
+ <!-- END GENERATED: verify-result -->
111
+
112
+ Inspect layout/render artifacts for visual tasks and use `checkMermaid` facts
113
+ for task-critical meaning. For an opaque-fallback body (unmodeled syntax where
114
+ the narrower returns null), return an explicit unsupported-family result unless
115
+ the task requested source-level editing and you can re-parse and verify afterward.
@@ -45,7 +45,7 @@ synonym is still an invalid call.
45
45
  ## Direct tools
46
46
 
47
47
  <!-- complete: hosted-mcp-tools -->
48
- - `verify({ source })` returns structural `ok`, detected `family`, `summary`,
48
+ - `verify({ source })` returns `ok`, detected `family`, `summary`,
49
49
  `warnings`, and layout counts. Confirm the family as well as `ok`.
50
50
  - `describe({ source, format })` uses `text` for prose, `json` for an AX tree,
51
51
  and `facts` for compact deterministic semantic fact lines.
@@ -61,6 +61,10 @@ synonym is still an invalid call.
61
61
  `mermaid.*` global. Reserve it for custom control flow that a direct tool or
62
62
  op list cannot express.
63
63
 
64
+ <!-- BEGIN GENERATED: verify-result -->
65
+ `verify.ok` means no unsuppressed error was detected, including measured content occlusion and explicit error policies. It is not a visual-quality or semantic-correctness score.
66
+ <!-- END GENERATED: verify-result -->
67
+
64
68
  There is no hosted `capabilities` tool. Use the MCP client's `tools/list` for
65
69
  tool discovery and `describe_sdk` for one family's mutation schema.
66
70