forked from NomaDamas/k-skill
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-skills.sh
More file actions
executable file
·64 lines (55 loc) · 1.46 KB
/
Copy pathvalidate-skills.sh
File metadata and controls
executable file
·64 lines (55 loc) · 1.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
#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
status=0
while IFS= read -r -d '' skill_dir; do
skill_name="$(basename "$skill_dir")"
skill_file="$skill_dir/SKILL.md"
if [[ ! -f "$skill_file" ]]; then
echo "missing SKILL.md: $skill_name"
status=1
continue
fi
if ! head -n 1 "$skill_file" | grep -qx -- "---"; then
echo "missing frontmatter start: $skill_file"
status=1
fi
if ! grep -q '^name: ' "$skill_file"; then
echo "missing name field: $skill_file"
status=1
fi
if ! grep -q '^description: ' "$skill_file"; then
echo "missing description field: $skill_file"
status=1
fi
declared_name="$(sed -n 's/^name: //p' "$skill_file" | head -n 1 | tr -d '"')"
if [[ "$declared_name" != "$skill_name" ]]; then
echo "name mismatch: $skill_file declares '$declared_name' but directory is '$skill_name'"
status=1
fi
done < <(
find "$root" -mindepth 1 -maxdepth 1 -type d \
! -name .git \
! -name .github \
! -name .codex \
! -name .claude \
! -name .omx \
! -name .ouroboros \
! -name .changeset \
! -name .cursor \
! -name .vscode \
! -name .sisyphus \
! -name .idea \
! -name dist \
! -name docs \
! -name node_modules \
! -name packages \
! -name python-packages \
! -name scripts \
! -name examples \
-print0
)
if [[ "$status" -ne 0 ]]; then
exit "$status"
fi
echo "skill layout looks valid"