0.2.3 • Published 4h agoCLI
@chat2cut/cli
Licence
—
Version
0.2.3
Deps
5
Size
239 kB
Vulns
0
Weekly
0
@chat2cut/cli
Chat2Cut 命令行工具——管理渲染任务、上传 bundle、使用模板。
安装
CLI 发布在公共 npm registry,全局安装:
npm install -g @chat2cut/cli
要求 Node.js ≥ 22。安装后即可使用 chat2cut 命令。
开发本仓库时可在 monorepo 中直接运行(无需打包):
pnpm --filter @chat2cut/cli dev -- <command>
快速开始
1. 登录
chat2cut login
会打开浏览器完成设备授权,Token 保存到 ~/.config/chat2cut/credentials.json。
2. 列出可用模板
chat2cut template list
输出:
共 2 个模板:
product-launch 产品发布 [HyperFrames]
composition: main version: pv_01J...
fields: title(text), subtitle(text), bgColor(color), ...
data-report 数据播报 [Remotion]
composition: DataReport version: pv_01J...
fields: headline(text), metricValue(number), ...
3. 使用模板渲染
# 最简方式:只用模板默认参数
chat2cut render run --template data-report
# 覆盖部分参数
chat2cut render run --template data-report \
--props '{"headline":"2026年报","metricValue":5000}'
# 指定项目版本和 composition(不使用 --template)
chat2cut render run \
--project-version pv_01J00000000000000000000002 \
--composition DataReport \
--props '{"headline":"测试"}'
CLI 会自动轮询任务状态,完成后打印下载链接。
4. 上传自定义 Bundle
# 上传本地 Remotion bundle 目录
chat2cut bundle upload ./build
# 输出 bundleKeyPrefix,后续渲染可复用
chat2cut render run --composition MyComp --bundle-key-prefix <prefix>
命令参考
| 命令 | 说明 |
|---|---|
chat2cut login |
设备授权登录 |
chat2cut logout |
退出登录 |
chat2cut doctor |
检查 CLI 配置状态 |
chat2cut template list |
列出可用渲染模板 |
chat2cut render run |
创建渲染任务并轮询至完成 |
chat2cut render status <id> |
查询任务状态 |
chat2cut render cancel <id> |
取消任务 |
chat2cut bundle upload <dir> |
上传 bundle 到 OSS |
chat2cut build [dir] |
构建 Remotion 项目(生成 manifest + tar.gz) |
chat2cut project upload [dir] |
上传项目到平台,触发验证 |
render run 参数
| 参数 | 说明 | 默认值 |
|---|---|---|
--template <key> |
模板 key,自动填充 composition/version/默认参数 | — |
--composition <id> |
composition ID(使用 --template 时可省略) | — |
--project-version <id> |
项目版本 ID | pv_01J00000000000000000000001 |
--props '<json>' |
inputProps JSON 字符串 | {} |
--bundle-key-prefix <prefix> |
已上传的 bundle key prefix | — |
--interval <sec> |
轮询间隔 | 5 |
--timeout <sec> |
轮询超时 | 300 |
--json |
输出 JSON 格式 | false |
[bundleDir] |
本地 bundle 目录参数 | — |
环境变量(CI/自动化)
CI 环境中可跳过 login,直接通过环境变量配置:
export CHAT2CUT_API_URL=https://api.example.com/api/v1
export CHAT2CUT_TOKEN=***
chat2cut render run --template data-report --json
可选的 Render 服务直连(回调丢失时的回退查询):
export CHAT2CUT_RENDER_URL=https://render.example.com
export CHAT2CUT_RENDER_TOKEN=***