Skip to content

Docs/reorganize topic layout - #78

Merged
watney1024 merged 10 commits into
mainfrom
docs/reorganize-topic-layout
Sep 26, 2026
Merged

watney1024 merged 10 commits into
mainfrom
docs/reorganize-topic-layout

Conversation

@jizhenjun

Copy link
Copy Markdown
Collaborator

No description provided.

jizhenjun and others added 10 commits September 26, 2026 21:07
Restructure the documentation tree so each topic's guide, design doc and
dev doc live together, and archive superseded material instead of leaving
it scattered across the repo root and docs/ root.

New layout:
  docs/guide/          foundation guides 00-04
  docs/topics/<NN-X>/  one folder per topic (guide + design + dev)
  docs/reference/      ARCHITECTURE, developer/optimization/verification, coding standards
  docs/reports/        topic reports and schedules
  docs/plans/          implementation plans
  docs/promo/          recruitment page (md + html)
  docs/archive/提案/   29 archived topic proposals
  docs/archive/旧版/   superseded versions (topic17 v1.3, old landing page)

103 files moved, 205 relative links rewritten, no content deleted.

The course-site generator keys output filenames on num+title rather than on
the markdown's directory, so the move is neutral for the published site:
the 42 generated pages are byte-identical before and after. Only 16 hrefs
change, 13 of them reference docs following the files into docs/reference/.

Also:
- docs/topics/html/ is a build artifact that CI never refreshed (it builds
  to benchmark_reports/docs), so it drifted from the sources. Untrack it,
  gitignore it, and add a `make docs` target.
- Drop the never-hit basename fallback in _md_link_to_html: with several
  docs legitimately sharing a basename it would silently resolve links to
  the wrong page.
- Fail the build when a COURSE doc is missing and wipe stale output. The
  previous WARNING-and-continue emitted dead sidebar links while CI stayed
  green.
- Add scripts/check_docs_links.py, wired into CI: validates relative links,
  basename uniqueness, and emitted GitHub blob URLs.
- Fix 4 pre-existing broken links in archived proposals.

Co-Authored-By: Claude <noreply@anthropic.com>
The reorganisation is complete and verified, so migrate_docs_layout.py has
no further use. Its two-phase MOVES table is preserved in the parent commit
(5a98471) for anyone auditing the file moves.

scripts/check_docs_links.py stays -- it is wired into CI.

Co-Authored-By: Claude <noreply@anthropic.com>
The docs under docs/topics/ read as long tutorials, which makes them a poor
entry point for someone picking up a topic. The original topic proposals in
docs/archive/提案/ already read as a guide -- difficulty, status, one-line
overview, task list, deliverables and a 12-week plan -- so for the 18 topics
that have one, the proposal now serves as the topic's main document and the
previous guide is renamed NN-X-详细教程.md and kept beside it.

  18 main documents swapped; the other 12 topics (3, 8, 10, 15, 19, 23-27,
  29, 30) have no proposal and are untouched.

Because the generator points at docs/topics/<NN-X>/<NN-X>.md, the course site
picks up the shorter documents with no path changes: still 42 pages, and
exactly the 18 swapped pages differ from the previous build.

Cross-references needed care. A link like "相关课题: 课题17" means "topic 17's
document", and that path is unchanged -- it just holds different content now.
Rewriting it to follow the old file to -详细教程.md would have pointed 62
cross-references and all of docs/topics/INDEX.md at the detailed version,
inverting the intent, so those were reverted. Only references that are
explicitly about the tutorial keep pointing at -详细教程.md.

Also fixes stale link labels: where a label was itself a path (e.g.
../../../topic13/README.md) it is now the current name. Labels that are
accurate repo-relative paths (benchmark_reports/peephole_compare.md) are
left as-is -- they are descriptions, not paths.

Co-Authored-By: Claude <noreply@anthropic.com>
The swap is done and verified; the mapping is preserved in the parent commit
(fb5d2fd) for anyone auditing it. scripts/check_docs_links.py stays.

Co-Authored-By: Claude <noreply@anthropic.com>
The project started with 14 topics (2026-05-21 task specs, implemented in
PR #5); the rest were added later and grew doc/topics to 30. docs/topics now
holds the first phase only, and the 16 later topics move to
docs/archive/后续课题/ -- moved, not deleted.

  docs/topics/          14 topics   (01 05 06 07 09 11 12 13 14 17 18 20 21 28)
  docs/archive/后续课题/ 16 topics   (02 03 04 08 10 15 16 19 22-27 29 30)

20 files moved, 47 links rewritten.

The course site follows: the 16 are dropped from COURSE, so it builds 25
pages instead of 42 (1 index + 5 sections + 5 foundation + 14 topics). The
"规划中" section had all three of its topics archived and is removed -- an
empty section is just an empty promise. Section descriptions no longer
advertise topics that left.

docs/topics/INDEX.md is rewritten as the first-phase index and gains a
section pointing at the archived 16, so nothing becomes undiscoverable. It
also now links topic 06's guide rather than 06-性能测试套件使用说明.md, which
is what COURSE had been pointing at -- the two had disagreed.

Two latent bugs surfaced while updating the promo page:

- docs/promo/ScratchV.html had 14 dead GitHub blob links. Its table has an
  "实现指南" and a "提案" column; once the proposals became the guides, the
  提案 column pointed at files that no longer exist. That column now points
  at the demoted -详细教程.md and is labelled accordingly.
- check_docs_links.py only validated blob URLs under --html-dir, so an
  absolute GitHub URL in a hand-maintained page was never checked -- exactly
  the kind of link that rots unnoticed when files move. It now scans every
  tracked .html. Verified against an injected dead link.

Co-Authored-By: Claude <noreply@anthropic.com>
Mapping preserved in the parent commit. scripts/check_docs_links.py stays.

Co-Authored-By: Claude <noreply@anthropic.com>
The 18 -详细教程.md files were the pre-swap guides, demoted when the topic
proposals became the guides. They are removed, along with the 12 later-phase
topics on docs/archive/后续课题/ whose only document was that same overly
detailed guide -- 30 files in total.

  docs/topics/           14 topics keep guide + design/dev docs
  docs/archive/后续课题/  only 02, 04, 16, 22 keep a document
  (03 08 10 15 19 23-27 29 30 are gone from the working tree)

All 30 remain in git history; nothing was rewritten.

Reference clean-up:

- docs/reference/ARCHITECTURE.md linked three deleted topics in its
  "深入学习" line; it now points at the topics index.
- docs/topics/13-窥孔优化器/ referenced its 详细教程 in four places
  (completion index, reading order, design doc header, guide header).
- docs/topics/INDEX.md's archive table listed all 16 later topics; it now
  lists the 4 that still have documents and says where the other 12 went.
- CLAUDE.md no longer advertises a 详细教程 role.

docs/promo/ScratchV.html had its 课题提案 column relabelled to 详细教程 in
the previous commit; with those files gone the column had no target, so the
column (header + 14 cells) is removed. The table is back to four columns.

check_docs_links.py caught all 19 relative links and 14 blob URLs this
deletion broke, which is what it is for.

Co-Authored-By: Claude <noreply@anthropic.com>
Both directories held per-topic material that belonged with its topic, so
docs/reports/ and docs/plans/ are gone and their 7 files sit in the topic
folders:

  06-性能基准套件/    06-双后端未通过用例分析.md
  17-寄存器分配/      17-寄存器分配-{AI自审报告,P1实现报告,伪指令溢出统计排期,修改测试自查报告}.md
  01-DSL前端增强器/   01-DSL前端增强器-CI-Benchmark实现计划-2026-09-19.md
  09-DSL错误提示美化器/ 09-DSL错误提示美化器-实现计划-2026-08-12.md

None of the 7 had an inbound link or an outbound relative link, so nothing
needed rewriting. The plan files were renamed to the topic-folder convention;
their original names carried the only date record, so it is kept as a suffix
rather than dropped.

docs/ is now only guide/ topics/ reference/ promo/ archive/ plus the index.

Co-Authored-By: Claude <noreply@anthropic.com>
The v1.3 design and dev docs sat in docs/archive/旧版/ because v1.5
superseded them. They belong with topic 17 like its other documents, so both
move to docs/topics/17-寄存器分配/ and keep their version-suffixed names, so
v1.3 and v1.5 sit side by side and the older one is still identifiable.

Neither file had an inbound link or an outbound relative link, so nothing
needed rewriting. docs/archive/旧版/ now holds only the archived landing page.

Co-Authored-By: Claude <noreply@anthropic.com>
15 files removed: the 11 module guides left in 提案/ and the 4 later-phase
topics still holding a document in 后续课题/ (02, 04, 16, 22). All remain in
git history.

They had 15 inbound references between them, which had to be dealt with
rather than left dangling:

- docs/promo/ScratchV.html pointed its 实现指南 column at the archived
  module guides for 7 of the 14 topics. Those now point at the topic's own
  guide, so all 14 rows are consistent and none point into archive/.
- docs/topics/13-窥孔优化器/ referenced topic13_asm_peephole_guide.md in four
  places (completion index, reading order, design doc header, and the
  closing maintenance pointer). The completion index was already removed
  earlier; the remaining three go, and the closing pointer now points at the
  topic's own completion index.
- docs/topics/INDEX.md loses its 后续课题 section, which listed topics whose
  documents no longer exist.

docs/archive/ now holds only the archived course landing page.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🤖 AI Code Review

共审查 10 个变更文件
⚠️ 另有 19 个文件超过上限(最多 10 个)未审查

📁 .github/workflows/ci.yml

🟡 Missing dependency for link checker — Line 427: check_docs_links.py may depend on packages (e.g., requests, beautifulsoup4) not installed in this step. Only markdown is installed above. If the script imports anything beyond stdlib, this step will fail on first run.

Suggestion: Add required pip packages alongside markdown, or have the script declare its own dependencies (e.g., via a requirements file or inline pip install at the top of the script).

🟡 Hard failure on link check — Line 427: No error tolerance — any broken link fails the entire CI.

Suggestion: Consider whether a continue-on-error: true or warning-level output is more appropriate, depending on team policy. If strict enforcement is intentional, this is fine — just noting the behavioral impact.

💭 Comment alignment — The trailing dashes in the comments don't match the new comment width after the path length change (docs/promo/ScratchV.html vs docs/ScratchV.html). Purely cosmetic.


📁 .gitignore

🔴 无阻塞问题。

这个变更本身没有问题,但我有一个小建议:

🟡 Suggestion — Line 18: 考虑添加前导 /

当前模式 docs/topics/html/ 会匹配仓库中 任意深度 的该路径。如果 docs/topics/html/ 只应该出现在仓库根目录下,建议写为 /docs/topics/html/ 以避免意外忽略其他位置的同名目录。

💭 Nit — 注释位置

注释 # Course site — generated by make docs, never commit 紧贴被忽略的条目,但下方紧跟着另一组注释 # Build artifacts at root。两个注释块之间建议空一行分隔,保持可读性一致:

 docs/topics/html/
+
 # Build artifacts at root (generated, never commit)

整体来说这是一个干净、低风险的变更 ✅


📁 CLAUDE.md

🟡 Topic count regression — 旧版 topics/ 有 30 个模块,新版写"第一期 14 个课题",剩余 16 个的去向未说明。
Suggestion: 在 archive/ 描述中注明旧版 topics 已迁入归档,或在注释中说明第二期计划。

💭 ARCHITECTURE.md 位置暗示变化 — 旧版是 docs/ARCHITECTURE.md(顶层文件),新版归入 reference/ 子目录。结构清晰,但如有外部链接引用旧路径会失效。
Suggestion: 确认没有外部文档或脚本依赖 docs/ARCHITECTURE.md 路径。


📁 Makefile

Review: Makefile — add docs target & update quick-start

🟡 docs 缺少依赖检查 — docs target 直接调用 python3 scripts/build_docs_html.py,如果该脚本依赖项目包或第三方库(例如 Python 依赖),用户可能忘记先运行 make install 而导致失败。考虑加一个前置条件或至少在注释里提示:

docs: install
	python3 scripts/build_docs_html.py

或者至少在脚本中做依赖自检测。

🟡 clean target 未清理生成物 — 注释明确写了 "generated, not committed",但 clean target 未清理 docs/topics/html/。用户运行 make clean 后构建产物残留,可能造成混乱。

💭 xdg-open 路径与 docs 输出路径的一致性 — 无法从 diff 中确认 build_docs_html.py 的输出确实是 docs/topics/html/index.html。建议确认路径一致,或者在 docs target 成功后 echo 一下输出路径,降低用户困惑。

💭 docs 缺少 @echo 反馈 — 其他 target(如 quick-start)都有用户友好的输出。docs 静默执行脚本,失败时用户只有 traceback。考虑加一行:

docs:
	@echo "📄 Building course HTML..."
	python3 scripts/build_docs_html.py

📁 README.md

Review: README.md docs restructure

🟡 docs/INDEX.md link may be broken — "文档速查" 表里仍指向 docs/INDEX.md,但新 tree 中 docs/ 根目录没有列出此文件。如果它已移入 docs/reference/ 或其他子目录,这个链接就会 404。请确认路径。

🟡 make docs 缺少上下文 — 快速上手第 3 步新增了 make docs,但没有任何解释(依赖什么工具?MkDocs? 需要什么版本?)。刚 clone 的用户会直接遇到 make: *** No rule to make target 'docs' 或找不到 mkdocs。建议加一行注释或脚注指向 docs/guide/00-环境搭建指南.md 中的前置条件。

🟡 课程首页本地链接被替换为远端 URL — docs/topics/html/index.html → https://scratchv-compiler.github.io/...。这意味着没有网或 fork 后部署路径不同的用户无法从 README 直接跳转到本地课程页。快速上手流程里保留了本地路径,但"文档速查"表里的入口就断掉了。考虑保留本地相对路径,或至少加一个本地备选。

💭 tree 注释可加粗对比 — topics/ 和 reference/ 的描述比较平铺,读者不容易区分"课题"和"参考"的边界。小建议,比如 ← 第一期课题(指引/设计/开发/报告) vs ← 架构/规范/开发指南。


📁 docs/INDEX.md

🟡 目录分类不一致 — 04-故障排除FAQ.md 移到了 guide/,但在 INDEX.md 中它列于"参考资料"表。FAQ 作为查阅型文档放在 reference/ 更一致,否则文件夹名和内容定位矛盾。

🟡 PR 完整性 — 此 diff 仅更新 INDEX.md 中的链接。需确认文件实际移动(git mv)在同一个 PR 中,否则所有链接会指向不存在的路径。如果分两个 PR,需要在 INDEX.md 合并时确保文件已就位。

💭 可追溯性 — 建议在 PR 描述中附上旧路径→新路径的映射表,方便 reviewer 快速确认无遗漏。当前 diff 中改动了 13 处链接,靠肉眼逐一核对容易漏。


📁 docs/archive/旧版/课程首页-index.html

🟡 Inconsistent link strategy — Two links use absolute GitHub Pages URL (https://scratchv-compiler.github.io/...) while all others use relative paths (../../guide/..., ../../reference/..., ../../INDEX.md). Pick one:

  • If this archived page is meant to redirect users to the live docs site, use absolute URLs for all external-redirect targets (including "交互式课程" card is fine, but consider whether the CTA "先搭环境" should also point to the live site rather than a sibling archive-local path).
  • If the archive should remain self-contained within the repo, prefer relative paths everywhere — they survive repo renames/relocations and work in local file:// previews.

🟡 Verify targets exist at the new depth — The file lives at docs/archive/旧版/, so ../../ resolves to docs/. Confirm these paths actually exist in the repo:

  • docs/guide/00-环境搭建指南.md (and 01–04)
  • docs/reference/ARCHITECTURE.md
  • docs/INDEX.md

If the current layout has these at docs/旧版/guide/ or similar, the ../../ jumps are off by one level and every link becomes a 404. A quick ls docs/guide/ (or CI link-check) would confirm.

💭 Broken-link check missing — For a 20-line link rewrite across 9 anchors, consider adding this PR to the repo's link-check CI (e.g., lychee / markdown-link-check) or at minimum a manual click-through of all 9 targets. Archive pages rot silently — relative paths here don't make them safe, only the targets' existence does.

💭 INDEX.md deep-link — ../../INDEX.md works for the docs index but users landing here may not realize it's the new index. If docs/archive/INDEX.md is the intended destination instead, this link should be INDEX.md (same directory). Clarify intent in the PR description.


📁 docs/guide/01-编译器概念入门.md

🟡 Broken link risk — 确认 docs/reference/ARCHITECTURE.md 已实际存在或将在同一 PR 中新增。否则链接将 404。

💭 Consider — 如果其他 .md 文件也有指向 ARCHITECTURE.md 的链接,建议一并检查是否遗漏更新(可用 grep -r "ARCHITECTURE.md" docs/ 排查)。


📁 docs/guide/02-快速上手教程.md

🔴 链接路径需验证 — 三个链接从同目录改为 ../reference/ 和 ../topics/,需确认仓库实际目录结构匹配。如果文件未实际搬迁,这些链接会 404。

🟡 文本内容变更 — "30 个课题" → "第一期 14 个课题",这不是纯链接修复而是内容变更,确认数字与当前实际状态一致。


📁 docs/guide/03-指标解读指南.md

🟡 Verify companion link — Line 241: [04-故障排除FAQ.md](04-故障排除FAQ.md) still points to the same directory. If optimization_guide.md was reorganized into ../reference/, confirm that 04-故障排除FAQ.md is still correctly located in docs/guide/. If the whole docs structure was reorganized, this link may be broken too.

💭 Nit — Consider making both links consistent. If 04-故障排除FAQ.md is also in docs/guide/, the relative path is fine; but if the reorganization touched more files, this might be the next link to break. A quick search for all relative links in this directory would catch it proactively.



⚠️ 未审查的文件

  • docs/guide/04-故障排除FAQ.md
  • docs/promo/ScratchV.html
  • docs/promo/ScratchV.md
  • docs/reference/ARCHITECTURE.md
  • docs/reference/CODING_STANDARDS.md
  • docs/reference/developer_guide.md
  • docs/reference/optimization_guide.md
  • docs/reference/verification.md
  • docs/topics/01-DSL前端增强器.md
  • docs/topics/01-DSL前端增强器/01-DSL前端增强器-CI-Benchmark实现计划-2026-09-19.md
  • docs/topics/01-DSL前端增强器/01-DSL前端增强器-开发文档.md
  • docs/topics/01-DSL前端增强器/01-DSL前端增强器-设计文档.md
  • docs/topics/01-DSL前端增强器/01-DSL前端增强器.md
  • docs/topics/02-ONNX解析器.md
  • docs/topics/03-IR系统.md
  • docs/topics/04-IR优化器框架.md
  • docs/topics/05-汇编代码美化器.md
  • docs/topics/05-汇编代码美化器/05-汇编代码美化器-开发文档.md
  • docs/topics/05-汇编代码美化器/05-汇编代码美化器-设计文档.md

@watney1024
watney1024 merged commit 11a2c3c into main Sep 26, 2026
6 checks passed
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.

2 participants