Retrofit brownfield projects for autonomous development
/plugin marketplace add akaszubski/autonomous-dev/plugin install autonomous-dev@autonomous-devPurpose: Analyze existing (brownfield) projects and retrofit them to align with autonomous-dev standards for /auto-implement compatibility.
Target Users: Teams adopting autonomous-dev on existing codebases
Workflow: 5-phase process with backup/rollback safety
This command transforms brownfield projects into autonomous-dev compatible projects through a structured 5-phase workflow:
DRY_RUN: Shows what would change without modifying files
/align-project-retrofit --dry-run
STEP_BY_STEP: Confirms before each step (default, safest)
/align-project-retrofit
AUTO: Executes all steps automatically (fastest, less control)
/align-project-retrofit --auto
# Full retrofit with confirmations
/align-project-retrofit
# Analyze project root explicitly
/align-project-retrofit --project-root /path/to/project
# Analyze only
/align-project-retrofit --phase analyze
# Plan only (requires prior analysis)
/align-project-retrofit --phase plan
# Verify only (after manual changes)
/align-project-retrofit --phase verify
# Human-readable output (default)
/align-project-retrofit
# JSON output for scripting
/align-project-retrofit --json
# Save to file
/align-project-retrofit --json --output retrofit_results.json
# Verbose mode
/align-project-retrofit --verbose
.claude/PROJECT.md - Project goals, scope, constraintssrc/ - Source code directory (if missing)tests/ - Test directory (if missing).github/workflows/ - CI/CD configuration (if missing)README.md - Enhanced with autonomous-dev context.gitignore - Standard exclusions added/tmp/retrofit_backup_YYYYMMDD_HHMMSS/0o700 (user-only, secure)Ready for /auto-implement when:
# Claude coordinates this workflow via BrownfieldRetrofit facade
python plugins/autonomous-dev/scripts/align_project_retrofit.py [options]
Facade Pattern: BrownfieldRetrofit (brownfield_retrofit.py) coordinates all phases
Libraries:
codebase_analyzer.py - Tech stack and structure detectionalignment_assessor.py - Alignment gap analysis and scoringmigration_planner.py - Migration step generation and optimizationretrofit_executor.py - Safe execution with backup/rollbackretrofit_verifier.py - Compliance verification and readiness assessmentSecurity: All libraries use security_utils for path validation (CWE-22), symlink detection (CWE-59), and audit logging (CWE-117)
$ /align-project-retrofit
PHASE 1: Analyzing codebase...
Tech Stack: Python 3.9
Framework: Flask
Files: 47
Tests: 12
PHASE 2: Assessing alignment...
12-Factor Score: 65.0%
Alignment Gaps: 8
PROJECT.md Confidence: 0.75
PHASE 3: Generating migration plan...
Migration Steps: 8
Total Effort: 12.5 hours
Critical Path: 8.0 hours
PHASE 4: EXECUTING migration...
Completed: 8
Failed: 0
Backup: /tmp/retrofit_backup_20231109_143022/
PHASE 5: Verifying results...
Readiness Score: 85.0%
Compliance Checks: 5/5 passed
Blockers: 0
Ready for /auto-implement: YES
=== Retrofit Complete ===
Readiness Score: 85.0%
Compliance: 5/5 checks passed
Blockers: 0
Ready for /auto-implement: YES
Fix: Initialize git first
git init
git add .
git commit -m "Initial commit"
Fix: Create requirements.txt or pyproject.toml
pip freeze > requirements.txt
Fix: Review verification report for specific gaps
/align-project-retrofit --phase verify --verbose
Fix: Check logs for failure reason
cat logs/security_audit.log | grep retrofit_execution_failed
Brownfield Analyzer Agent: Available via /brownfield-analyzer for specialized analysis
Agent File: plugins/autonomous-dev/agents/brownfield-analyzer.md
Skills Used:
/setup - Initial project setup (greenfield)/align-project - Fix PROJECT.md conflicts/health-check - Validate plugin integrity/status - Track project progressSuccessful retrofit achieved when:
--dry-run to preview changesRelated: GitHub Issue #59 - Brownfield retrofit command implementation