Spaces:
Sleeping
Sleeping
updated CLAUDE.md and README.md
Browse files
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
|
| 26 |
* Production: OpenAI gpt-4o-mini via OpenAIServerModel
|
|
|
|
| 27 |
* Configuration variables:
|
| 28 |
-
* ENVIRONMENT (development|production)
|
| 29 |
-
* DEVELOPMENT_MODEL_ID (default: ollama/
|
| 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 |
-
|
| 61 |
-
|
| 62 |
-
.
|
|
|
|
| 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
|
|
|
|
| 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:
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.33.2
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# Ada
|
| 13 |
|
| 14 |
-
A
|
| 15 |
|
| 16 |
## Features
|
| 17 |
|
| 18 |
-
- **
|
| 19 |
-
- **
|
| 20 |
-
- **
|
| 21 |
-
- **
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## Architecture
|
| 24 |
|
| 25 |
-
- **Framework**: Smolagents for LLM abstraction, Gradio for UI
|
| 26 |
-
- **Agents**: Multi-agent architecture with specialized
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
- **Hosting**: Designed for Hugging Face Spaces deployment
|
| 28 |
-
- **Observability**: Langfuse integration (
|
| 29 |
|
| 30 |
## Usage
|
| 31 |
|
| 32 |
### Web Interface
|
| 33 |
-
1. Upload
|
| 34 |
-
2.
|
| 35 |
-
3.
|
|
|
|
| 36 |
|
| 37 |
### Command Line
|
| 38 |
```bash
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
```
|
| 41 |
|
| 42 |
## Development
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
### Setup
|
| 45 |
```bash
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
# Install dependencies
|
| 47 |
-
uv
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
|
| 51 |
```
|
| 52 |
|
| 53 |
-
### Configuration
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
### Testing
|
| 59 |
```bash
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
```
|
| 62 |
|
|
|
|
|
|
|
| 63 |
## Project Structure
|
| 64 |
```
|
| 65 |
src/
|
| 66 |
βββ agents/
|
| 67 |
-
β
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
tests/
|
| 70 |
-
βββ
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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]
|