Communitygithub.com

cli-anything-inkscape

用于矢量图形编辑的状态化命令行界面,遵循与 GIMP 和 Blender CLI 相同的模式,直接操作 SVG 文档并使用 JSON 项目格式进行状态追踪。

cli-anything-inkscape 是什么?

cli-anything-inkscape 是一个专为矢量图形编辑设计的命令行工具,它遵循与 GIMP 和 Blender CLI 相同的状态化模式。该工具直接操作 SVG 文档(基于 XML),并通过 JSON 格式的项目文件来追踪和持久化编辑状态。它支持丰富的命令组,包括文档管理、形状操作、文本排版、样式设置、变换、图层管理、路径布尔运算、渐变处理以及导出为 PNG、SVG、PDF 等格式。cli-anything-inkscape 支持交互式 REPL 模式和脚本化调用,尤其适合 AI 代理在无需图形界面的环境中进行程序化的矢量图形创建与编辑。它的双输出模式(人类可读表格和机器友好的 JSON)使其既能被开发者直接使用,也能无缝集成到自动化工作流中。

兼容平台~Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-inkscape

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

cli-anything-inkscape 是做什么的?

用于矢量图形编辑的状态化命令行界面,遵循与 GIMP 和 Blender CLI 相同的模式。直接操作 SVG(XML)文档,并使用 JSON 项目格式进行状态追踪。

安装

该 CLI 作为 cli-anything-inkscape 包的一部分安装:

pip install cli-anything-inkscape

先决条件:

  • Python 3.10+
  • 系统上必须安装 Inkscape

用法

基本命令

# 显示帮助
cli-anything-inkscape --help

# 启动交互式 REPL 模式
cli-anything-inkscape

# 创建新文档
cli-anything-inkscape document new -o project.json

# 使用 JSON 输出运行(用于代理消费)
cli-anything-inkscape --json document info -p project.json

REPL 模式

当不带子命令调用时,CLI 将进入交互式 REPL 会话:

cli-anything-inkscape
# 交互式输入命令,支持 Tab 自动补全和历史记录

您也可以使用不存在的项目路径启动 REPL。CLI 现在会在内存中创建一个新文档,而不是立即失败:

cli-anything-inkscape --project /abs/path/new-title.inkscape-cli.json

命令组

文档

文档管理命令。

命令描述
new创建新文档
open打开现有项目
save保存当前项目
info显示文档信息
profiles列出可用的文档配置文件
canvas-size设置画布大小
units设置文档单位
json打印原始项目 JSON

形状

形状管理命令。

命令描述
add-rect添加矩形
add-circle添加圆形
add-ellipse添加椭圆
add-line添加线条
add-polygon添加多边形
add-path添加路径
add-star添加星形
remove按索引删除形状
duplicate复制形状
list列出所有形状/对象
get获取形状的详细信息

文本

文本管理命令。

命令描述
add添加文本元素;支持 --box-width、--box-height 和 --line-height 用于带换行的布局
set设置文本属性(text、font-family、font-size、fill、box-width、box-height、line-height 等)
list列出所有文本对象

样式

样式管理命令。

命令描述
set-fill设置对象的填充颜色
set-stroke设置对象的描边颜色(以及可选的宽度)
set-opacity设置对象的不透明度(0.0-1.0)
set在对象上设置任意样式属性
get获取对象的样式属性
list-properties列出所有可用的样式属性

变换

变换操作(平移、旋转、缩放、倾斜)。

命令描述
translate平移(移动)对象
rotate旋转对象
scale缩放对象
skew-x水平倾斜对象
skew-y垂直倾斜对象
get获取对象当前的变换
clear清除对象上的所有变换

图层

图层管理命令。

命令描述
add添加新图层
remove按索引删除图层
move-object将对象移动到不同图层
set设置图层属性(名称、可见性、锁定、不透明度)
list列出所有图层
reorder将图层从一个位置移动到另一个位置
get获取图层的详细信息

路径组

路径布尔运算命令。

命令描述
union两个对象的并集
intersection两个对象的交集
difference两个对象的差集(A 减 B)
exclusion两个对象的排除(异或)
convert将形状转换为路径
list-operations列出可用的路径布尔运算

渐变

渐变管理命令。

命令描述
add-linear添加线性渐变
add-radial添加径向渐变
apply将渐变应用于对象
list列出所有渐变

导出组

导出/渲染命令。

命令描述
png将文档渲染为 PNG
svg将文档导出为 SVG
pdf将文档导出为 PDF(需要 Inkscape)
presets列出导出预设

会话

会话管理命令。

命令描述
status显示会话状态
undo撤销上一次操作
redo重做上一次撤销的操作
history显示撤销历史

示例

创建新项目

创建一个新的 Inkscape 项目文件。

cli-anything-inkscape document new -o myproject.json
# 或者使用 JSON 输出以便程序化使用
cli-anything-inkscape --json document new -o myproject.json

交互式 REPL 会话

启动一个支持撤销/重做的交互式会话。

cli-anything-inkscape
# 交互式输入命令
# 使用 'help' 查看可用命令
# 使用 'undo' 和 'redo' 进行历史导航

导出项目

将项目导出为最终输出格式。

cli-anything-inkscape --project myproject.json export pdf output.pdf --overwrite

带换行的文本布局

对于标题卡片、徽章和竖屏安全面板,优先使用带自动换行的文本框,而不是手动插入换行符:

cli-anything-inkscape --project title.json text add \
  --text "Real capture + Veo cold open + Gemini score + thumbnail plate" \
  --x 180 --y 470 --font-size 118 \
  --box-width 1180 --box-height 260 --line-height 1.05

cli-anything-inkscape --project title.json text set 0 box-width 980
cli-anything-inkscape --project title.json text set 0 line-height 1.15

注意:

  • box-width 将长文本自动换行为多行导出的 SVG tspan 行。
  • box-height 让长文本在超出画布时安全失败。
  • 在手动断行之前,优先使用带自动换行的文本框处理长文本图形。

状态管理

CLI 通过以下方式维护会话状态:

  • 撤销/重做:最多 50 级历史记录
  • 项目持久化:将项目状态保存/加载为 JSON
  • 会话追踪:追踪修改和变更

输出格式

所有命令都支持双输出模式:

  • 人类可读(默认):表格、颜色、格式化文本
  • 机器可读(--json 标志):结构化的 JSON,供代理使用
# 人类可读输出
cli-anything-inkscape project info -p project.json

# JSON 输出(用于代理)
cli-anything-inkscape --json project info -p project.json

用于 AI 代理

当以编程方式使用此 CLI 时:

  1. 始终使用 --json 标志 以获取可解析的输出
  2. 检查返回码 - 0 表示成功,非零表示错误
  3. 解析 stderr 以获取失败时的错误消息
  4. 对所有文件操作使用绝对路径
  5. 导出操作后验证输出文件是否存在
  6. 优先使用带自动换行的文本框 处理标题和可变长度文本,以确保布局在编辑过程中保持稳定

更多信息

  • 完整文档:参见包内的 README.md
  • 测试覆盖率:参见包内的 TEST.md
  • 方法论:参见 cli-anything-plugin 中的 HARNESS.md

版本

1.0.1

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-adguardhome

>-

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-browser

Browser automation CLI using DOMShell MCP server. Maps Chrome

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-gimp

>-

cli-anything-godot

>-

相关技能