iter(g05): verify 增加 llms-full 同步校验
This commit is contained in:
@@ -623,6 +623,18 @@ function checkCountDocs(actual) {
|
||||
return issues;
|
||||
}
|
||||
|
||||
/*** llms-full.txt 同步校验:内联重渲染 Agent 文档(时间戳归一化)与落盘产物比对,防 manifest 改后忘跑 docs ***/
|
||||
function checkLlmsFull(pkgs, issues) {
|
||||
if (!fs.existsSync(LLMS_FULL)) return; // 卫语句:产物缺失不算漂移(可能是新仓库)
|
||||
const tokensPath = path.join(ROOT, 'packages', 'design', 'tokens', 'tokens.json');
|
||||
const tokens = fs.existsSync(tokensPath) ? JSON.parse(fs.readFileSync(tokensPath, 'utf8')) : null;
|
||||
const norm = (s) => s.replace(/\r\n/g, '\n').replace(/自动生成于 [^,]*/, '自动生成于 X');
|
||||
const expected = renderAgentDocs({ generatedAt: '', packages: pkgs }, tokens);
|
||||
if (norm(fs.readFileSync(LLMS_FULL, 'utf8')) !== norm(expected)) {
|
||||
issues.push('llms-full.txt 与清单不一致,请运行 npm run docs 重新生成');
|
||||
}
|
||||
}
|
||||
|
||||
/*** 清单一致性校验:组件文档块的 id / props 说明 / demo 锚点必须与代码和演示产物对齐 ***/
|
||||
function cmdVerify() {
|
||||
const issues = [];
|
||||
@@ -663,6 +675,7 @@ function cmdVerify() {
|
||||
.flatMap((p) => p.docs?.components ?? []).length;
|
||||
issues.push(...checkCountDocs(skinTotal));
|
||||
issues.push(...checkReadme(pkgs));
|
||||
checkLlmsFull(pkgs, issues);
|
||||
|
||||
if (issues.length) {
|
||||
for (const it of issues) console.error('verify: ' + it);
|
||||
|
||||
Reference in New Issue
Block a user