You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
temp/ # 📁 Analysis result files
├── analysis-*.md # Generated analyses
└── .gitkeep
rag-index/ # 📊 RAG index storage
└── rag-index.json # Vector store data
prompts/ # 📝 Claude prompts
└── code-analyzer.md # Analysis instructions
🧩 Key Components
Core Files
File
Lines
Description
index.ts
208
Entry point, graceful shutdown, indexing lock
bot.ts
710
Telegram handlers, commands, progress animation
auth.ts
50
Whitelist authorization
utils.ts
642
Logging, file ops, config management
validation.ts
268
Zod schemas, XSS prevention
LLM Layer
File
Lines
Description
llm/index.ts
511
Provider factory, multi-provider config
llm/retry.ts
196
retryWithBackoff() - exponential backoff for 429/5xx/timeouts
llm/fallback.ts
143
CompletionProviderWithFallback - tries providers in order
llm/timeout.ts
89
withTimeout() - configurable operation timeouts
llm/cli-adapter.ts
227
Uses Claude Code CLI as LLM provider
RAG System
File
Lines
Description
rag/pipeline.ts
695
RAG orchestrator, incremental indexing
rag/retriever.ts
323
Vector search + LLM reranking (batch: 5)
rag/store.ts
482
JSON-based vector store
rag/embedding-cache.ts
102
LRU cache with single-flight deduplication
rag/parser.ts
276
TypeScript AST parsing
rag/chunker.ts
329
Semantic code chunking
📊 Project Metrics
Component
Files
Lines
Core Source
7
~2,034
CLI Adapters
5
~836
LLM Providers
12
~2,791
RAG System
9
~2,657
Error Handling
1
~423
Total Source
34
~8,741
🎯 Development Principles
KISS + Occam's Razor - Every entity must justify its existence
Security First - Input validation, whitelist auth, XSS prevention
Type Safety - Strict TypeScript, Zod runtime validation
Resilience - Retry with backoff, provider fallback, timeouts
Testability - Comprehensive test coverage
🚀 Development Commands
npm run dev # Development mode with tsx
npm run build # TypeScript compilation
npm start # Production start
npm run test# Run tests in watch mode
npm run test:run # Run tests once (CI mode)
npm run type-check # TypeScript type checking
npm run lint # Check code formatting
npm run lint:fix # Auto-fix code formatting
🧪 Testing Strategy
Unit Tests: Individual component testing (LLM, RAG, CLI)