zombie-mermaid 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +6 -4
  2. package/dist/ascii.cjs +52 -9
  3. package/dist/ascii.cjs.map +1 -1
  4. package/dist/ascii.js +3151 -1916
  5. package/dist/ascii.js.map +1 -1
  6. package/dist/cli.js +6030 -5883
  7. package/dist/index.cjs +59 -59
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +50 -0
  10. package/dist/index.d.ts +50 -0
  11. package/dist/index.js +4594 -4534
  12. package/dist/index.js.map +1 -1
  13. package/dist/mcp.cjs +5868 -5609
  14. package/dist/mcp.cjs.map +1 -1
  15. package/dist/mcp.d.cts +2 -2
  16. package/dist/mcp.d.ts +2 -2
  17. package/dist/mcp.js +5868 -5609
  18. package/dist/mcp.js.map +1 -1
  19. package/package.json +1 -1
  20. package/src/__tests__/ascii-class-label-row-collision-531.test.ts +135 -0
  21. package/src/__tests__/ascii-state-bidirectional-label-swap-530.test.ts +130 -0
  22. package/src/__tests__/mcp-check-sequence-activations-tool.test.ts +85 -0
  23. package/src/__tests__/mcp-server.test.ts +33 -3
  24. package/src/__tests__/parser.test.ts +51 -1
  25. package/src/__tests__/render-options-per-type.test.ts +174 -0
  26. package/src/__tests__/sequence-activation-check.test.ts +220 -0
  27. package/src/ascii/class-diagram.ts +130 -54
  28. package/src/ascii/draw-arrows.ts +42 -7
  29. package/src/ascii/index.ts +13 -10
  30. package/src/class/layout.ts +3 -3
  31. package/src/diagram-registry.ts +190 -0
  32. package/src/er/layout.ts +3 -3
  33. package/src/index.ts +35 -55
  34. package/src/layout-engine.ts +7 -3
  35. package/src/mcp/server.ts +34 -6
  36. package/src/mcp/tools/check-sequence-activations.ts +89 -0
  37. package/src/parser.ts +58 -1
  38. package/src/sequence/activation-check.ts +148 -0
  39. package/src/sequence/layout.ts +2 -2
  40. package/src/types.ts +120 -0
  41. package/src/xychart/layout.ts +2 -2
package/README.md CHANGED
@@ -150,7 +150,7 @@ hyperlinks — off by default, since terminal and pager support varies (see
150
150
 
151
151
  **Output rules.** `-o` is the destination for the run's _file_ output — SVG, HTML, or PNG when `--svg`/`--html`/`--png` is given, otherwise the ASCII rendering — and `-o -` sends it to stdout instead. A recognised extension (`.svg`, `.html`/`.htm`, `.txt`, `.png`) picks the format on its own, so the flag can be dropped; an extension that contradicts an explicit flag (`--svg -o out.txt`) is an error, while unrecognised ones are simply used as given. `--svg`/`--html`/`--png` with no `-o` writes `<input stem>.svg`/`.html`/`.png` beside the input (stdin input has no name to derive from, so it must pass `-o`). Only one of `--svg`/`--html`/`--png` can be set at a time — run the command twice for more than one. ASCII always prints to the terminal when one of them is also requested (`--ascii --svg -o out.svg`), and never carries ANSI colour codes when written to a file. **An existing output file is never overwritten unless you pass `--force`/`-f`.**
152
152
 
153
- **`--html`** wraps the rendered SVG in a self-contained pan/zoom viewer — one file, no server, no network — with drag/scroll pan, ctrl/cmd+scroll and pinch to zoom, fit/1:1 buttons, a light/dark toggle that follows `prefers-color-scheme`, and keyboard controls. It opens straight from disk and survives being emailed as a single attachment. This is the one place in the project that ships client-side JavaScript, and deliberately so — see [`docs/decisions/no-script-interactivity.md`](docs/decisions/no-script-interactivity.md): the library's own SVG output stays permanently script-free, and this viewer is a separate CLI artifact wrapping that output, never part of it.
153
+ **`--html`** wraps the rendered SVG in a self-contained pan/zoom viewer — one file, no server, no network — with drag/scroll pan, ctrl/cmd+scroll and pinch to zoom, fit/1:1 buttons, a light/dark toggle that follows `prefers-color-scheme`, and keyboard controls. It opens straight from disk (including over `file://`, no server needed) and survives being emailed as a single attachment — see [Using the self-contained HTML viewer](docs/guides/html-viewer.md) for the full controls reference. This is the one place in the project that ships client-side JavaScript, and deliberately so — see [`docs/decisions/no-script-interactivity.md`](docs/decisions/no-script-interactivity.md): the library's own SVG output stays permanently script-free, and this viewer is a separate CLI artifact wrapping that output, never part of it.
154
154
 
155
155
  **`--png`** rasterizes the diagram for anywhere SVG isn't accepted — issue trackers, Slack, docs tools, email — at the SVG's own pixel dimensions (1:1, no scaling). It always resolves CSS colors first, automatically, the same substitution `--resolve-colors` does for `--svg` — a rasterizer can't evaluate `var()`/`color-mix()`, so skipping this would render the whole theme black. Rasterization is via [`@resvg/resvg-js`](https://github.com/thx/resvg-js), listed as an `optionalDependency`: a normal install pulls its native binary like any other dependency, but a platform it has no prebuilt binary for, or an install run with `--no-optional`, simply skips it — `--png` then fails with a clear error telling you how to install it explicitly, rather than breaking the rest of the CLI.
156
156
 
@@ -160,7 +160,7 @@ hyperlinks — off by default, since terminal and pager support varies (see
160
160
 
161
161
  > 🧪 **Experimental — shipped to gauge interest, not a finished or best-effort implementation.** This is a first cut covering the common case; the tool surface may change based on feedback. Try it and [open an issue](https://github.com/dfadler/zombie-mermaid/issues/new) with what you'd want from it.
162
162
 
163
- `zombie-mermaid mcp` starts a [Model Context Protocol](https://modelcontextprotocol.io/) server on stdio, exposing the library's rendering as two tools: `render_mermaid_svg` and `render_mermaid_ascii`. Point an MCP client (Claude Desktop, Claude Code, or anything else that speaks MCP) at it to render Mermaid diagrams directly in a conversation, without shelling out to the CLI or importing the library.
163
+ `zombie-mermaid mcp` starts a [Model Context Protocol](https://modelcontextprotocol.io/) server on stdio, exposing the library's rendering as three tools: `render_mermaid_svg`, `render_mermaid_ascii`, and `check_mermaid_sequence_activations`. Point an MCP client (Claude Desktop, Claude Code, or anything else that speaks MCP) at it to render Mermaid diagrams directly in a conversation, without shelling out to the CLI or importing the library.
164
164
 
165
165
  Example Claude Desktop / Claude Code MCP server config:
166
166
 
@@ -175,7 +175,9 @@ Example Claude Desktop / Claude Code MCP server config:
175
175
  }
176
176
  ```
177
177
 
178
- Both tools accept a `diagram` string plus a handful of rendering options (`theme`, `transparent`, `font` for SVG; `useAscii`, `paddingX`/`paddingY`/`boxBorderPadding` for ASCII) — see each tool's `inputSchema` for the full, current list. Invalid Mermaid syntax comes back as a normal tool error (`isError: true`) rather than crashing the connection.
178
+ All three tools accept a `diagram` string. The two render tools also take a handful of rendering options (`theme`, `transparent`, `font` for SVG; `useAscii`, `paddingX`/`paddingY`/`boxBorderPadding` for ASCII) — see each tool's `inputSchema` for the full, current list. Invalid Mermaid syntax comes back as a normal tool error (`isError: true`) rather than crashing the connection.
179
+
180
+ `check_mermaid_sequence_activations` is a mechanical, deterministic check — no LLM judgment involved — for a specific gap in existing Mermaid validators: every `activate X` (or `+` arrow shorthand) in a `sequenceDiagram` must be closed by a matching `deactivate X` (`-` shorthand) before the diagram ends. It returns a JSON report (`{ ok, issues }`) rather than rendering anything, and errors (`isError: true`) if given a non-sequence diagram.
179
181
 
180
182
  To embed the server in your own process instead of running it as a subcommand, import `zombie-mermaid/mcp` and connect it to any [MCP `Transport`](https://modelcontextprotocol.io/) yourself:
181
183
 
@@ -191,7 +193,7 @@ await server.connect(new StdioServerTransport())
191
193
 
192
194
  ## Docs
193
195
 
194
- - [Guides](docs/guides/) — task-oriented walkthroughs: [browsing the samples](docs/guides/samples.md), [choosing a theme](docs/guides/theming.md)
196
+ - [Guides](docs/guides/) — task-oriented walkthroughs: [browsing the samples](docs/guides/samples.md), [choosing a theme](docs/guides/theming.md), [using the HTML viewer](docs/guides/html-viewer.md)
195
197
  - [Accessibility](docs/accessibility.md) — conformance statement: what's guaranteed (and CI-enforced), what's implemented but unverified by automation, and what isn't covered
196
198
  - [Theming](docs/theming.md) — the two-color foundation, enriched mode, built-in themes, custom themes, Shiki compatibility
197
199
  - [Supported Diagrams](docs/diagrams.md) — syntax for every diagram type, XY chart styling, and ASCII rendering options