# Coding Module API Specification

**Version**: v1.2.3 | **Status**: Stable | **Last Updated**: March 2026

## 1. Overview
The `coding` module provides a unified environment for code execution, sandboxing, analysis, and debugging. It integrates Docker-based isolation with static analysis tools.

## 2. Core Components

### 2.1 Execution & Sandboxing
- **`execute_code`**: Run code snippets securely.
- **`execute_with_limits`**: Execute code with resource constraints.
- **`run_code_in_docker`**: Execute within a containerized environment.
- **`ExecutionLimits`**: Configuration for timeouts and memory.

### 2.2 Code Review
- **`CodeReviewer`**: Assessment engine.
- **`analyze_file` / `analyze_project`**: Static analysis triggers.
- **`CodeMetrics`**: Quantitative measurements (complexity, churn).
- **`AnalysisResult`**: Detailed report of findings.

### 2.3 Debugging
- **`Debugger`**: Interactive debugging session manager.
- **`PatchGenerator`**: AI-driven fix proposal.
- **`FixVerifier`**: Automated regression testing of patches.

### 2.4 Monitoring
- **`ExecutionMonitor`**: Real-time tracking of running processes.
- **`ResourceMonitor`**: CPU/Memory usage tracking.

## 3. Usage Example

```python
from codomyrmex.coding import execute_code, run_code_in_docker

# Simple execution
result = execute_code("print('hello')", language="python")

# Sandboxed execution
result = run_code_in_docker(
    code_content="import os; print(os.environ)",
    language="python",
    image="python:3.11-slim"
)
```
