@andrebuzeli/git-mcp 5.0.2 → 5.0.4
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 +13 -5
- package/dist/server.js.map +1 -1
- package/dist/tools/git-files.d.ts +29 -0
- package/dist/tools/git-files.d.ts.map +1 -1
- package/dist/tools/git-files.js +175 -219
- package/dist/tools/git-files.js.map +1 -1
- package/dist/tools/git-init.d.ts +50 -0
- package/dist/tools/git-init.d.ts.map +1 -0
- package/dist/tools/git-init.js +258 -0
- package/dist/tools/git-init.js.map +1 -0
- package/dist/tools/git-log.d.ts +67 -0
- package/dist/tools/git-log.d.ts.map +1 -0
- package/dist/tools/git-log.js +320 -0
- package/dist/tools/git-log.js.map +1 -0
- package/dist/tools/git-status.d.ts +29 -0
- package/dist/tools/git-status.d.ts.map +1 -0
- package/dist/tools/git-status.js +182 -0
- package/dist/tools/git-status.js.map +1 -0
- package/dist/tools/git-update.d.ts +34 -0
- package/dist/tools/git-update.d.ts.map +1 -0
- package/dist/tools/git-update.js +191 -0
- package/dist/tools/git-update.js.map +1 -0
- package/dist/utils/git-operations.d.ts +28 -0
- package/dist/utils/git-operations.d.ts.map +1 -1
- package/dist/utils/git-operations.js +53 -0
- package/dist/utils/git-operations.js.map +1 -1
- package/dist/utils/terminal-controller.d.ts +64 -0
- package/dist/utils/terminal-controller.d.ts.map +1 -1
- package/dist/utils/terminal-controller.js +130 -0
- package/dist/utils/terminal-controller.js.map +1 -1
- package/package.json +3 -3
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":"AA4EA,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAS;;IAgBvB,OAAO,CAAC,aAAa;IA+LrB,OAAO,CAAC,eAAe;IAuBjB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBpB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dist/server.js
CHANGED
|
@@ -24,6 +24,10 @@ const git_archive_js_1 = require("./tools/git-archive.js");
|
|
|
24
24
|
const git_packages_js_1 = require("./tools/git-packages.js");
|
|
25
25
|
const git_analytics_js_1 = require("./tools/git-analytics.js");
|
|
26
26
|
const git_sync_js_1 = require("./tools/git-sync.js");
|
|
27
|
+
const git_update_js_1 = require("./tools/git-update.js");
|
|
28
|
+
const git_status_js_1 = require("./tools/git-status.js");
|
|
29
|
+
const git_init_js_1 = require("./tools/git-init.js");
|
|
30
|
+
const git_log_js_1 = require("./tools/git-log.js");
|
|
27
31
|
/**
|
|
28
32
|
* Servidor MCP Git Completo com 17 Tools Unificadas
|
|
29
33
|
*
|
|
@@ -31,7 +35,7 @@ const git_sync_js_1 = require("./tools/git-sync.js");
|
|
|
31
35
|
* unifica operações locais + gerenciamento completo de repositórios remotos.
|
|
32
36
|
* git-repos foi completamente integrado ao git-workflow.
|
|
33
37
|
*/
|
|
34
|
-
// Lista completa das
|
|
38
|
+
// Lista completa das 21 tools unificadas
|
|
35
39
|
const tools = [
|
|
36
40
|
git_workflow_js_1.gitWorkflowTool, // 1. Workflow completo (local + remoto): init, commit, sync, status, backup, create, list, get, update, delete, fork, search
|
|
37
41
|
git_files_js_1.gitFilesTool, // 2. Gerenciamento de arquivos
|
|
@@ -49,19 +53,23 @@ const tools = [
|
|
|
49
53
|
git_archive_js_1.gitArchiveTool, // 14. Arquivamento
|
|
50
54
|
git_packages_js_1.gitPackagesTool, // 15. Gerenciamento de packages
|
|
51
55
|
git_analytics_js_1.gitAnalyticsTool, // 16. Analytics e estatísticas
|
|
52
|
-
git_sync_js_1.gitSyncTool // 17. Sincronização avançada
|
|
56
|
+
git_sync_js_1.gitSyncTool, // 17. Sincronização avançada
|
|
57
|
+
git_update_js_1.gitUpdateTool, // 18. Atualização completa do projeto
|
|
58
|
+
git_status_js_1.gitStatusTool, // 19. Status detalhado do Git
|
|
59
|
+
git_init_js_1.gitInitTool, // 20. Inicialização completa do Git
|
|
60
|
+
git_log_js_1.gitLogTool // 21. Histórico de commits e alterações
|
|
53
61
|
];
|
|
54
62
|
const resources = [
|
|
55
63
|
{
|
|
56
64
|
uri: 'mcp-git://status',
|
|
57
65
|
name: 'Server Status',
|
|
58
|
-
description: 'Status atual do servidor MCP Git com todas as
|
|
66
|
+
description: 'Status atual do servidor MCP Git com todas as 21 tools',
|
|
59
67
|
mimeType: 'application/json'
|
|
60
68
|
},
|
|
61
69
|
{
|
|
62
70
|
uri: 'mcp-git://tools',
|
|
63
71
|
name: 'Available Tools',
|
|
64
|
-
description: 'Lista completa das
|
|
72
|
+
description: 'Lista completa das 21 ferramentas Git disponíveis',
|
|
65
73
|
mimeType: 'application/json'
|
|
66
74
|
}
|
|
67
75
|
];
|
|
@@ -70,7 +78,7 @@ class GiteaMCPServer {
|
|
|
70
78
|
constructor() {
|
|
71
79
|
this.server = new index_js_1.Server({
|
|
72
80
|
name: 'git-mcp',
|
|
73
|
-
version: '
|
|
81
|
+
version: '5.0.4',
|
|
74
82
|
}, {
|
|
75
83
|
capabilities: {
|
|
76
84
|
tools: {},
|
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,iEAA0J;AAC1J,2CAAqC;AACrC,mDAAuF;AAEvF,mBAAmB;AACnB,6DAA0D;AAC1D,uDAAoD;AACpD,6DAA0D;AAC1D,yDAAsD;AACtD,uDAAoD;AACpD,qDAAkD;AAClD,2DAAwD;AACxD,yDAAsD;AACtD,uDAAoD;AACpD,uDAAoD;AACpD,yDAAsD;AACtD,2DAAwD;AACxD,yDAAsD;AACtD,2DAAwD;AACxD,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C;QACtE,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,6BAA6B,KAAK,CAAC,MAAM,qCAAqC,CAAC,CAAC;QAC9F,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF;AAhQD,wCAgQC;AAED,kCAAkC;AAClC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,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,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"}
|
|
@@ -14,6 +14,19 @@ export declare const gitFilesTool: {
|
|
|
14
14
|
type: string;
|
|
15
15
|
description: string;
|
|
16
16
|
};
|
|
17
|
+
provider: {
|
|
18
|
+
type: string;
|
|
19
|
+
enum: string[];
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
owner: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
repo: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
17
30
|
filePath: {
|
|
18
31
|
type: string;
|
|
19
32
|
description: string;
|
|
@@ -22,10 +35,26 @@ export declare const gitFilesTool: {
|
|
|
22
35
|
type: string;
|
|
23
36
|
description: string;
|
|
24
37
|
};
|
|
38
|
+
message: {
|
|
39
|
+
type: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
branch: {
|
|
43
|
+
type: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
sha: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
25
50
|
searchTerm: {
|
|
26
51
|
type: string;
|
|
27
52
|
description: string;
|
|
28
53
|
};
|
|
54
|
+
path: {
|
|
55
|
+
type: string;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
29
58
|
};
|
|
30
59
|
required: string[];
|
|
31
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-files.d.ts","sourceRoot":"","sources":["../../src/tools/git-files.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,iBAAiB,EAAc,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"git-files.d.ts","sourceRoot":"","sources":["../../src/tools/git-files.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,iBAAiB,EAAc,MAAM,4BAA4B,CAAC;AAyEpG,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAIF,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA8NtD,CAAC"}
|
package/dist/tools/git-files.js
CHANGED
|
@@ -2,278 +2,234 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.gitFilesTool = void 0;
|
|
4
4
|
const auto_detection_js_1 = require("../utils/auto-detection.js");
|
|
5
|
+
const configuration_validator_js_1 = require("../utils/configuration-validator.js");
|
|
6
|
+
const index_js_1 = require("../providers/index.js");
|
|
5
7
|
/**
|
|
6
|
-
* Git Files Tool - Gerenciamento de Arquivos
|
|
8
|
+
* Git Files Tool - Gerenciamento de Arquivos Remotos
|
|
7
9
|
*
|
|
8
|
-
* Implementa operações de arquivo
|
|
9
|
-
* - read: Ler conteúdo de arquivo
|
|
10
|
-
* - create: Criar novo arquivo
|
|
11
|
-
* - update: Atualizar arquivo existente
|
|
12
|
-
* - delete: Remover arquivo
|
|
13
|
-
* - search: Buscar conteúdo em arquivos
|
|
14
|
-
* -
|
|
10
|
+
* Implementa operações de arquivo em repositórios remotos via API:
|
|
11
|
+
* - read: Ler conteúdo de arquivo do repositório remoto
|
|
12
|
+
* - create: Criar novo arquivo no repositório remoto
|
|
13
|
+
* - update: Atualizar arquivo existente no repositório remoto
|
|
14
|
+
* - delete: Remover arquivo do repositório remoto
|
|
15
|
+
* - search: Buscar conteúdo em arquivos do repositório remoto
|
|
16
|
+
* - list: Listar arquivos do repositório remoto
|
|
15
17
|
*/
|
|
16
18
|
const inputSchema = {
|
|
17
19
|
type: 'object',
|
|
18
20
|
properties: {
|
|
19
21
|
action: {
|
|
20
22
|
type: 'string',
|
|
21
|
-
enum: ['read', 'create', '
|
|
23
|
+
enum: ['read', 'create', 'list'],
|
|
22
24
|
description: 'Ação de arquivo a executar'
|
|
23
25
|
},
|
|
24
26
|
projectPath: {
|
|
25
27
|
type: 'string',
|
|
26
28
|
description: 'Caminho do projeto (obrigatório)'
|
|
27
29
|
},
|
|
30
|
+
provider: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['github', 'gitea', 'both'],
|
|
33
|
+
description: 'Provider para operações remotas (obrigatório)'
|
|
34
|
+
},
|
|
35
|
+
owner: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: 'Proprietário do repositório (auto-detectado se não fornecido)'
|
|
38
|
+
},
|
|
39
|
+
repo: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: 'Nome do repositório (auto-detectado se não fornecido)'
|
|
42
|
+
},
|
|
28
43
|
filePath: {
|
|
29
44
|
type: 'string',
|
|
30
|
-
description: 'Caminho do arquivo
|
|
45
|
+
description: 'Caminho do arquivo no repositório'
|
|
31
46
|
},
|
|
32
47
|
content: {
|
|
33
48
|
type: 'string',
|
|
34
49
|
description: 'Conteúdo do arquivo (para create/update)'
|
|
35
50
|
},
|
|
51
|
+
message: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'Mensagem de commit (para create/update/delete)'
|
|
54
|
+
},
|
|
55
|
+
branch: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'Branch para operação (padrão: main)'
|
|
58
|
+
},
|
|
59
|
+
sha: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'SHA do arquivo (obrigatório para update/delete)'
|
|
62
|
+
},
|
|
36
63
|
searchTerm: {
|
|
37
64
|
type: 'string',
|
|
38
65
|
description: 'Termo de busca (para search)'
|
|
66
|
+
},
|
|
67
|
+
path: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'Caminho do diretório para listar (para list)'
|
|
39
70
|
}
|
|
40
71
|
},
|
|
41
|
-
required: ['action', 'projectPath']
|
|
72
|
+
required: ['action', 'projectPath', 'provider']
|
|
42
73
|
};
|
|
43
74
|
exports.gitFilesTool = {
|
|
44
75
|
name: 'git-files',
|
|
45
|
-
description: '📁 GERENCIAMENTO DE ARQUIVOS - Operações de arquivo
|
|
76
|
+
description: '📁 GERENCIAMENTO DE ARQUIVOS - Operações de arquivo em repositórios remotos',
|
|
46
77
|
inputSchema,
|
|
47
78
|
async handler(input) {
|
|
48
79
|
try {
|
|
49
|
-
const { action, projectPath, filePath, content, searchTerm } = input;
|
|
80
|
+
const { action, projectPath, provider, owner, repo, filePath, content, message, branch, sha, searchTerm, path } = input;
|
|
50
81
|
const detection = (0, auto_detection_js_1.autoDetect)(projectPath);
|
|
51
|
-
|
|
52
|
-
|
|
82
|
+
// Validar provider obrigatório
|
|
83
|
+
if (!provider) {
|
|
84
|
+
throw new Error('Provider é obrigatório. Use: github, gitea, ou both');
|
|
85
|
+
}
|
|
86
|
+
// Validar provider
|
|
87
|
+
const providerValidation = configuration_validator_js_1.ConfigurationValidator.validateProvider(provider);
|
|
88
|
+
if (!providerValidation.valid) {
|
|
89
|
+
return (0, auto_detection_js_1.createUniversalResponse)(false, action, providerValidation.error.message, detection, 'git-files', undefined, {
|
|
90
|
+
code: providerValidation.error.code,
|
|
91
|
+
message: providerValidation.error.message,
|
|
92
|
+
cause: 'Invalid provider parameter',
|
|
93
|
+
suggestion: providerValidation.error.suggestion
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// Auto-detectar owner e repo se não fornecidos
|
|
97
|
+
const targetOwner = owner || detection.owner || '';
|
|
98
|
+
const targetRepo = repo || detection.repoName || '';
|
|
99
|
+
if (!targetOwner || !targetRepo) {
|
|
100
|
+
throw new Error('Owner e repo são obrigatórios. Forneça-os ou execute em um repositório Git válido.');
|
|
101
|
+
}
|
|
102
|
+
// Executar operações baseadas no provider
|
|
103
|
+
let result;
|
|
53
104
|
switch (action) {
|
|
54
105
|
case 'read':
|
|
55
106
|
if (!filePath)
|
|
56
107
|
throw new Error('filePath é obrigatório para read');
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
108
|
+
if (provider === 'both') {
|
|
109
|
+
const results = { github: null, gitea: null };
|
|
110
|
+
// Tentar GitHub
|
|
111
|
+
try {
|
|
112
|
+
const githubProvider = index_js_1.globalProviderFactory.getProvider('github');
|
|
113
|
+
if (githubProvider) {
|
|
114
|
+
const fileData = await githubProvider.getFile(targetOwner, targetRepo, filePath, branch);
|
|
115
|
+
results.github = {
|
|
116
|
+
success: true,
|
|
117
|
+
data: {
|
|
118
|
+
filePath,
|
|
119
|
+
content: fileData.content ? Buffer.from(fileData.content, 'base64').toString('utf8') : '',
|
|
120
|
+
sha: fileData.sha,
|
|
121
|
+
size: fileData.size,
|
|
122
|
+
encoding: fileData.encoding,
|
|
123
|
+
url: fileData.url,
|
|
124
|
+
html_url: fileData.html_url
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
results.github = {
|
|
131
|
+
success: false,
|
|
132
|
+
error: error instanceof Error ? error.message : String(error)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// Tentar Gitea
|
|
136
|
+
try {
|
|
137
|
+
const giteaProvider = index_js_1.globalProviderFactory.getProvider('gitea');
|
|
138
|
+
if (giteaProvider) {
|
|
139
|
+
const fileData = await giteaProvider.getFile(targetOwner, targetRepo, filePath, branch);
|
|
140
|
+
results.gitea = {
|
|
141
|
+
success: true,
|
|
142
|
+
data: {
|
|
143
|
+
filePath,
|
|
144
|
+
content: fileData.content ? Buffer.from(fileData.content, 'base64').toString('utf8') : '',
|
|
145
|
+
sha: fileData.sha,
|
|
146
|
+
size: fileData.size,
|
|
147
|
+
encoding: fileData.encoding,
|
|
148
|
+
url: fileData.url,
|
|
149
|
+
html_url: fileData.html_url
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
results.gitea = {
|
|
156
|
+
success: false,
|
|
157
|
+
error: error instanceof Error ? error.message : String(error)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return (0, auto_detection_js_1.createUniversalResponse)(true, action, `Arquivo ${filePath} lido de ambos os providers`, detection, 'git-files', {
|
|
161
|
+
provider: 'both',
|
|
162
|
+
results
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// Provider único
|
|
167
|
+
const providerInstance = index_js_1.globalProviderFactory.getProvider(provider);
|
|
168
|
+
if (!providerInstance) {
|
|
169
|
+
throw new Error(`Provider ${provider} não configurado`);
|
|
170
|
+
}
|
|
171
|
+
const fileData = await providerInstance.getFile(targetOwner, targetRepo, filePath, branch);
|
|
172
|
+
return (0, auto_detection_js_1.createUniversalResponse)(true, action, `Arquivo ${filePath} lido com sucesso`, detection, 'git-files', {
|
|
173
|
+
filePath,
|
|
174
|
+
content: fileData.content ? Buffer.from(fileData.content, 'base64').toString('utf8') : '',
|
|
175
|
+
sha: fileData.sha,
|
|
176
|
+
size: fileData.size,
|
|
177
|
+
encoding: fileData.encoding,
|
|
178
|
+
url: fileData.url,
|
|
179
|
+
html_url: fileData.html_url,
|
|
180
|
+
provider
|
|
181
|
+
});
|
|
182
|
+
}
|
|
65
183
|
case 'create':
|
|
66
184
|
if (!filePath)
|
|
67
185
|
throw new Error('filePath é obrigatório para create');
|
|
68
186
|
if (!content)
|
|
69
187
|
throw new Error('content é obrigatório para create');
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
74
|
-
|
|
188
|
+
if (!message)
|
|
189
|
+
throw new Error('message é obrigatório para create');
|
|
190
|
+
const providerInstance = index_js_1.globalProviderFactory.getProvider(provider === 'both' ? 'github' : provider);
|
|
191
|
+
if (!providerInstance) {
|
|
192
|
+
throw new Error(`Provider ${provider} não configurado`);
|
|
75
193
|
}
|
|
76
|
-
|
|
77
|
-
return (0, auto_detection_js_1.createUniversalResponse)(true, action,
|
|
194
|
+
const fileData = await providerInstance.createFile(targetOwner, targetRepo, filePath, content, message, branch);
|
|
195
|
+
return (0, auto_detection_js_1.createUniversalResponse)(true, action, `Arquivo ${filePath} criado com sucesso`, detection, 'git-files', {
|
|
78
196
|
filePath,
|
|
79
|
-
|
|
80
|
-
size: content.length
|
|
197
|
+
sha: fileData.sha,
|
|
198
|
+
size: content.length,
|
|
199
|
+
message,
|
|
200
|
+
branch: branch || 'main',
|
|
201
|
+
provider
|
|
81
202
|
});
|
|
82
|
-
case '
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (!
|
|
86
|
-
throw new Error(
|
|
87
|
-
const updatePath = path.join(projectPath, filePath);
|
|
88
|
-
if (!fs.existsSync(updatePath)) {
|
|
89
|
-
throw new Error('Arquivo não existe');
|
|
203
|
+
case 'list':
|
|
204
|
+
const listPath = path || '';
|
|
205
|
+
const listProvider = index_js_1.globalProviderFactory.getProvider(provider === 'both' ? 'github' : provider);
|
|
206
|
+
if (!listProvider) {
|
|
207
|
+
throw new Error(`Provider ${provider} não configurado`);
|
|
90
208
|
}
|
|
91
|
-
|
|
92
|
-
return (0, auto_detection_js_1.createUniversalResponse)(true, action,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
fs.unlinkSync(deletePath);
|
|
105
|
-
return (0, auto_detection_js_1.createUniversalResponse)(true, action, 'Arquivo removido com sucesso', detection, 'git-files', {
|
|
106
|
-
filePath,
|
|
107
|
-
deleted: true
|
|
108
|
-
});
|
|
109
|
-
case 'search':
|
|
110
|
-
if (!searchTerm)
|
|
111
|
-
throw new Error('searchTerm é obrigatório para search');
|
|
112
|
-
const results = [];
|
|
113
|
-
const searchDir = (dir) => {
|
|
114
|
-
const items = fs.readdirSync(dir);
|
|
115
|
-
for (const item of items) {
|
|
116
|
-
const itemPath = path.join(dir, item);
|
|
117
|
-
const stat = fs.statSync(itemPath);
|
|
118
|
-
if (stat.isDirectory() && !item.startsWith('.')) {
|
|
119
|
-
searchDir(itemPath);
|
|
120
|
-
}
|
|
121
|
-
else if (stat.isFile() && item.endsWith('.js') || item.endsWith('.ts') || item.endsWith('.md')) {
|
|
122
|
-
try {
|
|
123
|
-
const content = fs.readFileSync(itemPath, 'utf8');
|
|
124
|
-
if (content.includes(searchTerm)) {
|
|
125
|
-
const lines = content.split('\n');
|
|
126
|
-
const matches = lines
|
|
127
|
-
.map((line, index) => ({ line: line.trim(), number: index + 1 }))
|
|
128
|
-
.filter((l) => l.line.includes(searchTerm));
|
|
129
|
-
results.push({
|
|
130
|
-
file: path.relative(projectPath, itemPath),
|
|
131
|
-
matches: matches.slice(0, 5) // Limitar a 5 matches por arquivo
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
// Ignorar arquivos que não podem ser lidos
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
searchDir(projectPath);
|
|
142
|
-
return (0, auto_detection_js_1.createUniversalResponse)(true, action, `Busca concluída - ${results.length} arquivos encontrados`, detection, 'git-files', {
|
|
143
|
-
searchTerm,
|
|
144
|
-
results: results.slice(0, 20), // Limitar a 20 arquivos
|
|
145
|
-
totalFiles: results.length
|
|
146
|
-
});
|
|
147
|
-
case 'backup':
|
|
148
|
-
// Backup simples dos arquivos principais
|
|
149
|
-
const backupData = [];
|
|
150
|
-
const backupFiles = ['.gitignore', 'package.json', 'README.md', 'tsconfig.json'];
|
|
151
|
-
for (const file of backupFiles) {
|
|
152
|
-
const filePath = path.join(projectPath, file);
|
|
153
|
-
if (fs.existsSync(filePath)) {
|
|
154
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
155
|
-
backupData.push({
|
|
156
|
-
file,
|
|
157
|
-
content,
|
|
158
|
-
size: content.length,
|
|
159
|
-
timestamp: new Date().toISOString()
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return (0, auto_detection_js_1.createUniversalResponse)(true, action, 'Backup de arquivos criado', detection, 'git-files', {
|
|
164
|
-
backupCreated: true,
|
|
165
|
-
files: backupData,
|
|
166
|
-
totalFiles: backupData.length
|
|
209
|
+
const files = await listProvider.listFiles(targetOwner, targetRepo, listPath, branch);
|
|
210
|
+
return (0, auto_detection_js_1.createUniversalResponse)(true, action, `${files.length} arquivos encontrados em ${listPath || 'raiz'}`, detection, 'git-files', {
|
|
211
|
+
path: listPath,
|
|
212
|
+
files: files.map((file) => ({
|
|
213
|
+
name: file.name,
|
|
214
|
+
path: file.path,
|
|
215
|
+
type: file.type,
|
|
216
|
+
size: file.size,
|
|
217
|
+
sha: file.sha
|
|
218
|
+
})),
|
|
219
|
+
totalFiles: files.length,
|
|
220
|
+
provider
|
|
167
221
|
});
|
|
168
222
|
default:
|
|
169
|
-
throw new Error(`Ação '${action}' não suportada`);
|
|
223
|
+
throw new Error(`Ação '${action}' não suportada. Ações disponíveis: read, create, list`);
|
|
170
224
|
}
|
|
171
225
|
}
|
|
172
226
|
catch (error) {
|
|
173
227
|
const detection = (0, auto_detection_js_1.autoDetect)(input.projectPath || '');
|
|
174
228
|
const errorInstance = error instanceof Error ? error : new Error(String(error));
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
operationError = {
|
|
180
|
-
code: 'FILE_NOT_FOUND',
|
|
181
|
-
message: `File not found: ${input.filePath || 'unknown'}`,
|
|
182
|
-
cause: 'The specified file does not exist',
|
|
183
|
-
solution: 'Check the file path and ensure the file exists',
|
|
184
|
-
troubleshooting: [
|
|
185
|
-
'Verify the file path is correct',
|
|
186
|
-
'Check if the file was moved or deleted',
|
|
187
|
-
'Ensure you have read permissions for the file',
|
|
188
|
-
'Use relative paths from the project root'
|
|
189
|
-
]
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
else if (errorMessage.includes('eacces') || errorMessage.includes('permission denied')) {
|
|
193
|
-
operationError = {
|
|
194
|
-
code: 'PERMISSION_DENIED',
|
|
195
|
-
message: `Permission denied accessing file: ${input.filePath || 'unknown'}`,
|
|
196
|
-
cause: 'Insufficient permissions to access the file',
|
|
197
|
-
solution: 'Check file permissions and user access rights',
|
|
198
|
-
troubleshooting: [
|
|
199
|
-
'Verify you have read/write permissions for the file',
|
|
200
|
-
'Check if the file is locked by another process',
|
|
201
|
-
'Ensure the parent directory has proper permissions',
|
|
202
|
-
'Run with appropriate user privileges if needed'
|
|
203
|
-
]
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
else if (errorMessage.includes('enospc') || errorMessage.includes('no space left')) {
|
|
207
|
-
operationError = {
|
|
208
|
-
code: 'DISK_SPACE_ERROR',
|
|
209
|
-
message: 'Insufficient disk space for file operation',
|
|
210
|
-
cause: 'Not enough disk space to complete the operation',
|
|
211
|
-
solution: 'Free up disk space and try again',
|
|
212
|
-
troubleshooting: [
|
|
213
|
-
'Check available disk space',
|
|
214
|
-
'Remove unnecessary files',
|
|
215
|
-
'Move files to a different location with more space',
|
|
216
|
-
'Clean up temporary files'
|
|
217
|
-
]
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
else if (errorMessage.includes('eisdir') || errorMessage.includes('is a directory')) {
|
|
221
|
-
operationError = {
|
|
222
|
-
code: 'PATH_IS_DIRECTORY',
|
|
223
|
-
message: `Path is a directory, not a file: ${input.filePath || 'unknown'}`,
|
|
224
|
-
cause: 'Attempted file operation on a directory',
|
|
225
|
-
solution: 'Specify a file path, not a directory path',
|
|
226
|
-
troubleshooting: [
|
|
227
|
-
'Check if the path points to a directory instead of a file',
|
|
228
|
-
'Add a filename to the path',
|
|
229
|
-
'Use directory operations for directory paths',
|
|
230
|
-
'Verify the intended target is a file'
|
|
231
|
-
]
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
else if (errorMessage.includes('emfile') || errorMessage.includes('too many open files')) {
|
|
235
|
-
operationError = {
|
|
236
|
-
code: 'TOO_MANY_FILES',
|
|
237
|
-
message: 'Too many files open simultaneously',
|
|
238
|
-
cause: 'System limit for open files exceeded',
|
|
239
|
-
solution: 'Close unused files and try again',
|
|
240
|
-
troubleshooting: [
|
|
241
|
-
'Close unnecessary applications',
|
|
242
|
-
'Restart the application',
|
|
243
|
-
'Check system limits for open files',
|
|
244
|
-
'Process files in smaller batches'
|
|
245
|
-
]
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
operationError = {
|
|
250
|
-
code: 'FILE_OPERATION_ERROR',
|
|
251
|
-
message: errorInstance.message,
|
|
252
|
-
cause: 'File operation failed',
|
|
253
|
-
solution: 'Check file path, permissions, and system resources',
|
|
254
|
-
troubleshooting: [
|
|
255
|
-
'Verify the file path is correct',
|
|
256
|
-
'Check file and directory permissions',
|
|
257
|
-
'Ensure sufficient disk space',
|
|
258
|
-
'Try the operation again',
|
|
259
|
-
'Check system logs for additional details'
|
|
260
|
-
]
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
const formattedMessage = [
|
|
264
|
-
`❌ ${operationError.code}: ${operationError.message}`,
|
|
265
|
-
'',
|
|
266
|
-
`🔍 Cause: ${operationError.cause}`,
|
|
267
|
-
`💡 Solution: ${operationError.solution}`,
|
|
268
|
-
'',
|
|
269
|
-
'🛠️ Troubleshooting Steps:',
|
|
270
|
-
...operationError.troubleshooting.map(step => ` • ${step}`)
|
|
271
|
-
].join('\n');
|
|
272
|
-
return (0, auto_detection_js_1.createUniversalResponse)(false, input.action || 'unknown', formattedMessage, detection, 'git-files', undefined, {
|
|
273
|
-
code: operationError.code,
|
|
274
|
-
message: formattedMessage,
|
|
275
|
-
cause: operationError.cause,
|
|
276
|
-
suggestion: operationError.solution
|
|
229
|
+
return (0, auto_detection_js_1.createUniversalResponse)(false, input.action || 'unknown', `Erro na operação de arquivo: ${errorInstance.message}`, detection, 'git-files', undefined, {
|
|
230
|
+
code: 'FILE_OPERATION_ERROR',
|
|
231
|
+
message: errorInstance.message,
|
|
232
|
+
cause: 'File operation failed'
|
|
277
233
|
});
|
|
278
234
|
}
|
|
279
235
|
}
|