cli-anything-inkscape

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

cli-anything-inkscape

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.
一个有状态的矢量图形编辑命令行界面,遵循与GIMP和Blender CLI工具相同的模式。直接操作SVG(XML)文档,并采用JSON项目格式进行状态跟踪。

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
此CLI作为cli-anything-inkscape包的一部分进行安装:
bash
pip install cli-anything-inkscape
前置要求:
  • Python 3.10+
  • 系统中必须安装inkscape

Usage

使用

Basic Commands

基础命令

bash
undefined
bash
undefined

Show help

显示帮助

cli-anything-inkscape --help
cli-anything-inkscape --help

Start interactive REPL mode

启动交互式REPL模式

cli-anything-inkscape
cli-anything-inkscape

Create a new project

创建新项目

cli-anything-inkscape project new -o project.json
cli-anything-inkscape project new -o project.json

Run with JSON output (for agent consumption)

以JSON格式输出(供Agent使用)

cli-anything-inkscape --json project info -p project.json
undefined
cli-anything-inkscape --json project info -p project.json
undefined

REPL Mode

REPL模式

When invoked without a subcommand, the CLI enters an interactive REPL session:
bash
cli-anything-inkscape
当不指定子命令调用时,CLI会进入交互式REPL会话:
bash
cli-anything-inkscape

Enter commands interactively with tab-completion and history

交互式输入命令,支持自动补全和历史记录

undefined
undefined

Command Groups

命令组

Document

文档

Document management commands.
CommandDescription
new
Create a new document
open
Open an existing project
save
Save the current project
info
Show document information
profiles
List available document profiles
canvas-size
Set the canvas size
units
Set the document units
json
Print raw project JSON
文档管理命令。
命令描述
new
创建新文档
open
打开现有项目
save
保存当前项目
info
显示文档信息
profiles
列出可用的文档配置文件
canvas-size
设置画布尺寸
units
设置文档单位
json
打印原始项目JSON

Shape

形状

Shape management commands.
CommandDescription
add-rect
Add a rectangle
add-circle
Add a circle
add-ellipse
Add an ellipse
add-line
Add a line
add-polygon
Add a polygon
add-path
Add a path
add-star
Add a star
remove
Remove a shape by index
duplicate
Duplicate a shape
list
List all shapes/objects
get
Get detailed info about a shape
形状管理命令。
命令描述
add-rect
添加矩形
add-circle
添加圆形
add-ellipse
添加椭圆
add-line
添加直线
add-polygon
添加多边形
add-path
添加路径
add-star
添加星形
remove
通过索引删除形状
duplicate
复制形状
list
列出所有形状/对象
get
获取形状的详细信息

Text

文本

Text management commands.
CommandDescription
add
Add a text element
set
Set a text property (text, font-family, font-size, fill, etc.)
list
List all text objects
文本管理命令。
命令描述
add
添加文本元素
set
设置文本属性(文本内容、字体、字号、填充色等)
list
列出所有文本对象

Style

样式

Style management commands.
CommandDescription
set-fill
Set the fill color of an object
set-stroke
Set the stroke color (and optionally width) of an object
set-opacity
Set the opacity of an object (0.0-1.0)
set
Set an arbitrary style property on an object
get
Get the style properties of an object
list-properties
List all available style properties
样式管理命令。
命令描述
set-fill
设置对象的填充色
set-stroke
设置对象的描边颜色(可选设置宽度)
set-opacity
设置对象的透明度(0.0-1.0)
set
设置对象的任意样式属性
get
获取对象的样式属性
list-properties
列出所有可用的样式属性

Transform

变换

Transform operations (translate, rotate, scale, skew).
CommandDescription
translate
Translate (move) an object
rotate
Rotate an object
scale
Scale an object
skew-x
Skew an object horizontally
skew-y
Skew an object vertically
get
Get the current transform of an object
clear
Clear all transforms from an object
变换操作(平移、旋转、缩放、倾斜)。
命令描述
translate
平移(移动)对象
rotate
旋转对象
scale
缩放对象
skew-x
水平倾斜对象
skew-y
垂直倾斜对象
get
获取对象当前的变换信息
clear
清除对象的所有变换

Layer

图层

Layer management commands.
CommandDescription
add
Add a new layer
remove
Remove a layer by index
move-object
Move an object to a different layer
set
Set a layer property (name, visible, locked, opacity)
list
List all layers
reorder
Move a layer from one position to another
get
Get detailed info about a layer
图层管理命令。
命令描述
add
添加新图层
remove
通过索引删除图层
move-object
将对象移动到不同图层
set
设置图层属性(名称、可见性、锁定状态、透明度)
list
列出所有图层
reorder
将图层从一个位置移动到另一个位置
get
获取图层的详细信息

Path Group

路径组

Path boolean operations.
CommandDescription
union
Union of two objects
intersection
Intersection of two objects
difference
Difference of two objects (A minus B)
exclusion
Exclusion (XOR) of two objects
convert
Convert a shape to a path
list-operations
List available path boolean operations
路径布尔运算命令。
命令描述
union
两个对象的并集
intersection
两个对象的交集
difference
两个对象的差集(A减B)
exclusion
两个对象的异或集
convert
将形状转换为路径
list-operations
列出可用的路径布尔运算

Gradient

渐变

Gradient management commands.
CommandDescription
add-linear
Add a linear gradient
add-radial
Add a radial gradient
apply
Apply a gradient to an object
list
List all gradients
渐变管理命令。
命令描述
add-linear
添加线性渐变
add-radial
添加径向渐变
apply
为对象应用渐变
list
列出所有渐变

Export Group

导出组

Export/render commands.
CommandDescription
png
Render the document to PNG
svg
Export the document as SVG
pdf
Export the document as PDF (requires Inkscape)
presets
List export presets
导出/渲染命令。
命令描述
png
将文档渲染为PNG格式
svg
将文档导出为SVG格式
pdf
将文档导出为PDF格式(需要安装Inkscape)
presets
列出导出预设

Session

会话

Session management commands.
CommandDescription
status
Show session status
undo
Undo the last operation
redo
Redo the last undone operation
history
Show undo history
会话管理命令。
命令描述
status
显示会话状态
undo
撤销上一步操作
redo
重做上一步撤销的操作
history
显示撤销历史

Examples

示例

Create a New Project

创建新项目

Create a new inkscape project file.
bash
cli-anything-inkscape project new -o myproject.json
创建新的Inkscape项目文件。
bash
cli-anything-inkscape project new -o myproject.json

Or with JSON output for programmatic use

或以JSON格式输出供程序调用

cli-anything-inkscape --json project new -o myproject.json
undefined
cli-anything-inkscape --json project new -o myproject.json
undefined

Interactive REPL Session

交互式REPL会话

Start an interactive session with undo/redo support.
bash
cli-anything-inkscape
启动支持撤销/重做的交互式会话。
bash
cli-anything-inkscape

Enter commands interactively

交互式输入命令

Use 'help' to see available commands

使用'help'查看可用命令

Use 'undo' and 'redo' for history navigation

使用'undo'和'redo'导航历史记录

undefined
undefined

Export Project

导出项目

Export the project to a final output format.
bash
cli-anything-inkscape --project myproject.json export render output.pdf --overwrite
将项目导出为最终输出格式。
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
CLI通过以下方式维护会话状态:
  • 撤销/重做:最多支持50级历史记录
  • 项目持久化:以JSON格式保存/加载项目状态
  • 会话跟踪:跟踪修改和变更

Output Formats

输出格式

All commands support dual output modes:
  • Human-readable (default): Tables, colors, formatted text
  • Machine-readable (
    --json
    flag): Structured JSON for agent consumption
bash
undefined
所有命令支持两种输出模式:
  • 人类可读格式(默认):表格、颜色、格式化文本
  • 机器可读格式
    --json
    标志):结构化JSON,供Agent使用
bash
undefined

Human output

人类可读输出

cli-anything-inkscape project info -p project.json
cli-anything-inkscape project info -p project.json

JSON output for agents

供Agent使用的JSON输出

cli-anything-inkscape --json project info -p project.json
undefined
cli-anything-inkscape --json project info -p project.json
undefined

For AI Agents

面向AI Agent

When using this CLI programmatically:
  1. Always use
    --json
    flag
    for parseable output
  2. Check return codes - 0 for success, non-zero for errors
  3. Parse stderr for error messages on failure
  4. Use absolute paths for all file operations
  5. Verify outputs exist after export operations
以编程方式使用此CLI时:
  1. 始终使用
    --json
    标志
    以获得可解析的输出
  2. 检查返回码——0表示成功,非0表示错误
  3. 解析stderr以获取失败时的错误信息
  4. 使用绝对路径进行所有文件操作
  5. 验证输出是否存在在导出操作完成后

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
  • 完整文档:查看包中的README.md
  • 测试覆盖率:查看包中的TEST.md
  • 方法学:查看cli-anything-plugin中的HARNESS.md

Version

版本

1.0.0
1.0.0