Skip to content

feat: add Cline and Continue.dev formats, MCP search tool, CI tests, expanded tags#80

Open
ShaunSec wants to merge 1 commit into
cosai-oasis:mainfrom
ShaunSec:feat/cline-continuedev-mcp-enhancements
Open

feat: add Cline and Continue.dev formats, MCP search tool, CI tests, expanded tags#80
ShaunSec wants to merge 1 commit into
cosai-oasis:mainfrom
ShaunSec:feat/cline-continuedev-mcp-enhancements

Conversation

@ShaunSec
Copy link
Copy Markdown

Summary

This PR adds four features to improve CodeGuard's reach and developer experience.

1. New Format Support: Cline and Continue.dev

Two new format implementations that expand CodeGuard's coverage to Cline (8M+ installs, VS Code / JetBrains / CLI) and Continue.dev (open-source AI assistant for VS Code and JetBrains).

  • src/formats/cline.py: generates .md rules for .clinerules/ directory with paths: for conditional activation
  • src/formats/continuedev.py: generates .md rules for .continue/rules/ directory with globs: for conditional activation
  • Both registered in __init__.py and convert_to_ide_formats.py
  • Build, validation, and auto-update workflows updated to include both formats in zip bundles and release uploads
  • codeguard-reviewer AGENT.md exclusion list updated

2. MCP Server Enhancements

  • rule_processor.py: added tags field to ProcessedRule, rule caching to avoid repeated filesystem reads, graceful error handling that logs warnings and skips malformed rules instead of crashing
  • tool_factory.py: enhanced tool output to include language and tag metadata; added search_rules tool that filters the rule catalogue by language, tag, or free-text keyword (AND logic, all optional)
  • server.py: registers search_rules meta-tool, warns when no rules are loaded to help debug CODEGUARD_RULES_DIR misconfiguration

3. CI/CD Test Infrastructure

  • .github/workflows/test-mcp-server.yml: new workflow that runs MCP server tests on Python 3.11/3.12/3.13 with ruff linting, triggered on changes to src/codeguard-mcp/ or sources/rules/core/

4. Tag Mappings Expansion

  • src/tag_mappings.py: expanded from 6 to 24 tags organized by security domain (identity, data protection, application security, infrastructure, supply chain, platform, compliance, serialization)

Testing

  • 25/25 MCP server tests pass (16 existing + 8 new + 1 new metadata)
  • 23/23 rules convert to all 12 formats with 0 errors
  • 46/46 Cline + Continue.dev files validate with correct YAML frontmatter
  • Edge cases verified: empty globs, single glob, always-apply, special YAML characters, caching identity, malformed rule recovery

Security Review

  • All YAML parsing uses yaml.safe_load()
  • No exec/eval/shell injection vectors
  • Search tool uses substring matching (no ReDoS risk)
  • All inputs normalized before comparison

Files Changed (14)

File Change
src/formats/cline.py New - Cline format
src/formats/continuedev.py New - Continue.dev format
src/formats/__init__.py Updated exports
src/convert_to_ide_formats.py Added new formats to pipeline
src/codeguard-mcp/src/codeguard_mcp/rule_processor.py Tags, caching, error handling
src/codeguard-mcp/src/codeguard_mcp/server.py Search tool registration
src/codeguard-mcp/src/codeguard_mcp/tool_factory.py Search tool, enhanced metadata
src/codeguard-mcp/tests/test_tool_factory.py 8 new tests
src/tag_mappings.py Expanded tag set
.github/workflows/test-mcp-server.yml New CI workflow
.github/workflows/validate-rules.yml Added format checks
.github/workflows/build-ide-bundles.yml Added zip/upload steps
.github/workflows/update-codeguard-rules.yml Added format entries
sources/agents/codeguard-reviewer/AGENT.md Updated exclusion list

…expanded tags

Add four features to improve CodeGuard's reach and developer experience:

1. New Format Support: Cline and Continue.dev

   - src/formats/cline.py: generates .md rules for .clinerules/ directory
     with paths-based conditional activation
   - src/formats/continuedev.py: generates .md rules for .continue/rules/
     with globs-based conditional activation
   - Both formats registered in __init__.py and convert_to_ide_formats.py
   - All 23 rules convert successfully to both formats with valid YAML
   - Build, validation, and auto-update workflows updated to include
     both formats in zip bundles and release uploads
   - codeguard-reviewer AGENT.md exclusion list updated

2. MCP Server Enhancements

   - rule_processor.py: added tags field to ProcessedRule, rule caching
     to avoid repeated filesystem reads, and graceful error handling that
     logs warnings and skips malformed rules instead of crashing
   - tool_factory.py: enhanced tool output to include language and tag
     metadata; added search_rules tool that filters the rule catalogue
     by language, tag, or free-text keyword (AND logic, all optional)
   - server.py: registers search_rules meta-tool, warns when no rules
     are loaded to help debug CODEGUARD_RULES_DIR misconfiguration

3. CI/CD Test Infrastructure

   - .github/workflows/test-mcp-server.yml: new workflow that runs
     MCP server tests on Python 3.11/3.12/3.13 with ruff linting,
     triggered on changes to src/codeguard-mcp/ or sources/rules/core/

4. Tag Mappings Expansion

   - src/tag_mappings.py: expanded from 6 to 24 tags organized by
     security domain (identity, data protection, application security,
     infrastructure, supply chain, platform, compliance, serialization)

Testing:
  - 25/25 MCP server tests pass (16 existing + 8 new + 1 new metadata)
  - 23/23 rules convert to all 12 formats with 0 errors
  - 46/46 Cline + Continue.dev files validate with correct YAML
  - Edge cases verified: empty globs, single glob, always-apply,
    special YAML characters, caching identity, malformed rule recovery

Security review: PASS
  - yaml.safe_load() for all YAML parsing
  - No exec/eval/shell injection vectors
  - Search uses substring matching, no ReDoS risk
  - All inputs normalized before comparison
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

thschaffr pushed a commit to thschaffr/project-codeguard that referenced this pull request May 26, 2026
…tag-to-rule mapping table to the generated SKILL.md.

Tags are already validated in rule frontmatter (utils.validate_tags) and
exposed on ProcessedRule/ConversionResult, but they were not propagated
to any IDE-format output or to the generated SKILL.md. This change makes
the existing tag data actually usable downstream.

Format changes (tags appended to YAML frontmatter when present):
- cursor.py:       tags: [authentication, web]
- copilot.py:      tags: [authentication, web]
- windsurf.py:     tags: [authentication, web]
- antigravity.py:  tags: [authentication, web]
- agentskills.py:  expanded YAML list (inherited by opencode, codex,
                   openclaw, hermes, claude formats)

SKILL.md template / generator:
- Add <!-- TAG_MAPPINGS_START --> / <!-- TAG_MAPPINGS_END --> markers
  mirroring the existing language-mapping block
- New update_tag_mappings() renders a "Security Context (Tag) -> Rules"
  table from the per-run tag_to_rules dict; falls back silently when the
  markers are absent so older templates still build
- Add a new section to the skill workflow text that calls out tag-based
  selection alongside the existing language-based selection

Regenerated skills/software-security/ artifacts to match the new
pipeline (committed because they ship as the plugin payload).

No change to tag_mappings.py (avoids overlap with PR cosai-oasis#80).
No change to validation behavior; validate_unified_rules.py already
rejects unknown tags.
@thomas-bartlett thomas-bartlett added the enhancement New feature or request label May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants