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 -> CutoverEach 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.tsbrowser/engine/discovery/unitDecomposer.tsbrowser/engine/discovery/dependencyExtractor.tsbrowser/engine/discovery/complexityAnalyzer.tsbrowser/engine/discovery/techDebtAnalyzer.tsbrowser/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:
- Build translation context (6-priority budget: source, types, interfaces, patterns, rules, annotations)
- Construct prompt with language-pair idioms
- Send to LLM
- Parse response (4-strategy extraction)
- Verify (8 checks: non-empty, no placeholders, no truncation, balanced braces, length sanity)
- 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 stores | Why |
|---|---|
| Translation results + confidence scores | Track quality per unit |
| Type mapping decisions | Consistency across units |
| Naming decisions | Domain glossary enforcement |
| Glossary terms | Shared vocabulary |
| Compliance gate results | Audit trail |
| Checkpoints | Snapshot + restore at any point |
| Audit log | Every action recorded |
| Annotations | Human 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
.neuralinverseagentworkspace config
Contributing
Adding a New Source Language
discovery/languageDetector.ts— file extension map + heuristic detectiondiscovery/unitDecomposer.ts— how to split files into migration unitsdiscovery/dependencyExtractor.ts— import/include patternsdiscovery/fileWalker.ts— add extensions to SOURCE_EXTSdiscovery/complexityAnalyzer.ts— cyclomatic complexity patternsdiscovery/techDebtAnalyzer.ts— language-specific debt detectorsdiscovery/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.