The command
Merlive is one script, skills/merlive/scripts/merlive.mjs, run with Node 22 from the project's folder. Your agent runs it for you. This page is for when you want to run it yourself, or to know what your agent did.
Every option
This is what --help prints.
Merlive 0.6.1: Mermaid flowcharts, state, class, entity, requirement, C4, architecture, block and sequence diagrams, mindmaps, kanban boards, timelines and packets, placed by rule and made live.
node merlive.mjs <file> [options] draw a file's flowcharts and sequence diagrams:
Markdown, a .mmd file, or a page or script that keeps
a flowchart in a string
node merlive.mjs --setup [file.md] [--from <site>] once for a project: read its colours, write its design
--setup read the project's colours (its own stylesheet, or the site named in package.json) and
write merlive.design.json and a page showing a diagram in them. Asks nothing.
--from <site> with --setup: the address of the site the diagrams will be read on, or the path of a
stylesheet or a folder of them
--out <folder> where the diagrams go (default: a "diagrams" folder beside the file)
--design <file> a design file to draw with (default: merlive.design.json in this folder if there is
one, else Merlive's own look, in light and dark)
--format <html|svg|both> a live page, a still picture for wikis, or both (default: what the design says)
--only <n> just the nth Mermaid block of the file
--check say what would be drawn and whether it passes its rules; write nothing
--force write a diagram even when it breaks a rule; with --setup, replace the design there is
--help this
Ends with 0 when every diagram was drawn, 1 when one broke a rule and was not written, 2 when something is
missing (the file, an option's value, the design, a site that does not answer), 3 when the file has nothing
Merlive draws. A state diagram is drawn as a flowchart is. Blocks of any other kind of diagram are left as they
are and named.
Check first, then draw
node skills/merlive/scripts/merlive.mjs docs/orders.md --check # what would be drawn; writes nothing
node skills/merlive/scripts/merlive.mjs docs/orders.md # diagrams/orders-1.html beside the file
- One file at a time: Markdown, a
.mmdfile, or a page or script that keeps a flowchart in a string (an.astropage, say). - Each block becomes
<file>-<n>.htmlin adiagramsfolder beside the file.--outputs them elsewhere, and--only 2draws just the second block. --format svgwrites a still picture instead, for a wiki or anywhere a page cannot be opened.
What it says
| A line that starts | Means |
|---|---|
drew | A diagram was written, with how many boxes and links it has and the design it is drawn in |
would draw | With --check: it passes its rules and would be written |
left as Mermaid: | A block of a kind Merlive does not draw. It is named by its number and line, and left exactly as written |
note, | Something the script could not read or draw as written: a group's own direction, an icon it has no drawing for. The diagram is still drawn |
not drawn: | The block breaks a rule. Each rule broken follows, with the place and what to change |
When a rule fails
The script ends with 1, writes nothing for that diagram, and names the rule. Each has one usual fix, made in the Mermaid.
| Rule | Usual fix |
|---|---|
| P6 words do not fit | Shorten the label, and put the detail in a %% note |
| P7 a link's words squeezed into a column | Shorten the words on the link |
| P4 too many crossings | Name the main path with %% main:, or split the diagram in two |
| P3 a line through a box | Name the main path with %% main:, so the box in the way moves aside |
| S7 a name or words too long, in a sequence diagram | Give the participant a shorter name with as, or break a message with <br/> |
| D1 contrast | Change the colour the message names, in the design file |
| D2 kinds look alike | Make one of the two colours named lighter or darker, in the design file |
--force writes the diagram anyway. It is for when you have read the message and still want the picture.
How it ends
| Ends with | Means |
|---|---|
| 0 | Every flowchart was drawn (or, with --check, would be) |
| 1 | A diagram broke a rule and was not written; the rule and the place are named |
| 2 | Something is missing: the file, an option's value, the design file |
| 3 | The file has no flowchart to draw |
Where the Mermaid is found
Fenced mermaid blocks in Markdown (.md, .mdx); the whole of a .mmd file; and, in any other file, a string between backticks that starts as a flowchart does. A string put together when the page runs cannot be read.
Written from site/pages/command.md in the repository, so the two cannot disagree.
Before: A sequence diagram’s rulesNext: What your agent is told