-
Notifications
You must be signed in to change notification settings - Fork 7
163 lines (135 loc) · 5.46 KB
/
smoke-tests.yml
File metadata and controls
163 lines (135 loc) · 5.46 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Smoke Tests
on:
pull_request:
paths:
- 'skills/**/*.md'
- 'tests/**'
- '.github/workflows/smoke-tests.yml'
push:
branches:
- main
jobs:
validate-code-blocks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Validate Python code blocks
run: |
python3 tests/validate_code_blocks.py
validate-frontmatter:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Validate YAML frontmatter
run: |
python3 << 'EOF'
import re
import sys
from pathlib import Path
print("="*60)
print("VALIDATING YAML FRONTMATTER")
print("="*60)
errors = []
checked = 0
skipped = 0
# Meta files that don't need frontmatter (by name)
SKIP_FILES = {
"MIGRATION_GUIDE.md", "REFACTORING_SUMMARY.md", "_INDEX.md",
"README.md", "ENHANCEMENT_PLAN.md", "ENHANCEMENTS_SUMMARY.md",
"SKILLS_USAGE_GUIDE.md", "CLAUDE.md", "SUMMARY.txt",
"CLAUDE_MD_UPDATES.md", "PLUGIN.md", "MIGRATION.md",
"INDEX.md", "PROJECT_STATUS.md", "QUICK_START.md",
"SECURITY.md", "README_SAFETY_VALIDATOR.md",
"SAFETY_VALIDATOR_SUMMARY.md", "DSPY_INTEGRATION_STATUS.md",
"DSPY_INTEGRATION_SUMMARY.md", "DSPY_INTEGRATION_COMPLETION.md",
"WAVE12_PHASE2_FINAL_STATUS.md", "STATUS.md",
"safety-checklist.md", "security-fixes-summary.md"
}
for skill_file in Path(".").rglob("*.md"):
# Skip archived files
if "_archive" in str(skill_file):
skipped += 1
continue
# Skip .work directory (planning documents)
if ".work" in skill_file.parts:
skipped += 1
continue
# Skip .claude directory (internal configuration and audits)
if ".claude" in skill_file.parts:
skipped += 1
continue
# Skip root-level markdown files (planning docs, reports, etc.)
if len(skill_file.parts) == 1:
skipped += 1
continue
# Skip commands directory (slash commands don't need skill frontmatter)
if "commands" in skill_file.parts:
skipped += 1
continue
# Skip docs directory (documentation files don't need skill frontmatter)
if "docs" in skill_file.parts:
skipped += 1
continue
# Skip meta files by name
if skill_file.name in SKIP_FILES:
skipped += 1
continue
# Calculate depth (number of slashes after skills/)
# skills/file.md = depth 1 ✓
# skills/category/file.md = depth 2 ✓
# skills/skill/SKILL.md = depth 2 ✓
# skills/skill/references/file.md = depth 3 ✗ (supporting files)
parts = skill_file.parts
if "skills" in parts:
skills_idx = parts.index("skills")
depth = len(parts) - skills_idx - 1
# Skip files at depth 3+ (these are reference/foundation/implementation files)
if depth >= 3:
skipped += 1
continue
content = skill_file.read_text(encoding='utf-8')
checked += 1
# Check for frontmatter
if not content.strip().startswith('---\n'):
errors.append(f"{skill_file}: Missing YAML frontmatter")
continue
# Parse frontmatter
parts = content.split('---\n', 2)
if len(parts) < 3:
errors.append(f"{skill_file}: Invalid frontmatter format")
continue
frontmatter = parts[1]
# Check required fields
if not re.search(r'^name:\s*\S+', frontmatter, re.MULTILINE):
errors.append(f"{skill_file}: Missing 'name' field")
if not re.search(r'^description:\s*.+', frontmatter, re.MULTILINE):
errors.append(f"{skill_file}: Missing 'description' field")
# Validate name format (hyphen-case)
name_match = re.search(r'^name:\s*(\S+)', frontmatter, re.MULTILINE)
if name_match:
name = name_match.group(1)
if not re.match(r'^[a-z0-9-]+$', name):
errors.append(f"{skill_file}: Invalid name format '{name}' (must be hyphen-case)")
print(f"Checked: {checked} skill files")
print(f"Skipped: {skipped} supporting/meta files\n")
if errors:
print("❌ FAILED: Found frontmatter errors:\n")
for error in errors:
print(f" • {error}")
print(f"\n{len(errors)} error(s) found")
print("="*60)
sys.exit(1)
else:
print("✅ SUCCESS: All skill files have valid frontmatter")
print("="*60)
EOF