Skip to content

Commit 7cfd4f4

Browse files
authored
Merge pull request #98 from project-codeguard/update-version
updating codeguard version in SKILLS.md and marketplace.json
2 parents 7298d2e + 88ea2d3 commit 7cfd4f4

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"name": "codeguard-security",
1414
"source": "./",
1515
"description": "Comprehensive security rules for AI coding agents",
16-
"version": "1.1.0",
16+
"version": "1.2.0",
1717
"repository": "https://github.com/project-codeguard/rules.git",
1818
"tags": [
1919
"security",

skills/software-security/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: software-security
33
description: A software security skill that integrates with Project CodeGuard to help AI coding agents write secure code and prevent common vulnerabilities. Use this skill when writing, reviewing, or modifying code to ensure secure-by-default practices are followed.
4-
codeguard-version: "1.1.0"
4+
codeguard-version: "1.2.0"
55
framework: "Project CodeGuard"
66
purpose: "Embed secure-by-default practices into AI coding workflows"
77
---
@@ -85,4 +85,4 @@ After writing code:
8585
- Verify no hardcoded credentials or secrets
8686
- Validate that all the rules have been successfully followed when applicable.
8787
- Explain which security rules were applied
88-
- Highlight security features implemented
88+
- Highlight security features implemented

src/validate_versions.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"""
1414

1515
import json
16+
import re
1617
import sys
1718
import tomllib
1819
from pathlib import Path
@@ -21,6 +22,7 @@
2122

2223
class VersionCheck(NamedTuple):
2324
"""Result of a version check."""
25+
2426
file: str
2527
expected: str
2628
found: str
@@ -74,6 +76,29 @@ def set_marketplace_version(version: str, root: Path) -> None:
7476
f.write("\n")
7577

7678

79+
def _read_front_matter_value(path: Path, key: str) -> str:
80+
"""Read a YAML front-matter value from a markdown file."""
81+
content = path.read_text(encoding="utf-8")
82+
front_matter_match = re.match(r"^---\s*\n(.*?)\n---\s*\n", content, re.DOTALL)
83+
if not front_matter_match:
84+
raise ValueError(f"Missing front matter in {path}")
85+
front_matter = front_matter_match.group(1)
86+
value_match = re.search(
87+
rf'^{re.escape(key)}:\s*"([^"]+)"\s*$',
88+
front_matter,
89+
re.MULTILINE,
90+
)
91+
if not value_match:
92+
raise ValueError(f"Missing {key} in front matter for {path}")
93+
return value_match.group(1)
94+
95+
96+
def get_skill_codeguard_version(root: Path) -> str:
97+
"""Get codeguard-version from skills/software-security/SKILL.md."""
98+
skill_path = root / "skills" / "software-security" / "SKILL.md"
99+
return _read_front_matter_value(skill_path, "codeguard-version")
100+
101+
77102
def validate_versions(expected_version: str, root: Path = None) -> list[VersionCheck]:
78103
"""
79104
Validate all versions match the expected version.
@@ -89,15 +114,24 @@ def validate_versions(expected_version: str, root: Path = None) -> list[VersionC
89114
root = Path(__file__).parent.parent
90115

91116
checks = [
92-
VersionCheck("pyproject.toml", expected_version, get_pyproject_version(root), False),
117+
VersionCheck(
118+
"pyproject.toml", expected_version, get_pyproject_version(root), False
119+
),
93120
VersionCheck("plugin.json", expected_version, get_plugin_version(root), False),
94-
VersionCheck("marketplace.json", expected_version, get_marketplace_version(root), False),
121+
VersionCheck(
122+
"marketplace.json", expected_version, get_marketplace_version(root), False
123+
),
124+
VersionCheck(
125+
"SKILL.md",
126+
expected_version,
127+
get_skill_codeguard_version(root),
128+
False,
129+
),
95130
]
96131

97132
# Update matches field
98133
return [
99-
VersionCheck(c.file, c.expected, c.found, c.expected == c.found)
100-
for c in checks
134+
VersionCheck(c.file, c.expected, c.found, c.expected == c.found) for c in checks
101135
]
102136

103137

0 commit comments

Comments
 (0)