iter(g12): verify 增加 backlog 与留痕交叉校验
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
- `apps/demo`(@ui-arch/demo):交互演示,产物 apps/demo/dist/demo.html
|
- `apps/demo`(@ui-arch/demo):交互演示,产物 apps/demo/dist/demo.html
|
||||||
- `apps/docs`:文档站,纯产物(ua docs 生成)
|
- `apps/docs`:文档站,纯产物(ua docs 生成)
|
||||||
|
|
||||||
**门禁一条龙**:`npm run check` = build + style + typecheck + smoke + index + verify,提交前必过。`ua verify` 校验清单 ↔ 文档 ↔ 演示一致(docs.components 的 id 必须在 api.exports 有对应条目、props 必须带 n/t/d、demo 锚点必须在 `apps/demo/main.ts` 中存在),检查皮肤包样式表无硬编码颜色(`#hex` 一律禁止,必须走 `--ua-*` 令牌),并核对 README 的 `<!-- ua:components -->` 区块与清单组件集合完全一致。
|
**门禁一条龙**:`npm run check` = build + style + typecheck + smoke + index + verify,提交前必过。`ua verify` 校验清单 ↔ 文档 ↔ 演示一致(docs.components 的 id 必须在 api.exports 有对应条目、props 必须带 n/t/d、demo 锚点必须在 `apps/demo/main.ts` 中存在),检查皮肤包样式表无硬编码颜色(`#hex` 一律禁止,必须走 `--ua-*` 令牌),核对 README 的 `<!-- ua:components -->` 区块与清单组件集合完全一致,并交叉校验 backlog 的 done 条目与 `.ua/iterations.log` 的 done 留痕一一对应。
|
||||||
|
|
||||||
**提交信息规范**:`COMMITTING.md`(`<type>(<scope>): <中文祈使句>`),`ua commit-lint` + commit-msg 钩子自动校验,迭代提交用 `iter(<条目id>): <subject>`。
|
**提交信息规范**:`COMMITTING.md`(`<type>(<scope>): <中文祈使句>`),`ua commit-lint` + commit-msg 钩子自动校验,迭代提交用 `iter(<条目id>): <subject>`。
|
||||||
|
|
||||||
|
|||||||
@@ -635,6 +635,28 @@ function checkLlmsFull(pkgs, issues) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*** 交叉校验留痕与条目:done 条目必须有一条 done 留痕,留痕 id 必须存在于 backlog(防「标完成无记录 / 记录指向幽灵条目」) ***/
|
||||||
|
function checkIterations() {
|
||||||
|
const issues = [];
|
||||||
|
const backlogPath = path.join(ROOT, '.ua', 'backlog.json');
|
||||||
|
const logPath = path.join(ROOT, '.ua', 'iterations.log');
|
||||||
|
if (!fs.existsSync(backlogPath) || !fs.existsSync(logPath)) return issues; // 卫语句:产物缺失不校验
|
||||||
|
const items = JSON.parse(fs.readFileSync(backlogPath, 'utf8')).items ?? [];
|
||||||
|
const ids = new Set(items.map((i) => i.id));
|
||||||
|
const done = new Set(); // 有 done 留痕的条目 id
|
||||||
|
for (const line of fs.readFileSync(logPath, 'utf8').split(/\r?\n/)) {
|
||||||
|
if (!line.trim()) continue; // 空行跳过
|
||||||
|
let row;
|
||||||
|
try { row = JSON.parse(line); } catch { continue; } // 行格式归 lint-iterations 管,这里不重复报
|
||||||
|
if (!ids.has(row.id)) issues.push(`iterations.log: 留痕 id ${row.id} 在 backlog 中不存在`);
|
||||||
|
if (row.result === 'done') done.add(row.id);
|
||||||
|
}
|
||||||
|
for (const item of items) {
|
||||||
|
if (item.status === 'done' && !done.has(item.id)) issues.push(`backlog: ${item.id} 已置 done 但 iterations.log 无 done 留痕`);
|
||||||
|
}
|
||||||
|
return issues;
|
||||||
|
}
|
||||||
|
|
||||||
/*** 清单一致性校验:组件文档块的 id / props 说明 / demo 锚点必须与代码和演示产物对齐 ***/
|
/*** 清单一致性校验:组件文档块的 id / props 说明 / demo 锚点必须与代码和演示产物对齐 ***/
|
||||||
function cmdVerify() {
|
function cmdVerify() {
|
||||||
const issues = [];
|
const issues = [];
|
||||||
@@ -676,13 +698,14 @@ function cmdVerify() {
|
|||||||
issues.push(...checkCountDocs(skinTotal));
|
issues.push(...checkCountDocs(skinTotal));
|
||||||
issues.push(...checkReadme(pkgs));
|
issues.push(...checkReadme(pkgs));
|
||||||
checkLlmsFull(pkgs, issues);
|
checkLlmsFull(pkgs, issues);
|
||||||
|
issues.push(...checkIterations());
|
||||||
|
|
||||||
if (issues.length) {
|
if (issues.length) {
|
||||||
for (const it of issues) console.error('verify: ' + it);
|
for (const it of issues) console.error('verify: ' + it);
|
||||||
console.error(`${issues.length} violation(s)`);
|
console.error(`${issues.length} violation(s)`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
console.log('verify OK (manifest ↔ docs ↔ demo 一致,皮肤无硬编码颜色,README 组件清单同步)');
|
console.log('verify OK (manifest ↔ docs ↔ demo 一致,皮肤无硬编码颜色,README 组件清单同步,backlog ↔ 留痕一致)');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** 校验 git 提交信息是否符合 COMMITTING.md 规范(参数为 message 文件路径或直接 message 文本),违规退出码 1 ***/
|
/*** 校验 git 提交信息是否符合 COMMITTING.md 规范(参数为 message 文件路径或直接 message 文本),违规退出码 1 ***/
|
||||||
|
|||||||
Reference in New Issue
Block a user