CLI Reference
How to use the Shumoku command-line tool
shumoku render
Render diagrams from YAML/JSON files.
npx @shumoku/cli render <input> [options]Options
| Option | Description |
|---|---|
-f, --format <type> | Output format: svg, html, png (default: auto-detect from extension) |
-o, --output <file> | Output filename (default: output.svg) |
--scale <number> | PNG scale factor (default: 2) |
-h, --help | Show help |
-v, --version | Show version |
Examples
# SVG output
npx @shumoku/cli render network.yaml -o diagram.svg
# Interactive HTML output
npx @shumoku/cli render network.yaml -f html -o diagram.html
# PNG output
npx @shumoku/cli render network.yaml -f png -o diagram.png
# High-resolution PNG output
npx @shumoku/cli render network.yaml -f png --scale 3 -o diagram.png
# Generate from JSON
npx @shumoku/cli render topology.json -o diagram.svg
# Read from stdin
cat network.yaml | npx @shumoku/cli render - -o diagram.svgInput Formats
Auto-detected from extension:
| Extension | Format |
|---|---|
.yaml, .yml | YAML |
.json | JSON |
- (stdin) | Interpreted as YAML |
Output Formats
| Format | Description | Use Case |
|---|---|---|
svg | Vector image | Document embedding, editing |
html | Interactive HTML | Browser viewing, pan/zoom |
png | Raster image | Presentations, sharing as image |
PNG Options
Additional options for PNG output:
# High resolution output (default: scale=2)
npx @shumoku/cli render network.yaml -f png --scale 3 -o diagram.pngWhen using from TypeScript (Node.js only):
import { renderGraphToPng } from '@shumoku/renderer-png'
const output = await renderGraphToPng(graph, {
scale: 3 // Resolution scale
})Integration Workflow
Generate JSON from other systems and render it with the CLI:
# 1. Generate Shumoku JSON with a custom script
node generate-from-api.js > network.json
# 2. Generate a diagram from the JSON
npx @shumoku/cli render network.json -f html -o diagram.htmlSee Custom Integration for details.