feat(skill): 本地 git 门禁 + 项目级安装 + 覆盖率与第三方扫描
skill-gate / gate (pull_request) Waiting to run

- hooks/git/{pre-commit,pre-push} + scripts/install-git-hooks.sh(Gitea Actions 无 runner,本地兜底)
- install-skills.sh: --scope project --project-dir(装到项目 .agents/skills)
- scripts/scan-installed.sh: 扫第三方已装技能(33 个,0 高危)
- generate-catalog: has_evals/has_docs + coverage;validate --coverage + 路由一致性检查
- SCOPE 覆盖率路线图(3-4 周补齐 40 个技能的 evals 与四段式文档)
- MAINTENANCE/README/CHANGELOG 同步
This commit is contained in:
johnQ
2026-11-01 05:04:14 +08:00
parent 748ea68aa0
commit 04e20babc1
12 changed files with 496 additions and 65 deletions
+18 -1
View File
@@ -55,9 +55,12 @@ def build() -> dict:
fm = frontmatter(skill_md.read_text(encoding="utf-8", errors="replace"))
desc = fm.get("description", "")
body = skill_md.read_text(encoding="utf-8", errors="replace")
install_name = meta.get("install_name") or fm.get("name")
has_evals = any((plugin_dir / "skills").rglob("evals/evals.json"))
has_docs = (ROOT / "docs" / "skills" / f"{install_name}.md").is_file()
skills.append(
{
"name": meta.get("install_name") or fm.get("name"),
"name": install_name,
"category": meta.get("dir_category"),
"version": meta.get("version"),
"status": meta.get("status", "promoted"),
@@ -66,14 +69,28 @@ def build() -> dict:
"description_len": len(desc),
"path": str(skill_md.relative_to(ROOT)),
"digest": hashlib.sha256(body.encode("utf-8")).hexdigest()[:16],
"has_evals": has_evals,
"has_docs": has_docs,
}
)
counts: dict = {}
for skill in skills:
key = f"{skill['status']}/{skill['invocation']}"
counts[key] = counts.get(key, 0) + 1
required = [
x for x in skills
if x["status"] == "promoted" and x["invocation"] == "model-invoked"
]
coverage = {
"required": len(required),
"with_evals": sum(1 for x in required if x["has_evals"]),
"with_docs": sum(1 for x in required if x["has_docs"]),
"missing_evals": [x["name"] for x in required if not x["has_evals"]],
"missing_docs": [x["name"] for x in required if not x["has_docs"]],
}
return {
"repo": "ai-proj-helper",
"coverage": coverage,
"generated_at": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
"total": len(skills),
"counts": counts,