mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 21:05:51 +00:00
以 README 为单一事实来源,重构整个 docs/ 目录。 最终结构(3 大组、15 篇文档): - 开始: installation / quickstart / model-providers - 核心功能: pipes-and-lan、acp、channels、chrome-control、computer-use、 voice-mode、web-browser-tool、auto-dream、remote-control-self-hosting、 langfuse-monitoring - 内部机制: growthbook-adapter、sentry-setup 主要变更: - 删除 56 个 README 未提及的文档(architecture 全部 / guides 全部 / features 中未在 README 出现的 20 篇 / internals 中的 5 篇) - 合并 6 组重复文档(pipes-and-lan、chrome-control、acp、computer-use、 auto-dream、coordinator-mode 简化为入口) - features 子组从 5 → 4,ui/ 合并入 tools/ - 所有保留文档加上人性化 frontmatter(title/description/keywords) - docs.json navigation 简化为 3 大组,redirects 重新过滤为 7 条合并跳转 - 新增 docs.md 工作大纲与验证脚本(verify-docs / check-docs-orphans / dump-docs-outline) 总计 130 文件改动,从约 35000 行精简到约 2000 行。 Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* 校验 docs.json 引用的所有页面文件是否真实存在。
|
|
* 用法: node scripts/verify-docs.mjs
|
|
*/
|
|
import { readFileSync, existsSync } from 'node:fs'
|
|
import { resolve, dirname } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
const ROOT = resolve(__dirname, '..')
|
|
|
|
const docsJson = JSON.parse(readFileSync(resolve(ROOT, 'docs.json'), 'utf8'))
|
|
|
|
const referenced = new Set()
|
|
const walk = pages => {
|
|
if (!Array.isArray(pages)) return
|
|
for (const p of pages) {
|
|
if (typeof p === 'string') {
|
|
referenced.add(p)
|
|
} else if (p && Array.isArray(p.pages)) {
|
|
walk(p.pages)
|
|
}
|
|
}
|
|
}
|
|
|
|
const groups = docsJson?.navigation?.groups ?? []
|
|
for (const g of groups) walk(g.pages)
|
|
|
|
const candidates = ['.mdx', '.md']
|
|
const missing = []
|
|
for (const ref of referenced) {
|
|
const base = resolve(ROOT, ref)
|
|
const found = candidates.some(ext => existsSync(base + ext))
|
|
if (!found) missing.push(ref)
|
|
}
|
|
|
|
if (missing.length === 0) {
|
|
console.log(`✅ All ${referenced.size} referenced pages exist.`)
|
|
process.exit(0)
|
|
} else {
|
|
console.error(`❌ ${missing.length} missing page(s):`)
|
|
for (const m of missing) console.error(' - ' + m)
|
|
process.exit(1)
|
|
}
|