feat(scripts): generate the RFC index tables from the tree

docs/rfc/README.md's per-lifecycle tables are now generated between
gen-rfc-index marker comments from each RFC's path (lifecycle/class),
H1 title (optional 'RFC: ' prefix stripped), and filename date, sorted
by date then filename — the one docs region every proposal wave edits
and every concurrent branch conflicts on becomes derived state.

scripts/rfc-index.ts owns the shared walker (closed lifecycle/class
sets, structure rules, parseable-H1 requirement) and the renderer;
gen-rfc-index.ts is the writer CLI; verify-rfc-classification.ts keeps
the structure check and asserts the committed regions byte-match a
fresh render (freshness subsumes the index-completeness check, since a
generated-from-disk table is definitionally complete and correctly
headed). A malformed H1 is a hard error in both directions, so the H1
is now load-bearing as the title source — the one nonconforming H1
(a status suffix duplicating the path) is normalized.

Implements docs/rfc/implemented/process/2026-07-04-generate-rfc-index-tables.md
(moved from proposed/ and amended to the shipped mechanics); the
classification RFC's verify-only stance carries the supersession
cross-link per implemented/AGENTS.md.
This commit is contained in:
Tianyi Cui
2026-07-04 14:47:51 +08:00
parent 049e04f4a2
commit 5611f772b1
10 changed files with 269 additions and 198 deletions
+4 -2
View File
@@ -188,9 +188,11 @@ pnpm run verify-doc-refs # assert every docs/*.md path cited in a packages|exam
# TypeScript comment resolves (catches a moved/renamed doc)
pnpm run verify-package-paths # assert every packages/<path> cited in Markdown or a
# TypeScript comment resolves when it names a real (moved) package
pnpm run gen-rfc-index # regenerate the docs/rfc/README.md index tables from the
# RFC tree (marker-delimited; rows from path + H1 + filename date)
pnpm run verify-rfc-classification # assert every RFC lives in a valid
# {lifecycle}/{class}/ folder and docs/rfc/README.md lists it
# under the matching heading (closed class set + index completeness)
# {lifecycle}/{class}/ folder and the generated README index
# regions are fresh (closed class set + index freshness)
pnpm run verify-translation-pairing # assert the bilingual pairing contract
# (docs/i18n/README.md): required docs have a complete pair
# (foo.md + foo.zh.md + foo.i18n.yaml); every pair matches its