feat(tools): Phase 0.3 ds-compare 注册表驱动(每屏+外壳都跟原型比)

- 抽出 tools/screens.mjs 屏注册表单一真源,fidelity 与 ds-compare 共用
- ds-compare 改为遍历注册表(含 shell 外壳项),默认全屏×三主题产并排目检图;
  保留 --html/--prefix 临时单屏;统一注入 NotoSansSC 与 golden 同字体
- 满足规则2:每一屏 + 外壳都需跟原型对比

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
wangjia
2026-06-25 17:47:07 +08:00
parent 0af9bf663e
commit c314fb381d
3 changed files with 95 additions and 47 deletions
+1 -15
View File
@@ -32,21 +32,7 @@ import { execFileSync } from 'node:child_process';
import { mkdirSync, existsSync, writeFileSync } from 'node:fs';
import { homedir, tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
// ── 逐屏注册表 ────────────────────────────────────────────────────────────────
// width/height = golden 的「逻辑」尺寸(golden 物理像素 = 逻辑 × dpr);两边须一致。
// prefix = golden 文件前缀 client/test/golden/goldens/<prefix>_<theme>.png。
// threshold = 该屏校准阈值(差异像素比例上限);首版人工目检「像」后把当时 diff% + 余量记此。
// 注:屏随 Phase 2 逐个照原型重建后再把其 prefix 入册并校准阈值。
const SCREENS = {
inventory: {
html: '.superpowers/prototype/screens/inventory.html',
prefix: 'inventory_list',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
threshold: 0.20, // 旧屏未重建,暂宽松;Phase 2 重建后收紧
},
};
import { SCREENS } from './screens.mjs'; // 屏注册表单一真源(与 ds-compare 共用)
const { values, positionals } = parseArgs({
allowPositionals: true,