syum-af commited on
Commit
81ef860
Β·
1 Parent(s): 5377bcd

updated CLAUDE.md and README.md

Browse files
Files changed (2) hide show
  1. CLAUDE.md +31 -11
  2. README.md +106 -28
CLAUDE.md CHANGED
@@ -21,13 +21,15 @@
21
  * Langfuse - Observability (planned)
22
 
23
  ## Model Configuration
24
- * Environment-based configuration via .env file
25
- * Local development: Ollama with qwen2.5-coder model via LiteLLMModel
26
  * Production: OpenAI gpt-4o-mini via OpenAIServerModel
 
27
  * Configuration variables:
28
- * ENVIRONMENT (development|production)
29
- * DEVELOPMENT_MODEL_ID (default: ollama/qwen2.5-coder)
30
  * PRODUCTION_MODEL_ID (default: gpt-4o-mini)
 
31
 
32
  ## Project Structure
33
  ```
@@ -37,7 +39,7 @@ src/
37
  β”‚ β”œβ”€β”€ ada_converter.py # AdaConverterAgent for Ada to Python conversion
38
  β”‚ └── unit_test_generator.py # UnitTestGeneratorAgent for reverse-engineering unit tests
39
  β”œβ”€β”€ tools/
40
- β”‚ └── project_handler.py # Zip extraction and file handling utilities
41
  β”œβ”€β”€ ui.py # Gradio UI components and logic
42
  └── main.py # CLI interface for development/testing
43
  tests/
@@ -57,9 +59,10 @@ tests/
57
  β”‚ └── test_project.zip # Sample zip archive for testing
58
  └── conftest.py # Pytest configuration for Playwright
59
  app.py # Application entry point and agent initialization
60
- requirements.txt # Generated from uv dependencies
61
- pyproject.toml # Project configuration and dependencies
62
- .env # Environment configuration
 
63
  ```
64
 
65
  ## Agents
@@ -85,17 +88,34 @@ pyproject.toml # Project configuration and dependencies
85
  * **Unit Tests**: Test individual agents and utilities in isolation
86
  * Located in `tests/unit/agents/` and `tests/unit/tools/`
87
  * Use mock LLM models to avoid external dependencies
 
88
  * Run with: `uv run pytest tests/unit/ -v`
89
 
90
  * **Integration Tests**: Test complete user workflows end-to-end
91
  * Located in `tests/integration/`
92
- * Use Playwright for browser automation
93
- * Test zip upload, file selection, and analysis display
 
94
  * Run with: `uv run pytest tests/integration/ --browser chromium`
95
 
 
 
 
 
 
 
96
  * **Test Data**: Sample Ada files and zip archives for testing
97
- * Calculator example with basic arithmetic functions
98
  * Stored in `tests/test_data/` directory
 
 
 
 
 
 
 
 
 
99
 
100
  ## Hosting Platform
101
  * Hugging Face Spaces with Gradio SDK
 
21
  * Langfuse - Observability (planned)
22
 
23
  ## Model Configuration
24
+ * Environment-based configuration via .env file (optional)
25
+ * Local development: Ollama with llama3.2 model via LiteLLMModel
26
  * Production: OpenAI gpt-4o-mini via OpenAIServerModel
27
+ * Langfuse integration enabled only in production environment
28
  * Configuration variables:
29
+ * ENVIRONMENT (development|production) - defaults to development
30
+ * DEVELOPMENT_MODEL_ID (default: ollama/llama3.2)
31
  * PRODUCTION_MODEL_ID (default: gpt-4o-mini)
32
+ * LANGFUSE_* variables (only needed for production)
33
 
34
  ## Project Structure
35
  ```
 
39
  β”‚ β”œβ”€β”€ ada_converter.py # AdaConverterAgent for Ada to Python conversion
40
  β”‚ └── unit_test_generator.py # UnitTestGeneratorAgent for reverse-engineering unit tests
41
  β”œβ”€β”€ tools/
42
+ β”‚ └── project_handler.py # Zip extraction and file handling utilities (with auto-cleanup)
43
  β”œβ”€β”€ ui.py # Gradio UI components and logic
44
  └── main.py # CLI interface for development/testing
45
  tests/
 
59
  β”‚ └── test_project.zip # Sample zip archive for testing
60
  └── conftest.py # Pytest configuration for Playwright
61
  app.py # Application entry point and agent initialization
62
+ TESTING.md # Comprehensive testing documentation
63
+ requirements.txt # Generated from uv dependencies
64
+ pyproject.toml # Project configuration, dependencies, and pytest settings
65
+ uv.lock # UV lockfile for reproducible dependencies
66
  ```
67
 
68
  ## Agents
 
88
  * **Unit Tests**: Test individual agents and utilities in isolation
89
  * Located in `tests/unit/agents/` and `tests/unit/tools/`
90
  * Use mock LLM models to avoid external dependencies
91
+ * Fast execution (~0.15s for 11 tests)
92
  * Run with: `uv run pytest tests/unit/ -v`
93
 
94
  * **Integration Tests**: Test complete user workflows end-to-end
95
  * Located in `tests/integration/`
96
+ * Use Playwright for browser automation with Chromium
97
+ * Test zip upload, file extraction, file selection, and UI workflows
98
+ * Requires Ollama running for local development
99
  * Run with: `uv run pytest tests/integration/ --browser chromium`
100
 
101
+ * **Test Configuration**:
102
+ * All configuration in `pyproject.toml` with proper marker registration
103
+ * Markers: `integration` and `e2e` for test categorization
104
+ * Playwright settings in `tests/conftest.py`
105
+ * No warnings or configuration conflicts
106
+
107
  * **Test Data**: Sample Ada files and zip archives for testing
108
+ * Calculator example with basic arithmetic functions (add, subtract, multiply, divide, power, factorial)
109
  * Stored in `tests/test_data/` directory
110
+ * Automatic cleanup of temporary project folders
111
+
112
+ ## Development Workflow
113
+ * **Prerequisites**:
114
+ * Ollama installed and running with llama3.2 model
115
+ * Python 3.10+ with UV package manager
116
+ * **Setup**: `uv sync` to install dependencies
117
+ * **Testing**: See TESTING.md for comprehensive test commands
118
+ * **Playwright Setup**: `uv run playwright install` for browser automation
119
 
120
  ## Hosting Platform
121
  * Hugging Face Spaces with Gradio SDK
README.md CHANGED
@@ -1,73 +1,151 @@
1
  ---
2
  title: Ada Assistant
3
- emoji: πŸ“Š
4
- colorFrom: pink
5
  colorTo: purple
6
  sdk: gradio
7
  sdk_version: 5.33.2
8
  app_file: app.py
9
  pinned: false
 
 
 
 
 
 
 
10
  ---
11
 
12
- # Ada Conversion Assistant
13
 
14
- A modern tool for analyzing legacy Ada codebases and providing conversion recommendations to modern programming languages.
15
 
16
  ## Features
17
 
18
- - **Business Logic Analysis**: Extracts core algorithms, data structures, and business rules from Ada code
19
- - **Conversion Recommendations**: Provides guidance on complexity and modernization approaches
20
- - **Web Interface**: Drag & drop file upload with Gradio UI
21
- - **LLM-Powered**: Uses AI models (Ollama for development, OpenAI for production) via smolagents
 
 
 
22
 
23
  ## Architecture
24
 
25
- - **Framework**: Smolagents for LLM abstraction, Gradio for UI
26
- - **Agents**: Multi-agent architecture with specialized CodeAnalyzerAgent
 
 
 
 
27
  - **Hosting**: Designed for Hugging Face Spaces deployment
28
- - **Observability**: Langfuse integration (planned)
29
 
30
  ## Usage
31
 
32
  ### Web Interface
33
- 1. Upload Ada files (.ads, .adb, .ada)
34
- 2. Click "Analyze Business Logic"
35
- 3. View extracted business logic and conversion recommendations
 
36
 
37
  ### Command Line
38
  ```bash
39
- uv run src/main.py
 
 
 
 
40
  ```
41
 
42
  ## Development
43
 
 
 
 
 
 
44
  ### Setup
45
  ```bash
 
 
 
 
46
  # Install dependencies
47
- uv install
48
 
49
- # Set environment variables
50
- cp .env.example .env
51
  ```
52
 
53
- ### Configuration
54
- - `ENVIRONMENT`: "development" or "production"
55
- - `DEVELOPMENT_MODEL_ID`: Ollama Model for local development (default: ollama/qwen2.5-coder)
56
- - `PRODUCTION_MODEL_ID`: OpenAI Model for production (default: gpt-4o-mini)
 
 
 
57
 
58
  ### Testing
59
  ```bash
60
- uv run pytest tests/
 
 
 
 
 
 
 
 
 
 
 
61
  ```
62
 
 
 
63
  ## Project Structure
64
  ```
65
  src/
66
  β”œβ”€β”€ agents/
67
- β”‚ └── code_analyzer.py # Business logic analysis agent
68
- └── main.py # CLI interface
 
 
 
 
 
 
69
  tests/
70
- β”œβ”€β”€ test_code_analyzer_agent.py
71
- └── tictactoe.ads # Test Ada file
72
- app.py # Gradio web interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ```
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  title: Ada Assistant
3
+ emoji: πŸ”„
4
+ colorFrom: blue
5
  colorTo: purple
6
  sdk: gradio
7
  sdk_version: 5.33.2
8
  app_file: app.py
9
  pinned: false
10
+ tags:
11
+ - ada
12
+ - python
13
+ - code-conversion
14
+ - legacy-code
15
+ - llm
16
+ - testing
17
  ---
18
 
19
+ # Ada Assistant
20
 
21
+ A comprehensive tool for analyzing legacy Ada codebases and converting them to modern Python, with integrated testing and analysis capabilities.
22
 
23
  ## Features
24
 
25
+ - **πŸ“ Project Upload**: Drag & drop ZIP file upload with automatic extraction and cleanup
26
+ - **πŸ” Business Logic Analysis**: Extracts core algorithms, data structures, and business rules from Ada code
27
+ - **🐍 Ada to Python Conversion**: Converts Ada code to clean, PEP 8 compliant Python with type hints
28
+ - **πŸ§ͺ Unit Test Generation**: Automatically generates comprehensive pytest test suites for converted code
29
+ - **🌐 Web Interface**: Modern Gradio UI with file explorer and real-time analysis
30
+ - **πŸ€– LLM-Powered**: Uses AI models (Ollama for development, OpenAI for production) via smolagents
31
+ - **πŸ”§ Comprehensive Testing**: Full test suite with unit and integration tests using Playwright
32
 
33
  ## Architecture
34
 
35
+ - **Framework**: Smolagents for LLM abstraction, Gradio for UI, Playwright for E2E testing
36
+ - **Agents**: Multi-agent architecture with specialized agents:
37
+ - **CodeAnalyzerAgent**: Business logic extraction and analysis
38
+ - **AdaConverterAgent**: Ada to Python code conversion
39
+ - **UnitTestGeneratorAgent**: Automated test generation
40
+ - **Testing**: Comprehensive test strategy with unit and integration tests
41
  - **Hosting**: Designed for Hugging Face Spaces deployment
42
+ - **Observability**: Langfuse integration (production only)
43
 
44
  ## Usage
45
 
46
  ### Web Interface
47
+ 1. **Upload Project**: Drag & drop a ZIP file containing your Ada project
48
+ 2. **Browse Files**: Use the file explorer to navigate extracted files
49
+ 3. **Select Ada File**: Click on any `.ads` or `.adb` file
50
+ 4. **View Results**: See business analysis, Python conversion, and generated tests in real-time
51
 
52
  ### Command Line
53
  ```bash
54
+ # Start the web interface
55
+ uv run python app.py
56
+
57
+ # Run CLI analysis (development)
58
+ uv run python src/main.py
59
  ```
60
 
61
  ## Development
62
 
63
+ ### Prerequisites
64
+ - **Python 3.10+** with UV package manager
65
+ - **Ollama** installed and running with llama3.2 model
66
+ - **Git** for version control
67
+
68
  ### Setup
69
  ```bash
70
+ # Clone the repository
71
+ git clone <repository-url>
72
+ cd ada-assistant2
73
+
74
  # Install dependencies
75
+ uv sync
76
 
77
+ # Install Playwright browsers for testing
78
+ uv run playwright install
79
  ```
80
 
81
+ ### Configuration (Optional)
82
+ Create a `.env` file for custom configuration:
83
+ ```bash
84
+ ENVIRONMENT=development # or "production"
85
+ DEVELOPMENT_MODEL_ID=ollama/llama3.2 # or your preferred Ollama model
86
+ PRODUCTION_MODEL_ID=gpt-4o-mini # for production deployment
87
+ ```
88
 
89
  ### Testing
90
  ```bash
91
+ # Run all tests
92
+ uv run pytest tests/ -v
93
+
94
+ # Run only unit tests (fast)
95
+ uv run pytest tests/unit/ -v
96
+
97
+ # Run only integration tests (requires Ollama)
98
+ uv run pytest tests/integration/ --browser chromium
99
+
100
+ # Run tests with specific markers
101
+ uv run pytest -m "not integration" -v # Skip integration tests
102
+ uv run pytest -m "integration" -v # Only integration tests
103
  ```
104
 
105
+ For detailed testing information, see [TESTING.md](TESTING.md).
106
+
107
  ## Project Structure
108
  ```
109
  src/
110
  β”œβ”€β”€ agents/
111
+ β”‚ β”œβ”€β”€ code_analyzer.py # Business logic analysis agent
112
+ β”‚ β”œβ”€β”€ ada_converter.py # Ada to Python conversion agent
113
+ β”‚ └── unit_test_generator.py # Unit test generation agent
114
+ β”œβ”€β”€ tools/
115
+ β”‚ └── project_handler.py # ZIP extraction and file handling
116
+ β”œβ”€β”€ ui.py # Gradio UI components and logic
117
+ └── main.py # CLI interface
118
+
119
  tests/
120
+ β”œβ”€β”€ unit/ # Unit tests (isolated, fast)
121
+ β”‚ β”œβ”€β”€ agents/ # Agent unit tests
122
+ β”‚ β”‚ β”œβ”€β”€ test_code_analyzer_agent.py
123
+ β”‚ β”‚ β”œβ”€β”€ test_ada_converter_agent.py
124
+ β”‚ β”‚ β”œβ”€β”€ test_unit_test_generator_agent.py
125
+ β”‚ β”‚ └── tictactoe.ads # Test Ada file
126
+ β”‚ └── tools/
127
+ β”‚ └── test_project_handler.py
128
+ β”œβ”€β”€ integration/ # E2E tests (browser automation)
129
+ β”‚ └── test_e2e_ada_analysis.py
130
+ β”œβ”€β”€ test_data/ # Sample test files
131
+ β”‚ β”œβ”€β”€ calculator.ads # Sample Ada specification
132
+ β”‚ β”œβ”€β”€ calculator.adb # Sample Ada implementation
133
+ β”‚ └── test_project.zip # Sample ZIP archive
134
+ └── conftest.py # Pytest configuration
135
+
136
+ app.py # Application entry point
137
+ TESTING.md # Comprehensive testing guide
138
+ pyproject.toml # Project config, dependencies, test settings
139
+ uv.lock # Dependency lockfile
140
  ```
141
+
142
+ ## Contributing
143
+
144
+ 1. **Follow TDD**: Write tests first, implement minimal code, refactor
145
+ 2. **Run tests**: Always run `uv run pytest tests/unit/ -v` after changes
146
+ 3. **Integration tests**: Run `uv run pytest tests/integration/ --browser chromium` for full E2E validation
147
+ 4. **Documentation**: Update CLAUDE.md with architectural changes
148
+
149
+ ## License
150
+
151
+ [Your License Here]