cli-anything-inkscape
A stateful command-line interface for vector graphics editing, following the same patterns as the GIMP and Blender CLI harnesses. Directly manipulates SVG (XML) documents with a JSON project format for state tracking.
Installation
This CLI is installed as part of the cli-anything-inkscape package:
bash
pip install cli-anything-inkscape
Prerequisites:
- Python 3.10+
- inkscape must be installed on your system
Usage
Basic Commands
bash
# Show help
cli-anything-inkscape --help
# Start interactive REPL mode
cli-anything-inkscape
# Create a new project
cli-anything-inkscape project new -o project.json
# Run with JSON output (for agent consumption)
cli-anything-inkscape --json project info -p project.json
REPL Mode
When invoked without a subcommand, the CLI enters an interactive REPL session:
bash
cli-anything-inkscape
# Enter commands interactively with tab-completion and history
Command Groups
Document
Document management commands.
| Command | Description |
|---|
| Create a new document |
| Open an existing project |
| Save the current project |
| Show document information |
| List available document profiles |
| Set the canvas size |
| Set the document units |
| Print raw project JSON |
Shape
Shape management commands.
| Command | Description |
|---|
| Add a rectangle |
| Add a circle |
| Add an ellipse |
| Add a line |
| Add a polygon |
| Add a path |
| Add a star |
| Remove a shape by index |
| Duplicate a shape |
| List all shapes/objects |
| Get detailed info about a shape |
Text
Text management commands.
| Command | Description |
|---|
| Add a text element |
| Set a text property (text, font-family, font-size, fill, etc.) |
| List all text objects |
Style
Style management commands.
| Command | Description |
|---|
| Set the fill color of an object |
| Set the stroke color (and optionally width) of an object |
| Set the opacity of an object (0.0-1.0) |
| Set an arbitrary style property on an object |
| Get the style properties of an object |
| List all available style properties |
Transform
Transform operations (translate, rotate, scale, skew).
| Command | Description |
|---|
| Translate (move) an object |
| Rotate an object |
| Scale an object |
| Skew an object horizontally |
| Skew an object vertically |
| Get the current transform of an object |
| Clear all transforms from an object |
Layer
Layer management commands.
| Command | Description |
|---|
| Add a new layer |
| Remove a layer by index |
| Move an object to a different layer |
| Set a layer property (name, visible, locked, opacity) |
| List all layers |
| Move a layer from one position to another |
| Get detailed info about a layer |
Path Group
Path boolean operations.
| Command | Description |
|---|
| Union of two objects |
| Intersection of two objects |
| Difference of two objects (A minus B) |
| Exclusion (XOR) of two objects |
| Convert a shape to a path |
| List available path boolean operations |
Gradient
Gradient management commands.
| Command | Description |
|---|
| Add a linear gradient |
| Add a radial gradient |
| Apply a gradient to an object |
| List all gradients |
Export Group
Export/render commands.
| Command | Description |
|---|
| Render the document to PNG |
| Export the document as SVG |
| Export the document as PDF (requires Inkscape) |
| List export presets |
Session
Session management commands.
| Command | Description |
|---|
| Show session status |
| Undo the last operation |
| Redo the last undone operation |
| Show undo history |
Examples
Create a New Project
Create a new inkscape project file.
bash
cli-anything-inkscape project new -o myproject.json
# Or with JSON output for programmatic use
cli-anything-inkscape --json project new -o myproject.json
Interactive REPL Session
Start an interactive session with undo/redo support.
bash
cli-anything-inkscape
# Enter commands interactively
# Use 'help' to see available commands
# Use 'undo' and 'redo' for history navigation
Export Project
Export the project to a final output format.
bash
cli-anything-inkscape --project myproject.json export render output.pdf --overwrite
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 ( flag): Structured JSON for agent consumption
bash
# Human output
cli-anything-inkscape project info -p project.json
# JSON output for agents
cli-anything-inkscape --json project info -p project.json
For AI Agents
When using this CLI programmatically:
- Always use flag 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