@andre.buzeli/git-mcp 16.0.4 → 16.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andre.buzeli/git-mcp",
3
- "version": "16.0.4",
3
+ "version": "16.0.6",
4
4
  "private": false,
5
5
  "description": "MCP server para Git com operações locais e sincronização paralela GitHub/Gitea",
6
6
  "license": "MIT",
@@ -292,8 +292,13 @@ EXEMPLOS DE USO:
292
292
  }
293
293
 
294
294
  const ensured = await pm.ensureRepos({ repoName: repo, createIfMissing: true, isPublic, organization });
295
- const urls = await pm.getRemoteUrls(repo, organization);
296
- await git.ensureRemotes(projectPath, { githubUrl: urls.github || "", giteaUrl: urls.gitea || "" });
295
+ // Build URLs from actual ensureRepos results (handles GitHub fallback to personal account)
296
+ const githubUrl = ensured.github?.ok && ensured.github.repo
297
+ ? `https://github.com/${ensured.github.repo}.git` : "";
298
+ const giteaBase = pm.giteaUrl?.replace(/\/$/, "");
299
+ const giteaUrl = ensured.gitea?.ok && ensured.gitea.repo && giteaBase
300
+ ? `${giteaBase}/${ensured.gitea.repo}.git` : "";
301
+ await git.ensureRemotes(projectPath, { githubUrl, giteaUrl, organization });
297
302
  const remotes = await git.listRemotes(projectPath);
298
303
  return asToolResult({ success: true, ensured, remotes, isPrivate: !isPublic, organization: organization || undefined }, { tool: 'workflow', action: 'ensure-remotes' });
299
304
  }
@@ -313,6 +318,19 @@ EXEMPLOS DE USO:
313
318
 
314
319
  const organization = args.organization || undefined;
315
320
 
321
+ // Ensure repos exist and set correct remote URLs (handles GitHub org fallback)
322
+ if (organization) {
323
+ const repo = getRepoNameFromPath(projectPath);
324
+ const isPublic = args.isPublic === true;
325
+ const ensured = await pm.ensureRepos({ repoName: repo, createIfMissing: true, isPublic, organization });
326
+ const githubUrl = ensured.github?.ok && ensured.github.repo
327
+ ? `https://github.com/${ensured.github.repo}.git` : "";
328
+ const giteaBase = pm.giteaUrl?.replace(/\/$/, "");
329
+ const giteaUrl = ensured.gitea?.ok && ensured.gitea.repo && giteaBase
330
+ ? `${giteaBase}/${ensured.gitea.repo}.git` : "";
331
+ await git.ensureRemotes(projectPath, { githubUrl, giteaUrl, organization });
332
+ }
333
+
316
334
  // Retry logic for push (often fails due to network or concurrent updates)
317
335
  const result = await withRetry(
318
336
  () => git.pushParallel(projectPath, branch, force, organization),
@@ -396,9 +414,15 @@ EXEMPLOS DE USO:
396
414
  const organization = args.organization || undefined;
397
415
  if (organization) {
398
416
  const repo = getRepoNameFromPath(projectPath);
399
- await pm.ensureRepos({ repoName: repo, createIfMissing: true, organization });
400
- const urls = await pm.getRemoteUrls(repo, organization);
401
- await git.ensureRemotes(projectPath, { githubUrl: urls.github || "", giteaUrl: urls.gitea || "" });
417
+ const isPublic = args.isPublic === true;
418
+ const ensured = await pm.ensureRepos({ repoName: repo, createIfMissing: true, isPublic, organization });
419
+ // Build URLs from actual ensureRepos results (handles GitHub fallback to personal account)
420
+ const githubUrl = ensured.github?.ok && ensured.github.repo
421
+ ? `https://github.com/${ensured.github.repo}.git` : "";
422
+ const giteaBase = pm.giteaUrl?.replace(/\/$/, "");
423
+ const giteaUrl = ensured.gitea?.ok && ensured.gitea.repo && giteaBase
424
+ ? `${giteaBase}/${ensured.gitea.repo}.git` : "";
425
+ await git.ensureRemotes(projectPath, { githubUrl, giteaUrl, organization });
402
426
  }
403
427
 
404
428
  // 4. Push