Intelligent Code Refactoring
With or Without AI

Transform how you refactor code with intelligent analysis, safety checkpoints, and structured workflows. Use standalone for deterministic refactoring, or with AI for context-aware changes.

npm install -g refactogent
View Documentation →

Open source • MIT License • TypeScript, JavaScript, Python, Go

Two Modes, One Tool

Choose the right approach for your refactoring needs

Mode 1: Standalone CLI

Deterministic Refactoring

Automated refactoring without AI. Fast, consistent, repeatable.

# Extract types automatically
refactogent refactor ./src

# Batch process with options
refactogent refactor ./src \
  --ignore "**/*.test.ts" \
  --types-path "src/types" \
  --dry-run
  • Type extraction to .types.ts files
  • Batch processing for entire codebases
  • Perfect for CI/CD pipelines
  • Zero AI dependencies
Mode 2: MCP Server

AI-Assisted Intelligence

Enhance Claude with refactoring superpowers via MCP.

# Install MCP server
npm install -g @refactogent/mcp-server

# Configure with Claude
claude mcp add --transport stdio \
  refactogent -- npx -y \
  @refactogent/mcp-server
  • Deep codebase analysis with AI
  • Safety checkpoints with rollback
  • Impact analysis & blast radius
  • Context-aware suggestions

Powerful Features

Everything you need for safe, intelligent refactoring

Type Abstraction

Automatically extract interfaces and types to separate .types.ts files with smart import management.

Safety Checkpoints

Git-based safety points with automatic rollback if validation fails. Never break your code.

Impact Analysis

Understand the blast radius of changes with dependency tracing and risk scoring.

Automated Validation

Run tests, linting, and type checking automatically after refactoring changes.

Deep Code Analysis

AST-based parsing with complexity metrics, dependency mapping, and symbol indexing.

Multi-Language

TypeScript, JavaScript, Python, and Go support with language-specific optimizations.

How It Works

Simple workflow, powerful results

1 CLI Workflow

1

Install & Run

Install globally and run on your codebase

2

Automatic Analysis

AST parsing finds refactoring opportunities

3

Apply Changes

Types extracted, imports updated automatically

4

Verify

Run your build and tests - everything works

2 MCP Workflow

1

Configure MCP

Add Refactogent to Claude's MCP config

2

Create Checkpoint

AI creates git safety point before changes

3

Analyze & Execute

AI analyzes context and makes intelligent changes

4

Validate

Auto-runs tests, rolls back if needed

Use Cases

Real scenarios, real solutions

CLI Mode

Batch Type Extraction

Extract types from 50+ files in seconds. Clean separation of interfaces and implementation with automatic import updates.

  • 35 type abstractions applied
  • All imports updated correctly
  • Build passes first try
$ refactogent refactor ./src \
  --ignore "**/*.test.ts"

🚀 RefactoGent: Complete Refactoring
📁 Discovered 50 files
✅ Indexed 50 files with 120 symbols
✅ Found 35 type abstractions
✅ Applied 35 type abstractions

$ npm run build
✓ Build passes!
User: "What's the impact of
changing UserService?"

Claude:
1. Analyzing dependencies...
2. Found 47 dependent files
3. Risk score: 82/100 (High)
4. Suggesting incremental approach

Create checkpoint? [Y/n]
MCP Mode

Impact Analysis

Understand blast radius before making changes. AI traces dependencies and suggests safe refactoring strategies.

  • Dependency chain visualization
  • Risk scoring for changes
  • Incremental refactoring suggestions
MCP Mode

Safe Refactoring with Rollback

AI makes intelligent changes with automatic checkpoints. If tests fail, instant rollback to safety.

  • Automatic git checkpoints
  • Test validation after changes
  • One-click rollback on failure
User: "Extract UserProfile types"

Claude:
1. Created checkpoint #abc123
2. Analyzing UserProfile.tsx...
3. Extracting 8 type definitions
4. Updating 12 import statements
5. Running tests...
   ❌ 2 tests failed
6. Rolling back to checkpoint
7. Analyzing failures...
8. Suggesting fixes...

Ready to Transform Your Refactoring?

Open source, MIT licensed, and ready to use today

Quick Start - CLI

npm install -g refactogent

Quick Start - MCP

npm i -g @refactogent/mcp-server