@andrebuzeli/git-mcp 10.0.8 → 11.0.0
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/README.md +34 -428
- package/bin/git-mcp.js +21 -0
- package/docs/TOOLS.md +110 -0
- package/mcp.json.template +12 -0
- package/package.json +9 -76
- package/src/local/git.js +14 -0
- package/src/providers/gitea.js +13 -0
- package/src/providers/github.js +13 -0
- package/src/server.js +63 -0
- package/src/tools/git-actions.js +19 -0
- package/src/tools/git-activity.js +28 -0
- package/src/tools/git-admin.js +20 -0
- package/src/tools/git-checks.js +14 -0
- package/src/tools/git-commits.js +34 -0
- package/src/tools/git-contents.js +30 -0
- package/src/tools/git-deployments.js +21 -0
- package/src/tools/git-gists.js +15 -0
- package/src/tools/git-gitdata.js +19 -0
- package/src/tools/git-issues-prs.js +44 -0
- package/src/tools/git-issues.js +12 -0
- package/src/tools/git-local.js +66 -0
- package/src/tools/git-meta.js +19 -0
- package/src/tools/git-misc.js +21 -0
- package/src/tools/git-orgs.js +26 -0
- package/src/tools/git-packages.js +12 -0
- package/src/tools/git-raw.js +14 -0
- package/src/tools/git-releases.js +17 -0
- package/src/tools/git-remote.js +29 -0
- package/src/tools/git-repos.js +60 -0
- package/src/tools/git-search.js +18 -0
- package/src/tools/git-sync.js +40 -0
- package/src/tools/git-user.js +26 -0
- package/src/tools/schema.js +3 -0
- package/src/utils/fs.js +29 -0
- package/src/utils/project.js +7 -0
- package/tests/errors.js +26 -0
- package/tests/full_suite.js +98 -0
- package/tests/run.js +50 -0
- package/LICENSE +0 -21
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -224
- package/dist/prompts/gitPrompts.d.ts +0 -93
- package/dist/prompts/gitPrompts.js +0 -177
- package/dist/providers/giteaProvider.d.ts +0 -3
- package/dist/providers/giteaProvider.js +0 -6
- package/dist/providers/githubProvider.d.ts +0 -2
- package/dist/providers/githubProvider.js +0 -4
- package/dist/providers/providerManager.d.ts +0 -11
- package/dist/providers/providerManager.js +0 -49
- package/dist/resources/toolsGuide.d.ts +0 -12
- package/dist/resources/toolsGuide.js +0 -1713
- package/dist/scripts/test_e2e.d.ts +0 -1
- package/dist/scripts/test_e2e.js +0 -199
- package/dist/scripts/test_exhaustive.d.ts +0 -1
- package/dist/scripts/test_exhaustive.js +0 -275
- package/dist/scripts/verify_setup.d.ts +0 -1
- package/dist/scripts/verify_setup.js +0 -61
- package/dist/server.d.ts +0 -9
- package/dist/server.js +0 -73
- package/dist/tools/gitAnalytics.d.ts +0 -35
- package/dist/tools/gitAnalytics.js +0 -220
- package/dist/tools/gitArchive.d.ts +0 -119
- package/dist/tools/gitArchive.js +0 -150
- package/dist/tools/gitBackup.d.ts +0 -116
- package/dist/tools/gitBackup.js +0 -156
- package/dist/tools/gitBranches.d.ts +0 -54
- package/dist/tools/gitBranches.js +0 -282
- package/dist/tools/gitChangelog.d.ts +0 -37
- package/dist/tools/gitChangelog.js +0 -67
- package/dist/tools/gitConfig.d.ts +0 -97
- package/dist/tools/gitConfig.js +0 -125
- package/dist/tools/gitFiles.d.ts +0 -129
- package/dist/tools/gitFiles.js +0 -213
- package/dist/tools/gitFix.d.ts +0 -4
- package/dist/tools/gitFix.js +0 -159
- package/dist/tools/gitFix.tool.d.ts +0 -31
- package/dist/tools/gitFix.tool.js +0 -92
- package/dist/tools/gitHistory.d.ts +0 -41
- package/dist/tools/gitHistory.js +0 -349
- package/dist/tools/gitIgnore.d.ts +0 -214
- package/dist/tools/gitIgnore.js +0 -338
- package/dist/tools/gitIssues.d.ts +0 -80
- package/dist/tools/gitIssues.js +0 -363
- package/dist/tools/gitLog.d.ts +0 -30
- package/dist/tools/gitLog.js +0 -46
- package/dist/tools/gitMonitor.d.ts +0 -30
- package/dist/tools/gitMonitor.js +0 -284
- package/dist/tools/gitPackages.d.ts +0 -180
- package/dist/tools/gitPackages.js +0 -214
- package/dist/tools/gitPulls.d.ts +0 -66
- package/dist/tools/gitPulls.js +0 -347
- package/dist/tools/gitPush.d.ts +0 -40
- package/dist/tools/gitPush.js +0 -59
- package/dist/tools/gitRelease.d.ts +0 -49
- package/dist/tools/gitRelease.js +0 -359
- package/dist/tools/gitRemote.d.ts +0 -47
- package/dist/tools/gitRemote.js +0 -111
- package/dist/tools/gitReset.d.ts +0 -57
- package/dist/tools/gitReset.js +0 -79
- package/dist/tools/gitStash.d.ts +0 -61
- package/dist/tools/gitStash.js +0 -80
- package/dist/tools/gitSync.d.ts +0 -34
- package/dist/tools/gitSync.js +0 -182
- package/dist/tools/gitTags.d.ts +0 -45
- package/dist/tools/gitTags.js +0 -251
- package/dist/tools/gitUpdate.d.ts +0 -60
- package/dist/tools/gitUpdate.js +0 -474
- package/dist/tools/gitUpload.d.ts +0 -35
- package/dist/tools/gitUpload.js +0 -385
- package/dist/tools/gitWorkflow.d.ts +0 -117
- package/dist/tools/gitWorkflow.js +0 -472
- package/dist/types.d.ts +0 -20
- package/dist/types.js +0 -1
- package/dist/utils/agentHelpers.d.ts +0 -11
- package/dist/utils/agentHelpers.js +0 -41
- package/dist/utils/apiHelpers.d.ts +0 -29
- package/dist/utils/apiHelpers.js +0 -125
- package/dist/utils/cache.d.ts +0 -96
- package/dist/utils/cache.js +0 -208
- package/dist/utils/contextDetector.d.ts +0 -0
- package/dist/utils/contextDetector.js +0 -1
- package/dist/utils/errors.d.ts +0 -13
- package/dist/utils/errors.js +0 -17
- package/dist/utils/gitAdapter.d.ts +0 -224
- package/dist/utils/gitAdapter.js +0 -1152
- package/dist/utils/logger.d.ts +0 -45
- package/dist/utils/logger.js +0 -140
- package/dist/utils/rateLimiter.d.ts +0 -113
- package/dist/utils/rateLimiter.js +0 -257
- package/dist/utils/repoHelpers.d.ts +0 -44
- package/dist/utils/repoHelpers.js +0 -122
- package/dist/utils/safetyController.d.ts +0 -1
- package/dist/utils/safetyController.js +0 -12
- package/dist/utils/validation.d.ts +0 -115
- package/dist/utils/validation.js +0 -270
package/dist/tools/gitPulls.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Tool, MCPContext } from '../types.js';
|
|
2
|
-
export declare class GitPullsTool implements Tool {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
inputSchema: {
|
|
6
|
-
type: "object";
|
|
7
|
-
properties: {
|
|
8
|
-
projectPath: {
|
|
9
|
-
type: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
action: {
|
|
13
|
-
type: string;
|
|
14
|
-
enum: string[];
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
pullNumber: {
|
|
18
|
-
type: string;
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
title: {
|
|
22
|
-
type: string;
|
|
23
|
-
description: string;
|
|
24
|
-
};
|
|
25
|
-
head: {
|
|
26
|
-
type: string;
|
|
27
|
-
description: string;
|
|
28
|
-
};
|
|
29
|
-
base: {
|
|
30
|
-
type: string;
|
|
31
|
-
description: string;
|
|
32
|
-
};
|
|
33
|
-
body: {
|
|
34
|
-
type: string;
|
|
35
|
-
description: string;
|
|
36
|
-
};
|
|
37
|
-
state: {
|
|
38
|
-
type: string;
|
|
39
|
-
enum: string[];
|
|
40
|
-
description: string;
|
|
41
|
-
};
|
|
42
|
-
direction: {
|
|
43
|
-
type: string;
|
|
44
|
-
enum: string[];
|
|
45
|
-
description: string;
|
|
46
|
-
};
|
|
47
|
-
sort: {
|
|
48
|
-
type: string;
|
|
49
|
-
enum: string[];
|
|
50
|
-
description: string;
|
|
51
|
-
};
|
|
52
|
-
mergeMethod: {
|
|
53
|
-
type: string;
|
|
54
|
-
enum: string[];
|
|
55
|
-
description: string;
|
|
56
|
-
};
|
|
57
|
-
reviewEvent: {
|
|
58
|
-
type: string;
|
|
59
|
-
enum: string[];
|
|
60
|
-
description: string;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
required: string[];
|
|
64
|
-
};
|
|
65
|
-
handle(params: Record<string, any>, ctx: MCPContext): Promise<any>;
|
|
66
|
-
}
|
package/dist/tools/gitPulls.js
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import { MCPError } from '../utils/errors.js';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import { getRepoInfo, normalizeToolParams } from '../utils/repoHelpers.js';
|
|
4
|
-
export class GitPullsTool {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = 'git-pulls';
|
|
7
|
-
this.description = 'Pull request management for GitHub and Gitea - automatic dual-provider execution';
|
|
8
|
-
this.inputSchema = {
|
|
9
|
-
type: "object",
|
|
10
|
-
properties: {
|
|
11
|
-
projectPath: {
|
|
12
|
-
type: "string",
|
|
13
|
-
description: "The absolute path to the Git repository directory on the local filesystem. This should be the root directory containing the .git folder. For example: '/home/user/my-project' on Linux/Mac or 'C:\\Users\\user\\my-project' on Windows."
|
|
14
|
-
},
|
|
15
|
-
action: {
|
|
16
|
-
type: "string",
|
|
17
|
-
enum: ["create", "list", "get", "update", "merge", "close", "comment", "review"],
|
|
18
|
-
description: "The pull request operation to perform: 'create' (create PR), 'list' (list PRs), 'get' (get PR details), 'update' (update PR), 'merge' (merge PR), 'close' (close PR), 'comment' (add comment), 'review' (submit review)"
|
|
19
|
-
},
|
|
20
|
-
pullNumber: {
|
|
21
|
-
type: "number",
|
|
22
|
-
description: "Pull request number (required for get, update, merge, close, comment, review actions)"
|
|
23
|
-
},
|
|
24
|
-
title: {
|
|
25
|
-
type: "string",
|
|
26
|
-
description: "PR title (required for create action)"
|
|
27
|
-
},
|
|
28
|
-
head: {
|
|
29
|
-
type: "string",
|
|
30
|
-
description: "Head branch (required for create action)"
|
|
31
|
-
},
|
|
32
|
-
base: {
|
|
33
|
-
type: "string",
|
|
34
|
-
description: "Base branch (required for create action)"
|
|
35
|
-
},
|
|
36
|
-
body: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "PR description/body (optional for create/update/comment)"
|
|
39
|
-
},
|
|
40
|
-
state: {
|
|
41
|
-
type: "string",
|
|
42
|
-
enum: ["open", "closed", "all"],
|
|
43
|
-
description: "PR state filter (optional for list, default: open)"
|
|
44
|
-
},
|
|
45
|
-
direction: {
|
|
46
|
-
type: "string",
|
|
47
|
-
enum: ["asc", "desc"],
|
|
48
|
-
description: "Sort direction (optional for list)"
|
|
49
|
-
},
|
|
50
|
-
sort: {
|
|
51
|
-
type: "string",
|
|
52
|
-
enum: ["created", "updated", "popularity"],
|
|
53
|
-
description: "Sort field (optional for list)"
|
|
54
|
-
},
|
|
55
|
-
mergeMethod: {
|
|
56
|
-
type: "string",
|
|
57
|
-
enum: ["merge", "squash", "rebase"],
|
|
58
|
-
description: "Merge method (optional for merge, default: merge)"
|
|
59
|
-
},
|
|
60
|
-
reviewEvent: {
|
|
61
|
-
type: "string",
|
|
62
|
-
enum: ["APPROVE", "REQUEST_CHANGES", "COMMENT"],
|
|
63
|
-
description: "Review event type (required for review action)"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
required: ["projectPath", "action"]
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
async handle(params, ctx) {
|
|
70
|
-
params = normalizeToolParams(params);
|
|
71
|
-
const action = params.action;
|
|
72
|
-
const projectPath = params.projectPath;
|
|
73
|
-
if (!action)
|
|
74
|
-
throw new MCPError('VALIDATION_ERROR', 'action is required');
|
|
75
|
-
if (!projectPath)
|
|
76
|
-
throw new MCPError('VALIDATION_ERROR', 'projectPath is required');
|
|
77
|
-
const repoInfo = getRepoInfo(projectPath);
|
|
78
|
-
const repo = params.repo || repoInfo.repoName;
|
|
79
|
-
const githubOwner = params.owner || repoInfo.githubOwner || process.env.GITHUB_USERNAME;
|
|
80
|
-
const giteaOwner = params.owner || repoInfo.giteaOwner || process.env.GITEA_USERNAME;
|
|
81
|
-
switch (action) {
|
|
82
|
-
case 'create': {
|
|
83
|
-
if (!params.title || !params.head || !params.base) {
|
|
84
|
-
throw new MCPError('VALIDATION_ERROR', 'title, head, and base are required');
|
|
85
|
-
}
|
|
86
|
-
const results = { success: true, providers: {} };
|
|
87
|
-
// GitHub
|
|
88
|
-
if (ctx.providerManager.github) {
|
|
89
|
-
try {
|
|
90
|
-
const result = await ctx.providerManager.github.rest.pulls.create({
|
|
91
|
-
owner: githubOwner,
|
|
92
|
-
repo: repo,
|
|
93
|
-
title: params.title,
|
|
94
|
-
head: params.head,
|
|
95
|
-
base: params.base,
|
|
96
|
-
body: params.body,
|
|
97
|
-
});
|
|
98
|
-
results.providers.github = { success: true, pull: result.data };
|
|
99
|
-
}
|
|
100
|
-
catch (err) {
|
|
101
|
-
results.providers.github = { success: false, error: err.message };
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Gitea
|
|
105
|
-
if (ctx.providerManager.giteaBaseUrl) {
|
|
106
|
-
try {
|
|
107
|
-
const result = await axios.post(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls`, {
|
|
108
|
-
title: params.title,
|
|
109
|
-
head: params.head,
|
|
110
|
-
base: params.base,
|
|
111
|
-
body: params.body,
|
|
112
|
-
}, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
|
|
113
|
-
results.providers.gitea = { success: true, pull: result.data };
|
|
114
|
-
}
|
|
115
|
-
catch (err) {
|
|
116
|
-
results.providers.gitea = { success: false, error: err.message };
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return results;
|
|
120
|
-
}
|
|
121
|
-
case 'list': {
|
|
122
|
-
const results = { success: true, providers: {} };
|
|
123
|
-
// GitHub
|
|
124
|
-
if (ctx.providerManager.github) {
|
|
125
|
-
try {
|
|
126
|
-
const result = await ctx.providerManager.github.rest.pulls.list({
|
|
127
|
-
owner: githubOwner,
|
|
128
|
-
repo: repo,
|
|
129
|
-
state: params.state_filter || 'open',
|
|
130
|
-
sort: params.sort || 'created',
|
|
131
|
-
direction: params.direction || 'desc',
|
|
132
|
-
});
|
|
133
|
-
results.providers.github = { success: true, pulls: result.data };
|
|
134
|
-
}
|
|
135
|
-
catch (err) {
|
|
136
|
-
results.providers.github = { success: false, error: err.message };
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
// Gitea
|
|
140
|
-
if (ctx.providerManager.giteaBaseUrl) {
|
|
141
|
-
try {
|
|
142
|
-
const result = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls`, {
|
|
143
|
-
params: { state: params.state_filter || 'open' },
|
|
144
|
-
headers: { Authorization: `token ${ctx.providerManager.giteaToken}` }
|
|
145
|
-
});
|
|
146
|
-
results.providers.gitea = { success: true, pulls: result.data };
|
|
147
|
-
}
|
|
148
|
-
catch (err) {
|
|
149
|
-
results.providers.gitea = { success: false, error: err.message };
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return results;
|
|
153
|
-
}
|
|
154
|
-
case 'get': {
|
|
155
|
-
const pull_number = params.pull_number || params.pullNumber;
|
|
156
|
-
if (!pull_number)
|
|
157
|
-
throw new MCPError('VALIDATION_ERROR', 'pull_number is required');
|
|
158
|
-
const results = { success: true, providers: {} };
|
|
159
|
-
// GitHub
|
|
160
|
-
if (ctx.providerManager.github) {
|
|
161
|
-
try {
|
|
162
|
-
const result = await ctx.providerManager.github.rest.pulls.get({
|
|
163
|
-
owner: githubOwner,
|
|
164
|
-
repo: repo,
|
|
165
|
-
pull_number,
|
|
166
|
-
});
|
|
167
|
-
results.providers.github = { success: true, pull: result.data };
|
|
168
|
-
}
|
|
169
|
-
catch (err) {
|
|
170
|
-
results.providers.github = { success: false, error: err.message };
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
// Gitea
|
|
174
|
-
if (ctx.providerManager.giteaBaseUrl) {
|
|
175
|
-
try {
|
|
176
|
-
const result = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
|
|
177
|
-
results.providers.gitea = { success: true, pull: result.data };
|
|
178
|
-
}
|
|
179
|
-
catch (err) {
|
|
180
|
-
results.providers.gitea = { success: false, error: err.message };
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return results;
|
|
184
|
-
}
|
|
185
|
-
case 'update': {
|
|
186
|
-
const pull_number = params.pull_number || params.pullNumber;
|
|
187
|
-
if (!pull_number)
|
|
188
|
-
throw new MCPError('VALIDATION_ERROR', 'pull_number is required');
|
|
189
|
-
const results = { success: true, providers: {} };
|
|
190
|
-
// GitHub
|
|
191
|
-
if (ctx.providerManager.github) {
|
|
192
|
-
try {
|
|
193
|
-
const result = await ctx.providerManager.github.rest.pulls.update({
|
|
194
|
-
owner: githubOwner,
|
|
195
|
-
repo: repo,
|
|
196
|
-
pull_number,
|
|
197
|
-
title: params.title,
|
|
198
|
-
body: params.body,
|
|
199
|
-
state: params.state,
|
|
200
|
-
});
|
|
201
|
-
results.providers.github = { success: true, pull: result.data };
|
|
202
|
-
}
|
|
203
|
-
catch (err) {
|
|
204
|
-
results.providers.github = { success: false, error: err.message };
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
// Gitea
|
|
208
|
-
if (ctx.providerManager.giteaBaseUrl) {
|
|
209
|
-
try {
|
|
210
|
-
const result = await axios.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}`, { title: params.title, body: params.body }, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
|
|
211
|
-
results.providers.gitea = { success: true, pull: result.data };
|
|
212
|
-
}
|
|
213
|
-
catch (err) {
|
|
214
|
-
results.providers.gitea = { success: false, error: err.message };
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return results;
|
|
218
|
-
}
|
|
219
|
-
case 'merge': {
|
|
220
|
-
const pull_number = params.pull_number || params.pullNumber;
|
|
221
|
-
if (!pull_number)
|
|
222
|
-
throw new MCPError('VALIDATION_ERROR', 'pull_number is required');
|
|
223
|
-
const results = { success: true, providers: {} };
|
|
224
|
-
// GitHub
|
|
225
|
-
if (ctx.providerManager.github) {
|
|
226
|
-
try {
|
|
227
|
-
const result = await ctx.providerManager.github.rest.pulls.merge({
|
|
228
|
-
owner: githubOwner,
|
|
229
|
-
repo: repo,
|
|
230
|
-
pull_number,
|
|
231
|
-
commit_title: params.commit_title,
|
|
232
|
-
commit_message: params.commit_message,
|
|
233
|
-
merge_method: params.merge_method || 'merge',
|
|
234
|
-
});
|
|
235
|
-
results.providers.github = { success: true, merged: result.data };
|
|
236
|
-
}
|
|
237
|
-
catch (err) {
|
|
238
|
-
results.providers.github = { success: false, error: err.message };
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
// Gitea
|
|
242
|
-
if (ctx.providerManager.giteaBaseUrl) {
|
|
243
|
-
try {
|
|
244
|
-
const result = await axios.post(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}/merge`, {
|
|
245
|
-
Do: params.merge_method || 'merge',
|
|
246
|
-
MergeTitleField: params.commit_title,
|
|
247
|
-
MergeMessageField: params.commit_message,
|
|
248
|
-
}, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
|
|
249
|
-
results.providers.gitea = { success: true, merged: result.data };
|
|
250
|
-
}
|
|
251
|
-
catch (err) {
|
|
252
|
-
results.providers.gitea = { success: false, error: err.message };
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return results;
|
|
256
|
-
}
|
|
257
|
-
case 'close': {
|
|
258
|
-
const pull_number = params.pull_number || params.pullNumber;
|
|
259
|
-
if (!pull_number)
|
|
260
|
-
throw new MCPError('VALIDATION_ERROR', 'pull_number is required');
|
|
261
|
-
const results = { success: true, providers: {} };
|
|
262
|
-
// GitHub
|
|
263
|
-
if (ctx.providerManager.github) {
|
|
264
|
-
try {
|
|
265
|
-
const result = await ctx.providerManager.github.rest.pulls.update({
|
|
266
|
-
owner: githubOwner,
|
|
267
|
-
repo: repo,
|
|
268
|
-
pull_number,
|
|
269
|
-
state: 'closed',
|
|
270
|
-
});
|
|
271
|
-
results.providers.github = { success: true, pull: result.data };
|
|
272
|
-
}
|
|
273
|
-
catch (err) {
|
|
274
|
-
results.providers.github = { success: false, error: err.message };
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
// Gitea
|
|
278
|
-
if (ctx.providerManager.giteaBaseUrl) {
|
|
279
|
-
try {
|
|
280
|
-
const result = await axios.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}`, { state: 'closed' }, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
|
|
281
|
-
results.providers.gitea = { success: true, pull: result.data };
|
|
282
|
-
}
|
|
283
|
-
catch (err) {
|
|
284
|
-
results.providers.gitea = { success: false, error: err.message };
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return results;
|
|
288
|
-
}
|
|
289
|
-
case 'review': {
|
|
290
|
-
const pull_number = params.pull_number || params.pullNumber;
|
|
291
|
-
const event = params.event;
|
|
292
|
-
if (!pull_number || !event) {
|
|
293
|
-
throw new MCPError('VALIDATION_ERROR', 'pull_number and event are required');
|
|
294
|
-
}
|
|
295
|
-
const results = { success: true, providers: {} };
|
|
296
|
-
// GitHub
|
|
297
|
-
if (ctx.providerManager.github) {
|
|
298
|
-
try {
|
|
299
|
-
const result = await ctx.providerManager.github.rest.pulls.createReview({
|
|
300
|
-
owner: githubOwner,
|
|
301
|
-
repo: repo,
|
|
302
|
-
pull_number,
|
|
303
|
-
event,
|
|
304
|
-
body: params.review_body,
|
|
305
|
-
});
|
|
306
|
-
results.providers.github = { success: true, review: result.data };
|
|
307
|
-
}
|
|
308
|
-
catch (err) {
|
|
309
|
-
results.providers.github = { success: false, error: err.message };
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
// Gitea
|
|
313
|
-
if (ctx.providerManager.giteaBaseUrl) {
|
|
314
|
-
results.providers.gitea = { success: false, error: 'Review not fully implemented for Gitea' };
|
|
315
|
-
}
|
|
316
|
-
return results;
|
|
317
|
-
}
|
|
318
|
-
case 'search': {
|
|
319
|
-
const query = params.query;
|
|
320
|
-
if (!query)
|
|
321
|
-
throw new MCPError('VALIDATION_ERROR', 'query is required');
|
|
322
|
-
const results = { success: true, providers: {} };
|
|
323
|
-
// GitHub
|
|
324
|
-
if (ctx.providerManager.github) {
|
|
325
|
-
try {
|
|
326
|
-
const result = await ctx.providerManager.github.rest.search.issuesAndPullRequests({
|
|
327
|
-
q: `${query} repo:${giteaOwner}/${repo} type:pr`,
|
|
328
|
-
sort: params.search_sort || 'created',
|
|
329
|
-
order: params.search_order || 'desc',
|
|
330
|
-
});
|
|
331
|
-
results.providers.github = { success: true, pulls: result.data.items };
|
|
332
|
-
}
|
|
333
|
-
catch (err) {
|
|
334
|
-
results.providers.github = { success: false, error: err.message };
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
// Gitea
|
|
338
|
-
if (ctx.providerManager.giteaBaseUrl) {
|
|
339
|
-
results.providers.gitea = { success: false, error: 'Search not fully implemented for Gitea' };
|
|
340
|
-
}
|
|
341
|
-
return results;
|
|
342
|
-
}
|
|
343
|
-
default:
|
|
344
|
-
throw new MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
package/dist/tools/gitPush.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Tool, MCPContext } from '../types.js';
|
|
2
|
-
export declare class GitPushTool implements Tool {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
inputSchema: {
|
|
6
|
-
type: "object";
|
|
7
|
-
properties: {
|
|
8
|
-
projectPath: {
|
|
9
|
-
type: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
remote: {
|
|
13
|
-
type: string;
|
|
14
|
-
description: string;
|
|
15
|
-
};
|
|
16
|
-
branch: {
|
|
17
|
-
type: string;
|
|
18
|
-
description: string;
|
|
19
|
-
};
|
|
20
|
-
force: {
|
|
21
|
-
type: string;
|
|
22
|
-
description: string;
|
|
23
|
-
};
|
|
24
|
-
setUpstream: {
|
|
25
|
-
type: string;
|
|
26
|
-
description: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
required: string[];
|
|
30
|
-
additionalProperties: boolean;
|
|
31
|
-
};
|
|
32
|
-
handle(params: Record<string, any>, ctx: MCPContext): Promise<{
|
|
33
|
-
success: boolean;
|
|
34
|
-
remote: any;
|
|
35
|
-
branch: any;
|
|
36
|
-
force: any;
|
|
37
|
-
setUpstream: any;
|
|
38
|
-
message: string;
|
|
39
|
-
}>;
|
|
40
|
-
}
|
package/dist/tools/gitPush.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { MCPError } from '../utils/errors.js';
|
|
2
|
-
export class GitPushTool {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.name = 'git-push';
|
|
5
|
-
this.description = 'Push local commits to remote repository - local Git operation';
|
|
6
|
-
this.inputSchema = {
|
|
7
|
-
type: "object",
|
|
8
|
-
properties: {
|
|
9
|
-
projectPath: {
|
|
10
|
-
type: "string",
|
|
11
|
-
description: "Absolute path to the project/repository (REQUIRED)"
|
|
12
|
-
},
|
|
13
|
-
remote: {
|
|
14
|
-
type: "string",
|
|
15
|
-
description: "Remote name (optional, default: origin)"
|
|
16
|
-
},
|
|
17
|
-
branch: {
|
|
18
|
-
type: "string",
|
|
19
|
-
description: "Branch name (optional, default: current branch)"
|
|
20
|
-
},
|
|
21
|
-
force: {
|
|
22
|
-
type: "boolean",
|
|
23
|
-
description: "Force push (optional, default: false)"
|
|
24
|
-
},
|
|
25
|
-
setUpstream: {
|
|
26
|
-
type: "boolean",
|
|
27
|
-
description: "Set upstream tracking (optional, default: true)"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
required: ["projectPath"],
|
|
31
|
-
additionalProperties: true
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
async handle(params, ctx) {
|
|
35
|
-
const projectPath = params.projectPath;
|
|
36
|
-
if (!projectPath) {
|
|
37
|
-
throw new MCPError('VALIDATION_ERROR', 'projectPath is required');
|
|
38
|
-
}
|
|
39
|
-
const git = ctx.gitAdapter;
|
|
40
|
-
const remote = params.remote || 'origin';
|
|
41
|
-
const branch = params.branch || await git.getCurrentBranch(projectPath);
|
|
42
|
-
const force = params.force || false;
|
|
43
|
-
const setUpstream = params.setUpstream !== undefined ? params.setUpstream : true; // Default to true
|
|
44
|
-
try {
|
|
45
|
-
await git.push(projectPath, remote, branch, force, setUpstream);
|
|
46
|
-
return {
|
|
47
|
-
success: true,
|
|
48
|
-
remote,
|
|
49
|
-
branch,
|
|
50
|
-
force,
|
|
51
|
-
setUpstream,
|
|
52
|
-
message: `Successfully pushed ${branch} to ${remote}`,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
throw new MCPError('PUSH_ERROR', `Failed to push: ${err.message}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Tool, MCPContext } from '../types.js';
|
|
2
|
-
export declare class GitReleaseTool implements Tool {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
inputSchema: {
|
|
6
|
-
type: "object";
|
|
7
|
-
properties: {
|
|
8
|
-
projectPath: {
|
|
9
|
-
type: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
action: {
|
|
13
|
-
type: string;
|
|
14
|
-
enum: string[];
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
tagName: {
|
|
18
|
-
type: string;
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
releaseId: {
|
|
22
|
-
type: string;
|
|
23
|
-
description: string;
|
|
24
|
-
};
|
|
25
|
-
name: {
|
|
26
|
-
type: string;
|
|
27
|
-
description: string;
|
|
28
|
-
};
|
|
29
|
-
body: {
|
|
30
|
-
type: string;
|
|
31
|
-
description: string;
|
|
32
|
-
};
|
|
33
|
-
draft: {
|
|
34
|
-
type: string;
|
|
35
|
-
description: string;
|
|
36
|
-
};
|
|
37
|
-
prerelease: {
|
|
38
|
-
type: string;
|
|
39
|
-
description: string;
|
|
40
|
-
};
|
|
41
|
-
confirm: {
|
|
42
|
-
type: string;
|
|
43
|
-
description: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
required: string[];
|
|
47
|
-
};
|
|
48
|
-
handle(params: Record<string, any>, ctx: MCPContext): Promise<any>;
|
|
49
|
-
}
|