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
17613 skills10 agents13 commands2 hooks
Install
> /plugin marketplace add thalysjuvenal/advpl-specialist
> /plugin install advpl-specialist@advpl-specialist-marketplace

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/migrate

Context preview

What this command does when you run it.

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

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
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:

Get the whole plugin