Comp names zh

From 2017YANR02/cuberoot.me · View interactive version

Comp names zh is an AI agent skill from the GitHub repository 2017YANR02/cuberoot.me. Use when regenerating comp_names_zh.json, debugging 比赛名本地化, or rendering competition names through localizeCompName, CompCell, stripCompYear, or localizeCity. Always use comp-localize.ts, never raw c.name, and avoid duplicating the year beside dates.

How to use this skill

Skill file

中国比赛名中文化

前端显示规则全在 core/packages/client/lib/comp-localize.ts 的 JSDoc(localizeCompName / stripWcaPrefix)。新代码渲染比赛名一律走它,禁止裸 c.name。compNameZh() 命中前先 await loadFlagData()。

年份不重复(全站规则,issue #65)

比赛年份已经显示在页面上(同行日期列 / 卡片日期 / 年份分组标题)时,比赛名里就不再出现年号:夹江公开赛2026 + 2026-07-25 → 显示 夹江公开赛。

数据:`stats/comp_names_zh.json`

日常由 fetch_upcoming_comps.ts --incremental 复用本轮 WCA/CN 索引增量合并,保留历史映射。历史补齐仍使用 core/jobs/stats-build/src/bin/fetch_comp_names_zh.ts(在 core/jobs/stats-build 下跑),不再每天全量遍历历史。

npx tsx src/bin/fetch_comp_names_zh.ts           # 全量
npx tsx src/bin/fetch_comp_names_zh.ts --refresh # 增量(清第 1 页 + WCA API 缓存)

爬虫已知坑

城市名(兄弟模块)

lib/city-localize.ts::localizeCity(city, isZh),新增城市直接往 CITY_ZH 加键。

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.