Skip to content

docs-gen: getCategoryTitle() 只给 UI/AI/API 大写,qa 渲染成 "Qa Protocol"(参考页标题 + meta.json + 根索引导航三处) #5853

Description

@baozhoutao

现象

packages/spec/scripts/build-docs.tsgetCategoryTitle() 只对三个缩写做全大写:

const getCategoryTitle = (dir: string) => {
  const upper = dir.toUpperCase();
  if (['UI', 'AI', 'API'].includes(upper)) return `${upper} Protocol`;
  return `${dir.charAt(0).toUpperCase() + dir.slice(1)} Protocol`;
};

qa 同样是缩写(Quality Assurance),但不在名单里,于是走了首字母大写分支,生成 "Qa Protocol"

落点(当前 main 三处,均为已发布内容)

文件 内容
content/docs/references/qa/index.mdx title: Qa Protocol —— 分类页标题
content/docs/references/qa/meta.json "title": "Qa Protocol" —— 侧边栏这一项的显示名
content/docs/references/index.mdx 根索引导航表与章节标题(#4759 把根索引纳入生成后,同一个 CATEGORIES[category] 也喂给了这张表)

src/qa/index.ts 自己的文件头写的是 "Quality Assurance (QA) Protocol",所以是生成器单方面把它降级成了 Qa

修法

getCategoryTitle() 的缩写名单加 QA。这是个纯生成器改动,改完 pnpm --filter @objectstack/spec gen:docs 重新生成即可;check:docs 会把上面三处一起带上。

要不要顺手把名单换成一个显式的 CATEGORY_TITLE_OVERRIDES 表(而不是「全大写后查缩写名单」这种反推),归接手方判断 —— 现在这个形状每加一个缩写目录就会再犯一次,而目录是 readdirSync(SRC_DIR) 动态发现的,没有任何东西提醒你补名单。

#4759(根索引纳入生成)的开发过程扫出:生成的导航表把 14 个分类标题并排列出来时,Qa Protocol 夹在 AI Protocol / API Protocol / UI Protocol 中间一眼可见。范围外,故单开,不在 #4759 的 PR 里改 —— 那个 PR 只把根索引纳入生成,不改分类标题,否则会额外动到 qa/index.mdxqa/meta.json 两个与 #4759 无关的生成物。

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions