@andrebuzeli/git-mcp 2.27.3 → 2.28.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/client.d.ts +306 -306
- package/dist/client.js +298 -298
- package/dist/config.d.ts +310 -310
- package/dist/config.js +392 -392
- package/dist/index.d.ts +22 -22
- package/dist/index.js +89 -89
- package/dist/providers/base-provider.d.ts +160 -156
- package/dist/providers/base-provider.d.ts.map +1 -1
- package/dist/providers/base-provider.js +274 -260
- package/dist/providers/base-provider.js.map +1 -1
- package/dist/providers/error-handler.d.ts +50 -50
- package/dist/providers/error-handler.js +175 -175
- package/dist/providers/gitea-provider.d.ts +97 -97
- package/dist/providers/gitea-provider.js +1001 -1001
- package/dist/providers/github-provider.d.ts +104 -104
- package/dist/providers/github-provider.js +1234 -1234
- package/dist/providers/index.d.ts +12 -12
- package/dist/providers/index.js +40 -40
- package/dist/providers/provider-factory.d.ts +74 -74
- package/dist/providers/provider-factory.js +311 -311
- package/dist/providers/types.d.ts +318 -298
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/types.js +6 -6
- package/dist/server.d.ts +76 -76
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +306 -357
- package/dist/server.js.map +1 -1
- package/dist/tools/gh-actions.d.ts +252 -252
- package/dist/tools/gh-actions.js +389 -389
- package/dist/tools/gh-analytics.d.ts +263 -263
- package/dist/tools/gh-analytics.js +401 -401
- package/dist/tools/gh-code-review.d.ts +304 -304
- package/dist/tools/gh-code-review.js +512 -512
- package/dist/tools/gh-codespaces.d.ts +138 -138
- package/dist/tools/gh-codespaces.js +282 -282
- package/dist/tools/gh-deployments.d.ts +300 -300
- package/dist/tools/gh-deployments.js +367 -367
- package/dist/tools/gh-gists.d.ts +174 -174
- package/dist/tools/gh-gists.js +321 -321
- package/dist/tools/gh-projects.d.ts +205 -205
- package/dist/tools/gh-projects.js +358 -358
- package/dist/tools/gh-security.d.ts +274 -274
- package/dist/tools/gh-security.js +395 -395
- package/dist/tools/gh-sync.d.ts +213 -213
- package/dist/tools/gh-sync.js +378 -378
- package/dist/tools/gh-workflows.d.ts +290 -290
- package/dist/tools/gh-workflows.js +432 -432
- package/dist/tools/git-archive.d.ts +165 -165
- package/dist/tools/git-archive.js +233 -233
- package/dist/tools/git-branches.d.ts +430 -430
- package/dist/tools/git-branches.d.ts.map +1 -1
- package/dist/tools/git-branches.js +627 -530
- package/dist/tools/git-branches.js.map +1 -1
- package/dist/tools/git-bundle.d.ts +171 -171
- package/dist/tools/git-bundle.js +241 -241
- package/dist/tools/git-cherry-pick.d.ts +158 -158
- package/dist/tools/git-cherry-pick.js +224 -224
- package/dist/tools/git-commits.d.ts +485 -485
- package/dist/tools/git-commits.d.ts.map +1 -1
- package/dist/tools/git-commits.js +735 -625
- package/dist/tools/git-commits.js.map +1 -1
- package/dist/tools/git-config.d.ts +140 -140
- package/dist/tools/git-config.js +268 -268
- package/dist/tools/git-files.d.ts +486 -486
- package/dist/tools/git-files.js +607 -607
- package/dist/tools/git-issues.d.ts +571 -571
- package/dist/tools/git-issues.d.ts.map +1 -1
- package/dist/tools/git-issues.js +740 -693
- package/dist/tools/git-issues.js.map +1 -1
- package/dist/tools/git-pulls.d.ts +694 -694
- package/dist/tools/git-pulls.js +732 -732
- package/dist/tools/git-rebase.d.ts +137 -137
- package/dist/tools/git-rebase.js +213 -213
- package/dist/tools/git-releases.d.ts +487 -487
- package/dist/tools/git-releases.js +557 -557
- package/dist/tools/git-remote.d.ts +138 -138
- package/dist/tools/git-remote.js +274 -274
- package/dist/tools/git-repositories.d.ts +483 -483
- package/dist/tools/git-repositories.js +640 -640
- package/dist/tools/git-reset.d.ts +130 -130
- package/dist/tools/git-reset.js +223 -223
- package/dist/tools/git-revert.d.ts +149 -149
- package/dist/tools/git-revert.js +198 -198
- package/dist/tools/git-stash.d.ts +140 -140
- package/dist/tools/git-stash.js +269 -269
- package/dist/tools/git-submodule.d.ts +152 -152
- package/dist/tools/git-submodule.js +289 -289
- package/dist/tools/git-sync.d.ts +178 -166
- package/dist/tools/git-sync.d.ts.map +1 -1
- package/dist/tools/git-sync.js +312 -117
- package/dist/tools/git-sync.js.map +1 -1
- package/dist/tools/git-tags.d.ts +411 -411
- package/dist/tools/git-tags.js +485 -485
- package/dist/tools/git-webhooks.d.ts +470 -482
- package/dist/tools/git-webhooks.d.ts.map +1 -1
- package/dist/tools/git-webhooks.js +543 -555
- package/dist/tools/git-webhooks.js.map +1 -1
- package/dist/tools/git-worktree.d.ts +159 -159
- package/dist/tools/git-worktree.js +269 -269
- package/dist/tools/repositories.d.ts +405 -405
- package/dist/tools/repositories.js +569 -569
- package/dist/tools/users.d.ts +372 -372
- package/dist/tools/users.js +499 -499
- package/dist/tools/validator.d.ts +170 -170
- package/dist/tools/validator.js +194 -194
- package/dist/tools/version-control.d.ts +136 -136
- package/dist/tools/version-control.js +164 -164
- package/dist/utils/terminal-controller.d.ts +80 -80
- package/dist/utils/terminal-controller.js +345 -345
- package/dist/utils/user-detection.d.ts +24 -24
- package/dist/utils/user-detection.js +53 -53
- package/package.json +59 -59
package/dist/tools/git-rebase.js
CHANGED
|
@@ -1,214 +1,214 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gitRebaseTool = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const terminal_controller_js_1 = require("../utils/terminal-controller.js");
|
|
6
|
-
/**
|
|
7
|
-
* Tool: git-rebase
|
|
8
|
-
*
|
|
9
|
-
* DESCRIÇÃO:
|
|
10
|
-
* Gerenciamento de rebase Git (GitHub + Gitea) com múltiplas ações
|
|
11
|
-
*
|
|
12
|
-
* FUNCIONALIDADES:
|
|
13
|
-
* - Rebase interativo
|
|
14
|
-
* - Rebase simples
|
|
15
|
-
* - Abortar rebase
|
|
16
|
-
* - Continuar rebase
|
|
17
|
-
* - Pular commit
|
|
18
|
-
* - Rebase de branch
|
|
19
|
-
*
|
|
20
|
-
* USO:
|
|
21
|
-
* - Para reescrever histórico de commits
|
|
22
|
-
* - Para limpar commits antes do merge
|
|
23
|
-
* - Para reorganizar commits
|
|
24
|
-
* - Para resolver conflitos
|
|
25
|
-
*
|
|
26
|
-
* RECOMENDAÇÕES:
|
|
27
|
-
* - Use com cuidado em branches compartilhadas
|
|
28
|
-
* - Faça backup antes de rebases complexos
|
|
29
|
-
* - Teste em branches locais primeiro
|
|
30
|
-
*/
|
|
31
|
-
const GitRebaseInputSchema = zod_1.z.object({
|
|
32
|
-
action: zod_1.z.enum(['rebase', 'interactive-rebase', 'abort', 'continue', 'skip']),
|
|
33
|
-
// owner: obtido automaticamente do provider,
|
|
34
|
-
repo: zod_1.z.string(),
|
|
35
|
-
provider: zod_1.z.enum(['gitea', 'github']).describe('Provider to use (gitea or github)'),
|
|
36
|
-
projectPath: zod_1.z.string().describe('Local project path for git operations'),
|
|
37
|
-
// Para rebase
|
|
38
|
-
target_branch: zod_1.z.string().optional(),
|
|
39
|
-
base_branch: zod_1.z.string().optional(),
|
|
40
|
-
interactive: zod_1.z.boolean().optional(),
|
|
41
|
-
// Para interactive-rebase
|
|
42
|
-
commit_range: zod_1.z.string().optional(),
|
|
43
|
-
rebase_commands: zod_1.z.string().optional(),
|
|
44
|
-
});
|
|
45
|
-
const GitRebaseResultSchema = zod_1.z.object({
|
|
46
|
-
success: zod_1.z.boolean(),
|
|
47
|
-
action: zod_1.z.string(),
|
|
48
|
-
message: zod_1.z.string(),
|
|
49
|
-
data: zod_1.z.any().optional(),
|
|
50
|
-
error: zod_1.z.string().optional()
|
|
51
|
-
});
|
|
52
|
-
exports.gitRebaseTool = {
|
|
53
|
-
name: 'git-rebase',
|
|
54
|
-
description: 'tool: Gerencia operações Git rebase para reorganização de commits\n──────────────\naction rebase: executa rebase simples\naction rebase requires: repo, target_branch, base_branch, provider, projectPath\n───────────────\naction interactive-rebase: rebase interativo\naction interactive-rebase requires: repo, target_branch, base_branch, interactive, commit_range, rebase_commands, provider, projectPath\n───────────────\naction abort: aborta rebase em andamento\naction abort requires: repo, provider, projectPath\n───────────────\naction continue: continua rebase pausado\naction continue requires: repo, provider, projectPath\n───────────────\naction skip: pula commit problemático\naction skip requires: repo, provider, projectPath',
|
|
55
|
-
inputSchema: {
|
|
56
|
-
type: 'object',
|
|
57
|
-
properties: {
|
|
58
|
-
action: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
enum: ['rebase', 'interactive-rebase', 'abort', 'continue', 'skip'],
|
|
61
|
-
description: 'Action to perform on rebase'
|
|
62
|
-
},
|
|
63
|
-
owner: { type: 'string', description: 'Repository owner' },
|
|
64
|
-
repo: { type: 'string', description: 'Repository name' },
|
|
65
|
-
provider: { type: 'string', enum: ['gitea', 'github'], description: 'Provider to use (gitea or github)' },
|
|
66
|
-
projectPath: { type: 'string', description: 'Local project path for git operations' },
|
|
67
|
-
target_branch: { type: 'string', description: 'Target branch for rebase' },
|
|
68
|
-
base_branch: { type: 'string', description: 'Base branch for rebase' },
|
|
69
|
-
interactive: { type: 'boolean', description: 'Interactive rebase' },
|
|
70
|
-
commit_range: { type: 'string', description: 'Commit range for interactive rebase' },
|
|
71
|
-
rebase_commands: { type: 'string', description: 'Rebase commands for interactive mode' }
|
|
72
|
-
},
|
|
73
|
-
required: ['action', 'repo', 'provider', 'projectPath']
|
|
74
|
-
},
|
|
75
|
-
async handler(input) {
|
|
76
|
-
try {
|
|
77
|
-
const validatedInput = GitRebaseInputSchema.parse(input);
|
|
78
|
-
switch (validatedInput.action) {
|
|
79
|
-
case 'rebase':
|
|
80
|
-
return await this.rebase(validatedInput);
|
|
81
|
-
case 'interactive-rebase':
|
|
82
|
-
return await this.interactiveRebase(validatedInput);
|
|
83
|
-
case 'abort':
|
|
84
|
-
return await this.abortRebase(validatedInput);
|
|
85
|
-
case 'continue':
|
|
86
|
-
return await this.continueRebase(validatedInput);
|
|
87
|
-
case 'skip':
|
|
88
|
-
return await this.skipCommit(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 rebase',
|
|
98
|
-
error: error instanceof Error ? error.message : String(error)
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
async rebase(params) {
|
|
103
|
-
try {
|
|
104
|
-
if (!params.target_branch) {
|
|
105
|
-
throw new Error('target_branch é obrigatório para rebase');
|
|
106
|
-
}
|
|
107
|
-
const gitCommand = params.interactive
|
|
108
|
-
? `cd "${params.projectPath}" && git rebase -i ${params.target_branch}`
|
|
109
|
-
: `cd "${params.projectPath}" && git rebase ${params.target_branch}`;
|
|
110
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(gitCommand, params.projectPath, 'Executando rebase');
|
|
111
|
-
if (result.exitCode !== 0) {
|
|
112
|
-
throw new Error(`Falha no rebase: ${result.output}`);
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
success: true,
|
|
116
|
-
action: 'rebase',
|
|
117
|
-
message: `Rebase executado com sucesso na branch ${params.target_branch}`,
|
|
118
|
-
data: {
|
|
119
|
-
target_branch: params.target_branch,
|
|
120
|
-
interactive: params.interactive,
|
|
121
|
-
output: result.output
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
throw new Error(`Falha ao executar rebase: ${error instanceof Error ? error.message : String(error)}`);
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
async interactiveRebase(params) {
|
|
130
|
-
try {
|
|
131
|
-
if (!params.commit_range) {
|
|
132
|
-
throw new Error('commit_range é obrigatório para rebase interativo');
|
|
133
|
-
}
|
|
134
|
-
const gitCommand = `rebase -i ${params.commit_range}`;
|
|
135
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(gitCommand, params.projectPath, 'Executando rebase interativo');
|
|
136
|
-
if (result.exitCode !== 0) {
|
|
137
|
-
throw new Error(`Falha no rebase interativo: ${result.output}`);
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
success: true,
|
|
141
|
-
action: 'interactive-rebase',
|
|
142
|
-
message: `Rebase interativo executado com sucesso no range ${params.commit_range}`,
|
|
143
|
-
data: {
|
|
144
|
-
commit_range: params.commit_range,
|
|
145
|
-
output: result.output
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
throw new Error(`Falha ao executar rebase interativo: ${error instanceof Error ? error.message : String(error)}`);
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
async abortRebase(params) {
|
|
154
|
-
try {
|
|
155
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(`rebase --abort`, params.projectPath, 'Abortando rebase');
|
|
156
|
-
if (result.exitCode !== 0) {
|
|
157
|
-
throw new Error(`Falha ao abortar rebase: ${result.output}`);
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
success: true,
|
|
161
|
-
action: 'abort',
|
|
162
|
-
message: 'Rebase abortado com sucesso',
|
|
163
|
-
data: {
|
|
164
|
-
aborted: true,
|
|
165
|
-
output: result.output
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
throw new Error(`Falha ao abortar rebase: ${error instanceof Error ? error.message : String(error)}`);
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
async continueRebase(params) {
|
|
174
|
-
try {
|
|
175
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(`rebase --continue`, params.projectPath, 'Continuando rebase');
|
|
176
|
-
if (result.exitCode !== 0) {
|
|
177
|
-
throw new Error(`Falha ao continuar rebase: ${result.output}`);
|
|
178
|
-
}
|
|
179
|
-
return {
|
|
180
|
-
success: true,
|
|
181
|
-
action: 'continue',
|
|
182
|
-
message: 'Rebase continuado com sucesso',
|
|
183
|
-
data: {
|
|
184
|
-
continued: true,
|
|
185
|
-
output: result.output
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
throw new Error(`Falha ao continuar rebase: ${error instanceof Error ? error.message : String(error)}`);
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
async skipCommit(params) {
|
|
194
|
-
try {
|
|
195
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(`rebase --skip`, params.projectPath, 'Pulando commit no rebase');
|
|
196
|
-
if (result.exitCode !== 0) {
|
|
197
|
-
throw new Error(`Falha ao pular commit: ${result.output}`);
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
success: true,
|
|
201
|
-
action: 'skip',
|
|
202
|
-
message: 'Commit pulado com sucesso',
|
|
203
|
-
data: {
|
|
204
|
-
skipped: true,
|
|
205
|
-
output: result.output
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
catch (error) {
|
|
210
|
-
throw new Error(`Falha ao pular commit: ${error instanceof Error ? error.message : String(error)}`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gitRebaseTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const terminal_controller_js_1 = require("../utils/terminal-controller.js");
|
|
6
|
+
/**
|
|
7
|
+
* Tool: git-rebase
|
|
8
|
+
*
|
|
9
|
+
* DESCRIÇÃO:
|
|
10
|
+
* Gerenciamento de rebase Git (GitHub + Gitea) com múltiplas ações
|
|
11
|
+
*
|
|
12
|
+
* FUNCIONALIDADES:
|
|
13
|
+
* - Rebase interativo
|
|
14
|
+
* - Rebase simples
|
|
15
|
+
* - Abortar rebase
|
|
16
|
+
* - Continuar rebase
|
|
17
|
+
* - Pular commit
|
|
18
|
+
* - Rebase de branch
|
|
19
|
+
*
|
|
20
|
+
* USO:
|
|
21
|
+
* - Para reescrever histórico de commits
|
|
22
|
+
* - Para limpar commits antes do merge
|
|
23
|
+
* - Para reorganizar commits
|
|
24
|
+
* - Para resolver conflitos
|
|
25
|
+
*
|
|
26
|
+
* RECOMENDAÇÕES:
|
|
27
|
+
* - Use com cuidado em branches compartilhadas
|
|
28
|
+
* - Faça backup antes de rebases complexos
|
|
29
|
+
* - Teste em branches locais primeiro
|
|
30
|
+
*/
|
|
31
|
+
const GitRebaseInputSchema = zod_1.z.object({
|
|
32
|
+
action: zod_1.z.enum(['rebase', 'interactive-rebase', 'abort', 'continue', 'skip']),
|
|
33
|
+
// owner: obtido automaticamente do provider,
|
|
34
|
+
repo: zod_1.z.string(),
|
|
35
|
+
provider: zod_1.z.enum(['gitea', 'github']).describe('Provider to use (gitea or github)'),
|
|
36
|
+
projectPath: zod_1.z.string().describe('Local project path for git operations'),
|
|
37
|
+
// Para rebase
|
|
38
|
+
target_branch: zod_1.z.string().optional(),
|
|
39
|
+
base_branch: zod_1.z.string().optional(),
|
|
40
|
+
interactive: zod_1.z.boolean().optional(),
|
|
41
|
+
// Para interactive-rebase
|
|
42
|
+
commit_range: zod_1.z.string().optional(),
|
|
43
|
+
rebase_commands: zod_1.z.string().optional(),
|
|
44
|
+
});
|
|
45
|
+
const GitRebaseResultSchema = zod_1.z.object({
|
|
46
|
+
success: zod_1.z.boolean(),
|
|
47
|
+
action: zod_1.z.string(),
|
|
48
|
+
message: zod_1.z.string(),
|
|
49
|
+
data: zod_1.z.any().optional(),
|
|
50
|
+
error: zod_1.z.string().optional()
|
|
51
|
+
});
|
|
52
|
+
exports.gitRebaseTool = {
|
|
53
|
+
name: 'git-rebase',
|
|
54
|
+
description: 'tool: Gerencia operações Git rebase para reorganização de commits\n──────────────\naction rebase: executa rebase simples\naction rebase requires: repo, target_branch, base_branch, provider, projectPath\n───────────────\naction interactive-rebase: rebase interativo\naction interactive-rebase requires: repo, target_branch, base_branch, interactive, commit_range, rebase_commands, provider, projectPath\n───────────────\naction abort: aborta rebase em andamento\naction abort requires: repo, provider, projectPath\n───────────────\naction continue: continua rebase pausado\naction continue requires: repo, provider, projectPath\n───────────────\naction skip: pula commit problemático\naction skip requires: repo, provider, projectPath',
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
properties: {
|
|
58
|
+
action: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
enum: ['rebase', 'interactive-rebase', 'abort', 'continue', 'skip'],
|
|
61
|
+
description: 'Action to perform on rebase'
|
|
62
|
+
},
|
|
63
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
64
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
65
|
+
provider: { type: 'string', enum: ['gitea', 'github'], description: 'Provider to use (gitea or github)' },
|
|
66
|
+
projectPath: { type: 'string', description: 'Local project path for git operations' },
|
|
67
|
+
target_branch: { type: 'string', description: 'Target branch for rebase' },
|
|
68
|
+
base_branch: { type: 'string', description: 'Base branch for rebase' },
|
|
69
|
+
interactive: { type: 'boolean', description: 'Interactive rebase' },
|
|
70
|
+
commit_range: { type: 'string', description: 'Commit range for interactive rebase' },
|
|
71
|
+
rebase_commands: { type: 'string', description: 'Rebase commands for interactive mode' }
|
|
72
|
+
},
|
|
73
|
+
required: ['action', 'repo', 'provider', 'projectPath']
|
|
74
|
+
},
|
|
75
|
+
async handler(input) {
|
|
76
|
+
try {
|
|
77
|
+
const validatedInput = GitRebaseInputSchema.parse(input);
|
|
78
|
+
switch (validatedInput.action) {
|
|
79
|
+
case 'rebase':
|
|
80
|
+
return await this.rebase(validatedInput);
|
|
81
|
+
case 'interactive-rebase':
|
|
82
|
+
return await this.interactiveRebase(validatedInput);
|
|
83
|
+
case 'abort':
|
|
84
|
+
return await this.abortRebase(validatedInput);
|
|
85
|
+
case 'continue':
|
|
86
|
+
return await this.continueRebase(validatedInput);
|
|
87
|
+
case 'skip':
|
|
88
|
+
return await this.skipCommit(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 rebase',
|
|
98
|
+
error: error instanceof Error ? error.message : String(error)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
async rebase(params) {
|
|
103
|
+
try {
|
|
104
|
+
if (!params.target_branch) {
|
|
105
|
+
throw new Error('target_branch é obrigatório para rebase');
|
|
106
|
+
}
|
|
107
|
+
const gitCommand = params.interactive
|
|
108
|
+
? `cd "${params.projectPath}" && git rebase -i ${params.target_branch}`
|
|
109
|
+
: `cd "${params.projectPath}" && git rebase ${params.target_branch}`;
|
|
110
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(gitCommand, params.projectPath, 'Executando rebase');
|
|
111
|
+
if (result.exitCode !== 0) {
|
|
112
|
+
throw new Error(`Falha no rebase: ${result.output}`);
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
success: true,
|
|
116
|
+
action: 'rebase',
|
|
117
|
+
message: `Rebase executado com sucesso na branch ${params.target_branch}`,
|
|
118
|
+
data: {
|
|
119
|
+
target_branch: params.target_branch,
|
|
120
|
+
interactive: params.interactive,
|
|
121
|
+
output: result.output
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
throw new Error(`Falha ao executar rebase: ${error instanceof Error ? error.message : String(error)}`);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
async interactiveRebase(params) {
|
|
130
|
+
try {
|
|
131
|
+
if (!params.commit_range) {
|
|
132
|
+
throw new Error('commit_range é obrigatório para rebase interativo');
|
|
133
|
+
}
|
|
134
|
+
const gitCommand = `rebase -i ${params.commit_range}`;
|
|
135
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(gitCommand, params.projectPath, 'Executando rebase interativo');
|
|
136
|
+
if (result.exitCode !== 0) {
|
|
137
|
+
throw new Error(`Falha no rebase interativo: ${result.output}`);
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
success: true,
|
|
141
|
+
action: 'interactive-rebase',
|
|
142
|
+
message: `Rebase interativo executado com sucesso no range ${params.commit_range}`,
|
|
143
|
+
data: {
|
|
144
|
+
commit_range: params.commit_range,
|
|
145
|
+
output: result.output
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
throw new Error(`Falha ao executar rebase interativo: ${error instanceof Error ? error.message : String(error)}`);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
async abortRebase(params) {
|
|
154
|
+
try {
|
|
155
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(`rebase --abort`, params.projectPath, 'Abortando rebase');
|
|
156
|
+
if (result.exitCode !== 0) {
|
|
157
|
+
throw new Error(`Falha ao abortar rebase: ${result.output}`);
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
success: true,
|
|
161
|
+
action: 'abort',
|
|
162
|
+
message: 'Rebase abortado com sucesso',
|
|
163
|
+
data: {
|
|
164
|
+
aborted: true,
|
|
165
|
+
output: result.output
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
throw new Error(`Falha ao abortar rebase: ${error instanceof Error ? error.message : String(error)}`);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
async continueRebase(params) {
|
|
174
|
+
try {
|
|
175
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(`rebase --continue`, params.projectPath, 'Continuando rebase');
|
|
176
|
+
if (result.exitCode !== 0) {
|
|
177
|
+
throw new Error(`Falha ao continuar rebase: ${result.output}`);
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
success: true,
|
|
181
|
+
action: 'continue',
|
|
182
|
+
message: 'Rebase continuado com sucesso',
|
|
183
|
+
data: {
|
|
184
|
+
continued: true,
|
|
185
|
+
output: result.output
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
throw new Error(`Falha ao continuar rebase: ${error instanceof Error ? error.message : String(error)}`);
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
async skipCommit(params) {
|
|
194
|
+
try {
|
|
195
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(`rebase --skip`, params.projectPath, 'Pulando commit no rebase');
|
|
196
|
+
if (result.exitCode !== 0) {
|
|
197
|
+
throw new Error(`Falha ao pular commit: ${result.output}`);
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
success: true,
|
|
201
|
+
action: 'skip',
|
|
202
|
+
message: 'Commit pulado com sucesso',
|
|
203
|
+
data: {
|
|
204
|
+
skipped: true,
|
|
205
|
+
output: result.output
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
throw new Error(`Falha ao pular commit: ${error instanceof Error ? error.message : String(error)}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
214
|
//# sourceMappingURL=git-rebase.js.map
|