|
| 1 | +# Architecture |
| 2 | + |
| 3 | +``` |
| 4 | +codeflash/ |
| 5 | +├── main.py # CLI entry point |
| 6 | +├── cli_cmds/ # Command handling, console output (Rich) |
| 7 | +├── discovery/ # Find optimizable functions |
| 8 | +├── context/ # Extract code dependencies and imports |
| 9 | +├── optimization/ # Generate optimized code via AI |
| 10 | +│ ├── optimizer.py # Main optimization orchestration |
| 11 | +│ └── function_optimizer.py # Per-function optimization logic |
| 12 | +├── verification/ # Run deterministic tests (pytest plugin) |
| 13 | +├── benchmarking/ # Performance measurement |
| 14 | +├── github/ # PR creation |
| 15 | +├── api/ # AI service communication |
| 16 | +├── code_utils/ # Code parsing, git utilities |
| 17 | +├── models/ # Pydantic models and types |
| 18 | +├── languages/ # Multi-language support (Python, JavaScript/TypeScript) |
| 19 | +├── setup/ # Config schema, auto-detection, first-run experience |
| 20 | +├── picklepatch/ # Serialization/deserialization utilities |
| 21 | +├── tracing/ # Function call tracing |
| 22 | +├── tracer.py # Root-level tracer entry point for profiling |
| 23 | +├── lsp/ # IDE integration (Language Server Protocol) |
| 24 | +├── telemetry/ # Sentry, PostHog |
| 25 | +├── either.py # Functional Result type for error handling |
| 26 | +├── result/ # Result types and handling |
| 27 | +└── version.py # Version information |
| 28 | +``` |
| 29 | + |
| 30 | +## Key Entry Points |
| 31 | + |
| 32 | +| Task | Start here | |
| 33 | +|------|------------| |
| 34 | +| CLI arguments & commands | `cli_cmds/cli.py` | |
| 35 | +| Optimization orchestration | `optimization/optimizer.py` → `run()` | |
| 36 | +| Per-function optimization | `optimization/function_optimizer.py` | |
| 37 | +| Function discovery | `discovery/functions_to_optimize.py` | |
| 38 | +| Context extraction | `context/code_context_extractor.py` | |
| 39 | +| Test execution | `verification/test_runner.py`, `verification/pytest_plugin.py` | |
| 40 | +| Performance ranking | `benchmarking/function_ranker.py` | |
| 41 | +| Domain types | `models/models.py`, `models/function_types.py` | |
| 42 | +| Result handling | `either.py` (`Result`, `Success`, `Failure`, `is_successful`) | |
0 commit comments