Skip to main content

CLI harness for Draw.io - Diagram creation and export via draw.io CLI. Requires: draw.io desktop app (draw.io --export)

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_anything_drawio-1.0.0.tar.gz (36.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_anything_drawio-1.0.0-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file cli_anything_drawio-1.0.0.tar.gz.

File metadata

  • Download URL: cli_anything_drawio-1.0.0.tar.gz
  • Upload date:
  • Size: 36.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for cli_anything_drawio-1.0.0.tar.gz
Algorithm Hash digest
SHA256 08991cd3e6b535dc8e6a90bdb65e78d9782d1c25be5911ab3d270cdd1a792747
MD5 6699d274c935678a24f6e9cabdf8df43
BLAKE2b-256 4db74c6e50803a84a4744d6c83ba630fe30e24d592988177fa02de6f11a8ad75

See more details on using hashes here.

File details

Details for the file cli_anything_drawio-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cli_anything_drawio-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e62006580aa26476c99f99df5cfc732b256ed2d114cfc64a3d438c56ecf8f08
MD5 d98a85dc03baecfa31a210f97632464c
BLAKE2b-256 5ea229ab8fd6753b7cb423cc34675afb1b7e82d5f4fb53a901f37a0a50c91327

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page