feat: publish official resources atomically

Fixes #9

Fixes #11
This commit is contained in:
2026-07-14 00:10:39 +08:00
parent 45aba2fb2b
commit 2ff99ae9e3
10 changed files with 1055 additions and 63 deletions
+4 -3
View File
@@ -106,9 +106,9 @@ cas/
```
官方 metadata → GameMainConfig → server-info → discovery endpoints
seed catalog → inventory → pull plan → downloader → output directory
seed catalog → inventory → pull plan → staging → versions/<id>
official-sync-snapshot.json + official-download-manifest.json
current symlink → official-sync-snapshot.json + official-download-manifest.json
```
**已具备特性**
@@ -118,7 +118,8 @@ official-sync-snapshot.json + official-download-manifest.json
- `--auto-discover` 自动获取 `app-version``connection-group``server-info`
- `--watch` / `--daemon` 常驻检查,正常检查默认 1 小时,失败重试默认 60 秒,每天北京时间(UTC+8)`03:00``16:00``18:00` 强制刷新一次。
- `refresh --force` 可手动强制刷新;`verify` 只读校验当前官方计划、本地 manifest 和官方 seed hash`repair` 尝试修复异常资源。
- `--daemon` 使用状态目录下的 `bat.sock` 作为 Unix socket JSON-RPC live control planePID、状态和日志文件是快照与 fallback。
- 非 dry-run 同步先写 `.staging/<id>`,校验完成后发布 `versions/<id>` 并原子切换 `current` symlink。
- `--daemon` 使用状态目录下的 `bat.sock` 作为 Unix socket JSON-RPC live control planePID、状态和日志文件是快照与 fallback,`bat-events.jsonl` 是结构化轮转日志。
- `status``logs``reload``stop` 和默认形态的 `refresh` 优先通过 RPC 管理后台进程;控制命令通过 `bat-control.lock` 串行化;`restart` 负责重启或替换启动参数;live daemon 会阻止前台写命令直接修改同一资源目录;`doctor` 做运行时诊断;`clean-stable` 清理临时文件和失效/损坏状态。
- 远端 marker 无变化且本地 manifest clean 时不下载。
- 本地文件损坏时 repair。