cli-anything-openrefine

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CLI-Anything OpenRefine

CLI-Anything OpenRefine

Use this skill when a task needs OpenRefine data cleaning, transformation, reusable operation histories, or CSV/TSV export from an automated agent workflow.
当任务需要使用 OpenRefine 进行数据清理、转换、复用操作历史,或在自动化 Agent 工作流中导出 CSV/TSV 时,使用此 skill。

Prerequisites

前置条件

Install the harness:
bash
cd openrefine/agent-harness
python -m pip install -e .
Start OpenRefine before backend commands:
bash
openrefine -i 127.0.0.1 -p 3333
Set a custom server with
OPENREFINE_URL=http://127.0.0.1:3333
or pass
--base-url
.
安装 harness:
bash
cd openrefine/agent-harness
python -m pip install -e .
执行后端命令前先启动 OpenRefine:
bash
openrefine -i 127.0.0.1 -p 3333
通过
OPENREFINE_URL=http://127.0.0.1:3333
设置自定义服务器,或传入
--base-url
。

Command Rules For Agents

面向 Agent 的命令规则

  • Prefer
    --json
    on every one-shot command.
  • Use
    --session <path>
    for isolated task state.
  • Import or open a project before row, apply, export, undo, or redo commands.
  • Existing OpenRefine operation-history JSON can be passed directly to
    data apply
    .
  • Generated files are normal OpenRefine operation JSON and exported CSV/TSV data.
  • 每个一次性命令都优先使用
    --json
    。
  • 使用
    --session <path>
    隔离任务状态。
  • 在执行 row、apply、export、undo 或 redo 命令前,先导入或打开项目。
  • 现有的 OpenRefine operation-history JSON 可以直接传递给
    data apply
    。
  • 生成的文件为标准 OpenRefine operation JSON 和导出的 CSV/TSV 数据。

Common Commands

常用命令

bash
cli-anything-openrefine --json server ping
cli-anything-openrefine --json project list
cli-anything-openrefine --json --session run/session.json project import messy.csv --name cleanup
cli-anything-openrefine --json --session run/session.json data rows --limit 10
cli-anything-openrefine --json ops text-transform run/trim.json --column Name --expression 'value.trim()'
cli-anything-openrefine --json --session run/session.json data apply run/trim.json
cli-anything-openrefine --json --session run/session.json data export run/clean.csv --format csv
cli-anything-openrefine --json --session run/session.json session undo
cli-anything-openrefine --json --session run/session.json session redo
bash
cli-anything-openrefine --json server ping
cli-anything-openrefine --json project list
cli-anything-openrefine --json --session run/session.json project import messy.csv --name cleanup
cli-anything-openrefine --json --session run/session.json data rows --limit 10
cli-anything-openrefine --json ops text-transform run/trim.json --column Name --expression 'value.trim()'
cli-anything-openrefine --json --session run/session.json data apply run/trim.json
cli-anything-openrefine --json --session run/session.json data export run/clean.csv --format csv
cli-anything-openrefine --json --session run/session.json session undo
cli-anything-openrefine --json --session run/session.json session redo

REPL

REPL

Run
cli-anything-openrefine
with no subcommand to enter the REPL.
For automated user journeys, pipe newline-separated REPL commands through stdin. Redirected streams automatically use an ASCII-only input/output path while interactive terminals retain the Unicode banner, prompt history, and styling:
bash
printf 'help\nexit\n' | cli-anything-openrefine
Unicode payloads are rendered as reversible ASCII backslash escapes when the REPL is redirected, preventing legacy Windows output encodings from turning a successful command into a failed journey.
Piped workflows return a nonzero exit status at
exit
or EOF if any command failed, allowing CI to detect an unsuccessful user journey.
运行
cli-anything-openrefine
且不传入子命令即可进入 REPL。
对于自动化用户流程,可以通过 stdin 传入以换行符分隔的 REPL 命令。重定向的流会自动使用仅支持 ASCII 的输入/输出路径,而交互式终端会保留 Unicode 横幅、提示历史和样式:
bash
printf 'help\nexit\n' | cli-anything-openrefine
当 REPL 被重定向时,Unicode 载荷会呈现为可逆的 ASCII 反斜杠转义,从而避免旧版 Windows 输出编码将成功命令转换为失败流程。
如果任意命令失败,管道工作流会在
exit
或 EOF 时返回非零退出状态,使 CI 能够检测到未成功的用户流程。

Error Handling

错误处理

When
--json
is set, command failures write a JSON object to stderr with
ok: false
.
设置
--json
后,命令失败时会在 stderr 中写入一个包含
ok: false
的 JSON 对象。