Skip to main content

cli-anything-drawio

A CLI harness for Draw.io — create, edit, and export diagrams from the command line.

Designed for AI agents and power users who need to generate diagrams programmatically.

Prerequisites

  • Python 3.10+
  • draw.io desktop app (for PNG/PDF/SVG export):
    • macOS: brew install --cask drawio
    • Linux: snap install drawio
    • Windows: winget install JGraph.Draw

Note: The CLI can create and manipulate .drawio files without the desktop app installed. The app is only needed for rasterized export (PNG, PDF, SVG).

Installation

cd drawio/agent-harness
pip install -e .

Usage

One-shot commands

# Create a new diagram
cli-anything-drawio project new --preset letter -o diagram.drawio

# Add shapes
cli-anything-drawio --project diagram.drawio shape add rectangle --label "Server"
cli-anything-drawio --project diagram.drawio shape add cylinder --label "Database" --x 300 --y 100

# Connect shapes
cli-anything-drawio --project diagram.drawio connect add <source_id> <target_id>

# Export
cli-anything-drawio --project diagram.drawio export render output.png -f png
cli-anything-drawio --project diagram.drawio export render output.svg -f svg

JSON mode (for AI agents)

cli-anything-drawio --json project new -o diagram.drawio
cli-anything-drawio --json --project diagram.drawio shape add rectangle --label "API"
cli-anything-drawio --json --project diagram.drawio shape list

Interactive REPL

cli-anything-drawio
# or
cli-anything-drawio repl --project diagram.drawio

Command Reference

Group Command Description
project new, open, save, info, xml, presets Project lifecycle
shape add, remove, list, label, move, resize, style, info, types Shape operations
connect add, remove, label, style, list, styles Connector operations
page add, remove, rename, list Multi-page management
export render, formats Export to PNG/PDF/SVG/XML
session status, undo, redo, save-state, list Session management

Shape Types

rectangle, rounded, ellipse, diamond, triangle, hexagon, cylinder, cloud, parallelogram, process, document, callout, note, actor, text

Edge Styles

straight, orthogonal, curved, entity-relation

Running Tests

cd drawio/agent-harness
python3 -m pytest cli_anything/drawio/tests/ -v

Release files for cli-anything-drawio 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cli-anything-drawio 1.0.0
File Size Uploaded
cli_anything_drawio-1.0.0.tar.gz 36.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cli-anything-drawio 1.0.0
File Interpreter ABI Platform
cli_anything_drawio-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 80.2 kB

Release files / cli_anything_drawio-1.0.0.tar.gz

Download URL cli_anything_drawio-1.0.0.tar.gz
Size 36.8 kB
Tags Source
SHA-256 checksum
How to use checksums
08991cd3e6b535dc8e6a90bdb65e78d9782d1c25be5911ab3d270cdd1a792747
BLAKE2b-256 checksum
How to use checksums
4db74c6e50803a84a4744d6c83ba630fe30e24d592988177fa02de6f11a8ad75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / cli_anything_drawio-1.0.0-py3-none-any.whl

Download URL cli_anything_drawio-1.0.0-py3-none-any.whl
Size 43.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e62006580aa26476c99f99df5cfc732b256ed2d114cfc64a3d438c56ecf8f08
BLAKE2b-256 checksum
How to use checksums
5ea229ab8fd6753b7cb423cc34675afb1b7e82d5f4fb53a901f37a0a50c91327
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page