📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -23,7 +23,6 @@ def safe_user_path(path_value, base_dir="."):
|
||||
return resolved_path
|
||||
|
||||
from _project_paths import find_repo_root
|
||||
from risk_classifier import suggest_risk
|
||||
from validate_skills import configure_utf8_output, has_when_to_use_section, parse_frontmatter
|
||||
|
||||
|
||||
@@ -46,7 +45,6 @@ SECURITY_DISCLAIMER_PATTERN = re.compile(r"AUTHORIZED USE ONLY", re.IGNORECASE)
|
||||
VALID_RISK_LEVELS = {"none", "safe", "critical", "offensive", "unknown"}
|
||||
DEFAULT_MARKDOWN_TOP_FINDINGS = 15
|
||||
DEFAULT_MARKDOWN_TOP_SKILLS = 20
|
||||
DEFAULT_MARKDOWN_TOP_RISK_SUGGESTIONS = 20
|
||||
STRICT_BUDGET_PATH = Path("tools/config/audit-skills-strict-budget.json")
|
||||
|
||||
|
||||
@@ -146,7 +144,6 @@ def build_skill_report(
|
||||
risk = metadata.get("risk")
|
||||
source = metadata.get("source")
|
||||
date_added = metadata.get("date_added")
|
||||
risk_suggestion = suggest_risk(content, metadata)
|
||||
|
||||
if name != skill_root.name:
|
||||
findings.append(
|
||||
@@ -199,17 +196,6 @@ def build_skill_report(
|
||||
)
|
||||
)
|
||||
|
||||
if risk_suggestion.risk not in ("unknown", "none"):
|
||||
risk_needs_review = risk is None or risk == "unknown" or risk != risk_suggestion.risk
|
||||
if risk_needs_review:
|
||||
findings.append(
|
||||
Finding(
|
||||
"info" if risk in (None, "unknown") else "warning",
|
||||
"risk_suggestion",
|
||||
f"Suggested risk is {risk_suggestion.risk} based on: {', '.join(risk_suggestion.reasons[:3])}.",
|
||||
)
|
||||
)
|
||||
|
||||
if source is None:
|
||||
findings.append(Finding("warning", "missing_source", "Missing source attribution."))
|
||||
|
||||
@@ -264,8 +250,6 @@ def build_skill_report(
|
||||
rel_file,
|
||||
findings,
|
||||
risk=risk,
|
||||
suggested_risk=risk_suggestion.risk,
|
||||
suggested_risk_reasons=list(risk_suggestion.reasons),
|
||||
)
|
||||
|
||||
|
||||
@@ -275,8 +259,6 @@ def finalize_skill_report(
|
||||
findings: list[Finding],
|
||||
*,
|
||||
risk: str | None = None,
|
||||
suggested_risk: str = "unknown",
|
||||
suggested_risk_reasons: list[str] | None = None,
|
||||
) -> dict[str, object]:
|
||||
severity_counts = Counter(finding.severity for finding in findings)
|
||||
if severity_counts["error"] > 0:
|
||||
@@ -294,8 +276,6 @@ def finalize_skill_report(
|
||||
"warning_count": severity_counts["warning"],
|
||||
"info_count": severity_counts["info"],
|
||||
"risk": risk,
|
||||
"suggested_risk": suggested_risk,
|
||||
"suggested_risk_reasons": suggested_risk_reasons or [],
|
||||
"findings": [finding.to_dict() for finding in findings],
|
||||
}
|
||||
|
||||
@@ -322,30 +302,19 @@ def audit_skills(skills_dir: str | Path) -> dict[str, object]:
|
||||
|
||||
code_counts = Counter()
|
||||
severity_counts = Counter()
|
||||
risk_suggestion_counts = Counter()
|
||||
for report in reports:
|
||||
for finding in report["findings"]:
|
||||
code_counts[finding["code"]] += 1
|
||||
severity_counts[finding["severity"]] += 1
|
||||
if report["suggested_risk"] not in (None, "unknown", "none"):
|
||||
risk_suggestion_counts[report["suggested_risk"]] += 1
|
||||
|
||||
summary = {
|
||||
"skills_scanned": len(reports),
|
||||
"skills_ok": sum(report["status"] == "ok" for report in reports),
|
||||
"skills_with_errors": sum(report["status"] == "error" for report in reports),
|
||||
"skills_with_warnings_only": sum(report["status"] == "warning" for report in reports),
|
||||
"skills_with_suggested_risk": sum(
|
||||
report["suggested_risk"] not in ("unknown", "none")
|
||||
for report in reports
|
||||
),
|
||||
"errors": severity_counts["error"],
|
||||
"warnings": severity_counts["warning"],
|
||||
"infos": severity_counts["info"],
|
||||
"risk_suggestions": [
|
||||
{"risk": risk, "count": count}
|
||||
for risk, count in risk_suggestion_counts.most_common()
|
||||
],
|
||||
"top_finding_codes": [
|
||||
{"code": code, "count": count}
|
||||
for code, count in code_counts.most_common()
|
||||
@@ -367,16 +336,6 @@ def write_markdown_report(report: dict[str, object], destination: str | Path) ->
|
||||
top_skills = [
|
||||
skill for skill in skills if skill["status"] != "ok"
|
||||
][:DEFAULT_MARKDOWN_TOP_SKILLS]
|
||||
risk_suggestions = [
|
||||
skill
|
||||
for skill in skills
|
||||
if skill.get("suggested_risk") not in (None, "unknown", "none")
|
||||
and (
|
||||
skill.get("risk") in (None, "unknown")
|
||||
or skill.get("risk") != skill.get("suggested_risk")
|
||||
)
|
||||
][:DEFAULT_MARKDOWN_TOP_RISK_SUGGESTIONS]
|
||||
|
||||
lines = [
|
||||
"# Skills Audit Report",
|
||||
"",
|
||||
@@ -388,18 +347,11 @@ def write_markdown_report(report: dict[str, object], destination: str | Path) ->
|
||||
f"- Skills ready: **{summary['skills_ok']}**",
|
||||
f"- Skills with errors: **{summary['skills_with_errors']}**",
|
||||
f"- Skills with warnings only: **{summary['skills_with_warnings_only']}**",
|
||||
f"- Skills with suggested risk: **{summary['skills_with_suggested_risk']}**",
|
||||
f"- Total errors: **{summary['errors']}**",
|
||||
f"- Total warnings: **{summary['warnings']}**",
|
||||
f"- Total info findings: **{summary['infos']}**",
|
||||
]
|
||||
|
||||
if summary.get("risk_suggestions"):
|
||||
summary_text = ", ".join(
|
||||
f"{item['risk']}: {item['count']}" for item in summary["risk_suggestions"]
|
||||
)
|
||||
lines.append(f"- Suggested risks: **{summary_text}**")
|
||||
|
||||
lines.extend(
|
||||
[
|
||||
"",
|
||||
@@ -433,24 +385,6 @@ def write_markdown_report(report: dict[str, object], destination: str | Path) ->
|
||||
else:
|
||||
lines.append("| _none_ | ok | 0 | 0 |")
|
||||
|
||||
lines.extend(
|
||||
[
|
||||
"",
|
||||
"## Risk Suggestions",
|
||||
"",
|
||||
"| Skill | Current | Suggested | Why |",
|
||||
"| --- | --- | --- | --- |",
|
||||
]
|
||||
)
|
||||
|
||||
if risk_suggestions:
|
||||
lines.extend(
|
||||
f"| `{skill['id']}` | {skill.get('risk') or 'unknown'} | {skill.get('suggested_risk') or 'unknown'} | {', '.join(skill.get('suggested_risk_reasons', [])[:3]) or '_n/a_'} |"
|
||||
for skill in risk_suggestions
|
||||
)
|
||||
else:
|
||||
lines.append("| _none_ | _none_ | _none_ | _n/a_ |")
|
||||
|
||||
destination_path = Path(destination).expanduser().resolve()
|
||||
safe_user_path(destination_path, destination_path.parent).write_text(
|
||||
"\n".join(lines) + "\n",
|
||||
@@ -465,17 +399,9 @@ def print_summary(report: dict[str, object]) -> None:
|
||||
print(f" Ready: {summary['skills_ok']}")
|
||||
print(f" Warning only: {summary['skills_with_warnings_only']}")
|
||||
print(f" With errors: {summary['skills_with_errors']}")
|
||||
print(f" With suggested risk: {summary['skills_with_suggested_risk']}")
|
||||
print(f" Total warnings: {summary['warnings']}")
|
||||
print(f" Total errors: {summary['errors']}")
|
||||
print(f" Total info findings: {summary['infos']}")
|
||||
if summary.get("risk_suggestions"):
|
||||
risk_summary = ", ".join(
|
||||
f"{item['risk']}: {item['count']}"
|
||||
for item in summary["risk_suggestions"]
|
||||
)
|
||||
print(f" Suggested risks: {risk_summary}")
|
||||
|
||||
top_findings = summary["top_finding_codes"][:10]
|
||||
if top_findings:
|
||||
print(" Top findings:")
|
||||
|
||||
Reference in New Issue
Block a user