Skip to content

About

AI-powered legacy code modernization — transforms Perl/Mason codebases to TypeScript/React/Node.js using LLMs

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

RT Modernizer — AI-Powered Legacy Code Transformation

Transform Perl/Mason enterprise codebases to modern TypeScript/React/Node.js using LLMs and deterministic parsing. Built as a proof-of-concept for the $250B+ legacy software modernization market.

TypeScript License: MIT


Why This Matters

Enterprises spend years and millions modernizing legacy systems. Request Tracker (RT)—a widely-used Perl/Mason ticketing system—exemplifies the challenge: declining Perl expertise, integration hurdles, and maintenance costs. This project demonstrates how generative AI can turn multi-year migrations into weeks.

Relevant to: AI Migrations (Snowflake), Code Generation (Cohere), Developer Tools (Databricks), Agent Platforms (GitLab).


What It Does

Perl/Mason Code  →  Parser  →  AST  →  Transformer  →  TypeScript/React/Node.js
                                    ↓
                              LLM (Claude/GPT/Gemini) for complex patterns
  • Analyzes RT Perl modules and Mason templates
  • Transforms to production-ready TypeScript: models, controllers, routes, React components
  • Validates API compatibility and business logic preservation
  • Optional LLM mode for complex patterns (multi-provider, consensus mode)

Quick Start

# Install
npm install

# Analyze a Perl module
npx tsx src/cli.ts analyze examples/input/User.pm

# Transform to TypeScript (no LLM required)
npx tsx src/cli.ts transform examples/input/User.pm -o ./output

# With LLM for complex transformations (add API keys to .env)
cp .env.example .env   # then add your keys
npx tsx src/cli.ts transform examples/input/User.pm -o ./output --llm best

Key Features

Feature Description
Multi-LLM Support Claude, GPT-4, Gemini with consensus mode for accuracy
RT Pattern Recognition Error tuples, SUPER:: calls, localization, ACL checks
Production Ready Error recovery, circuit breaker, metrics, code optimization
Validation Method coverage, API compatibility, behavioral checks

Example Transformation

Input (Perl):

sub Create {
    my $self = shift;
    my %args = (Name => '', EmailAddress => '', @_);
    return (0, $self->loc("No name provided")) unless $args{Name};
    # ... database insert
}

Output (TypeScript):

async Create(args: UserCreateArgs): Promise<[boolean, string]> {
  if (!args.name) return [false, this.loc("No name provided")];
  // Type-safe implementation with RT semantics preserved
}

Architecture

src/
├── parser/          # Perl & Mason parsing
├── transformer/     # AST → TypeScript generation
├── llm/             # Multi-provider LLM orchestration
├── validator/       # Compatibility validation
├── optimization/    # Dead code elimination, memoization
└── error-recovery/  # Circuit breaker, retry, fallbacks

Tech Stack

  • Runtime: Node.js 18+, TypeScript 5
  • LLMs: Anthropic Claude, OpenAI GPT-4, Google Gemini
  • Output: React, Express, Prisma/Sequelize

Performance (from integration tests)

  • Transformation: ~33,600 lines/second
  • Size reduction: ~38% after optimization
  • Accuracy: 85%+ on real RT::User (3,309 lines)

Author

Himanshu Tayal — hanutayal@gmail.com

Ex-AWS Principal PM (Developer Tools, GenAI), Microsoft Teams, ReRite founder. Building tools to modernize legacy software at scale.


License

MIT

About

AI-powered legacy code modernization — transforms Perl/Mason codebases to TypeScript/React/Node.js using LLMs

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages