-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·103 lines (89 loc) · 2.43 KB
/
Copy pathrun-tests.sh
File metadata and controls
executable file
·103 lines (89 loc) · 2.43 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
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
SKILLS_DIR="$REPO_ROOT/skills"
PASS=0
FAIL=0
echo "=== Skill Loading Tests ==="
for skill_dir in "$SKILLS_DIR"/issue-*/; do
skill_name=$(basename "$skill_dir")
skill_file="$skill_dir/SKILL.md"
if [ ! -f "$skill_file" ]; then
echo " FAIL: $skill_name/SKILL.md not found"
FAIL=$((FAIL + 1))
continue
fi
# Check YAML frontmatter exists (starts with ---)
echo -n " $skill_name: frontmatter ... "
if head -1 "$skill_file" | grep -q '^---$'; then
echo -n "ok, "
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
continue
fi
# Check name field
echo -n "name ... "
if grep -q '^name:' "$skill_file"; then
echo -n "ok, "
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
continue
fi
# Check description field
echo -n "description ... "
if grep -q '^description:' "$skill_file"; then
echo -n "ok, "
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
continue
fi
# Check frontmatter ends (second ---)
echo -n "format ... "
if awk 'NR==1{next} /^---$/{found=1; exit} END{exit !found}' "$skill_file"; then
PASS=$((PASS + 1))
echo "ok"
else
echo "FAIL"
FAIL=$((FAIL + 1))
fi
done
echo ""
echo "=== Content Constraint Tests ==="
echo -n " issue-create: default label + assignee + Chinese ... "
if grep -q -- '--label' "$SKILLS_DIR/issue-create/SKILL.md" \
&& grep -q -- '--assignee "@me"' "$SKILLS_DIR/issue-create/SKILL.md" \
&& grep -q 'Issue 标题和正文全部使用中文' "$SKILLS_DIR/issue-create/SKILL.md"; then
echo "ok"
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
fi
echo -n " issue-pr: default label + assignee + Chinese ... "
if grep -F -q -- '--label "..."' "$SKILLS_DIR/issue-pr/SKILL.md" \
&& grep -q -- '--assignee "@me"' "$SKILLS_DIR/issue-pr/SKILL.md" \
&& grep -q 'PR 标题和正文全部使用中文' "$SKILLS_DIR/issue-pr/SKILL.md"; then
echo "ok"
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
fi
echo -n " issue-commit: commit message stays English ... "
if grep -q 'commit message 使用英文' "$SKILLS_DIR/issue-commit/SKILL.md" \
&& grep -q '不要改成中文' "$SKILLS_DIR/issue-commit/SKILL.md"; then
echo "ok"
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
fi
echo ""
echo "=== Results: $PASS passed, $FAIL failed ==="
[ "$FAIL" -eq 0 ] && exit 0 || exit 1