feat(kubernetes): S0 三章上线(第 0-2 章),并补人检清单

- 新增 00-why / 01-env / 02-kubectl 三章页面,13 模块骨架,0 处机检不合格
- 第 1 章 7 个 Step 从裸机到 3 节点 kind 集群,3 处双环境分栏
- 第 2 章三遍读集群:discovery / 建命名空间 / diff 与 dry-run
- tools/check-pages.js:命令块下限可按章配置、命名空间白名单修正
- 新增 tools/REVIEW.md:机检覆盖不到的人检清单与 S0 复审结论
This commit is contained in:
2026-11-08 14:51:28 +08:00
parent 9959f566a8
commit 0e37ff54ba
11 changed files with 2328 additions and 36 deletions

View File

@@ -90,7 +90,8 @@ for (const file of targets) {
bad(file, "代码块里有未转义的尖括号(应写 < / >)");
}
const bashBlocks = count(html, /data-lang="(bash|powershell)"/g);
if (bashBlocks < 8) bad(file, `命令块 ${bashBlocks} 段,06 要求 ≥8`);
const minBash = (meta && meta.minBash) || 8;
if (bashBlocks < minBash) bad(file, `命令块 ${bashBlocks} 段,本章要求 ≥${minBash}`);
/* --- 6. 站内链接 --- */
for (const [, href] of html.matchAll(/href="([^"]+)"/g)) {
@@ -114,7 +115,12 @@ for (const file of targets) {
}
/* --- 7. 篇幅(口径同 06 §1:不含代码块与表格单元格) --- */
const text = strip(html.replace(/<div class="tablewrap">[\s\S]*?<\/div>/g, " "));
const text = strip(html
.replace(/<div class="tablewrap">[\s\S]*?<\/div>/g, " ")
.replace(/<aside[\s\S]*?<\/aside>/g, " ")
.replace(/<nav class="chapnav"[\s\S]*?<\/nav>/g, " ")
.replace(/<nav class="pager"[\s\S]*?<\/nav>/g, " ")
.replace(/<p class="foot"[\s\S]*?<\/p>/g, " "));
const chars = cjk(text);
if (chars < 1800) bad(file, `正文 ${chars} 汉字,06 要求 ≥1800`);
if (chars > 3200) soft(file, `正文 ${chars} 汉字,超过 06 的上限 3200,考虑拆小节或删冗余`);
@@ -138,8 +144,10 @@ for (const file of targets) {
if (tables < 5) bad(file, `表格 ${tables} 张,要求 ≥5`);
/* --- 9. 常量表 --- */
const nsBad = [...html.matchAll(/--namespace[= ](\S+)/g)].map(m => m[1].replace(/["']/g, ""))
.filter(n => !["shop", "platform", "kube-system"].includes(n));
/* 只查「自己造的资源落在哪个 ns」:系统 ns 与 default 允许出现(教学里要对照) */
const nsOk = ["shop", "platform", "kube-system", "kube-public", "kube-node-lease", "default"];
const nsBad = [...html.matchAll(/--namespace[= ]+([a-z0-9][a-z0-9-]*)/g)].map(m => m[1])
.filter(n => !nsOk.includes(n));
if (nsBad.length) bad(file, `命名空间越界:${[...new Set(nsBad)].join(", ")}`);
if (!fail) console.log(` ✔ ${pres.length} 段代码 · ${chars} 汉字 · ${figs} 图 · ${tables} 表 · ${takes} 句话 · ${details} 折叠 · ${warns} 易错点`);