@andrebuzeli/git-mcp 2.27.4 → 2.28.1
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 -305
- 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-bundle.js
CHANGED
|
@@ -1,242 +1,242 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gitBundleTool = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const terminal_controller_js_1 = require("../utils/terminal-controller.js");
|
|
6
|
-
/**
|
|
7
|
-
* Tool: git-bundle
|
|
8
|
-
*
|
|
9
|
-
* DESCRIÇÃO:
|
|
10
|
-
* Gerenciamento de bundles Git (GitHub + Gitea) com múltiplas ações
|
|
11
|
-
*
|
|
12
|
-
* FUNCIONALIDADES:
|
|
13
|
-
* - Criar bundle
|
|
14
|
-
* - Verificar bundle
|
|
15
|
-
* - Listar heads do bundle
|
|
16
|
-
* - Unbundle
|
|
17
|
-
* - Criar bundle incremental
|
|
18
|
-
* - Criar bundle com tags
|
|
19
|
-
*
|
|
20
|
-
* USO:
|
|
21
|
-
* - Para transferir repositórios offline
|
|
22
|
-
* - Para backup completo de repositórios
|
|
23
|
-
* - Para sincronização sem rede
|
|
24
|
-
* - Para distribuição de código
|
|
25
|
-
*
|
|
26
|
-
* RECOMENDAÇÕES:
|
|
27
|
-
* - Use para transferências offline
|
|
28
|
-
* - Inclua tags quando necessário
|
|
29
|
-
* - Verifique bundles antes de usar
|
|
30
|
-
*/
|
|
31
|
-
const GitBundleInputSchema = zod_1.z.object({
|
|
32
|
-
action: zod_1.z.enum(['create', 'verify', 'list-heads', 'unbundle']),
|
|
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 create
|
|
38
|
-
bundle_file: zod_1.z.string().optional(),
|
|
39
|
-
commit_range: zod_1.z.string().optional(),
|
|
40
|
-
branch_name: zod_1.z.string().optional(),
|
|
41
|
-
// Para verify
|
|
42
|
-
verify_bundle: zod_1.z.string().optional(),
|
|
43
|
-
// Para list-heads
|
|
44
|
-
list_bundle: zod_1.z.string().optional(),
|
|
45
|
-
// Para unbundle
|
|
46
|
-
unbundle_file: zod_1.z.string().optional(),
|
|
47
|
-
unbundle_path: zod_1.z.string().optional(),
|
|
48
|
-
// Opções
|
|
49
|
-
all_branches: zod_1.z.boolean().optional(),
|
|
50
|
-
all_tags: zod_1.z.boolean().optional(),
|
|
51
|
-
all_remotes: zod_1.z.boolean().optional(),
|
|
52
|
-
});
|
|
53
|
-
const GitBundleResultSchema = zod_1.z.object({
|
|
54
|
-
success: zod_1.z.boolean(),
|
|
55
|
-
action: zod_1.z.string(),
|
|
56
|
-
message: zod_1.z.string(),
|
|
57
|
-
data: zod_1.z.any().optional(),
|
|
58
|
-
error: zod_1.z.string().optional()
|
|
59
|
-
});
|
|
60
|
-
exports.gitBundleTool = {
|
|
61
|
-
name: 'git-bundle',
|
|
62
|
-
description: 'tool: Gerencia bundles Git para transferência offline de repositórios\n──────────────\naction create: cria bundle do repositório\naction create requires: repo, provider, projectPath, bundle_file, commit_range, branch_name, all_branches, all_tags, all_remotes\n───────────────\naction verify: verifica integridade do bundle\naction verify requires: repo, provider, projectPath, verify_bundle\n───────────────\naction list-heads: lista heads do bundle\naction list-heads requires: repo, provider, projectPath, list_bundle\n───────────────\naction unbundle: extrai bundle para repositório\naction unbundle requires: repo, provider, projectPath, unbundle_file, unbundle_path',
|
|
63
|
-
inputSchema: {
|
|
64
|
-
type: 'object',
|
|
65
|
-
properties: {
|
|
66
|
-
action: {
|
|
67
|
-
type: 'string',
|
|
68
|
-
enum: ['create', 'verify', 'list-heads', 'unbundle'],
|
|
69
|
-
description: 'Action to perform on bundles'
|
|
70
|
-
},
|
|
71
|
-
owner: { type: 'string', description: 'Repository owner' },
|
|
72
|
-
repo: { type: 'string', description: 'Repository name' },
|
|
73
|
-
provider: { type: 'string', enum: ['gitea', 'github'], description: 'Provider to use (gitea or github)' },
|
|
74
|
-
projectPath: { type: 'string', description: 'Local project path for git operations' },
|
|
75
|
-
bundle_file: { type: 'string', description: 'Bundle file path' },
|
|
76
|
-
commit_range: { type: 'string', description: 'Commit range for bundle' },
|
|
77
|
-
branch_name: { type: 'string', description: 'Branch name for bundle' },
|
|
78
|
-
verify_bundle: { type: 'string', description: 'Bundle file to verify' },
|
|
79
|
-
list_bundle: { type: 'string', description: 'Bundle file to list heads' },
|
|
80
|
-
unbundle_file: { type: 'string', description: 'Bundle file to unbundle' },
|
|
81
|
-
unbundle_path: { type: 'string', description: 'Path to unbundle to' },
|
|
82
|
-
all_branches: { type: 'boolean', description: 'Include all branches' },
|
|
83
|
-
all_tags: { type: 'boolean', description: 'Include all tags' },
|
|
84
|
-
all_remotes: { type: 'boolean', description: 'Include all remotes' }
|
|
85
|
-
},
|
|
86
|
-
required: ['action', 'repo', 'provider', 'projectPath']
|
|
87
|
-
},
|
|
88
|
-
async handler(input) {
|
|
89
|
-
try {
|
|
90
|
-
const validatedInput = GitBundleInputSchema.parse(input);
|
|
91
|
-
switch (validatedInput.action) {
|
|
92
|
-
case 'create':
|
|
93
|
-
return await this.create(validatedInput);
|
|
94
|
-
case 'verify':
|
|
95
|
-
return await this.verify(validatedInput);
|
|
96
|
-
case 'list-heads':
|
|
97
|
-
return await this.listHeads(validatedInput);
|
|
98
|
-
case 'unbundle':
|
|
99
|
-
return await this.unbundle(validatedInput);
|
|
100
|
-
default:
|
|
101
|
-
throw new Error(`Ação não suportada: ${validatedInput.action}`);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
return {
|
|
106
|
-
success: false,
|
|
107
|
-
action: input.action,
|
|
108
|
-
message: 'Erro na operação de bundle',
|
|
109
|
-
error: error instanceof Error ? error.message : String(error)
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
async create(params) {
|
|
114
|
-
try {
|
|
115
|
-
if (!params.bundle_file) {
|
|
116
|
-
throw new Error('bundle_file é obrigatório para create');
|
|
117
|
-
}
|
|
118
|
-
let gitCommand = `bundle create ${params.bundle_file}`;
|
|
119
|
-
if (params.all_branches) {
|
|
120
|
-
gitCommand += ' --all';
|
|
121
|
-
}
|
|
122
|
-
else if (params.all_tags) {
|
|
123
|
-
gitCommand += ' --all-tags';
|
|
124
|
-
}
|
|
125
|
-
else if (params.all_remotes) {
|
|
126
|
-
gitCommand += ' --all-remotes';
|
|
127
|
-
}
|
|
128
|
-
else if (params.commit_range) {
|
|
129
|
-
gitCommand += ` ${params.commit_range}`;
|
|
130
|
-
}
|
|
131
|
-
else if (params.branch_name) {
|
|
132
|
-
gitCommand += ` ${params.branch_name}`;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
gitCommand += ' HEAD';
|
|
136
|
-
}
|
|
137
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(gitCommand, params.projectPath, 'Criando bundle');
|
|
138
|
-
if (result.exitCode !== 0) {
|
|
139
|
-
throw new Error(`Falha ao criar bundle: ${result.output}`);
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
success: true,
|
|
143
|
-
action: 'create',
|
|
144
|
-
message: `Bundle criado com sucesso: ${params.bundle_file}`,
|
|
145
|
-
data: {
|
|
146
|
-
bundle_file: params.bundle_file,
|
|
147
|
-
commit_range: params.commit_range,
|
|
148
|
-
branch_name: params.branch_name,
|
|
149
|
-
all_branches: params.all_branches,
|
|
150
|
-
all_tags: params.all_tags,
|
|
151
|
-
all_remotes: params.all_remotes,
|
|
152
|
-
output: result.output
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
throw new Error(`Falha ao criar bundle: ${error instanceof Error ? error.message : String(error)}`);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
async verify(params) {
|
|
161
|
-
try {
|
|
162
|
-
if (!params.verify_bundle) {
|
|
163
|
-
throw new Error('verify_bundle é obrigatório para verify');
|
|
164
|
-
}
|
|
165
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(`bundle verify ${params.verify_bundle}`, params.projectPath, 'Verificando bundle');
|
|
166
|
-
const isValid = result.exitCode === 0;
|
|
167
|
-
return {
|
|
168
|
-
success: true,
|
|
169
|
-
action: 'verify',
|
|
170
|
-
message: `Bundle ${isValid ? 'válido' : 'inválido'}: ${params.verify_bundle}`,
|
|
171
|
-
data: {
|
|
172
|
-
bundle: params.verify_bundle,
|
|
173
|
-
valid: isValid,
|
|
174
|
-
output: result.output
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
throw new Error(`Falha ao verificar bundle: ${error instanceof Error ? error.message : String(error)}`);
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
async listHeads(params) {
|
|
183
|
-
try {
|
|
184
|
-
if (!params.list_bundle) {
|
|
185
|
-
throw new Error('list_bundle é obrigatório para list-heads');
|
|
186
|
-
}
|
|
187
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(`bundle list-heads ${params.list_bundle}`, params.projectPath, 'Listando heads do bundle');
|
|
188
|
-
if (result.exitCode !== 0) {
|
|
189
|
-
throw new Error(`Falha ao listar heads do bundle: ${result.output}`);
|
|
190
|
-
}
|
|
191
|
-
const heads = result.output.split('\n')
|
|
192
|
-
.filter((line) => line.trim())
|
|
193
|
-
.map((line) => {
|
|
194
|
-
const parts = line.trim().split(' ');
|
|
195
|
-
return {
|
|
196
|
-
commit: parts[0],
|
|
197
|
-
ref: parts[1] || 'HEAD'
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
return {
|
|
201
|
-
success: true,
|
|
202
|
-
action: 'list-heads',
|
|
203
|
-
message: `Heads do bundle listados com sucesso: ${params.list_bundle}`,
|
|
204
|
-
data: {
|
|
205
|
-
bundle: params.list_bundle,
|
|
206
|
-
heads,
|
|
207
|
-
output: result.output
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
throw new Error(`Falha ao listar heads do bundle: ${error instanceof Error ? error.message : String(error)}`);
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
async unbundle(params) {
|
|
216
|
-
try {
|
|
217
|
-
if (!params.unbundle_file) {
|
|
218
|
-
throw new Error('unbundle_file é obrigatório para unbundle');
|
|
219
|
-
}
|
|
220
|
-
const unbundlePath = params.unbundle_path || params.projectPath;
|
|
221
|
-
const gitCommand = `bundle unbundle ${params.unbundle_file}`;
|
|
222
|
-
const result = await (0, terminal_controller_js_1.runGitCommand)(gitCommand, unbundlePath, 'Unbundling bundle');
|
|
223
|
-
if (result.exitCode !== 0) {
|
|
224
|
-
throw new Error(`Falha ao unbundle: ${result.output}`);
|
|
225
|
-
}
|
|
226
|
-
return {
|
|
227
|
-
success: true,
|
|
228
|
-
action: 'unbundle',
|
|
229
|
-
message: `Bundle unbundled com sucesso: ${params.unbundle_file}`,
|
|
230
|
-
data: {
|
|
231
|
-
bundle_file: params.unbundle_file,
|
|
232
|
-
unbundle_path: unbundlePath,
|
|
233
|
-
output: result.output
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
catch (error) {
|
|
238
|
-
throw new Error(`Falha ao unbundle: ${error instanceof Error ? error.message : String(error)}`);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gitBundleTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const terminal_controller_js_1 = require("../utils/terminal-controller.js");
|
|
6
|
+
/**
|
|
7
|
+
* Tool: git-bundle
|
|
8
|
+
*
|
|
9
|
+
* DESCRIÇÃO:
|
|
10
|
+
* Gerenciamento de bundles Git (GitHub + Gitea) com múltiplas ações
|
|
11
|
+
*
|
|
12
|
+
* FUNCIONALIDADES:
|
|
13
|
+
* - Criar bundle
|
|
14
|
+
* - Verificar bundle
|
|
15
|
+
* - Listar heads do bundle
|
|
16
|
+
* - Unbundle
|
|
17
|
+
* - Criar bundle incremental
|
|
18
|
+
* - Criar bundle com tags
|
|
19
|
+
*
|
|
20
|
+
* USO:
|
|
21
|
+
* - Para transferir repositórios offline
|
|
22
|
+
* - Para backup completo de repositórios
|
|
23
|
+
* - Para sincronização sem rede
|
|
24
|
+
* - Para distribuição de código
|
|
25
|
+
*
|
|
26
|
+
* RECOMENDAÇÕES:
|
|
27
|
+
* - Use para transferências offline
|
|
28
|
+
* - Inclua tags quando necessário
|
|
29
|
+
* - Verifique bundles antes de usar
|
|
30
|
+
*/
|
|
31
|
+
const GitBundleInputSchema = zod_1.z.object({
|
|
32
|
+
action: zod_1.z.enum(['create', 'verify', 'list-heads', 'unbundle']),
|
|
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 create
|
|
38
|
+
bundle_file: zod_1.z.string().optional(),
|
|
39
|
+
commit_range: zod_1.z.string().optional(),
|
|
40
|
+
branch_name: zod_1.z.string().optional(),
|
|
41
|
+
// Para verify
|
|
42
|
+
verify_bundle: zod_1.z.string().optional(),
|
|
43
|
+
// Para list-heads
|
|
44
|
+
list_bundle: zod_1.z.string().optional(),
|
|
45
|
+
// Para unbundle
|
|
46
|
+
unbundle_file: zod_1.z.string().optional(),
|
|
47
|
+
unbundle_path: zod_1.z.string().optional(),
|
|
48
|
+
// Opções
|
|
49
|
+
all_branches: zod_1.z.boolean().optional(),
|
|
50
|
+
all_tags: zod_1.z.boolean().optional(),
|
|
51
|
+
all_remotes: zod_1.z.boolean().optional(),
|
|
52
|
+
});
|
|
53
|
+
const GitBundleResultSchema = zod_1.z.object({
|
|
54
|
+
success: zod_1.z.boolean(),
|
|
55
|
+
action: zod_1.z.string(),
|
|
56
|
+
message: zod_1.z.string(),
|
|
57
|
+
data: zod_1.z.any().optional(),
|
|
58
|
+
error: zod_1.z.string().optional()
|
|
59
|
+
});
|
|
60
|
+
exports.gitBundleTool = {
|
|
61
|
+
name: 'git-bundle',
|
|
62
|
+
description: 'tool: Gerencia bundles Git para transferência offline de repositórios\n──────────────\naction create: cria bundle do repositório\naction create requires: repo, provider, projectPath, bundle_file, commit_range, branch_name, all_branches, all_tags, all_remotes\n───────────────\naction verify: verifica integridade do bundle\naction verify requires: repo, provider, projectPath, verify_bundle\n───────────────\naction list-heads: lista heads do bundle\naction list-heads requires: repo, provider, projectPath, list_bundle\n───────────────\naction unbundle: extrai bundle para repositório\naction unbundle requires: repo, provider, projectPath, unbundle_file, unbundle_path',
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
action: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
enum: ['create', 'verify', 'list-heads', 'unbundle'],
|
|
69
|
+
description: 'Action to perform on bundles'
|
|
70
|
+
},
|
|
71
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
72
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
73
|
+
provider: { type: 'string', enum: ['gitea', 'github'], description: 'Provider to use (gitea or github)' },
|
|
74
|
+
projectPath: { type: 'string', description: 'Local project path for git operations' },
|
|
75
|
+
bundle_file: { type: 'string', description: 'Bundle file path' },
|
|
76
|
+
commit_range: { type: 'string', description: 'Commit range for bundle' },
|
|
77
|
+
branch_name: { type: 'string', description: 'Branch name for bundle' },
|
|
78
|
+
verify_bundle: { type: 'string', description: 'Bundle file to verify' },
|
|
79
|
+
list_bundle: { type: 'string', description: 'Bundle file to list heads' },
|
|
80
|
+
unbundle_file: { type: 'string', description: 'Bundle file to unbundle' },
|
|
81
|
+
unbundle_path: { type: 'string', description: 'Path to unbundle to' },
|
|
82
|
+
all_branches: { type: 'boolean', description: 'Include all branches' },
|
|
83
|
+
all_tags: { type: 'boolean', description: 'Include all tags' },
|
|
84
|
+
all_remotes: { type: 'boolean', description: 'Include all remotes' }
|
|
85
|
+
},
|
|
86
|
+
required: ['action', 'repo', 'provider', 'projectPath']
|
|
87
|
+
},
|
|
88
|
+
async handler(input) {
|
|
89
|
+
try {
|
|
90
|
+
const validatedInput = GitBundleInputSchema.parse(input);
|
|
91
|
+
switch (validatedInput.action) {
|
|
92
|
+
case 'create':
|
|
93
|
+
return await this.create(validatedInput);
|
|
94
|
+
case 'verify':
|
|
95
|
+
return await this.verify(validatedInput);
|
|
96
|
+
case 'list-heads':
|
|
97
|
+
return await this.listHeads(validatedInput);
|
|
98
|
+
case 'unbundle':
|
|
99
|
+
return await this.unbundle(validatedInput);
|
|
100
|
+
default:
|
|
101
|
+
throw new Error(`Ação não suportada: ${validatedInput.action}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
return {
|
|
106
|
+
success: false,
|
|
107
|
+
action: input.action,
|
|
108
|
+
message: 'Erro na operação de bundle',
|
|
109
|
+
error: error instanceof Error ? error.message : String(error)
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
async create(params) {
|
|
114
|
+
try {
|
|
115
|
+
if (!params.bundle_file) {
|
|
116
|
+
throw new Error('bundle_file é obrigatório para create');
|
|
117
|
+
}
|
|
118
|
+
let gitCommand = `bundle create ${params.bundle_file}`;
|
|
119
|
+
if (params.all_branches) {
|
|
120
|
+
gitCommand += ' --all';
|
|
121
|
+
}
|
|
122
|
+
else if (params.all_tags) {
|
|
123
|
+
gitCommand += ' --all-tags';
|
|
124
|
+
}
|
|
125
|
+
else if (params.all_remotes) {
|
|
126
|
+
gitCommand += ' --all-remotes';
|
|
127
|
+
}
|
|
128
|
+
else if (params.commit_range) {
|
|
129
|
+
gitCommand += ` ${params.commit_range}`;
|
|
130
|
+
}
|
|
131
|
+
else if (params.branch_name) {
|
|
132
|
+
gitCommand += ` ${params.branch_name}`;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
gitCommand += ' HEAD';
|
|
136
|
+
}
|
|
137
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(gitCommand, params.projectPath, 'Criando bundle');
|
|
138
|
+
if (result.exitCode !== 0) {
|
|
139
|
+
throw new Error(`Falha ao criar bundle: ${result.output}`);
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
success: true,
|
|
143
|
+
action: 'create',
|
|
144
|
+
message: `Bundle criado com sucesso: ${params.bundle_file}`,
|
|
145
|
+
data: {
|
|
146
|
+
bundle_file: params.bundle_file,
|
|
147
|
+
commit_range: params.commit_range,
|
|
148
|
+
branch_name: params.branch_name,
|
|
149
|
+
all_branches: params.all_branches,
|
|
150
|
+
all_tags: params.all_tags,
|
|
151
|
+
all_remotes: params.all_remotes,
|
|
152
|
+
output: result.output
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
throw new Error(`Falha ao criar bundle: ${error instanceof Error ? error.message : String(error)}`);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
async verify(params) {
|
|
161
|
+
try {
|
|
162
|
+
if (!params.verify_bundle) {
|
|
163
|
+
throw new Error('verify_bundle é obrigatório para verify');
|
|
164
|
+
}
|
|
165
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(`bundle verify ${params.verify_bundle}`, params.projectPath, 'Verificando bundle');
|
|
166
|
+
const isValid = result.exitCode === 0;
|
|
167
|
+
return {
|
|
168
|
+
success: true,
|
|
169
|
+
action: 'verify',
|
|
170
|
+
message: `Bundle ${isValid ? 'válido' : 'inválido'}: ${params.verify_bundle}`,
|
|
171
|
+
data: {
|
|
172
|
+
bundle: params.verify_bundle,
|
|
173
|
+
valid: isValid,
|
|
174
|
+
output: result.output
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
throw new Error(`Falha ao verificar bundle: ${error instanceof Error ? error.message : String(error)}`);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
async listHeads(params) {
|
|
183
|
+
try {
|
|
184
|
+
if (!params.list_bundle) {
|
|
185
|
+
throw new Error('list_bundle é obrigatório para list-heads');
|
|
186
|
+
}
|
|
187
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(`bundle list-heads ${params.list_bundle}`, params.projectPath, 'Listando heads do bundle');
|
|
188
|
+
if (result.exitCode !== 0) {
|
|
189
|
+
throw new Error(`Falha ao listar heads do bundle: ${result.output}`);
|
|
190
|
+
}
|
|
191
|
+
const heads = result.output.split('\n')
|
|
192
|
+
.filter((line) => line.trim())
|
|
193
|
+
.map((line) => {
|
|
194
|
+
const parts = line.trim().split(' ');
|
|
195
|
+
return {
|
|
196
|
+
commit: parts[0],
|
|
197
|
+
ref: parts[1] || 'HEAD'
|
|
198
|
+
};
|
|
199
|
+
});
|
|
200
|
+
return {
|
|
201
|
+
success: true,
|
|
202
|
+
action: 'list-heads',
|
|
203
|
+
message: `Heads do bundle listados com sucesso: ${params.list_bundle}`,
|
|
204
|
+
data: {
|
|
205
|
+
bundle: params.list_bundle,
|
|
206
|
+
heads,
|
|
207
|
+
output: result.output
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
throw new Error(`Falha ao listar heads do bundle: ${error instanceof Error ? error.message : String(error)}`);
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
async unbundle(params) {
|
|
216
|
+
try {
|
|
217
|
+
if (!params.unbundle_file) {
|
|
218
|
+
throw new Error('unbundle_file é obrigatório para unbundle');
|
|
219
|
+
}
|
|
220
|
+
const unbundlePath = params.unbundle_path || params.projectPath;
|
|
221
|
+
const gitCommand = `bundle unbundle ${params.unbundle_file}`;
|
|
222
|
+
const result = await (0, terminal_controller_js_1.runGitCommand)(gitCommand, unbundlePath, 'Unbundling bundle');
|
|
223
|
+
if (result.exitCode !== 0) {
|
|
224
|
+
throw new Error(`Falha ao unbundle: ${result.output}`);
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
success: true,
|
|
228
|
+
action: 'unbundle',
|
|
229
|
+
message: `Bundle unbundled com sucesso: ${params.unbundle_file}`,
|
|
230
|
+
data: {
|
|
231
|
+
bundle_file: params.unbundle_file,
|
|
232
|
+
unbundle_path: unbundlePath,
|
|
233
|
+
output: result.output
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
throw new Error(`Falha ao unbundle: ${error instanceof Error ? error.message : String(error)}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
242
|
//# sourceMappingURL=git-bundle.js.map
|