How asaad-suliman/ai-code-analyst works
This repository is an AI code-analysis product: a user submits Python, the backend analyzes and rewrites it, then executes both versions in a sandbox to verify correctness and performance. The web app also provides authentication, live progress, analysis reports, and session history. The backend pipeline and API relationships are supported by the excerpts and index; the README documents the broader six-stage flow and UI streaming. Some frontend and agent implementations were not sampled, so uncertain internal calls are omitted.
Main entry points: orchestrator.py Pipeline orchestrator · schemas.py Typed data contracts · app.py FastAPI endpoints · main.jsx Page routing
Components 24
API and access
- FastAPI endpoints
api/app.py - Runtime configuration
core/config.py - Supabase auth and sessions
Analysis pipeline
- Pipeline orchestrator
orchestrator.py - Typed data contracts
core/schemas.py - AST architect
agents/architect_agent.py - Security scanner
agents/security_agent.py - Bug detector
agents/bug_detector.py - Code optimizer
agents/optimizer.py - LLM prompts
core/prompts.py
Execution and verification
- Performance analyzer
agents/performance_analyzer.py - Optimization validator
agents/validator.py - Sandbox executor
core/code_executor.py - Resource sampler
core/metrics.py
Learning and metrics
- RAG retrieval and storage
rag/retriever.py - Learning gate
rag/learning_engine.py
Web experience
- React dashboard
frontend/src/pages/Dashboard.jsx - Frontend API client
frontend/src/lib/api.js - Frontend authentication
frontend/src/lib/auth.js - Page routing
frontend/src/main.jsx - Analysis insights
frontend/src/pages/Insights.jsx - Session history
frontend/src/pages/History.jsx - Product landing page
frontend/src/pages/Home.jsx
Other components
- Code submitter
Connections 35
- Code submitter → FastAPI endpoints: submits code
api/app.py - FastAPI endpoints → Pipeline orchestrator: runs pipeline
api/app.py - Pipeline orchestrator → AST architect: runs stage
orchestrator.py - Pipeline orchestrator → Security scanner: runs stage
orchestrator.py - Pipeline orchestrator → RAG retrieval and storage: retrieves context
orchestrator.py - Pipeline orchestrator → Bug detector: runs stage
orchestrator.py - Pipeline orchestrator → Performance analyzer: runs stage
orchestrator.py - Pipeline orchestrator → Code optimizer: runs stage
orchestrator.py - Pipeline orchestrator → Optimization validator: runs stage
orchestrator.py - Pipeline orchestrator → Learning gate: triggers learning
orchestrator.py - Pipeline orchestrator → Typed data contracts: uses contracts
orchestrator.py - Optimization validator → Sandbox executor: executes code
agents/validator.py - Performance analyzer → Sandbox executor: measures execution
- Resource sampler → Sandbox executor: samples process
core/metrics.py - Learning gate → RAG retrieval and storage: saves approved fixes
rag/learning_engine.py - RAG retrieval and storage → Runtime configuration: reads store path
rag/retriever.py - FastAPI endpoints → Supabase auth and sessions: authenticates and stores sessions
api/app.py - FastAPI endpoints → Runtime configuration: loads settings
core/config.py - AST architect → Typed data contracts: returns report
agents/architect_agent.py - Security scanner → Typed data contracts: returns report
agents/security_agent.py - Bug detector → Typed data contracts: returns report
agents/bug_detector.py - Performance analyzer → Typed data contracts: returns report
agents/performance_analyzer.py - Code optimizer → Typed data contracts: returns result
agents/optimizer.py - Optimization validator → Typed data contracts: returns verdict
agents/validator.py - Code submitter → React dashboard: uses dashboard
README.md - React dashboard → Frontend API client: requests analysis
frontend/src/pages/Dashboard.jsx - Frontend API client → FastAPI endpoints: calls API
README.md - FastAPI endpoints → React dashboard: streams stages
README.md - Page routing → React dashboard: routes dashboard
frontend/src/main.jsx - Page routing → Analysis insights: routes reports
frontend/src/main.jsx - Page routing → Session history: routes sessions
frontend/src/main.jsx - Page routing → Product landing page: routes home
frontend/src/main.jsx - Analysis insights → Frontend API client: loads reports
frontend/src/pages/Insights.jsx - Session history → Frontend API client: loads history
frontend/src/pages/History.jsx - Frontend authentication → Supabase auth and sessions: stores login state