Appearance
工作流与自动化命令
TIP
工作流定义"怎么做"——一系列步骤的编排。自动化定义"什么时候做"——触发工作流运行的条件和规则。
工作流管理
workflow:list
列出所有工作流。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| page | number | 否 | 页码,默认 1 |
| pageSize | number | 否 | 每页条数,默认 20 |
| keyword | string | 否 | 搜索关键词 |
请求示例:
bash
workova workflow:list --input '{"page": 1, "keyword": "deploy"}'返回示例:
json
{
"success": true,
"data": {
"items": [
{
"id": "wf_abc",
"name": "deploy-pipeline",
"version": 3,
"description": "Production deploy workflow"
},
{
"id": "wf_def",
"name": "deploy-staging",
"version": 1,
"description": "Staging deploy"
}
],
"page": { "total": 2, "hasMore": false }
}
}workflow:get
获取工作流详情。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| workflowId | string | 是 | 工作流 ID |
请求示例:
bash
workova workflow:get --input '{"workflowId": "wf_abc"}'返回示例:
json
{
"success": true,
"data": {
"workflow": {
"id": "wf_abc",
"name": "deploy-pipeline",
"nodes": [
{ "id": "n1", "type": "action", "label": "Build" },
{ "id": "n2", "type": "action", "label": "Test" }
],
"edges": [{ "source": "n1", "target": "n2" }],
"variables": { "env": "production" }
}
}
}workflow:create
创建工作流。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 工作流名称 |
| description | string | 否 | 工作流描述 |
| version | string | 否 | 版本号,默认 1.0.0 |
| workflowData | object | 否 | 工作流定义数据(节点、边等) |
请求示例:
bash
workova workflow:create --input '{"name": "deploy-pipeline", "description": "Production deploy workflow"}'返回示例:
json
{
"success": true,
"data": {
"workflow": {
"id": "wf_abc",
"name": "deploy-pipeline",
"version": 1,
"description": "Production deploy workflow"
}
}
}workflow:update
更新工作流。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| workflowId | string | 是 | 工作流 ID |
| name | string | 否 | 工作流名称 |
| description | string | 否 | 工作流描述 |
| version | string | 否 | 版本号 |
| workflowData | object | 否 | 工作流定义数据 |
请求示例:
bash
workova workflow:update --input '{"workflowId": "wf_abc", "name": "deploy-pipeline-v2"}'返回示例:
json
{
"success": true,
"data": {
"workflow": {
"id": "wf_abc",
"name": "deploy-pipeline-v2",
"version": 4,
"description": "Production deploy workflow"
}
}
}workflow:delete
删除工作流。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| workflowId | string | 是 | 工作流 ID |
请求示例:
bash
workova workflow:delete --input '{"workflowId": "wf_abc"}'返回示例:
json
{
"success": true,
"data": {
"workflowId": "wf_abc",
"deleted": true
}
}workflow:export
导出工作流完整定义。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| workflowId | string | 是 | 工作流 ID |
请求示例:
bash
workova workflow:export --input '{"workflowId": "wf_abc"}'返回示例:
json
{
"success": true,
"data": {
"workflow": {
"id": "wf_abc",
"name": "deploy-pipeline",
"version": 3,
"nodes": [],
"edges": [],
"variables": {}
}
}
}工作流运行
workflow-run:start
启动工作流运行。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| workflowId | string | 是 | 工作流 ID |
| inputs | object | 否 | 运行时输入参数 |
| inputFile | string | 否 | 从文件读取输入参数 |
请求示例:
bash
workova workflow-run:start --input '{"workflowId": "wf_abc", "inputs": {"url": "https://example.com"}}'返回示例:
json
{
"success": true,
"data": {
"runId": "wfr_123",
"status": "running"
}
}workflow-run:events
获取运行事件流。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| runId | string | 是 | 运行 ID |
| cursor | string | 否 | 分页游标 |
请求示例:
bash
workova workflow-run:events --input '{"runId": "wfr_123"}'返回示例:
json
{
"success": true,
"data": {
"events": [
{
"eventType": "node_started",
"nodeId": "n1",
"message": "Executing Build step"
},
{
"eventType": "node_completed",
"nodeId": "n1",
"message": "Build succeeded"
}
]
}
}workflow-run:snapshot
获取运行快照(当前状态)。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| runId | string | 是 | 运行 ID |
请求示例:
bash
workova workflow-run:snapshot --input '{"runId": "wfr_123"}'返回示例:
json
{
"success": true,
"data": {
"runId": "wfr_123",
"status": "running",
"currentNodeIndex": 1,
"totalNodes": 4
}
}workflow-run:pause
暂停运行。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| runId | string | 是 | 运行 ID |
请求示例:
bash
workova workflow-run:pause --input '{"runId": "wfr_123"}'返回示例:
json
{
"success": true,
"data": {
"runId": "wfr_123",
"status": "paused"
}
}workflow-run:resume
恢复运行。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| runId | string | 是 | 运行 ID |
请求示例:
bash
workova workflow-run:resume --input '{"runId": "wfr_123"}'返回示例:
json
{
"success": true,
"data": {
"runId": "wfr_123",
"status": "running"
}
}workflow-run:cancel
取消运行(不可恢复)。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| runId | string | 是 | 运行 ID |
请求示例:
bash
workova workflow-run:cancel --input '{"runId": "wfr_123"}'返回示例:
json
{
"success": true,
"data": {
"runId": "wfr_123",
"status": "cancelled"
}
}workflow-run:list
列出运行记录。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| status | string | 否 | 按状态筛选 |
| limit | number | 否 | 返回条数,默认 50,最大 100 |
| offset | number | 否 | 偏移量 |
请求示例:
bash
workova workflow-run:list --input '{"status": "running", "limit": 10}'返回示例:
json
{
"success": true,
"data": {
"items": [
{
"runId": "wfr_123",
"workflowId": "wf_abc",
"status": "running",
"startedAt": "2026-03-30T09:00:00Z"
}
],
"page": { "total": 1, "hasMore": false }
}
}自动化管理
automation:list
列出所有自动化。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| userId | string | 否 | 按用户 ID 筛选 |
请求示例:
bash
workova automation:list返回示例:
json
{
"success": true,
"data": {
"items": [
{
"id": "auto_abc",
"name": "daily-report",
"enabled": true,
"triggerType": "scheduled",
"scheduleExpr": "0 9 * * 1-5",
"actionType": "workflow"
}
]
}
}automation:create
创建自动化。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 自动化名称 |
| triggerType | string | 是 | 触发类型,可选 scheduled / notification |
| actionType | string | 是 | 动作类型,可选 workflow / agent_session / multi_agent_session |
| description | string | 否 | 描述 |
| enabled | boolean | 否 | 是否启用,默认 true |
| scheduleKind | string | 否 | 调度类型 |
| scheduleExpr | string | 否 | 调度表达式(cron 格式) |
| timezone | string | 否 | 时区 |
| notificationSources | string[] | 否 | 通知来源列表 |
| matcherJson | object | 否 | 匹配规则 |
| actionConfig | object | 否 | 动作配置 |
| cooldownSeconds | number | 否 | 冷却时间(秒),默认 0 |
| dedupWindowSeconds | number | 否 | 去重窗口(秒),默认 300 |
请求示例:
bash
workova automation:create --input '{"name": "daily-report", "triggerType": "scheduled", "actionType": "workflow", "scheduleExpr": "0 9 * * 1-5"}'返回示例:
json
{
"success": true,
"data": {
"trigger": {
"id": "auto_abc",
"name": "daily-report",
"triggerType": "scheduled",
"actionType": "workflow",
"scheduleExpr": "0 9 * * 1-5",
"enabled": true
}
}
}automation:update
更新自动化。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| triggerId | string | 是 | 自动化触发器 ID |
| name | string | 否 | 自动化名称 |
| triggerType | string | 否 | 触发类型 |
| actionType | string | 否 | 动作类型 |
| description | string | 否 | 描述 |
| enabled | boolean | 否 | 是否启用 |
| scheduleKind | string | 否 | 调度类型 |
| scheduleExpr | string | 否 | 调度表达式 |
| timezone | string | 否 | 时区 |
| notificationSources | string[] | 否 | 通知来源列表 |
| matcherJson | object | 否 | 匹配规则 |
| actionConfig | object | 否 | 动作配置 |
| cooldownSeconds | number | 否 | 冷却时间(秒) |
| dedupWindowSeconds | number | 否 | 去重窗口(秒) |
请求示例:
bash
workova automation:update --input '{"triggerId": "auto_abc", "scheduleExpr": "0 10 * * 1-5"}'返回示例:
json
{
"success": true,
"data": {
"trigger": {
"id": "auto_abc",
"name": "daily-report",
"scheduleExpr": "0 10 * * 1-5",
"enabled": true
}
}
}automation:delete
删除自动化。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| triggerId | string | 是 | 自动化触发器 ID |
请求示例:
bash
workova automation:delete --input '{"triggerId": "auto_abc"}'返回示例:
json
{
"success": true,
"data": {
"triggerId": "auto_abc",
"deleted": true
}
}automation:enable
启用自动化。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| triggerId | string | 是 | 自动化触发器 ID |
请求示例:
bash
workova automation:enable --input '{"triggerId": "auto_abc"}'返回示例:
json
{
"success": true,
"data": {
"triggerId": "auto_abc",
"enabled": true
}
}automation:disable
禁用自动化。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| triggerId | string | 是 | 自动化触发器 ID |
请求示例:
bash
workova automation:disable --input '{"triggerId": "auto_abc"}'返回示例:
json
{
"success": true,
"data": {
"triggerId": "auto_abc",
"enabled": false
}
}automation:runs
查看运行记录。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| limit | number | 否 | 返回条数,默认 100,最大 200 |
| offset | number | 否 | 偏移量 |
请求示例:
bash
workova automation:runs --input '{"limit": 5}'返回示例:
json
{
"success": true,
"data": {
"items": [
{
"id": "arun_001",
"triggerId": "auto_abc",
"status": "completed",
"startAt": "2026-03-30T09:00:00Z",
"error": null
},
{
"id": "arun_002",
"triggerId": "auto_abc",
"status": "failed",
"startAt": "2026-03-29T09:00:00Z",
"error": "Workflow timeout"
}
]
}
}automation:process
手动触发处理。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| maxDue | number | 否 | 最大处理数量,默认 20 |
请求示例:
bash
workova automation:process --input '{"maxDue": 10}'返回示例:
json
{
"success": true,
"data": {
"processed": 3
}
}WARNING
automation:process 会立即触发运行,不受自动化的启用/禁用状态影响。请谨慎使用。
典型场景
CI/CD 中执行工作流
bash
# 启动工作流并等待完成
RUN_ID=$(workova workflow-run:start --input '{"workflowId": "wf_deploy"}' | jq -r '.data.runId')
# 跟踪运行事件直到完成
workova workflow-run:events --input "{\"runId\": \"$RUN_ID\"}"定时批量处理
创建一个每个工作日早 9 点执行的自动化:
bash
workova automation:create --input-file - << 'EOF'
{
"name": "daily-report",
"triggerType": "scheduled",
"actionType": "workflow",
"workflowId": "wf_report",
"scheduleExpr": "0 9 * * 1-5"
}
EOF