cli-anything-inkscape
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecli-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-inkscapePrerequisites:
- 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
undefinedbash
undefinedShow 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
undefinedcli-anything-inkscape --json project info -p project.json
undefinedREPL Mode
REPL模式
When invoked without a subcommand, the CLI enters an interactive REPL session:
bash
cli-anything-inkscape当不指定子命令调用时,CLI会进入交互式REPL会话:
bash
cli-anything-inkscapeEnter commands interactively with tab-completion and history
交互式输入命令,支持自动补全和历史记录
undefinedundefinedCommand 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 |
文档管理命令。
| 命令 | 描述 |
|---|---|
| 创建新文档 |
| 打开现有项目 |
| 保存当前项目 |
| 显示文档信息 |
| 列出可用的文档配置文件 |
| 设置画布尺寸 |
| 设置文档单位 |
| 打印原始项目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 |
样式管理命令。
| 命令 | 描述 |
|---|---|
| 设置对象的填充色 |
| 设置对象的描边颜色(可选设置宽度) |
| 设置对象的透明度(0.0-1.0) |
| 设置对象的任意样式属性 |
| 获取对象的样式属性 |
| 列出所有可用的样式属性 |
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 |
路径布尔运算命令。
| 命令 | 描述 |
|---|---|
| 两个对象的并集 |
| 两个对象的交集 |
| 两个对象的差集(A减B) |
| 两个对象的异或集 |
| 将形状转换为路径 |
| 列出可用的路径布尔运算 |
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 |
导出/渲染命令。
| 命令 | 描述 |
|---|---|
| 将文档渲染为PNG格式 |
| 将文档导出为SVG格式 |
| 将文档导出为PDF格式(需要安装Inkscape) |
| 列出导出预设 |
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创建新的Inkscape项目文件。
bash
cli-anything-inkscape project new -o myproject.jsonOr with JSON output for programmatic use
或以JSON格式输出供程序调用
cli-anything-inkscape --json project new -o myproject.json
undefinedcli-anything-inkscape --json project new -o myproject.json
undefinedInteractive REPL Session
交互式REPL会话
Start an interactive session with undo/redo support.
bash
cli-anything-inkscape启动支持撤销/重做的交互式会话。
bash
cli-anything-inkscapeEnter commands interactively
交互式输入命令
Use 'help' to see available commands
使用'help'查看可用命令
Use 'undo' and 'redo' for history navigation
使用'undo'和'redo'导航历史记录
undefinedundefinedExport 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 --overwriteState 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 (flag): Structured JSON for agent consumption
--json
bash
undefined所有命令支持两种输出模式:
- 人类可读格式(默认):表格、颜色、格式化文本
- 机器可读格式(标志):结构化JSON,供Agent使用
--json
bash
undefinedHuman 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
undefinedcli-anything-inkscape --json project info -p project.json
undefinedFor AI Agents
面向AI Agent
When using this CLI programmatically:
- Always use flag for parseable output
--json - 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
以编程方式使用此CLI时:
- 始终使用标志以获得可解析的输出
--json - 检查返回码——0表示成功,非0表示错误
- 解析stderr以获取失败时的错误信息
- 使用绝对路径进行所有文件操作
- 验证输出是否存在在导出操作完成后
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