AutoRepro is a developer tool that transforms issue descriptions into clear reproducibility steps and shareable workspaces. It automatically detects repository technologies, generates devcontainers, and creates prioritized reproduction plans with explicit assumptions and execution commands.
Core Mission: Eliminate the "How do I reproduce this?" problem by automating the path from issue description to failing test and Draft PR.
- Python 3.11+ (primary language)
- CLI Framework: Click for command-line interface
- Package Management: pip with pyproject.toml configuration
- Testing: pytest with golden test fixtures
autorepro/
├── autorepro/ # Core package
│ ├── cli.py # CLI entry points and command routing
│ ├── detect.py # Language/framework detection logic
│ ├── env.py # Environment metadata collection
│ ├── planner.py # Reproduction plan generation
│ └── rules.py # Command suggestion rules and scoring
├── tests/ # Test suite
│ ├── golden/ # Golden test fixtures
│ │ ├── plan/ # Plan command expected outputs
│ │ └── scan/ # Scan command expected outputs
│ └── test_*.py # Unit and integration tests
├── scripts/
│ └── regold.py # Golden test regeneration tool
└── pyproject.toml # Project configuration
- Purpose: Detect languages/frameworks from file indicators
- Key Files:
autorepro/detect.py - Algorithm: Weighted scoring (lock files=4, configs=3, setup=2, source=1)
- Output: Text or JSON with detected languages and reasons
- Supported: Python, Node.js, Go, Rust, Java, C#
- Purpose: Create standardized development containers
- Key Files:
autorepro/cli.py(init_cmd function) - Behavior: Idempotent, atomic file writes
- Default Stack: Python 3.11, Node 20, Go 1.22
- Purpose: Generate structured reproduction plans from issue descriptions
- Key Files:
autorepro/planner.py,autorepro/rules.py - Algorithm:
- Keyword extraction (filters stopwords, preserves dev terms)
- Command scoring (language priors + keyword matches)
- Plugin system for custom rules
- Output: Markdown or JSON with prioritized commands
- Purpose: Execute suggested commands with logging
- Features: Timeout control, environment variables, JSONL logging
- Integration: Works with plan output for automated testing
- Purpose: Create ZIP artifacts for CI/issue tracking
- Contents: repro.md, ENV.txt, run.log (if executed), runs.jsonl
- Use Case: GitHub Actions, issue documentation
- Purpose: Create Draft PRs from reproduction plans
- Dependencies: GitHub CLI (
gh) - Features: Auto-push, label assignment, update existing PRs
- Environment Variable:
AUTOREPRO_PLUGINS - Interface:
provide_rules()function returning language->rules mapping - Example:
from autorepro.rules import Rule
def provide_rules():
return {
"python": [Rule("pytest -k smoke", {"pytest", "smoke"}, 3, {"test"})],
"node": [Rule("npm run test:unit", {"unit", "test"}, 2, {"test"})]
}- Base Score: Language match (2 points) + keyword matches (1 point each)
- Bonuses: Direct command match (+3), specific flags (+1)
- Quality Gates:
--min-scorefilters,--strictmode fails if no good commands - Plugin Priority: Plugin commands win ties over built-in commands
- 0: Success (including "already exists" scenarios)
- 1: I/O errors or strict mode failures
- 2: Misuse (invalid arguments, missing required options)
- Special:
execandreport --execreturn subprocess exit codes
# All tests
pytest
# Specific test categories
pytest tests/test_golden_plan.py # Plan golden tests
pytest tests/test_cli.py -k scan # Scan command tests
# With coverage
pytest --cov=autorepro --cov-report=term-missing# Preview changes
python scripts/regold.py
# Apply updates
python scripts/regold.py --write# Create plugin file
echo 'def provide_rules(): return {"python": []}' > my_plugin.py
# Test with plugin
AUTOREPRO_PLUGINS=my_plugin.py autorepro plan --desc "test issue"
# Debug plugin loading
AUTOREPRO_PLUGINS_DEBUG=1 autorepro plan --desc "test issue"--filepaths resolve relative to CWD first- Falls back to
--repodirectory if not found - Enables flexible issue description file handling
initwon't overwrite without--force- Returns exit code 0 for "already exists"
- Atomic writes using temp file + rename
--out -sends to stdout for piping--dry-runpreviews without writing- JSON format available for programmatic use
- Auto-detects repository from git remotes
- Pushes branch if needed (unless
--skip-push) - Structured PR body with top 3 commands
- ✅ Language detection (scan)
- ✅ DevContainer generation (init)
- ✅ Reproduction planning (plan)
- ✅ Command execution (exec)
- ✅ Report bundling (report)
- ✅ Draft PR creation (pr)
- Automatic failing test generation
- More language support (Ruby, PHP, etc.)
- Advanced CI integration
- Interactive mode for plan refinement
- Multi-command execution chains
autorepro/cli.py: Entry point, command routing, argument parsingautorepro/planner.py: Core planning logic, markdown/JSON generationautorepro/rules.py: Command database, scoring systemautorepro/detect.py: Language detection patterns and weightstests/golden/: Expected outputs for regression testing
AUTOREPRO_PLUGINS: Comma-separated plugin modules/filesAUTOREPRO_PLUGINS_DEBUG: Show plugin import errors (default: silent)- Standard git/GitHub environment variables for PR creation
# Detect project languages
autorepro scan --json
# Create devcontainer
autorepro init --force
# Generate reproduction plan
autorepro plan --desc "pytest failing" --format json
# Execute top command
autorepro exec --desc "test failures" --timeout 300
# Create report bundle
autorepro report --desc "CI issues" --exec --out report.zip
# Create GitHub PR
autorepro pr --desc "flaky tests" --label bug --assignee maintainer- Python 3.11 on Ubuntu latest
- Runs full test suite on PR/push
- Golden test validation
- Code coverage reporting
# Clone and setup
git clone https://github.com/ali90h/AutoRepro.git
cd AutoRepro
python3.11 -m venv .venv
source .venv/bin/activate
pip install -e .
pip install pytest # For testing
# Verify installation
autorepro --version
autorepro scan- Code Style: Follow existing patterns in codebase
- Testing: Add tests for new features, update golden tests if needed
- Exit Codes: Maintain consistent exit code convention
- Documentation: Update README.md and docstrings
- Commits: Clear, descriptive commit messages
- Use
-vflag for verbose output - Check
~/.autorepro/for cached data (if implemented) AUTOREPRO_PLUGINS_DEBUG=1for plugin issues--dry-runto preview operations--out -to inspect outputs without file creation
- Repository: https://github.com/ali90h/AutoRepro
- Author: Ali Nazzal
- License: Apache 2.0
- Issues: GitHub Issues for bug reports and features