cli-anything-drawio
A CLI harness for Draw.io — create, edit, and export diagrams from the command line.
Installation
This CLI is installed as part of the cli-anything-drawio package:
Prerequisites:
- Python 3.10+
- drawio must be installed on your system
Usage
Basic Commands
REPL Mode
When invoked without a subcommand, the CLI enters an interactive REPL session:
Command Groups
Project
Project management: new, open, save, info.
Shape
Shape operations: add, remove, move, resize, style.
Connect
Connector operations: add, remove, style.
Page
Page operations: add, remove, rename, list.
Export
Export operations: render to PNG, PDF, SVG.
Session
Session management: status, undo, redo.
Examples
Create a New Project
Create a new drawio project file.
Interactive REPL Session
Start an interactive session with undo/redo support.
Export Project
Export the project to a final output format.
State Management
The CLI maintains session state with:
- Undo/Redo: Up to 50 levels of history
- Project persistence: Save/load project state as JSON
- Session tracking: Track modifications and changes
Output Formats
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable (
--jsonflag): Structured JSON for agent consumption
For AI Agents
When using this CLI programmatically:
- Always use
--jsonflag for parseable output - Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
- Use absolute paths for all file operations
- Verify outputs exist after export operations
More Information
- Full documentation: See README.md in the package
- Test coverage: See TEST.md in the package
- Methodology: See HARNESS.md in the cli-anything-plugin
Version
1.0.0

