Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ade70d6
feat: sketch JavaFunctionOptimizer subclass
KRRT7 Mar 2, 2026
a538722
chore: sync docs, CI, config, and rules from main
KRRT7 Mar 2, 2026
65288d1
feat: sync JS/TS language improvements from main
KRRT7 Mar 2, 2026
c37fb44
feat: sync language infrastructure from main with Java additions
KRRT7 Mar 2, 2026
8046fcf
feat: sync Python language changes from main with Java additions
KRRT7 Mar 2, 2026
e222e24
feat: sync code utilities and discovery from main with Java additions
KRRT7 Mar 2, 2026
d518ad2
feat: sync core pipeline from main with Java protocol additions
KRRT7 Mar 2, 2026
2299d26
feat: sync CLI from main with Java additions
KRRT7 Mar 2, 2026
19bd6e4
test: sync test files from main (safe, main-only changes)
KRRT7 Mar 2, 2026
bd3ec8f
test: sync dual-changed test files from main with omni-java fixes
KRRT7 Mar 2, 2026
2dfa74d
chore: sync pyproject.toml from main and add tree-sitter-java dependency
KRRT7 Mar 2, 2026
f37b372
fix: update Java test_replacement import for moved code_replacer module
KRRT7 Mar 2, 2026
a14bd09
fix: update Java tests for protocol-dispatch refactoring
KRRT7 Mar 2, 2026
e7687f2
fix: rename min/max_outer_loops to pytest_min/max_loops and add Java …
KRRT7 Mar 2, 2026
f7fd593
fix: resolve remaining test failures after main sync
KRRT7 Mar 2, 2026
db447d6
fix: pass test_string to instrument_existing_test in function_optimizer
KRRT7 Mar 2, 2026
d5c744a
style: auto-fix ruff formatting in java test_runner
github-actions[bot] Mar 2, 2026
83831ac
fix: resolve e2e test path and pass_fail_only issues
KRRT7 Mar 2, 2026
61bcc37
Update test_java_e2e.py
KRRT7 Mar 2, 2026
754727c
fix: resolve e2e failures (path, pass_fail_only, Java context, codefl…
KRRT7 Mar 2, 2026
5b17da8
Update support.py
KRRT7 Mar 2, 2026
67b422f
fix: add @property to JavaSupport.function_optimizer_class, prek form…
KRRT7 Mar 2, 2026
2a2b421
fix: resolve remaining Java test failures
KRRT7 Mar 2, 2026
130953a
one more
KRRT7 Mar 2, 2026
399441e
one more
KRRT7 Mar 2, 2026
66f1633
fix: respect CODEFLASH_INNER_ITERATIONS env var in Java test runner
KRRT7 Mar 2, 2026
e67cdb9
fix paths
KRRT7 Mar 2, 2026
253ced9
refactor: remove all is_java() guards from shared code
KRRT7 Mar 2, 2026
ea82e2c
refactor: delete dead concolic_testing.py from shared code
KRRT7 Mar 2, 2026
e1f8e07
refactor: make parse_test_xml a protocol method on LanguageSupport
KRRT7 Mar 2, 2026
d38a0b5
temp
KRRT7 Mar 2, 2026
22b5f02
format
KRRT7 Mar 2, 2026
626be4d
use the class parser directly
KRRT7 Mar 3, 2026
f79cd93
release
KRRT7 Mar 3, 2026
fe3e2f6
11 as per workflow
KRRT7 Mar 3, 2026
7b7c4fb
Update parse_line_profile_test_output.py
KRRT7 Mar 3, 2026
dc25d12
one more
KRRT7 Mar 3, 2026
881b4e9
fix: resolve merge conflicts and fix test failures
KRRT7 Mar 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 46 additions & 5 deletions .claude/rules/architecture.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Architecture

When adding, moving, or deleting source files, update this doc to match.

```
codeflash/
├── main.py # CLI entry point
├── cli_cmds/ # Command handling, console output (Rich)
├── discovery/ # Find optimizable functions
├── context/ # Extract code dependencies and imports
├── optimization/ # Generate optimized code via AI
│ ├── optimizer.py # Main optimization orchestration
│ └── function_optimizer.py # Per-function optimization logic
Expand All @@ -15,7 +16,21 @@ codeflash/
├── api/ # AI service communication
├── code_utils/ # Code parsing, git utilities
├── models/ # Pydantic models and types
├── languages/ # Multi-language support (Python, JavaScript/TypeScript)
├── languages/ # Multi-language support (Python, JavaScript/TypeScript, Java planned)
│ ├── base.py # LanguageSupport protocol and shared data types
│ ├── registry.py # Language registration and lookup by extension/enum
│ ├── current.py # Current language singleton (set_current_language / current_language_support)
│ ├── code_replacer.py # Language-agnostic code replacement
│ ├── python/
│ │ ├── support.py # PythonSupport (LanguageSupport implementation)
│ │ ├── function_optimizer.py # PythonFunctionOptimizer subclass
│ │ ├── optimizer.py # Python module preparation & AST resolution
│ │ └── normalizer.py # Python code normalization for deduplication
│ └── javascript/
│ ├── support.py # JavaScriptSupport (LanguageSupport implementation)
│ ├── function_optimizer.py # JavaScriptFunctionOptimizer subclass
│ ├── optimizer.py # JS project root finding & module preparation
│ └── normalizer.py # JS/TS code normalization for deduplication
├── setup/ # Config schema, auto-detection, first-run experience
├── picklepatch/ # Serialization/deserialization utilities
├── tracing/ # Function call tracing
Expand All @@ -33,10 +48,36 @@ codeflash/
|------|------------|
| CLI arguments & commands | `cli_cmds/cli.py` |
| Optimization orchestration | `optimization/optimizer.py` → `run()` |
| Per-function optimization | `optimization/function_optimizer.py` |
| Per-function optimization | `optimization/function_optimizer.py` (base), `languages/python/function_optimizer.py`, `languages/javascript/function_optimizer.py` |
| Function discovery | `discovery/functions_to_optimize.py` |
| Context extraction | `context/code_context_extractor.py` |
| Test execution | `verification/test_runner.py`, `verification/pytest_plugin.py` |
| Context extraction | `languages/<lang>/context/code_context_extractor.py` |
| Test execution | `languages/<lang>/support.py` (`run_behavioral_tests`, etc.), `verification/pytest_plugin.py` |
| Performance ranking | `benchmarking/function_ranker.py` |
| Domain types | `models/models.py`, `models/function_types.py` |
| Result handling | `either.py` (`Result`, `Success`, `Failure`, `is_successful`) |

## LanguageSupport Protocol Methods

Core protocol in `languages/base.py`. Each language (`PythonSupport`, `JavaScriptSupport`) implements these.

| Category | Method/Property | Purpose |
|----------|----------------|---------|
| Identity | `language`, `file_extensions`, `default_file_extension` | Language identification |
| Identity | `comment_prefix`, `dir_excludes` | Language conventions |
| AI service | `default_language_version` | Language version for API payloads (`None` for Python, `"ES2022"` for JS) |
| AI service | `valid_test_frameworks` | Allowed test frameworks for validation |
| Discovery | `discover_functions`, `discover_tests` | Find optimizable functions and their tests |
| Discovery | `adjust_test_config_for_discovery` | Pre-discovery config adjustment (no-op default) |
| Context | `extract_code_context`, `find_helper_functions`, `find_references` | Code dependency extraction |
| Transform | `replace_function`, `format_code`, `normalize_code` | Code modification |
| Validation | `validate_syntax` | Syntax checking |
| Test execution | `run_behavioral_tests`, `run_benchmarking_tests`, `run_line_profile_tests` | Test runners |
| Test results | `test_result_serialization_format` | `"pickle"` (Python) or `"json"` (JS) |
| Test results | `load_coverage` | Load coverage from language-specific format |
| Test results | `compare_test_results` | Equivalence checking between original and candidate |
| Test gen | `postprocess_generated_tests` | Post-process `GeneratedTestsList` objects |
| Test gen | `process_generated_test_strings` | Instrument/transform raw generated test strings |
| Module | `detect_module_system` | Detect project module system (`None` for Python, `"esm"`/`"commonjs"` for JS) |
| Module | `prepare_module` | Parse/validate module before optimization |
| Setup | `setup_test_config` | One-time project setup after language detection |
| Optimizer | `function_optimizer_class` | Return `FunctionOptimizer` subclass for this language |
3 changes: 2 additions & 1 deletion .claude/rules/code-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
- **Comments**: Minimal - only explain "why", not "what"
- **Docstrings**: Do not add unless explicitly requested
- **Naming**: NEVER use leading underscores (`_function_name`) - Python has no true private functions, use public names
- **Paths**: Always use absolute paths, handle encoding explicitly (UTF-8)
- **Paths**: Always use absolute paths
- **Encoding**: Always pass `encoding="utf-8"` to `open()`, `read_text()`, `write_text()`, etc. in new or changed code — Windows defaults to `cp1252` which breaks on non-ASCII content. Don't flag pre-existing code that lacks it unless you're already modifying that line.
3 changes: 2 additions & 1 deletion .claude/rules/language-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ paths:
- Use `get_language_support(identifier)` from `languages/registry.py` to get a `LanguageSupport` instance — never import language classes directly
- New language support classes must use the `@register_language` decorator to register with the extension and language registries
- `languages/__init__.py` uses `__getattr__` for lazy imports to avoid circular dependencies — follow this pattern when adding new exports
- `is_javascript()` returns `True` for both JavaScript and TypeScript
- Prefer `LanguageSupport` protocol dispatch over `is_python()`/`is_javascript()` guards — remaining guards are being migrated to protocol methods
- `is_javascript()` returns `True` for both JavaScript and TypeScript (still used in ~15 call sites pending migration)
2 changes: 1 addition & 1 deletion .claude/rules/optimization-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ paths:
- "codeflash/optimization/**/*.py"
- "codeflash/verification/**/*.py"
- "codeflash/benchmarking/**/*.py"
- "codeflash/context/**/*.py"
- "codeflash/languages/*/context/**/*.py"
---

# Optimization Pipeline Patterns
Expand Down
Loading
Loading