@andrebuzeli/git-mcp 2.12.8 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +109 -51
- package/dist/server.js.map +1 -1
- package/dist/tools/branches.d.ts +2 -2
- package/dist/tools/code-review.d.ts +4 -4
- package/dist/tools/commits.d.ts +2 -2
- package/dist/tools/deployments.d.ts +4 -4
- package/dist/tools/gh-actions.d.ts +272 -0
- package/dist/tools/gh-actions.d.ts.map +1 -0
- package/dist/tools/gh-actions.js +479 -0
- package/dist/tools/gh-actions.js.map +1 -0
- package/dist/tools/gh-analytics.d.ts +326 -0
- package/dist/tools/gh-analytics.d.ts.map +1 -0
- package/dist/tools/gh-analytics.js +524 -0
- package/dist/tools/gh-analytics.js.map +1 -0
- package/dist/tools/gh-code-review.d.ts +323 -0
- package/dist/tools/gh-code-review.d.ts.map +1 -0
- package/dist/tools/gh-code-review.js +577 -0
- package/dist/tools/gh-code-review.js.map +1 -0
- package/dist/tools/gh-codespaces.d.ts +154 -0
- package/dist/tools/gh-codespaces.d.ts.map +1 -0
- package/dist/tools/gh-codespaces.js +286 -0
- package/dist/tools/gh-codespaces.js.map +1 -0
- package/dist/tools/gh-deployments.d.ts +319 -0
- package/dist/tools/gh-deployments.d.ts.map +1 -0
- package/dist/tools/gh-deployments.js +384 -0
- package/dist/tools/gh-deployments.js.map +1 -0
- package/dist/tools/gh-gists.d.ts +194 -0
- package/dist/tools/gh-gists.d.ts.map +1 -0
- package/dist/tools/gh-gists.js +328 -0
- package/dist/tools/gh-gists.js.map +1 -0
- package/dist/tools/gh-projects.d.ts +225 -0
- package/dist/tools/gh-projects.d.ts.map +1 -0
- package/dist/tools/gh-projects.js +365 -0
- package/dist/tools/gh-projects.js.map +1 -0
- package/dist/tools/gh-security.d.ts +341 -0
- package/dist/tools/gh-security.d.ts.map +1 -0
- package/dist/tools/gh-security.js +427 -0
- package/dist/tools/gh-security.js.map +1 -0
- package/dist/tools/gh-sync.d.ts +229 -0
- package/dist/tools/gh-sync.d.ts.map +1 -0
- package/dist/tools/gh-sync.js +384 -0
- package/dist/tools/gh-sync.js.map +1 -0
- package/dist/tools/gh-workflows.d.ts +313 -0
- package/dist/tools/gh-workflows.d.ts.map +1 -0
- package/dist/tools/gh-workflows.js +462 -0
- package/dist/tools/gh-workflows.js.map +1 -0
- package/dist/tools/git-archive.d.ts +169 -0
- package/dist/tools/git-archive.d.ts.map +1 -0
- package/dist/tools/git-archive.js +235 -0
- package/dist/tools/git-archive.js.map +1 -0
- package/dist/tools/git-branches.d.ts +438 -0
- package/dist/tools/git-branches.d.ts.map +1 -0
- package/dist/tools/git-branches.js +525 -0
- package/dist/tools/git-branches.js.map +1 -0
- package/dist/tools/git-bundle.d.ts +175 -0
- package/dist/tools/git-bundle.d.ts.map +1 -0
- package/dist/tools/git-bundle.js +258 -0
- package/dist/tools/git-bundle.js.map +1 -0
- package/dist/tools/git-cherry-pick.d.ts +162 -0
- package/dist/tools/git-cherry-pick.d.ts.map +1 -0
- package/dist/tools/git-cherry-pick.js +241 -0
- package/dist/tools/git-cherry-pick.js.map +1 -0
- package/dist/tools/git-commits.d.ts +497 -0
- package/dist/tools/git-commits.d.ts.map +1 -0
- package/dist/tools/git-commits.js +626 -0
- package/dist/tools/git-commits.js.map +1 -0
- package/dist/tools/git-config.d.ts +144 -0
- package/dist/tools/git-config.d.ts.map +1 -0
- package/dist/tools/git-config.js +293 -0
- package/dist/tools/git-config.js.map +1 -0
- package/dist/tools/git-files.d.ts +463 -0
- package/dist/tools/git-files.d.ts.map +1 -0
- package/dist/tools/git-files.js +555 -0
- package/dist/tools/git-files.js.map +1 -0
- package/dist/tools/git-issues.d.ts +579 -0
- package/dist/tools/git-issues.d.ts.map +1 -0
- package/dist/tools/git-issues.js +694 -0
- package/dist/tools/git-issues.js.map +1 -0
- package/dist/tools/git-pulls.d.ts +702 -0
- package/dist/tools/git-pulls.d.ts.map +1 -0
- package/dist/tools/git-pulls.js +733 -0
- package/dist/tools/git-pulls.js.map +1 -0
- package/dist/tools/git-rebase.d.ts +141 -0
- package/dist/tools/git-rebase.d.ts.map +1 -0
- package/dist/tools/git-rebase.js +234 -0
- package/dist/tools/git-rebase.js.map +1 -0
- package/dist/tools/git-releases.d.ts +495 -0
- package/dist/tools/git-releases.d.ts.map +1 -0
- package/dist/tools/git-releases.js +552 -0
- package/dist/tools/git-releases.js.map +1 -0
- package/dist/tools/git-remote.d.ts +142 -0
- package/dist/tools/git-remote.d.ts.map +1 -0
- package/dist/tools/git-remote.js +303 -0
- package/dist/tools/git-remote.js.map +1 -0
- package/dist/tools/git-repositories.d.ts +422 -0
- package/dist/tools/git-repositories.d.ts.map +1 -0
- package/dist/tools/git-repositories.js +557 -0
- package/dist/tools/git-repositories.js.map +1 -0
- package/dist/tools/git-reset.d.ts +134 -0
- package/dist/tools/git-reset.d.ts.map +1 -0
- package/dist/tools/git-reset.js +236 -0
- package/dist/tools/git-reset.js.map +1 -0
- package/dist/tools/git-revert.d.ts +153 -0
- package/dist/tools/git-revert.d.ts.map +1 -0
- package/dist/tools/git-revert.js +211 -0
- package/dist/tools/git-revert.js.map +1 -0
- package/dist/tools/git-stash.d.ts +144 -0
- package/dist/tools/git-stash.d.ts.map +1 -0
- package/dist/tools/git-stash.js +298 -0
- package/dist/tools/git-stash.js.map +1 -0
- package/dist/tools/git-submodule.d.ts +156 -0
- package/dist/tools/git-submodule.d.ts.map +1 -0
- package/dist/tools/git-submodule.js +314 -0
- package/dist/tools/git-submodule.js.map +1 -0
- package/dist/tools/git-sync.d.ts +4 -4
- package/dist/tools/git-tags.d.ts +419 -0
- package/dist/tools/git-tags.d.ts.map +1 -0
- package/dist/tools/git-tags.js +480 -0
- package/dist/tools/git-tags.js.map +1 -0
- package/dist/tools/git-webhooks.d.ts +490 -0
- package/dist/tools/git-webhooks.d.ts.map +1 -0
- package/dist/tools/git-webhooks.js +556 -0
- package/dist/tools/git-webhooks.js.map +1 -0
- package/dist/tools/git-worktree.d.ts +163 -0
- package/dist/tools/git-worktree.d.ts.map +1 -0
- package/dist/tools/git-worktree.js +294 -0
- package/dist/tools/git-worktree.js.map +1 -0
- package/dist/tools/pulls.d.ts +2 -2
- package/dist/tools/users.d.ts +2 -2
- package/dist/tools/version-control.d.ts +4 -4
- package/package.json +2 -2
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gitRevertTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const terminal_controller_js_1 = require("../utils/terminal-controller.js");
|
|
6
|
+
/**
|
|
7
|
+
* Tool: git-revert
|
|
8
|
+
*
|
|
9
|
+
* DESCRIÇÃO:
|
|
10
|
+
* Gerenciamento de revert Git (GitHub + Gitea) com múltiplas ações
|
|
11
|
+
*
|
|
12
|
+
* FUNCIONALIDADES:
|
|
13
|
+
* - Reverter commit específico
|
|
14
|
+
* - Reverter merge commit
|
|
15
|
+
* - Reverter range de commits
|
|
16
|
+
* - Reverter com mensagem customizada
|
|
17
|
+
* - Reverter sem commit automático
|
|
18
|
+
*
|
|
19
|
+
* USO:
|
|
20
|
+
* - Para desfazer commits de forma segura
|
|
21
|
+
* - Para reverter mudanças em branches compartilhadas
|
|
22
|
+
* - Para criar commits de reversão
|
|
23
|
+
* - Para manter histórico limpo
|
|
24
|
+
*
|
|
25
|
+
* RECOMENDAÇÕES:
|
|
26
|
+
* - Use revert em vez de reset para branches compartilhadas
|
|
27
|
+
* - Teste reversões em branches locais primeiro
|
|
28
|
+
* - Documente motivos da reversão
|
|
29
|
+
*/
|
|
30
|
+
const GitRevertInputSchema = zod_1.z.object({
|
|
31
|
+
action: zod_1.z.enum(['revert-commit', 'revert-merge', 'revert-range']),
|
|
32
|
+
owner: zod_1.z.string(),
|
|
33
|
+
repo: zod_1.z.string(),
|
|
34
|
+
provider: zod_1.z.enum(['gitea', 'github']).describe('Provider to use (gitea or github)'),
|
|
35
|
+
projectPath: zod_1.z.string().describe('Local project path for git operations'),
|
|
36
|
+
// Para revert-commit
|
|
37
|
+
commit_hash: zod_1.z.string().optional(),
|
|
38
|
+
message: zod_1.z.string().optional(),
|
|
39
|
+
no_commit: zod_1.z.boolean().optional(),
|
|
40
|
+
// Para revert-merge
|
|
41
|
+
merge_commit_hash: zod_1.z.string().optional(),
|
|
42
|
+
mainline: zod_1.z.number().optional(),
|
|
43
|
+
// Para revert-range
|
|
44
|
+
commit_range: zod_1.z.string().optional(),
|
|
45
|
+
strategy: zod_1.z.enum(['ours', 'theirs']).optional(),
|
|
46
|
+
});
|
|
47
|
+
const GitRevertResultSchema = zod_1.z.object({
|
|
48
|
+
success: zod_1.z.boolean(),
|
|
49
|
+
action: zod_1.z.string(),
|
|
50
|
+
message: zod_1.z.string(),
|
|
51
|
+
data: zod_1.z.any().optional(),
|
|
52
|
+
error: zod_1.z.string().optional()
|
|
53
|
+
});
|
|
54
|
+
exports.gitRevertTool = {
|
|
55
|
+
name: 'git-revert',
|
|
56
|
+
description: 'Manage Git revert operations (GitHub + Gitea) with multiple actions: revert-commit, revert-merge, revert-range. Suporte completo a GitHub e Gitea simultaneamente. Boas práticas (solo): use para desfazer commits de forma segura, reverter mudanças em branches compartilhadas, criar commits de reversão; use revert em vez de reset para branches compartilhadas.',
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
action: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
enum: ['revert-commit', 'revert-merge', 'revert-range'],
|
|
63
|
+
description: 'Action to perform on revert'
|
|
64
|
+
},
|
|
65
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
66
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
67
|
+
provider: { type: 'string', enum: ['gitea', 'github'], description: 'Provider to use (gitea or github)' },
|
|
68
|
+
projectPath: { type: 'string', description: 'Local project path for git operations' },
|
|
69
|
+
commit_hash: { type: 'string', description: 'Commit hash to revert' },
|
|
70
|
+
message: { type: 'string', description: 'Custom revert message' },
|
|
71
|
+
no_commit: { type: 'boolean', description: 'Do not commit automatically' },
|
|
72
|
+
merge_commit_hash: { type: 'string', description: 'Merge commit hash to revert' },
|
|
73
|
+
mainline: { type: 'number', description: 'Mainline for merge revert' },
|
|
74
|
+
commit_range: { type: 'string', description: 'Commit range to revert' },
|
|
75
|
+
strategy: { type: 'string', enum: ['ours', 'theirs'], description: 'Revert strategy' }
|
|
76
|
+
},
|
|
77
|
+
required: ['action', 'owner', 'repo', 'provider', 'projectPath']
|
|
78
|
+
},
|
|
79
|
+
async handler(input) {
|
|
80
|
+
try {
|
|
81
|
+
const validatedInput = GitRevertInputSchema.parse(input);
|
|
82
|
+
switch (validatedInput.action) {
|
|
83
|
+
case 'revert-commit':
|
|
84
|
+
return await this.revertCommit(validatedInput);
|
|
85
|
+
case 'revert-merge':
|
|
86
|
+
return await this.revertMerge(validatedInput);
|
|
87
|
+
case 'revert-range':
|
|
88
|
+
return await this.revertRange(validatedInput);
|
|
89
|
+
default:
|
|
90
|
+
throw new Error(`Ação não suportada: ${validatedInput.action}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
action: input.action,
|
|
97
|
+
message: 'Erro na operação de revert',
|
|
98
|
+
error: error instanceof Error ? error.message : String(error)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
async revertCommit(params) {
|
|
103
|
+
try {
|
|
104
|
+
if (!params.commit_hash) {
|
|
105
|
+
throw new Error('commit_hash é obrigatório para revert-commit');
|
|
106
|
+
}
|
|
107
|
+
let command = `cd "${params.projectPath}" && git revert ${params.commit_hash}`;
|
|
108
|
+
if (params.no_commit) {
|
|
109
|
+
command += ' --no-commit';
|
|
110
|
+
}
|
|
111
|
+
if (params.message) {
|
|
112
|
+
command += ` -m "${params.message}"`;
|
|
113
|
+
}
|
|
114
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
115
|
+
command,
|
|
116
|
+
is_background: false,
|
|
117
|
+
explanation: 'Executando revert de commit'
|
|
118
|
+
});
|
|
119
|
+
if (result.exitCode !== 0) {
|
|
120
|
+
throw new Error(`Falha no revert de commit: ${result.output}`);
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
success: true,
|
|
124
|
+
action: 'revert-commit',
|
|
125
|
+
message: `Commit ${params.commit_hash} revertido com sucesso`,
|
|
126
|
+
data: {
|
|
127
|
+
commit_hash: params.commit_hash,
|
|
128
|
+
message: params.message,
|
|
129
|
+
no_commit: params.no_commit,
|
|
130
|
+
output: result.output
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
throw new Error(`Falha ao executar revert de commit: ${error instanceof Error ? error.message : String(error)}`);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
async revertMerge(params) {
|
|
139
|
+
try {
|
|
140
|
+
if (!params.merge_commit_hash) {
|
|
141
|
+
throw new Error('merge_commit_hash é obrigatório para revert-merge');
|
|
142
|
+
}
|
|
143
|
+
if (!params.mainline) {
|
|
144
|
+
throw new Error('mainline é obrigatório para revert de merge');
|
|
145
|
+
}
|
|
146
|
+
let command = `cd "${params.projectPath}" && git revert -m ${params.mainline} ${params.merge_commit_hash}`;
|
|
147
|
+
if (params.message) {
|
|
148
|
+
command += ` -m "${params.message}"`;
|
|
149
|
+
}
|
|
150
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
151
|
+
command,
|
|
152
|
+
is_background: false,
|
|
153
|
+
explanation: 'Executando revert de merge'
|
|
154
|
+
});
|
|
155
|
+
if (result.exitCode !== 0) {
|
|
156
|
+
throw new Error(`Falha no revert de merge: ${result.output}`);
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
success: true,
|
|
160
|
+
action: 'revert-merge',
|
|
161
|
+
message: `Merge commit ${params.merge_commit_hash} revertido com sucesso`,
|
|
162
|
+
data: {
|
|
163
|
+
merge_commit_hash: params.merge_commit_hash,
|
|
164
|
+
mainline: params.mainline,
|
|
165
|
+
message: params.message,
|
|
166
|
+
output: result.output
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
throw new Error(`Falha ao executar revert de merge: ${error instanceof Error ? error.message : String(error)}`);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
async revertRange(params) {
|
|
175
|
+
try {
|
|
176
|
+
if (!params.commit_range) {
|
|
177
|
+
throw new Error('commit_range é obrigatório para revert-range');
|
|
178
|
+
}
|
|
179
|
+
let command = `cd "${params.projectPath}" && git revert ${params.commit_range}`;
|
|
180
|
+
if (params.strategy) {
|
|
181
|
+
command += ` -X ${params.strategy}`;
|
|
182
|
+
}
|
|
183
|
+
if (params.message) {
|
|
184
|
+
command += ` -m "${params.message}"`;
|
|
185
|
+
}
|
|
186
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
187
|
+
command,
|
|
188
|
+
is_background: false,
|
|
189
|
+
explanation: 'Executando revert de range'
|
|
190
|
+
});
|
|
191
|
+
if (result.exitCode !== 0) {
|
|
192
|
+
throw new Error(`Falha no revert de range: ${result.output}`);
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
success: true,
|
|
196
|
+
action: 'revert-range',
|
|
197
|
+
message: `Range ${params.commit_range} revertido com sucesso`,
|
|
198
|
+
data: {
|
|
199
|
+
commit_range: params.commit_range,
|
|
200
|
+
strategy: params.strategy,
|
|
201
|
+
message: params.message,
|
|
202
|
+
output: result.output
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
throw new Error(`Falha ao executar revert de range: ${error instanceof Error ? error.message : String(error)}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|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H,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Tool: git-stash
|
|
4
|
+
*
|
|
5
|
+
* DESCRIÇÃO:
|
|
6
|
+
* Gerenciamento de stash Git (GitHub + Gitea) com múltiplas ações
|
|
7
|
+
*
|
|
8
|
+
* FUNCIONALIDADES:
|
|
9
|
+
* - Stash mudanças
|
|
10
|
+
* - Listar stashes
|
|
11
|
+
* - Aplicar stash
|
|
12
|
+
* - Pop stash
|
|
13
|
+
* - Mostrar stash
|
|
14
|
+
* - Deletar stash
|
|
15
|
+
* - Limpar todos os stashes
|
|
16
|
+
*
|
|
17
|
+
* USO:
|
|
18
|
+
* - Para salvar mudanças temporariamente
|
|
19
|
+
* - Para trocar de branch rapidamente
|
|
20
|
+
* - Para limpar working directory
|
|
21
|
+
* - Para aplicar mudanças posteriormente
|
|
22
|
+
*
|
|
23
|
+
* RECOMENDAÇÕES:
|
|
24
|
+
* - Use mensagens descritivas para stashes
|
|
25
|
+
* - Aplique stashes em ordem
|
|
26
|
+
* - Limpe stashes antigos regularmente
|
|
27
|
+
*/
|
|
28
|
+
declare const GitStashInputSchema: z.ZodObject<{
|
|
29
|
+
action: z.ZodEnum<["stash", "pop", "apply", "list", "show", "drop", "clear"]>;
|
|
30
|
+
owner: z.ZodString;
|
|
31
|
+
repo: z.ZodString;
|
|
32
|
+
provider: z.ZodEnum<["gitea", "github"]>;
|
|
33
|
+
projectPath: z.ZodString;
|
|
34
|
+
message: z.ZodOptional<z.ZodString>;
|
|
35
|
+
include_untracked: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
keep_index: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
stash_index: z.ZodOptional<z.ZodString>;
|
|
38
|
+
show_patch: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
provider: "gitea" | "github";
|
|
41
|
+
owner: string;
|
|
42
|
+
repo: string;
|
|
43
|
+
action: "pop" | "list" | "stash" | "apply" | "show" | "drop" | "clear";
|
|
44
|
+
projectPath: string;
|
|
45
|
+
message?: string | undefined;
|
|
46
|
+
include_untracked?: boolean | undefined;
|
|
47
|
+
keep_index?: boolean | undefined;
|
|
48
|
+
stash_index?: string | undefined;
|
|
49
|
+
show_patch?: boolean | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
provider: "gitea" | "github";
|
|
52
|
+
owner: string;
|
|
53
|
+
repo: string;
|
|
54
|
+
action: "pop" | "list" | "stash" | "apply" | "show" | "drop" | "clear";
|
|
55
|
+
projectPath: string;
|
|
56
|
+
message?: string | undefined;
|
|
57
|
+
include_untracked?: boolean | undefined;
|
|
58
|
+
keep_index?: boolean | undefined;
|
|
59
|
+
stash_index?: string | undefined;
|
|
60
|
+
show_patch?: boolean | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
export type GitStashInput = z.infer<typeof GitStashInputSchema>;
|
|
63
|
+
declare const GitStashResultSchema: z.ZodObject<{
|
|
64
|
+
success: z.ZodBoolean;
|
|
65
|
+
action: z.ZodString;
|
|
66
|
+
message: z.ZodString;
|
|
67
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
68
|
+
error: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
message: string;
|
|
71
|
+
action: string;
|
|
72
|
+
success: boolean;
|
|
73
|
+
error?: string | undefined;
|
|
74
|
+
data?: any;
|
|
75
|
+
}, {
|
|
76
|
+
message: string;
|
|
77
|
+
action: string;
|
|
78
|
+
success: boolean;
|
|
79
|
+
error?: string | undefined;
|
|
80
|
+
data?: any;
|
|
81
|
+
}>;
|
|
82
|
+
export type GitStashResult = z.infer<typeof GitStashResultSchema>;
|
|
83
|
+
export declare const gitStashTool: {
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
inputSchema: {
|
|
87
|
+
type: string;
|
|
88
|
+
properties: {
|
|
89
|
+
action: {
|
|
90
|
+
type: string;
|
|
91
|
+
enum: string[];
|
|
92
|
+
description: string;
|
|
93
|
+
};
|
|
94
|
+
owner: {
|
|
95
|
+
type: string;
|
|
96
|
+
description: string;
|
|
97
|
+
};
|
|
98
|
+
repo: {
|
|
99
|
+
type: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
provider: {
|
|
103
|
+
type: string;
|
|
104
|
+
enum: string[];
|
|
105
|
+
description: string;
|
|
106
|
+
};
|
|
107
|
+
projectPath: {
|
|
108
|
+
type: string;
|
|
109
|
+
description: string;
|
|
110
|
+
};
|
|
111
|
+
message: {
|
|
112
|
+
type: string;
|
|
113
|
+
description: string;
|
|
114
|
+
};
|
|
115
|
+
include_untracked: {
|
|
116
|
+
type: string;
|
|
117
|
+
description: string;
|
|
118
|
+
};
|
|
119
|
+
keep_index: {
|
|
120
|
+
type: string;
|
|
121
|
+
description: string;
|
|
122
|
+
};
|
|
123
|
+
stash_index: {
|
|
124
|
+
type: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
show_patch: {
|
|
128
|
+
type: string;
|
|
129
|
+
description: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
required: string[];
|
|
133
|
+
};
|
|
134
|
+
handler(input: GitStashInput): Promise<GitStashResult>;
|
|
135
|
+
stash(params: GitStashInput): Promise<GitStashResult>;
|
|
136
|
+
pop(params: GitStashInput): Promise<GitStashResult>;
|
|
137
|
+
apply(params: GitStashInput): Promise<GitStashResult>;
|
|
138
|
+
list(params: GitStashInput): Promise<GitStashResult>;
|
|
139
|
+
show(params: GitStashInput): Promise<GitStashResult>;
|
|
140
|
+
drop(params: GitStashInput): Promise<GitStashResult>;
|
|
141
|
+
clear(params: GitStashInput): Promise<GitStashResult>;
|
|
142
|
+
};
|
|
143
|
+
export {};
|
|
144
|
+
//# sourceMappingURL=git-stash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-stash.d.ts","sourceRoot":"","sources":["../../src/tools/git-stash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBvB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAMxB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAwBF,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;kBAgCxC,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;gBA0CzC,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;kBA4BrC,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;iBA4BxC,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;iBA0BvC,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;iBAkCvC,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;kBA4BtC,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;CAyB5D,CAAC"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gitStashTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const terminal_controller_js_1 = require("../utils/terminal-controller.js");
|
|
6
|
+
/**
|
|
7
|
+
* Tool: git-stash
|
|
8
|
+
*
|
|
9
|
+
* DESCRIÇÃO:
|
|
10
|
+
* Gerenciamento de stash Git (GitHub + Gitea) com múltiplas ações
|
|
11
|
+
*
|
|
12
|
+
* FUNCIONALIDADES:
|
|
13
|
+
* - Stash mudanças
|
|
14
|
+
* - Listar stashes
|
|
15
|
+
* - Aplicar stash
|
|
16
|
+
* - Pop stash
|
|
17
|
+
* - Mostrar stash
|
|
18
|
+
* - Deletar stash
|
|
19
|
+
* - Limpar todos os stashes
|
|
20
|
+
*
|
|
21
|
+
* USO:
|
|
22
|
+
* - Para salvar mudanças temporariamente
|
|
23
|
+
* - Para trocar de branch rapidamente
|
|
24
|
+
* - Para limpar working directory
|
|
25
|
+
* - Para aplicar mudanças posteriormente
|
|
26
|
+
*
|
|
27
|
+
* RECOMENDAÇÕES:
|
|
28
|
+
* - Use mensagens descritivas para stashes
|
|
29
|
+
* - Aplique stashes em ordem
|
|
30
|
+
* - Limpe stashes antigos regularmente
|
|
31
|
+
*/
|
|
32
|
+
const GitStashInputSchema = zod_1.z.object({
|
|
33
|
+
action: zod_1.z.enum(['stash', 'pop', 'apply', 'list', 'show', 'drop', 'clear']),
|
|
34
|
+
owner: zod_1.z.string(),
|
|
35
|
+
repo: zod_1.z.string(),
|
|
36
|
+
provider: zod_1.z.enum(['gitea', 'github']).describe('Provider to use (gitea or github)'),
|
|
37
|
+
projectPath: zod_1.z.string().describe('Local project path for git operations'),
|
|
38
|
+
// Para stash
|
|
39
|
+
message: zod_1.z.string().optional(),
|
|
40
|
+
include_untracked: zod_1.z.boolean().optional(),
|
|
41
|
+
keep_index: zod_1.z.boolean().optional(),
|
|
42
|
+
// Para pop/apply/show/drop
|
|
43
|
+
stash_index: zod_1.z.string().optional(),
|
|
44
|
+
// Para show
|
|
45
|
+
show_patch: zod_1.z.boolean().optional(),
|
|
46
|
+
});
|
|
47
|
+
const GitStashResultSchema = zod_1.z.object({
|
|
48
|
+
success: zod_1.z.boolean(),
|
|
49
|
+
action: zod_1.z.string(),
|
|
50
|
+
message: zod_1.z.string(),
|
|
51
|
+
data: zod_1.z.any().optional(),
|
|
52
|
+
error: zod_1.z.string().optional()
|
|
53
|
+
});
|
|
54
|
+
exports.gitStashTool = {
|
|
55
|
+
name: 'git-stash',
|
|
56
|
+
description: 'Manage Git stash operations (GitHub + Gitea) with multiple actions: stash, pop, apply, list, show, drop, clear. Suporte completo a GitHub e Gitea simultaneamente. Boas práticas (solo): use para salvar mudanças temporariamente, trocar de branch rapidamente, limpar working directory; use mensagens descritivas para stashes, aplique stashes em ordem.',
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
action: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
enum: ['stash', 'pop', 'apply', 'list', 'show', 'drop', 'clear'],
|
|
63
|
+
description: 'Action to perform on stash'
|
|
64
|
+
},
|
|
65
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
66
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
67
|
+
provider: { type: 'string', enum: ['gitea', 'github'], description: 'Provider to use (gitea or github)' },
|
|
68
|
+
projectPath: { type: 'string', description: 'Local project path for git operations' },
|
|
69
|
+
message: { type: 'string', description: 'Stash message' },
|
|
70
|
+
include_untracked: { type: 'boolean', description: 'Include untracked files' },
|
|
71
|
+
keep_index: { type: 'boolean', description: 'Keep changes in index' },
|
|
72
|
+
stash_index: { type: 'string', description: 'Stash index to operate on' },
|
|
73
|
+
show_patch: { type: 'boolean', description: 'Show patch in stash show' }
|
|
74
|
+
},
|
|
75
|
+
required: ['action', 'owner', 'repo', 'provider', 'projectPath']
|
|
76
|
+
},
|
|
77
|
+
async handler(input) {
|
|
78
|
+
try {
|
|
79
|
+
const validatedInput = GitStashInputSchema.parse(input);
|
|
80
|
+
switch (validatedInput.action) {
|
|
81
|
+
case 'stash':
|
|
82
|
+
return await this.stash(validatedInput);
|
|
83
|
+
case 'pop':
|
|
84
|
+
return await this.pop(validatedInput);
|
|
85
|
+
case 'apply':
|
|
86
|
+
return await this.apply(validatedInput);
|
|
87
|
+
case 'list':
|
|
88
|
+
return await this.list(validatedInput);
|
|
89
|
+
case 'show':
|
|
90
|
+
return await this.show(validatedInput);
|
|
91
|
+
case 'drop':
|
|
92
|
+
return await this.drop(validatedInput);
|
|
93
|
+
case 'clear':
|
|
94
|
+
return await this.clear(validatedInput);
|
|
95
|
+
default:
|
|
96
|
+
throw new Error(`Ação não suportada: ${validatedInput.action}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
action: input.action,
|
|
103
|
+
message: 'Erro na operação de stash',
|
|
104
|
+
error: error instanceof Error ? error.message : String(error)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
async stash(params) {
|
|
109
|
+
try {
|
|
110
|
+
let command = `cd "${params.projectPath}" && git stash`;
|
|
111
|
+
if (params.message) {
|
|
112
|
+
command += ` push -m "${params.message}"`;
|
|
113
|
+
}
|
|
114
|
+
if (params.include_untracked) {
|
|
115
|
+
command += ' -u';
|
|
116
|
+
}
|
|
117
|
+
if (params.keep_index) {
|
|
118
|
+
command += ' --keep-index';
|
|
119
|
+
}
|
|
120
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
121
|
+
command,
|
|
122
|
+
is_background: false,
|
|
123
|
+
explanation: 'Executando stash'
|
|
124
|
+
});
|
|
125
|
+
if (result.exitCode !== 0) {
|
|
126
|
+
throw new Error(`Falha no stash: ${result.output}`);
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
success: true,
|
|
130
|
+
action: 'stash',
|
|
131
|
+
message: 'Mudanças salvas no stash com sucesso',
|
|
132
|
+
data: {
|
|
133
|
+
message: params.message,
|
|
134
|
+
include_untracked: params.include_untracked,
|
|
135
|
+
keep_index: params.keep_index,
|
|
136
|
+
output: result.output
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
throw new Error(`Falha ao executar stash: ${error instanceof Error ? error.message : String(error)}`);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
async pop(params) {
|
|
145
|
+
try {
|
|
146
|
+
const stashIndex = params.stash_index || 'stash@{0}';
|
|
147
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
148
|
+
command: `cd "${params.projectPath}" && git stash pop ${stashIndex}`,
|
|
149
|
+
is_background: false,
|
|
150
|
+
explanation: 'Executando stash pop'
|
|
151
|
+
});
|
|
152
|
+
if (result.exitCode !== 0) {
|
|
153
|
+
throw new Error(`Falha no stash pop: ${result.output}`);
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
success: true,
|
|
157
|
+
action: 'pop',
|
|
158
|
+
message: `Stash ${stashIndex} aplicado e removido com sucesso`,
|
|
159
|
+
data: {
|
|
160
|
+
stash_index: stashIndex,
|
|
161
|
+
output: result.output
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
throw new Error(`Falha ao executar stash pop: ${error instanceof Error ? error.message : String(error)}`);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
async apply(params) {
|
|
170
|
+
try {
|
|
171
|
+
const stashIndex = params.stash_index || 'stash@{0}';
|
|
172
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
173
|
+
command: `cd "${params.projectPath}" && git stash apply ${stashIndex}`,
|
|
174
|
+
is_background: false,
|
|
175
|
+
explanation: 'Executando stash apply'
|
|
176
|
+
});
|
|
177
|
+
if (result.exitCode !== 0) {
|
|
178
|
+
throw new Error(`Falha no stash apply: ${result.output}`);
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
success: true,
|
|
182
|
+
action: 'apply',
|
|
183
|
+
message: `Stash ${stashIndex} aplicado com sucesso`,
|
|
184
|
+
data: {
|
|
185
|
+
stash_index: stashIndex,
|
|
186
|
+
output: result.output
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
throw new Error(`Falha ao executar stash apply: ${error instanceof Error ? error.message : String(error)}`);
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
async list(params) {
|
|
195
|
+
try {
|
|
196
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
197
|
+
command: `cd "${params.projectPath}" && git stash list`,
|
|
198
|
+
is_background: false,
|
|
199
|
+
explanation: 'Listando stashes'
|
|
200
|
+
});
|
|
201
|
+
if (result.exitCode !== 0) {
|
|
202
|
+
throw new Error(`Falha ao listar stashes: ${result.output}`);
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
success: true,
|
|
206
|
+
action: 'list',
|
|
207
|
+
message: 'Lista de stashes obtida com sucesso',
|
|
208
|
+
data: {
|
|
209
|
+
stashes: result.output.split('\n').filter(line => line.trim()),
|
|
210
|
+
output: result.output
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
throw new Error(`Falha ao listar stashes: ${error instanceof Error ? error.message : String(error)}`);
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
async show(params) {
|
|
219
|
+
try {
|
|
220
|
+
const stashIndex = params.stash_index || 'stash@{0}';
|
|
221
|
+
let command = `cd "${params.projectPath}" && git stash show ${stashIndex}`;
|
|
222
|
+
if (params.show_patch) {
|
|
223
|
+
command += ' -p';
|
|
224
|
+
}
|
|
225
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
226
|
+
command,
|
|
227
|
+
is_background: false,
|
|
228
|
+
explanation: 'Mostrando stash'
|
|
229
|
+
});
|
|
230
|
+
if (result.exitCode !== 0) {
|
|
231
|
+
throw new Error(`Falha ao mostrar stash: ${result.output}`);
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
success: true,
|
|
235
|
+
action: 'show',
|
|
236
|
+
message: `Stash ${stashIndex} mostrado com sucesso`,
|
|
237
|
+
data: {
|
|
238
|
+
stash_index: stashIndex,
|
|
239
|
+
show_patch: params.show_patch,
|
|
240
|
+
output: result.output
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
throw new Error(`Falha ao mostrar stash: ${error instanceof Error ? error.message : String(error)}`);
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
async drop(params) {
|
|
249
|
+
try {
|
|
250
|
+
const stashIndex = params.stash_index || 'stash@{0}';
|
|
251
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
252
|
+
command: `cd "${params.projectPath}" && git stash drop ${stashIndex}`,
|
|
253
|
+
is_background: false,
|
|
254
|
+
explanation: 'Removendo stash'
|
|
255
|
+
});
|
|
256
|
+
if (result.exitCode !== 0) {
|
|
257
|
+
throw new Error(`Falha ao remover stash: ${result.output}`);
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
success: true,
|
|
261
|
+
action: 'drop',
|
|
262
|
+
message: `Stash ${stashIndex} removido com sucesso`,
|
|
263
|
+
data: {
|
|
264
|
+
stash_index: stashIndex,
|
|
265
|
+
output: result.output
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
throw new Error(`Falha ao remover stash: ${error instanceof Error ? error.message : String(error)}`);
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
async clear(params) {
|
|
274
|
+
try {
|
|
275
|
+
const result = await (0, terminal_controller_js_1.runTerminalCmd)({
|
|
276
|
+
command: `cd "${params.projectPath}" && git stash clear`,
|
|
277
|
+
is_background: false,
|
|
278
|
+
explanation: 'Limpando todos os stashes'
|
|
279
|
+
});
|
|
280
|
+
if (result.exitCode !== 0) {
|
|
281
|
+
throw new Error(`Falha ao limpar stashes: ${result.output}`);
|
|
282
|
+
}
|
|
283
|
+
return {
|
|
284
|
+
success: true,
|
|
285
|
+
action: 'clear',
|
|
286
|
+
message: 'Todos os stashes foram removidos com sucesso',
|
|
287
|
+
data: {
|
|
288
|
+
cleared: true,
|
|
289
|
+
output: result.output
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
throw new Error(`Falha ao limpar stashes: ${error instanceof Error ? error.message : String(error)}`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
//# sourceMappingURL=git-stash.js.map
|