Files
BlueArchiveToolkit/CURRENT_STATUS.md
T

277 lines
8.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# BlueArchiveToolkit 当前工作区状态
- **更新时间**2026-07-06
- **状态来源**:本地工作区盘点、代码验证和最新提交
- **状态分支**`experiment`
- **最新功能提交**`789402c feat: add official resource sync pipeline`
- **权威计划**`PROJECT_PLAN.md`
---
## 1. 总体判断
当前项目处于 **稳定基线完成、CAS V1 已落地、Rust 官方资源同步链路已具备最小生产运行形态、Go CLI/API/Web 仍未落地** 阶段。
Rust 侧官方日服资源链路已经从实验验证推进到正式入口:
1. 首次运行可以通过 `--auto-discover` 从官方 HTTP metadata 解析 `GameMainConfig`,自动获得 `app-version``connection-group``server-info`
2. 不安装、不启动、不依赖已安装官方启动器。
3. 默认平台为 `Windows + Android`
4. 能生成官方全量 pull plan,执行真实下载,维护 `official-download-manifest.json`
5. 下载后使用本地 manifest 的 size + BLAKE3 校验复用文件;官方 seed `.hash` 使用 `xxHash32(seed=0)` 强校验。
6. 支持 `.part` 断点续传、失败后 clean retry、本地 manifest audit/repair。
7. `bat-official-sync --watch` 可常驻运行,正常检查默认每 1 小时一次;远端和本地一致时默认静默,失败后默认 60 秒快速重试。
8. 非 dry-run 使用 `--output/.official-sync.lock` 防止并发写同一状态目录。
仍需明确:这不是完整产品完成。Go CLI 最小入口、完整 AssetBundle 解析、Patch、翻译系统、API Server 和 Web 仍是后续工作;真实官方网络全量下载 smoke test 尚未记录在仓库文档中。
---
## 2. 权威文档入口
- `README.md`:项目概览、当前可用能力和快速验证。
- `PROJECT_PLAN.md`:最终目标、里程碑和近期任务。
- `DOCS_INDEX.md`:文档阅读顺序和索引。
- `docs/guides/official-resource-test-pull.md`:官方资源拉取与自动更新用户指南。
- `docs/architecture/official-resource-backend.md`:官方资源后端设计和审核说明。
- `docs/reports/CURRENT_GAPS.md`:当前缺口和关闭顺序。
历史 Week 2/Week 3 报告只作追溯,不再代表当前状态。
---
## 3. 当前模块状态
### Rust workspace
已显式纳入 workspace
- `core`
- `adapters`
- `infrastructure`
- `crates/bat-assetbundle`
- `crates/bat-cas-engine`
- `crates/bat-ffi`
- `crates/bat-patch`
### `bat-core`
状态:**领域模型和仓储接口骨架可用**
已包含:
- `GameClient`
- `GameVersion`
- `Resource`
- `Translation`
- `CasRepository`
- `ResourceRepository`
- `TranslationRepository`
待完成:
- 领域服务模块仍为空。
- Glossary、Provider、Patch、Manifest 等后续仓储/服务接口需要补齐。
- 公共错误模型需要与 CLI/API 错误码统一。
### `bat-adapters`
状态:**适配器框架可用,官方日服规则和 Addressables 当前样本解析已推进**
已包含:
- Unity adapter trait、注册表、Unity 2021.3 adapter 骨架。
- Manifest driver trait、Addressables driver、注册表。
- Addressables JSON catalog 的 path、hash、size、address、dependencies、metadata 解析。
- 真实形态 Addressables fixture/golden 测试。
- 官方日服 `server-info`、URL 规则、平台 discovery 和 inventory 枚举。
待完成:
- Unity bundle parse/serialize 仍是后续阶段能力。
- Addressables parser 仍需继续覆盖更多官方 catalog 结构变体和失败诊断。
- 客户端发现、备份、应用补丁流程尚未连接真实实现。
### `bat-cas-engine`
状态:**CAS V1 已完成**
已包含:
- BLAKE3 Hash。
- 原子文件写入:临时文件、fsync、rename、目录 sync。
- 文件系统对象存储:put/get/exists/delete/list/stats。
- SQLite 对象元数据和引用计数。
- 引用计数增加、减少、查询。
- GC 候选查询和 GC 删除。
- 并发写入相同内容测试。
- 损坏对象 Hash mismatch 检测。
- infrastructure 仓储适配层。
待完成:
- 更复杂的跨进程压力测试。
- 未来需要时扩展流式大文件写入。
- 未来需要时扩展非 SQLite 元数据后端。
### `bat-infrastructure`
状态:**CAS 适配层、ResourceRepository 和官方资源同步入口可用**
已包含:
- `FileSystemCasRepository` 作为 `bat-core::CasRepository` 适配层。
- `InMemoryResourceRepository`
- `SqliteResourceRepository`
- 官方 pull plan 构建。
- `OfficialResourcePullService`:官方 URL 拒绝策略、目标路径映射、下载 manifest、`.part` 续传、重试、官方 seed `.hash` 校验。
- `OfficialUpdateService`:官方 metadata auto-discover、bootstrap cache、snapshot diff、marker diff、本地 audit/repair。
- `bat-official-sync`:正式 CLI binary,支持 one-shot 和 `--watch`
待完成:
- 将官方同步下载结果作为用户级流程自动导入 CAS + ResourceRepository。
- 为真实线上全量下载建立受控 smoke test 记录。
- 增加更多失败恢复和权限场景测试。
### `bat-assetbundle`
状态:**占位**
当前只有:
- Parser trait 占位。
- AssetType 占位。
- 错误类型骨架。
待完成:
- UnityFS header、block、directory、metadata、object table。
- LZ4/LZMA 解压。
- TypeTree 解析。
- TextAsset、MonoBehaviour、ScriptableObject 解析入口。
### `bat-patch`
状态:**占位**
当前 Binary Patch 和 JSON Patch 函数返回空结果,不具备真实补丁能力。
待完成:
- Binary diff/apply。
- JSON Patch apply/validate。
- Patch manifest。
- Integrity check。
- Rollback。
### `bat-ffi`
状态:**粗粒度 JSON API 可用,稳定边界仍需继续收敛**
已包含:
- `bat_version`
- `bat_manifest_inspect_json`:解析 Addressables manifest 并返回 JSON summary。
- `bat_sync_plan_json`:根据 current/previous snapshot 生成官方同步计划 JSON。
- `internal/ffi/ffi.go` 提供 Go 包装骨架。
待完成:
- Go CLI 调用链路。
- 错误码与结构化响应约定。
- 发布用头文件、构建脚本和跨平台产物。
### Go / API / Web
状态:**Go FFI 包骨架存在,CLI/API/Web 仍未实现**
当前情况:
- `internal/ffi/ffi.go` 已存在。
- `cmd/``pkg/``api/``web/` 仍无可用产品入口。
- `go test ./...` 在没有 Go package 时可能无测试可运行;Makefile 会清晰跳过空 Go 阶段。
---
## 4. 已验证结果
最新功能提交前已运行并通过:
```bash
cargo test -p bat-adapters -- --nocapture
cargo test -p bat-ffi -- --nocapture
cargo test -p bat-infrastructure -- --nocapture
cargo test -p bat-infrastructure --bin bat-official-sync -- --nocapture
cargo run -p bat-infrastructure --bin bat-official-sync -- --help
git diff --cached --check
```
提交后确认:
```bash
git status --short
```
结果:工作区干净。
未执行:
- 真实官方网络全量下载 smoke test。
- Go CLI 端到端测试,因为 Go CLI 尚未实现。
- Web/API 测试,因为 Web/API 尚未实现。
---
## 5. 当前生产运行边界
当前唯一可作为 Linux 生产资源同步任务运行的入口是 Rust binary
```bash
cargo run -p bat-infrastructure --bin bat-official-sync -- \
--auto-discover \
--platforms Windows,Android \
--output /var/lib/bluearchive-toolkit/official \
--watch
```
生产要求:
1. 使用独立输出目录,例如 `/var/lib/bluearchive-toolkit/official`
2. 不要指向已有游戏客户端目录。
3. 不要指向 `/home/wanye/D/BlueArchive` 这类开发或人工维护资源目录。
4. `--auto-discover` 可以下载官方 metadata,并按官方 manifest 临时获取 `resources.assets` 以解析 `GameMainConfig`;旧 ZIP manifest 才会下载临时 game zip。该流程不会安装或启动官方 launcher。
5. systemd service、容器或 Go 进程可以负责守护 `bat-official-sync --watch`,但定时检查逻辑已经在 Rust 内部;正常检查默认 1 小时,失败重试默认 60 秒。
详细运行说明见 `docs/guides/official-resource-test-pull.md`
---
## 6. 当前阻塞项
下一阶段必须优先完成:
1. Go CLI 最小可用入口:`bat doctor``bat sync --help`、Rust 官方同步命令包装。
2. 官方同步结果接入 CAS + ResourceRepository 的用户级工作流。
3. AssetBundle UnityFS 基础解析。
4. Addressables parser 对更多官方 catalog 结构的覆盖。
5. 真实官方网络全量下载 smoke test 记录。
6. Patch 和翻译系统仍应后置。
---
## 7. 下一步建议
立即任务:
1. 实现 Go CLI 最小框架和 `doctor`
2.`bat-official-sync` 增加发布型构建/安装说明和服务化验证。
3. 补端到端 smoke:dry-run、真实下载到隔离目录、二次运行静默 up-to-date、本地损坏后 repair。
4. 开始 AssetBundle parser 的 UnityFS header/block/directory。
---
- **当前总体完成度**:约 22%
- **当前基线状态**:Rust 官方资源同步链路已具备可运行闭环;产品级 CLI/API/Web 仍未完成。
- **下一工程里程碑**:Go CLI 最小可用 + 官方同步端到端 smoke + AssetBundle 解析起步。