upgrade: adopt V8.12.0-dev.1 (V8.11 unified professional UI + V8.12 workflow usability)
- Overlay 26 changed files from SiteForge_Enterprise_V8_12 (UI layer only: professional-ui.js/css, workspace/factory-v2/operations/editor templates, +2 test files, compose/ci/scripts/docs) - Re-apply v8_workflows type-mapping fix (类型/分类) lost in upgrade - Pin compose project name to siteforge-v8-10 so existing data volumes (hesupipe site 483295c29ea0, 193 entries) keep attached - Drop stray .s10_* state files; ignore .s10_*/.sf_*/.s87_* patterns - Plan/spec revisions per plan-review round 1 (icons are new design, real test assertions, recorded deviations) Tests: 226 passed / 1 env-only failure (test needs node binary in PATH, absent in python:3.12-slim container; host node v24 --check all 9 JS OK) Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -20,13 +20,9 @@
|
||||
|
||||
## Phase 1+2:平台适配与骨架跑通(Task 1-8)
|
||||
|
||||
### Task 1: Git 基线
|
||||
### Task 1: Git 基线 —— ✅ 已完成(2026-10-22,幂等跳过)
|
||||
|
||||
**Files:** 无新文件(初始化仓库)
|
||||
|
||||
- [ ] **Step 1:** `cd $ROOT && git init && git add -A && git status --short | head -20`
|
||||
- [ ] **Step 2:** 确认 `.env`、`storage/`、`hesupipe_clean2.xml` 未被跟踪(.gitignore 已含 `.env`、`storage/`;`git check-ignore .env` 应有输出;`hesupipe_clean2.xml` 加入 .gitignore 一行)
|
||||
- [ ] **Step 3:** `git commit -m "chore: baseline V8.10.0-dev.1 with v8_workflows type-mapping fix and trade-pro spec"`(含 Co-Authored-By 行,下同)
|
||||
已执行并有扩展:仓库初始化、基线提交、远程 `http://219.157.255.213:25311/xinyouhe/cms-SiteForge.git` 配置并推送(main + feat/trade-pro-theme),远程原有 V5 基线历史经 `-s ours` 无损合并,`docs/COMPLETION_PLAN.md` 带入当前树;`.env`/密码确认未入库。随后追加 **V8_12 原地升级**(26 文件覆盖 + bug 修复重放 + compose 项目名钉回 `siteforge-v8-10` 保护数据卷)。执行者无需重跑本任务。
|
||||
|
||||
### Task 2: 主题发现单一源(F1)
|
||||
|
||||
@@ -40,15 +36,18 @@
|
||||
|
||||
```python
|
||||
"""Theme discovery must be a single source of truth."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
from app import core, theme_pro, theme_store
|
||||
|
||||
ROOT = Path(core.__file__).resolve().parent.parent
|
||||
|
||||
def test_discover_returns_builtin_themes_with_manifests():
|
||||
ids = core.discover_themes()
|
||||
for tid in ('automotive', 'industrial', 'corporate', 'minimal'):
|
||||
assert tid in ids
|
||||
import json
|
||||
for tid in ids:
|
||||
manifest = json.loads((core.ROOT / 'themes' / tid / 'manifest.json').read_text(encoding='utf-8'))
|
||||
manifest = json.loads((ROOT / 'themes' / tid / 'manifest.json').read_text(encoding='utf-8'))
|
||||
assert manifest.get('id') == tid
|
||||
|
||||
def test_three_whitelists_agree():
|
||||
@@ -56,8 +55,6 @@ def test_three_whitelists_agree():
|
||||
assert isinstance(core.THEMES, tuple)
|
||||
```
|
||||
|
||||
注:`core.ROOT` 若不存在,测试里用 `pathlib.Path(app.__file__).parent.parent`。
|
||||
|
||||
- [ ] **Step 2:** `python -m pytest tests/test_theme_registry.py -q` → 预期 FAIL(`discover_themes` 不存在)
|
||||
- [ ] **Step 3: 实现**——`app/core.py:12` 替换为:
|
||||
|
||||
@@ -208,13 +205,19 @@ def test_trade_pro_registered_and_compatible():
|
||||
assert result['valid'], result['errors']
|
||||
assert not result['errors']
|
||||
|
||||
def test_trade_pro_builds_real_site():
|
||||
# 集成冒烟:真实构建函数对演示站点渲染 home 不抛异常(复用现有测试夹具方式,
|
||||
# 参考 tests/test_theme_pro_v3.py 中的最小站点夹具)
|
||||
...
|
||||
def test_trade_pro_builds_real_site(tmp_path):
|
||||
# 复用 tests/test_theme_pro_v3.py 中"建站→切主题→构建→断言预览页"的既有写法
|
||||
# (夹具工厂在 tests/test_factory_v2.py:15-30),theme 用 'trade-pro'。
|
||||
# 真实断言(不允许空壳):
|
||||
# 1. 构建成功且生成 index.html
|
||||
# 2. 输出包含 lang="en"
|
||||
# 3. 不包含平台中文默认导航文案"首页"
|
||||
html = (tmp_path / 'index.html').read_text(encoding='utf-8') # 按夹具实际构建目录
|
||||
assert 'lang="en"' in html
|
||||
assert '>首页<' not in html
|
||||
```
|
||||
|
||||
(第二个测试复用 test_theme_pro_v3.py 已有的最小站点构建夹具写法,theme 传 'trade-pro'。)
|
||||
(执行时先读 test_theme_pro_v3.py 的相邻测试,逐行复制其夹具调用方式,仅替换 theme 参数与断言;禁止保留 `...` 空壳。)
|
||||
|
||||
- [ ] **Step 2:** 跑 → FAIL
|
||||
- [ ] **Step 3: 创建文件**
|
||||
@@ -230,7 +233,7 @@ def test_trade_pro_builds_real_site():
|
||||
"style": "international-b2b",
|
||||
"entry": "pro.html",
|
||||
"styles": ["theme.css", "blocks.css"],
|
||||
"page_templates": ["home","about","contact","listing","product","article","case","standard","category"],
|
||||
"page_templates": ["home","about","contact","listing","category","product","article","brand","case","service","faq","standard","notfound"],
|
||||
"blocks": ["hero","richtext","features","stats","collection","image_text","gallery","faq","cta","attributes","spacer","layout","carousel","video","tabs","pricing","map","form_link"],
|
||||
"responsive": true,
|
||||
"auto_binding": true,
|
||||
@@ -240,7 +243,9 @@ def test_trade_pro_builds_real_site():
|
||||
}
|
||||
```
|
||||
|
||||
`site.html`:以 `themes/industrial/site.html` 为底,改 `lang="zh-CN"` → `lang="en"`,其余变量占位不动(它只包 {{content}})。
|
||||
`site.html`:以 `themes/industrial/site.html` 为底(它是 4.4KB 的完整独立模板,自带 header/footer 结构,**不引用共享宏库**),改 `lang="zh-CN"` → `lang="en"`。注意:pro 主题的正式渲染走 pro.html,site.html 主要服务非 pro 路径/兜底。
|
||||
|
||||
**已知新行为(评审发现,记录不阻断)**:Task 2 后 trade-pro 进入 BUILTIN,上传主题 ZIP 可声明 `layout_family:'trade-pro'`(theme_store.install 会拷贝 trade-pro 的 site/pro.html),而 ZIP 包渲染走共享宏回落——与依赖自有宏库的 trade-pro 存在潜在错配。本轮接受(上传包本就以声明式为主),后续如出问题在 install() 校验 layout_family 白名单。
|
||||
|
||||
`_professional_components.html`:先做**透传骨架**(从共享库复制 card/cover 等宏,Task 10 起逐个换成 cms 设计 + SVG 图标)。
|
||||
|
||||
@@ -289,9 +294,11 @@ def test_frontend_entries_include_trade_pro():
|
||||
]:
|
||||
assert needle in (base / rel).read_text(encoding='utf-8'), rel
|
||||
|
||||
def test_theme_color_map_covers_trade_pro():
|
||||
# theme_pro.make_context 的 theme_color 字典含 trade-pro(渲染 smoke 断言 meta theme-color)
|
||||
...
|
||||
def test_theme_color_map_covers_trade_pro(tmp_path):
|
||||
# 真实断言:trade-pro 构建出的首页含 meta theme-color #0b3d91
|
||||
# (复用 Task 5 的构建夹具写法)
|
||||
html = (tmp_path / 'index.html').read_text(encoding='utf-8')
|
||||
assert '<meta name="theme-color" content="#0b3d91"' in html
|
||||
```
|
||||
|
||||
- [ ] **Step 2:** 跑 → FAIL
|
||||
@@ -328,11 +335,13 @@ def test_theme_color_map_covers_trade_pro():
|
||||
- [ ] 验收断言:`themes/trade-pro/theme.css` 覆盖 tokens 全集(颜色/字体/圆角/间距);构建产物 `assets/theme.css` 含 `--sf-tp-` 变量;平台 custom.css 的 `.btn{...}` 与主题按钮类无交集(grep 断言)
|
||||
- [ ] pytest(现有快照不受影响)+ commit
|
||||
|
||||
### Task 9: 图标宏库(替代箭头)
|
||||
### Task 9: 图标宏库(新增设计——不是 cms 移植)
|
||||
|
||||
- 源:cms 组件与 dist HTML 中的内联 SVG(`grep -o '<svg[^>]*>' dist/hesupipe/en/index.html` 起逐个提取;参考 `src/components/*.astro` 里的图标用法)
|
||||
- [ ] `themes/trade-pro/_professional_components.html` 定义 `icon(name)` 宏:内联 SVG 集合(≥8 个:arrow-right/check/phone/mail/location/whatsapp/download/quote 等,从 cms 实际用到的集合提取)
|
||||
- [ ] 验收:home/product 页渲染输出含 `<svg` 且无裸文本箭头 `→` 作为唯一图标(对照 dist)
|
||||
> 评审修正(2026-10-22):cms 源码与 dist 实测 **0 个 SVG**,其图标实为文本箭头 `→`(index 15 处、product 17 处)。用户需求"图标需要优化、现在很多都是箭头"意味着图标是**超出 cms 源的新增设计**,不与 dist 对照。
|
||||
|
||||
- [ ] `themes/trade-pro/_professional_components.html` 定义 `icon(name)` 宏:自设计内联 SVG 集合,线条风格与 `--sf-tp-*` 令牌一致,≥8 个:arrow-right / check / phone / mail / location / download / search / quote
|
||||
- [ ] 尺寸/描边随 CSS 变量(`currentColor`、`1.5px` stroke),跟随深浅文字色
|
||||
- [ ] 验收:home/product 渲染中**交互元素的图标均为 SVG**,不再以裸 `→` 作为唯一图标(对照对象是本主题自身,非 dist);`aria-hidden="true"` 保证可访问性
|
||||
- [ ] commit
|
||||
|
||||
### Task 10: 九种独立布局逐个移植(每布局一个 commit)
|
||||
@@ -361,6 +370,14 @@ def test_theme_color_map_covers_trade_pro():
|
||||
- [ ] 实战验收:站点 483295c29ea0 最终构建 ≥203 页零错误;视觉对照两层标准(spec §6)逐页记录
|
||||
- [ ] 更新 spec 附录验收记录;commit
|
||||
|
||||
## 与 spec 的已记录偏差(评审裁定可接受)
|
||||
|
||||
1. **发现函数放 core 而非 spec 4.2.1 写的 theme_store**:等价实现。core 已被全部引用方(builder/main/theme_pro)导入,放 core 消除反向耦合;theme_store.BUILTIN 经 import 别名保持一致。
|
||||
2. **builder.ENV 保持单目录**(spec 4.2.4 提到两处构造点):已验证 site.html 是不引用共享宏的独立模板,且带主题前缀的路径加载在单目录下安全;仅 theme_pro.LOADER 改为 per-theme env_for。
|
||||
3. **spec §6 "渲染快照"以 E2E 页面断言实现**(构建后逐页 200 + 结构选择器 + 文案断言),不另建 Jinja 快照测试文件。
|
||||
4. **/api/themes(main.py:267)经 core.THEMES 动态化自动生效**,不设专项测试(catalog 由既有测试覆盖)。
|
||||
5. **前端入口 option 文案**:三个 HTML 下拉用"Trade Pro · 外贸 B2B(英文)"中文风格与各文件现状一致(theme-gallery 用英文)。
|
||||
|
||||
## 风险与回退
|
||||
|
||||
- 每个 Task 独立 commit,出问题 `git revert` 单点回退
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
## 1. 背景与目标
|
||||
|
||||
把 cms 项目(D:\project\cms)Astro 主题的视觉设计移植为 SiteForge 第 5 套内置主题 `trade-pro`,首要服务 hesupipe.com 重建(英文外贸 B2B),长期服务后续外贸类客户站。附带解决:默认语言英文(现四套主题模板硬编码 `lang="zh-CN"` + 中文文案)、图标体系(现主题大量箭头符号,cms 主题有内联 SVG 图标集)。
|
||||
把 cms 项目(D:\project\cms)Astro 主题的视觉设计移植为 SiteForge 第 5 套内置主题 `trade-pro`,首要服务 hesupipe.com 重建(英文外贸 B2B),长期服务后续外贸类客户站。附带解决:默认语言英文(现四套主题模板硬编码 `lang="zh-CN"` + 中文文案)。**图标更正(R3.1)**:cms 源码实测 0 个 SVG、图标亦为文本箭头,故"替换箭头为 SVG 图标集"属**新增设计项**(用户明确要求优化图标),不是 cms 移植内容,不与 dist 对照。
|
||||
|
||||
### 范围外
|
||||
|
||||
@@ -88,7 +88,7 @@ themes/trade-pro/
|
||||
|
||||
- `lang="en"`,主题内全部 UI 文案/面包屑/分页/日期英文;英文 chrome 兜底见 4.2.5
|
||||
- tokens.css 变量 `--sf-tp-*` 桥接 SiteForge 设计令牌(V8.7 全站设计草稿可调),优先级规则见 4.2.6
|
||||
- 图标:cms 内联 SVG 集合进主题宏库(替代箭头)
|
||||
- 图标:自设计内联 SVG 集合进主题宏库(替代箭头;**新增设计**,cms 源无 SVG,见 §1 更正)
|
||||
- 素材规范:主题包仅含中性演示素材;hesupipe 真实图片留在站点数据侧
|
||||
|
||||
### 4.6 数据映射与导入通道
|
||||
|
||||
Reference in New Issue
Block a user