-
-
Notifications
You must be signed in to change notification settings - Fork 0
302 lines (253 loc) · 9.57 KB
/
Copy pathvalidate.yml
File metadata and controls
302 lines (253 loc) · 9.57 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
name: Validate Skills
on:
push:
branches: [main, develop]
pull_request:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: npm
- run: npm ci
- name: Markdown lint
run: npx markdownlint-cli2
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- run: pip install skills-ref
- name: Validate all skills (Agent Skills spec)
run: |
set -e
for skill_md in $(find . -name SKILL.md -not -path './.changeset/*' -not -path '*/node_modules/*'); do
skill_dir=$(dirname "$skill_md")
echo "Validating $skill_dir..."
agentskills validate "$skill_dir"
done
echo "All skills valid ✅"
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: npm
- run: npm ci
- name: Build skills.zip
run: npm run build
- name: Verify skills.zip contents
run: |
set -e
echo "📦 Checking dist/skills.zip..."
FILES=$(unzip -l dist/skills.zip | tail -n +4 | head -n -2 | awk '{print $4}')
# Every SKILL.md must be in the zip
for skill_md in $(find . -name SKILL.md -not -path './.changeset/*' -not -path '*/node_modules/*'); do
relative="${skill_md#./}"
if echo "$FILES" | grep -qF "$relative"; then
echo " ✅ $relative"
else
echo " ❌ MISSING: $relative"
exit 1
fi
done
# LICENSE + README must be present
for f in LICENSE LICENSE-CC0 README.md; do
if echo "$FILES" | grep -qF "$f"; then
echo " ✅ $f"
else
echo " ❌ MISSING: $f"
exit 1
fi
done
# No node_modules in the zip
if echo "$FILES" | grep -q "node_modules"; then
echo " ❌ node_modules found in skills.zip!"
exit 1
fi
echo "skills.zip verified ✅"
- name: Upload skills.zip
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: skills-zip
path: dist/skills.zip
skills-discovery:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
- name: Verify .well-known/skills/index.json is up to date
run: |
set -e
node generate-skills-index.mjs
if ! git diff --exit-code .well-known/skills/index.json; then
echo "❌ .well-known/skills/index.json is out of date!"
echo "Run: node generate-skills-index.mjs"
exit 1
fi
echo ".well-known/skills/index.json is up to date ✅"
- name: Verify README lists all skills
run: |
set -e
MISSING=0
for skill_md in $(find . -name SKILL.md -not -path './.changeset/*' -not -path '*/node_modules/*'); do
name=$(sed -n '/^---$/,/^---$/p' "$skill_md" | grep '^name:' | head -1 | sed 's/^name:\s*//')
if [ -n "$name" ] && ! grep -q "$name" README.md; then
echo "❌ Skill '$name' (from $skill_md) not found in README.md"
MISSING=1
else
echo " ✅ $name"
fi
done
if [ "$MISSING" -eq 1 ]; then
echo "README.md is missing skills — update the Available Skills table"
exit 1
fi
echo "README lists all skills ✅"
package-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: npm
- name: npm pack (simulate publish)
run: |
TARBALL=$(npm pack 2>/dev/null | tail -1)
echo "TARBALL=$TARBALL" >> "$GITHUB_ENV"
echo "Packed: $TARBALL"
- name: Verify tarball contents
run: |
set -e
FILES=$(tar tzf "$TARBALL")
# Every SKILL.md must be in the tarball
for skill_md in $(find . -name SKILL.md -not -path './.changeset/*' -not -path '*/node_modules/*'); do
relative="${skill_md#./}"
expected="package/$relative"
if echo "$FILES" | grep -qF "$expected"; then
echo " ✅ $relative"
else
echo " ❌ MISSING: $relative"
exit 1
fi
done
# No node_modules in tarball
if echo "$FILES" | grep -q "node_modules"; then
echo " ❌ node_modules found in tarball!"
exit 1
fi
# LICENSE files must be present
for f in LICENSE LICENSE-CC0 README.md; do
if echo "$FILES" | grep -qF "package/$f"; then
echo " ✅ $f"
else
echo " ❌ MISSING: $f"
exit 1
fi
done
echo "Tarball contents verified ✅"
- name: pi install (from tarball)
run: |
set -e
npm install -g @mariozechner/pi-coding-agent
export HOME=$(mktemp -d)
mkdir -p "$HOME/.pi/agent"
echo '{}' > "$HOME/.pi/agent/settings.json"
EXTRACT_DIR=$(mktemp -d)
tar xzf "$TARBALL" -C "$EXTRACT_DIR"
pi install "$EXTRACT_DIR/package"
OUTPUT=$(pi list 2>&1)
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q "package"; then
echo "pi install verified ✅"
else
echo "❌ Package not found in pi list"
exit 1
fi
- name: skills add — default discovery (no flags)
run: |
set -e
WORK_DIR=$(mktemp -d)
tar xzf "$TARBALL" -C "$WORK_DIR"
REPO_DIR="$WORK_DIR/package"
# Test what 'skills add' finds with zero flags — baseline behavior
echo "=== Default discovery (no --full-depth) ==="
export HOME=$(mktemp -d)
DEFAULT_OUTPUT=$(npx -y skills add "$REPO_DIR" --list 2>&1) || true
echo "$DEFAULT_OUTPUT"
# Count skills found in default mode
DEFAULT_COUNT=$(echo "$DEFAULT_OUTPUT" | grep -oP 'Found \K[0-9]+' || echo "0")
echo "Default discovery found: $DEFAULT_COUNT skill(s)"
echo ""
echo "=== Full-depth discovery (--full-depth) ==="
FULL_OUTPUT=$(npx -y skills add "$REPO_DIR" --list --full-depth 2>&1) || true
echo "$FULL_OUTPUT"
FULL_COUNT=$(echo "$FULL_OUTPUT" | grep -oP 'Found \K[0-9]+' || echo "0")
echo "Full-depth discovery found: $FULL_COUNT skill(s)"
# Full-depth must find all skills
EXPECTED=$(find "$REPO_DIR" -name SKILL.md | wc -l)
if [ "$FULL_COUNT" -lt "$EXPECTED" ]; then
echo "⚠️ Full-depth found $FULL_COUNT but repo has $EXPECTED SKILL.md files"
fi
echo "Discovery baseline captured ✅"
- name: skills add — install all skills
run: |
set -e
WORK_DIR=$(mktemp -d)
tar xzf "$TARBALL" -C "$WORK_DIR"
REPO_DIR="$WORK_DIR/package"
export HOME=$(mktemp -d)
OUTPUT=$(npx -y skills add "$REPO_DIR" --full-depth --all 2>&1) || true
echo "$OUTPUT"
# Verify every skill was installed
SKILL_NAMES=$(find "$REPO_DIR" -name SKILL.md | while read f; do
sed -n '/^---$/,/^---$/p' "$f" | grep '^name:' | head -1 | sed 's/^name:\s*//'
done)
FAILED=0
for name in $SKILL_NAMES; do
if echo "$OUTPUT" | grep -qi "$name"; then
echo " ✅ $name installed"
else
echo " ❌ $name NOT found in output"
FAILED=1
fi
done
if [ "$FAILED" -eq 1 ]; then
echo "❌ Some skills failed to install"
exit 1
fi
echo "All skills installed via 'skills add' ✅"
- name: skills add — install each skill individually
run: |
set -e
WORK_DIR=$(mktemp -d)
tar xzf "$TARBALL" -C "$WORK_DIR"
REPO_DIR="$WORK_DIR/package"
SKILL_NAMES=$(find "$REPO_DIR" -name SKILL.md | while read f; do
sed -n '/^---$/,/^---$/p' "$f" | grep '^name:' | head -1 | sed 's/^name:\s*//'
done)
FAILED=0
for name in $SKILL_NAMES; do
export HOME=$(mktemp -d)
OUTPUT=$(npx -y skills add "$REPO_DIR" --skill "$name" --full-depth --all 2>&1) || true
if echo "$OUTPUT" | grep -qi "$name"; then
echo " ✅ skills add --skill $name"
else
echo " ❌ skills add --skill $name FAILED"
echo "$OUTPUT" | tail -5
FAILED=1
fi
done
if [ "$FAILED" -eq 1 ]; then
echo "❌ Some individual skill installs failed"
exit 1
fi
echo "All individual skill installs verified ✅"