Skip to content
Development
Command

/migrate

Migrate ADVPL procedural code to TLPP object-oriented code with classes, namespaces, and modern patterns

From plugin
advpl-specialist
19514 skills10 agents14 commands2 hooks
> /plugin marketplace add thalysjuvenal/advpl-specialist
> /plugin install advpl-specialist@advpl-specialist-marketplace

Command definition

migrate.md
description: Migrate ADVPL procedural code to TLPP object-oriented code with classes, namespaces, and modern patterns
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent, WebSearch, WebFetch
argument-hint: "<file.prw> [--output file.tlpp] [--dry-run]"

/advpl-specialist:migrate

**IMPORTANT:** Always respond in the same language the user is writing in. If the user writes in Portuguese, respond in Portuguese. If in English, respond in English. Adapt all explanations and suggestions to the user's language. Code comments may remain in English or match the user's language.

Convert ADVPL procedural code to TLPP with object-oriented patterns.

Usage

/advpl-specialist:migrate <file.prw> [options]

Options

| Flag | Description | Default | |------|------------|---------| | `--output` | Output .tlpp file path | Same name with .tlpp extension | | `--dry-run` | Show migration plan without generating files | false | | `--keep-original` | Keep the original .prw file | true | | `--wrapper` | Generate backward compatibility wrapper | true | | `--namespace` | Override namespace | Auto-detect from module |

Process

**MANDATORY: Always enter planning mode before migrating code. Never skip planning.**

Analysis Phase

1. **Read source file** - Read the .prw file completely 2. **Analyze structure** - Identify functions, dependencies, shared variables 3. **Search for callers** - Grep codebase for `u_FunctionName` references

Planning Phase (REQUIRED)

4. **Load reference** - Read `skills/advpl-to-tlpp-migration/reference.md` for rules and checklist 5. **Enter plan mode** - Use `EnterPlanMode` to create a structured migration plan 6. **Design class structure** - Map functions to classes and methods 7. **Present plan** - Show the user a detailed migration plan including:

  • Source file analysis (functions found, dependencies, shared variables)
  • External callers that will be impacted
  • Target class structure (class name, namespace, properties, methods)
  • Mapping: which function becomes which method (public/private)
  • Private/Public variables to convert to class properties
  • Includes to update (TOTVS.CH -> tlpp-core.th, etc.)
  • Whether a backward compatibility wrapper is needed
  • Any risks or breaking changes

8. **Wait for approval** - The user must approve the plan before any code is written. If the user requests changes, revise the plan. 9. **If --dry-run** - Stop here after showing the plan 10. **Exit plan mode** - Use `ExitPlanMode` after approval

Implementation Phase (only after approval)

11. **Execute migration** - Generate .tlpp file(s) following the approved plan and `skills/advpl-to-tlpp-migration/reference.md` 12. **Generate wrapper** - Create backward compatibility .prw wrapper if --wrapper 13. **Run checklist** - Validate against migration-checklist.md 14. **Report** - Show summary of changes

Examples

# Migrate a file (shows plan first, then generates)
/advpl-specialist:migrate src/FATA001.prw

# Preview migration without generating files
/advpl-specialist:migrate src/FATA001.prw --dry-run

# Specify output path and namespace
/advpl-specialist:migrate src/FATA001.prw --output src/tlpp/PedidoService.tlpp --namespace mycompany.faturamento

# Migrate without backward compatibility wrapper
/advpl-specialist:migrate src/FATA001.prw --wrapper false

Output

  • `.tlpp` file with migrated class-based code
  • Optional `.prw` wrapper for backward compatibility
  • Migration summary with what changed and why
Read more
@thalysjuvenal
Ships withadvpl-specialist

Plugin para Claude Code especializado em ADVPL e TLPP para desenvolvimento no ecossistema TOTVS Protheus — para desenvolvedores e consultores funcionais. Documentacao completa:

19519 skills10 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
195
Star history of thalysjuvenal/advpl-specialist on GitHub, a chart by star-history.com

Other commands on advpl-specialist.

advpr

advpr

Command

Gera scripts de automação de testes ADVPR (Advanced Protheus Robot) - TestSuite, TestGroup, TestCase para rotinas MVC, ExecAuto,…

diagnose

diagnose

Command

Diagnose errors and problems in ADVPL/TLPP code - compilation errors, runtime errors, performance issues, and log analysis

docs

docs

Command

Look up Protheus documentation - native functions, SX data dictionary, REST APIs, MV parameters, and framework reference

generate

generate

Command

Generate ADVPL/TLPP code - functions, classes, MVC structures, REST APIs, Web Services, and entry points for TOTVS Protheus

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command