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