补齐模板库页面单测与真连建项目检查
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 6m50s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 6m2s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m36s
Project CI / Backend tests (pull_request) Failing after 11s
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 6m7s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 4m56s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m46s
Project CI / Repository checks (pull_request) Failing after 15s
Project CI / Frontend tests (pull_request) Failing after 4m41s
Project CI / AI game creator shell web tests (pull_request) Failing after 3m48s
Project CI / Native shell tests (pull_request) Successful in 9m39s

- 前端单测迁到 apps/ai-game-creator-shell/tests/,与根 vitest include 一致;新增模板库页面与首页推荐位 8 项渲染/交互测试(卡片封面、标签、已下载徽标、搜索、筛选、下载与使用模板、空态与错误态)
- 模板库的运行时与标签筛选补 aria-label,避免同名按钮歧义
- 真连检查扩展为「读线上清单 → 下载安装线上模板 → 据此建项目」的完整链路
- 同步技术方案、里程碑与实施计划的验证命令与验收口径
This commit is contained in:
kdletters
2026-09-17 11:37:29 +08:00
parent 7eaaa1a499
commit 46d395763d
7 changed files with 328 additions and 5 deletions
@@ -42,8 +42,9 @@ Milestone Spec: `docs/project-memory/plans/【里程碑】AGC模板库客户端
```bash
cargo check --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml
cargo test --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --bin genarrative-ai-game-creator-shell template_library
cargo test --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --bin genarrative-ai-game-creator-shell template_library -- --ignored
cd apps/ai-game-creator-shell && npx tsc -p tsconfig.json --noEmit
cd apps/ai-game-creator-shell && npx vitest run src/features/template-library
npx vitest run apps/ai-game-creator-shell/tests/templateLibraryModel.test.ts apps/ai-game-creator-shell/tests/templateLibraryView.test.tsx
node scripts/agc-template-library-publish.mjs --source <dir> --dry-run
npm run check:encoding
node scripts/check-doc-index.mjs
@@ -31,7 +31,7 @@ AGC 客户端能读取公共 OSS 上的游戏模板库,并把「浏览 → 筛
4. `create_automatic_local_game_project_from_template` 建出的项目同时具备模板文件、`.agent` 清单与标准目录;失败时不留项目目录。
5. 模板库页可按关键词、标签、运行时与「仅看已下载」筛选;卡片显示封面与已下载徽标;「使用模板」在版本落后时先重下再建项。
6. 首页推荐位展示模板库内容并可进入模板库页;左侧导航有模板库入口且为独立全屏页。
7. 定向 Rust 单测 8、前端模型单测 9 项、`tsc` 类型检查、`npm run check:encoding``git diff --check` 全部通过。
7. 定向 Rust 单测 9(含线上清单 fixture)、前端模型 9 项 + 页面/推荐位 8 项、`tsc` 类型检查、`npm run check:encoding``git diff --check` 全部通过;可选真连检查能读线上清单、下载安装线上模板并据此建项目
## 依赖
@@ -76,8 +76,10 @@ templates/
```bash
# 模板库单测(清单校验、键安全、解压路径逃逸、安装与建项目)
cargo test --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --bin genarrative-ai-game-creator-shell template_library
# 前端模型单测
cd apps/ai-game-creator-shell && npx vitest run src/features/template-library
# 模板库真连检查(可选,需要网络):读线上清单、下载安装线上模板包并据此建项目
cargo test --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml --bin genarrative-ai-game-creator-shell template_library -- --ignored
# 前端模型与页面单测(AGC 测试统一在 apps/ai-game-creator-shell/tests/
npx vitest run apps/ai-game-creator-shell/tests/templateLibraryModel.test.ts apps/ai-game-creator-shell/tests/templateLibraryView.test.tsx
# 类型检查 / 编码 / 空白
cd apps/ai-game-creator-shell && npm run typecheck
npm run check:encoding
@@ -88,6 +90,8 @@ curl -s https://agc-dev.oss-rg-china-mainland.aliyuncs.com/templates/index.json
手工验收:打开模板库 → 搜索与筛选 → 下载(出现「已下载」徽标)→ 「使用模板」→ 进入项目工作台且项目里已有模板文件。
运行态核验(客户端真的拉过清单时):本机缓存 `<app_data>/templates/index.json` 与线上 `templates/index.json` 逐字节一致;`<app_data>/templates/installed/<id>/<version>/installed.json` 出现即表示该模板已下载完成。
## 失败与回退
- 清单读不到且没有本机缓存:模板库页显示错误与重试,首页推荐位显示「模板库暂时没有可用的模板」。