rendering
Mermaid CLI for Shell Scripts
Use the Mermaid CLI for shell scripts with headless JSON commands, schema discovery, credentials, and permission controls.
1 functions 0 read 1 write No credentials auth
Mermaid CLI for Shell Scripts
Call integration functions from shell scripts with stable JSON input and output.
Use shell scripts for small local automations that need one or more integration calls. The Mermaid CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Mermaid CLI for Shell Scripts
kosmokrator integrations:configure mermaid --enable --read allow --write ask --json
kosmo integrations:call mermaid.render_mermaid '{"syntax":"example_syntax","title":"example_title","width":1,"theme":"example_theme"}' --json Discovery Before Execution
Agents and scripts can inspect Mermaid docs and schemas before choosing a function.
kosmo integrations:docs mermaid --json
kosmo integrations:docs mermaid.render_mermaid --json
kosmo integrations:schema mermaid.render_mermaid --json
kosmo integrations:search "Mermaid" --json
kosmo integrations:list --json Useful Mermaid CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
mermaid.render_mermaid | Write | syntax, title, width, theme | Render a Mermaid diagram to a PNG image. Pass valid Mermaid syntax and get back a markdown image embed. Supported diagram types: flowchart, sequence, class, state, ER, Gantt, pie, quadrant, requirement, git graph, C4, mindmap, timeline, sankey, XY chart, block. Example syntax: ``` graph TD A[Start] --> B{Decision} B -->|Yes| C[Action] B -->|No| D[End] ``` Tips: - Use `graph TD` for top-down flowcharts, `graph LR` for left-to-right - Use `sequenceDiagram` for sequence diagrams - Use `erDiagram` for entity-relationship diagrams - Use `classDiagram` for class diagrams - Use `stateDiagram-v2` for state diagrams - Use `gantt` for Gantt charts - Use `pie` for pie charts - Use `gitgraph` for git graphs - Use `mindmap` for mind maps |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.