@netoalmanca/advpl-sensei 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/agents/changelog-generator.md +63 -0
  2. package/agents/code-generator.md +215 -0
  3. package/agents/code-reviewer.md +145 -0
  4. package/agents/debugger.md +83 -0
  5. package/agents/doc-generator.md +67 -0
  6. package/agents/docs-reference.md +86 -0
  7. package/agents/migrator.md +84 -0
  8. package/agents/process-consultant.md +97 -0
  9. package/agents/refactorer.md +75 -0
  10. package/agents/sx-configurator.md +67 -0
  11. package/commands/changelog.md +66 -0
  12. package/commands/diagnose.md +67 -0
  13. package/commands/docs.md +81 -0
  14. package/commands/document.md +67 -0
  15. package/commands/explain.md +60 -0
  16. package/commands/generate.md +111 -0
  17. package/commands/migrate.md +81 -0
  18. package/commands/process.md +111 -0
  19. package/commands/refactor.md +65 -0
  20. package/commands/review.md +60 -0
  21. package/commands/sxgen.md +98 -0
  22. package/commands/test.md +103 -0
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +143 -0
  26. package/dist/index.js.map +1 -0
  27. package/package.json +30 -0
  28. package/skills/advpl-code-generation/SKILL.md +163 -0
  29. package/skills/advpl-code-generation/patterns-fwformbrowse.md +485 -0
  30. package/skills/advpl-code-generation/patterns-jobs.md +519 -0
  31. package/skills/advpl-code-generation/patterns-mvc.md +765 -0
  32. package/skills/advpl-code-generation/patterns-pontos-entrada.md +708 -0
  33. package/skills/advpl-code-generation/patterns-rest.md +974 -0
  34. package/skills/advpl-code-generation/patterns-soap.md +639 -0
  35. package/skills/advpl-code-generation/patterns-treport.md +481 -0
  36. package/skills/advpl-code-generation/patterns-workflow.md +779 -0
  37. package/skills/advpl-code-generation/templates-classes.md +1096 -0
  38. package/skills/advpl-code-review/SKILL.md +72 -0
  39. package/skills/advpl-code-review/rules-best-practices.md +444 -0
  40. package/skills/advpl-code-review/rules-modernization.md +290 -0
  41. package/skills/advpl-code-review/rules-performance.md +333 -0
  42. package/skills/advpl-code-review/rules-security.md +302 -0
  43. package/skills/advpl-debugging/SKILL.md +265 -0
  44. package/skills/advpl-debugging/common-errors.md +1124 -0
  45. package/skills/advpl-debugging/performance-tips.md +768 -0
  46. package/skills/advpl-refactoring/SKILL.md +139 -0
  47. package/skills/advpl-to-tlpp-migration/SKILL.md +293 -0
  48. package/skills/advpl-to-tlpp-migration/migration-checklist.md +122 -0
  49. package/skills/advpl-to-tlpp-migration/migration-rules.md +265 -0
  50. package/skills/changelog-patterns/SKILL.md +99 -0
  51. package/skills/code-explanation/SKILL.md +66 -0
  52. package/skills/documentation-patterns/SKILL.md +172 -0
  53. package/skills/embedded-sql/SKILL.md +379 -0
  54. package/skills/probat-testing/SKILL.md +226 -0
  55. package/skills/probat-testing/patterns-unit-tests.md +614 -0
  56. package/skills/protheus-business/SKILL.md +92 -0
  57. package/skills/protheus-business/modulo-compras.md +780 -0
  58. package/skills/protheus-business/modulo-contabilidade.md +874 -0
  59. package/skills/protheus-business/modulo-estoque.md +876 -0
  60. package/skills/protheus-business/modulo-faturamento.md +800 -0
  61. package/skills/protheus-business/modulo-financeiro.md +1015 -0
  62. package/skills/protheus-business/modulo-fiscal.md +749 -0
  63. package/skills/protheus-business/modulo-manutencao.md +848 -0
  64. package/skills/protheus-business/modulo-pcp.md +743 -0
  65. package/skills/protheus-reference/SKILL.md +119 -0
  66. package/skills/protheus-reference/native-functions.md +7029 -0
  67. package/skills/protheus-reference/rest-api-reference.md +1758 -0
  68. package/skills/protheus-reference/restricted-functions.md +265 -0
  69. package/skills/protheus-reference/sx-dictionary.md +854 -0
  70. package/skills/sx-configuration/SKILL.md +184 -0
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: sx-configuration
3
+ description: Use when generating SX dictionary configuration scripts for TOTVS Protheus - SX3 fields, SIX indexes, SX1 questions, SX5 generic tables, SX7 triggers
4
+ ---
5
+
6
+ # SX Configuration
7
+
8
+ ## Overview
9
+
10
+ Templates and validation rules for generating Protheus data dictionary configuration scripts. Covers SX3 (fields), SIX (indexes), SX1 (report questions), SX5 (generic tables), and SX7 (triggers).
11
+
12
+ ## When to Use
13
+
14
+ - Creating new custom fields for a table
15
+ - Defining indexes for custom tables
16
+ - Setting up report parameter questions
17
+ - Creating generic lookup tables
18
+ - Configuring field triggers
19
+
20
+ ## SX3 — Field Definition
21
+
22
+ ### Required Fields
23
+
24
+ | Field | Description | Example |
25
+ |-------|-------------|---------|
26
+ | X3_ARQUIVO | Table alias | ZA1 |
27
+ | X3_ORDEM | Field order (2 digits) | 01 |
28
+ | X3_CAMPO | Field name (ALIAS_FIELD) | ZA1_CODIGO |
29
+ | X3_TIPO | Type: C, N, D, L, M | C |
30
+ | X3_TAMANHO | Size | 6 |
31
+ | X3_DECIMAL | Decimal places (for N) | 0 |
32
+ | X3_TITULO | Title pt-BR (max 15 chars) | Codigo |
33
+ | X3_TITSPA | Title es (max 15 chars) | Codigo |
34
+ | X3_TITENG | Title en (max 15 chars) | Code |
35
+ | X3_DESCRIC | Description pt-BR | Codigo da OS |
36
+ | X3_DESCSPA | Description es | Codigo de la OS |
37
+ | X3_DESCENG | Description en | OS Code |
38
+ | X3_PICTURE | Display format | @! |
39
+ | X3_VALID | Validation expression | NaoVazio() |
40
+ | X3_USADO | In use (Sim/Nao) | Sim |
41
+ | X3_OBRIGAT | Required (Sim/Nao) | Sim |
42
+ | X3_BROWSE | Show in browse (Sim/Nao) | Sim |
43
+ | X3_VISUAL | Edit mode: Alterar/Visualizar | Alterar |
44
+ | X3_CONTEXT | Context: Real/Virtual | Real |
45
+ | X3_CBOX | Combo options (val1=desc1;val2=desc2) | |
46
+ | X3_RELACAO | Initial value expression | |
47
+ | X3_F3 | F3 lookup alias | SA1 |
48
+ | X3_VLDUSER | User validation expression | |
49
+ | X3_TRIGGER | Has trigger (Sim/Nao) | Nao |
50
+
51
+ ### Validation Rules
52
+
53
+ | Rule | Condition | Action |
54
+ |------|-----------|--------|
55
+ | Field name format | Must be ALIAS_XXXXXX (6 chars after underscore) | Error if invalid |
56
+ | Type C size | 1-254 characters | Warn if > 100 |
57
+ | Type N size | Max 18 digits including decimal | Error if > 18 |
58
+ | Type D size | Always 8 | Auto-set to 8 |
59
+ | Type L size | Always 1 | Auto-set to 1 |
60
+ | Type M size | Always 10 | Auto-set to 10 |
61
+ | Picture for C | @! (uppercase), @R (mask), or custom | Suggest @! for codes |
62
+ | Picture for N | @E 999,999,999.99 (adjust to size) | Auto-generate from size/decimal |
63
+ | Picture for D | (none needed) | Leave empty |
64
+ | Required + Validation | If X3_OBRIGAT = Sim, add NaoVazio() to X3_VALID | Auto-add |
65
+ | F3 lookup | If X3_F3 set, validation should include ExistCpo | Suggest adding |
66
+ | CBOX + Validation | If X3_CBOX set, add Pertence() to X3_VALID | Auto-add |
67
+ | Auto-increment | If primary key, set X3_RELACAO = GetSXENum() | Suggest for first field |
68
+ | Trigger | If F3 set and related display field needed, generate SX7 | Auto-generate |
69
+
70
+ ### Common Validations
71
+
72
+ | Validation | When to use | Syntax |
73
+ |------------|------------|--------|
74
+ | NaoVazio() | Required field | NaoVazio() |
75
+ | ExistCpo(alias, M->field) | Foreign key lookup | ExistCpo("SA1", M->ZA1_CLIENT) |
76
+ | ExistChav(alias, M->field, order) | Unique key check | ExistChav("ZA1", M->ZA1_CODIGO, 1) |
77
+ | Pertence(values) | Combo validation | Pertence("1234") |
78
+ | Positivo() | Must be > 0 | Positivo() |
79
+ | Vazio() .Or. ExistCpo() | Optional foreign key | Vazio() .Or. ExistCpo("SA1", M->ZA1_CLIENT) |
80
+
81
+ ### Common Pictures
82
+
83
+ | Type | Picture | Example display |
84
+ |------|---------|----------------|
85
+ | Code (uppercase) | @! | ABC123 |
86
+ | CNPJ | @R 99.999.999/9999-99 | 12.345.678/0001-90 |
87
+ | CPF | @R 999.999.999-99 | 123.456.789-00 |
88
+ | Phone | @R (99) 99999-9999 | (11) 98765-4321 |
89
+ | Currency | @E 999,999,999.99 | 1,234.56 |
90
+ | Percentage | @E 999.99 | 15.50 |
91
+
92
+ ## SIX — Index Definition
93
+
94
+ ### Required Fields
95
+
96
+ | Field | Description | Example |
97
+ |-------|-------------|---------|
98
+ | INDICE | Table alias | ZA1 |
99
+ | ORDEM | Index order number | 1 |
100
+ | CHAVE | Key expression (concatenated fields) | ZA1_FILIAL + ZA1_CODIGO |
101
+ | DESCRICAO | Description pt-BR | Codigo |
102
+ | DESCSPA | Description es | Codigo |
103
+ | DESCENG | Description en | Code |
104
+ | NICKNAME | Index nickname | ZA1_CODIGO |
105
+ | SHOWPESQ | Show in search (Sim/Nao) | Sim |
106
+
107
+ ### Rules
108
+ - Index 1 is ALWAYS the primary key (FILIAL + unique field)
109
+ - FILIAL must be the first component of every index
110
+ - Nickname must be unique within the table
111
+ - Order must be sequential starting from 1
112
+
113
+ ## SX1 — Report Questions
114
+
115
+ ### Required Fields
116
+
117
+ | Field | Description | Example |
118
+ |-------|-------------|---------|
119
+ | X1_GRUPO | Group name (matches report alias) | ZA1 |
120
+ | X1_ORDEM | Question order (2 digits) | 01 |
121
+ | X1_PERGUNT | Question text pt-BR | Data Abertura De |
122
+ | X1_PERGSPA | Question text es | Fecha Apertura De |
123
+ | X1_PERGENG | Question text en | Open Date From |
124
+ | X1_TIPO | Type: C, N, D | D |
125
+ | X1_TAMANHO | Field size | 8 |
126
+ | X1_GSC | Get/Select/Combo: G, S, C | G |
127
+ | X1_VALID | Validation expression | |
128
+ | X1_DEF01 | Default value | Space(8) |
129
+ | X1_F3 | F3 lookup (for type C) | SA1 |
130
+ | X1_HELP | Help text | Data inicial |
131
+
132
+ ### Rules
133
+ - Questions come in pairs for range filters (De/Ate)
134
+ - Type D always has size 8
135
+ - Default for "De" date: Space(8) or first day of month
136
+ - Default for "Ate" date: dDataBase or last day of month
137
+ - Default for "De" char: Space(size)
138
+ - Default for "Ate" char: Replicate("Z", size)
139
+ - If combo (C), X1_DEF01 contains the default option value
140
+ - X1_GSC: G=Get (text input), S=Select (not common), C=Combo
141
+
142
+ ## SX5 — Generic Tables
143
+
144
+ ### Required Fields
145
+
146
+ | Field | Description | Example |
147
+ |-------|-------------|---------|
148
+ | X5_FILIAL | Branch (usually empty for global) | |
149
+ | X5_TABELA | Table code (2 chars) | ZZ |
150
+ | X5_CHAVE | Key value (2 chars) | 01 |
151
+ | X5_DESCRI | Description pt-BR | Preventiva |
152
+ | X5_DESCSPA | Description es | Preventiva |
153
+ | X5_DESCENG | Description en | Preventive |
154
+
155
+ ### Rules
156
+ - Table code: 2 uppercase characters (use Z prefix for custom: ZA, ZB, ZZ, etc.)
157
+ - Key: 2 characters, sequential (01, 02, 03...)
158
+ - To use in code: GetSX5("ZZ", "01") or X5DESCRI("ZZ", "01")
159
+
160
+ ## SX7 — Triggers
161
+
162
+ ### Required Fields
163
+
164
+ | Field | Description | Example |
165
+ |-------|-------------|---------|
166
+ | X7_CAMPO | Source field | ZA1_CLIENT |
167
+ | X7_SEQUENC | Sequence (3 digits) | 001 |
168
+ | X7_REGRA | Expression to evaluate | Posicione("SA1", 1, xFilial("SA1") + M->ZA1_CLIENT, "A1_NOME") |
169
+ | X7_CDOMIN | Domain field (target to fill) | ZA1_NMCLI |
170
+ | X7_TIPO | Type: P=Primary | P |
171
+ | X7_SEEK | Seek expression | xFilial("SA1") + M->ZA1_CLIENT |
172
+ | X7_ALIAS | Lookup alias | SA1 |
173
+ | X7_ORDEM | Index order for seek | 1 |
174
+ | X7_CHTEFIL | Check branch (Sim/Nao) | Sim |
175
+
176
+ ### Rules
177
+ - Triggers fire when source field changes
178
+ - Posicione() is the standard function for lookups
179
+ - Always include xFilial() in the seek expression
180
+ - Sequence allows multiple triggers on the same field
181
+
182
+ ## Output Format
183
+
184
+ Scripts are formatted as key-value blocks, one field definition per block, separated by dashes. This format is human-readable and can be used as reference for manual configuration in the Configurador or for import scripts.