@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 +1 -1
- package/src/tools/git-workflow.js +29 -5
package/package.json
CHANGED
|
@@ -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
|
-
|
|
296
|
-
|
|
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
|
-
|
|
400
|
-
const
|
|
401
|
-
|
|
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
|