Repository navigation
161 lines (131 loc) · 4.02 KB
/
Copy pathci.yml
File metadata and controls
161 lines (131 loc) · 4.02 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
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
name: Test Installation
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [14.x, 16.x, 18.x, 20.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci || npm install
- name: Run installation test
run: npm test
- name: Verify SKILL.md format
run: |
if [ ! -f SKILL.md ]; then
echo "Error: SKILL.md not found"
exit 1
fi
# Check for required frontmatter
if ! grep -q "^---$" SKILL.md; then
echo "Error: SKILL.md missing frontmatter"
exit 1
fi
shell: bash
- name: Verify required files
run: |
required_files=(
"package.json"
"SKILL.md"
".claude-skill.json"
"install-skill.js"
"uninstall-skill.js"
)
for file in "${required_files[@]}"; do
if [ ! -f "$file" ]; then
echo "Error: Required file $file not found"
exit 1
fi
done
shell: bash
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Check markdown files
uses: DavidAnson/markdownlint-cli2-action@v11
with:
globs: '**/*.md'
continue-on-error: true
- name: Check JSON files
run: |
echo "Checking JSON files..."
for file in $(find . -name "*.json" -not -path "*/node_modules/*"); do
echo "Validating $file"
cat "$file" | jq empty || exit 1
done
shell: bash
validate-skill:
name: Validate Skill Structure
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Validate SKILL.md structure
run: |
echo "Validating SKILL.md structure..."
# Check for frontmatter
if ! head -n 1 SKILL.md | grep -q "^---$"; then
echo "Error: SKILL.md must start with frontmatter delimiter (---)"
exit 1
fi
# Extract frontmatter
frontmatter=$(sed -n '/^---$/,/^---$/p' SKILL.md | head -n -1 | tail -n +2)
# Check for required fields
if ! echo "$frontmatter" | grep -q "^name:"; then
echo "Error: SKILL.md frontmatter missing 'name' field"
exit 1
fi
if ! echo "$frontmatter" | grep -q "^description:"; then
echo "Error: SKILL.md frontmatter missing 'description' field"
exit 1
fi
# Extract name
skill_name=$(echo "$frontmatter" | grep "^name:" | cut -d' ' -f2- | tr -d ' ')
# Validate name format (lowercase, hyphens, max 64 chars)
if ! echo "$skill_name" | grep -Eq "^[a-z0-9-]{1,64}$"; then
echo "Error: Skill name must be lowercase letters, numbers, and hyphens only (max 64 chars)"
exit 1
fi
echo "✅ SKILL.md structure is valid"
shell: bash
- name: Validate .claude-skill.json
run: |
echo "Validating .claude-skill.json..."
# Check if file exists
if [ ! -f .claude-skill.json ]; then
echo "Error: .claude-skill.json not found"
exit 1
fi
# Validate JSON format
cat .claude-skill.json | jq empty || exit 1
# Check required fields
if ! jq -e '.name' .claude-skill.json > /dev/null; then
echo "Error: .claude-skill.json missing 'name' field"
exit 1
fi
echo "✅ .claude-skill.json is valid"
shell: bash