Automate architectural oversight for AI-assisted codebases.
Project details
RepoGuard serves as an architecture guardian, ensuring AI coding assistants maintain code quality and integrity. It generates strict .cursorrules and provides inline audits for every Pull Request, offering tailored guardrails that prevent common pitfalls in AI-generated code, thereby protecting your project from architectural chaos.
The Architecture Guardian for AI-Assisted Codebases
RepoGuard aims to mitigate the challenges posed by AI coding assistants that can often create chaotic and non-compliant code structures. This tool provides an automated solution to enforce strict architectural guidelines across your repository, ensuring that AI-assisted coding remains efficient and aligned with established practices.
AI coding assistants like Cursor, GitHub Copilot, and Claude Code can generate a vast amount of code in mere seconds. However, without stringent repository-level context, they frequently lead to:
any or as any, which can lead to vulnerabilities.RepoGuard helps maintain architectural integrity by performing the following actions:
.cursorrules files for Cursor AI, as well as context files (CLAUDE.md) for Claude Code.Simply run the following command in any repository to initialize RepoGuard without requiring any installation:
npx repoguard-rules init
For global installation, use the following commands:
npm install -g repoguard-rules
repoguard init
RepoGuard offers a suite of command-line interface (CLI) commands:
npx repoguard-rules init
npx repoguard-rules audit
npx repoguard-rules check
npx repoguard-rules install-hook
npx repoguard-rules review --sample
Integrating RepoGuard into your CI pipeline allows for automatic violation checks before merging:
# .github/workflows/repoguard.yml
name: RepoGuard Architecture Audit
on:
pull_request:
types: [opened, synchronize]
jobs:
audit:
name: Guard Architecture
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run RepoGuard Architecture Review
uses: repoguard-app/repoguard-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
strict_mode: true
RepoGuard enforces the following architectural rules to safeguard code quality and maintainability:
any.RepoGuard operates with zero external dependencies and can execute checks in less than 1.5 seconds, leading to minimal overhead during CI processes.
Contributions are welcomed. Refer to the CONTRIBUTING.md document to learn how to add custom rules for additional frameworks.
RepoGuard is designed with care to support AI-assisted engineering teams, providing the necessary tools to maintain code quality and architectural integrity.
Comments
1Hey everyone! Creator of RepoGuard here. We built this to prevent Cursor and Copilot from bypassing service layers and turning codebases into spaghetti. Let me know if you test the CLI (npx repoguard-rules init) or have suggestions for new architectural rules!!