@andrebuzeli/git-mcp 15.11.6 → 15.11.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrebuzeli/git-mcp",
3
- "version": "15.11.6",
3
+ "version": "15.11.8",
4
4
  "private": false,
5
5
  "description": "MCP server para Git com operações locais e sincronização paralela GitHub/Gitea",
6
6
  "license": "MIT",
package/src/index.js CHANGED
@@ -23,7 +23,6 @@ import { createGitMergeTool } from "./tools/git-merge.js";
23
23
  import { createGitDiffTool } from "./tools/git-diff.js";
24
24
  import { createGitCloneTool } from "./tools/git-clone.js";
25
25
  import { createGitHelpTool } from "./tools/git-help.js";
26
- import { createGitUpdateTool } from "./tools/git-update.js";
27
26
  import { getResources, readResource } from "./resources/index.js";
28
27
  import { createPromptsHandler, PROMPTS } from "./prompts/index.js";
29
28
 
@@ -62,7 +61,7 @@ const ajv = new Ajv({ allErrors: true });
62
61
  const tools = [
63
62
  createGitHelpTool(), // Primeiro: AI pode pedir ajuda
64
63
  createGitWorkflowTool(pm, git),
65
- createGitUpdateTool(pm, git),
64
+ createGitWorkflowTool(pm, git),
66
65
  createGitRemoteTool(pm, git),
67
66
  createGitBranchesTool(git),
68
67
  createGitTagsTool(git),
@@ -92,8 +92,7 @@ ${context.notAdded?.map(f => `- ${f}`).join("\n") || "Nenhum"}
92
92
  ## Instruções
93
93
 
94
94
  Forneça um resumo do status atual e sugira próximos passos. UTILIZANDO APENAS AS TOOLS DO GIT-MCP:
95
- - **PREFERENCIAL**: Use \`git-update\` para atualizar o projeto (add+commit+push em uma chamada)
96
- - Use \`git-workflow\` para operações individuais (add, commit, push separados)
95
+ - Use \`git-workflow\` para operações (status, add, commit, push)
97
96
  - Use \`git-branches\` para gerenciar branches`
98
97
  }
99
98
  }]
@@ -195,14 +194,12 @@ ${context.staged?.length > 0
195
194
  ? `Crie um commit com as mudanças staged. ${userMessage ? `Use a mensagem fornecida pelo usuário: "${userMessage}"` : "Se não houver mensagem do usuário, sugira uma mensagem descritiva baseada nas mudanças."}
196
195
 
197
196
  UTILIZANDO APENAS AS TOOLS DO GIT-MCP:
198
- - **PREFERENCIAL**: Use \`git-update\` com a mensagem para fazer add+commit+push de uma vez
199
- - Alternativa: Use \`git-workflow commit\` para apenas commitar (sem push)
197
+ - Use \`git-workflow commit\` para commitar
200
198
  - NÃO configure email (o usuário não quer isso)`
201
199
  : `Não há arquivos staged para commit.
202
200
 
203
201
  UTILIZANDO APENAS AS TOOLS DO GIT-MCP:
204
- - **PREFERENCIAL**: Use \`git-update\` com a mensagem para add+commit+push automaticamente
205
- - Alternativa: Use \`git-workflow add\` seguido de \`git-workflow commit\``}`
202
+ - Use \`git-workflow add\` seguido de \`git-workflow commit\` (sequencialmente)`}`
206
203
  }
207
204
  }];
208
205
  }
@@ -230,7 +227,6 @@ ${context.remotes?.map(r => `- **${r.name}**: ${r.url}`).join("\n") || "Nenhum"}
230
227
  ## Instruções
231
228
 
232
229
  Envie os commits locais para os remotes (GitHub/Gitea). UTILIZANDO APENAS AS TOOLS DO GIT-MCP:
233
- - **PREFERENCIAL**: Use \`git-update\` se ainda há mudanças para commitar (faz add+commit+push)
234
230
  - Use \`git-workflow push\` para enviar commits já feitos para todos os remotes
235
231
  - ${forceFlag ? "Use force=true se necessário (foi solicitado)" : "Use force=true apenas se push for rejeitado"}
236
232
  - Se não houver remotes configurados, use \`git-remote ensure\` primeiro`
@@ -530,7 +526,7 @@ Analise os commits e execute os passos para criar a release${assetsInstructions
530
526
  role: "user",
531
527
  content: {
532
528
  type: "text",
533
- text: `# Atualizar Projeto nos Providers
529
+ text: `# Atualizar Projeto nos Providers (Fluxo Manual)
534
530
 
535
531
  Você precisa atualizar este projeto Git nos providers remotos (GitHub/Gitea).
536
532
 
@@ -548,22 +544,22 @@ ${context.modified?.map(f => `- ${f}`).join("\n") || "Nenhum"}
548
544
 
549
545
  ## Instruções
550
546
 
551
- **USE A TOOL \`git-update\` para atualizar o projeto em UMA ÚNICA CHAMADA:**
547
+ Execute a atualização passo-a-passo utilizando o \`git-workflow\`.
548
+ Não chame tools inválidas como git-update. Use a sequência abaixo:
552
549
 
553
- \`\`\`json
554
- {
555
- "projectPath": "${context.projectPath}",
556
- "message": "feat/fix/chore: descrição das mudanças"
557
- }
558
- \`\`\`
550
+ 1. **Verificar mudanças** (se necessário):
551
+ \`git-workflow\` action="status"
552
+
553
+ 2. **Adicionar arquivos**:
554
+ \`git-workflow\` action="add" files=["."]
559
555
 
560
- A tool \`git-update\` executa automaticamente: status → add → commit → push.
556
+ 3. **Criar commit**:
557
+ \`git-workflow\` action="commit" message="tipo: descrição"
561
558
 
562
- ### Quando NÃO usar git-update:
563
- - Se **não é repositório Git**: Use \`git-workflow init\` primeiro
564
- - Se **não há remotes**: Use \`git-remote ensure\` primeiro
559
+ 4. **Enviar para remotes**:
560
+ \`git-workflow\` action="push"
565
561
 
566
- UTILIZANDO APENAS AS TOOLS DO GIT-MCP. Prefira \`git-update\` para atualizações rápidas.`
562
+ UTILIZANDO APENAS AS TOOLS DO GIT-MCP.`
567
563
  }
568
564
  }]
569
565
  }
@@ -29,11 +29,7 @@ export function createGitHelpTool() {
29
29
  actions: ["init", "status", "add", "remove", "commit", "push", "ensure-remotes", "clean"],
30
30
  useWhen: "Começar projeto, salvar mudanças, enviar para GitHub/Gitea"
31
31
  },
32
- "git-update": {
33
- purpose: "Atualização completa em uma chamada: status → add → commit → push",
34
- params: ["projectPath", "message", "files", "force", "dryRun"],
35
- useWhen: "Atualizar projeto rapidamente com uma única chamada"
36
- },
32
+ // git-update removido: usar git-workflow actions em sequência
37
33
  "git-branches": {
38
34
  purpose: "Gerenciar branches: criar, listar, trocar, deletar",
39
35
  actions: ["list", "create", "checkout", "delete", "rename"],
@@ -122,11 +118,8 @@ export function createGitHelpTool() {
122
118
  ]
123
119
  },
124
120
  "salvar-mudancas": {
125
- description: "Salvar e enviar mudanças (RECOMENDADO: use git-update)",
121
+ description: "Salvar e enviar mudanças",
126
122
  steps: [
127
- { tool: "git-update", params: { message: "sua mensagem" }, note: "Faz add+commit+push automaticamente" }
128
- ],
129
- alternativa: [
130
123
  { tool: "git-workflow", action: "status", note: "Ver o que mudou" },
131
124
  { tool: "git-workflow", action: "add", params: { files: ["."] } },
132
125
  { tool: "git-workflow", action: "commit", params: { message: "sua mensagem" } },
@@ -179,9 +172,9 @@ export function createGitHelpTool() {
179
172
  "iniciar projeto": "git-workflow (action=init)",
180
173
  "novo projeto": "git-workflow (action=init)",
181
174
  "commit": "git-workflow (action=commit)",
182
- "salvar": "git-update (message='sua mensagem')",
183
- "atualizar": "git-update (message='sua mensagem')",
184
- "update": "git-update (message='sua mensagem')",
175
+ "salvar": "git-workflow (actions: add, commit, push)",
176
+ "atualizar": "git-workflow (actions: add, commit, push)",
177
+ "update": "git-workflow (actions: add, commit, push)",
185
178
  "push": "git-workflow (action=push)",
186
179
  "enviar": "git-workflow (action=push)",
187
180
  "branch": "git-branches",
@@ -1,171 +0,0 @@
1
- import Ajv from "ajv";
2
- import { MCPError, asToolError, asToolResult, errorToResponse, createError } from "../utils/errors.js";
3
- import { getRepoNameFromPath, validateProjectPath, withRetry } from "../utils/repoHelpers.js";
4
-
5
- const ajv = new Ajv({ allErrors: true });
6
-
7
- export function createGitUpdateTool(pm, git) {
8
- const inputSchema = {
9
- type: "object",
10
- properties: {
11
- projectPath: {
12
- type: "string",
13
- description: "Caminho absoluto do diretório do projeto (ex: 'C:/Users/user/projeto' ou '/home/user/projeto')"
14
- },
15
- message: {
16
- type: "string",
17
- description: "Mensagem do commit (obrigatório). Ex: 'feat: adiciona nova funcionalidade'"
18
- },
19
- files: {
20
- type: "array",
21
- items: { type: "string" },
22
- description: "Lista de arquivos para adicionar ao staging. Use ['.'] para todos os arquivos. Default: ['.']"
23
- },
24
- force: {
25
- type: "boolean",
26
- description: "Force push (use apenas se push normal falhar com erro de histórico divergente). Default: false"
27
- },
28
- skipIfClean: {
29
- type: "boolean",
30
- description: "Se true, retorna sucesso sem erro quando não há mudanças. Default: true"
31
- },
32
- dryRun: {
33
- type: "boolean",
34
- description: "Se true, simula a operação sem executar (útil para testes). Default: false"
35
- }
36
- },
37
- required: ["projectPath", "message"],
38
- additionalProperties: false
39
- };
40
-
41
- const description = `Atualização completa do projeto em uma única operação (status → add → commit → push).
42
-
43
- QUANDO USAR:
44
- - Após fazer mudanças em um projeto e querer sincronizar com os remotes
45
- - Quando precisa fazer add + commit + push de uma vez só
46
- - Para automatizar o fluxo de trabalho Git
47
-
48
- O QUE FAZ AUTOMATICAMENTE:
49
- 1. Verifica status do repositório
50
- 2. Adiciona arquivos ao staging (git add)
51
- 3. Cria commit com a mensagem fornecida
52
- 4. Faz push para GitHub E Gitea em paralelo
53
-
54
- EXEMPLO DE USO:
55
- • Atualizar projeto: { "projectPath": "/path/to/project", "message": "feat: nova funcionalidade" }
56
- • Dry run: { "projectPath": "/path/to/project", "message": "test", "dryRun": true }
57
- • Force push: { "projectPath": "/path/to/project", "message": "fix: correção", "force": true }
58
-
59
- RETORNO:
60
- Retorna um resumo de todas as operações realizadas: status, add, commit e push.`;
61
-
62
- async function handle(args) {
63
- const validate = ajv.compile(inputSchema);
64
- if (!validate(args || {})) {
65
- return asToolError("VALIDATION_ERROR", "Parâmetros inválidos", validate.errors);
66
- }
67
-
68
- const { projectPath, message, dryRun = false, force = false, skipIfClean = true } = args;
69
- const files = Array.isArray(args.files) && args.files.length ? args.files : ["."];
70
-
71
- try {
72
- validateProjectPath(projectPath);
73
-
74
- const operations = {};
75
- const errors = [];
76
-
77
- // Step 1: Status
78
- const status = await git.status(projectPath);
79
- operations.status = {
80
- modified: status.modified?.length || 0,
81
- created: status.created?.length || 0,
82
- deleted: status.deleted?.length || 0,
83
- notAdded: status.not_added?.length || 0,
84
- staged: status.staged?.length || 0,
85
- isClean: status.isClean
86
- };
87
-
88
- // Check if there's anything to commit
89
- const hasUnstaged = (status.not_added?.length > 0) ||
90
- (status.modified?.length > 0) ||
91
- (status.created?.length > 0) ||
92
- (status.deleted?.length > 0);
93
- const hasStaged = status.staged?.length > 0;
94
- const hasChanges = hasUnstaged || hasStaged;
95
-
96
- if (!hasChanges) {
97
- if (skipIfClean) {
98
- return asToolResult({
99
- success: true,
100
- skipped: true,
101
- message: "Repositório limpo - nenhuma mudança para commitar",
102
- operations
103
- });
104
- } else {
105
- return asToolError("NO_CHANGES", "Nenhuma mudança encontrada para commitar", {
106
- suggestion: "Faça alterações em arquivos antes de usar git-update"
107
- });
108
- }
109
- }
110
-
111
- // Dry run mode - return preview
112
- if (dryRun) {
113
- return asToolResult({
114
- success: true,
115
- dryRun: true,
116
- message: "DRY RUN: Operações que seriam executadas",
117
- operations,
118
- preview: {
119
- add: files,
120
- commit: message,
121
- push: { force, remotes: ["github", "gitea"] }
122
- }
123
- });
124
- }
125
-
126
- // Step 2: Add
127
- await git.add(projectPath, files);
128
- operations.add = { files, success: true };
129
-
130
- // Step 3: Commit
131
- const sha = await git.commit(projectPath, message);
132
- operations.commit = { sha, message, success: true };
133
-
134
- // Step 4: Push
135
- const branch = await git.getCurrentBranch(projectPath);
136
- const pushResult = await withRetry(
137
- () => git.pushParallel(projectPath, branch, force),
138
- 3,
139
- "push"
140
- );
141
- operations.push = {
142
- branch,
143
- pushed: pushResult.pushed || [],
144
- failed: pushResult.failed || [],
145
- success: true
146
- };
147
-
148
- // Build summary
149
- const totalFiles = operations.status.modified + operations.status.created + operations.status.deleted + operations.status.notAdded;
150
- const pushedTo = operations.push.pushed.join(", ") || "nenhum remote";
151
- const summary = `${totalFiles} arquivo(s) commitados e enviados para ${pushedTo}`;
152
-
153
- return asToolResult({
154
- success: true,
155
- summary,
156
- operations,
157
- sha: operations.commit.sha
158
- }, { tool: 'update', action: 'complete' });
159
-
160
- } catch (e) {
161
- return errorToResponse(e);
162
- }
163
- }
164
-
165
- return {
166
- name: "git-update",
167
- description,
168
- inputSchema,
169
- handle
170
- };
171
- }