An AI programmer initially works for Browser4.
auto_coder is a Python automation pipeline that performs a closed-loop cycle of:
- Understanding – Parse and analyze a programming task description
- Design – Create a solution blueprint (parameters, algorithm steps)
- Programming – Generate executable Python code
- Execution – Run the generated code in a sandboxed namespace
- Diagnosis – Identify root causes when execution fails
- Automatic Repair – Patch the code and iterate until the task succeeds
# Run a task with a test assertion
python -m auto_coder "Write a function factorial that computes the factorial of n" \
--test "factorial(5)"
# Verbose output
python -m auto_coder -v "Write a function add that adds two numbers" \
--test "add(2, 3)"Process code blocks inside a Markdown document through an automated Extract → Normalize → Execute → Diagnose → Auto-fix loop:
python -m auto_coder --markdown examples/demo.md
python -m auto_coder --md examples/demo.md -v --max-iterations 3Each fenced Python code block is extracted, cleaned up, executed in a sandbox, and — if execution fails — automatically diagnosed and repaired. The loop repeats until the block succeeds or the iteration limit is reached.
pip install pytest
python -m pytest tests/ -vsrc/auto_coder/
├── __init__.py # Package metadata
├── __main__.py # CLI entry point
├── understanding.py # Stage 1: task parsing
├── design.py # Stage 2: solution design
├── programming.py # Stage 3: code generation
├── execution.py # Stage 4: code execution
├── diagnosis.py # Stage 5: error analysis
├── repair.py # Stage 6: automatic repair
├── pipeline.py # Orchestrator (closed loop)
└── markdown_processor.py # Markdown code-block processing loop