refactor: 原型迁移 .superpowers/prototype → design/prototype(与 CONTRACT 同目录)
Design Source Checks / design-source (push) Failing after 14m23s
Design Source Checks / design-source (push) Failing after 14m23s
- git mv 全目录(历史保留);.gitignore 收敛为整个 .superpowers/ 忽略 - 全仓 16 处引用同步(CI checks.yml / l1-sync / screens.mjs / hooks / CLAUDE.md / CONTRACT / SSR 模板注释 / docs / web 注释) - 修 pre-commit 路径正则残留;5180 评审服务已切新路径 - 验证:check-ds 12 道 / l1-sync 6 道 / fidelity 抽查全过 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// tools/check-l1-sync.mjs — L1 设计真相源同源闸(四道,纯 Node 零依赖)
|
||||
//
|
||||
// 治理依据:CLAUDE.md「设计真相源分层」L1 层——tokens/atoms/icons 以
|
||||
// .superpowers/prototype/ 为单一真源,client 与 web 只能是它的同步副本。
|
||||
// design/prototype/ 为单一真源,client 与 web 只能是它的同步副本。
|
||||
// CI(.gitea/workflows/checks.yml,PR + main push)与本地均可直接跑:
|
||||
// node tools/check-l1-sync.mjs
|
||||
//
|
||||
@@ -30,11 +30,11 @@ const problems = [];
|
||||
|
||||
// ── ① tokens 快照同源 ──────────────────────────────────────
|
||||
{
|
||||
const proto = read('.superpowers/prototype/tokens.css');
|
||||
const proto = read('design/prototype/tokens.css');
|
||||
const snap = read('client/lib/core/theme/token_source/tokens.css');
|
||||
if (proto !== snap) {
|
||||
problems.push(
|
||||
'[tokens快照] .superpowers/prototype/tokens.css 与 ' +
|
||||
'[tokens快照] design/prototype/tokens.css 与 ' +
|
||||
'client/lib/core/theme/token_source/tokens.css 不一致 —— ' +
|
||||
'改原型后需拷贝快照并重跑 client/tool/gen_tokens.mjs',
|
||||
);
|
||||
@@ -50,7 +50,7 @@ const problems = [];
|
||||
}
|
||||
return map;
|
||||
};
|
||||
const a = symbols(read('.superpowers/prototype/screens/icons.js'));
|
||||
const a = symbols(read('design/prototype/screens/icons.js'));
|
||||
const b = symbols(read('web/_includes/icons.njk'));
|
||||
for (const id of Object.keys(a)) {
|
||||
if (!(id in b)) problems.push(`[icons] symbol "${id}" 仅原型有,web/_includes/icons.njk 缺 —— 改原型后同步官网`);
|
||||
@@ -69,7 +69,7 @@ const problems = [];
|
||||
Object.fromEntries(
|
||||
[...css.matchAll(/(--[\w-]+)\s*:\s*([^;}]+)[;}]/g)].map(([, k, v]) => [k, v.replace(/\s+/g, '')]),
|
||||
);
|
||||
const proto = read('.superpowers/prototype/tokens.css');
|
||||
const proto = read('design/prototype/tokens.css');
|
||||
const root = proto.match(/:root\s*{([^}]*)}/s)?.[1] ?? '';
|
||||
const themeA = proto.match(/\[data-theme="a"\]\s*{([^}]*)}/s)?.[1] ?? '';
|
||||
const pv = { ...vars(root), ...vars(themeA) };
|
||||
@@ -114,7 +114,7 @@ const problems = [];
|
||||
Object.fromEntries(
|
||||
[...css.matchAll(/(--[\w-]+)\s*:\s*([^;}]+)[;}]/g)].map(([, k, v]) => [k, v.replace(/\s+/g, '')]),
|
||||
);
|
||||
const proto = read('.superpowers/prototype/tokens.css');
|
||||
const proto = read('design/prototype/tokens.css');
|
||||
const root = vars(proto.match(/:root\s*{([^}]*)}/s)?.[1] ?? '');
|
||||
const theme = (t) => vars(proto.match(new RegExp(`\\[data-theme="${t}"\\]\\s*{([^}]*)}`, 's'))?.[1] ?? '');
|
||||
// 模板私有派生变量(主色低透明度/表面高透明度,模板头注释声明来源)
|
||||
@@ -148,7 +148,7 @@ const problems = [];
|
||||
// ── ⑥ 徽章图标映射同集(BADGE_ICON ↔ kStatusIcons)─────────
|
||||
{
|
||||
const keysOf = (body) => new Set([...body.matchAll(/'([^']+)'\s*:/g)].map((m) => m[1]));
|
||||
const js = read('.superpowers/prototype/screens/icons.js');
|
||||
const js = read('design/prototype/screens/icons.js');
|
||||
const protoKeys = keysOf(js.match(/BADGE_ICON\s*=\s*{([\s\S]*?)}/)?.[1] ?? '');
|
||||
const dart = read('client/lib/widgets/ds/status_icon_map.dart');
|
||||
const dartKeys = keysOf(dart.match(/kStatusIcons\s*=[\s\S]*?{([\s\S]*?)};/)?.[1] ?? '');
|
||||
|
||||
+13
-13
@@ -20,7 +20,7 @@ export const SCREENS = {
|
||||
// 外壳:顶栏(两级品牌+主题器+通知) + 侧栏(分组) + 状态栏。
|
||||
// 全屏阈值松(内容区空白 vs 原型满表),真正判定看 zones(顶栏带收紧到 4%)。
|
||||
shell: {
|
||||
html: '.superpowers/prototype/screens/inventory.html', // 外壳含在每个全框屏里,借库存页取整框
|
||||
html: 'design/prototype/screens/inventory.html', // 外壳含在每个全框屏里,借库存页取整框
|
||||
prefix: 'app_shell',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -33,7 +33,7 @@ export const SCREENS = {
|
||||
],
|
||||
},
|
||||
inventory: {
|
||||
html: '.superpowers/prototype/screens/inventory.html',
|
||||
html: 'design/prototype/screens/inventory.html',
|
||||
prefix: 'inventory_list',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -42,7 +42,7 @@ export const SCREENS = {
|
||||
threshold: 0.07, // 实测 4.7% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
partners: {
|
||||
html: '.superpowers/prototype/screens/partners.html',
|
||||
html: 'design/prototype/screens/partners.html',
|
||||
prefix: 'partners',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -50,7 +50,7 @@ export const SCREENS = {
|
||||
threshold: 0.06, // 实测 3.6% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
products: {
|
||||
html: '.superpowers/prototype/screens/products.html',
|
||||
html: 'design/prototype/screens/products.html',
|
||||
prefix: 'products_archive',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -60,7 +60,7 @@ export const SCREENS = {
|
||||
threshold: 0.06, // 实测 3.7% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
devices: {
|
||||
html: '.superpowers/prototype/screens/devices.html',
|
||||
html: 'design/prototype/screens/devices.html',
|
||||
prefix: 'device_management',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -68,7 +68,7 @@ export const SCREENS = {
|
||||
threshold: 0.06, // 实测 3.5% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
settings: {
|
||||
html: '.superpowers/prototype/screens/settings.html',
|
||||
html: 'design/prototype/screens/settings.html',
|
||||
prefix: 'settings',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -76,7 +76,7 @@ export const SCREENS = {
|
||||
threshold: 0.04, // 实测 2.4% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
users: {
|
||||
html: '.superpowers/prototype/screens/users.html',
|
||||
html: 'design/prototype/screens/users.html',
|
||||
prefix: 'users',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -84,14 +84,14 @@ export const SCREENS = {
|
||||
threshold: 0.04, // 实测 1.9% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
about: {
|
||||
html: '.superpowers/prototype/screens/about.html',
|
||||
html: 'design/prototype/screens/about.html',
|
||||
prefix: 'about',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
threshold: 0.05, // 实测 2.7% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
'stock-in': {
|
||||
html: '.superpowers/prototype/screens/stock-in-list.html',
|
||||
html: 'design/prototype/screens/stock-in-list.html',
|
||||
prefix: 'stock_in_list',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -101,7 +101,7 @@ export const SCREENS = {
|
||||
threshold: 0.06, // 实测 4.0% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
'stock-out': {
|
||||
html: '.superpowers/prototype/screens/stock-out-list.html',
|
||||
html: 'design/prototype/screens/stock-out-list.html',
|
||||
prefix: 'stock_out_list',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
@@ -109,7 +109,7 @@ export const SCREENS = {
|
||||
threshold: 0.06, // 实测 4.0% + 2pp(2026-07-07 收紧,原 0.08)
|
||||
},
|
||||
login: {
|
||||
html: '.superpowers/prototype/screens/login.html',
|
||||
html: 'design/prototype/screens/login.html',
|
||||
prefix: 'login',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.auth',
|
||||
@@ -123,14 +123,14 @@ export const SCREENS = {
|
||||
// (实测 a 15.5 / b 6.2 / c 26%),像素闸无意义。golden 测试仍锁三主题回归;
|
||||
// 后端补 shop_code/voucher 支持后恢复此注册并收紧到 ~8%:
|
||||
// register: {
|
||||
// html: '.superpowers/prototype/screens/register.html',
|
||||
// html: 'design/prototype/screens/register.html',
|
||||
// prefix: 'register',
|
||||
// width: 1280, height: 900, dpr: 2,
|
||||
// waitFor: '.auth',
|
||||
// threshold: 0.08,
|
||||
// },
|
||||
finance: {
|
||||
html: '.superpowers/prototype/screens/finance.html',
|
||||
html: 'design/prototype/screens/finance.html',
|
||||
prefix: 'finance',
|
||||
width: 1280, height: 900, dpr: 2,
|
||||
waitFor: '.app',
|
||||
|
||||
Reference in New Issue
Block a user