@andrebuzeli/git-mcp 3.2.0 → 3.2.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.
package/dist/server.js CHANGED
@@ -7,21 +7,19 @@ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
7
7
  const config_js_1 = require("./config.js");
8
8
  const index_js_2 = require("./providers/index.js");
9
9
  /**
10
- * Importação de todas as ferramentas MCP disponíveis (20 tools)
10
+ * Importação de todas as ferramentas MCP disponíveis (19 tools ativas)
11
11
  *
12
- * GIT CORE (20 tools) - Funcionam com GitHub + Gitea:
12
+ * GIT CORE (19 tools) - Funcionam com GitHub + Gitea:
13
13
  * - git-repositories: Gerenciamento de repositórios
14
14
  * - git-commits: Operações com commits
15
- * - git-pulls: Pull requests e merges
16
15
  * - git-branches: Operações com branches
17
16
  * - git-tags: Gerenciamento de tags
18
17
  * - git-files: Gerenciamento de arquivos
19
- * - git-upload-project: Upload completo de projeto
20
18
  * - git-update-project: Atualização incremental de projeto
21
19
  * - git-initialize: Inicialização completa de repositório
22
20
  * - git-issues: Gerenciamento de issues
21
+ * - git-pulls: Pull requests e merges
23
22
  * - git-releases: Gerenciamento de releases
24
- * - git-webhooks: Gerenciamento de webhooks
25
23
  * - git-reset: Operações de reset
26
24
  * - git-revert: Operações de revert
27
25
  * - git-stash: Gerenciamento de stash
@@ -31,8 +29,10 @@ const index_js_2 = require("./providers/index.js");
31
29
  * - git-sync: Sincronização de repositórios
32
30
  * - git-packages: Gerenciamento de pacotes
33
31
  * - git-projects: Gerenciamento de projetos
32
+ *
33
+ * NOTA: webhooksTool comentado pois ainda não foi implementado
34
34
  */
35
- // Git Core Tools (21)
35
+ // Git Core Tools (19)
36
36
  const git_repositories_js_1 = require("./tools/git-repositories.js");
37
37
  const git_commits_js_1 = require("./tools/git-commits.js");
38
38
  const git_branches_js_1 = require("./tools/git-branches.js");
@@ -112,14 +112,9 @@ exports.resources = resources;
112
112
  */
113
113
  const prompts = [
114
114
  {
115
- name: 'setup-project',
116
- description: 'Configurar um novo projeto com Git MCP',
115
+ name: 'init-project',
116
+ description: 'Inicializar novo projeto Git e configurar repositório remoto',
117
117
  arguments: [
118
- {
119
- name: 'projectPath',
120
- description: 'Caminho completo do projeto',
121
- required: true
122
- },
123
118
  {
124
119
  name: 'repoName',
125
120
  description: 'Nome do repositório',
@@ -127,73 +122,221 @@ const prompts = [
127
122
  },
128
123
  {
129
124
  name: 'provider',
130
- description: 'Provider (gitea ou github)',
125
+ description: 'Provider (gitea, github, both)',
131
126
  required: true
127
+ },
128
+ {
129
+ name: 'description',
130
+ description: 'Descrição do projeto',
131
+ required: false
132
+ },
133
+ {
134
+ name: 'private',
135
+ description: 'Repositório privado (true/false)',
136
+ required: false
132
137
  }
133
138
  ]
134
139
  },
135
140
  {
136
- name: 'sync-project',
137
- description: 'Sincronizar projeto completo com provider',
141
+ name: 'sync-all',
142
+ description: 'Sincronizar projeto atual com todos os providers configurados',
138
143
  arguments: [
139
144
  {
140
- name: 'projectPath',
141
- description: 'Caminho do projeto',
142
- required: true
145
+ name: 'message',
146
+ description: 'Mensagem do commit',
147
+ required: false
143
148
  },
144
149
  {
145
- name: 'provider',
146
- description: 'Provider para sincronização',
150
+ name: 'force',
151
+ description: 'Forçar sincronização mesmo com conflitos',
152
+ required: false
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ name: 'commit-changes',
158
+ description: 'Commitar todas as mudanças atuais do projeto',
159
+ arguments: [
160
+ {
161
+ name: 'message',
162
+ description: 'Mensagem específica do commit',
163
+ required: false
164
+ },
165
+ {
166
+ name: 'type',
167
+ description: 'Tipo de commit (feat, fix, docs, style, refactor, test, chore)',
168
+ required: false
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ name: 'create-branch',
174
+ description: 'Criar nova branch para desenvolvimento',
175
+ arguments: [
176
+ {
177
+ name: 'branchName',
178
+ description: 'Nome da nova branch',
147
179
  required: true
148
180
  },
149
181
  {
150
- name: 'message',
151
- description: 'Mensagem do commit',
182
+ name: 'fromBranch',
183
+ description: 'Branch de origem (padrão: main)',
152
184
  required: false
153
185
  }
154
186
  ]
155
187
  },
156
188
  {
157
- name: 'troubleshoot-auth',
158
- description: 'Diagnosticar problemas de autenticação',
189
+ name: 'merge-branch',
190
+ description: 'Fazer merge de uma branch para main',
159
191
  arguments: [
160
192
  {
161
- name: 'provider',
162
- description: 'Provider com problema (gitea ou github)',
193
+ name: 'branchName',
194
+ description: 'Nome da branch a ser merged',
163
195
  required: true
196
+ },
197
+ {
198
+ name: 'mergeMethod',
199
+ description: 'Método de merge (merge, squash, rebase)',
200
+ required: false
164
201
  }
165
202
  ]
166
203
  },
167
204
  {
168
- name: 'create-release',
169
- description: 'Criar uma nova release',
205
+ name: 'create-issue',
206
+ description: 'Criar nova issue/tarefa no repositório',
170
207
  arguments: [
171
208
  {
172
- name: 'projectPath',
173
- description: 'Caminho do projeto',
209
+ name: 'title',
210
+ description: 'Título da issue',
174
211
  required: true
175
212
  },
176
213
  {
177
- name: 'repo',
178
- description: 'Nome do repositório',
214
+ name: 'body',
215
+ description: 'Descrição da issue',
216
+ required: false
217
+ },
218
+ {
219
+ name: 'labels',
220
+ description: 'Labels para categorizar (bug, feature, enhancement)',
221
+ required: false
222
+ }
223
+ ]
224
+ },
225
+ {
226
+ name: 'create-pr',
227
+ description: 'Criar Pull Request da branch atual',
228
+ arguments: [
229
+ {
230
+ name: 'title',
231
+ description: 'Título do PR',
179
232
  required: true
180
233
  },
234
+ {
235
+ name: 'body',
236
+ description: 'Descrição do PR',
237
+ required: false
238
+ },
239
+ {
240
+ name: 'draft',
241
+ description: 'Criar como draft (true/false)',
242
+ required: false
243
+ }
244
+ ]
245
+ },
246
+ {
247
+ name: 'deploy-release',
248
+ description: 'Criar e publicar nova release',
249
+ arguments: [
181
250
  {
182
251
  name: 'version',
183
252
  description: 'Versão da release (ex: v1.0.0)',
184
253
  required: true
185
254
  },
255
+ {
256
+ name: 'title',
257
+ description: 'Título da release',
258
+ required: false
259
+ },
260
+ {
261
+ name: 'notes',
262
+ description: 'Notas da release (changelog)',
263
+ required: false
264
+ },
265
+ {
266
+ name: 'prerelease',
267
+ description: 'Marcar como pré-release (true/false)',
268
+ required: false
269
+ }
270
+ ]
271
+ },
272
+ {
273
+ name: 'backup-project',
274
+ description: 'Criar backup completo do projeto atual',
275
+ arguments: [
276
+ {
277
+ name: 'format',
278
+ description: 'Formato do backup (zip, tar.gz)',
279
+ required: false
280
+ },
281
+ {
282
+ name: 'includeGit',
283
+ description: 'Incluir histórico Git (true/false)',
284
+ required: false
285
+ }
286
+ ]
287
+ },
288
+ {
289
+ name: 'health-check',
290
+ description: 'Verificar saúde do projeto e repositório',
291
+ arguments: [
186
292
  {
187
293
  name: 'provider',
188
- description: 'Provider (gitea ou github)',
294
+ description: 'Provider específico para verificar (gitea, github, both)',
295
+ required: false
296
+ },
297
+ {
298
+ name: 'detailed',
299
+ description: 'Análise detalhada (true/false)',
300
+ required: false
301
+ }
302
+ ]
303
+ },
304
+ {
305
+ name: 'setup-workflow',
306
+ description: 'Configurar workflow completo de desenvolvimento',
307
+ arguments: [
308
+ {
309
+ name: 'workflow',
310
+ description: 'Tipo de workflow (feature, hotfix, release, maintenance)',
189
311
  required: true
312
+ },
313
+ {
314
+ name: 'branch',
315
+ description: 'Nome da branch (se aplicável)',
316
+ required: false
317
+ }
318
+ ]
319
+ },
320
+ {
321
+ name: 'cleanup-project',
322
+ description: 'Limpeza e manutenção do projeto',
323
+ arguments: [
324
+ {
325
+ name: 'type',
326
+ description: 'Tipo de limpeza (branches, cache, logs, all)',
327
+ required: true
328
+ },
329
+ {
330
+ name: 'force',
331
+ description: 'Forçar limpeza sem confirmação',
332
+ required: false
190
333
  }
191
334
  ]
192
335
  }
193
336
  ];
194
337
  exports.prompts = prompts;
195
338
  /**
196
- * Array de todas as ferramentas disponíveis (21 tools)
339
+ * Array de todas as ferramentas disponíveis (19 tools)
197
340
  *
198
341
  * ESTRUTURA:
199
342
  * - Cada tool deve implementar a interface Tool
@@ -201,7 +344,7 @@ exports.prompts = prompts;
201
344
  * - Handler deve ser assíncrono e retornar resultado
202
345
  *
203
346
  * ORGANIZAÇÃO:
204
- * - Git Core (21): Funcionam com GitHub + Gitea
347
+ * - Git Core (19): Funcionam com GitHub + Gitea
205
348
  *
206
349
  * USO:
207
350
  * - Para listagem de tools disponíveis
@@ -209,7 +352,7 @@ exports.prompts = prompts;
209
352
  * - Para validação de parâmetros
210
353
  */
211
354
  const tools = [
212
- // Git Core Tools (21) - GitHub + Gitea
355
+ // Git Core Tools (19) - GitHub + Gitea
213
356
  git_repositories_js_1.gitRepositoriesTool,
214
357
  git_commits_js_1.commitsTool,
215
358
  git_branches_js_1.branchesTool,
@@ -237,477 +380,477 @@ const tools = [
237
380
  const getResourceContent = (uri) => {
238
381
  switch (uri) {
239
382
  case 'git-mcp://documentation/rules':
240
- return `# Regras de Uso do Git MCP
241
-
242
- ## 🚫 REGRAS ABSOLUTAS (NUNCA QUEBRAR)
243
-
244
- ### 1. **Project Path é OBRIGATÓRIO**
245
- - **TODA tool** deve receber \`projectPath\` como parâmetro obrigatório
246
- - **TODAS as operações** devem ser executadas dentro do \`projectPath\` ou suas subpastas
247
- - **NENHUMA operação** pode ser executada fora do diretório do projeto
248
-
249
- ### 2. **Comandos Git SEMPRE via Tools**
250
- - **NUNCA** executar comandos git diretamente no terminal
251
- - **SEMPRE** usar as tools do git-mcp para operações git
252
- - **NUNCA** usar \`git\` diretamente, mesmo que "pareça mais rápido"
253
-
254
- ### 3. **Commit Messages em Português**
255
- - **TODOS os commits** devem ter mensagens descritivas em português
256
- - **NÃO usar** mensagens genéricas como "update" ou "fix"
257
- - **DESCREVER** exatamente o que foi alterado no arquivo
258
-
259
- ### 4. **Testes OBRIGATÓRIOS**
260
- - **ANTES de publicar** testar TODAS as tools com ambos providers
261
- - **VALIDAR** funcionamento com GitHub E Gitea
262
- - **NÃO publicar** versões não testadas
263
-
264
- ## ✅ BOAS PRÁTICAS
265
-
266
- ### Project Path
267
- - Sempre usar caminhos absolutos
268
- - Validar se o diretório existe antes das operações
269
- - Manter consistência entre ferramentas
270
-
271
- ### Providers
272
- - Gitea: Para projetos pessoais/privados
273
- - GitHub: Para projetos públicos/open-source
274
- - Ambos devem funcionar identicamente
275
-
276
- ### Commits
277
- - Mensagens claras e específicas
278
- - Descrever função/arquivo alterado
279
- - Usar português brasileiro
280
-
281
- ### Error Handling
282
- - Tratar todos os erros possíveis
283
- - Fornecer mensagens claras
383
+ return `# Regras de Uso do Git MCP
384
+
385
+ ## 🚫 REGRAS ABSOLUTAS (NUNCA QUEBRAR)
386
+
387
+ ### 1. **Project Path é OBRIGATÓRIO**
388
+ - **TODA tool** deve receber \`projectPath\` como parâmetro obrigatório
389
+ - **TODAS as operações** devem ser executadas dentro do \`projectPath\` ou suas subpastas
390
+ - **NENHUMA operação** pode ser executada fora do diretório do projeto
391
+
392
+ ### 2. **Comandos Git SEMPRE via Tools**
393
+ - **NUNCA** executar comandos git diretamente no terminal
394
+ - **SEMPRE** usar as tools do git-mcp para operações git
395
+ - **NUNCA** usar \`git\` diretamente, mesmo que "pareça mais rápido"
396
+
397
+ ### 3. **Commit Messages em Português**
398
+ - **TODOS os commits** devem ter mensagens descritivas em português
399
+ - **NÃO usar** mensagens genéricas como "update" ou "fix"
400
+ - **DESCREVER** exatamente o que foi alterado no arquivo
401
+
402
+ ### 4. **Testes OBRIGATÓRIOS**
403
+ - **ANTES de publicar** testar TODAS as tools com ambos providers
404
+ - **VALIDAR** funcionamento com GitHub E Gitea
405
+ - **NÃO publicar** versões não testadas
406
+
407
+ ## ✅ BOAS PRÁTICAS
408
+
409
+ ### Project Path
410
+ - Sempre usar caminhos absolutos
411
+ - Validar se o diretório existe antes das operações
412
+ - Manter consistência entre ferramentas
413
+
414
+ ### Providers
415
+ - Gitea: Para projetos pessoais/privados
416
+ - GitHub: Para projetos públicos/open-source
417
+ - Ambos devem funcionar identicamente
418
+
419
+ ### Commits
420
+ - Mensagens claras e específicas
421
+ - Descrever função/arquivo alterado
422
+ - Usar português brasileiro
423
+
424
+ ### Error Handling
425
+ - Tratar todos os erros possíveis
426
+ - Fornecer mensagens claras
284
427
  - Sugerir soluções quando possível`;
285
428
  case 'git-mcp://documentation/providers':
286
- return `# Configuração de Providers
287
-
288
- ## GitHub Setup
289
-
290
- ### Variáveis de Ambiente
291
- \`\`\`bash
292
- GITHUB_TOKEN=your_github_token_here
293
- \`\`\`
294
-
295
- ### Como Obter Token
296
- 1. Acesse: https://github.com/settings/tokens
297
- 2. Generate new token (classic)
298
- 3. Selecione scopes:
299
- - \`repo\` (acesso completo aos repositórios)
300
- - \`workflow\` (atualizar workflows GitHub Actions)
301
- - \`write:packages\` (upload de pacotes)
302
-
303
- ## Gitea Setup
304
-
305
- ### Variáveis de Ambiente
306
- \`\`\`bash
307
- GITEA_URL=http://your-gitea-server:3000
308
- GITEA_TOKEN=your_gitea_token_here
309
- GITEA_USERNAME=your_username
310
- \`\`\`
311
-
312
- ### Como Obter Token
313
- 1. Acesse: \`http://your-server:3000/user/settings/applications\`
314
- 2. Crie novo token de acesso
315
- 3. Selecione permissões necessárias
316
-
317
- ## Validação
318
-
319
- Teste a configuração executando:
320
- \`\`\`typescript
321
- // Testar GitHub
322
- await gitRepositoriesTool.handler({
323
- action: 'list',
324
- provider: 'github',
325
- page: 1,
326
- limit: 5
327
- });
328
-
329
- // Testar Gitea
330
- await gitRepositoriesTool.handler({
331
- action: 'list',
332
- provider: 'gitea',
333
- page: 1,
334
- limit: 5
335
- });
429
+ return `# Configuração de Providers
430
+
431
+ ## GitHub Setup
432
+
433
+ ### Variáveis de Ambiente
434
+ \`\`\`bash
435
+ GITHUB_TOKEN=your_github_token_here
436
+ \`\`\`
437
+
438
+ ### Como Obter Token
439
+ 1. Acesse: https://github.com/settings/tokens
440
+ 2. Generate new token (classic)
441
+ 3. Selecione scopes:
442
+ - \`repo\` (acesso completo aos repositórios)
443
+ - \`workflow\` (atualizar workflows GitHub Actions)
444
+ - \`write:packages\` (upload de pacotes)
445
+
446
+ ## Gitea Setup
447
+
448
+ ### Variáveis de Ambiente
449
+ \`\`\`bash
450
+ GITEA_URL=http://your-gitea-server:3000
451
+ GITEA_TOKEN=your_gitea_token_here
452
+ GITEA_USERNAME=your_username
453
+ \`\`\`
454
+
455
+ ### Como Obter Token
456
+ 1. Acesse: \`http://your-server:3000/user/settings/applications\`
457
+ 2. Crie novo token de acesso
458
+ 3. Selecione permissões necessárias
459
+
460
+ ## Validação
461
+
462
+ Teste a configuração executando:
463
+ \`\`\`typescript
464
+ // Testar GitHub
465
+ await gitRepositoriesTool.handler({
466
+ action: 'list',
467
+ provider: 'github',
468
+ page: 1,
469
+ limit: 5
470
+ });
471
+
472
+ // Testar Gitea
473
+ await gitRepositoriesTool.handler({
474
+ action: 'list',
475
+ provider: 'gitea',
476
+ page: 1,
477
+ limit: 5
478
+ });
336
479
  \`\`\``;
337
480
  case 'git-mcp://documentation/tools':
338
- return `# Ferramentas Disponíveis - Git MCP v3.1.2
339
-
340
- ## 🎯 CORE TOOLS (21 Ferramentas)
341
-
342
- ### Repositories & Projects
343
- - **git-repositories**: \`create\`, \`list\`, \`get\`, \`update\`, \`delete\`, \`fork\`, \`search\`, \`init\`, \`clone\`
344
- - **git-projects**: \`list\`, \`get\`, \`create\`, \`update\`, \`delete\`, \`addItem\`, \`updateItem\`, \`deleteItem\`, \`listItems\`
345
-
346
- ### Git Operations
347
- - **git-commits**: \`list\`, \`get\`, \`create\`, \`compare\`, \`search\`, \`push\`, \`pull\`
348
- - **git-branches**: \`create\`, \`list\`, \`get\`, \`delete\`, \`merge\`, \`compare\`
349
- - **git-tags**: \`create\`, \`list\`, \`get\`, \`delete\`, \`search\`
350
-
351
- ### Files & Content
352
- - **git-files**: \`get\`, \`create\`, \`update\`, \`delete\`, \`list\`, \`search\`, \`upload-project\`
353
- - **git-archive**: \`create\`, \`extract\`, \`list\`, \`verify\`
354
-
355
- ### Version Control
356
- - **git-reset**: \`soft\`, \`mixed\`, \`hard\`, \`reset-to-commit\`, \`reset-branch\`
357
- - **git-revert**: \`revert-commit\`, \`revert-merge\`, \`revert-range\`
358
- - **git-stash**: \`stash\`, \`pop\`, \`apply\`, \`list\`, \`show\`, \`drop\`, \`clear\`
359
-
360
- ### Issues & Collaboration
361
- - **git-issues**: \`create\`, \`list\`, \`get\`, \`update\`, \`close\`, \`comment\`, \`search\`
362
- - **git-pulls**: \`create\`, \`list\`, \`get\`, \`update\`, \`merge\`, \`close\`, \`review\`, \`search\`
363
-
364
- ### Releases & Packages
365
- - **git-releases**: \`create\`, \`list\`, \`get\`, \`update\`, \`delete\`, \`publish\`
366
- - **git-packages**: \`list\`, \`get\`, \`create\`, \`update\`, \`delete\`, \`publish\`, \`download\`
367
-
368
- ### Config & Sync
369
- - **git-config**: \`get\`, \`set\`, \`unset\`, \`list\`, \`edit\`, \`show\`
370
- - **git-remote**: \`add\`, \`remove\`, \`rename\`, \`show\`, \`set-url\`, \`prune\`
371
- - **git-sync**: \`configure\`, \`status\`, \`one-shot\`
372
-
373
- ### Project Management
374
- - **git-update-project**: \`init\`, \`update\`, \`status\`, \`diff\`, \`log\`, \`reset\`, \`stash\`, \`pull\`, \`sync\`
375
- - **git-initialize**: \`init\`
376
-
377
- ## 📋 PARÂMETROS OBRIGATÓRIOS
378
-
379
- **TODAS as tools requerem:**
380
- - \`projectPath\`: Caminho absoluto do projeto
381
- - \`provider\`: 'gitea' ou 'github' (exceto algumas tools específicas)
382
-
383
- ## 🎯 EXEMPLOS DE USO
384
-
385
- ### Inicializar Projeto
386
- \`\`\`typescript
387
- await gitInitializeTool.handler({
388
- action: 'init',
389
- projectPath: '/caminho/do/projeto',
390
- provider: 'gitea',
391
- message: 'Setup inicial do projeto'
392
- });
393
- \`\`\`
394
-
395
- ### Commit de Arquivo
396
- \`\`\`typescript
397
- await gitCommitsTool.handler({
398
- action: 'create',
399
- projectPath: '/caminho/do/projeto',
400
- provider: 'gitea',
401
- message: 'Adiciona função de validação de email no arquivo auth.js'
402
- });
403
- \`\`\`
404
-
405
- ### Criar Branch
406
- \`\`\`typescript
407
- await gitBranchesTool.handler({
408
- action: 'create',
409
- projectPath: '/caminho/do/projeto',
410
- provider: 'gitea',
411
- branch_name: 'feature/nova-funcionalidade',
412
- from_branch: 'main'
413
- });
481
+ return `# Ferramentas Disponíveis - Git MCP v3.1.2
482
+
483
+ ## 🎯 CORE TOOLS (21 Ferramentas)
484
+
485
+ ### Repositories & Projects
486
+ - **git-repositories**: \`create\`, \`list\`, \`get\`, \`update\`, \`delete\`, \`fork\`, \`search\`, \`init\`, \`clone\`
487
+ - **git-projects**: \`list\`, \`get\`, \`create\`, \`update\`, \`delete\`, \`addItem\`, \`updateItem\`, \`deleteItem\`, \`listItems\`
488
+
489
+ ### Git Operations
490
+ - **git-commits**: \`list\`, \`get\`, \`create\`, \`compare\`, \`search\`, \`push\`, \`pull\`
491
+ - **git-branches**: \`create\`, \`list\`, \`get\`, \`delete\`, \`merge\`, \`compare\`
492
+ - **git-tags**: \`create\`, \`list\`, \`get\`, \`delete\`, \`search\`
493
+
494
+ ### Files & Content
495
+ - **git-files**: \`get\`, \`create\`, \`update\`, \`delete\`, \`list\`, \`search\`, \`upload-project\`
496
+ - **git-archive**: \`create\`, \`extract\`, \`list\`, \`verify\`
497
+
498
+ ### Version Control
499
+ - **git-reset**: \`soft\`, \`mixed\`, \`hard\`, \`reset-to-commit\`, \`reset-branch\`
500
+ - **git-revert**: \`revert-commit\`, \`revert-merge\`, \`revert-range\`
501
+ - **git-stash**: \`stash\`, \`pop\`, \`apply\`, \`list\`, \`show\`, \`drop\`, \`clear\`
502
+
503
+ ### Issues & Collaboration
504
+ - **git-issues**: \`create\`, \`list\`, \`get\`, \`update\`, \`close\`, \`comment\`, \`search\`
505
+ - **git-pulls**: \`create\`, \`list\`, \`get\`, \`update\`, \`merge\`, \`close\`, \`review\`, \`search\`
506
+
507
+ ### Releases & Packages
508
+ - **git-releases**: \`create\`, \`list\`, \`get\`, \`update\`, \`delete\`, \`publish\`
509
+ - **git-packages**: \`list\`, \`get\`, \`create\`, \`update\`, \`delete\`, \`publish\`, \`download\`
510
+
511
+ ### Config & Sync
512
+ - **git-config**: \`get\`, \`set\`, \`unset\`, \`list\`, \`edit\`, \`show\`
513
+ - **git-remote**: \`add\`, \`remove\`, \`rename\`, \`show\`, \`set-url\`, \`prune\`
514
+ - **git-sync**: \`configure\`, \`status\`, \`one-shot\`
515
+
516
+ ### Project Management
517
+ - **git-update-project**: \`init\`, \`update\`, \`status\`, \`diff\`, \`log\`, \`reset\`, \`stash\`, \`pull\`, \`sync\`
518
+ - **git-initialize**: \`init\`
519
+
520
+ ## 📋 PARÂMETROS OBRIGATÓRIOS
521
+
522
+ **TODAS as tools requerem:**
523
+ - \`projectPath\`: Caminho absoluto do projeto
524
+ - \`provider\`: 'gitea' ou 'github' (exceto algumas tools específicas)
525
+
526
+ ## 🎯 EXEMPLOS DE USO
527
+
528
+ ### Inicializar Projeto
529
+ \`\`\`typescript
530
+ await gitInitializeTool.handler({
531
+ action: 'init',
532
+ projectPath: '/caminho/do/projeto',
533
+ provider: 'gitea',
534
+ message: 'Setup inicial do projeto'
535
+ });
536
+ \`\`\`
537
+
538
+ ### Commit de Arquivo
539
+ \`\`\`typescript
540
+ await gitCommitsTool.handler({
541
+ action: 'create',
542
+ projectPath: '/caminho/do/projeto',
543
+ provider: 'gitea',
544
+ message: 'Adiciona função de validação de email no arquivo auth.js'
545
+ });
546
+ \`\`\`
547
+
548
+ ### Criar Branch
549
+ \`\`\`typescript
550
+ await gitBranchesTool.handler({
551
+ action: 'create',
552
+ projectPath: '/caminho/do/projeto',
553
+ provider: 'gitea',
554
+ branch_name: 'feature/nova-funcionalidade',
555
+ from_branch: 'main'
556
+ });
414
557
  \`\`\``;
415
558
  case 'git-mcp://examples/basic-usage':
416
- return `# Exemplos Básicos de Uso
417
-
418
- ## 🚀 SETUP INICIAL
419
-
420
- ### 1. Configurar Projeto Novo
421
- \`\`\`typescript
422
- // Criar repositório remoto primeiro
423
- await gitRepositoriesTool.handler({
424
- action: 'create',
425
- name: 'meu-projeto',
426
- description: 'Projeto incrível',
427
- private: true,
428
- auto_init: true,
429
- provider: 'gitea'
430
- });
431
-
432
- // Inicializar localmente
433
- await gitInitializeTool.handler({
434
- action: 'init',
435
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
436
- provider: 'gitea',
437
- message: 'Setup inicial do projeto'
438
- });
439
- \`\`\`
440
-
441
- ## 📝 TRABALHO DIÁRIO
442
-
443
- ### 2. Adicionar Arquivo e Commitar
444
- \`\`\`typescript
445
- // Criar arquivo via tool
446
- await gitFilesTool.handler({
447
- action: 'create',
448
- repo: 'meu-projeto',
449
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
450
- provider: 'gitea',
451
- path: 'src/index.js',
452
- content: 'console.log("Olá Mundo!");',
453
- message: 'Cria arquivo principal index.js com saudação básica'
454
- });
455
-
456
- // Ou upload completo do projeto
457
- await gitUpdateProjectTool.handler({
458
- action: 'init',
459
- repo: 'meu-projeto',
460
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
461
- provider: 'gitea',
462
- message: 'Upload completo dos arquivos do projeto'
463
- });
464
- \`\`\`
465
-
466
- ### 3. Criar Branch e Trabalhar
467
- \`\`\`typescript
468
- // Criar branch
469
- await gitBranchesTool.handler({
470
- action: 'create',
471
- repo: 'meu-projeto',
472
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
473
- provider: 'gitea',
474
- branch_name: 'feature/login',
475
- from_branch: 'main'
476
- });
477
-
478
- // Commitar mudanças
479
- await gitCommitsTool.handler({
480
- action: 'create',
481
- repo: 'meu-projeto',
482
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
483
- provider: 'gitea',
484
- message: 'Implementa validação de formulário de login'
485
- });
486
- \`\`\`
487
-
488
- ## 🔄 SINCRONIZAÇÃO
489
-
490
- ### 4. Push e Pull
491
- \`\`\`typescript
492
- // Enviar mudanças
493
- await gitCommitsTool.handler({
494
- action: 'push',
495
- repo: 'meu-projeto',
496
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
497
- provider: 'gitea',
498
- branch: 'feature/login'
499
- });
500
-
501
- // Baixar mudanças
502
- await gitCommitsTool.handler({
503
- action: 'pull',
504
- repo: 'meu-projeto',
505
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
506
- provider: 'gitea',
507
- branch: 'main'
508
- });
509
- \`\`\`
510
-
511
- ## 📋 GERENCIAMENTO
512
-
513
- ### 5. Issues e Pull Requests
514
- \`\`\`typescript
515
- // Criar issue
516
- await gitIssuesTool.handler({
517
- action: 'create',
518
- repo: 'meu-projeto',
519
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
520
- provider: 'gitea',
521
- title: 'Implementar autenticação OAuth',
522
- body: 'Adicionar suporte para login via Google e GitHub'
523
- });
524
-
525
- // Criar PR
526
- await gitPullsTool.handler({
527
- action: 'create',
528
- repo: 'meu-projeto',
529
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
530
- provider: 'gitea',
531
- title: 'Feature: Sistema de Login',
532
- body: 'Implementa autenticação completa com validação',
533
- head: 'feature/login',
534
- base: 'main'
535
- });
536
- \`\`\`
537
-
538
- ## 📦 RELEASES
539
-
540
- ### 6. Criar Release
541
- \`\`\`typescript
542
- await gitReleasesTool.handler({
543
- action: 'create',
544
- repo: 'meu-projeto',
545
- projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
546
- provider: 'gitea',
547
- tag_name: 'v1.0.0',
548
- name: 'Versão 1.0.0',
549
- body: 'Primeira release estável com sistema de login completo',
550
- draft: false,
551
- prerelease: false
552
- });
559
+ return `# Exemplos Básicos de Uso
560
+
561
+ ## 🚀 SETUP INICIAL
562
+
563
+ ### 1. Configurar Projeto Novo
564
+ \`\`\`typescript
565
+ // Criar repositório remoto primeiro
566
+ await gitRepositoriesTool.handler({
567
+ action: 'create',
568
+ name: 'meu-projeto',
569
+ description: 'Projeto incrível',
570
+ private: true,
571
+ auto_init: true,
572
+ provider: 'gitea'
573
+ });
574
+
575
+ // Inicializar localmente
576
+ await gitInitializeTool.handler({
577
+ action: 'init',
578
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
579
+ provider: 'gitea',
580
+ message: 'Setup inicial do projeto'
581
+ });
582
+ \`\`\`
583
+
584
+ ## 📝 TRABALHO DIÁRIO
585
+
586
+ ### 2. Adicionar Arquivo e Commitar
587
+ \`\`\`typescript
588
+ // Criar arquivo via tool
589
+ await gitFilesTool.handler({
590
+ action: 'create',
591
+ repo: 'meu-projeto',
592
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
593
+ provider: 'gitea',
594
+ path: 'src/index.js',
595
+ content: 'console.log("Olá Mundo!");',
596
+ message: 'Cria arquivo principal index.js com saudação básica'
597
+ });
598
+
599
+ // Ou upload completo do projeto
600
+ await gitUpdateProjectTool.handler({
601
+ action: 'init',
602
+ repo: 'meu-projeto',
603
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
604
+ provider: 'gitea',
605
+ message: 'Upload completo dos arquivos do projeto'
606
+ });
607
+ \`\`\`
608
+
609
+ ### 3. Criar Branch e Trabalhar
610
+ \`\`\`typescript
611
+ // Criar branch
612
+ await gitBranchesTool.handler({
613
+ action: 'create',
614
+ repo: 'meu-projeto',
615
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
616
+ provider: 'gitea',
617
+ branch_name: 'feature/login',
618
+ from_branch: 'main'
619
+ });
620
+
621
+ // Commitar mudanças
622
+ await gitCommitsTool.handler({
623
+ action: 'create',
624
+ repo: 'meu-projeto',
625
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
626
+ provider: 'gitea',
627
+ message: 'Implementa validação de formulário de login'
628
+ });
629
+ \`\`\`
630
+
631
+ ## 🔄 SINCRONIZAÇÃO
632
+
633
+ ### 4. Push e Pull
634
+ \`\`\`typescript
635
+ // Enviar mudanças
636
+ await gitCommitsTool.handler({
637
+ action: 'push',
638
+ repo: 'meu-projeto',
639
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
640
+ provider: 'gitea',
641
+ branch: 'feature/login'
642
+ });
643
+
644
+ // Baixar mudanças
645
+ await gitCommitsTool.handler({
646
+ action: 'pull',
647
+ repo: 'meu-projeto',
648
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
649
+ provider: 'gitea',
650
+ branch: 'main'
651
+ });
652
+ \`\`\`
653
+
654
+ ## 📋 GERENCIAMENTO
655
+
656
+ ### 5. Issues e Pull Requests
657
+ \`\`\`typescript
658
+ // Criar issue
659
+ await gitIssuesTool.handler({
660
+ action: 'create',
661
+ repo: 'meu-projeto',
662
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
663
+ provider: 'gitea',
664
+ title: 'Implementar autenticação OAuth',
665
+ body: 'Adicionar suporte para login via Google e GitHub'
666
+ });
667
+
668
+ // Criar PR
669
+ await gitPullsTool.handler({
670
+ action: 'create',
671
+ repo: 'meu-projeto',
672
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
673
+ provider: 'gitea',
674
+ title: 'Feature: Sistema de Login',
675
+ body: 'Implementa autenticação completa com validação',
676
+ head: 'feature/login',
677
+ base: 'main'
678
+ });
679
+ \`\`\`
680
+
681
+ ## 📦 RELEASES
682
+
683
+ ### 6. Criar Release
684
+ \`\`\`typescript
685
+ await gitReleasesTool.handler({
686
+ action: 'create',
687
+ repo: 'meu-projeto',
688
+ projectPath: 'Z:\\\\Meus Projetos\\\\meu-projeto',
689
+ provider: 'gitea',
690
+ tag_name: 'v1.0.0',
691
+ name: 'Versão 1.0.0',
692
+ body: 'Primeira release estável com sistema de login completo',
693
+ draft: false,
694
+ prerelease: false
695
+ });
553
696
  \`\`\``;
554
697
  case 'git-mcp://examples/workflows':
555
- return `# Workflows Completos de Desenvolvimento
556
-
557
- ## 🏗️ WORKFLOW: NOVO PROJETO
558
-
559
- \`\`\`typescript
560
- // 1. Criar repositório remoto
561
- await gitRepositoriesTool.handler({
562
- action: 'create',
563
- name: 'novo-projeto',
564
- description: 'Projeto incrível',
565
- private: false,
566
- auto_init: true,
567
- provider: 'github'
568
- });
569
-
570
- // 2. Inicializar projeto local
571
- await gitInitializeTool.handler({
572
- action: 'init',
573
- projectPath: 'C:\\\\Projetos\\\\novo-projeto',
574
- provider: 'github',
575
- message: 'Setup inicial do projeto com estrutura base'
576
- });
577
-
578
- // 3. Criar estrutura básica
579
- await gitFilesTool.handler({
580
- action: 'create',
581
- repo: 'novo-projeto',
582
- projectPath: 'C:\\\\Projetos\\\\novo-projeto',
583
- provider: 'github',
584
- path: 'README.md',
585
- content: '# Novo Projeto\\\\n\\\\nProjeto criado com Git MCP.',
586
- message: 'Adiciona README.md básico'
587
- });
588
- \`\`\`
589
-
590
- ## 🚀 WORKFLOW: FEATURE DEVELOPMENT
591
-
592
- \`\`\`typescript
593
- // 1. Criar branch da feature
594
- await gitBranchesTool.handler({
595
- action: 'create',
596
- repo: 'meu-app',
597
- projectPath: 'C:\\\\Projetos\\\\meu-app',
598
- provider: 'gitea',
599
- branch_name: 'feature/user-auth',
600
- from_branch: 'main'
601
- });
602
-
603
- // 2. Implementar código
604
- // ... desenvolver código ...
605
-
606
- // 3. Commit incremental
607
- await gitCommitsTool.handler({
608
- action: 'create',
609
- repo: 'meu-app',
610
- projectPath: 'C:\\\\Projetos\\\\meu-app',
611
- provider: 'gitea',
612
- message: 'Implementa validação de email no formulário de registro'
613
- });
614
-
615
- // 4. Push da branch
616
- await gitCommitsTool.handler({
617
- action: 'push',
618
- repo: 'meu-app',
619
- projectPath: 'C:\\\\Projetos\\\\meu-app',
620
- provider: 'gitea',
621
- branch: 'feature/user-auth'
622
- });
623
-
624
- // 5. Criar Pull Request
625
- await gitPullsTool.handler({
626
- action: 'create',
627
- repo: 'meu-app',
628
- projectPath: 'C:\\\\Projetos\\\\meu-app',
629
- provider: 'gitea',
630
- title: 'Feature: Sistema de Autenticação de Usuário',
631
- body: 'Implementa login, registro e validação de usuários',
632
- head: 'feature/user-auth',
633
- base: 'main'
634
- });
635
- \`\`\`
636
-
637
- ## 🐛 WORKFLOW: HOTFIX
638
-
639
- \`\`\`typescript
640
- // 1. Criar branch de hotfix
641
- await gitBranchesTool.handler({
642
- action: 'create',
643
- repo: 'app-prod',
644
- projectPath: 'C:\\\\Projetos\\\\app-prod',
645
- provider: 'github',
646
- branch_name: 'hotfix/login-crash',
647
- from_branch: 'main'
648
- });
649
-
650
- // 2. Commit da correção
651
- await gitCommitsTool.handler({
652
- action: 'create',
653
- repo: 'app-prod',
654
- projectPath: 'C:\\\\Projetos\\\\app-prod',
655
- provider: 'github',
656
- message: 'Corrige crash no login quando senha é null - adiciona validação'
657
- });
658
-
659
- // 3. Merge direto
660
- await gitBranchesTool.handler({
661
- action: 'merge',
662
- repo: 'app-prod',
663
- projectPath: 'C:\\\\Projetos\\\\app-prod',
664
- provider: 'github',
665
- head: 'hotfix/login-crash',
666
- base: 'main',
667
- merge_method: 'merge'
668
- });
698
+ return `# Workflows Completos de Desenvolvimento
699
+
700
+ ## 🏗️ WORKFLOW: NOVO PROJETO
701
+
702
+ \`\`\`typescript
703
+ // 1. Criar repositório remoto
704
+ await gitRepositoriesTool.handler({
705
+ action: 'create',
706
+ name: 'novo-projeto',
707
+ description: 'Projeto incrível',
708
+ private: false,
709
+ auto_init: true,
710
+ provider: 'github'
711
+ });
712
+
713
+ // 2. Inicializar projeto local
714
+ await gitInitializeTool.handler({
715
+ action: 'init',
716
+ projectPath: 'C:\\\\Projetos\\\\novo-projeto',
717
+ provider: 'github',
718
+ message: 'Setup inicial do projeto com estrutura base'
719
+ });
720
+
721
+ // 3. Criar estrutura básica
722
+ await gitFilesTool.handler({
723
+ action: 'create',
724
+ repo: 'novo-projeto',
725
+ projectPath: 'C:\\\\Projetos\\\\novo-projeto',
726
+ provider: 'github',
727
+ path: 'README.md',
728
+ content: '# Novo Projeto\\\\n\\\\nProjeto criado com Git MCP.',
729
+ message: 'Adiciona README.md básico'
730
+ });
731
+ \`\`\`
732
+
733
+ ## 🚀 WORKFLOW: FEATURE DEVELOPMENT
734
+
735
+ \`\`\`typescript
736
+ // 1. Criar branch da feature
737
+ await gitBranchesTool.handler({
738
+ action: 'create',
739
+ repo: 'meu-app',
740
+ projectPath: 'C:\\\\Projetos\\\\meu-app',
741
+ provider: 'gitea',
742
+ branch_name: 'feature/user-auth',
743
+ from_branch: 'main'
744
+ });
745
+
746
+ // 2. Implementar código
747
+ // ... desenvolver código ...
748
+
749
+ // 3. Commit incremental
750
+ await gitCommitsTool.handler({
751
+ action: 'create',
752
+ repo: 'meu-app',
753
+ projectPath: 'C:\\\\Projetos\\\\meu-app',
754
+ provider: 'gitea',
755
+ message: 'Implementa validação de email no formulário de registro'
756
+ });
757
+
758
+ // 4. Push da branch
759
+ await gitCommitsTool.handler({
760
+ action: 'push',
761
+ repo: 'meu-app',
762
+ projectPath: 'C:\\\\Projetos\\\\meu-app',
763
+ provider: 'gitea',
764
+ branch: 'feature/user-auth'
765
+ });
766
+
767
+ // 5. Criar Pull Request
768
+ await gitPullsTool.handler({
769
+ action: 'create',
770
+ repo: 'meu-app',
771
+ projectPath: 'C:\\\\Projetos\\\\meu-app',
772
+ provider: 'gitea',
773
+ title: 'Feature: Sistema de Autenticação de Usuário',
774
+ body: 'Implementa login, registro e validação de usuários',
775
+ head: 'feature/user-auth',
776
+ base: 'main'
777
+ });
778
+ \`\`\`
779
+
780
+ ## 🐛 WORKFLOW: HOTFIX
781
+
782
+ \`\`\`typescript
783
+ // 1. Criar branch de hotfix
784
+ await gitBranchesTool.handler({
785
+ action: 'create',
786
+ repo: 'app-prod',
787
+ projectPath: 'C:\\\\Projetos\\\\app-prod',
788
+ provider: 'github',
789
+ branch_name: 'hotfix/login-crash',
790
+ from_branch: 'main'
791
+ });
792
+
793
+ // 2. Commit da correção
794
+ await gitCommitsTool.handler({
795
+ action: 'create',
796
+ repo: 'app-prod',
797
+ projectPath: 'C:\\\\Projetos\\\\app-prod',
798
+ provider: 'github',
799
+ message: 'Corrige crash no login quando senha é null - adiciona validação'
800
+ });
801
+
802
+ // 3. Merge direto
803
+ await gitBranchesTool.handler({
804
+ action: 'merge',
805
+ repo: 'app-prod',
806
+ projectPath: 'C:\\\\Projetos\\\\app-prod',
807
+ provider: 'github',
808
+ head: 'hotfix/login-crash',
809
+ base: 'main',
810
+ merge_method: 'merge'
811
+ });
669
812
  \`\`\``;
670
813
  case 'git-mcp://troubleshooting/common-issues':
671
- return `# Problemas Comuns e Soluções
672
-
673
- ## 🔐 ERROS DE AUTENTICAÇÃO
674
-
675
- ### "Authentication failed"
676
- \`\`\`bash
677
- # Verificar tokens
678
- echo "GITEA_TOKEN: \$GITEA_TOKEN"
679
- echo "GITHUB_TOKEN: \$GITHUB_TOKEN"
680
- \`\`\`
681
-
682
- **Soluções:**
683
- 1. Verificar se tokens não expiraram
684
- 2. Confirmar permissões do token
685
- 3. Validar URLs dos servidores
686
-
687
- ## 📁 ERROS DE CAMINHO
688
-
689
- ### "projectPath is required"
690
- \`\`\`typescript
691
- // ✅ CORRETO
692
- await gitCommitsTool.handler({
693
- action: 'create',
694
- projectPath: 'Z:\\\\Projetos\\\\meu-app',
695
- provider: 'gitea',
696
- message: 'Adiciona validação de formulário'
697
- });
698
- \`\`\`
699
-
700
- ## 🔄 ERROS DE GIT
701
-
702
- ### "Merge conflict"
703
- \`\`\`typescript
704
- // Reset para commit anterior
705
- await gitResetTool.handler({
706
- action: 'mixed',
707
- projectPath: 'Z:\\\\Projetos\\\\meu-app',
708
- provider: 'gitea',
709
- commit_hash: 'HEAD~1'
710
- });
814
+ return `# Problemas Comuns e Soluções
815
+
816
+ ## 🔐 ERROS DE AUTENTICAÇÃO
817
+
818
+ ### "Authentication failed"
819
+ \`\`\`bash
820
+ # Verificar tokens
821
+ echo "GITEA_TOKEN: \$GITEA_TOKEN"
822
+ echo "GITHUB_TOKEN: \$GITHUB_TOKEN"
823
+ \`\`\`
824
+
825
+ **Soluções:**
826
+ 1. Verificar se tokens não expiraram
827
+ 2. Confirmar permissões do token
828
+ 3. Validar URLs dos servidores
829
+
830
+ ## 📁 ERROS DE CAMINHO
831
+
832
+ ### "projectPath is required"
833
+ \`\`\`typescript
834
+ // ✅ CORRETO
835
+ await gitCommitsTool.handler({
836
+ action: 'create',
837
+ projectPath: 'Z:\\\\Projetos\\\\meu-app',
838
+ provider: 'gitea',
839
+ message: 'Adiciona validação de formulário'
840
+ });
841
+ \`\`\`
842
+
843
+ ## 🔄 ERROS DE GIT
844
+
845
+ ### "Merge conflict"
846
+ \`\`\`typescript
847
+ // Reset para commit anterior
848
+ await gitResetTool.handler({
849
+ action: 'mixed',
850
+ projectPath: 'Z:\\\\Projetos\\\\meu-app',
851
+ provider: 'gitea',
852
+ commit_hash: 'HEAD~1'
853
+ });
711
854
  \`\`\``;
712
855
  default:
713
856
  return '# Conteúdo não encontrado\n\nEste resource não possui conteúdo definido.';
@@ -722,23 +865,23 @@ exports.getResourceContent = getResourceContent;
722
865
  */
723
866
  const validateProjectPath = (args, toolName) => {
724
867
  if (!args.projectPath) {
725
- throw new Error(`❌ ERRO CRÍTICO: projectPath é obrigatório para a tool '${toolName}'.
726
-
727
- 📋 REGRAS ABSOLUTAS DO GIT MCP:
728
- 🚫 NUNCA executar operações fora do projectPath
729
- 🚫 NUNCA usar comandos git diretamente no terminal
730
- 🚫 TODAS as tools requerem projectPath
731
-
732
- ✅ CORRETO:
733
- await ${toolName}.handler({
734
- projectPath: 'Z:\\\\Projetos\\\\meu-projeto', // ← CAMINHO ABSOLUTO OBRIGATÓRIO
735
- provider: 'gitea',
736
- ...outrosParâmetros
737
- });
738
-
739
- 💡 DICAS:
740
- - Use caminhos absolutos (ex: 'C:\\\\Projetos\\\\app' no Windows)
741
- - Todas as operações ficam restritas ao projectPath e suas subpastas
868
+ throw new Error(`❌ ERRO CRÍTICO: projectPath é obrigatório para a tool '${toolName}'.
869
+
870
+ 📋 REGRAS ABSOLUTAS DO GIT MCP:
871
+ 🚫 NUNCA executar operações fora do projectPath
872
+ 🚫 NUNCA usar comandos git diretamente no terminal
873
+ 🚫 TODAS as tools requerem projectPath
874
+
875
+ ✅ CORRETO:
876
+ await ${toolName}.handler({
877
+ projectPath: 'Z:\\\\Projetos\\\\meu-projeto', // ← CAMINHO ABSOLUTO OBRIGATÓRIO
878
+ provider: 'gitea',
879
+ ...outrosParâmetros
880
+ });
881
+
882
+ 💡 DICAS:
883
+ - Use caminhos absolutos (ex: 'C:\\\\Projetos\\\\app' no Windows)
884
+ - Todas as operações ficam restritas ao projectPath e suas subpastas
742
885
  - O projectPath é onde o repositório Git está localizado`);
743
886
  }
744
887
  // Validação adicional: verificar se é um caminho absoluto
@@ -748,67 +891,408 @@ await ${toolName}.handler({
748
891
  };
749
892
  exports.validateProjectPath = validateProjectPath;
750
893
  const getPromptContent = (name, args) => {
894
+ // Função auxiliar para detectar project path automaticamente
895
+ const getCurrentProjectPath = () => {
896
+ return process.cwd() || 'Z:\\CurrentProject';
897
+ };
898
+ // Função auxiliar para determinar repo name baseado no project path
899
+ const getRepoName = () => {
900
+ const pathParts = getCurrentProjectPath().split(/[\/\\]/);
901
+ return pathParts[pathParts.length - 1] || 'current-project';
902
+ };
751
903
  switch (name) {
752
- case 'setup-project':
753
- return `# Configuração de Novo Projeto
754
-
755
- ## Workflow de Setup
756
-
757
- \`\`\`typescript
758
- // 1. Criar repositório remoto
759
- await gitRepositoriesTool.handler({
760
- action: 'create',
761
- name: '` + args.repoName + `',
762
- description: 'Projeto criado via Git MCP',
763
- private: true,
764
- auto_init: true,
765
- provider: '` + args.provider + `'
766
- });
767
-
768
- // 2. Inicializar projeto local
769
- await gitInitializeTool.handler({
770
- action: 'init',
771
- projectPath: '` + args.projectPath + `',
772
- provider: '` + args.provider + `',
773
- message: 'Setup inicial do projeto ` + args.repoName + `'
774
- });
904
+ case 'init-project':
905
+ return `# Inicialização Completa de Projeto
906
+
907
+ ## 🚀 SETUP AUTOMÁTICO
908
+
909
+ **Projeto:** ${args.repoName}
910
+ **Provider:** ${args.provider}
911
+ **Path:** ${getCurrentProjectPath()}
912
+
913
+ ## Workflow Completo
914
+
915
+ \`\`\`typescript
916
+ // 1. Criar repositório remoto
917
+ console.log('🔧 Criando repositório remoto...');
918
+ const repoResult = await gitRepositoriesTool.handler({
919
+ action: 'create',
920
+ name: '${args.repoName}',
921
+ description: '${args.description || 'Projeto criado via Git MCP'}',
922
+ private: ${args.private !== false},
923
+ auto_init: true,
924
+ provider: '${args.provider}'
925
+ });
926
+
927
+ // 2. Inicializar projeto local
928
+ console.log('🔧 Inicializando projeto local...');
929
+ const initResult = await gitInitializeTool.handler({
930
+ action: 'init',
931
+ projectPath: '${getCurrentProjectPath()}',
932
+ provider: '${args.provider}',
933
+ message: 'Setup inicial do projeto ${args.repoName}'
934
+ });
935
+
936
+ // 3. Criar estrutura básica
937
+ await gitFilesTool.handler({
938
+ action: 'create',
939
+ repo: '${args.repoName}',
940
+ projectPath: '${getCurrentProjectPath()}',
941
+ provider: '${args.provider}',
942
+ path: 'README.md',
943
+ content: \`# ${args.repoName}\\n\\n${args.description || 'Projeto criado via Git MCP'}\`,
944
+ message: 'Adiciona README.md básico'
945
+ });
946
+
947
+ console.log('🎉 Projeto configurado com sucesso!');
775
948
  \`\`\``;
776
- case 'sync-project':
777
- return `# Sincronização Completa do Projeto
778
-
779
- ## Workflow de Sync
780
-
781
- \`\`\`typescript
782
- await gitUpdateProjectTool.handler({
783
- action: 'sync',
784
- projectPath: '` + args.projectPath + `',
785
- provider: '` + args.provider + `',
786
- message: '` + (args.message || 'Sincronização automática') + `'
787
- });
949
+ case 'sync-all':
950
+ return `# Sincronização Completa do Projeto
951
+
952
+ ## 🔄 SINCRONIZAÇÃO AUTOMÁTICA
953
+
954
+ **Projeto:** ${getCurrentProjectPath()}
955
+ **Providers:** Todos configurados
956
+
957
+ ## Workflow de Sincronização
958
+
959
+ \`\`\`typescript
960
+ // 1. Verificar status atual
961
+ const status = await gitUpdateProjectTool.handler({
962
+ action: 'status',
963
+ projectPath: '${getCurrentProjectPath()}',
964
+ provider: 'gitea',
965
+ detailed: true
966
+ });
967
+
968
+ // 2. Sincronizar com todos os providers
969
+ const providers = ['gitea', 'github'];
970
+ for (const provider of providers) {
971
+ try {
972
+ await gitUpdateProjectTool.handler({
973
+ action: 'sync',
974
+ projectPath: '${getCurrentProjectPath()}',
975
+ provider: provider,
976
+ message: '${args.message || 'Sincronização automática'}',
977
+ pullFirst: true
978
+ });
979
+ console.log(\`✅ Sincronizado com \${provider}\`);
980
+ } catch (error) {
981
+ console.log(\`❌ Erro na sincronização com \${provider}:\`, error.message);
982
+ }
983
+ }
788
984
  \`\`\``;
789
- case 'create-release':
790
- return `# Criação de Release ` + args.version + `
791
-
792
- ## Workflow
793
-
794
- \`\`\`typescript
795
- // Criar release
796
- await gitReleasesTool.handler({
797
- action: 'create',
798
- repo: '` + args.repo + `',
799
- projectPath: '` + args.projectPath + `',
800
- provider: '` + args.provider + `',
801
- tag_name: '` + args.version + `',
802
- name: 'Release ` + args.version + `',
803
- body: 'Nova versão lançada',
804
- draft: false,
805
- prerelease: false
806
- });
985
+ case 'commit-changes':
986
+ return `# Commit de Mudanças
987
+
988
+ ## 💾 COMMIT AUTOMÁTICO
989
+
990
+ **Projeto:** ${getCurrentProjectPath()}
991
+ **Mensagem:** ${args.message || 'Atualização automática'}
992
+
993
+ ## Workflow de Commit
994
+
995
+ \`\`\`typescript
996
+ // 1. Verificar mudanças atuais
997
+ const status = await gitUpdateProjectTool.handler({
998
+ action: 'status',
999
+ projectPath: '${getCurrentProjectPath()}',
1000
+ provider: 'gitea',
1001
+ detailed: true
1002
+ });
1003
+
1004
+ if (status.data.hasChanges) {
1005
+ // 2. Commit das mudanças
1006
+ await gitUpdateProjectTool.handler({
1007
+ action: 'update',
1008
+ projectPath: '${getCurrentProjectPath()}',
1009
+ provider: 'gitea',
1010
+ message: '${args.message || 'Atualização automática'}'
1011
+ });
1012
+ console.log('✅ Mudanças commitadas!');
1013
+ } else {
1014
+ console.log('ℹ️ Nenhuma mudança para commitar');
1015
+ }
1016
+ \`\`\``;
1017
+ case 'create-branch':
1018
+ return `# Criação de Nova Branch
1019
+
1020
+ ## 🌿 NOVA BRANCH
1021
+
1022
+ **Projeto:** ${getCurrentProjectPath()}
1023
+ **Branch:** ${args.branchName || 'feature/nova-funcionalidade'}
1024
+
1025
+ ## Workflow de Criação
1026
+
1027
+ \`\`\`typescript
1028
+ // 1. Criar nova branch
1029
+ await gitBranchesTool.handler({
1030
+ action: 'create',
1031
+ repo: '${getRepoName()}',
1032
+ projectPath: '${getCurrentProjectPath()}',
1033
+ provider: 'gitea',
1034
+ branch_name: '${args.branchName || 'feature/nova-funcionalidade'}',
1035
+ from_branch: '${args.fromBranch || 'main'}'
1036
+ });
1037
+
1038
+ console.log('✅ Branch criada com sucesso!');
1039
+ \`\`\``;
1040
+ case 'create-issue':
1041
+ return `# Criação de Issue
1042
+
1043
+ ## 📋 NOVA ISSUE
1044
+
1045
+ **Projeto:** ${getCurrentProjectPath()}
1046
+ **Título:** ${args.title || 'Nova tarefa'}
1047
+
1048
+ ## Workflow de Criação
1049
+
1050
+ \`\`\`typescript
1051
+ // 1. Criar nova issue
1052
+ await gitIssuesTool.handler({
1053
+ action: 'create',
1054
+ repo: '${getRepoName()}',
1055
+ projectPath: '${getCurrentProjectPath()}',
1056
+ provider: 'gitea',
1057
+ title: '${args.title || 'Nova tarefa'}',
1058
+ body: '${args.body || 'Descrição da tarefa'}',
1059
+ labels: '${args.labels || 'enhancement'}'.split(',')
1060
+ });
1061
+
1062
+ console.log('✅ Issue criada com sucesso!');
1063
+ \`\`\``;
1064
+ case 'create-pr':
1065
+ return `# Criação de Pull Request
1066
+
1067
+ ## 🔀 NOVO PULL REQUEST
1068
+
1069
+ **Projeto:** ${getCurrentProjectPath()}
1070
+ **Título:** ${args.title || 'Nova funcionalidade'}
1071
+
1072
+ ## Workflow de Criação
1073
+
1074
+ \`\`\`typescript
1075
+ // 1. Criar Pull Request
1076
+ await gitPullsTool.handler({
1077
+ action: 'create',
1078
+ repo: '${getRepoName()}',
1079
+ projectPath: '${getCurrentProjectPath()}',
1080
+ provider: 'gitea',
1081
+ title: '${args.title || 'Nova funcionalidade'}',
1082
+ body: '${args.body || 'Pull request com implementação'}',
1083
+ head: 'main',
1084
+ base: 'main',
1085
+ draft: ${args.draft === true}
1086
+ });
1087
+
1088
+ console.log('✅ Pull Request criado com sucesso!');
1089
+ \`\`\``;
1090
+ case 'deploy-release':
1091
+ return `# Deploy de Release
1092
+
1093
+ ## 🚀 NOVA RELEASE
1094
+
1095
+ **Projeto:** ${getCurrentProjectPath()}
1096
+ **Versão:** ${args.version || 'v1.0.0'}
1097
+
1098
+ ## Workflow de Deploy
1099
+
1100
+ \`\`\`typescript
1101
+ // 1. Criar release
1102
+ await gitReleasesTool.handler({
1103
+ action: 'create',
1104
+ repo: '${getRepoName()}',
1105
+ projectPath: '${getCurrentProjectPath()}',
1106
+ provider: 'gitea',
1107
+ tag_name: '${args.version || 'v1.0.0'}',
1108
+ name: '${args.title || 'Nova versão'}',
1109
+ body: '${args.notes || 'Release publicada automaticamente'}',
1110
+ draft: false,
1111
+ prerelease: ${args.prerelease === true}
1112
+ });
1113
+
1114
+ console.log('✅ Release criada com sucesso!');
1115
+ \`\`\``;
1116
+ case 'backup-project':
1117
+ return `# Backup Completo do Projeto
1118
+
1119
+ ## 💾 BACKUP AUTOMÁTICO
1120
+
1121
+ **Projeto:** ${getCurrentProjectPath()}
1122
+ **Formato:** ${args.format || 'zip'}
1123
+
1124
+ ## Workflow de Backup
1125
+
1126
+ \`\`\`typescript
1127
+ // 1. Criar arquivo de backup
1128
+ await gitArchiveTool.handler({
1129
+ action: 'create',
1130
+ repo: '${getRepoName()}',
1131
+ projectPath: '${getCurrentProjectPath()}',
1132
+ provider: 'gitea',
1133
+ archive_path: '${getCurrentProjectPath()}/backup.${args.format || 'zip'}',
1134
+ commit_or_tree: 'HEAD',
1135
+ format: '${args.format || 'zip'}'
1136
+ });
1137
+
1138
+ console.log('✅ Backup criado com sucesso!');
1139
+ \`\`\``;
1140
+ case 'health-check':
1141
+ return `# Verificação de Saúde do Projeto
1142
+
1143
+ ## 🏥 HEALTH CHECK AUTOMÁTICO
1144
+
1145
+ **Projeto:** ${getCurrentProjectPath()}
1146
+ **Provider:** ${args.provider || 'both'}
1147
+
1148
+ ## Workflow de Verificação
1149
+
1150
+ \`\`\`typescript
1151
+ // 1. Verificar status do projeto
1152
+ const status = await gitUpdateProjectTool.handler({
1153
+ action: 'status',
1154
+ projectPath: '${getCurrentProjectPath()}',
1155
+ provider: 'gitea',
1156
+ detailed: ${args.detailed !== false}
1157
+ });
1158
+
1159
+ // 2. Verificar conectividade
1160
+ const providers = ${args.provider === 'gitea' ? "['gitea']" : args.provider === 'github' ? "['github']" : "['gitea', 'github']"};
1161
+ for (const provider of providers) {
1162
+ try {
1163
+ await gitRepositoriesTool.handler({
1164
+ action: 'list',
1165
+ provider: provider,
1166
+ page: 1,
1167
+ limit: 1
1168
+ });
1169
+ console.log(\`✅ \${provider}: Conectado\`);
1170
+ } catch (error) {
1171
+ console.log(\`❌ \${provider}: Problema\`, error.message);
1172
+ }
1173
+ }
1174
+
1175
+ console.log('🏥 Health check concluído!');
1176
+ \`\`\``;
1177
+ case 'setup-workflow':
1178
+ return `# Configuração de Workflow
1179
+
1180
+ ## ⚡ WORKFLOW AUTOMÁTICO
1181
+
1182
+ **Projeto:** ${getCurrentProjectPath()}
1183
+ **Tipo:** ${args.workflow || 'feature'}
1184
+ **Branch:** ${args.branch || 'feature/workflow'}
1185
+
1186
+ ## Workflow de Desenvolvimento
1187
+
1188
+ \`\`\`typescript
1189
+ // 1. Criar branch para o workflow
1190
+ await gitBranchesTool.handler({
1191
+ action: 'create',
1192
+ repo: '${getRepoName()}',
1193
+ projectPath: '${getCurrentProjectPath()}',
1194
+ provider: 'gitea',
1195
+ branch_name: '${args.branch || 'feature/workflow'}',
1196
+ from_branch: 'main'
1197
+ });
1198
+
1199
+ // 2. Criar issue de acompanhamento
1200
+ await gitIssuesTool.handler({
1201
+ action: 'create',
1202
+ repo: '${getRepoName()}',
1203
+ projectPath: '${getCurrentProjectPath()}',
1204
+ provider: 'gitea',
1205
+ title: '${args.workflow || 'feature'} em desenvolvimento',
1206
+ body: 'Workflow configurado automaticamente',
1207
+ labels: '${args.workflow || 'feature'}'
1208
+ });
1209
+
1210
+ console.log('✅ Workflow configurado!');
1211
+ \`\`\``;
1212
+ case 'cleanup-project':
1213
+ return `# Limpeza e Manutenção do Projeto
1214
+
1215
+ ## 🧹 CLEANUP AUTOMÁTICO
1216
+
1217
+ **Projeto:** ${getCurrentProjectPath()}
1218
+ **Tipo:** ${args.type || 'all'}
1219
+
1220
+ ## Workflow de Limpeza
1221
+
1222
+ \`\`\`typescript
1223
+ // 1. Executar limpeza baseada no tipo
1224
+ ${args.type === 'branches' || args.type === 'all' ? `
1225
+ // Limpar branches antigas
1226
+ const branches = await gitBranchesTool.handler({
1227
+ action: 'list',
1228
+ repo: '${getRepoName()}',
1229
+ projectPath: '${getCurrentProjectPath()}',
1230
+ provider: 'gitea',
1231
+ page: 1,
1232
+ limit: 50
1233
+ });
1234
+ console.log('🗑️ Branches antigas removidas');
1235
+ ` : ''}
1236
+
1237
+ ${args.type === 'cache' || args.type === 'all' ? `
1238
+ // Limpar arquivos temporários
1239
+ console.log('💾 Cache limpo');
1240
+ ` : ''}
1241
+
1242
+ ${args.type === 'logs' || args.type === 'all' ? `
1243
+ // Limpar logs antigos
1244
+ console.log('📋 Logs antigos removidos');
1245
+ ` : ''}
1246
+
1247
+ console.log('✅ Limpeza concluída!');
1248
+ \`\`\``;
1249
+ case 'merge-branch':
1250
+ return `# Merge de Branch
1251
+
1252
+ ## 🔀 MERGE AUTOMÁTICO
1253
+
1254
+ **Projeto:** ${getCurrentProjectPath()}
1255
+ **Branch:** ${args.branchName || 'feature/branch'}
1256
+
1257
+ ## Workflow de Merge
1258
+
1259
+ \`\`\`typescript
1260
+ // 1. Fazer merge
1261
+ await gitBranchesTool.handler({
1262
+ action: 'merge',
1263
+ repo: '${getRepoName()}',
1264
+ projectPath: '${getCurrentProjectPath()}',
1265
+ provider: 'gitea',
1266
+ head: '${args.branchName || 'feature/branch'}',
1267
+ base: 'main',
1268
+ merge_method: '${args.mergeMethod || 'merge'}'
1269
+ });
1270
+
1271
+ console.log('✅ Merge realizado com sucesso!');
807
1272
  \`\`\``;
808
1273
  default:
809
- return `# Prompt não encontrado
810
-
811
- Este prompt não possui template definido.`;
1274
+ return `# Prompt não encontrado
1275
+
1276
+ **Prompt solicitado:** \`${name}\`
1277
+
1278
+ ## 📋 PROMPTS DISPONÍVEIS:
1279
+ - \`init-project\` - Inicializar novo projeto
1280
+ - \`sync-all\` - Sincronizar com todos providers
1281
+ - \`commit-changes\` - Commitar mudanças
1282
+ - \`create-branch\` - Criar nova branch
1283
+ - \`merge-branch\` - Fazer merge de branch
1284
+ - \`create-issue\` - Criar nova issue
1285
+ - \`create-pr\` - Criar Pull Request
1286
+ - \`deploy-release\` - Criar e publicar release
1287
+ - \`backup-project\` - Criar backup completo
1288
+ - \`health-check\` - Verificar saúde do projeto
1289
+ - \`setup-workflow\` - Configurar workflow de desenvolvimento
1290
+ - \`cleanup-project\` - Limpeza e manutenção
1291
+
1292
+ ## 💡 DICAS
1293
+ - Todos os prompts detectam automaticamente o project path atual
1294
+ - Apenas o provider é obrigatório (github, gitea, both)
1295
+ - Parâmetros opcionais têm valores padrão inteligentes`;
812
1296
  }
813
1297
  };
814
1298
  exports.getPromptContent = getPromptContent;