@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 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.0',
80
+ version: '6.3.1',
81
81
  });
82
82
  // Register tool list handler
83
83
  server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
@@ -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
- if (url.includes('github.com') && !finalGithubRepo) {
61
- const match = url.match(/github\.com[:/]([^/]+)\/([^/.]+)/);
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
- finalGithubRepo = `${match[1]}/${match[2]}`;
64
- result.fixed.push(`🔍 GitHub repo auto-detectado: ${finalGithubRepo}`);
71
+ detectedRepoName = match[1];
72
+ result.fixed.push(`🔍 Nome do repo auto-detectado: ${detectedRepoName}`);
65
73
  }
66
74
  }
67
- if ((url.includes('nas-ubuntu') || url.includes('gitea')) && !finalGiteaRepo) {
68
- const match = url.match(/\/([^/]+)\/([^/.]+)(?:\.git)?$/);
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
- finalGiteaRepo = `${match[1]}/${match[2]}`;
71
- result.fixed.push(`🔍 Gitea repo auto-detectado: ${finalGiteaRepo}`);
79
+ detectedRepoName = match[1];
80
+ result.fixed.push(`🔍 Nome do repo auto-detectado: ${detectedRepoName}`);
72
81
  }
73
82
  }
74
83
  }
75
84
  }
76
- // Obter username dos remotes existentes ou env vars
77
- const githubUsername = process.env.GITHUB_USERNAME || 'andrebuzeli';
78
- const giteaUsername = process.env.GITEA_USERNAME || 'andrebuzeli';
79
- // Se não detectou repos, usar o nome da pasta
80
- if (!finalGithubRepo) {
81
- const folderName = path_1.default.basename(absolutePath);
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
- if (!finalGiteaRepo) {
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
- finalGiteaRepo = `${giteaUsername}/${folderName}`;
88
- result.warnings.push(`⚠️ Gitea repo não detectado - usando: ${finalGiteaRepo}`);
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.0",
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",