$npx -y skills add totvs/engpro-advpl-tlpp-skills --skill advpl-tlpp-compileCompile AdvPL/TLPP sources (.prw, .prg, .prx, .tlpp, .ppx, .ppp, .apw, .aph, .apl, .ahu and resources) inside VS Code using the TOTVS Developer Studio (tds-vscode) extension and the servers.json connection registry. Orchestrates the full flow: verifies the TOTVS.tds-vscode extens
| 1 | # AdvPL/TLPP Compile (tds-vscode) |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Compile AdvPL and TLPP source files from inside VS Code using the **TOTVS Developer Studio for VSCode** extension (`TOTVS.tds-vscode`). Compilation in the Protheus ecosystem requires a connected and authenticated AppServer: the extension reads its connection registry from `servers.json`, sends the source to the server's RPO (Repository of Programs/Objects), and returns the compilation result. |
| 6 | |
| 7 | This skill orchestrates the complete path so a single "compile" request works end-to-end even on a fresh machine: |
| 8 | |
| 9 | 1. Ensure the extension is installed (install it if missing). |
| 10 | 2. Ensure a server is configured in `servers.json` (configure it with the user if missing). |
| 11 | 3. Pick the target server (ask the user when more than one exists). |
| 12 | 4. Connect and authenticate (the **user** types the password — it is never exposed to the agent). |
| 13 | 5. Open the target source in the editor (required before a file-scope compile). |
| 14 | 6. Run the build/rebuild command for the file, folder, or workspace. |
| 15 | 7. Report the result and surface any compilation errors. |
| 16 | |
| 17 | ## When to Use |
| 18 | |
| 19 | Use this skill when: |
| 20 | |
| 21 | - The user asks to **compile** or **recompile** an AdvPL/TLPP source (`compile`, `recompile`, `build`, `compilar`, `enviar para o RPO`). |
| 22 | - A code-generation, migration, or refactoring skill just produced/changed `.prw`, `.prg`, `.prx`, `.tlpp`, `.ppx`, `.ppp`, `.apw`, `.aph`, `.apl`, or `.ahu` files that must be sent to the AppServer. |
| 23 | - The user wants to validate that a source compiles cleanly against a server. |
| 24 | - The tds-vscode extension is not yet installed or configured and the user wants to start compiling. |
| 25 | |
| 26 | **Do NOT use when:** |
| 27 | |
| 28 | - The user only wants static analysis / linting without sending to the RPO. |
| 29 | - The target language is not AdvPL/TLPP/4GL. |
| 30 | - The user explicitly wants a command-line (`tds-cli` / `advpls`) build outside VS Code. |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | ## CRITICAL — Agent Execution Rules |
| 35 | |
| 36 | > **These rules are MANDATORY.** |
| 37 | |
| 38 | 1. **NEVER ask for, read, store, echo, or write the AppServer password.** Authentication is interactive: the user types the password directly in the VS Code connection prompt. If a step needs the password, instruct the user to type it in the prompt and wait — do not collect it with any tool. |
| 39 | 2. **ALWAYS use the extension UI to register and connect servers.** Never edit `servers.json` by hand. Server registration goes through the *Add Server* assistant and connection goes through the connection prompt, so the extension validates the data and fills generated fields (`id`, `buildVersion`, `secure`, `token`) itself. |
| 40 | 3. **NEVER write `token`, `savedTokens`, or `authorizationtoken` values into `servers.json`.** Those are generated by the extension after a successful connection. The agent does not write to `servers.json` at all — it only reads it to detect existing servers. |
| 41 | 4. **Ensure the source is CP1252 before compiling.** The Protheus compiler only accepts Windows-1252 files. If the file was created/edited by an AI agent (UTF-8), run the `utf8-to-cp1252-conversion` skill first, otherwise compilation fails with garbled characters. |
| 42 | 5. **Always confirm the target server with the user when more than one is registered.** Never guess. |
| 43 | 6. **When this skill runs as a follow-up to code generation/migration/refactoring, ASK the user whether they want to compile before starting.** Do not auto-compile silently after another skill produced code. |
| 44 | 7. **Read the result before declaring success.** A command running without error is NOT proof of a successful compile — check the compilation output/Problems for errors and warnings. |
| 45 | |
| 46 | --- |
| 47 | |
| 48 | ## Bundled Reference File |
| 49 | |
| 50 | This skill uses progressive disclosure. Read the reference on demand: |
| 51 | |
| 52 | | Reference File | When to Read | Content | |
| 53 | | --- | --- | --- | |
| 54 | | [references/tds-vscode-reference.md](references/tds-vscode-reference.md) | Whenever you need an exact command ID, the `servers.json` schema/location per OS, the list of compilable extensions, or troubleshooting gui |