Merlive

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 .mmd file, or a page or script that keeps a flowchart in a string (an .astro page, say).
  • Each block becomes <file>-<n>.html in a diagrams folder beside the file. --out puts them elsewhere, and --only 2 draws just the second block.
  • --format svg writes a still picture instead, for a wiki or anywhere a page cannot be opened.

What it says

A line that startsMeans
drewA diagram was written, with how many boxes and links it has and the design it is drawn in
would drawWith --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.

RuleUsual fix
P6 words do not fitShorten the label, and put the detail in a %% note
P7 a link's words squeezed into a columnShorten the words on the link
P4 too many crossingsName the main path with %% main:, or split the diagram in two
P3 a line through a boxName the main path with %% main:, so the box in the way moves aside
S7 a name or words too long, in a sequence diagramGive the participant a shorter name with as, or break a message with <br/>
D1 contrastChange the colour the message names, in the design file
D2 kinds look alikeMake 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 withMeans
0Every flowchart was drawn (or, with --check, would be)
1A diagram broke a rule and was not written; the rule and the place are named
2Something is missing: the file, an option's value, the design file
3The 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