-
Notifications
You must be signed in to change notification settings - Fork 5
322 lines (258 loc) · 9.99 KB
/
Copy pathci.yml
File metadata and controls
322 lines (258 loc) · 9.99 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# Validate markdown files and frontmatter
validate-structure:
name: Validate Plugin Structure
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install markdown linter
run: npm install -g markdownlint-cli
- name: Validate markdown syntax
run: |
markdownlint '**/*.md' \
--ignore node_modules \
--config .markdownlint.json || echo "Warning: Markdown linting found issues"
- name: Validate YAML frontmatter
run: |
echo "Validating agent and workflow frontmatter..."
# Check all agent files have required frontmatter
for file in .claude/agents/**/*.md; do
if [ -f "$file" ]; then
if ! grep -q "^---$" "$file"; then
echo "ERROR: Missing frontmatter in $file"
exit 1
fi
# Extract frontmatter and validate required fields
if ! grep -A 20 "^---$" "$file" | grep -q "name:"; then
echo "ERROR: Missing 'name' field in $file"
exit 1
fi
if ! grep -A 20 "^---$" "$file" | grep -q "description:"; then
echo "ERROR: Missing 'description' field in $file"
exit 1
fi
fi
done
echo "✓ All agent files have valid frontmatter"
# Check all workflow files have required frontmatter
for file in .claude/commands/*.md; do
if [ -f "$file" ]; then
if ! grep -q "^---$" "$file"; then
echo "ERROR: Missing frontmatter in $file"
exit 1
fi
if ! grep -A 10 "^---$" "$file" | grep -q "description:"; then
echo "ERROR: Missing 'description' field in $file"
exit 1
fi
fi
done
echo "✓ All workflow files have valid frontmatter"
- name: Validate directory structure
run: |
echo "Validating plugin directory structure..."
# Required directories
required_dirs=(
".claude"
".claude/agents"
".claude/commands"
".claude-plugin"
)
for dir in "${required_dirs[@]}"; do
if [ ! -d "$dir" ]; then
echo "ERROR: Missing required directory: $dir"
exit 1
fi
done
echo "✓ Directory structure is valid"
- name: Validate required files
run: |
echo "Validating required files..."
required_files=(
".claude/VERSION"
".claude/plugin.json"
".claude/CHANGELOG.md"
".claude/CLAUDE.md"
".claude-plugin/marketplace.json"
"README.md"
"ARCHITECTURE.md"
"CLAUDE.md"
)
for file in "${required_files[@]}"; do
if [ ! -f "$file" ]; then
echo "ERROR: Missing required file: $file"
exit 1
fi
done
echo "✓ All required files present"
# Validate version consistency
validate-versions:
name: Validate Version Consistency
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Check version consistency
run: |
echo "Checking version consistency across all files..."
# Read versions from different files
VERSION_FILE=$(cat .claude/VERSION | tr -d '\n')
PLUGIN_VERSION=$(jq -r '.version' .claude/plugin.json)
MARKETPLACE_META_VERSION=$(jq -r '.metadata.version' .claude-plugin/marketplace.json)
MARKETPLACE_PLUGIN_VERSION=$(jq -r '.plugins[0].version' .claude-plugin/marketplace.json)
echo "VERSION file: $VERSION_FILE"
echo "plugin.json: $PLUGIN_VERSION"
echo "marketplace.json (metadata): $MARKETPLACE_META_VERSION"
echo "marketplace.json (plugins[0]): $MARKETPLACE_PLUGIN_VERSION"
# Check all versions match
if [ "$VERSION_FILE" != "$PLUGIN_VERSION" ]; then
echo "ERROR: Version mismatch between VERSION ($VERSION_FILE) and plugin.json ($PLUGIN_VERSION)"
exit 1
fi
if [ "$VERSION_FILE" != "$MARKETPLACE_META_VERSION" ]; then
echo "ERROR: Version mismatch between VERSION ($VERSION_FILE) and marketplace.json metadata ($MARKETPLACE_META_VERSION)"
exit 1
fi
if [ "$VERSION_FILE" != "$MARKETPLACE_PLUGIN_VERSION" ]; then
echo "ERROR: Version mismatch between VERSION ($VERSION_FILE) and marketplace.json plugins[0] ($MARKETPLACE_PLUGIN_VERSION)"
exit 1
fi
echo "✓ All version files are consistent: $VERSION_FILE"
- name: Validate semantic versioning
run: |
VERSION=$(cat .claude/VERSION | tr -d '\n')
# Check if version follows semantic versioning (X.Y.Z)
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "ERROR: Version '$VERSION' does not follow semantic versioning (MAJOR.MINOR.PATCH)"
exit 1
fi
echo "✓ Version follows semantic versioning: $VERSION"
# Validate plugin metadata
validate-metadata:
name: Validate Plugin Metadata
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Validate plugin.json
run: |
echo "Validating plugin.json structure..."
# Check required fields
required_fields=("name" "version" "description" "author" "license" "repository")
for field in "${required_fields[@]}"; do
if ! jq -e ".$field" .claude/plugin.json > /dev/null; then
echo "ERROR: Missing required field in plugin.json: $field"
exit 1
fi
done
echo "✓ plugin.json structure is valid"
- name: Validate marketplace.json
run: |
echo "Validating marketplace.json structure..."
# Check required fields
if ! jq -e '.name' .claude-plugin/marketplace.json > /dev/null; then
echo "ERROR: Missing 'name' field in marketplace.json"
exit 1
fi
if ! jq -e '.metadata.version' .claude-plugin/marketplace.json > /dev/null; then
echo "ERROR: Missing 'metadata.version' field in marketplace.json"
exit 1
fi
if ! jq -e '.plugins[0]' .claude-plugin/marketplace.json > /dev/null; then
echo "ERROR: Missing plugins array in marketplace.json"
exit 1
fi
echo "✓ marketplace.json structure is valid"
- name: Validate component counts
run: |
echo "Validating agent and workflow counts..."
# Count actual agents (exclude meta directory)
AGENT_COUNT=$(find .claude/agents -name "*.md" | wc -l | tr -d ' ')
# Count actual workflows
WORKFLOW_COUNT=$(find .claude/commands -name "*.md" | wc -l | tr -d ' ')
echo "Detected agents: $AGENT_COUNT"
echo "Detected workflows: $WORKFLOW_COUNT"
# Extract counts from description (this is informational, not enforced)
DESCRIPTION=$(jq -r '.description' .claude/plugin.json)
echo "Plugin description mentions: $DESCRIPTION"
echo "✓ Component counts validated"
# Security scanning
security-scan:
name: Security Scanning
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Scan for secrets
uses: trufflesecurity/trufflehog@main
continue-on-error: true
with:
path: ./
base: ${{ github.event.before }}
head: ${{ github.sha }}
extra_args: --only-verified
- name: Scan for malicious patterns
run: |
echo "Scanning for potentially malicious patterns..."
# Check for common malicious patterns
if grep -r "eval(" .claude/ --include="*.md"; then
echo "WARNING: Found eval() usage in markdown files"
fi
if grep -r "exec(" .claude/ --include="*.md"; then
echo "WARNING: Found exec() usage in markdown files"
fi
echo "✓ Security scan complete"
# Link validation
validate-links:
name: Validate Documentation Links
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install markdown-link-check
run: npm install -g markdown-link-check
- name: Check links in README
run: |
markdown-link-check README.md --config .github/markdown-link-check.json || echo "Warning: Some links may be broken"
- name: Check links in ARCHITECTURE
run: |
markdown-link-check ARCHITECTURE.md --config .github/markdown-link-check.json || echo "Warning: Some links may be broken"
# All checks passed
all-checks-passed:
name: All Checks Passed
runs-on: ubuntu-latest
needs: [validate-structure, validate-versions, validate-metadata, security-scan, validate-links]
steps:
- name: All checks passed
run: |
echo "✅ All CI checks passed successfully!"
echo "The plugin is ready for release."