@netoalmanca/advpl-sensei 1.1.0 → 1.1.2

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.
@@ -1,19 +1,37 @@
1
1
  ---
2
2
  description: Generate changelog from ADVPL/TLPP code changes - analyzes diffs and produces structured release notes
3
3
  allowed-tools: Read, Glob, Grep, Bash, Agent, Skill
4
- argument-hint: "[--since commit|date] [--format markdown|txt] [--output path]"
4
+ parameters:
5
+ since:
6
+ type: string
7
+ description: "Ponto inicial para o changelog (commit hash, tag ou data YYYY-MM-DD)"
8
+ required: false
9
+ format:
10
+ type: string
11
+ enum: ["markdown", "txt"]
12
+ description: "Formato de saída do changelog"
13
+ required: false
14
+ output:
15
+ type: string
16
+ description: "Caminho do arquivo para salvar o changelog"
17
+ required: false
18
+ groupBy:
19
+ type: string
20
+ enum: ["file", "type", "module"]
21
+ description: "Agrupar entradas por arquivo, tipo ou módulo"
22
+ required: false
5
23
  ---
6
24
 
7
25
  **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.
8
26
 
9
- # /advpl-specialist:changelog
27
+ # /advpl-sensei:changelog
10
28
 
11
29
  Generate a structured changelog from code changes in ADVPL/TLPP files.
12
30
 
13
31
  ## Usage
14
32
 
15
33
  ```bash
16
- /advpl-specialist:changelog [options]
34
+ /advpl-sensei:changelog [options]
17
35
  ```
18
36
 
19
37
  ## Options
@@ -39,22 +57,22 @@ Generate a structured changelog from code changes in ADVPL/TLPP files.
39
57
 
40
58
  ```bash
41
59
  # Changelog from last commit
42
- /advpl-specialist:changelog
60
+ /advpl-sensei:changelog
43
61
 
44
62
  # Changelog since a specific commit
45
- /advpl-specialist:changelog --since abc1234
63
+ /advpl-sensei:changelog --since abc1234
46
64
 
47
65
  # Changelog since a date
48
- /advpl-specialist:changelog --since 2026-03-01
66
+ /advpl-sensei:changelog --since 2026-03-01
49
67
 
50
68
  # Changelog in plain text format
51
- /advpl-specialist:changelog --since v1.0.0 --format txt
69
+ /advpl-sensei:changelog --since v1.0.0 --format txt
52
70
 
53
71
  # Save changelog to a file
54
- /advpl-specialist:changelog --since v1.0.0 --output CHANGELOG.md
72
+ /advpl-sensei:changelog --since v1.0.0 --output CHANGELOG.md
55
73
 
56
74
  # Group by module instead of type
57
- /advpl-specialist:changelog --since v1.0.0 --group-by module
75
+ /advpl-sensei:changelog --since v1.0.0 --group-by module
58
76
  ```
59
77
 
60
78
  ## Output
@@ -1,10 +1,21 @@
1
1
  ---
2
2
  description: Diagnose errors and problems in ADVPL/TLPP code - compilation errors, runtime errors, performance issues, and log analysis
3
3
  allowed-tools: Read, Glob, Grep, Bash, Agent, Skill, WebSearch, WebFetch
4
- argument-hint: "<file|error-message> [--log logfile]"
4
+ parameters:
5
+ target:
6
+ type: string
7
+ description: "Caminho do arquivo, mensagem de erro ou arquivo de log para diagnóstico"
8
+ log:
9
+ type: string
10
+ description: "Caminho para um arquivo de log do Protheus"
11
+ required: false
12
+ verbose:
13
+ type: boolean
14
+ description: "Se deve fornecer um diagnóstico detalhado com explicações"
15
+ required: false
5
16
  ---
6
17
 
7
- # /advpl-specialist:diagnose
18
+ # /advpl-sensei:diagnose
8
19
 
9
20
  **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, error descriptions, and suggestions to the user's language. Code comments may remain in English or match the user's language.
10
21
 
@@ -13,7 +24,7 @@ Diagnose and resolve ADVPL/TLPP errors and problems.
13
24
  ## Usage
14
25
 
15
26
  ```bash
16
- /advpl-specialist:diagnose <target> [options]
27
+ /advpl-sensei:diagnose <target> [options]
17
28
  ```
18
29
 
19
30
  ## Modes
@@ -47,16 +58,16 @@ Diagnose and resolve ADVPL/TLPP errors and problems.
47
58
 
48
59
  ```bash
49
60
  # Analyze a source file for issues
50
- /advpl-specialist:diagnose src/FATA001.prw
61
+ /advpl-sensei:diagnose src/FATA001.prw
51
62
 
52
63
  # Diagnose a specific error message
53
- /advpl-specialist:diagnose "THREAD ERROR ([55889]) Variable does not exist: cCodCli"
64
+ /advpl-sensei:diagnose "THREAD ERROR ([55889]) Variable does not exist: cCodCli"
54
65
 
55
66
  # Analyze a Protheus log file
56
- /advpl-specialist:diagnose --log /var/protheus/console.log
67
+ /advpl-sensei:diagnose --log /var/protheus/console.log
57
68
 
58
69
  # Verbose diagnosis with full explanations
59
- /advpl-specialist:diagnose src/FATA001.prw --verbose
70
+ /advpl-sensei:diagnose src/FATA001.prw --verbose
60
71
  ```
61
72
 
62
73
  ## Output
package/commands/docs.md CHANGED
@@ -1,10 +1,23 @@
1
1
  ---
2
2
  description: Look up Protheus documentation - native functions, SX data dictionary, REST APIs, MV parameters, and framework reference
3
3
  allowed-tools: Read, Glob, Grep, Bash, Agent, Skill, WebSearch, WebFetch
4
- argument-hint: "<term> [--source tdn|local] [--type function|sx|api|param]"
4
+ parameters:
5
+ term:
6
+ type: string
7
+ description: "Termo de busca (função, tabela SX, parâmetro MV, API)"
8
+ source:
9
+ type: string
10
+ enum: ["local", "tdn", "both"]
11
+ description: "Fonte de busca: local, TDN (online) ou ambos"
12
+ required: false
13
+ type:
14
+ type: string
15
+ enum: ["function", "sx", "api", "param"]
16
+ description: "Filtrar por tipo: função, dicionário SX, API ou parâmetro MV"
17
+ required: false
5
18
  ---
6
19
 
7
- # /advpl-specialist:docs
20
+ # /advpl-sensei:docs
8
21
 
9
22
  **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.
10
23
 
@@ -13,7 +26,7 @@ Look up documentation for Protheus functions, APIs, tables, and parameters.
13
26
  ## Usage
14
27
 
15
28
  ```bash
16
- /advpl-specialist:docs <term> [options]
29
+ /advpl-sensei:docs <term> [options]
17
30
  ```
18
31
 
19
32
  ## Options
@@ -39,19 +52,19 @@ Look up documentation for Protheus functions, APIs, tables, and parameters.
39
52
 
40
53
  ```bash
41
54
  # Look up a function
42
- /advpl-specialist:docs FWExecView
55
+ /advpl-sensei:docs FWExecView
43
56
 
44
57
  # Look up a data dictionary table
45
- /advpl-specialist:docs SX2 --type sx
58
+ /advpl-sensei:docs SX2 --type sx
46
59
 
47
60
  # Look up a system parameter
48
- /advpl-specialist:docs MV_ESTADO --type param
61
+ /advpl-sensei:docs MV_ESTADO --type param
49
62
 
50
63
  # Force TDN search
51
- /advpl-specialist:docs MsExecAuto --source tdn
64
+ /advpl-sensei:docs MsExecAuto --source tdn
52
65
 
53
66
  # Look up REST API pattern
54
- /advpl-specialist:docs FWRest --type api
67
+ /advpl-sensei:docs FWRest --type api
55
68
  ```
56
69
 
57
70
  ## Output
@@ -1,19 +1,31 @@
1
1
  ---
2
2
  description: Generate technical documentation from ADVPL/TLPP source code - Protheus.doc headers, routine docs, API docs
3
3
  allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent, Skill, WebSearch, WebFetch
4
- argument-hint: "<file> [--type header|full|api] [--output path]"
4
+ parameters:
5
+ target:
6
+ type: string
7
+ description: "Caminho do arquivo ou diretório para gerar documentação"
8
+ type:
9
+ type: string
10
+ enum: ["header", "full", "api"]
11
+ description: "Tipo de documentação: cabeçalho Protheus.doc, completo ou API"
12
+ required: false
13
+ output:
14
+ type: string
15
+ description: "Caminho do arquivo para salvar a documentação"
16
+ required: false
5
17
  ---
6
18
 
7
19
  **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.
8
20
 
9
- # /advpl-specialist:document
21
+ # /advpl-sensei:document
10
22
 
11
23
  Generate technical documentation from existing ADVPL/TLPP source code.
12
24
 
13
25
  ## Usage
14
26
 
15
27
  ```bash
16
- /advpl-specialist:document <target> [options]
28
+ /advpl-sensei:document <target> [options]
17
29
  ```
18
30
 
19
31
  ## Options
@@ -45,19 +57,19 @@ Generate technical documentation from existing ADVPL/TLPP source code.
45
57
 
46
58
  ```bash
47
59
  # Generate complete routine documentation
48
- /advpl-specialist:document src/MATA461.prw
60
+ /advpl-sensei:document src/MATA461.prw
49
61
 
50
62
  # Generate just the Protheus.doc header
51
- /advpl-specialist:document src/MATA461.prw --type header
63
+ /advpl-sensei:document src/MATA461.prw --type header
52
64
 
53
65
  # Document a REST API endpoint
54
- /advpl-specialist:document src/ApiClientes.tlpp --type api
66
+ /advpl-sensei:document src/ApiClientes.tlpp --type api
55
67
 
56
68
  # Save documentation to a file
57
- /advpl-specialist:document src/MATA461.prw --output docs/MATA461.md
69
+ /advpl-sensei:document src/MATA461.prw --output docs/MATA461.md
58
70
 
59
71
  # Document all files in a directory
60
- /advpl-specialist:document src/
72
+ /advpl-sensei:document src/
61
73
  ```
62
74
 
63
75
  ## Output
@@ -1,19 +1,27 @@
1
1
  ---
2
2
  description: Explain ADVPL/TLPP code in plain language for developers and functional consultants
3
3
  allowed-tools: Read, Glob, Grep, Bash, Agent, Skill
4
- argument-hint: "<file|code> [--level junior|senior|funcional]"
4
+ parameters:
5
+ target:
6
+ type: string
7
+ description: "Caminho do arquivo ou snippet de código para explicar"
8
+ level:
9
+ type: string
10
+ enum: ["junior", "senior", "funcional"]
11
+ description: "Nível da audiência: iniciante, experiente ou consultor funcional"
12
+ required: false
5
13
  ---
6
14
 
7
15
  **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.
8
16
 
9
- # /advpl-specialist:explain
17
+ # /advpl-sensei:explain
10
18
 
11
19
  Explain ADVPL/TLPP code in plain language, adapted to the audience level.
12
20
 
13
21
  ## Usage
14
22
 
15
23
  ```bash
16
- /advpl-specialist:explain <target> [--level level]
24
+ /advpl-sensei:explain <target> [--level level]
17
25
  ```
18
26
 
19
27
  ## Levels
@@ -40,16 +48,16 @@ If `--level` is not provided, default to `junior`.
40
48
 
41
49
  ```bash
42
50
  # Explain code for a junior developer (default)
43
- /advpl-specialist:explain src/MATA461.prw
51
+ /advpl-sensei:explain src/MATA461.prw
44
52
 
45
53
  # Explain for a functional consultant
46
- /advpl-specialist:explain src/CustomFaturamento.prw --level funcional
54
+ /advpl-sensei:explain src/CustomFaturamento.prw --level funcional
47
55
 
48
56
  # Explain for a senior developer
49
- /advpl-specialist:explain src/JobProcessaNF.tlpp --level senior
57
+ /advpl-sensei:explain src/JobProcessaNF.tlpp --level senior
50
58
 
51
59
  # Explain a specific function
52
- /advpl-specialist:explain src/Utils.prw::fCalcDesconto
60
+ /advpl-sensei:explain src/Utils.prw::fCalcDesconto
53
61
  ```
54
62
 
55
63
  ## Output
@@ -1,10 +1,28 @@
1
1
  ---
2
2
  description: Generate ADVPL/TLPP code - functions, classes, MVC structures, REST APIs, Web Services, and entry points for TOTVS Protheus
3
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent, Skill, WebSearch, WebFetch
4
- argument-hint: "<type> [name] [--module module]"
3
+ parameters:
4
+ type:
5
+ type: string
6
+ enum: ["function", "class", "mvc", "rest", "ponto-entrada", "webservice", "treport", "fwformbrowse", "job", "workflow"]
7
+ description: "Tipo de código a ser gerado"
8
+ name:
9
+ type: string
10
+ description: "Nome da rotina ou classe"
11
+ module:
12
+ type: string
13
+ description: "Módulo do Protheus (FAT, COM, FIN, etc.)"
14
+ required: false
15
+ lang:
16
+ type: string
17
+ enum: ["advpl", "tlpp"]
18
+ description: "Linguagem desejada"
19
+ required: false
20
+ prompt:
21
+ type: string
22
+ description: "Instruções específicas sobre a lógica de negócio"
5
23
  ---
6
24
 
7
- # /advpl-specialist:generate
25
+ # /advpl-sensei:generate
8
26
 
9
27
  **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.
10
28
 
@@ -13,7 +31,7 @@ Generate new ADVPL or TLPP code following Protheus conventions and best practice
13
31
  ## Usage
14
32
 
15
33
  ```bash
16
- /advpl-specialist:generate <type> [name] [--module <module>]
34
+ /advpl-sensei:generate <type> [name] [--module <module>]
17
35
  ```
18
36
 
19
37
  ## Types
@@ -71,34 +89,34 @@ Generate new ADVPL or TLPP code following Protheus conventions and best practice
71
89
 
72
90
  ```bash
73
91
  # Create a User Function for billing module
74
- /advpl-specialist:generate function FATA050 --module FAT
92
+ /advpl-sensei:generate function FATA050 --module FAT
75
93
 
76
94
  # Create a TLPP service class
77
- /advpl-specialist:generate class PedidoService
95
+ /advpl-sensei:generate class PedidoService
78
96
 
79
97
  # Create complete MVC CRUD
80
- /advpl-specialist:generate mvc CadProduto --module EST
98
+ /advpl-sensei:generate mvc CadProduto --module EST
81
99
 
82
100
  # Create a REST API endpoint
83
- /advpl-specialist:generate rest ClienteAPI --lang tlpp
101
+ /advpl-sensei:generate rest ClienteAPI --lang tlpp
84
102
 
85
103
  # Create an entry point
86
- /advpl-specialist:generate ponto-entrada MT100LOK
104
+ /advpl-sensei:generate ponto-entrada MT100LOK
87
105
 
88
106
  # Create a SOAP Web Service
89
- /advpl-specialist:generate webservice WSPedido
107
+ /advpl-sensei:generate webservice WSPedido
90
108
 
91
109
  # Create a TReport report
92
- /advpl-specialist:generate treport RelProdutos --module EST
110
+ /advpl-sensei:generate treport RelProdutos --module EST
93
111
 
94
112
  # Create a FWFormBrowse screen
95
- /advpl-specialist:generate fwformbrowse CadFornecedores --module COM
113
+ /advpl-sensei:generate fwformbrowse CadFornecedores --module COM
96
114
 
97
115
  # Create a batch processing job
98
- /advpl-specialist:generate job JobProcessaNotas --module FAT
116
+ /advpl-sensei:generate job JobProcessaNotas --module FAT
99
117
 
100
118
  # Create an approval workflow
101
- /advpl-specialist:generate workflow AprovacaoPedido --module COM
119
+ /advpl-sensei:generate workflow AprovacaoPedido --module COM
102
120
  ```
103
121
 
104
122
  ## Output
@@ -1,10 +1,33 @@
1
1
  ---
2
2
  description: Migrate ADVPL procedural code to TLPP object-oriented code with classes, namespaces, and modern patterns
3
3
  allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent, Skill, WebSearch, WebFetch
4
- argument-hint: "<file.prw> [--output file.tlpp] [--dry-run]"
4
+ parameters:
5
+ target:
6
+ type: string
7
+ description: "Caminho do arquivo .prw para migrar para TLPP"
8
+ output:
9
+ type: string
10
+ description: "Caminho do arquivo .tlpp de saída"
11
+ required: false
12
+ dryRun:
13
+ type: boolean
14
+ description: "Mostrar plano de migração sem gerar arquivos"
15
+ required: false
16
+ keepOriginal:
17
+ type: boolean
18
+ description: "Manter o arquivo .prw original"
19
+ required: false
20
+ wrapper:
21
+ type: boolean
22
+ description: "Gerar wrapper de compatibilidade para chamadas antigas"
23
+ required: false
24
+ namespace:
25
+ type: string
26
+ description: "Namespace para a nova classe TLPP"
27
+ required: false
5
28
  ---
6
29
 
7
- # /advpl-specialist:migrate
30
+ # /advpl-sensei:migrate
8
31
 
9
32
  **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.
10
33
 
@@ -13,7 +36,7 @@ Convert ADVPL procedural code to TLPP with object-oriented patterns.
13
36
  ## Usage
14
37
 
15
38
  ```bash
16
- /advpl-specialist:migrate <file.prw> [options]
39
+ /advpl-sensei:migrate <file.prw> [options]
17
40
  ```
18
41
 
19
42
  ## Options
@@ -62,16 +85,16 @@ Convert ADVPL procedural code to TLPP with object-oriented patterns.
62
85
 
63
86
  ```bash
64
87
  # Migrate a file (shows plan first, then generates)
65
- /advpl-specialist:migrate src/FATA001.prw
88
+ /advpl-sensei:migrate src/FATA001.prw
66
89
 
67
90
  # Preview migration without generating files
68
- /advpl-specialist:migrate src/FATA001.prw --dry-run
91
+ /advpl-sensei:migrate src/FATA001.prw --dry-run
69
92
 
70
93
  # Specify output path and namespace
71
- /advpl-specialist:migrate src/FATA001.prw --output src/tlpp/PedidoService.tlpp --namespace mycompany.faturamento
94
+ /advpl-sensei:migrate src/FATA001.prw --output src/tlpp/PedidoService.tlpp --namespace mycompany.faturamento
72
95
 
73
96
  # Migrate without backward compatibility wrapper
74
- /advpl-specialist:migrate src/FATA001.prw --wrapper false
97
+ /advpl-sensei:migrate src/FATA001.prw --wrapper false
75
98
  ```
76
99
 
77
100
  ## Output
@@ -1,11 +1,18 @@
1
1
  ---
2
2
  description: Consult Protheus ERP business processes, module workflows, routines and integrations
3
3
  allowed-tools: Read, Glob, Grep, WebSearch, WebFetch, Skill, Bash, EnterPlanMode, ExitPlanMode, browser_navigate, browser_snapshot, browser_take_screenshot, browser_fill_form, browser_click, browser_close
4
- argument-hint: "<process|routine|module> [--type process|routine|module|integration]"
5
- agent: process-consultant
4
+ parameters:
5
+ query:
6
+ type: string
7
+ description: "Consulta sobre processo, rotina, módulo ou integração (ex: MATA410, fluxo de compras)"
8
+ type:
9
+ type: string
10
+ enum: ["process", "routine", "module", "integration"]
11
+ description: "Tipo de consulta: processo, rotina, módulo ou integração"
12
+ required: false
6
13
  ---
7
14
 
8
- # /advpl-specialist:process
15
+ # /advpl-sensei:process
9
16
 
10
17
  **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, process descriptions, and references to the user's language.
11
18
 
@@ -14,7 +21,7 @@ Consult Protheus ERP business processes, module workflows, routines, and integra
14
21
  ## Usage
15
22
 
16
23
  ```bash
17
- /advpl-specialist:process <query> [options]
24
+ /advpl-sensei:process <query> [options]
18
25
  ```
19
26
 
20
27
  ## Options
@@ -85,22 +92,22 @@ When the user needs more detail, load additional skills:
85
92
 
86
93
  ```bash
87
94
  # Understand a business process
88
- /advpl-specialist:process fluxo de compras
95
+ /advpl-sensei:process fluxo de compras
89
96
 
90
97
  # Look up a specific routine
91
- /advpl-specialist:process MATA410
98
+ /advpl-sensei:process MATA410
92
99
 
93
100
  # Understand a module
94
- /advpl-specialist:process modulo Faturamento --type module
101
+ /advpl-sensei:process modulo Faturamento --type module
95
102
 
96
103
  # Understand integration between modules
97
- /advpl-specialist:process integracao Compras Estoque --type integration
104
+ /advpl-sensei:process integracao Compras Estoque --type integration
98
105
 
99
106
  # Ask in natural language
100
- /advpl-specialist:process como funciona o processo de faturamento no Protheus?
107
+ /advpl-sensei:process como funciona o processo de faturamento no Protheus?
101
108
 
102
109
  # Look up financial process
103
- /advpl-specialist:process contas a pagar
110
+ /advpl-sensei:process contas a pagar
104
111
  ```
105
112
 
106
113
  ## Output
@@ -1,19 +1,26 @@
1
1
  ---
2
2
  description: Refactor ADVPL/TLPP code - extract functions, simplify logic, remove dead code, improve naming
3
3
  allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent, Skill, WebSearch, WebFetch
4
- argument-hint: "<file> [--dry-run]"
4
+ parameters:
5
+ target:
6
+ type: string
7
+ description: "Caminho do arquivo ou diretório para refatorar"
8
+ dryRun:
9
+ type: boolean
10
+ description: "Mostrar sugestões sem aplicar as alterações"
11
+ required: false
5
12
  ---
6
13
 
7
14
  **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.
8
15
 
9
- # /advpl-specialist:refactor
16
+ # /advpl-sensei:refactor
10
17
 
11
18
  Analyze and refactor ADVPL/TLPP code to improve structure without changing behavior.
12
19
 
13
20
  ## Usage
14
21
 
15
22
  ```bash
16
- /advpl-specialist:refactor <target> [options]
23
+ /advpl-sensei:refactor <target> [options]
17
24
  ```
18
25
 
19
26
  ## Options
@@ -49,13 +56,13 @@ Analyze and refactor ADVPL/TLPP code to improve structure without changing behav
49
56
 
50
57
  ```bash
51
58
  # Refactor a source file (interactive, with approval)
52
- /advpl-specialist:refactor src/FATA001.prw
59
+ /advpl-sensei:refactor src/FATA001.prw
53
60
 
54
61
  # Show suggestions without applying
55
- /advpl-specialist:refactor src/FATA001.prw --dry-run
62
+ /advpl-sensei:refactor src/FATA001.prw --dry-run
56
63
 
57
64
  # Refactor all files in a directory
58
- /advpl-specialist:refactor src/
65
+ /advpl-sensei:refactor src/
59
66
  ```
60
67
 
61
68
  ## Output
@@ -1,19 +1,27 @@
1
1
  ---
2
2
  description: Review ADVPL/TLPP code for best practices, performance, security, and modernization
3
3
  allowed-tools: Read, Glob, Grep, Bash, Agent, Skill, WebSearch, WebFetch
4
- argument-hint: "<file|directory> [--focus category]"
4
+ parameters:
5
+ target:
6
+ type: string
7
+ description: "Caminho do arquivo ou diretório para revisão"
8
+ focus:
9
+ type: string
10
+ enum: ["boas-praticas", "performance", "seguranca", "modernizacao", "all"]
11
+ description: "Foco da revisão: boas práticas, performance, segurança ou modernização"
12
+ required: false
5
13
  ---
6
14
 
7
15
  **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, error descriptions, and suggestions to the user's language. Code comments may remain in English or match the user's language.
8
16
 
9
- # /advpl-specialist:review
17
+ # /advpl-sensei:review
10
18
 
11
19
  Review ADVPL/TLPP code for best practices, performance, security, and modernization opportunities.
12
20
 
13
21
  ## Usage
14
22
 
15
23
  ```bash
16
- /advpl-specialist:review <target> [--focus category]
24
+ /advpl-sensei:review <target> [--focus category]
17
25
  ```
18
26
 
19
27
  ## Focus Categories
@@ -37,19 +45,19 @@ Review ADVPL/TLPP code for best practices, performance, security, and modernizat
37
45
 
38
46
  ```bash
39
47
  # Review a single source file (all categories)
40
- /advpl-specialist:review src/FATA001.prw
48
+ /advpl-sensei:review src/FATA001.prw
41
49
 
42
50
  # Review an entire directory focusing on performance
43
- /advpl-specialist:review src/ --focus performance
51
+ /advpl-sensei:review src/ --focus performance
44
52
 
45
53
  # Review REST endpoints for security issues
46
- /advpl-specialist:review src/REST/*.tlpp --focus seguranca
54
+ /advpl-sensei:review src/REST/*.tlpp --focus seguranca
47
55
 
48
56
  # Review current directory for modernization opportunities
49
- /advpl-specialist:review . --focus modernizacao
57
+ /advpl-sensei:review . --focus modernizacao
50
58
 
51
59
  # Review specific files for best practices
52
- /advpl-specialist:review src/MATA010.prw --focus boas-praticas
60
+ /advpl-sensei:review src/MATA010.prw --focus boas-praticas
53
61
  ```
54
62
 
55
63
  ## Output
package/commands/sxgen.md CHANGED
@@ -1,19 +1,31 @@
1
1
  ---
2
2
  description: Generate Protheus SX data dictionary configuration scripts - SX3 fields, SIX indexes, SX1 questions, SX5 generic tables
3
3
  allowed-tools: Read, Write, Glob, Grep, Bash, Agent, Skill
4
- argument-hint: "[--type sx3|six|sx1|sx5] [--output path]"
4
+ parameters:
5
+ description:
6
+ type: string
7
+ description: "Descrição em linguagem natural dos campos, índices ou perguntas (ex: Criar campos para ZA1...)"
8
+ type:
9
+ type: string
10
+ enum: ["sx3", "six", "sx1", "sx5"]
11
+ description: "Tipo de tabela SX: campos, índices, perguntas ou tabelas genéricas"
12
+ required: false
13
+ output:
14
+ type: string
15
+ description: "Caminho do arquivo para salvar o script gerado"
16
+ required: false
5
17
  ---
6
18
 
7
19
  **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.
8
20
 
9
- # /advpl-specialist:sxgen
21
+ # /advpl-sensei:sxgen
10
22
 
11
23
  Generate Protheus data dictionary configuration scripts for SX tables.
12
24
 
13
25
  ## Usage
14
26
 
15
27
  ```bash
16
- /advpl-specialist:sxgen [options]
28
+ /advpl-sensei:sxgen [options]
17
29
  ```
18
30
 
19
31
  Describe what you need in natural language after the command. The agent will parse your description and generate the configuration.
@@ -59,7 +71,7 @@ The command automatically:
59
71
 
60
72
  ```bash
61
73
  # Generate SX3 field definitions from description
62
- /advpl-specialist:sxgen --type sx3
74
+ /advpl-sensei:sxgen --type sx3
63
75
  Criar campos para tabela ZA1 - Ordens de Servico:
64
76
  - ZA1_CODIGO: codigo da OS, char 6, obrigatorio
65
77
  - ZA1_DESCRI: descricao do servico, char 40, obrigatorio
@@ -67,25 +79,25 @@ Criar campos para tabela ZA1 - Ordens de Servico:
67
79
  - ZA1_STATUS: status, char 1, combo 1=Aberta;2=Em Andamento;3=Concluida;4=Cancelada
68
80
 
69
81
  # Generate SIX index definitions
70
- /advpl-specialist:sxgen --type six
82
+ /advpl-sensei:sxgen --type six
71
83
  Indices para ZA1:
72
84
  - Indice 1: filial + codigo (unico)
73
85
  - Indice 2: filial + cliente + data abertura
74
86
 
75
87
  # Generate SX1 report questions
76
- /advpl-specialist:sxgen --type sx1
88
+ /advpl-sensei:sxgen --type sx1
77
89
  Perguntas para relatorio de OS (grupo ZA1):
78
90
  - Data abertura de/ate
79
91
  - Status de/ate
80
92
  - Cliente de/ate
81
93
 
82
94
  # Generate SX5 generic table
83
- /advpl-specialist:sxgen --type sx5
95
+ /advpl-sensei:sxgen --type sx5
84
96
  Tabela generica ZZ para tipos de servico:
85
97
  01=Preventiva, 02=Corretiva, 03=Instalacao
86
98
 
87
99
  # Save to file
88
- /advpl-specialist:sxgen --type sx3 --output config/ZA1-campos.txt
100
+ /advpl-sensei:sxgen --type sx3 --output config/ZA1-campos.txt
89
101
  ```
90
102
 
91
103
  ## Output
package/commands/test.md CHANGED
@@ -1,10 +1,30 @@
1
1
  ---
2
2
  description: Generate ProBat unit tests for TLPP classes and functions
3
3
  allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent, Skill, WebSearch, WebFetch
4
- argument-hint: "<file.tlpp|function> [--type unit|api] [--output path]"
4
+ parameters:
5
+ target:
6
+ type: string
7
+ description: "Caminho do arquivo .tlpp ou nome da função/classe para testar"
8
+ type:
9
+ type: string
10
+ enum: ["unit", "api"]
11
+ description: "Tipo de teste: unitário ou API REST"
12
+ required: false
13
+ output:
14
+ type: string
15
+ description: "Caminho do arquivo de teste de saída"
16
+ required: false
17
+ suite:
18
+ type: string
19
+ description: "Nome da suíte para agrupamento de testes"
20
+ required: false
21
+ owner:
22
+ type: string
23
+ description: "Identificador do autor/time para o @TestFixture"
24
+ required: false
5
25
  ---
6
26
 
7
- # /advpl-specialist:test
27
+ # /advpl-sensei:test
8
28
 
9
29
  **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.
10
30
 
@@ -13,7 +33,7 @@ Generate ProBat unit tests for TLPP classes and functions on TOTVS Protheus.
13
33
  ## Usage
14
34
 
15
35
  ```bash
16
- /advpl-specialist:test <target> [options]
36
+ /advpl-sensei:test <target> [options]
17
37
  ```
18
38
 
19
39
  Where `<target>` is a `.tlpp` file path or a function/class name.
@@ -39,7 +59,7 @@ Where `<target>` is a `.tlpp` file path or a function/class name.
39
59
  ProBat only works with TLPP (`.tlpp` files). If a `.prw` file is passed:
40
60
 
41
61
  1. Inform the user that ProBat requires TLPP
42
- 2. Suggest using `/advpl-specialist:migrate` first to convert the source to TLPP
62
+ 2. Suggest using `/advpl-sensei:migrate` first to convert the source to TLPP
43
63
  3. The test file itself is always `.tlpp`, even when testing ADVPL functions
44
64
 
45
65
  ## Process
@@ -74,19 +94,19 @@ ProBat only works with TLPP (`.tlpp` files). If a `.prw` file is passed:
74
94
 
75
95
  ```bash
76
96
  # Generate unit tests for a TLPP file
77
- /advpl-specialist:test src/calculadora.tlpp
97
+ /advpl-sensei:test src/calculadora.tlpp
78
98
 
79
99
  # Generate API tests for a REST endpoint
80
- /advpl-specialist:test src/customer_api.tlpp --type api
100
+ /advpl-sensei:test src/customer_api.tlpp --type api
81
101
 
82
102
  # Generate tests with a specific output path
83
- /advpl-specialist:test src/pedido_service.tlpp --output test/unit/test_pedido.tlpp
103
+ /advpl-sensei:test src/pedido_service.tlpp --output test/unit/test_pedido.tlpp
84
104
 
85
105
  # Generate tests for a specific function
86
- /advpl-specialist:test U_calculateTotal --type unit
106
+ /advpl-sensei:test U_calculateTotal --type unit
87
107
 
88
108
  # Generate tests grouped in a suite
89
- /advpl-specialist:test src/financeiro/ --suite financeiro
109
+ /advpl-sensei:test src/financeiro/ --suite financeiro
90
110
  ```
91
111
 
92
112
  ## Output
package/dist/index.js CHANGED
@@ -5,10 +5,27 @@ import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSche
5
5
  import { promises as fs } from "node:fs";
6
6
  import path from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
+ import yaml from "js-yaml";
8
9
  const __filename = fileURLToPath(import.meta.url);
9
10
  const __dirname = path.dirname(__filename);
10
11
  // Estrutura: dist/index.js -> mcp-server/
11
12
  const MCP_ROOT = path.resolve(__dirname, "..");
13
+ /**
14
+ * Extrai o frontmatter YAML de um arquivo markdown
15
+ */
16
+ function parseFrontmatter(content) {
17
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
18
+ if (match) {
19
+ try {
20
+ const metadata = yaml.load(match[1]);
21
+ return { metadata, body: match[2] };
22
+ }
23
+ catch (e) {
24
+ console.error("Erro ao processar frontmatter:", e);
25
+ }
26
+ }
27
+ return { metadata: {}, body: content };
28
+ }
12
29
  const server = new Server({
13
30
  name: "advpl-sensei",
14
31
  version: "1.1.0",
@@ -34,10 +51,13 @@ server.setRequestHandler(ListResourcesRequestSchema, async () => {
34
51
  await walk(fullPath);
35
52
  }
36
53
  else if (entry.name.endsWith(".md")) {
54
+ const content = await fs.readFile(fullPath, "utf-8");
55
+ const { metadata } = parseFrontmatter(content);
37
56
  const relPath = path.relative(skillsDir, fullPath);
38
57
  resources.push({
39
58
  uri: `mcp://advpl/skills/${relPath}`,
40
- name: relPath,
59
+ name: metadata.name || relPath,
60
+ description: metadata.description || `Skill: ${relPath}`,
41
61
  mimeType: "text/markdown",
42
62
  });
43
63
  }
@@ -69,17 +89,26 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
69
89
  if (file.endsWith(".md")) {
70
90
  const name = file.replace(".md", "");
71
91
  const content = await fs.readFile(path.join(commandsDir, file), "utf-8");
72
- const descMatch = content.match(/description: (.*)/);
92
+ const { metadata } = parseFrontmatter(content);
93
+ const rawParams = metadata.parameters || undefined;
94
+ const properties = {};
95
+ if (rawParams) {
96
+ for (const [k, v] of Object.entries(rawParams)) {
97
+ const { required: _req, ...rest } = v;
98
+ properties[k] = rest;
99
+ }
100
+ }
101
+ const defaultProperties = {
102
+ prompt: { type: "string", description: "O prompt ou instrução para o comando" },
103
+ args: { type: "string", description: "Argumentos adicionais (opcional)" },
104
+ };
73
105
  tools.push({
74
106
  name: `advpl_${name}`,
75
- description: descMatch ? descMatch[1] : `Command ${name}`,
107
+ description: metadata.description || `Command ${name}`,
76
108
  inputSchema: {
77
109
  type: "object",
78
- properties: {
79
- prompt: { type: "string" },
80
- args: { type: "string" },
81
- },
82
- required: ["prompt"],
110
+ properties: rawParams ? properties : defaultProperties,
111
+ required: rawParams ? Object.keys(rawParams).filter(k => rawParams[k].required !== false) : ["prompt"],
83
112
  },
84
113
  });
85
114
  }
@@ -89,14 +118,69 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
89
118
  return { tools };
90
119
  });
91
120
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
92
- const name = request.params.name.replace("advpl_", "");
93
- const filePath = path.join(MCP_ROOT, "commands", `${name}.md`);
94
- const instructions = await fs.readFile(filePath, "utf-8");
95
- const { prompt, args } = request.params.arguments;
121
+ const toolName = request.params.name; // e.g., 'advpl_generate'
122
+ const mcpToolName = toolName.replace("advpl_", ""); // e.g., 'generate'
123
+ const commandFilePath = path.join(MCP_ROOT, "commands", `${mcpToolName}.md`);
124
+ let metadata = {};
125
+ let commandBody = "";
126
+ try {
127
+ const content = await fs.readFile(commandFilePath, "utf-8");
128
+ const parsed = parseFrontmatter(content);
129
+ metadata = parsed.metadata;
130
+ commandBody = parsed.body;
131
+ }
132
+ catch (error) {
133
+ console.error(`Erro ao carregar definição da ferramenta '${toolName}':`, error);
134
+ const errMsg = (error && typeof error === 'object' && 'message' in error) ? error.message : String(error);
135
+ return {
136
+ content: [{
137
+ type: "text",
138
+ text: `Erro ao carregar definição da ferramenta '${toolName}'. Verifique se o arquivo de comando existe e está formatado corretamente. Detalhe: ${errMsg}`,
139
+ }],
140
+ };
141
+ }
142
+ const toolDescription = metadata.description || `Ferramenta '${toolName}' sem descrição.`;
143
+ const toolParametersSchema = metadata.parameters || {};
144
+ const receivedArguments = request.params.arguments || {};
145
+ // Constrói uma resposta mais descritiva
146
+ let responseText = `Chamada da Ferramenta: \`${toolName}\`\n`;
147
+ responseText += `Descrição: ${toolDescription}\n\n`;
148
+ responseText += `Argumentos Recebidos:\n`;
149
+ // Determina quais parâmetros são obrigatórios com base no schema
150
+ const allParameterNames = Object.keys(toolParametersSchema);
151
+ const requiredParams = allParameterNames.filter(paramName => toolParametersSchema[paramName].required !== false);
152
+ const optionalParams = allParameterNames.filter(paramName => toolParametersSchema[paramName].required === false);
153
+ // Lista argumentos obrigatórios
154
+ if (requiredParams.length > 0) {
155
+ responseText += ` * **Obrigatórios**:\n`;
156
+ requiredParams.forEach(paramName => {
157
+ const paramValue = receivedArguments[paramName] !== undefined ? `\`${receivedArguments[paramName]}\`` : "*(não fornecido)*";
158
+ responseText += ` - \`${paramName}\`: ${paramValue}\n`;
159
+ });
160
+ }
161
+ // Lista argumentos opcionais
162
+ if (optionalParams.length > 0) {
163
+ responseText += ` * **Opcionais**:\n`;
164
+ optionalParams.forEach(paramName => {
165
+ const paramValue = receivedArguments[paramName] !== undefined ? `\`${receivedArguments[paramName]}\`` : "*(não fornecido)*";
166
+ responseText += ` - \`${paramName}\`: ${paramValue}\n`;
167
+ });
168
+ }
169
+ // Se houver argumentos recebidos que não estão no schema de parâmetros, liste-os como desconhecidos.
170
+ const receivedArgNames = Object.keys(receivedArguments);
171
+ const unknownParams = receivedArgNames.filter(argName => !allParameterNames.includes(argName));
172
+ if (unknownParams.length > 0) {
173
+ responseText += ` * **Desconhecidos**:\n`;
174
+ unknownParams.forEach(paramName => {
175
+ responseText += ` - \`${paramName}\`: \`${receivedArguments[paramName]}\`\n`;
176
+ });
177
+ }
178
+ // Indica que esta é uma simulação/placeholder
179
+ responseText += `\n--- SIMULAÇÃO DE EXECUÇÃO ---\nEsta é uma resposta simulada. A lógica real de execução para '${toolName}' não está implementada neste handler.`;
96
180
  return {
97
181
  content: [{
98
182
  type: "text",
99
- text: `Tool: ${name}\nContext: ${instructions}\nInput: ${prompt}\nArgs: ${args || ""}`,
183
+ text: responseText,
100
184
  }],
101
185
  };
102
186
  });
@@ -111,10 +195,12 @@ server.setRequestHandler(ListPromptsRequestSchema, async () => {
111
195
  for (const file of files) {
112
196
  if (file.endsWith(".md")) {
113
197
  const name = file.replace(".md", "");
198
+ const content = await fs.readFile(path.join(agentsDir, file), "utf-8");
199
+ const { metadata } = parseFrontmatter(content);
114
200
  prompts.push({
115
201
  name: `advpl_agent_${name}`,
116
- description: `Agent ${name}`,
117
- arguments: [{ name: "context", required: false }],
202
+ description: metadata.description || `Agent Persona: ${name}`,
203
+ arguments: metadata.arguments || [{ name: "context", description: "Contexto adicional para o agente", required: false }],
118
204
  });
119
205
  }
120
206
  }
@@ -125,19 +211,23 @@ server.setRequestHandler(ListPromptsRequestSchema, async () => {
125
211
  server.setRequestHandler(GetPromptRequestSchema, async (request) => {
126
212
  const name = request.params.name.replace("advpl_agent_", "");
127
213
  const filePath = path.join(MCP_ROOT, "agents", `${name}.md`);
128
- const text = await fs.readFile(filePath, "utf-8");
214
+ const content = await fs.readFile(filePath, "utf-8");
215
+ const { metadata, body } = parseFrontmatter(content);
129
216
  return {
130
217
  messages: [{
131
218
  role: "user",
132
219
  content: {
133
220
  type: "text",
134
- text: `Role: ${name}\nRules: ${text}\nContext: ${request.params.arguments?.context || ""}`,
221
+ text: `Role: ${name}\nDescription: ${metadata.description || ""}\nRules: ${body}\nUser Input: ${JSON.stringify(request.params.arguments)}`,
135
222
  },
136
223
  }],
137
224
  };
138
225
  });
139
226
  async function main() {
140
227
  const transport = new StdioServerTransport();
228
+ console.log(`MCP server 'advpl-sensei' iniciado — aguardando conexão via stdin/stdout...`);
141
229
  await server.connect(transport);
142
230
  }
143
- main().catch(() => { });
231
+ main().catch((err) => {
232
+ console.error("MCP Server Error:", err);
233
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netoalmanca/advpl-sensei",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "MCP Server for ADVPL/TLPP Protheus ecosystem",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -16,15 +16,18 @@
16
16
  "scripts": {
17
17
  "build": "tsc",
18
18
  "start": "node dist/index.js",
19
- "dev": "ts-node src/index.ts"
19
+ "dev": "node --loader ts-node/esm src/index.ts"
20
20
  },
21
21
  "dependencies": {
22
22
  "@modelcontextprotocol/sdk": "^1.5.0",
23
+ "js-yaml": "^4.1.1",
23
24
  "zod": "^3.24.2"
24
25
  },
25
26
  "devDependencies": {
27
+ "@types/js-yaml": "^4.0.9",
26
28
  "@types/node": "^22.13.9",
27
29
  "ts-node": "^10.9.2",
28
30
  "typescript": "^5.8.2"
29
- }
31
+ },
32
+ "repository": "https://github.com/genesius13/advpl-sensei.git"
30
33
  }