@andrebuzeli/git-mcp 2.41.0 → 2.43.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 +4 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/git-reset.d.ts +4 -4
- package/dist/tools/git-update-project.d.ts +35 -35
- package/dist/tools/git-update-project.d.ts.map +1 -1
- package/dist/tools/git-update-project.js +161 -164
- package/dist/tools/git-update-project.js.map +1 -1
- package/dist/utils/git-operations.js +5 -6
- package/dist/utils/git-operations.js.map +1 -1
- package/package.json +4 -3
- package/dist/tools/git-upload-project.d.ts +0 -173
- package/dist/tools/git-upload-project.d.ts.map +0 -1
- package/dist/tools/git-upload-project.js +0 -348
- package/dist/tools/git-upload-project.js.map +0 -1
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AA+FA;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAS;;IAavB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,aAAa;IAuDrB;;;;;;;;;;;;;;;;;;OAkBG;IACG,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA8D1B;;;;;;;;;;;;OAYG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dist/server.js
CHANGED
|
@@ -16,7 +16,8 @@ const index_js_2 = require("./providers/index.js");
|
|
|
16
16
|
* - git-branches: Operações com branches
|
|
17
17
|
* - git-tags: Gerenciamento de tags
|
|
18
18
|
* - git-files: Gerenciamento de arquivos
|
|
19
|
-
* - git-
|
|
19
|
+
* - git-upload-project: Upload completo de projeto
|
|
20
|
+
* - git-update-project: Atualização incremental de projeto
|
|
20
21
|
* - git-initialize: Inicialização completa de repositório
|
|
21
22
|
* - git-issues: Gerenciamento de issues
|
|
22
23
|
* - git-releases: Gerenciamento de releases
|
|
@@ -61,7 +62,7 @@ const git_projects_js_1 = require("./tools/git-projects.js");
|
|
|
61
62
|
* - Handler deve ser assíncrono e retornar resultado
|
|
62
63
|
*
|
|
63
64
|
* ORGANIZAÇÃO:
|
|
64
|
-
* - Git Core (
|
|
65
|
+
* - Git Core (21): Funcionam com GitHub + Gitea
|
|
65
66
|
*
|
|
66
67
|
* USO:
|
|
67
68
|
* - Para listagem de tools disponíveis
|
|
@@ -69,7 +70,7 @@ const git_projects_js_1 = require("./tools/git-projects.js");
|
|
|
69
70
|
* - Para validação de parâmetros
|
|
70
71
|
*/
|
|
71
72
|
const tools = [
|
|
72
|
-
// Git Core Tools (
|
|
73
|
+
// Git Core Tools (21) - GitHub + Gitea
|
|
73
74
|
git_repositories_js_1.gitRepositoriesTool,
|
|
74
75
|
git_commits_js_1.commitsTool,
|
|
75
76
|
git_branches_js_1.branchesTool,
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AACnE,wEAAiF;AACjF,iEAAmG;AACnG,2CAAqC;AACrC,mDAAuF;AAEvF
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AACnE,wEAAiF;AACjF,iEAAmG;AACnG,2CAAqC;AACrC,mDAAuF;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,sBAAsB;AACtB,qEAAkE;AAClE,2DAAqD;AACrD,6DAAuD;AACvD,qDAA+C;AAC/C,uDAAiD;AACjD,yEAAqE;AACrE,iEAA2D;AAC3D,yDAAmD;AACnD,uDAAiD;AACjD,6DAAuD;AACvD,0DAA0D;A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CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAErC,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,6BAA6B;QAC/B,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF;AAxLD,wCAwLC;AAED;;;;;;;;;;;;;;;;;GAiBG;AAEH,+CAA+C;AAC/C,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;IAC9B,uBAAuB;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,gDAAgD;AAChD,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,qCAAqC;AACrC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -35,20 +35,20 @@ declare const GitResetInputSchema: z.ZodObject<{
|
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
36
|
provider: "gitea" | "github";
|
|
37
37
|
repo: string;
|
|
38
|
-
action: "soft" | "
|
|
38
|
+
action: "soft" | "hard" | "mixed" | "reset-to-commit" | "reset-branch";
|
|
39
39
|
projectPath: string;
|
|
40
40
|
branch_name?: string | undefined;
|
|
41
41
|
commit_hash?: string | undefined;
|
|
42
|
-
reset_type?: "soft" | "
|
|
42
|
+
reset_type?: "soft" | "hard" | "mixed" | undefined;
|
|
43
43
|
target_branch?: string | undefined;
|
|
44
44
|
}, {
|
|
45
45
|
provider: "gitea" | "github";
|
|
46
46
|
repo: string;
|
|
47
|
-
action: "soft" | "
|
|
47
|
+
action: "soft" | "hard" | "mixed" | "reset-to-commit" | "reset-branch";
|
|
48
48
|
projectPath: string;
|
|
49
49
|
branch_name?: string | undefined;
|
|
50
50
|
commit_hash?: string | undefined;
|
|
51
|
-
reset_type?: "soft" | "
|
|
51
|
+
reset_type?: "soft" | "hard" | "mixed" | undefined;
|
|
52
52
|
target_branch?: string | undefined;
|
|
53
53
|
}>;
|
|
54
54
|
export type GitResetInput = z.infer<typeof GitResetInputSchema>;
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
declare const GitUpdateProjectInputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
3
|
+
action: z.ZodLiteral<"init">;
|
|
4
|
+
repo: z.ZodString;
|
|
5
|
+
projectPath: z.ZodString;
|
|
6
|
+
provider: z.ZodEnum<["gitea", "github"]>;
|
|
7
|
+
message: z.ZodString;
|
|
8
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
9
|
+
createRepo: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
forcePush: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
granular: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
provider: "gitea" | "github";
|
|
14
|
+
message: string;
|
|
15
|
+
repo: string;
|
|
16
|
+
action: "init";
|
|
17
|
+
projectPath: string;
|
|
18
|
+
branch?: string | undefined;
|
|
19
|
+
createRepo?: boolean | undefined;
|
|
20
|
+
forcePush?: boolean | undefined;
|
|
21
|
+
granular?: boolean | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
provider: "gitea" | "github";
|
|
24
|
+
message: string;
|
|
25
|
+
repo: string;
|
|
26
|
+
action: "init";
|
|
27
|
+
projectPath: string;
|
|
28
|
+
branch?: string | undefined;
|
|
29
|
+
createRepo?: boolean | undefined;
|
|
30
|
+
forcePush?: boolean | undefined;
|
|
31
|
+
granular?: boolean | undefined;
|
|
32
|
+
}>, z.ZodObject<{
|
|
3
33
|
action: z.ZodLiteral<"update">;
|
|
4
34
|
repo: z.ZodString;
|
|
5
35
|
projectPath: z.ZodString;
|
|
@@ -80,12 +110,12 @@ declare const GitUpdateProjectInputSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
80
110
|
action: "reset";
|
|
81
111
|
projectPath: string;
|
|
82
112
|
commit?: string | undefined;
|
|
83
|
-
mode?: "soft" | "
|
|
113
|
+
mode?: "soft" | "hard" | "mixed" | undefined;
|
|
84
114
|
}, {
|
|
85
115
|
action: "reset";
|
|
86
116
|
projectPath: string;
|
|
87
117
|
commit?: string | undefined;
|
|
88
|
-
mode?: "soft" | "
|
|
118
|
+
mode?: "soft" | "hard" | "mixed" | undefined;
|
|
89
119
|
}>, z.ZodObject<{
|
|
90
120
|
action: z.ZodLiteral<"stash">;
|
|
91
121
|
projectPath: z.ZodString;
|
|
@@ -137,36 +167,6 @@ declare const GitUpdateProjectInputSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
137
167
|
projectPath: string;
|
|
138
168
|
branch?: string | undefined;
|
|
139
169
|
forcePush?: boolean | undefined;
|
|
140
|
-
}>, z.ZodObject<{
|
|
141
|
-
action: z.ZodLiteral<"init">;
|
|
142
|
-
repo: z.ZodString;
|
|
143
|
-
projectPath: z.ZodString;
|
|
144
|
-
provider: z.ZodEnum<["gitea", "github"]>;
|
|
145
|
-
message: z.ZodString;
|
|
146
|
-
branch: z.ZodOptional<z.ZodString>;
|
|
147
|
-
createRepo: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
-
forcePush: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
-
granular: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
-
}, "strip", z.ZodTypeAny, {
|
|
151
|
-
provider: "gitea" | "github";
|
|
152
|
-
message: string;
|
|
153
|
-
repo: string;
|
|
154
|
-
action: "init";
|
|
155
|
-
projectPath: string;
|
|
156
|
-
branch?: string | undefined;
|
|
157
|
-
forcePush?: boolean | undefined;
|
|
158
|
-
createRepo?: boolean | undefined;
|
|
159
|
-
granular?: boolean | undefined;
|
|
160
|
-
}, {
|
|
161
|
-
provider: "gitea" | "github";
|
|
162
|
-
message: string;
|
|
163
|
-
repo: string;
|
|
164
|
-
action: "init";
|
|
165
|
-
projectPath: string;
|
|
166
|
-
branch?: string | undefined;
|
|
167
|
-
forcePush?: boolean | undefined;
|
|
168
|
-
createRepo?: boolean | undefined;
|
|
169
|
-
granular?: boolean | undefined;
|
|
170
170
|
}>]>;
|
|
171
171
|
export type GitUpdateProjectInput = z.infer<typeof GitUpdateProjectInputSchema>;
|
|
172
172
|
declare const GitUpdateProjectResultSchema: z.ZodObject<{
|
|
@@ -285,6 +285,9 @@ export declare const gitUpdateProjectTool: {
|
|
|
285
285
|
handleUpdate(params: GitUpdateProjectInput & {
|
|
286
286
|
action: "update";
|
|
287
287
|
}): Promise<GitUpdateProjectResult>;
|
|
288
|
+
handleInit(params: GitUpdateProjectInput & {
|
|
289
|
+
action: "init";
|
|
290
|
+
}): Promise<GitUpdateProjectResult>;
|
|
288
291
|
handleStatus(params: GitUpdateProjectInput & {
|
|
289
292
|
action: "status";
|
|
290
293
|
}): Promise<GitUpdateProjectResult>;
|
|
@@ -306,9 +309,6 @@ export declare const gitUpdateProjectTool: {
|
|
|
306
309
|
handleSync(params: GitUpdateProjectInput & {
|
|
307
310
|
action: "sync";
|
|
308
311
|
}): Promise<GitUpdateProjectResult>;
|
|
309
|
-
handleInit(params: GitUpdateProjectInput & {
|
|
310
|
-
action: "init";
|
|
311
|
-
}): Promise<GitUpdateProjectResult>;
|
|
312
312
|
groupFilesByType(projectPath: string): Promise<Record<string, string[]>>;
|
|
313
313
|
};
|
|
314
314
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-update-project.d.ts","sourceRoot":"","sources":["../../src/tools/git-update-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmF/B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;EAMhC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAmCV,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;yBAqCjD,qBAAqB,GAAG;QAAE,MAAM,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"git-update-project.d.ts","sourceRoot":"","sources":["../../src/tools/git-update-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC;uBAwC5E,qBAAqB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;kCAkGjE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAwC/E,CAAC"}
|
|
@@ -6,6 +6,18 @@ const index_js_1 = require("../providers/index.js");
|
|
|
6
6
|
const user_detection_js_1 = require("../utils/user-detection.js");
|
|
7
7
|
const git_operations_js_1 = require("../utils/git-operations.js");
|
|
8
8
|
const GitUpdateProjectInputSchema = zod_1.z.discriminatedUnion('action', [
|
|
9
|
+
// Action: init - upload inicial completo (substitui upload-project)
|
|
10
|
+
zod_1.z.object({
|
|
11
|
+
action: zod_1.z.literal('init'),
|
|
12
|
+
repo: zod_1.z.string(),
|
|
13
|
+
projectPath: zod_1.z.string(),
|
|
14
|
+
provider: zod_1.z.enum(['gitea', 'github']),
|
|
15
|
+
message: zod_1.z.string().min(1, 'Commit message is required'),
|
|
16
|
+
branch: zod_1.z.string().optional(),
|
|
17
|
+
createRepo: zod_1.z.boolean().optional(),
|
|
18
|
+
forcePush: zod_1.z.boolean().optional(),
|
|
19
|
+
granular: zod_1.z.boolean().optional() // commits granulares por tipo de arquivo
|
|
20
|
+
}),
|
|
9
21
|
// Action: update - commit incremental
|
|
10
22
|
zod_1.z.object({
|
|
11
23
|
action: zod_1.z.literal('update'),
|
|
@@ -67,18 +79,6 @@ const GitUpdateProjectInputSchema = zod_1.z.discriminatedUnion('action', [
|
|
|
67
79
|
message: zod_1.z.string().min(1, 'Commit message is required'),
|
|
68
80
|
branch: zod_1.z.string().optional(),
|
|
69
81
|
forcePush: zod_1.z.boolean().optional()
|
|
70
|
-
}),
|
|
71
|
-
// Action: init - upload inicial completo (substitui upload-project)
|
|
72
|
-
zod_1.z.object({
|
|
73
|
-
action: zod_1.z.literal('init'),
|
|
74
|
-
repo: zod_1.z.string(),
|
|
75
|
-
projectPath: zod_1.z.string(),
|
|
76
|
-
provider: zod_1.z.enum(['gitea', 'github']),
|
|
77
|
-
message: zod_1.z.string().min(1, 'Commit message is required'),
|
|
78
|
-
branch: zod_1.z.string().optional(),
|
|
79
|
-
createRepo: zod_1.z.boolean().optional(),
|
|
80
|
-
forcePush: zod_1.z.boolean().optional(),
|
|
81
|
-
granular: zod_1.z.boolean().optional() // commits granulares por tipo de arquivo
|
|
82
82
|
})
|
|
83
83
|
]);
|
|
84
84
|
const GitUpdateProjectResultSchema = zod_1.z.object({
|
|
@@ -286,6 +286,151 @@ exports.gitUpdateProjectTool = {
|
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
288
|
},
|
|
289
|
+
// Action: init - upload inicial completo (substitui upload-project)
|
|
290
|
+
async handleInit(params) {
|
|
291
|
+
try {
|
|
292
|
+
const { repo, projectPath, message, branch = 'main', forcePush = false, createRepo = false, granular = false, provider: providerName } = params;
|
|
293
|
+
const gitOps = new git_operations_js_1.GitOperations(projectPath);
|
|
294
|
+
// Aplicar auto-detecção de usuário
|
|
295
|
+
const processedInput = await (0, user_detection_js_1.applyAutoUserDetection)(params, providerName);
|
|
296
|
+
const provider = index_js_1.globalProviderFactory.getProvider(processedInput.provider);
|
|
297
|
+
if (!provider) {
|
|
298
|
+
throw new Error(`Provider '${providerName}' não encontrado`);
|
|
299
|
+
}
|
|
300
|
+
const currentUser = await provider.getCurrentUser();
|
|
301
|
+
const owner = currentUser.login;
|
|
302
|
+
// 1. Inicializar repositório Git local se necessário
|
|
303
|
+
const isGitRepo = await gitOps.isGitRepository();
|
|
304
|
+
if (!isGitRepo) {
|
|
305
|
+
const initResult = await gitOps.initRepository();
|
|
306
|
+
if (!initResult.success) {
|
|
307
|
+
throw new Error(`Falha ao inicializar repositório Git: ${initResult.error}`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// 2. Verificar/criar repositório remoto
|
|
311
|
+
let repoExists = true;
|
|
312
|
+
try {
|
|
313
|
+
await provider.getRepository(owner, repo);
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
repoExists = false;
|
|
317
|
+
if (createRepo) {
|
|
318
|
+
try {
|
|
319
|
+
await provider.createRepository(repo, `Projeto ${repo}`, false);
|
|
320
|
+
repoExists = true;
|
|
321
|
+
}
|
|
322
|
+
catch (createError) {
|
|
323
|
+
console.warn(`Aviso: Não foi possível criar repositório: ${createError instanceof Error ? createError.message : String(createError)}`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
throw new Error(`Repositório '${repo}' não existe. Use createRepo: true para criar automaticamente.`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// 3. Preparar arquivos para commit
|
|
331
|
+
let filesCommitted = 0;
|
|
332
|
+
let commitsCreated = 0;
|
|
333
|
+
if (granular) {
|
|
334
|
+
// Commits granulares por tipo de arquivo (melhor rastreabilidade)
|
|
335
|
+
const fileGroups = await this.groupFilesByType(projectPath);
|
|
336
|
+
for (const [fileType, files] of Object.entries(fileGroups)) {
|
|
337
|
+
if (files.length > 0) {
|
|
338
|
+
// Adicionar arquivos do tipo específico
|
|
339
|
+
const addResult = await gitOps.addFiles(files);
|
|
340
|
+
if (addResult.success) {
|
|
341
|
+
// Verificar se há mudanças para commitar
|
|
342
|
+
const statusResult = await gitOps.status({ porcelain: true });
|
|
343
|
+
if (statusResult.success && statusResult.output.trim()) {
|
|
344
|
+
const commitResult = await gitOps.commit(`${message} - ${fileType} files`);
|
|
345
|
+
if (commitResult.success) {
|
|
346
|
+
commitsCreated++;
|
|
347
|
+
filesCommitted += files.length;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
// Commit único de todos os arquivos (como upload-project)
|
|
356
|
+
const addResult = await gitOps.addFiles(['.']);
|
|
357
|
+
if (addResult.success) {
|
|
358
|
+
const statusResult = await gitOps.status({ porcelain: true });
|
|
359
|
+
if (statusResult.success && statusResult.output.trim()) {
|
|
360
|
+
const commitResult = await gitOps.commit(message);
|
|
361
|
+
if (commitResult.success) {
|
|
362
|
+
commitsCreated++;
|
|
363
|
+
filesCommitted = statusResult.output.trim().split('\n').length;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
// 4. Configurar e fazer push para remote
|
|
369
|
+
let pushSuccessful = false;
|
|
370
|
+
const remoteUrl = provider.getRepositoryUrl(owner, repo);
|
|
371
|
+
// Configurar remote origin
|
|
372
|
+
const remoteResult = await gitOps.remote('show', 'origin');
|
|
373
|
+
if (!remoteResult.success) {
|
|
374
|
+
const addRemoteResult = await gitOps.remote('add', 'origin', remoteUrl);
|
|
375
|
+
if (!addRemoteResult.success && !addRemoteResult.error?.includes('already exists')) {
|
|
376
|
+
console.warn(`Aviso: Falha ao adicionar remote: ${addRemoteResult.error}`);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
// Atualizar URL se necessário
|
|
381
|
+
const setUrlResult = await gitOps.remote('set-url', 'origin', remoteUrl);
|
|
382
|
+
if (!setUrlResult.success) {
|
|
383
|
+
console.warn(`Aviso: Falha ao atualizar remote URL: ${setUrlResult.error}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// Fazer push
|
|
387
|
+
if (commitsCreated > 0) {
|
|
388
|
+
try {
|
|
389
|
+
const pushOptions = { setUpstream: true };
|
|
390
|
+
if (forcePush)
|
|
391
|
+
pushOptions.force = true;
|
|
392
|
+
const pushResult = await gitOps.push('origin', branch, pushOptions);
|
|
393
|
+
pushSuccessful = pushResult.success;
|
|
394
|
+
if (!pushSuccessful) {
|
|
395
|
+
console.warn(`Aviso: Push falhou: ${pushResult.error}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
catch (pushErr) {
|
|
399
|
+
console.warn(`Aviso: Erro no push: ${pushErr instanceof Error ? pushErr.message : String(pushErr)}`);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return {
|
|
403
|
+
success: true,
|
|
404
|
+
action: 'init',
|
|
405
|
+
message: `Upload inicial concluído com ${commitsCreated} commit(s) e ${filesCommitted} arquivo(s)`,
|
|
406
|
+
data: {
|
|
407
|
+
repo,
|
|
408
|
+
branch,
|
|
409
|
+
provider: providerName,
|
|
410
|
+
owner,
|
|
411
|
+
remoteUrl,
|
|
412
|
+
repositoryCreated: !repoExists && createRepo,
|
|
413
|
+
gitInit: !isGitRepo,
|
|
414
|
+
commitsCreated,
|
|
415
|
+
filesCommitted,
|
|
416
|
+
pushSuccessful,
|
|
417
|
+
granular,
|
|
418
|
+
implementation: 'REAL_GIT_OPERATIONS_v2.40.0',
|
|
419
|
+
note: granular ?
|
|
420
|
+
'Commits granulares criados por tipo de arquivo para melhor rastreabilidade' :
|
|
421
|
+
'Commit único criado (como upload-project original)'
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
return {
|
|
427
|
+
success: false,
|
|
428
|
+
action: 'init',
|
|
429
|
+
message: 'Erro no upload inicial do projeto',
|
|
430
|
+
error: error instanceof Error ? error.message : String(error)
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
},
|
|
289
434
|
// Action: status - verificar status do repositório
|
|
290
435
|
async handleStatus(params) {
|
|
291
436
|
try {
|
|
@@ -341,7 +486,6 @@ exports.gitUpdateProjectTool = {
|
|
|
341
486
|
if (!isGitRepo) {
|
|
342
487
|
throw new Error(`Diretório '${projectPath}' não é um repositório Git válido`);
|
|
343
488
|
}
|
|
344
|
-
// Obter diferenças
|
|
345
489
|
const diffOptions = {};
|
|
346
490
|
if (staged)
|
|
347
491
|
diffOptions.cached = true;
|
|
@@ -435,11 +579,9 @@ exports.gitUpdateProjectTool = {
|
|
|
435
579
|
throw new Error(`Diretório '${projectPath}' não é um repositório Git válido`);
|
|
436
580
|
}
|
|
437
581
|
// Executar reset
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
442
|
-
const resetResult = await gitOps.reset(mode, resetOptions);
|
|
582
|
+
const target = commit || 'HEAD';
|
|
583
|
+
const resetOptions = { mode };
|
|
584
|
+
const resetResult = await gitOps.reset(target, resetOptions);
|
|
443
585
|
if (!resetResult.success) {
|
|
444
586
|
throw new Error(`Falha no reset: ${resetResult.error}`);
|
|
445
587
|
}
|
|
@@ -449,7 +591,7 @@ exports.gitUpdateProjectTool = {
|
|
|
449
591
|
message: `Reset ${mode} executado com sucesso`,
|
|
450
592
|
data: {
|
|
451
593
|
mode,
|
|
452
|
-
targetCommit:
|
|
594
|
+
targetCommit: target,
|
|
453
595
|
resetOutput: resetResult.output,
|
|
454
596
|
implementation: 'REAL_GIT_OPERATIONS_v2.38.0'
|
|
455
597
|
}
|
|
@@ -649,151 +791,6 @@ exports.gitUpdateProjectTool = {
|
|
|
649
791
|
};
|
|
650
792
|
}
|
|
651
793
|
},
|
|
652
|
-
// Action: init - upload inicial completo (substitui upload-project)
|
|
653
|
-
async handleInit(params) {
|
|
654
|
-
try {
|
|
655
|
-
const { repo, projectPath, message, branch = 'main', forcePush = false, createRepo = false, granular = false, provider: providerName } = params;
|
|
656
|
-
const gitOps = new git_operations_js_1.GitOperations(projectPath);
|
|
657
|
-
// Aplicar auto-detecção de usuário
|
|
658
|
-
const processedInput = await (0, user_detection_js_1.applyAutoUserDetection)(params, providerName);
|
|
659
|
-
const provider = index_js_1.globalProviderFactory.getProvider(processedInput.provider);
|
|
660
|
-
if (!provider) {
|
|
661
|
-
throw new Error(`Provider '${providerName}' não encontrado`);
|
|
662
|
-
}
|
|
663
|
-
const currentUser = await provider.getCurrentUser();
|
|
664
|
-
const owner = currentUser.login;
|
|
665
|
-
// 1. Inicializar repositório Git local se necessário
|
|
666
|
-
const isGitRepo = await gitOps.isGitRepository();
|
|
667
|
-
if (!isGitRepo) {
|
|
668
|
-
const initResult = await gitOps.initRepository();
|
|
669
|
-
if (!initResult.success) {
|
|
670
|
-
throw new Error(`Falha ao inicializar repositório Git: ${initResult.error}`);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
// 2. Verificar/criar repositório remoto
|
|
674
|
-
let repoExists = true;
|
|
675
|
-
try {
|
|
676
|
-
await provider.getRepository(owner, repo);
|
|
677
|
-
}
|
|
678
|
-
catch (error) {
|
|
679
|
-
repoExists = false;
|
|
680
|
-
if (createRepo) {
|
|
681
|
-
try {
|
|
682
|
-
await provider.createRepository(repo, `Projeto ${repo}`, false);
|
|
683
|
-
repoExists = true;
|
|
684
|
-
}
|
|
685
|
-
catch (createError) {
|
|
686
|
-
console.warn(`Aviso: Não foi possível criar repositório: ${createError instanceof Error ? createError.message : String(createError)}`);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
else {
|
|
690
|
-
throw new Error(`Repositório '${repo}' não existe. Use createRepo: true para criar automaticamente.`);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
// 3. Preparar arquivos para commit
|
|
694
|
-
let filesCommitted = 0;
|
|
695
|
-
let commitsCreated = 0;
|
|
696
|
-
if (granular) {
|
|
697
|
-
// Commits granulares por tipo de arquivo (melhor rastreabilidade)
|
|
698
|
-
const fileGroups = await this.groupFilesByType(projectPath);
|
|
699
|
-
for (const [fileType, files] of Object.entries(fileGroups)) {
|
|
700
|
-
if (files.length > 0) {
|
|
701
|
-
// Adicionar arquivos do tipo específico
|
|
702
|
-
const addResult = await gitOps.addFiles(files);
|
|
703
|
-
if (addResult.success) {
|
|
704
|
-
// Verificar se há mudanças para commitar
|
|
705
|
-
const statusResult = await gitOps.status({ porcelain: true });
|
|
706
|
-
if (statusResult.success && statusResult.output.trim()) {
|
|
707
|
-
const commitResult = await gitOps.commit(`${message} - ${fileType} files`);
|
|
708
|
-
if (commitResult.success) {
|
|
709
|
-
commitsCreated++;
|
|
710
|
-
filesCommitted += files.length;
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
else {
|
|
718
|
-
// Commit único de todos os arquivos (como upload-project)
|
|
719
|
-
const addResult = await gitOps.addFiles(['.']);
|
|
720
|
-
if (addResult.success) {
|
|
721
|
-
const statusResult = await gitOps.status({ porcelain: true });
|
|
722
|
-
if (statusResult.success && statusResult.output.trim()) {
|
|
723
|
-
const commitResult = await gitOps.commit(message);
|
|
724
|
-
if (commitResult.success) {
|
|
725
|
-
commitsCreated++;
|
|
726
|
-
filesCommitted = statusResult.output.trim().split('\n').length;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
// 4. Configurar e fazer push para remote
|
|
732
|
-
let pushSuccessful = false;
|
|
733
|
-
const remoteUrl = provider.getRepositoryUrl(owner, repo);
|
|
734
|
-
// Configurar remote origin
|
|
735
|
-
const remoteResult = await gitOps.remote('show', 'origin');
|
|
736
|
-
if (!remoteResult.success) {
|
|
737
|
-
const addRemoteResult = await gitOps.remote('add', 'origin', remoteUrl);
|
|
738
|
-
if (!addRemoteResult.success && !addRemoteResult.error?.includes('already exists')) {
|
|
739
|
-
console.warn(`Aviso: Falha ao adicionar remote: ${addRemoteResult.error}`);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
else {
|
|
743
|
-
// Atualizar URL se necessário
|
|
744
|
-
const setUrlResult = await gitOps.remote('set-url', 'origin', remoteUrl);
|
|
745
|
-
if (!setUrlResult.success) {
|
|
746
|
-
console.warn(`Aviso: Falha ao atualizar remote URL: ${setUrlResult.error}`);
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
// Fazer push
|
|
750
|
-
if (commitsCreated > 0) {
|
|
751
|
-
try {
|
|
752
|
-
const pushOptions = { setUpstream: true };
|
|
753
|
-
if (forcePush)
|
|
754
|
-
pushOptions.force = true;
|
|
755
|
-
const pushResult = await gitOps.push('origin', branch, pushOptions);
|
|
756
|
-
pushSuccessful = pushResult.success;
|
|
757
|
-
if (!pushSuccessful) {
|
|
758
|
-
console.warn(`Aviso: Push falhou: ${pushResult.error}`);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
catch (pushErr) {
|
|
762
|
-
console.warn(`Aviso: Erro no push: ${pushErr instanceof Error ? pushErr.message : String(pushErr)}`);
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
return {
|
|
766
|
-
success: true,
|
|
767
|
-
action: 'init',
|
|
768
|
-
message: `Upload inicial concluído com ${commitsCreated} commit(s) e ${filesCommitted} arquivo(s)`,
|
|
769
|
-
data: {
|
|
770
|
-
repo,
|
|
771
|
-
branch,
|
|
772
|
-
provider: providerName,
|
|
773
|
-
owner,
|
|
774
|
-
remoteUrl,
|
|
775
|
-
repositoryCreated: !repoExists && createRepo,
|
|
776
|
-
gitInit: !isGitRepo,
|
|
777
|
-
commitsCreated,
|
|
778
|
-
filesCommitted,
|
|
779
|
-
pushSuccessful,
|
|
780
|
-
granular,
|
|
781
|
-
implementation: 'REAL_GIT_OPERATIONS_v2.40.0',
|
|
782
|
-
note: granular ?
|
|
783
|
-
'Commits granulares criados por tipo de arquivo para melhor rastreabilidade' :
|
|
784
|
-
'Commit único criado (como upload-project original)'
|
|
785
|
-
}
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
catch (error) {
|
|
789
|
-
return {
|
|
790
|
-
success: false,
|
|
791
|
-
action: 'init',
|
|
792
|
-
message: 'Erro no upload inicial do projeto',
|
|
793
|
-
error: error instanceof Error ? error.message : String(error)
|
|
794
|
-
};
|
|
795
|
-
}
|
|
796
|
-
},
|
|
797
794
|
// Helper method para agrupar arquivos por tipo
|
|
798
795
|
async groupFilesByType(projectPath) {
|
|
799
796
|
const gitOps = new git_operations_js_1.GitOperations(projectPath);
|