π Open-source solution that transforms AI-generated code suggestions into safe, semantic-aware IDE refactoring operations
- π΄ The Problem
- π‘ The Solution
- π― Key Features
- ποΈ Architecture
- π Quick Start
- π Refactoring Operations
- π IDE Support
- πΌ Use Cases
- π License
Approach | Method | Result | Risk Level |
---|---|---|---|
π΄ AI Generative | Creates new code from scratch | Loses all context, breaks dependencies | |
π‘ Text Replacement | Find & replace strings | Misses semantic meaning | |
π’ IDE Refactoring | AST transformations | Preserves all relationships | β ZERO |
Key Insight: Current AI assistants GENERATE code instead of TRANSFORMING it, making them fundamentally destructive rather than constructive.
graph LR
subgraph "β¨ NON-DESTRUCTIVE Refactoring Flow"
A[π€ Developer Intent] -->|"Natural Language"| B[π€ AI Understanding]
B -->|"Maps to Operations"| C[π§ RefactorAI Engine]
C -->|"IDE Commands"| D[π» AST Transformations]
D -->|"Atomic & Safe"| E[β
Perfect Result]
style A fill:#74c0fc,stroke:#339af0,color:#fff
style B fill:#8ce99a,stroke:#51cf66,color:#fff
style C fill:#ffd43b,stroke:#fab005,color:#000
style D fill:#a5d8ff,stroke:#4dabf7,color:#000
style E fill:#8ce99a,stroke:#51cf66,color:#fff
end
subgraph "π‘οΈ Safety Guarantees"
G1[Compilation Success β]
G2[All Tests Pass β]
G3[References Updated β]
G4[Rollback Available β]
style G1 fill:#d3f9d8,stroke:#51cf66
style G2 fill:#d3f9d8,stroke:#51cf66
style G3 fill:#d3f9d8,stroke:#51cf66
style G4 fill:#d3f9d8,stroke:#51cf66
end
Every refactoring operation MUST result in compilable, working code. No exceptions.
We TRANSFORM existing code using IDE operations, never GENERATE replacements.
Every operation understands the code's meaning, not just its text.
All operations can be undone with a single command.
Updates ALL references across the entire codebase automatically.
mindmap
root((π§ IDE Operations))
π Naming & References
Rename Element
Methods
Fields
Variables
Types
Packages
Update References
Same File
Cross File
JavaDoc
Comments
π¦ Code Organization
Extract Operations
Extract Method
Extract Variable
Extract Constant
Extract Class
Extract Interface
Extract Superclass
Introduce Operations
Parameter Object
Factory Method
Indirection
Parameter
π Code Movement
Move Operations
Move Method
Move Type
Move Package
Move Static Members
Hierarchy Changes
Pull Up
Push Down
Extract Interface
Use Supertype
π Structural Changes
Method Signature
Add Parameter
Remove Parameter
Change Return Type
Reorder Parameters
Inline Operations
Inline Method
Inline Variable
Inline Constant
Encapsulation
Encapsulate Field
Generate Getters/Setters
π― Advanced Patterns
Dependency Breaking
Extract Interface
Dependency Inversion
Introduce Facade
Design Patterns
Factory Pattern
Builder Pattern
Strategy Pattern
Cycle Resolution
Package Restructuring
Layer Separation
Module Extraction
graph TB
subgraph "π’ SAFE Operations - Always Non-Destructive"
S1[β
Rename with References]
S2[β
Extract Method]
S3[β
Move with Updates]
S4[β
Change Signature]
S5[β
Extract Interface]
style S1 fill:#8ce99a,stroke:#51cf66
style S2 fill:#8ce99a,stroke:#51cf66
style S3 fill:#8ce99a,stroke:#51cf66
style S4 fill:#8ce99a,stroke:#51cf66
style S5 fill:#8ce99a,stroke:#51cf66
end
subgraph "π‘ VALIDATED Operations - Checked Before Execution"
V1[β οΈ Inline Method]
V2[β οΈ Pull Up Method]
V3[β οΈ Push Down Field]
style V1 fill:#fff3bf,stroke:#fab005
style V2 fill:#fff3bf,stroke:#fab005
style V3 fill:#fff3bf,stroke:#fab005
end
subgraph "π΄ NEVER - Destructive Anti-Patterns"
D1[β Delete & Recreate]
D2[β String Replace]
D3[β Manual Edit]
style D1 fill:#ffe3e3,stroke:#ff6b6b
style D2 fill:#ffe3e3,stroke:#ff6b6b
style D3 fill:#ffe3e3,stroke:#ff6b6b
end
graph TB
subgraph "π¨ User Interface Layer"
UI[IDE Plugin UI]
CLI[CLI Interface]
API[REST API]
end
subgraph "π§ Intelligence Layer"
INT[Intent Analyzer]
MAP[Operation Mapper]
VAL[Validation Engine]
end
subgraph "π§ Execution Layer"
MCP[MCP Server]
ADAPT[IDE Adapters]
EXEC[Refactoring Executor]
ROLL[Rollback Manager]
end
subgraph "π‘οΈ Safety Layer"
PRE[Pre-conditions Check]
POST[Post-conditions Verify]
TEST[Test Runner]
COMP[Compiler Check]
end
UI --> INT
INT --> MAP
MAP --> VAL
VAL --> PRE
PRE --> MCP
MCP --> ADAPT
ADAPT --> EXEC
EXEC --> POST
POST --> TEST
TEST --> COMP
style UI fill:#ffd43b,stroke:#fab005
style INT fill:#74c0fc,stroke:#339af0
style PRE fill:#ff8cc3,stroke:#f06595
style EXEC fill:#8ce99a,stroke:#51cf66
graph LR
subgraph "β¨ RefactorAI Solution"
A[π€ Developer Intent] -->|"Natural Language"| B[π€ AI Analysis]
B -->|"MCP Protocol"| C[π§ RefactorAI Engine]
C -->|"IDE Commands"| D[π» Native IDE Operations]
D -->|"Safe Refactoring"| E[β
Clean Code]
style A fill:#74c0fc,stroke:#339af0,color:#fff
style B fill:#8ce99a,stroke:#51cf66,color:#fff
style C fill:#ffd43b,stroke:#fab005,color:#000
style D fill:#a5d8ff,stroke:#4dabf7,color:#000
style E fill:#8ce99a,stroke:#51cf66,color:#fff
end
RefactorAI acts as an intelligent bridge between AI language models and IDE refactoring engines:
- π§ Understands Intent: AI interprets what you want to achieve
- π― Maps to Operations: Translates intent to specific IDE refactoring commands
- β‘ Executes Safely: Uses native IDE operations with full semantic awareness
- β Guarantees Consistency: All references updated, no broken code
mindmap
root((π§ RefactorAI))
π― Core Refactorings
π Rename
Types
Methods
Variables
Packages
π¦ Extract
Method
Interface
Superclass
Variable
π Move
Class
Method
Package
π Transform
Inline
Pull Up
Push Down
π§ Advanced Features
π Cycle Detection
Package cycles
Class dependencies
Import analysis
ποΈ Architecture
Layer violations
Pattern detection
SOLID compliance
π Analytics
Tech debt scoring
Complexity metrics
Impact analysis
π Integrations
π» IDEs
Eclipse
IntelliJ
VS Code
Visual Studio
π€ AI Models
GitHub Copilot
Claude
GPT-4
Local LLMs
π§ Tools
Git
Maven/Gradle
CI/CD
graph TB
subgraph "π§ Basic Refactorings"
R1[π·οΈ Rename]
R2[π€ Extract Method]
R3[π₯ Inline]
R4[π Move]
style R1 fill:#e3f2fd,stroke:#2196f3,color:#0d47a1
style R2 fill:#e3f2fd,stroke:#2196f3,color:#0d47a1
style R3 fill:#e3f2fd,stroke:#2196f3,color:#0d47a1
style R4 fill:#e3f2fd,stroke:#2196f3,color:#0d47a1
end
subgraph "ποΈ Structural Refactorings"
S1[πΊ Extract Superclass]
S2[π» Extract Interface]
S3[β¬οΈ Pull Up]
S4[β¬οΈ Push Down]
style S1 fill:#f3e5f5,stroke:#9c27b0,color:#4a148c
style S2 fill:#f3e5f5,stroke:#9c27b0,color:#4a148c
style S3 fill:#f3e5f5,stroke:#9c27b0,color:#4a148c
style S4 fill:#f3e5f5,stroke:#9c27b0,color:#4a148c
end
subgraph "π― Advanced Refactorings"
A1[π Break Cycles]
A2[π¦ Parameter Object]
A3[π Introduce Factory]
A4[π Introduce Facade]
style A1 fill:#e8f5e9,stroke:#4caf50,color:#1b5e20
style A2 fill:#e8f5e9,stroke:#4caf50,color:#1b5e20
style A3 fill:#e8f5e9,stroke:#4caf50,color:#1b5e20
style A4 fill:#e8f5e9,stroke:#4caf50,color:#1b5e20
end
graph TB
subgraph "π¨ Frontend Layer"
UI[IDE Plugin UI]
CLI[CLI Interface]
API[REST API]
end
subgraph "π§ Intelligence Layer"
INT[Intent Analyzer]
SMELL[Code Smell Detector]
PLAN[Refactoring Planner]
end
subgraph "π§ Execution Layer"
MCP[MCP Server]
ADAPT[IDE Adapters]
EXEC[Refactoring Executor]
end
subgraph "πΎ Data Layer"
HIST[History Store]
METR[Metrics DB]
CONF[Configuration]
end
UI --> INT
CLI --> INT
API --> INT
INT --> SMELL
SMELL --> PLAN
PLAN --> MCP
MCP --> ADAPT
ADAPT --> EXEC
EXEC --> HIST
EXEC --> METR
style UI fill:#ffd43b,stroke:#fab005
style INT fill:#74c0fc,stroke:#339af0
style MCP fill:#8ce99a,stroke:#51cf66
style EXEC fill:#ff8cc3,stroke:#f06595
graph LR
subgraph "π― Scope & Naming"
REN[Rename]
REN --> REN1[Variables]
REN --> REN2[Methods]
REN --> REN3[Classes]
REN --> REN4[Packages]
style REN fill:#e1f5fe,stroke:#03a9f4
style REN1 fill:#b3e5fc,stroke:#03a9f4
style REN2 fill:#b3e5fc,stroke:#03a9f4
style REN3 fill:#b3e5fc,stroke:#03a9f4
style REN4 fill:#b3e5fc,stroke:#03a9f4
end
subgraph "π¦ Code Organization"
EXT[Extract]
EXT --> EXT1[Method]
EXT --> EXT2[Variable]
EXT --> EXT3[Interface]
EXT --> EXT4[Superclass]
style EXT fill:#f3e5f5,stroke:#9c27b0
style EXT1 fill:#e1bee7,stroke:#9c27b0
style EXT2 fill:#e1bee7,stroke:#9c27b0
style EXT3 fill:#e1bee7,stroke:#9c27b0
style EXT4 fill:#e1bee7,stroke:#9c27b0
end
subgraph "π Dependency Management"
CYC[Break Cycles]
CYC --> CYC1[Package Level]
CYC --> CYC2[Class Level]
CYC --> CYC3[Method Level]
style CYC fill:#e8f5e9,stroke:#4caf50
style CYC1 fill:#c8e6c9,stroke:#4caf50
style CYC2 fill:#c8e6c9,stroke:#4caf50
style CYC3 fill:#c8e6c9,stroke:#4caf50
end
Refactoring | Before Complexity | After Complexity | Impact |
---|---|---|---|
π€ Extract Method | CC: 15 | CC: 3 Γ 5 | -67% complexity |
ποΈ Extract Class | LOC: 500 | LOC: 200 + 150 + 150 | Better cohesion |
π¦ Parameter Object | Params: 8 | Params: 2 | -75% parameters |
π Break Cycle | Circular: Yes | Circular: No | 100% improvement |
π― Move Method | Feature Envy: High | Feature Envy: None | Proper encapsulation |
Feature | Eclipse | IntelliJ | VS Code | Visual Studio |
---|---|---|---|---|
Basic Refactorings | β | β | β | β |
AI Integration | β | β | β | β |
β Full Support | π§ In Development | β Not Planned
graph TB
subgraph "β Before: Circular Dependency"
A1[Service A] --> B1[Service B]
B1 --> C1[Service C]
C1 --> A1
style A1 fill:#ff6b6b,stroke:#c92a2a
style B1 fill:#ff6b6b,stroke:#c92a2a
style C1 fill:#ff6b6b,stroke:#c92a2a
end
subgraph "β
After: Clean Architecture"
A2[Service A] --> I[Interface]
B2[Service B] --> I
C2[Service C] --> I
style A2 fill:#8ce99a,stroke:#51cf66
style B2 fill:#8ce99a,stroke:#51cf66
style C2 fill:#8ce99a,stroke:#51cf66
style I fill:#74c0fc,stroke:#339af0
end
Command: "Break the circular dependency between these services"
RefactorAI Actions:
- Detects cycle using graph analysis
- Suggests Extract Interface refactoring
- Creates common interface
- Updates all implementations
- Verifies no cycles remain
// Before: 500-line method with 15 parameters
public void processOrder(String id, String customer, String product,
int quantity, double price, String address,
String city, String zip, String country,
boolean express, double discount, String coupon,
String payment, String card, Date delivery) {
// 500 lines of spaghetti code...
}
// After: Clean, testable code
public void processOrder(OrderRequest request) {
Order order = createOrder(request);
validateOrder(order);
applyDiscounts(order);
processPayment(order);
scheduleDelivery(order);
}
graph LR
subgraph "π¦ Monolith"
M[Monolithic App]
end
subgraph "π― Microservices"
MS1[User Service]
MS2[Order Service]
MS3[Payment Service]
MS4[Notification Service]
end
M -->|"RefactorAI"| MS1
M -->|"Extraction"| MS2
M -->|"Process"| MS3
M -->|"β¨"| MS4
style M fill:#ffd43b,stroke:#fab005
style MS1 fill:#74c0fc,stroke:#339af0
style MS2 fill:#8ce99a,stroke:#51cf66
style MS3 fill:#ff8cc3,stroke:#f06595
style MS4 fill:#c5f6fa,stroke:#22b8cf
MIT License - see LICENSE file for details.
π Star us on GitHub to support the project!