A powerful toolkit for detecting, analyzing, and debugging AI-generated code. Inspired by research in AI-assisted debugging, this toolkit helps developers identify and fix common issues in AI-generated code.
⚠️ Project Status: BetaThis project is under active development. While core features are functional, you may encounter bugs or incomplete features.
- Basic AI code detection and probability scoring
- Security vulnerability scanning (eval, innerHTML, etc.)
- Error handling pattern detection
- VS Code extension with:
- Real-time code analysis
- Quick fixes for common issues
- Workspace scanning
- Status bar integration
- Advanced pattern recognition improvements
- Machine learning model analysis features
- Performance optimizations for large codebases
- Enhanced test coverage
- AI Code Detection: Identify code likely generated by AI tools
- Bug Pattern Recognition: Detect common issues in AI-generated code
- Automated Fix Suggestions: Get intelligent suggestions for fixing identified issues
- Complexity Analysis: Analyze code complexity and potential maintenance issues
- Security Scanning: Identify potential security vulnerabilities in AI-generated code
pip install ai-toolkit
from ai_toolkit import code_analyzer
# Initialize the analyzer
analyzer = code_analyzer.AICodeAnalyzer()
# Analyze a file
results = analyzer.analyze_file('path/to/your/file.py')
# View results
print(f"AI Generated Probability: {results['ai_probability']}")
print("\nPotential Bugs:")
for bug in results['potential_bugs']:
print(f"- {bug['description']}")
- Pattern recognition for AI-generated code
- Confidence scoring for AI attribution
- Style analysis and comparison
- Common AI coding pattern issues
- Error handling problems
- API misuse detection
- Security vulnerability scanning
- Automated fix recommendations
- Best practice suggestions
- Code improvement hints
- Install from VS Code Marketplace:
- Search for "AI Code Detective"
- Click Install
- Real-time AI code detection
- Dedicated sidebar for analysis results
- Status bar integration
- Auto-scan on file save
- Custom highlighting for AI-generated code
- Quick fixes and suggestions
The Fix All Issues button appears in two places:
- In the editor title area when viewing a supported file (.py, .js, .ts, etc.)
- At the top of the "Potential Issues" section in the AI Code Detective sidebar
To use this feature:
- Open a file you want to analyze
- Run the "AI Detective: Analyze File" command
- If issues are found, click the "Fix All Issues" button
- The extension will automatically fix all fixable issues in the file
Note: You must have an active editor open with the file you want to fix when clicking the Fix All Issues button.
- Inline Decorations: Lines flagged (e.g.
eval
usages) are highlighted in the editor. - Quick Fix: Hover on a warning gutter, select "Replace with ast.literal_eval" to apply safe parsing.
AI Detective: Scan Workspace
scans all files in the workspace.
Access settings through:
- Command Palette (
Ctrl+Shift+P
) - Search "AI Code Detective"
- Customize:
- Auto-scan behavior
- Highlighting options
- Analysis sensitivity
probabilityThreshold
: 0.5complexityThreshold
: 10
ai-toolkit path/to/your_file.py
Outputs JSON with fields:
ai_probability
potential_bugs
complexity_score
suggested_fixes
Install in editable mode:
pip install -e .
Run Python tests:
pytest
Run VS Code extension tests:
npm install
npm run compile
npm run test
- Code review automation
- Quality assurance for AI-generated code
- Security auditing
- Technical debt assessment
We welcome contributions! See our Contributing Guide for details.
MIT License - see LICENSE file for details.