Trust your AI-generated code before shipping to production.
The complete quality gate for AI-assisted development
Installation β’ Quick Start β’ Features β’ CLI Reference β’ Documentation
84% of developers use AI coding tools. Only 29% trust the output. (Stack Overflow 2025)
AI writes code fast, but that code often contains:
- π Security vulnerabilities β SQL injection, hardcoded secrets, command injection
- π Hallucinations β Fake imports, invented functions, imaginary APIs
- π Logic errors β Unreachable code, infinite loops, dead branches
- π Technical debt β Missing docs, poor naming, deep nesting
- π Dependency issues β Circular imports, missing modules, unused code
You can't ship what you can't trust.
| Category | Features |
|---|---|
| π Analysis | Security scanning, Hallucination detection, Logic validation, Best practices |
| π Multi-Language | Python, JavaScript, TypeScript support |
| π€ AI Auto-Fix | LLM-powered fixes (OpenAI, Anthropic, Ollama) |
| π Reports | JSON, HTML (beautiful dashboard), SARIF (GitHub Security), PDF |
| π§ Fixes | Auto-fix suggestions, Confidence scores, One-click apply |
| π§ͺ Testing | Auto-generate pytest tests, Edge case detection, Coverage analysis |
| π API | REST API server, OpenAPI docs, Batch validation, Webhook support |
| π Monitoring | File watch mode, Live dashboard, Continuous validation |
| π¦ Multi-file | Dependency analysis, Circular dependency detection, Import validation |
| β‘ Performance | Intelligent caching, Incremental analysis, ~10,000+ lines/sec |
| π Extensible | Plugin system, Custom analyzers, Hook system |
| π³ Deployment | Docker, Docker Compose, GitHub Action, Pre-commit hooks |
| π» IDE Integration | VS Code extension, JetBrains plugin, LSP server |
| π Team Analytics | Dashboard, Leaderboards, Trend analysis, Project breakdown |
# From PyPI (recommended)
pip install ai-trust-validator
# With server support
pip install ai-trust-validator[server]
# With all extras
pip install ai-trust-validator[all]
# From source
git clone https://github.com/rudra496/ai-code-trust-validator.git
cd ai-code-trust-validator
pip install -e ".[all]"
# Docker
docker pull ghcr.io/rudra496/ai-code-trust-validator:latest
docker run -v ./code:/code ghcr.io/rudra496/ai-code-trust-validator validate /code# Validate a file (Python, JS, or TS)
aitrust validate generated_code.py
aitrust validate src/app.js
aitrust validate src/component.tsx
# Validate directory with minimum score
aitrust validate src/ --min-score 75 --strict
# Generate HTML report
aitrust report src/ --format html --output report.html
# Get fix suggestions
aitrust suggest-fixes buggy_code.py
# AI-powered auto-fix (requires API key)
export OPENAI_API_KEY="sk-..."
aitrust ai-fix file.py --apply
# Generate tests
aitrust generate-tests module.py --output tests/test_module.py
# Start API server
aitrust serve --port 8080
# Watch for changes with live dashboard
aitrust watch src/ --dashboard
# Analyze dependencies
aitrust analyze-deps src/
# Run benchmarks
aitrust benchmark --iterations 100
# View team analytics
aitrust analytics --days 30
# Start LSP server (for IDE integration)
aitrust lsp
# Show supported languages
aitrust languagesfrom ai_trust_validator import Validator, Config, MultiLanguageValidator
# Simple validation (auto-detects language)
validator = MultiLanguageValidator()
result = validator.validate("generated_code.py") # or .js, .ts files
print(f"Trust Score: {result.trust_score}/100")
print(f"Passed: {result.passed}")
for issue in result.critical_issues:
print(f"[CRITICAL] {issue.message}")
if issue.suggestion:
print(f" π‘ {issue.suggestion}")
# With custom config
config = Config(min_score=80, strict_mode=True)
validator = Validator(config)
result = validator.validate_code(code_string)
# Multi-file analysis
from ai_trust_validator import MultiFileAnalyzer
analyzer = MultiFileAnalyzer(validator)
result = analyzer.analyze_directory("src/")
print(f"Circular deps: {result.circular_dependencies}")
# Team analytics
from ai_trust_validator import AnalyticsDB
db = AnalyticsDB()
db.record_validation("file.py", result, user="dev1", project="myapp")
stats = db.get_stats(days=30)
print(f"Team avg: {stats.average_score}")The validator supports JavaScript and TypeScript files with comprehensive analysis:
| Language | Extensions | Analysis Type |
|---|---|---|
| JavaScript | .js, .mjs, .cjs, .jsx | Pattern-based analysis |
| TypeScript | .ts, .tsx, .mts | JS + type checking |
eval(),new Function()- Code injection risksinnerHTML,outerHTML- XSS vulnerabilitiesdocument.write()- XSS and DOM manipulation riskssetTimeout(string)- Code injection via strings- Prototype pollution (
__proto__,constructor.prototype) - Hardcoded secrets and API keys
child_process.exec()- Command injection@ts-ignore,anytype - Type safety bypass
- Detects hallucinated npm packages
- Identifies fake/invented functions
- Checks for placeholder API URLs
from ai_trust_validator import MultiLanguageValidator, detect_language
validator = MultiLanguageValidator()
# Auto-detects language from file extension
result = validator.validate("src/app.js")
print(f"Language: {detect_language('src/app.js')}") # 'javascript'
print(f"Trust Score: {result.trust_score}/100")Use LLMs to automatically fix detected issues. Supports multiple providers:
| Provider | Environment Variable | Default Model |
|---|---|---|
| OpenAI | OPENAI_API_KEY |
gpt-4o-mini |
| Anthropic | ANTHROPIC_API_KEY |
claude-3-haiku-20240307 |
| Ollama | USE_OLLAMA=true |
llama3 |
| Custom | LLM_BASE_URL + LLM_API_KEY |
configurable |
# Set your API key
export OPENAI_API_KEY="sk-..."
# Fix a file (shows fixed code)
aitrust ai-fix file.py
# Apply fixes directly (creates .backup file)
aitrust ai-fix file.py --apply
# Fix only security issues
aitrust ai-fix file.py --category security
# Use different provider/model
aitrust ai-fix file.js --provider ollama --model llama3
aitrust ai-fix file.ts --provider anthropic --model claude-3-haiku-20240307from ai_trust_validator import Validator, AIAutoFixer, LLMConfig
# Configure LLM
config = LLMConfig(
provider="openai",
model="gpt-4o-mini",
api_key="sk-..."
)
fixer = AIAutoFixer(config)
validator = Validator()
# Validate and fix
code = open("file.py").read()
result = validator.validate(code, is_file=False)
fix_result = fixer.fix(code, result.all_issues, language="python")
if fix_result.success:
print(f"Fixed with {fix_result.confidence:.0%} confidence")
print(fix_result.fixed_code)from ai_trust_validator import ai_fix_code
result = ai_fix_code(
code,
issues,
language="javascript",
api_key="sk-..."
)
print(result.fixed_code)# Install from VS Code Marketplace
# Search for "AI Trust Validator"
# Or install manually
cd vscode-extension
npm install
npm run compileFeatures:
- Real-time diagnostics
- Trust score in status bar
- Quick fix suggestions
- Hover information
- Auto-validate on save
# Install from JetBrains Marketplace
# Search for "AI Trust Validator"
# Or build from source
cd jetbrains-plugin
./gradlew build
# Install the built plugin from build/distributions/Features:
- Real-time code analysis with inline warnings
- Trust score in status bar
- Tool window with detailed results
- One-click AI-powered fixes
- Project-wide validation
# Start LSP server
aitrust lsp
# Configure in your LSP client
# Command: aitrust lsp
# Language: python, javascript, typescriptπ Analyzing: generated_code.py
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π TRUST SCORE: 67/100 β οΈ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Category Score Issues β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Security 72 2 medium, 1 low β
β Hallucinations 45 3 critical β
β Logic 85 1 minor β
β Best Practices 70 2 warnings β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π¨ Critical Issues:
[HALLUCINATION] Line 12: Import 'fancy_lib' does not exist
[HALLUCINATION] Line 18: Function 'quick_sort_v2' not defined
[SECURITY] Line 24: Potential SQL injection via f-string
π‘ AI Suggestions:
β Replace 'fancy_lib' with 'numpy' or 'pandas'
β Use built-in sorted() instead of 'quick_sort_v2'
β Use parameterized queries: cursor.execute("... WHERE id = ?", (user_id,))
| Command | Description |
|---|---|
aitrust validate <path> |
Validate code and show trust score |
aitrust report <path> |
Generate detailed report (JSON/HTML/SARIF) |
aitrust suggest-fixes <path> |
Show fix suggestions for issues |
aitrust ai-fix <path> |
Apply AI-powered fixes |
aitrust generate-tests <path> |
Generate pytest tests |
aitrust serve |
Start REST API server |
aitrust watch <path> |
Watch files for changes |
aitrust benchmark |
Run performance benchmarks |
aitrust analyze-deps <path> |
Multi-file dependency analysis |
aitrust analytics |
View team analytics |
aitrust cache <action> |
Manage validation cache |
aitrust lsp |
Start LSP server for IDEs |
aitrust languages |
Show supported languages |
version: '3.8'
services:
validator:
image: ghcr.io/rudra496/ai-code-trust-validator:latest
ports:
- "8080:8080"
command: serve --port 8080
volumes:
- ./code:/code:ro
- ./.aitrust_cache:/app/.aitrust_cachename: AI Code Trust Check
on: [pull_request]
jobs:
trust-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate AI Code
uses: rudra496/ai-code-trust-validator@v0.4.0
with:
path: 'src/'
min-score: '75'
format: 'sarif'# .pre-commit-config.yaml
repos:
- repo: https://github.com/rudra496/ai-code-trust-validator
rev: v0.4.0
hooks:
- id: ai-trust-validator
args: ['--min-score', '70']Create custom analyzers:
from ai_trust_validator import AnalyzerPlugin, PluginMetadata, Issue
class MyCustomAnalyzer(AnalyzerPlugin):
@property
def metadata(self):
return PluginMetadata(
name="my_custom",
version="1.0.0",
author="You",
description="Custom analyzer"
)
def analyze(self, tree, code, context):
issues = []
# Your analysis logic
return issues
# Register
from ai_trust_validator import PluginManager
manager = PluginManager()
manager.register(MyCustomAnalyzer())| Metric | Value |
|---|---|
| Throughput | 10,000+ lines/sec |
| Avg validation | 5-20ms per file |
| Memory | <50MB typical |
| Cache hit rate | 95%+ on re-runs |
Run your own benchmarks:
aitrust benchmark --iterations 1000- Core validation engine
- Security analyzer
- Hallucination detector
- Logic analyzer
- Best practices checker
- CLI with rich output
- JSON/HTML/SARIF reports
- Fix suggestions
- Test generation
- REST API server
- Docker support
- GitHub Action
- Pre-commit hooks
- Plugin system
- Multi-file analysis
- Watch mode
- Caching system
- LSP server
- VS Code extension
- Web dashboard
- Team analytics
- JavaScript/TypeScript support (NEW in v0.4.0)
- AI-powered auto-fix with LLM integration (NEW in v0.4.0)
- JetBrains plugin (IntelliJ, PyCharm) (NEW in v0.4.0)
- Cloud hosted version
We welcome contributions! See CONTRIBUTING.md for guidelines.
Ways to help:
- π Report bugs
- π‘ Suggest features
- π Improve documentation
- π§ Submit pull requests
- β Star the repo!
MIT License β use it freely. Just don't blame us if AI breaks production. π
Rudra Sarker β’ Developer & Researcher
Built to close the AI trust gap.
If this helped you, consider giving it a β β it helps others find it too!
Made with β€οΈ by Rudra Sarker