Skip to content

Commit 0e9460e

Browse files
Improve build automation with better validation
1 parent 5cd7f60 commit 0e9460e

23 files changed

Lines changed: 909 additions & 586 deletions

.claude-plugin/marketplace.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
"description": "Comprehensive security rules for AI coding agents",
1616
"version": "1.0.0",
1717
"repository": "https://github.com/project-codeguard/rules.git",
18-
"tags": ["security", "code-review", "vulnerability-prevention"]
18+
"tags": [
19+
"security",
20+
"code-review",
21+
"vulnerability-prevention"
22+
]
1923
}
2024
]
2125
}
22-

.claude-plugin/plugin.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"license": "CC-BY-4.0 (rules), Apache-2.0 (tools)",
1010
"homepage": "https://github.com/project-codeguard/rules",
1111
"repository": "https://github.com/project-codeguard/rules.git",
12-
"keywords": ["security", "secure-coding", "vulnerability-prevention", "code-review", "appsec"]
12+
"keywords": [
13+
"security",
14+
"secure-coding",
15+
"vulnerability-prevention",
16+
"code-review",
17+
"appsec"
18+
]
1319
}
14-

.gitattributes

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: Build and Release IDE Bundles
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build-and-release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.event.release.tag_name }}
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
enable-cache: true
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.11'
29+
30+
- name: Install dependencies
31+
run: uv sync
32+
33+
- name: Get version from release
34+
id: get_version
35+
run: |
36+
TAG="${{ github.event.release.tag_name }}"
37+
VERSION=${TAG#v}
38+
echo "tag=$TAG" >> $GITHUB_OUTPUT
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
40+
echo "Release version: $VERSION (tag: $TAG)"
41+
42+
- name: Validate rules
43+
run: uv run python src/validate_unified_rules.py sources/
44+
45+
- name: Validate versions match tag
46+
run: uv run python src/validate_versions.py ${{ steps.get_version.outputs.version }}
47+
48+
- name: Generate IDE bundles
49+
run: uv run python src/convert_to_ide_formats.py
50+
51+
- name: Create release archives
52+
run: |
53+
cd dist
54+
zip -r ../ide-rules-cursor.zip .cursor/
55+
zip -r ../ide-rules-windsurf.zip .windsurf/
56+
zip -r ../ide-rules-copilot.zip .github/
57+
cd ..
58+
zip -r ide-rules-all.zip dist/
59+
ls -lh ide-rules-*.zip
60+
61+
- name: Upload release assets
62+
env:
63+
GH_TOKEN: ${{ github.token }}
64+
run: |
65+
gh release upload "${{ steps.get_version.outputs.tag }}" \
66+
ide-rules-all.zip \
67+
ide-rules-cursor.zip \
68+
ide-rules-windsurf.zip \
69+
ide-rules-copilot.zip \
70+
--clobber
71+

.github/workflows/generate-ide-rules.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
name: Validate Rules
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- 'sources/**'
8+
- 'src/**'
9+
- 'pyproject.toml'
10+
push:
11+
branches:
12+
- main
13+
- develop
14+
paths:
15+
- 'sources/**'
16+
- 'src/**'
17+
- 'pyproject.toml'
18+
workflow_dispatch:
19+
20+
jobs:
21+
validate:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v4
30+
with:
31+
enable-cache: true
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: '3.11'
37+
38+
- name: Install dependencies
39+
run: uv sync
40+
41+
- name: Validate unified rules
42+
run: uv run python src/validate_unified_rules.py sources/
43+
44+
- name: Check required core rule files exist
45+
run: |
46+
echo "Checking for required core rule files..."
47+
required_files=(
48+
"sources/core/codeguard-1-hardcoded-credentials.md"
49+
"sources/core/codeguard-1-crypto-algorithms.md"
50+
"sources/core/codeguard-1-digital-certificates.md"
51+
"sources/core/codeguard-1-safe-c-functions.md"
52+
"sources/core/codeguard-SKILLS.md.template"
53+
)
54+
55+
missing=0
56+
for file in "${required_files[@]}"; do
57+
if [ ! -f "$file" ]; then
58+
echo "❌ Missing required file: $file"
59+
missing=1
60+
else
61+
echo "✅ Found: $file"
62+
fi
63+
done
64+
65+
if [ $missing -eq 1 ]; then
66+
exit 1
67+
fi
68+
69+
- name: Test conversion to IDE formats
70+
run: |
71+
echo "Testing IDE format conversion..."
72+
uv run python src/convert_to_ide_formats.py --output-dir test-output
73+
74+
# Check that files were generated
75+
if [ ! -d "test-output/.cursor" ]; then
76+
echo "❌ Cursor rules not generated"
77+
exit 1
78+
fi
79+
80+
if [ ! -d "test-output/.windsurf" ]; then
81+
echo "❌ Windsurf rules not generated"
82+
exit 1
83+
fi
84+
85+
if [ ! -d "test-output/.github" ]; then
86+
echo "❌ Copilot instructions not generated"
87+
exit 1
88+
fi
89+
90+
echo "✅ All IDE formats generated successfully"
91+
92+
- name: Check skills/ directory is up-to-date
93+
run: |
94+
echo "Checking if committed skills/ directory is up-to-date..."
95+
96+
# Save current skills
97+
mv skills skills-committed
98+
99+
# Regenerate skills (core rules only, matching default)
100+
uv run python src/convert_to_ide_formats.py
101+
102+
# Compare
103+
if ! diff -r skills/ skills-committed/ > /dev/null 2>&1; then
104+
echo "❌ The skills/ directory is out of date!"
105+
echo "Please regenerate by running: python src/convert_to_ide_formats.py"
106+
echo "Then: git add skills/"
107+
mv skills-committed skills
108+
exit 1
109+
fi
110+
111+
# Restore original
112+
rm -rf skills
113+
mv skills-committed skills
114+
echo "✅ Committed skills/ directory is up-to-date"
115+
116+
- name: Summary
117+
if: success()
118+
run: |
119+
echo "✅ All validation checks passed!"
120+
echo ""
121+
echo "Rule validation: ✅"
122+
echo "Required files: ✅"
123+
echo "IDE conversion: ✅"
124+
echo "Skills directory: ✅"
125+

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,7 @@ AGENTS.md
162162

163163
# Claude Code Plugin
164164
.claude-plugin/.cache
165-
.claude/settings.local.json
165+
.claude/settings.local.json
166+
167+
# Generated IDE-specific rule bundles (not committed, built for releases)
168+
dist/

0 commit comments

Comments
 (0)