Skip to content

feat(codegraph): 新增 CodeGraph 文档站,取代产品页发布到 firlab.app/codegraph/ - #31

Merged
sunerpy merged 3 commits into
mainfrom
feat/codegraph-site
Oct 3, 2026
Merged

sunerpy merged 3 commits into
mainfrom
feat/codegraph-site

Conversation

@sunerpy

@sunerpy sunerpy commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

摘要

为 CodeGraph 新增文档站,按 Voltip 站点的设计(DESIGN.md §10)实现,取代原产品页,发布到 firlab.app/codegraph/。做法与 pt-tools 的 #14 相同。owner 已于 2026-10-03 确定采用这个路径方案。

  • codegraph/:VitePress 1.6.4 子站,base 为 /codegraph/,中文为根语言,英文在 /codegraph/en/。

    • 外壳从 pt-tools 复制,样式前缀改为 cg-,字体改用 Inter 和 JetBrains Mono(与查看器一致)。
    • 首页数据结构为 home-schema.ts;区块包括功能一览、四步上手、三组文字加证据(Agent 用的问题与工具对照表、查看器截图、语言提取深度表)、平台表、数据去向、安装方式和「它不做什么」。
  • 页面来源:页面同步自 codegraph-rust 的 docs/site/(中英文各 11 页)。13 份规范参考文档(docs/<name>.md,只有英文)原样发布到 /en/reference/ 和 /en/dev/,每份另有一个生成的中文指引页(noindex,不进 sitemap,不显示编辑链接)。

  • scripts/sync-codegraph-docs.sh:写入任何内容之前先检查以下各项,任一不通过就停止:

    • 缺页,或只有一种语言的页面;
    • 未注册的组件,或页面引用了不存在的截图;
    • 用户页中的口语词或 crate 名;
    • 无版本依据的「亚毫秒」说法。

    检查通过后,它把指向规范文档的仓库相对链接改写为站内路径,其余链接改写为 GitHub 链接。

  • 标题锚点与编辑链接:标题锚点采用 GitHub 的 slug 规则,使 codegraph-rust 中经 docs-check 校验过的锚点在站内同样有效;编辑链接按页面来源映射回 docs/site/ 或 docs/<name>.md。

  • scripts/check-dist.sh:除了 pt-tools 已有的检查,还会把每个站内根相对链接和资源解析到构建产物,从而覆盖首页 frontmatter 中的链接。

  • deploy.yml:在主站之后构建并检查子站,再放入 dist/codegraph/;如果主站仍生成这个目录,就停止部署。另新增 codegraph-site-ci.yml 用于 PR 检查。

  • 主站改动:

    • 删除 CodeGraph 产品页(CodeGraphPage.astro、i18n/codegraph.ts 及两个 pages);
    • 目录条目的 page.href 按语言指向子站;
    • /en/codegraph/ 重定向到 /codegraph/en/;
    • robots.txt 增加子站 sitemap;
    • AppIcon 改为 CodeGraph 查看器的 BrandMark 图形,画在海军蓝底板上;
    • 合入 feat(site): 有独立域名的产品直接链到其站点首页 #30 后,站内只剩 AgentLens 一个产品页:DESIGN.md 开头与 LangSwitch.astro、ui.ts 注释中的示例改指 AgentLens;schema.ts 的 EntityFragment 去掉不再使用的 'codegraph'(与 feat(site): 有独立域名的产品直接链到其站点首页 #30 去掉 'voltip' 相同)。
  • 文档:DESIGN.md 新增 §13,只记录与 §10–§12 不同之处及原因,§8 注明其中测量过的 /codegraph/ 页面已由文档站取代;更新 README.md,新增 codegraph/README.md。

  • 首次同步:内容来自 codegraph-rust PR #313 的 head 3b3cb5e,synced.json 记录了这个提交。

验证(本地,绑定 head 7b353cb)

验证脚本从本分支 head 的 git archive 全新导出运行,不使用本地的 dist/、node_modules/ 或未跟踪文件。工具链与 CI 相同(node 22.23.2、pnpm 10.25.0),日志首行记录 head、tree 和 origin/main(f554f4b,含 #30)。

  • 同步:synced.json 指向 codegraph-rust PR #313 的 head 3b3cb5e;从该提交重新同步,结果与本分支逐字节相同。
  • 主站(按 ci.yml 与 deploy.yml 的步骤):check-versions.mjs 通过;pnpm check 0 errors、0 warnings;pnpm build 构建出 4 页,dist/CNAME 为 firlab.app。
  • 子站:lockra、pt-tools、codegraph 按 deploy.yml 的步骤安装、构建、运行 check-dist.sh,再放入 dist/。codegraph 为中文 25 页、英文 24 页。
  • 主站接线:
    • 中英文目录页分别链接 /codegraph/ 和 /codegraph/en/,不再链接旧的 /en/codegraph/;
    • /en/codegraph/ 重定向到 /codegraph/en/;
    • robots.txt 列出子站的 sitemap。
  • 链接:
    • 组装产物的 159 个页面中,400 个不同的根相对链接全部可解析;
    • /codegraph/ 下 499 个不同链接(含相对链接,其中 385 个带锚点)全部可解析,每个锚点都对应目标页中存在的 id。
  • 浏览器验收(headless Chrome):覆盖 10 个页面、6 种宽度(320–1440)和两种主题,共 120 次渲染,结果如下:
    • 无横向溢出、无控制台错误、无失败请求;
    • 每页恰好一个 h1,13 张图片全部返回 200;
    • 计算颜色中没有紫色(OKLCH 色相 270–330 且色度 > 0.04);
    • 两个首页在 1280×800 和 375×812 下,标题、两条事实和安装按钮都在首屏内;
    • 语言切换正确映射到对应页面,包括指引页;
    • /en/codegraph/ 落到 /codegraph/en/;
    • 中文搜索「增量」、英文搜索「impact」都有结果,每个结果页面都返回 200。

合并顺序

先合并本 PR。合并并部署后,再在 codegraph-rust 的 PR 上重跑 docs-site.yml,然后合并那个 PR。codegraph-rust 需要 owner 手动创建 FIRLAB_DOCS_TOKEN 后才能自动推送同步;在此之前,同步改用 PR 进入本仓库。

🤖 Generated with Claude Code

sunerpy and others added 3 commits October 3, 2026 22:44
- codegraph/:VitePress 文档站,base 为 /codegraph/,中文为根语言、英文在 /codegraph/en/;页面与截图同步自 codegraph-rust 的 docs/site/,规范参考文档(只有英文)发布到 /en/reference/ 与 /en/dev/,并为每份生成中文指引页
- sync-codegraph-docs.sh 同步前检查缺页、单语页面、未注册组件、缺失截图、禁用词与无依据的性能说法,并把仓库相对链接改写为站内路径或 GitHub 链接;check-dist.sh 检查两种语言、站内链接全部可解析且都在 /codegraph/ 下
- deploy.yml 构建并检查子站后放进 dist/codegraph/,主站仍生成该路径时停止部署;codegraph-site-ci.yml 在 PR 上构建检查
- 删除主站的 CodeGraph 产品页,首页条目按语言链到文档站,/en/codegraph/ 跳转到 /codegraph/en/,robots.txt 增加子站 sitemap,AppIcon 改用查看器的 BrandMark
- DESIGN.md §13、README 与 codegraph/README.md 记录取舍、同步流程和一次性配置
#30 删除了 Voltip 的站内页面,CodeGraph 的产品页也由本分支删除,站内只剩 AgentLens 一个产品页:

- DESIGN.md 开头的组件示例与 LangSwitch.astro、ui.ts 注释中的路径示例改用 AgentLensPage.astro 与 /en/agentlens/;
- schema.ts 的 EntityFragment 去掉不再使用的 'codegraph'(与 #30 去掉 'voltip' 相同),文档示例 IRI 改为 #agentlens;
- DESIGN.md §8 记录其中测量过的 /codegraph/ 页面已于同日由文档站取代(§13)。
@sunerpy
sunerpy merged commit b725e94 into main Oct 3, 2026
4 checks passed
@sunerpy
sunerpy deleted the feat/codegraph-site branch October 3, 2026 15:17
sunerpy added a commit to sunerpy/codegraph-rust that referenced this pull request Oct 3, 2026
…ws (#313)

The words, screenshots and publishing workflows of the CodeGraph website at
https://firlab.app/codegraph/ (Chinese) and /codegraph/en/ (English), built to the
design of the Voltip site in sunerpy/firlab. The site shell, sync script and deploy
live in firlab (sunerpy/firlab#31).

- docs/site/: the home page and the guide (what CodeGraph is, install / update /
  removal, quick start, coding agents, the browser viewer, keeping the index
  current, configuration, FAQ, data and network, contributing), Chinese at the
  root and English under en/; the canonical references are published unchanged
- docs/site/public/: 14 captures of the real viewer (seven views, light and dark)
  and the logo; docs/site/tools/ retakes them in a temporary directory of its own
- .github/workflows/docs-site.yml builds a pull request's pages against firlab's
  main (advisory); publish-site.yml syncs them to firlab after a merge and needs
  the FIRLAB_DOCS_TOKEN secret
- README, docs/README.md and AGENTS.md link and describe the site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant