feat(bat): 补全工作流校验与调度过滤
bat-rust / Build and test Rust (push) Canceled after 0s
bat-rust / Build and test Go API (push) Canceled after 0s

新增 parse clear-cache 和 i18n validate,补齐 schedule 的作用域过滤与单轮执行上限,并将列表过滤参数暴露给 bat-api dashboard。同步 RPC、OpenAPI、用户文档和回归测试。

Refs #43
This commit is contained in:
2026-08-03 23:47:59 +08:00
parent 0784d5b532
commit 1933d6acb0
19 changed files with 714 additions and 49 deletions
+5 -3
View File
@@ -167,11 +167,11 @@ SQLite `ResourceRepository`,索引不存在时返回 `ok=true` 且
| 方法 | 状态 | params | data |
|---|---|---|---|
| `schedule.list` | 已实现 | `null` | `{ "command": "schedule-list", "schedules": [...] }`。 |
| `schedule.list` | 已实现 | `null``{ "id": "...", "group": "res", "enabled": true }` | `{ "command": "schedule-list", "query": {...}, "schedules": [...] }`。 |
| `schedule.add` | 已实现 | 调度 mutation | 新建 schedule report。 |
| `schedule.update` | 已实现 | 调度 mutation,必须有 `id` | 更新后的 schedule report。 |
| `schedule.remove` | 已实现 | `{ "id": "daily-pull" }` | 删除报告。 |
| `schedule.run` | 已实现 | `{ "id": "daily-pull", "force": true }`,字段可省略 | 到期或强制执行报告;省略 `id` 执行所有到期计划。 |
| `schedule.run` | 已实现 | `{ "id": "daily-pull", "group": "res", "force": true, "max_runs": 1 }`,字段可省略 | 到期或强制执行报告;省略 `id` 执行指定 group 的到期计划。 |
调度 mutation 字段如下:
@@ -179,7 +179,7 @@ SQLite `ResourceRepository`,索引不存在时返回 `ok=true` 且
|---|---|---|
| `id` | string | 计划 IDadd 必填,update/remove 用于定位。 |
| `group` | string | `res``parse``i18n`;对应一级工作流。 |
| `action` | string | `res``pull/refresh/verify/repair``parse``run/repack``i18n``run/export/publish`。 |
| `action` | string | `res``pull/refresh/verify/repair``parse``run/repack/clear-cache``i18n``run/export/validate/publish`。 |
| `args` | string[] | 目标工作流的 CLI 参数。 |
| `next_run_unix_seconds` | uint64 | 指定下一次执行时间;不能和 `delay_seconds` 同时使用。 |
| `delay_seconds` | uint64 | 从当前时间计算下一次执行时间。 |
@@ -189,6 +189,8 @@ SQLite `ResourceRepository`,索引不存在时返回 `ok=true` 且
| `clear_every` | bool | update 时清除周期并转为单次计划。 |
| `enabled` | bool | 启用或停用计划。 |
`schedule.run.max_runs` 必须大于 0,用于限制一次轮询最多领取的到期计划数。
`count > 1` 必须和周期同时存在;`schedule.run``force=true` 只忽略
到期时间,不会绕过 `enabled=false`。每次执行前先持久化下一次状态,执行后
再持久化成功/失败和错误信息,避免进程中断后重复领取同一计划。