turbo-verify
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVerify Theme Implementation
验证主题实现
Verify that a theme implementation is complete and follows all turbo-themes
standards. When asked to verify a theme (e.g., ), run
through the sections below. The skill holds the full add-time file map
and discovery approach — this skill checks the result.
/turbo-verify rose-pineturbo-add验证主题实现是否完整且符合所有turbo-themes标准。当需要验证某个主题(例如:)时,按照以下章节执行检查。技能包含完整的添加时文件映射和发现方法——本技能用于检查最终结果。
/turbo-verify rose-pineturbo-add1. Discover Touchpoints (do this first)
1. 排查主题关联文件(首先执行此步骤)
Do not trust a memorized file inventory. Compare the new theme's footprint against
a known-complete theme's footprint:
bash
undefined不要依赖记忆中的文件清单。将新主题的文件足迹与已知完整主题的文件足迹进行对比:
bash
undefinedPick a known-good variant id from src/themes/registry.ts (e.g. rose-pine-moon)
从src/themes/registry.ts中选择一个已知正确的变体ID(例如rose-pine-moon)
rg -l 'rose-pine-moon' --hidden -g '!node_modules' -g '!dist' | sort > /tmp/ref.txt
rg -l '<new-variant-id>' --hidden -g '!node_modules' -g '!dist' | sort > /tmp/new.txt
diff /tmp/ref.txt /tmp/new.txt
rg -l 'rose-pine-moon' --hidden -g '!node_modules' -g '!dist' | sort > /tmp/ref.txt
rg -l '<new-variant-id>' --hidden -g '!node_modules' -g '!dist' | sort > /tmp/new.txt
diff /tmp/ref.txt /tmp/new.txt
Family-level touchpoints (type unions, family maps, vendor metadata)
家族级关联点(类型联合、家族映射、供应商元数据)
diff <(rg -l 'rose-pine' src/ packages/ apps/ scripts/ | sort)
<(rg -l '<theme>' src/ packages/ apps/ scripts/ | sort)
<(rg -l '<theme>' src/ packages/ apps/ scripts/ | sort)
Also verify root-level registrations the greps can miss because they do not
mention variant ids:
- [ ] `theme:sync` script wiring in `package.json`
- [ ] Size limits in `test/integration/bundle-size.test.ts`
Every file present only in the reference list is a likely missing touchpoint.
Exclude files that auto-derive from core (imports from
`@lgtm-hq/turbo-themes-core/tokens`) and generated artifacts (rebuild instead).diff <(rg -l 'rose-pine' src/ packages/ apps/ scripts/ | sort)
<(rg -l '<theme>' src/ packages/ apps/ scripts/ | sort)
<(rg -l '<theme>' src/ packages/ apps/ scripts/ | sort)
同时验证grep可能遗漏的根级注册信息,因为这些信息未提及变体ID:
- [ ] `package.json` 中的 `theme:sync` 脚本配置
- [ ] `test/integration/bundle-size.test.ts` 中的大小限制
仅在参考列表中存在的文件很可能是新主题缺失的关联点。排除从核心自动派生的文件(从`@lgtm-hq/turbo-themes-core/tokens`导入的文件)和生成的产物(重新构建即可)。2. Core Implementation
2. 核心实现
Theme Pack (src/themes/packs/<theme>.synced.ts
or <theme>.ts
)
src/themes/packs/<theme>.synced.ts<theme>.ts主题包(src/themes/packs/<theme>.synced.ts
或 <theme>.ts
)
src/themes/packs/<theme>.synced.ts<theme>.ts- Exports a with
ThemePackage,id,name,homepage(spdx/url/copyright, recommended),license(package/version/repository, recommended for synced), andsourceflavors - Each flavor has (lowercase-hyphenated),
id(full display name, e.g. "Gruvbox Dark Hard"),label(matches family),vendor(appearance/light), and completedarktokens - No in flavor definitions (icons resolve via
iconUrl)VENDOR_ICON_MAP
- 导出包含、
id、name、homepage(推荐使用spdx/url/copyright格式)、license(对于同步主题推荐包含package/version/repository)和source的flavorsThemePackage - 每个flavor包含(小写连字符格式)、
id(完整显示名称,例如“Gruvbox Dark Hard”)、label(匹配家族)、vendor(appearance/light)和完整的darktokens - flavor定义中没有(图标通过
iconUrl解析)VENDOR_ICON_MAP
Required Token Groups
必填令牌组
- — base, surface, overlay
background - — primary, secondary, inverse
text - — primary
brand - — info, success, warning, danger
state - — default
border - — link
accent - — fonts (sans, mono), webFonts
typography - — heading (h1-h6), body, link, selection, blockquote, codeInline, codeBlock, table
content
- —— base、surface、overlay
background - —— primary、secondary、inverse
text - —— primary
brand - —— info、success、warning、danger
state - —— default
border - —— link
accent - —— fonts(sans、mono)、webFonts
typography - —— heading(h1-h6)、body、link、selection、blockquote、codeInline、codeBlock、table
content
Registry, Tokens, Icons
注册表、令牌、图标
- Theme imported in , flavors spread into
src/themes/registry.tsallFlavors - W3C token JSON per variant in (
schema/tokens/themes/<variant-id>.tokens.json/$valueformat,$type→$schema)../../turbo-themes.schema.json#/$defs/ThemeFile - PNG icon per variant in (typically 24x24)
assets/img/<variant-id>.png
- 主题已导入,flavors已展开到
src/themes/registry.ts中allFlavors - 每个变体对应schema/tokens/themes/<variant-id>.tokens.json中的W3C令牌JSON(/
$value格式,$type指向$schema)../../turbo-themes.schema.json#/$defs/ThemeFile - 每个变体对应assets/img/<variant-id>.png中的PNG图标(通常为24x24尺寸)
3. Theme Selector Package
3. 主题选择器包
- type union includes the family (
ThemeFamily)packages/theme-selector/src/types.ts - has name + description (
THEME_FAMILIES)packages/theme-selector/src/constants.ts - and
VENDOR_FAMILY_MAPupdated;VENDOR_ICON_MAPhas an entry per variant (FLAVOR_DESCRIPTIONS)packages/theme-selector/src/theme-mapper.ts
- 类型联合中包含该主题家族(
ThemeFamily)packages/theme-selector/src/types.ts - 中包含名称和描述(
THEME_FAMILIES)packages/theme-selector/src/constants.ts - 和
VENDOR_FAMILY_MAP已更新;VENDOR_ICON_MAP中每个变体都有对应条目(FLAVOR_DESCRIPTIONS)packages/theme-selector/src/theme-mapper.ts
4. Site Integration
4. 站点集成
apps/site/src/data/theme-meta.tsBaseLayout.astroThemeDropdown.astro- Theme group in (id, displayName, flavors)
themeGroups - All variants in with short labels (e.g., "Mocha" — shorter than the token
themeNames)label - All variants in with icon filenames
themeIcons - auto-derives — verify the count matches the expected total
validThemeIds - and
ThemeDropdown.astrostill import fromBaseLayout.astro(no hardcoded theme arrays crept back in)theme-meta.ts - Theme family in the sidebar (header with icon/name/count, button per variant) and in its JS
themes.astroobjectthemeNames - Hero preview strip buttons added in
index.astro
apps/site/src/data/theme-meta.tsBaseLayout.astroThemeDropdown.astro- 中包含主题组(id、displayName、flavors)
themeGroups - 中包含所有变体的短标签(例如“Mocha”——比令牌中的
themeNames更短)label - 中包含所有变体的图标文件名
themeIcons - 自动派生——验证其数量与预期总数一致
validThemeIds - 和
ThemeDropdown.astro仍从BaseLayout.astro导入(没有硬编码的主题数组被重新加入)theme-meta.ts - 主题家族出现在侧边栏中(带有图标/名称/数量的标题,每个变体对应一个按钮)及其JS
themes.astro对象中themeNames - 中添加了Hero预览条按钮
index.astro
5. Build Pipeline
5. 构建流水线
- If synced: script in (package.json), output path is
theme:sync(NOTsrc/themes/packs/), version read frompackages/core/...intonode_modules/<pkg>/package.json, and the build succeeds from a clean state (delete thesource.versionfile, run.synced.ts, confirm it regenerates)bun run build - in
vendorMetahas correct name/homepage; generatedscripts/prepare-style-dictionary.mjsfiles show themtokens.json - Generated assets rebuilt and committed — discover them with
after
git status(theme-selector JS bundles,bun run buildin core/python/swift trees)tokens.json
- 如果是同步主题:的
package.json中有对应脚本,输出路径为theme:sync(而非src/themes/packs/),版本从packages/core/...读取并写入node_modules/<pkg>/package.json,且从干净状态构建成功(删除source.version文件,运行.synced.ts,确认文件已重新生成)bun run build - 中的
scripts/prepare-style-dictionary.mjs包含正确的名称/主页;生成的vendorMeta文件中显示这些信息tokens.json - 重新构建并提交生成的资源——运行后通过
bun run build查看(theme-selector JS包、core/python/swift目录下的git status)tokens.json
6. Examples
6. 示例验证
Use the section-1 diff to enumerate example files. Then confirm, per hit:
- Web examples: new variants in options and
<select>/VALID_THEMES/LIGHT_THEMESarrays (FOUC and main scripts)THEMES - Files that import from were NOT hand-edited (they auto-update)
@lgtm-hq/turbo-themes-core/tokens - Swift example: enum cases,
ThemeId.swiftThemeRegistry.swiftpalettes,ThemeDefinitioncounts, labels, and raw valuesThemeRegistryTests.swift
使用第1步的diff结果枚举示例文件。然后针对每个匹配项确认:
- Web示例:选项和
<select>/VALID_THEMES/LIGHT_THEMES数组中包含新变体(FOUC和主脚本)THEMES - 从导入的文件未被手动编辑(它们会自动更新)
@lgtm-hq/turbo-themes-core/tokens - Swift示例:枚举案例、
ThemeId.swift中的ThemeRegistry.swift调色板、ThemeDefinition中的数量、标签和原始值ThemeRegistryTests.swift
7. Build Verification
7. 构建验证
bash
uv run lintro chk # Expected: 0 issues (run first for fast failure)
bun run build # Expected: "Build complete!" with new theme count
bun run examples:build # Expected: all example projects build
bun run test # Expected: all unit tests pass
bun run examples:test # Expected: all example E2E tests pass
cd apps/site && bun run build # Expected: no errorsVisual regression note: if E2E visual tests fail after adding themes to the
hero strip, that is expected — snapshots are generated on Linux CI. Run the
workflow (Actions → Maintenance: Generate
Playwright Snapshots → Run workflow).
maintenance-generate-snapshots.ymlbash
uv run lintro chk # 预期结果:0个问题(先运行此命令快速排查错误)
bun run build # 预期结果:显示“Build complete!”且包含新主题数量
bun run examples:build # 预期结果:所有示例项目构建成功
bun run test # 预期结果:所有单元测试通过
bun run examples:test # 预期结果:所有示例E2E测试通过
cd apps/site && bun run build # 预期结果:无错误视觉回归说明:如果在Hero条添加主题后E2E视觉测试失败,这是正常现象——快照是在Linux CI上生成的。运行工作流(Actions → Maintenance: Generate Playwright Snapshots → Run workflow)即可。
maintenance-generate-snapshots.yml8. Functional Testing
8. 功能测试
- Theme appears in the header dropdown under the correct family group
- Selecting it updates page styling; header shows the correct icon and short label (not the id or full name)
- Theme persists across refresh and page navigation (no revert to default)
- Explorer page: family in sidebar, all variants selectable, palette and live preview render per variant
- CSS file generated per variant; CSS variables set when applied
- 主题出现在顶部下拉菜单中的对应家族分组下
- 选择主题后页面样式更新;顶部显示正确的图标和短标签(而非ID或全名)
- 主题在刷新和页面跳转后仍保持生效(不会恢复为默认主题)
- 探索页面:侧边栏中显示主题家族,所有变体均可选择,每个变体的调色板和实时预览正常渲染
- 每个变体都生成了对应的CSS文件;应用主题时CSS变量已正确设置
Quick Fix Reference
快速修复参考
| Issue | Solution |
|---|---|
| Theme reverts on navigation | Add variants to |
| Wrong/missing header label | Fix |
| Missing icon | Fix |
| Theme in wrong group | Fix |
| Theme not appearing | Check |
| Tests fail on theme order | Use |
| Bundle too large | Review asset diff; raise bundle budget if intentional |
| CI "Cannot find module" | Add sync script to |
| tokens.json wrong metadata | Add to |
| Generated assets outdated | Run |
| Missing descriptions | Add to |
| Sync writes to wrong path | Change outPath to |
| Visual regression fails | Run |
| Missing from examples/Swift | Re-run the section-1 diff and fill the gaps |
| 问题 | 解决方案 |
|---|---|
| 主题在页面跳转后恢复默认 | 在theme-meta.ts的 |
| 顶部标签错误/缺失 | 修复theme-meta.ts中的 |
| 图标缺失 | 修复theme-meta.ts中的 |
| 主题分组错误 | 修复theme-mapper.ts中的 |
| 主题未显示 | 检查 |
| 测试因主题顺序失败 | 使用 |
| 包体积过大 | 检查资源差异;若为有意调整则提高包体积预算 |
| CI提示“Cannot find module” | 在package.json的 |
| tokens.json元数据错误 | 在prepare-style-dictionary.mjs中添加到 |
| 生成的资源过时 | 运行 |
| 描述缺失 | 在theme-mapper.ts中添加到 |
| 同步脚本写入错误路径 | 将outPath改为 |
| 视觉回归测试失败 | 运行 |
| Swift示例中缺失 | 重新执行第1步的diff并填补缺失内容 |
Review Output Format
评审输出格式
text
undefinedtext
undefinedTheme Review: <theme_name>
主题评审:<theme_name>
Status: PASS / FAIL / PARTIAL
状态:通过 / 失败 / 部分通过
Checklist Summary
检查清单摘要
- Discovery diff: clean / N missing files
- Core Implementation: X/Y items
- Theme Selector Package: X/Y items
- Site Integration: X/Y items
- Build Pipeline & Examples: X/Y items
- Build Verification: X/Y items
- Functional Testing: X/Y items
- 关联文件对比:无差异 / 缺失N个文件
- 核心实现:完成X/Y项
- 主题选择器包:完成X/Y项
- 站点集成:完成X/Y项
- 构建流水线与示例:完成X/Y项
- 构建验证:完成X/Y项
- 功能测试:完成X/Y项
Missing Items
缺失项
- [item]
- [具体项]
Recommendations
建议
- [recommendation]
undefined- [具体建议]
undefined