Filter the command matrix by the web module registry

The matrix is scraped from upstream source, so it still carries modules
the port has removed. Counting its rows re-introduced OpenSCAD into the
manual data after the workbench was taken out. Parse the module list from
module-registry.generated.ts once and drop every record whose module is
not in it, which keeps 31 modules and reproduces the 1575 command rows
the manual now reports.

Regenerate the gaps document so it lists the 11 boundaries with the new
OpenSCAD-free set, and refresh the ch03 fixture captured alongside the
re-shot chapter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 20:44:59 +08:00
parent 82d78af58e
commit 3c2c623f70
3 changed files with 23 additions and 5 deletions

View File

@@ -25,6 +25,16 @@ const ledgerPath = path.join(webRoot, "docs/current/freecad-official-case-ledger
const matrix = readJson(matrixPath);
const routes = readJson(routesPath);
const features = readJson(featuresPath);
// The module registry is the single owner of "which modules exist on the web".
// The desktop command matrix is scraped from upstream source and keeps modules
// that have been removed from the port (OpenSCAD), so counting rows there would
// re-introduce a module the manual must not teach. Filter once, here.
const registrySource = fs.readFileSync(registryPath, "utf8");
const webModules = new Set([...registrySource.matchAll(/\{ module: "([^"]+)"/g)].map(match => match[1]));
if (!webModules.size) throw new Error(`no modules parsed from ${registryPath}`);
const droppedRecords = (matrix.records ?? []).filter(record => !webModules.has(record.module));
matrix.records = (matrix.records ?? []).filter(record => webModules.has(record.module));
const cases = readJson(casesPath);
const ledger = readJson(ledgerPath);
@@ -42,7 +52,7 @@ const chapters = [
{ id: "ch10", order: 10, level: "specialist", title: "CAM 加工", moduleIds: ["CAM"] },
{ id: "ch11", order: 11, level: "specialist", title: "TechDraw 工程图", moduleIds: ["TechDraw"] },
{ id: "ch12", order: 12, level: "specialist", title: "FEM 有限元", moduleIds: ["Fem"] },
{ id: "ch13", order: 13, level: "specialist", title: "Draft、Plot、OpenSCAD 等", moduleIds: ["Draft", "Plot", "OpenSCAD", "Robot", "Cloud", "JtReader", "Sandbox", "Test", "Tux", "TemplatePyMod", "Show"] },
{ id: "ch13", order: 13, level: "specialist", title: "Draft、Plot、Robot 等专项工具", moduleIds: ["Draft", "Plot", "Robot", "Cloud", "JtReader", "Sandbox", "Test", "Tux", "TemplatePyMod", "Show"] },
{ id: "ch14", order: 14, level: "case", title: "综合案例:27 件 GLB 产线", moduleIds: [] },
{ id: "ch15", order: 15, level: "appendix", title: "附录:命令索引与缺口", moduleIds: [] },
];
@@ -155,6 +165,8 @@ const stats = {
overview: commands.filter(item => item.status === "overview").length,
boundary: commands.filter(item => item.status === "boundary").length,
verifiedCandidates: commands.filter(item => item.ledgerCaseId).length,
droppedDesktopRecords: droppedRecords.length,
droppedModules: [...new Set(droppedRecords.map(record => record.module))],
screenshots: 0,
workflows: 0,
};