Skip to content

Commit e96e2b0

Browse files
authored
Merge pull request #51 from project-codeguard/feature/restructure-and-release-automation
2 parents 13b9632 + 032a647 commit e96e2b0

File tree

197 files changed

+850
-6362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+850
-6362
lines changed

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

.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)