A sophisticated 3-stage automated pipeline that converts GitHub repositories into SWE-smith compatible profile classes using mini-swe-agent for repository analysis and intelligent test framework detection.
Full automated pipeline (recommended):
# Python repository with conda environment
python generate_profile.py Instagram/MonkeyType --python-repo --model claude-sonnet-4-20250514
# JavaScript repository with Docker environment
python generate_profile.py expressjs/express --model claude-sonnet-4-20250514
# Rust repository with livestreaming agent action
python generate_profile.py BurntSushi/ripgrep --livestream --model claude-sonnet-4-20250514Output: Ready-to-integrate SWE-smith profile classes in agent-result/owner-repo/generated_profiles/
This pipeline automatically:
- Analyzes repositories using mini-swe-agent to understand structure and dependencies
- Generates deployment artifacts (Dockerfiles for most languages, conda scripts for Python)
- Verifies installations and captures test execution output with smart parsing
- Parses test frameworks to identify the correct parser (pytest, mocha, jest, cargo, etc.)
- Generates SWE-smith profiles with correct naming conventions and integration metadata
Supported Languages: Python, JavaScript, TypeScript, Rust, Go, Java, C/C++, PHP, Ruby
# Install mini-swe-agent submodule
cd mini-swe-agent
pip install -e .
# API Keys (choose one)
export ANTHROPIC_API_KEY="your-anthropic-key"
export OPENAI_API_KEY="your-openai-key"- Docker (for non-Python repositories)
- Conda/Miniconda (for Python repositories)
- Git
- Python 3.8+
Script: simple_repo_to_dockerfile.py
# Python repositories (generates conda installation script)
python simple_repo_to_dockerfile.py owner/repo --python-repo --model_name claude-sonnet-4-20250514
# Non-Python repositories (generates Dockerfile)
python simple_repo_to_dockerfile.py owner/repo --model_name claude-sonnet-4-20250514What it does:
- Clones and analyzes repository structure
- Detects programming language and framework
- Identifies installation and test commands
- Creates deployment artifacts (Dockerfile or conda script)
- Generates
repo_metadata.jsonwith standardized format
Output files:
agent-result/owner-repo/Dockerfile(or*_install.shfor Python)agent-result/owner-repo/repo_metadata.jsonagent-result/owner-repo/trajectory.json(agent interaction log)
Script: verify_dockerfile.py
# Verify Python repository (SWE-smith compatible workflow)
python verify_dockerfile.py agent-result/owner-repo --python-repo --cleanup
# Verify non-Python repository (Docker-based)
python verify_dockerfile.py agent-result/owner-repo/Dockerfile --cleanupWhat it does:
- Python repos: Clones repo, creates conda "testbed" environment, runs installation script, executes tests from cloned repository
- Non-Python repos: Docker build verification + intelligent test result parsing that ignores npm notices
- Smart verification: Separates installation success from testing success
- Detailed reporting: Clear status for both installation and testing phases
Output files:
agent-result/owner-repo/test_output.txtagent-result/owner-repo/sweenv_RepoName.yml(Python only)
Script: verify_testing.py
# Parse test output with framework detection
python verify_testing.py agent-result/owner-repo --python-repo # for Python repos
python verify_testing.py agent-result/owner-repo # for othersWhat it does:
- Detects test framework from output patterns
- Parses individual test results (PASSED/FAILED/SKIPPED)
- Maps test names to status using framework-specific parsers
- Handles multiple fallback strategies for unknown frameworks
Supported frameworks:
- Python: pytest, unittest
- JavaScript: jest, mocha, vitest
- Rust: cargo test
- Go: go test
- Java: maven, gradle
Output files:
agent-result/owner-repo/parsed_test_status.json
Script: generate_profile.py - Recommended for most use cases
# Python repository (conda-based profile)
python generate_profile.py Instagram/MonkeyType --python-repo --model claude-sonnet-4-20250514
# JavaScript repository (Docker-based profile)
python generate_profile.py expressjs/express --model claude-sonnet-4-20250514
# With custom output file
python generate_profile.py fastapi/typer --python-repo --output typer_profile.py
# JSON output for programmatic use
python generate_profile.py owner/repo --json| Option | Description | Default |
|---|---|---|
--python-repo |
Treat as Python repository (conda workflow) | False |
--model |
Model to use for analysis | claude-sonnet-4-20250514 |
--output |
Save profile to file | Print to stdout |
--json |
Output JSON instead of Python class | False |
--livestream |
Enable real-time output | True |
- π΄ Livestream Mode: See mini-swe-agent working in real-time
- π Failure Handling: Pipeline stops if previous stage fails (Stage 1β2β3)
- π Complete Logging: Full pipeline output saved to
pipeline_full_log.txt - β‘ Smart Verification: Separate installation and testing checks
- π― SWE-smith Ready: Generates integration-ready profile classes
- β Quality Assurance: Profiles only generated if Stages 1&2 succeed
After running the full pipeline:
agent-result/owner-repo/
βββ Dockerfile # (or *_install.sh for Python)
βββ repo_metadata.json # Repository metadata
βββ test_output.txt # Test execution output
βββ parsed_test_status.json # Test parsing results
βββ pipeline_full_log.txt # Complete pipeline log
βββ generated_profiles/ # π― SWE-smith Integration Files
βββ profile_class.py # Ready-to-copy profile class
βββ profile_metadata.json # Integration metadata
βββ integration_instructions.md # Step-by-step integration guide
The pipeline generates zero-friction integration files for SWE-smith:
Python Example:
# Auto-generated profile for Instagram/MonkeyType
# Integration: Copy to swesmith/profiles/python.py
@dataclass
class MonkeyType15e7bca6(PythonProfile):
owner: str = "Instagram"
repo: str = "MonkeyType"
commit: str = "15e7bca60146a7afbde46ee8782a0c650f781c74"
install_cmds: list = field(default_factory=lambda: [
"pip install -e .",
"pip install pytest"
])JavaScript Example:
@dataclass
class Express9a7afb28(JavaScriptProfile):
owner: str = "expressjs"
repo: str = "express"
commit: str = "9a7afb2886247603ebd69a1c8ee5d2f29542a6c0"
test_cmd: str = "npm test -- --verbose"
@property
def dockerfile(self):
return f"""FROM node:18-slim
RUN apt-get update && apt-get install -y git
RUN git clone https://github.com/{self.mirror_name} /testbed
WORKDIR /testbed
RUN npm install
"""
def log_parser(self, log: str) -> dict[str, str]:
return parse_log_mocha(log)-
Check Integration Status:
cat agent-result/owner-repo/generated_profiles/profile_metadata.json # Look for "integration_ready": true -
Copy Profile Class:
cat agent-result/owner-repo/generated_profiles/profile_class.py >> /path/to/SWE-smith/swesmith/profiles/python.py -
Test Integration:
from swesmith.profiles import registry profile = registry.get("owner/repo") print(f"Profile loaded: {profile.__class__.__name__}")
- Stage 1 only: Test repository analysis and artifact generation
- Stage 2 only: Debug installation or test execution issues
- Stage 3 only: Test output parsing with different frameworks
- Stages 1+2: Skip parsing if you only need installation verification
# Python repository
python simple_repo_to_dockerfile.py Instagram/MonkeyType --python-repo --model_name claude-sonnet-4-20250514
# JavaScript repository
python simple_repo_to_dockerfile.py expressjs/express --model_name claude-sonnet-4-20250514
# With livestream enabled
python simple_repo_to_dockerfile.py owner/repo --livestream# Verify existing Python repository artifacts
python verify_dockerfile.py agent-result/Instagram-MonkeyType --python-repo --cleanup
# Verify existing Dockerfile
python verify_dockerfile.py agent-result/expressjs-express/Dockerfile --cleanup
# Without cleanup (keep containers)
python verify_dockerfile.py agent-result/owner-repo/Dockerfile# Parse existing test output
python verify_testing.py agent-result/owner-repo --python-repo
python verify_testing.py agent-result/owner-repo
# Test specific framework parsing
python -c "from log_parser.parsers.mocha import parse_log_mocha; print(parse_log_mocha(open('test_output.txt').read()))"| Issue | Cause | Solution |
|---|---|---|
| Stage 1 fails | API key missing/invalid | Set ANTHROPIC_API_KEY or OPENAI_API_KEY |
| Stage 2 false failure | npm notices causing non-zero exit | Use smart parsing (already implemented) |
| Python tests fail | Running from wrong directory | Uses SWE-smith workflow (clones repo) |
| Missing test framework | Parsing strategy failed | Check parsed_test_status.json |
| Docker build fails | Missing dependencies | Check generated Dockerfile |
| No profile generated | Stage 1 or 2 failed | Both stages must succeed for profile generation |
# Check pipeline stages status
ls -la agent-result/owner-repo/
# Examine test output in detail
cat agent-result/owner-repo/test_output.txt
# Review full pipeline execution log
cat agent-result/owner-repo/pipeline_full_log.txt
# Check agent decision making
head -100 agent-result/owner-repo/trajectory.json
# Re-run Stage 2 with detailed output
python verify_dockerfile.py agent-result/owner-repo --python-repo
# Test specific parsing
python verify_testing.py agent-result/owner-repo --python-repo- Generated files: Check
integration_instructions.mdfor specific guidance - Pipeline issues: Review
pipeline_full_log.txtfor complete execution trace - Agent behavior: Examine
trajectory.jsonfor analysis decisions - Parsing problems: Test individual parsers in
log_parser/directory
| Model | Best For | Speed | Accuracy |
|---|---|---|---|
claude-sonnet-4-20250514 |
Complex repos, high accuracy | Slower | βββββ |
gpt-4o-mini |
Simple repos, fast iteration | Faster | ββββ |
For large repositories that need longer analysis time:
timeout 300 python generate_profile.py complex/repo --model claude-sonnet-4-20250514# Process multiple repositories
for repo in "owner1/repo1" "owner2/repo2" "owner3/repo3"; do
python generate_profile.py "$repo" --model claude-sonnet-4-20250514
done| Language | Frameworks | Base Images | Test Parsers |
|---|---|---|---|
| Python | pip, poetry, conda | miniconda3 | pytest, unittest |
| JavaScript | npm, yarn | node:18-slim | jest, mocha, vitest |
| TypeScript | npm, yarn, tsc | node:18-slim | jest, mocha |
| Rust | cargo | rust:latest | cargo test |
| Go | go modules | golang:1.21 | go test |
| Java | maven, gradle | openjdk:17 | maven, junit |
| C/C++ | make, cmake | gcc:latest | ctest, custom |
| Ruby | bundler | ruby:latest | rspec, minitest |
| PHP | composer | php:latest | phpunit |
Verified Repositories:
- β Instagram/MonkeyType (Python) - pytest framework, 379 tests
- β expressjs/express (JavaScript) - mocha framework, 1235 tests
- β fastapi/typer (Python) - pytest framework, CLI tool
- β facebook/react (JavaScript) - jest framework, large codebase
- β BurntSushi/ripgrep (Rust) - cargo test, performance tool
Ready to automate your repository profile generation! π