main-image-editor
Orchestration layer for "main image modification" workflows:
- 1. Parse screenshot + Chinese instruction into structured edit tasks.
- Convert tasks into
psd-automator task JSON. - Execute serially with transaction rollback (rollback all on any failure).
- Reuse
psd-automator export + bundle output.
Usage
CODEBLOCK0
Dry-run or force execute:
CODEBLOCK1
CODEBLOCK2
Request payload
INLINECODE2 JSON supports:
- -
text: Chinese requirement text - INLINECODE4 : screenshot path (used for match + audit)
- INLINECODE5 : optional (default
0.8) - INLINECODE7 : optional pre-parsed tasks (skip regex parsing when provided)
- INLINECODE8 : optional runtime controls (
indexPath, dryRun, force)
When fileHint is missing, parser will try to extract .psd/.psb filename from:
- 1. request INLINECODE14
- OCR text from
screenshotPath (local tesseract command or macOS Vision OCR fallback)
Failure policy
- - Default policy is
rollback_all. - Any single PSD failure restores all touched PSD files from transaction backups.
- Temporary outputs generated in the failed run are cleaned up before returning.
main-image-editor
“主图像修改”工作流的编排层:
- 1. 将截图 + 中文指令解析为结构化编辑任务。
- 将任务转换为 psd-automator 任务 JSON。
- 串行执行并支持事务回滚(任何失败时回滚所有操作)。
- 复用 psd-automator 的导出与打包输出。
使用方法
bash
node skills/main-image-editor/scripts/run-main-image-editor.js \
--request skills/main-image-editor/examples/request.sample.json \
--index ~/.openclaw/psd-index.json
预演或强制执行:
bash
node skills/main-image-editor/scripts/run-main-image-editor.js \
--request skills/main-image-editor/examples/request.sample.json \
--dry-run
bash
node skills/main-image-editor/scripts/run-main-image-editor.js \
--request skills/main-image-editor/examples/request.sample.json \
--force
请求负载
request JSON 支持以下字段:
- - text:中文需求文本
- screenshotPath:截图路径(用于匹配和审核)
- confidenceThreshold:可选(默认值为 0.8)
- tasks:可选,预解析的任务(提供时跳过正则解析)
- execution:可选,运行时控制参数(indexPath、dryRun、force)
当 fileHint 缺失时,解析器会尝试从以下来源提取 .psd/.psb 文件名:
- 1. 请求中的 text
- screenshotPath 对应的 OCR 文本(本地 tesseract 命令或 macOS Vision OCR 回退方案)
失败策略
- - 默认策略为 rollback_all。
- 任何单个 PSD 失败时,将从事务备份中恢复所有被修改的 PSD 文件。
- 失败运行中生成的临时输出会在返回前清理干净。