figcraft

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

FigCraft

FigCraft

Operate FigCraft through its structured automation interface. Preserve the user's requested design workflow and target file.
通过 FigCraft 的结构化自动化接口进行操作。保留用户所请求的设计工作流和目标文件。

Protocol reference

协议参考

Read the relevant sections of references/control-protocol.md before constructing calls. This is the downloaded upstream protocol, captured on 2026-11-02.
Source: FigCraft control protocol. The documentation is distributed under the bundled MIT license. Relative links inside the snapshot (e.g.
mcp.md
) refer to upstream documentation; resolve those against
https://github.com/storytold/figcraft/blob/main/docs/
when needed. If installed behavior differs, inspect the installed command registry through
engine.commands
rather than inventing parameters.
在构建调用之前,读取 references/control-protocol.md 的相关章节。这是已下载的上游协议快照,采集于 2026-11-02。
来源:FigCraft control protocol。文档依据随附的 MIT 许可证分发。快照内的相对链接(例如
mcp.md
)指向上游文档;如有需要,请相对于
https://github.com/storytold/figcraft/blob/main/docs/
进行解析。如果已安装版本的行为有所不同,请通过
engine.commands
检查已安装的命令注册表,而不要臆造参数。

Select the session

选择会话

  • The desktop app serves the control channel on
    127.0.0.1
    only:
    figcraft --control 7979 [file.figcraft|file.svg|image]
    . For the user's open file, drive that live window, directly or through the attached MCP server (
    figcraft-cli mcp --attach 7979
    , see upstream
    docs/mcp.md
    ).
  • The app can show files in several windows. Every method takes an optional
    window
    id from
    window.list
    (
    0
    is the main window); without it, requests go to the window last in front.
    engine.execute
    ,
    document.inspect
    ,
    node.get
    , and
    ui.render
    also take an optional
    document
    (open file id from
    doc.list
    , or a path) to act on a background tab.
  • The web build exposes the same methods as promises on
    window.figcraft
    when the page URL carries a
    control
    query entry.
  • Discover available executables and sessions first. If the required connection or executable is missing, report the concrete prerequisite; this skill does not install FigCraft or register an MCP server.
  • 桌面应用仅在
    127.0.0.1
    上提供控制通道:
    figcraft --control 7979 [file.figcraft|file.svg|image]
    。对于用户已打开的文件,可直接驱动该实时窗口,也可通过已附加的 MCP server 驱动它(
    figcraft-cli mcp --attach 7979
    ,参见上游
    docs/mcp.md
    )。
  • 应用可以在多个窗口中显示文件。每个方法都接受一个可选的
    window
    id,该 id 来自
    window.list
    (
    0
    为主窗口);如果不指定,请求将发送到最后位于前台的窗口。
    engine.execute
    、
    document.inspect
    、
    node.get
    和
    ui.render
    还接受可选的
    document
    (来自
    doc.list
    的已打开文件 id,或一个路径),以便在后台标签页中执行操作。
  • 当页面 URL 带有
    control
    查询条目时,Web 构建版本会在
    window.figcraft
    上以 Promise 形式公开相同的方法。
  • 首先发现可用的可执行文件和会话。如果缺少所需连接或可执行文件,请报告具体的前置条件;此 skill 不会安装 FigCraft,也不会注册 MCP server。

Transport and limits

传输与限制

Requests are newline-delimited JSON, one per line, replies matched by
id
; check
ok
. Requests run on the UI thread at the start of the next frame. A 60 s timeout reply distinguishes a dropped request (never applied) from one already running (will take effect; inspect the document before retrying). A long request such as a big
command.batch
can raise its own wait with
timeoutMs
(up to 600000). A request line is limited to 32 MiB; at most 8 connections and 8 queued requests per queue are accepted. A minimised or covered window still answers state methods but cannot take
ui.screenshot
or
ui.input
until it paints.
请求采用换行分隔的 JSON,每行一个,回复通过
id
匹配;请检查
ok
。请求在下一帧开始时于 UI 线程上运行。60 秒超时回复可用于区分被丢弃的请求(从未应用)与已在运行的请求(将生效;重试前检查文档)。这类长请求(例如大型
command.batch
)可通过
timeoutMs
(最高 600000)延长自身的等待时间。单行请求限制为 32 MiB;最多接受 8 个连接,每个队列最多可容纳 8 个排队请求。最小化或被遮挡的窗口仍会响应状态方法,但在完成绘制前无法执行
ui.screenshot
或
ui.input
。

Inspect, edit, and verify

检查、编辑与验证

Inspect before editing:
document.inspect
(pages, layer tree, selection, styles, undo history; use
depth
,
fields
, or
outline: true
to bound output) and
node.get {id}
for one layer. Discover command ids, parameters, and menus through
engine.commands
.
Edit through
engine.execute {command, params}
; programmatic calls never open dialogs. Creation commands return
{"id": N}
; use real returned ids. Unknown parameters are errors, never ignored. Prefer editable nodes:
frame.create
,
node.create
,
node.set
,
shape.*
,
text.*
,
tool.set
plus
ui.pointer
gestures. Use
command.batch
for known sequences; with
onError: "continue"
only failed steps roll back, and steps can reference earlier results with
{"$ref": "name"}
or
{"$step": n}
. Pass
agent
beside
command
so comment activity is signed as an AI agent.
Coordinates are page units, y down;
x
/
y
in
node.set
/
node.create
are relative to the parent frame.
ui.pointer
takes page coordinates or screen pixels (
sx
,
sy
);
ui.input
sends raw window input (separate calls for press and release);
ui.key
sends canvas shortcuts;
ui.type
goes to the text being edited (begin with
text.edit.begin {id}
or a double-click).
ui.menu.invoke
clicks a menu item and may open a dialog;
ui.set
switches panels, tabs, and pickers.
Verify with
ui.render
(document PNG without chrome, works without a window) or
ui.screenshot
(whole window). Report material import warnings;
file.open
and
file.import
return a
summary
.
  • 编辑前先检查:使用
    document.inspect
    检查页面、图层树、选区、样式和撤销历史(使用
    depth
    、
    fields
    或
    outline: true
    限制输出范围),并使用
    node.get {id}
    获取单个图层。通过
    engine.commands
    发现命令 ID、参数和菜单。
  • 通过
    engine.execute {command, params}
    进行编辑;程序化调用永远不会打开对话框。创建命令返回
    {"id": N}
    ;请使用实际返回的 id。未知参数会触发错误,绝不会被忽略。应优先使用可编辑节点:
    frame.create
    、
    node.create
    、
    node.set
    、
    shape.*
    、
    text.*
    、
    tool.set
    ,以及
    ui.pointer
    手势。对已知操作序列使用
    command.batch
    ;设置
    onError: "continue"
    时,仅失败的步骤会回滚,并且后续步骤可以通过
    {"$ref": "name"}
    或
    {"$step": n}
    引用早期结果。在
    command
    旁传入
    agent
    ,使评论活动以 AI Agent 身份签名。
  • 坐标使用页面单位,y 轴向下;在
    node.set
    /
    node.create
    中,
    x
    /
    y
    相对于父级 frame。
    ui.pointer
    接受页面坐标或屏幕像素(
    sx
    、
    sy
    );
    ui.input
    发送原始窗口输入(按下和释放需分别调用);
    ui.key
    发送画布快捷键;
    ui.type
    将输入发送到正在编辑的文本(先使用
    text.edit.begin {id}
    ,或双击)。
    ui.menu.invoke
    点击菜单项,并且可能会打开对话框;
    ui.set
    用于切换面板、标签页和选择器。
  • 使用
    ui.render
    进行验证(生成不含界面框架的文档 PNG,无需窗口即可工作),或使用
    ui.screenshot
    (捕获整个窗口)。报告重要的素材导入警告;
    file.open
    和
    file.import
    会返回
    summary
    。

File access and output

文件访问与输出

--automation-read-root
and
--automation-write-root
(FigCraft 0.7.0+) confine control and injected input to task folders; writes go only inside a write root, reads only inside a read or write root, and networked collaboration is refused while confined. Use forward-slash paths inside the roots; a rejected path is an ordinary error (
automation path rejected: …
) — do not bypass it with ambient filesystem commands. Save native editable files as
.figcraft
; export SVG, PNG, or PDF as requested.
events.poll
watches comment activity; keep the returned
cursor
and re-read comments when
reset
is true.
--automation-read-root
和
--automation-write-root
(FigCraft 0.7.0+)将控制和注入输入限制在任务文件夹内;写入只能发生在 write root 内,读取只能发生在 read root 或 write root 内,并且在受限模式下会拒绝联网协作。请在根目录内使用正斜杠路径;路径被拒绝属于普通错误(
automation path rejected: …
)——不要使用环境文件系统命令绕过此限制。将原生可编辑文件保存为
.figcraft
;按要求导出 SVG、PNG 或 PDF。
events.poll
用于监视评论活动;保留返回的
cursor
,并在
reset
为 true 时重新读取评论。