@andrebuzeli/git-mcp 6.3.0 → 6.3.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/index.js +1 -1
- package/dist/tools/gitFix.js +34 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77,7 +77,7 @@ async function main() {
|
|
|
77
77
|
// Create MCP Server with STDIO transport
|
|
78
78
|
const server = new index_js_1.Server({
|
|
79
79
|
name: '@andrebuzeli/git-mcp',
|
|
80
|
-
version: '6.3.
|
|
80
|
+
version: '6.3.1',
|
|
81
81
|
});
|
|
82
82
|
// Register tool list handler
|
|
83
83
|
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
package/dist/tools/gitFix.js
CHANGED
|
@@ -51,41 +51,56 @@ async function handleGitFix(args) {
|
|
|
51
51
|
// Capturar remotes antes
|
|
52
52
|
const remotesBefore = await git.getRemotes(true);
|
|
53
53
|
result.remotes.before = remotesBefore.map(r => ({ name: r.name, url: r.refs.fetch || '' }));
|
|
54
|
+
// Obter usernames das env vars (OBRIGATÓRIO usar as credenciais fornecidas)
|
|
55
|
+
const githubUsername = process.env.GITHUB_USERNAME;
|
|
56
|
+
const giteaUsername = process.env.GITEA_USERNAME;
|
|
57
|
+
if (!githubUsername || !giteaUsername) {
|
|
58
|
+
throw new Error('GITHUB_USERNAME e GITEA_USERNAME são obrigatórios nas env vars');
|
|
59
|
+
}
|
|
54
60
|
// Auto-detectar repos se solicitado
|
|
55
61
|
let finalGithubRepo = githubRepo;
|
|
56
62
|
let finalGiteaRepo = giteaRepo;
|
|
63
|
+
let detectedRepoName = null;
|
|
57
64
|
if (autoDetect && remotesBefore.length > 0) {
|
|
58
65
|
for (const remote of remotesBefore) {
|
|
59
66
|
const url = remote.refs.fetch || '';
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
// Detectar APENAS o nome do repo (sem username)
|
|
68
|
+
if (url.includes('github.com') && !detectedRepoName) {
|
|
69
|
+
const match = url.match(/github\.com[:/][^/]+\/([^/.]+)/);
|
|
62
70
|
if (match) {
|
|
63
|
-
|
|
64
|
-
result.fixed.push(`🔍
|
|
71
|
+
detectedRepoName = match[1];
|
|
72
|
+
result.fixed.push(`🔍 Nome do repo auto-detectado: ${detectedRepoName}`);
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
// Detectar de Gitea
|
|
76
|
+
if ((url.includes('nas-ubuntu') || url.includes('gitea')) && !detectedRepoName) {
|
|
77
|
+
const match = url.match(/\/[^/]+\/([^/.]+)(?:\.git)?$/);
|
|
69
78
|
if (match) {
|
|
70
|
-
|
|
71
|
-
result.fixed.push(`🔍
|
|
79
|
+
detectedRepoName = match[1];
|
|
80
|
+
result.fixed.push(`🔍 Nome do repo auto-detectado: ${detectedRepoName}`);
|
|
72
81
|
}
|
|
73
82
|
}
|
|
74
83
|
}
|
|
75
84
|
}
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
finalGithubRepo = `${githubUsername}/${folderName}`;
|
|
83
|
-
result.warnings.push(`⚠️ GitHub repo não detectado - usando: ${finalGithubRepo}`);
|
|
85
|
+
// Construir repos usando os usernames CORRETOS das env vars
|
|
86
|
+
if (detectedRepoName) {
|
|
87
|
+
finalGithubRepo = finalGithubRepo || `${githubUsername}/${detectedRepoName}`;
|
|
88
|
+
finalGiteaRepo = finalGiteaRepo || `${giteaUsername}/${detectedRepoName}`;
|
|
89
|
+
result.fixed.push(`✅ GitHub repo: ${finalGithubRepo}`);
|
|
90
|
+
result.fixed.push(`✅ Gitea repo: ${finalGiteaRepo}`);
|
|
84
91
|
}
|
|
85
|
-
|
|
92
|
+
// Se não detectou repos, usar o nome da pasta
|
|
93
|
+
if (!finalGithubRepo || !finalGiteaRepo) {
|
|
86
94
|
const folderName = path_1.default.basename(absolutePath);
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
if (!finalGithubRepo) {
|
|
96
|
+
finalGithubRepo = `${githubUsername}/${folderName}`;
|
|
97
|
+
}
|
|
98
|
+
if (!finalGiteaRepo) {
|
|
99
|
+
finalGiteaRepo = `${giteaUsername}/${folderName}`;
|
|
100
|
+
}
|
|
101
|
+
result.warnings.push(`⚠️ Repo não detectado - usando nome da pasta: ${folderName}`);
|
|
102
|
+
result.fixed.push(`✅ GitHub repo: ${finalGithubRepo}`);
|
|
103
|
+
result.fixed.push(`✅ Gitea repo: ${finalGiteaRepo}`);
|
|
89
104
|
}
|
|
90
105
|
// Remover remotes antigos
|
|
91
106
|
const remotesToRemove = ['origin', 'github', 'gitea'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrebuzeli/git-mcp",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"description": "Professional MCP server for Git operations - STDIO UNIVERSAL: works in ANY IDE (Cursor, VSCode, Claude Desktop). Fully autonomous with intelligent error handling. Auto-detects branches, owner, repo. User-friendly error messages. Dual-provider execution (GitHub + Gitea)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|