Shumoku

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

OptionDescription
-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, --helpShow help
-v, --versionShow 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.svg

Input Formats

Auto-detected from extension:

ExtensionFormat
.yaml, .ymlYAML
.jsonJSON
- (stdin)Interpreted as YAML

Output Formats

FormatDescriptionUse Case
svgVector imageDocument embedding, editing
htmlInteractive HTMLBrowser viewing, pan/zoom
pngRaster imagePresentations, 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.png

When 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.html

See Custom Integration for details.

On this page