结论:新增 kinematics source-map 文档和同步检查,固定 manifest 分组计数与 source-coverage 边界,并接入 native/all-native guardrail;未扩展 smoke 功能。
65 lines
2.1 KiB
Bash
Executable File
65 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# LinuxCNC source basis: this guard keeps the kinematics source map aligned
|
|
# with linuxcnc-kinematics-source-files.txt, which enumerates LinuxCNC
|
|
# kinematics, posemath, switchkins INI/HAL/remap/tooldata/assets, and adjacent
|
|
# build metadata. It validates source coverage documentation only; it does not
|
|
# add or interpret CNC behavior.
|
|
python3 - <<'PY'
|
|
from pathlib import Path
|
|
import re
|
|
|
|
manifest = Path("linuxcnc-kinematics-source-files.txt").read_text(encoding="utf-8").splitlines()
|
|
source_map = Path("docs/linuxcnc-kinematics-source-map.md").read_text(encoding="utf-8")
|
|
|
|
expected_groups = [
|
|
"core",
|
|
"config",
|
|
"remap",
|
|
"component",
|
|
"generated",
|
|
"header",
|
|
"metadata",
|
|
"asset",
|
|
"tooldata",
|
|
]
|
|
counts = {group: 0 for group in expected_groups}
|
|
for line in manifest:
|
|
if not line or line.startswith("#"):
|
|
continue
|
|
group = line.split(":", 1)[0]
|
|
if group not in counts:
|
|
raise SystemExit(f"unexpected kinematics manifest group in source map guard: {group}")
|
|
counts[group] += 1
|
|
|
|
for group, count in counts.items():
|
|
pattern = rf"\| `{re.escape(group)}` \| {count} \|"
|
|
if not re.search(pattern, source_map):
|
|
raise SystemExit(
|
|
f"docs/linuxcnc-kinematics-source-map.md {group} count no longer matches linuxcnc-kinematics-source-files.txt"
|
|
)
|
|
|
|
for group in expected_groups:
|
|
if f"`{group}`" not in source_map:
|
|
raise SystemExit(
|
|
f"docs/linuxcnc-kinematics-source-map.md is missing kinematics manifest group {group}"
|
|
)
|
|
|
|
required_phrases = [
|
|
"not browser API surface",
|
|
"OPFS-only",
|
|
"derive M428/M429/M430 cases from",
|
|
"RTCP and five-axis coverage",
|
|
"./check-linuxcnc-inputs.sh linuxcnc-kinematics-source-files.txt --require-kinematics-complete",
|
|
"./check-linuxcnc-switchkins-remap-table.sh linuxcnc-kinematics-source-files.txt",
|
|
]
|
|
for phrase in required_phrases:
|
|
if phrase not in source_map:
|
|
raise SystemExit(
|
|
f"docs/linuxcnc-kinematics-source-map.md is missing source-coverage boundary phrase: {phrase}"
|
|
)
|
|
PY
|