Neural Inverse is Open Source →
GuidesLegacy Modernisation
GuidesOpen Source ContributingLegacy Modernisation

Legacy Modernisation

Open with Cmd+Alt+M. A full migration platform for moving legacy codebases to modern languages without losing business logic.

Source: src/vs/workbench/contrib/neuralInverseModernisation/


Overview

The modernisation engine is a 5-stage pipeline that runs entirely in the IDE:

Discovery -> Planning -> Resolution -> Translation -> Cutover

Each stage produces artifacts that feed into the next. A persistent Knowledge Base stores every decision for auditability.


Stage 1: Discovery

Scans source trees and extracts everything needed to plan the migration.

30+ languages supported: COBOL, PL/SQL, RPG, Natural, FORTRAN, Assembler, AUTOSAR ARXML, CAN DBC, IEC 61131-3 (Structured Text), TTCN-3, plus all mainstream languages (Java, C#, Python, TypeScript, Go, Rust, etc.)

What it extracts:

  • Dependency graphs (imports, includes, calls)
  • Cyclomatic complexity per unit
  • Tech debt categories (17 generic + 14 firmware/industrial)
  • Regulated data patterns (PCI-DSS, GDPR, HIPAA, SOX, ISO 26262, IEC 61850, 3GPP)
  • GRC snapshot (violation counts, blocking violations, severity distribution)
  • API surface detection
  • Data schema extraction
  • Market-vertical classification (automotive, safety, telecom, energy, industrial OT)

Key files:

  • browser/engine/discovery/languageDetector.ts
  • browser/engine/discovery/unitDecomposer.ts
  • browser/engine/discovery/dependencyExtractor.ts
  • browser/engine/discovery/complexityAnalyzer.ts
  • browser/engine/discovery/techDebtAnalyzer.ts
  • browser/engine/discovery/regulatedDataScanner.ts

Stage 2: Planning

Builds a migration roadmap with CPM (Critical Path Method) scheduling.

7 phases: foundation -> schema -> core-logic -> API layer -> integration -> compliance -> cutover

Features:

  • 12+ blocker types (including AUTOSAR RTE dependency, E2E protection gap, ASIL decomposition break, GOOSE protection relay)
  • Market-vertical compliance gates (automotive ASIL-D, energy GOOSE isolation, telecom 3GPP key externalisation)
  • Effort estimation with safety-critical language surcharges
  • API compatibility gates between phases

Stage 3 is locked until the user explicitly approves the plan.


Stage 3: Source Resolution

Prepares each migration unit for translation by inlining its dependencies so the unit is self-contained.

Language-specific resolvers:

  • COBOL: copybook inlining with cycle detection, CALL graph resolution
  • PL/SQL: %TYPE/%ROWTYPE inline expansion, package call headers
  • Java: @EJB/@Autowired context injection
  • RPG: /COPY + /INCLUDE expansion, CALL context
  • Natural: USING DA / INCLUDE / CALLNAT resolution
  • Generic: TS, Python, Go, Rust, C#, Kotlin, Scala import inlining

Scheduling: leaf-nodes-first with risk priority and configurable concurrency.


Stage 4: Translation

Converts source code using language-pair profiles with deep idiom mappings.

36 translation profiles including:

  • COBOL -> Java (32 idiom mappings)
  • PL/SQL -> TypeScript
  • RPG -> Java
  • Natural -> Java
  • FORTRAN -> Python
  • Angular 1 -> Angular 18
  • Vue 2 -> Vue 3
  • 25 firmware profiles (bare-metal -> FreeRTOS/Zephyr, AUTOSAR CP -> AP, CAN DBC -> CANopen, IEC 61850 -> OPC-UA, etc.)

Pipeline per unit:

  1. Build translation context (6-priority budget: source, types, interfaces, patterns, rules, annotations)
  2. Construct prompt with language-pair idioms
  3. Send to LLM
  4. Parse response (4-strategy extraction)
  5. Verify (8 checks: non-empty, no placeholders, no truncation, balanced braces, length sanity)
  6. Record decisions (naming, type mapping, rule interpretation)

Stage 5: Cutover

Final step: write translated files to the target tree.

  • 8-point readiness gate (4 blocking, 2 warning, 2 info)
  • Audit bundle export with FNV-1a chain integrity hash
  • Verifiable bundle integrity (verifyAuditBundleIntegrity())
  • File writing via VS Code file service

Knowledge Base

Persistent store that survives IDE restarts:

What it storesWhy
Translation results + confidence scoresTrack quality per unit
Type mapping decisionsConsistency across units
Naming decisionsDomain glossary enforcement
Glossary termsShared vocabulary
Compliance gate resultsAudit trail
CheckpointsSnapshot + restore at any point
Audit logEvery action recorded
AnnotationsHuman reviewer notes

Importable/exportable as JSON for team sharing or backup.


Session Model

modernisationSessionService.ts manages:

  • Sources (one or many legacy codebases)
  • Targets (one or many target projects)
  • Topology — flexible source/target count based on migration pattern
  • Current stage — gates progression
  • Plan approval — locks migration until plan is approved

30+ migration pattern presets covering every common migration shape.


Autonomy Engine

Optional autonomous execution for unattended migration:

  • Auto-approval policies per tool type
  • Concurrent sub-task scheduling with configurable limits
  • Batch progress events for UI updates
  • Configurable via .neuralinverseagent workspace config

Contributing

Adding a New Source Language

  1. discovery/languageDetector.ts — file extension map + heuristic detection
  2. discovery/unitDecomposer.ts — how to split files into migration units
  3. discovery/dependencyExtractor.ts — import/include patterns
  4. discovery/fileWalker.ts — add extensions to SOURCE_EXTS
  5. discovery/complexityAnalyzer.ts — cyclomatic complexity patterns
  6. discovery/techDebtAnalyzer.ts — language-specific debt detectors
  7. discovery/migrationEffortEstimator.ts — difficulty rating

Adding a Translation Profile

Add to browser/engine/translation/impl/languagePairRegistry.ts:

{
  id: 'source-to-target',
  sourceLanguage: 'source',
  targetLanguage: 'target',
  description: 'Migrate Source to Target',
  idiomMappings: [
    { sourceConstruct: '...', targetConstruct: '...', notes: '...' },
  ],
  frameworkMappings: ['...'],
  commonPitfalls: ['...'],
}

Adding a Source Resolver

Add to browser/engine/resolution/ following the existing pattern (see cobolCopybookInliner.ts as reference). Register in resolutionRouter.ts language dispatch table.


Was this page helpful?