-
Notifications
You must be signed in to change notification settings - Fork 24
109 lines (96 loc) · 3.36 KB
/
Copy pathvalidate.yml
File metadata and controls
109 lines (96 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: validate
on:
push:
paths:
- "README.md"
- "install.sh"
- "install.ps1"
- "CLAUDE.md"
- ".github/workflows/validate.yml"
- "docs/**"
- "skills/**"
pull_request:
paths:
- "README.md"
- "install.sh"
- "install.ps1"
- "CLAUDE.md"
- ".github/workflows/validate.yml"
- "docs/**"
- "skills/**"
jobs:
structure:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Validate bash installer syntax
run: bash -n install.sh
- name: Validate PowerShell installer syntax
run: pwsh -NoProfile -Command "[void][scriptblock]::Create((Get-Content -Raw './install.ps1'))"
- name: Validate package structure and skill content
shell: python
run: |
import pathlib
import re
import sys
root = pathlib.Path(".")
required_files = [
root / "README.md",
root / "install.sh",
root / "install.ps1",
root / "CLAUDE.md",
root / "docs" / "migration-guide.md",
root / "docs" / "tool-mapping.md",
root / ".github" / "workflows" / "validate.yml",
]
missing = [str(path) for path in required_files if not path.exists()]
if missing:
print("Missing required files:")
for path in missing:
print(f"- {path}")
sys.exit(1)
skills_dir = root / "skills"
if not skills_dir.exists():
print("skills directory is missing")
sys.exit(1)
skill_files = sorted(skills_dir.glob("*/SKILL.md"))
if len(skill_files) < 1:
print("No skill files found in skills/")
sys.exit(1)
print(f"Found {len(skill_files)} skill files")
required_frontmatter_keys = [
"name:",
"description:",
"version:",
"author:",
"license:",
"metadata:",
]
for skill_file in skill_files:
text = skill_file.read_text(encoding="utf-8")
if not text.startswith("---\n"):
print(f"{skill_file}: missing opening YAML frontmatter delimiter")
sys.exit(1)
parts = text.split("---\n", 2)
if len(parts) < 3:
print(f"{skill_file}: malformed YAML frontmatter")
sys.exit(1)
frontmatter = parts[1]
body = parts[2]
for key in required_frontmatter_keys:
if key not in frontmatter:
print(f"{skill_file}: missing frontmatter key {key}")
sys.exit(1)
body_lines = [line for line in body.splitlines() if line.strip()]
if len(body_lines) < 100:
print(f"{skill_file}: body has only {len(body_lines)} non-empty lines, expected at least 100")
sys.exit(1)
if re.search(r"\t", body):
print(f"{skill_file}: contains tab characters; use spaces for readability")
sys.exit(1)
print("Validation passed.")