Quick Start

Run AI Guard

After installation, run AI Guard on your entire project:

bash
npx ai-guard

Sample Output

AI Guard will analyze your code and report any violations:

bash
AI Guard Analysis Results
==========================
src/utils/data-processor.ts
Line 12: [excessive-comments] Comment ratio 23% exceeds threshold of 15%
Line 45: [generic-names] Avoid generic variable name: 'data'
Line 67: [ai-patterns] AI-typical phrase detected: "this function will process"
src/components/UserList.tsx
Line 8: [obvious-comments] Obvious comment: "// Loop through users"
Line 34: [large-functions] Function 'processUsers' has 78 lines (max: 60)
Found 5 violations in 2 files.
Exit code: 1

Analyze Staged Files Only

For use in git hooks, analyze only staged files:

bash
npx ai-guard --staged

This is perfect for pre-commit hooks to validate changes before they're committed.

Add to Pre-commit Hook

Add AI Guard to your pre-commit workflow using husky or lint-staged:

json
{
"lint-staged": {
"*.{ts,tsx,js,jsx}": [
"npx ai-guard --staged"
]
}
}
AI Guard exits with code 1 when violations are found, which will prevent the commit from completing.