-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (78 loc) · 2.87 KB
/
Copy pathvalidate-plugin.yml
File metadata and controls
89 lines (78 loc) · 2.87 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
name: Validate Plugin Structure
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate JSON syntax
run: |
echo "Validating JSON files..."
errors=0
for f in $(find . -name "*.json" -not -path "./node_modules/*"); do
if ! jq empty "$f" 2>/dev/null; then
echo "Invalid JSON: $f"
errors=$((errors + 1))
fi
done
if [ "$errors" -gt 0 ]; then
echo "$errors JSON file(s) have syntax errors"
exit 1
fi
echo "All JSON files valid"
- name: Validate plugin structure
run: |
echo "Checking required files..."
errors=0
for plugin_dir in plugins/*/; do
name=$(basename "$plugin_dir")
echo "Validating plugin: $name"
# Check required manifest
if [ ! -f "$plugin_dir/.claude-plugin/plugin.json" ]; then
echo " Missing: .claude-plugin/plugin.json"
errors=$((errors + 1))
else
# Validate name field exists
plugin_name=$(jq -r '.name // empty' "$plugin_dir/.claude-plugin/plugin.json")
if [ -z "$plugin_name" ]; then
echo " Missing 'name' field in plugin.json"
errors=$((errors + 1))
fi
fi
# Check recommended files
[ ! -f "$plugin_dir/README.md" ] && echo " Warning: Missing README.md"
done
# Check marketplace manifest
if [ ! -f ".claude-plugin/marketplace.json" ]; then
echo "Missing: .claude-plugin/marketplace.json"
errors=$((errors + 1))
fi
# Check repo-level files
[ ! -f "LICENSE" ] && echo "Warning: Missing LICENSE"
[ ! -f "README.md" ] && echo "Warning: Missing README.md"
[ ! -f "SECURITY.md" ] && echo "Warning: Missing SECURITY.md"
if [ "$errors" -gt 0 ]; then
echo "$errors validation error(s) found"
exit 1
fi
echo "All validations passed"
- name: Check MCP endpoint reachability
run: |
for plugin_dir in plugins/*/; do
if [ -f "$plugin_dir/.mcp.json" ]; then
urls=$(jq -r '.. | .url? // empty' "$plugin_dir/.mcp.json" 2>/dev/null)
for url in $urls; do
echo "Checking: $url"
status=$(curl -sf -o /dev/null -w "%{http_code}" --max-time 10 "$url" 2>/dev/null || echo "000")
if [ "$status" = "000" ]; then
echo " Warning: $url is unreachable (may require auth)"
else
echo " Reachable (HTTP $status)"
fi
done
fi
done