Open-source security scanner for AI-assisted development.
Installation • CLI Reference • API • VS Code • How It Works
With AI coding assistants (Copilot, Cursor, Claude), developers ship code they didn't write and often don't fully understand. Studies show:
- 42% of code now has AI assistance (Sonar 2026)
- 96% of developers don't fully trust AI-generated code
- 45% of AI-generated code contains security vulnerabilities
VGX helps you know what's AI-generated and catch vulnerabilities before they hit production.
| Feature | Description |
|---|---|
| AI Code Detection | Identify AI-generated code using stylometry + pattern analysis |
| Security Scanning | Vulnerability detection via Semgrep (+ optional OpenAI) |
| Pre-commit Hooks | Block insecure code before it's committed |
| VS Code Extension | Real-time AI detection in your editor |
| Offline-First | No API keys required. Your code never leaves your machine. |
| CI/CD Ready | JSON output for pipeline integration |
curl -sSL https://vgx.sh/install | bashgo install github.com/rohansx/vgx@latestdocker pull ghcr.io/rohansx/vgx:latest
docker run -v $(pwd):/code ghcr.io/rohansx/vgx detect --path /codegit clone https://github.com/rohansx/vgx.git
cd vgx
go build -o vgx ./cmd/vgxvgx <command> [options]
Commands:
detect Detect AI-generated code
scan Security vulnerability scan
version Print version
help Show help
Analyze files for AI-generated code patterns.
# Scan a directory
vgx detect --path ./src
# Scan a single file
vgx detect src/api/handler.ts
# JSON output (for CI/CD)
vgx detect --path ./src --format json
# Custom threshold (default: 70)
vgx detect --path ./src --threshold 80Options:
| Flag | Short | Default | Description |
|---|---|---|---|
--path |
-p |
. |
Path to scan |
--format |
-f |
text |
Output format: text, json |
--threshold |
70 |
AI confidence threshold (0-100) |
Example Output:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
VGX AI Code Detection
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Files scanned: 12
AI-generated: 4
Human-written: 8
AI percentage: 33.2%
Max AI confidence: 89%
FILES
🤖 src/api/handlers.ts 89%
🤖 src/utils/fetch.ts 82%
✓ src/config.ts 28%
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 4 file(s) detected as AI-generated
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Scan for vulnerabilities using Semgrep rules.
# Scan changed files (default)
vgx scan
# Scan all files
vgx scan --changes=false
# Scan specific files
vgx scan src/auth.ts src/api/users.tsOptions:
| Flag | Default | Description |
|---|---|---|
--changes |
true |
Scan only git-changed files |
--report |
true |
Generate markdown report |
--update-context |
true |
Update file context cache |
Detects:
- Hardcoded secrets & API keys
- SQL injection vulnerabilities
- XSS (Cross-Site Scripting)
- Insecure cryptography
- Path traversal
- Command injection
- And more via Semgrep rules
{
"files_scanned": 12,
"ai_detected": 4,
"human_written": 8,
"max_ai_confidence": 0.89,
"ai_percentage": 33.2,
"results": [
{
"file_path": "src/api/handler.ts",
"ai_confidence": 0.89,
"confidence_level": "very_high",
"style_score": 0.82,
"pattern_score": 0.94,
"is_ai_generated": true,
"lines_of_code": 145,
"patterns": [
{
"name": "async_await_fetch",
"confidence": 0.10,
"line_start": 23,
"line_end": 35
}
]
}
]
}{
"file": "src/auth.ts",
"description": "Hardcoded API key detected",
"rule": "generic.secrets.security.detected-api-key",
"severity": "high",
"line": 15,
"source": "semgrep",
"recommendation": "Use environment variables for secrets"
}| Code | Meaning |
|---|---|
0 |
Success, no issues found |
1 |
Issues found (AI code or vulnerabilities) |
2 |
Error (invalid path, etc.) |
Real-time AI code detection in your editor.
- Status Bar Indicator — Shows AI confidence for current file
- Inline Highlighting — Highlights AI-generated code patterns
- Workspace Scanning — Scan entire workspace for AI code
| Command | Description |
|---|---|
VGX: Detect AI Code in File |
Analyze current file |
VGX: Detect AI Code in Workspace |
Scan all files |
VGX: Security Scan File |
Run security scan |
{
"vgx.aiThreshold": 70,
"vgx.highlightAICode": true,
"vgx.showInlineConfidence": true
}cd vscode-extension
npm install
npm run compile
# Then install via "Install from VSIX" in VS CodeVGX uses a combination of stylometry (code style analysis) and pattern matching to detect AI-generated code.
┌─────────────────────────────────────────────────────────────┐
│ VGX DETECTION ENGINE │
├─────────────────────────────────────────────────────────────┤
│ │
│ INPUT: Source code file │
│ │
│ ┌─────────────────────┐ ┌─────────────────────┐ │
│ │ STYLOMETRY (45%) │ │ PATTERNS (55%) │ │
│ ├─────────────────────┤ ├─────────────────────┤ │
│ │ • Naming consistency│ │ • try/catch style │ │
│ │ • Indentation │ │ • async/await fetch │ │
│ │ • Comment density │ │ • React hooks │ │
│ │ • Line length var. │ │ • Go error handling │ │
│ │ • Boilerplate ratio │ │ • Python docstrings │ │
│ │ • Empty line ratio │ │ • JSDoc comments │ │
│ └─────────────────────┘ └─────────────────────┘ │
│ │ │ │
│ └──────────┬───────────────┘ │
│ ▼ │
│ Combined Score (0-100%) │
│ │ │
│ ▼ │
│ ┌─────────────────────────┐ │
│ │ Threshold Check (70%) │ │
│ └─────────────────────────┘ │
│ │ │
│ ┌──────────┴──────────┐ │
│ ▼ ▼ │
│ 🤖 AI-Generated ✓ Human-Written │
│ │
└─────────────────────────────────────────────────────────────┘
| Feature | AI Signal | Weight |
|---|---|---|
| Naming Consistency | High consistency = AI | 20% |
| Indentation | Perfect consistency = AI | 20% |
| Boilerplate Ratio | High boilerplate = AI | 20% |
| Line Length Variance | Low variance = AI | 15% |
| Comment Density | ~15% density = AI | 10% |
| Empty Line Ratio | Consistent spacing = AI | 10% |
| Average Line Length | ~45 chars = AI | 5% |
VGX recognizes 16+ language-specific patterns commonly generated by AI:
JavaScript/TypeScript:
copilot_try_catch— Standard try/catch with console.errorasync_await_fetch— Async function with await fetcharrow_with_types— Typed arrow functionsuse_effect_deps— React useEffect with dependency arrayuse_state_destructure— React useState destructuring
Go:
go_error_check—if err != nil { return }patterngo_defer—defer file.Close()patterngo_struct_init— Multi-line struct initialization
Python:
python_docstring— Docstrings with Args/Returns/Raisespython_type_hints— Function type annotations
Block AI code or vulnerabilities before commit.
# Create hook
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/bash
vgx scan --changes=true
if [ $? -ne 0 ]; then
echo "VGX: Commit blocked due to security issues"
exit 1
fi
EOF
chmod +x .git/hooks/pre-commit# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: vgx-scan
name: VGX Security Scan
entry: vgx scan --changes=true
language: system
pass_filenames: falseVGX works out of the box with zero configuration.
| Variable | Description |
|---|---|
OPENAI_API_KEY |
Enable AI-enhanced scanning (optional) |
SEMGREP_RULES |
Custom Semgrep rules (default: p/security-audit) |
# Optional: Enhanced scanning with OpenAI
OPENAI_API_KEY=sk-...
# Optional: Custom Semgrep rules
SEMGREP_RULES=p/security-audit,p/secretsvgx/
├── cmd/
│ └── vgx/
│ └── main.go # CLI entrypoint
├── pkg/
│ ├── detection/
│ │ ├── detector.go # Main detector
│ │ ├── stylometry.go # Style analysis
│ │ └── patterns.go # Pattern matching
│ ├── scanner/
│ │ ├── scanner.go # Vulnerability scanner
│ │ ├── semgrep.go # Semgrep integration
│ │ └── openai.go # OpenAI integration
│ ├── context/
│ │ └── manager.go # File context & caching
│ ├── cache/
│ │ └── cache.go # Scan result cache
│ └── types/
│ └── types.go # Shared types
├── vscode-extension/
│ └── src/
│ └── extension.ts # VS Code extension
├── website/
│ └── index.html # Landing page
├── scripts/
│ └── install.sh # Installer script
└── .github/
└── workflows/
└── release.yml # CI/CD
- Go 1.22+ (for building)
- Semgrep (optional, for security scanning)
# Install Semgrep (optional)
pip install semgrep
# or
brew install semgrepContributions welcome! Please read our contributing guidelines.
# Clone
git clone https://github.com/rohansx/vgx.git
cd vgx
# Build
go build -o vgx ./cmd/vgx
# Test
go test ./...
# Run
./vgx detect --path ./pkgMIT License — see LICENSE
- Website: vgx.sh
- GitHub: github.com/rohansx/vgx
- Author: @rohansx
Built for developers who ship AI-assisted code responsibly.