@andrebuzeli/git-mcp 7.2.5 → 7.3.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.
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GitIssuesTool = void 0;
4
- const errors_1 = require("../utils/errors");
5
- const repoHelpers_1 = require("../utils/repoHelpers");
6
- class GitIssuesTool {
1
+ import { MCPError } from '../utils/errors';
2
+ import { getRepoInfo } from '../utils/repoHelpers';
3
+ export class GitIssuesTool {
7
4
  constructor() {
8
5
  this.name = 'git-issues';
9
6
  this.description = 'Issue management for GitHub and Gitea - automatic dual-provider execution';
@@ -11,11 +8,11 @@ class GitIssuesTool {
11
8
  async handle(params, ctx) {
12
9
  const action = params.action;
13
10
  if (!action)
14
- throw new errors_1.MCPError('VALIDATION_ERROR', 'action is required');
11
+ throw new MCPError('VALIDATION_ERROR', 'action is required');
15
12
  // Auto-extract repo info if projectPath is provided
16
13
  let repo = params.repo;
17
14
  if (!repo && params.projectPath) {
18
- const repoInfo = (0, repoHelpers_1.getRepoInfo)(params.projectPath);
15
+ const repoInfo = getRepoInfo(params.projectPath);
19
16
  repo = repoInfo.repoName;
20
17
  }
21
18
  // Each provider uses its own username from env
@@ -24,9 +21,9 @@ class GitIssuesTool {
24
21
  switch (action) {
25
22
  case 'create': {
26
23
  if (!params.title)
27
- throw new errors_1.MCPError('VALIDATION_ERROR', 'title is required');
24
+ throw new MCPError('VALIDATION_ERROR', 'title is required');
28
25
  if (!repo)
29
- throw new errors_1.MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
26
+ throw new MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
30
27
  const results = { success: true, providers: {} };
31
28
  // GitHub
32
29
  if (ctx.providerManager.github && githubOwner) {
@@ -68,7 +65,7 @@ class GitIssuesTool {
68
65
  }
69
66
  case 'list': {
70
67
  if (!repo)
71
- throw new errors_1.MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
68
+ throw new MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
72
69
  const results = { success: true, providers: {} };
73
70
  // GitHub
74
71
  if (ctx.providerManager.github && githubOwner) {
@@ -110,9 +107,9 @@ class GitIssuesTool {
110
107
  case 'get': {
111
108
  const issue_number = params.issue_number;
112
109
  if (!issue_number)
113
- throw new errors_1.MCPError('VALIDATION_ERROR', 'issue_number is required');
110
+ throw new MCPError('VALIDATION_ERROR', 'issue_number is required');
114
111
  if (!repo)
115
- throw new errors_1.MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
112
+ throw new MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
116
113
  const results = { success: true, providers: {} };
117
114
  // GitHub
118
115
  if (ctx.providerManager.github && githubOwner) {
@@ -146,9 +143,9 @@ class GitIssuesTool {
146
143
  case 'update': {
147
144
  const issue_number = params.issue_number;
148
145
  if (!issue_number)
149
- throw new errors_1.MCPError('VALIDATION_ERROR', 'issue_number is required');
146
+ throw new MCPError('VALIDATION_ERROR', 'issue_number is required');
150
147
  if (!repo)
151
- throw new errors_1.MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
148
+ throw new MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
152
149
  const results = { success: true, providers: {} };
153
150
  // GitHub
154
151
  if (ctx.providerManager.github && githubOwner) {
@@ -189,9 +186,9 @@ class GitIssuesTool {
189
186
  case 'close': {
190
187
  const issue_number = params.issue_number;
191
188
  if (!issue_number)
192
- throw new errors_1.MCPError('VALIDATION_ERROR', 'issue_number is required');
189
+ throw new MCPError('VALIDATION_ERROR', 'issue_number is required');
193
190
  if (!repo)
194
- throw new errors_1.MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
191
+ throw new MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
195
192
  const results = { success: true, providers: {} };
196
193
  // GitHub
197
194
  if (ctx.providerManager.github && githubOwner) {
@@ -227,11 +224,11 @@ class GitIssuesTool {
227
224
  const issue_number = params.issue_number;
228
225
  const comment_body = params.comment_body;
229
226
  if (!issue_number)
230
- throw new errors_1.MCPError('VALIDATION_ERROR', 'issue_number is required');
227
+ throw new MCPError('VALIDATION_ERROR', 'issue_number is required');
231
228
  if (!comment_body)
232
- throw new errors_1.MCPError('VALIDATION_ERROR', 'comment_body is required');
229
+ throw new MCPError('VALIDATION_ERROR', 'comment_body is required');
233
230
  if (!repo)
234
- throw new errors_1.MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
231
+ throw new MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
235
232
  const results = { success: true, providers: {} };
236
233
  // GitHub
237
234
  if (ctx.providerManager.github && githubOwner) {
@@ -266,9 +263,9 @@ class GitIssuesTool {
266
263
  case 'search': {
267
264
  const query = params.query;
268
265
  if (!query)
269
- throw new errors_1.MCPError('VALIDATION_ERROR', 'query is required');
266
+ throw new MCPError('VALIDATION_ERROR', 'query is required');
270
267
  if (!repo)
271
- throw new errors_1.MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
268
+ throw new MCPError('VALIDATION_ERROR', 'repo is required (or provide projectPath)');
272
269
  const results = { success: true, providers: {} };
273
270
  // GitHub
274
271
  if (ctx.providerManager.github && githubOwner) {
@@ -291,8 +288,7 @@ class GitIssuesTool {
291
288
  return results;
292
289
  }
293
290
  default:
294
- throw new errors_1.MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
291
+ throw new MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
295
292
  }
296
293
  }
297
294
  }
298
- exports.GitIssuesTool = GitIssuesTool;
@@ -1,14 +1,8 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GitMonitorTool = void 0;
7
- const simple_git_1 = __importDefault(require("simple-git"));
8
- const errors_1 = require("../utils/errors");
9
- const repoHelpers_1 = require("../utils/repoHelpers");
10
- const axios_1 = __importDefault(require("axios"));
11
- class GitMonitorTool {
1
+ import simpleGit from 'simple-git';
2
+ import { MCPError } from '../utils/errors';
3
+ import { getRepoInfo } from '../utils/repoHelpers';
4
+ import axios from 'axios';
5
+ export class GitMonitorTool {
12
6
  constructor() {
13
7
  this.name = 'git-monitor';
14
8
  this.description = 'Repository monitoring and status operations - automatic dual-provider execution for remote queries';
@@ -17,9 +11,9 @@ class GitMonitorTool {
17
11
  const action = params.action;
18
12
  const projectPath = params.projectPath;
19
13
  if (!action || !projectPath) {
20
- throw new errors_1.MCPError('VALIDATION_ERROR', 'action and projectPath are required');
14
+ throw new MCPError('VALIDATION_ERROR', 'action and projectPath are required');
21
15
  }
22
- const git = (0, simple_git_1.default)({ baseDir: projectPath });
16
+ const git = simpleGit({ baseDir: projectPath });
23
17
  switch (action) {
24
18
  case 'log': {
25
19
  const options = {
@@ -41,7 +35,7 @@ class GitMonitorTool {
41
35
  providers: {}
42
36
  };
43
37
  // Also query remote APIs
44
- const repoInfo = (0, repoHelpers_1.getRepoInfo)(projectPath);
38
+ const repoInfo = getRepoInfo(projectPath);
45
39
  const githubOwner = process.env.GITHUB_USERNAME;
46
40
  const giteaOwner = process.env.GITEA_USERNAME;
47
41
  // GitHub
@@ -73,7 +67,7 @@ class GitMonitorTool {
73
67
  // Gitea
74
68
  if (ctx.providerManager.giteaBaseUrl && giteaOwner) {
75
69
  try {
76
- const commits = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repoInfo.repoName}/commits`, {
70
+ const commits = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repoInfo.repoName}/commits`, {
77
71
  params: {
78
72
  since: params.since,
79
73
  until: params.until,
@@ -141,7 +135,7 @@ class GitMonitorTool {
141
135
  providers: {}
142
136
  };
143
137
  // Also query remote APIs
144
- const repoInfo = (0, repoHelpers_1.getRepoInfo)(projectPath);
138
+ const repoInfo = getRepoInfo(projectPath);
145
139
  const githubOwner = process.env.GITHUB_USERNAME;
146
140
  const giteaOwner = process.env.GITEA_USERNAME;
147
141
  // GitHub
@@ -172,7 +166,7 @@ class GitMonitorTool {
172
166
  // Gitea
173
167
  if (ctx.providerManager.giteaBaseUrl && giteaOwner) {
174
168
  try {
175
- const commits = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repoInfo.repoName}/commits`, {
169
+ const commits = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repoInfo.repoName}/commits`, {
176
170
  params: {
177
171
  sha: branch,
178
172
  since: params.since,
@@ -220,7 +214,7 @@ class GitMonitorTool {
220
214
  providers: {}
221
215
  };
222
216
  // Also query remote APIs
223
- const repoInfo = (0, repoHelpers_1.getRepoInfo)(projectPath);
217
+ const repoInfo = getRepoInfo(projectPath);
224
218
  const githubOwner = process.env.GITHUB_USERNAME;
225
219
  const giteaOwner = process.env.GITEA_USERNAME;
226
220
  // GitHub
@@ -247,7 +241,7 @@ class GitMonitorTool {
247
241
  // Gitea
248
242
  if (ctx.providerManager.giteaBaseUrl && giteaOwner) {
249
243
  try {
250
- const contributors = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repoInfo.repoName}/contributors`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
244
+ const contributors = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repoInfo.repoName}/contributors`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
251
245
  results.providers.gitea = {
252
246
  success: true,
253
247
  contributors: contributors.data.map((c) => ({
@@ -265,8 +259,7 @@ class GitMonitorTool {
265
259
  return results;
266
260
  }
267
261
  default:
268
- throw new errors_1.MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
262
+ throw new MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
269
263
  }
270
264
  }
271
265
  }
272
- exports.GitMonitorTool = GitMonitorTool;
@@ -1,13 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GitPackagesTool = void 0;
7
- const promises_1 = __importDefault(require("fs/promises"));
8
- const path_1 = __importDefault(require("path"));
9
- const errors_1 = require("../utils/errors");
10
- class GitPackagesTool {
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ import { MCPError } from '../utils/errors';
4
+ export class GitPackagesTool {
11
5
  constructor() {
12
6
  this.name = 'git-packages';
13
7
  this.description = 'Package management operations';
@@ -16,15 +10,15 @@ class GitPackagesTool {
16
10
  const action = params.action;
17
11
  const projectPath = params.projectPath;
18
12
  if (!action)
19
- throw new errors_1.MCPError('VALIDATION_ERROR', 'action is required');
13
+ throw new MCPError('VALIDATION_ERROR', 'action is required');
20
14
  switch (action) {
21
15
  case 'list': {
22
16
  if (!projectPath)
23
- throw new errors_1.MCPError('VALIDATION_ERROR', 'projectPath is required');
17
+ throw new MCPError('VALIDATION_ERROR', 'projectPath is required');
24
18
  // Ler package.json
25
19
  try {
26
- const packageJsonPath = path_1.default.join(projectPath, 'package.json');
27
- const content = await promises_1.default.readFile(packageJsonPath, 'utf-8');
20
+ const packageJsonPath = path.join(projectPath, 'package.json');
21
+ const content = await fs.readFile(packageJsonPath, 'utf-8');
28
22
  const pkg = JSON.parse(content);
29
23
  return {
30
24
  success: true,
@@ -36,13 +30,13 @@ class GitPackagesTool {
36
30
  };
37
31
  }
38
32
  catch (error) {
39
- throw new errors_1.MCPError('FILE_ERROR', `Failed to read package.json: ${error.message}`);
33
+ throw new MCPError('FILE_ERROR', `Failed to read package.json: ${error.message}`);
40
34
  }
41
35
  }
42
36
  case 'get': {
43
37
  const packageName = params.packageName;
44
38
  if (!packageName)
45
- throw new errors_1.MCPError('VALIDATION_ERROR', 'packageName is required');
39
+ throw new MCPError('VALIDATION_ERROR', 'packageName is required');
46
40
  return {
47
41
  success: true,
48
42
  message: `Package info for ${packageName}`,
@@ -54,10 +48,9 @@ class GitPackagesTool {
54
48
  case 'delete':
55
49
  case 'publish':
56
50
  case 'download':
57
- throw new errors_1.MCPError('NOT_IMPLEMENTED', `Action ${action} not yet fully implemented`);
51
+ throw new MCPError('NOT_IMPLEMENTED', `Action ${action} not yet fully implemented`);
58
52
  default:
59
- throw new errors_1.MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
53
+ throw new MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
60
54
  }
61
55
  }
62
56
  }
63
- exports.GitPackagesTool = GitPackagesTool;
@@ -1,12 +1,6 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GitPullsTool = void 0;
7
- const errors_1 = require("../utils/errors");
8
- const axios_1 = __importDefault(require("axios"));
9
- class GitPullsTool {
1
+ import { MCPError } from '../utils/errors';
2
+ import axios from 'axios';
3
+ export class GitPullsTool {
10
4
  constructor() {
11
5
  this.name = 'git-pulls';
12
6
  this.description = 'Pull request management for GitHub and Gitea - automatic dual-provider execution';
@@ -14,14 +8,14 @@ class GitPullsTool {
14
8
  async handle(params, ctx) {
15
9
  const action = params.action;
16
10
  if (!action)
17
- throw new errors_1.MCPError('VALIDATION_ERROR', 'action is required');
11
+ throw new MCPError('VALIDATION_ERROR', 'action is required');
18
12
  const githubOwner = params.owner || process.env.GITHUB_USERNAME;
19
13
  const giteaOwner = params.owner || process.env.GITEA_USERNAME;
20
14
  const repo = params.repo;
21
15
  switch (action) {
22
16
  case 'create': {
23
17
  if (!params.title || !params.head || !params.base) {
24
- throw new errors_1.MCPError('VALIDATION_ERROR', 'title, head, and base are required');
18
+ throw new MCPError('VALIDATION_ERROR', 'title, head, and base are required');
25
19
  }
26
20
  const results = { success: true, providers: {} };
27
21
  // GitHub
@@ -44,7 +38,7 @@ class GitPullsTool {
44
38
  // Gitea
45
39
  if (ctx.providerManager.giteaBaseUrl) {
46
40
  try {
47
- const result = await axios_1.default.post(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls`, {
41
+ const result = await axios.post(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls`, {
48
42
  title: params.title,
49
43
  head: params.head,
50
44
  base: params.base,
@@ -79,7 +73,7 @@ class GitPullsTool {
79
73
  // Gitea
80
74
  if (ctx.providerManager.giteaBaseUrl) {
81
75
  try {
82
- const result = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls`, {
76
+ const result = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls`, {
83
77
  params: { state: params.state_filter || 'open' },
84
78
  headers: { Authorization: `token ${ctx.providerManager.giteaToken}` }
85
79
  });
@@ -94,7 +88,7 @@ class GitPullsTool {
94
88
  case 'get': {
95
89
  const pull_number = params.pull_number;
96
90
  if (!pull_number)
97
- throw new errors_1.MCPError('VALIDATION_ERROR', 'pull_number is required');
91
+ throw new MCPError('VALIDATION_ERROR', 'pull_number is required');
98
92
  const results = { success: true, providers: {} };
99
93
  // GitHub
100
94
  if (ctx.providerManager.github) {
@@ -113,7 +107,7 @@ class GitPullsTool {
113
107
  // Gitea
114
108
  if (ctx.providerManager.giteaBaseUrl) {
115
109
  try {
116
- const result = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
110
+ const result = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
117
111
  results.providers.gitea = { success: true, pull: result.data };
118
112
  }
119
113
  catch (err) {
@@ -125,7 +119,7 @@ class GitPullsTool {
125
119
  case 'update': {
126
120
  const pull_number = params.pull_number;
127
121
  if (!pull_number)
128
- throw new errors_1.MCPError('VALIDATION_ERROR', 'pull_number is required');
122
+ throw new MCPError('VALIDATION_ERROR', 'pull_number is required');
129
123
  const results = { success: true, providers: {} };
130
124
  // GitHub
131
125
  if (ctx.providerManager.github) {
@@ -147,7 +141,7 @@ class GitPullsTool {
147
141
  // Gitea
148
142
  if (ctx.providerManager.giteaBaseUrl) {
149
143
  try {
150
- const result = await axios_1.default.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}`, { title: params.title, body: params.body }, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
144
+ 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}` } });
151
145
  results.providers.gitea = { success: true, pull: result.data };
152
146
  }
153
147
  catch (err) {
@@ -159,7 +153,7 @@ class GitPullsTool {
159
153
  case 'merge': {
160
154
  const pull_number = params.pull_number;
161
155
  if (!pull_number)
162
- throw new errors_1.MCPError('VALIDATION_ERROR', 'pull_number is required');
156
+ throw new MCPError('VALIDATION_ERROR', 'pull_number is required');
163
157
  const results = { success: true, providers: {} };
164
158
  // GitHub
165
159
  if (ctx.providerManager.github) {
@@ -181,7 +175,7 @@ class GitPullsTool {
181
175
  // Gitea
182
176
  if (ctx.providerManager.giteaBaseUrl) {
183
177
  try {
184
- const result = await axios_1.default.post(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}/merge`, {
178
+ const result = await axios.post(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}/merge`, {
185
179
  Do: params.merge_method || 'merge',
186
180
  MergeTitleField: params.commit_title,
187
181
  MergeMessageField: params.commit_message,
@@ -197,7 +191,7 @@ class GitPullsTool {
197
191
  case 'close': {
198
192
  const pull_number = params.pull_number;
199
193
  if (!pull_number)
200
- throw new errors_1.MCPError('VALIDATION_ERROR', 'pull_number is required');
194
+ throw new MCPError('VALIDATION_ERROR', 'pull_number is required');
201
195
  const results = { success: true, providers: {} };
202
196
  // GitHub
203
197
  if (ctx.providerManager.github) {
@@ -217,7 +211,7 @@ class GitPullsTool {
217
211
  // Gitea
218
212
  if (ctx.providerManager.giteaBaseUrl) {
219
213
  try {
220
- const result = await axios_1.default.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}`, { state: 'closed' }, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
214
+ const result = await axios.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/pulls/${pull_number}`, { state: 'closed' }, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
221
215
  results.providers.gitea = { success: true, pull: result.data };
222
216
  }
223
217
  catch (err) {
@@ -230,7 +224,7 @@ class GitPullsTool {
230
224
  const pull_number = params.pull_number;
231
225
  const event = params.event;
232
226
  if (!pull_number || !event) {
233
- throw new errors_1.MCPError('VALIDATION_ERROR', 'pull_number and event are required');
227
+ throw new MCPError('VALIDATION_ERROR', 'pull_number and event are required');
234
228
  }
235
229
  const results = { success: true, providers: {} };
236
230
  // GitHub
@@ -258,7 +252,7 @@ class GitPullsTool {
258
252
  case 'search': {
259
253
  const query = params.query;
260
254
  if (!query)
261
- throw new errors_1.MCPError('VALIDATION_ERROR', 'query is required');
255
+ throw new MCPError('VALIDATION_ERROR', 'query is required');
262
256
  const results = { success: true, providers: {} };
263
257
  // GitHub
264
258
  if (ctx.providerManager.github) {
@@ -281,8 +275,7 @@ class GitPullsTool {
281
275
  return results;
282
276
  }
283
277
  default:
284
- throw new errors_1.MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
278
+ throw new MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
285
279
  }
286
280
  }
287
281
  }
288
- exports.GitPullsTool = GitPullsTool;
@@ -1,13 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GitReleaseTool = void 0;
7
- const simple_git_1 = __importDefault(require("simple-git"));
8
- const errors_1 = require("../utils/errors");
9
- const axios_1 = __importDefault(require("axios"));
10
- class GitReleaseTool {
1
+ import simpleGit from 'simple-git';
2
+ import { MCPError } from '../utils/errors';
3
+ import axios from 'axios';
4
+ export class GitReleaseTool {
11
5
  constructor() {
12
6
  this.name = 'git-release';
13
7
  this.description = 'Release management operations - automatic dual-provider execution';
@@ -16,9 +10,9 @@ class GitReleaseTool {
16
10
  const action = params.action;
17
11
  const projectPath = params.projectPath;
18
12
  if (!action)
19
- throw new errors_1.MCPError('VALIDATION_ERROR', 'action is required');
13
+ throw new MCPError('VALIDATION_ERROR', 'action is required');
20
14
  if (!projectPath)
21
- throw new errors_1.MCPError('VALIDATION_ERROR', 'projectPath is required');
15
+ throw new MCPError('VALIDATION_ERROR', 'projectPath is required');
22
16
  const githubOwner = params.owner || process.env.GITHUB_USERNAME;
23
17
  const giteaOwner = params.owner || process.env.GITEA_USERNAME;
24
18
  const repo = params.repo;
@@ -26,8 +20,8 @@ class GitReleaseTool {
26
20
  case 'create': {
27
21
  const tagName = params.tagName;
28
22
  if (!tagName)
29
- throw new errors_1.MCPError('VALIDATION_ERROR', 'tagName is required');
30
- const git = (0, simple_git_1.default)({ baseDir: projectPath });
23
+ throw new MCPError('VALIDATION_ERROR', 'tagName is required');
24
+ const git = simpleGit({ baseDir: projectPath });
31
25
  await git.addAnnotatedTag(tagName, params.description || tagName);
32
26
  const results = { success: true, localTag: tagName, providers: {} };
33
27
  if (ctx.providerManager.github) {
@@ -49,7 +43,7 @@ class GitReleaseTool {
49
43
  }
50
44
  if (ctx.providerManager.giteaBaseUrl) {
51
45
  try {
52
- const result = await axios_1.default.post(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, {
46
+ const result = await axios.post(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, {
53
47
  tag_name: tagName,
54
48
  name: params.releaseName || tagName,
55
49
  body: params.body,
@@ -80,7 +74,7 @@ class GitReleaseTool {
80
74
  }
81
75
  if (ctx.providerManager.giteaBaseUrl) {
82
76
  try {
83
- const result = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
77
+ const result = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
84
78
  results.providers.gitea = { success: true, releases: result.data };
85
79
  }
86
80
  catch (err) {
@@ -92,7 +86,7 @@ class GitReleaseTool {
92
86
  case 'get': {
93
87
  const tagName = params.tagName;
94
88
  if (!tagName)
95
- throw new errors_1.MCPError('VALIDATION_ERROR', 'tagName is required');
89
+ throw new MCPError('VALIDATION_ERROR', 'tagName is required');
96
90
  const results = { success: true, providers: {} };
97
91
  if (ctx.providerManager.github) {
98
92
  try {
@@ -109,7 +103,7 @@ class GitReleaseTool {
109
103
  }
110
104
  if (ctx.providerManager.giteaBaseUrl) {
111
105
  try {
112
- const result = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/tags/${tagName}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
106
+ const result = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/tags/${tagName}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
113
107
  results.providers.gitea = { success: true, release: result.data };
114
108
  }
115
109
  catch (err) {
@@ -121,7 +115,7 @@ class GitReleaseTool {
121
115
  case 'update': {
122
116
  const tagName = params.tagName;
123
117
  if (!tagName)
124
- throw new errors_1.MCPError('VALIDATION_ERROR', 'tagName is required');
118
+ throw new MCPError('VALIDATION_ERROR', 'tagName is required');
125
119
  const results = { success: true, providers: {} };
126
120
  // GitHub
127
121
  if (ctx.providerManager.github) {
@@ -154,13 +148,13 @@ class GitReleaseTool {
154
148
  // Gitea
155
149
  if (ctx.providerManager.giteaBaseUrl) {
156
150
  try {
157
- const releases = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
151
+ const releases = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
158
152
  const release = releases.data.find((r) => r.tag_name === tagName);
159
153
  if (!release) {
160
154
  results.providers.gitea = { success: false, error: 'Release not found' };
161
155
  }
162
156
  else {
163
- const result = await axios_1.default.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/${release.id}`, {
157
+ const result = await axios.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/${release.id}`, {
164
158
  name: params.releaseName,
165
159
  body: params.body,
166
160
  draft: params.draft,
@@ -178,7 +172,7 @@ class GitReleaseTool {
178
172
  case 'delete': {
179
173
  const tagName = params.tagName;
180
174
  if (!tagName)
181
- throw new errors_1.MCPError('VALIDATION_ERROR', 'tagName is required');
175
+ throw new MCPError('VALIDATION_ERROR', 'tagName is required');
182
176
  const results = { success: true, providers: {} };
183
177
  // GitHub
184
178
  if (ctx.providerManager.github) {
@@ -207,13 +201,13 @@ class GitReleaseTool {
207
201
  // Gitea
208
202
  if (ctx.providerManager.giteaBaseUrl) {
209
203
  try {
210
- const releases = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
204
+ const releases = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
211
205
  const release = releases.data.find((r) => r.tag_name === tagName);
212
206
  if (!release) {
213
207
  results.providers.gitea = { success: false, error: 'Release not found' };
214
208
  }
215
209
  else {
216
- await axios_1.default.delete(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/${release.id}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
210
+ await axios.delete(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/${release.id}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
217
211
  results.providers.gitea = { success: true, deleted: true };
218
212
  }
219
213
  }
@@ -226,7 +220,7 @@ class GitReleaseTool {
226
220
  case 'publish': {
227
221
  const tagName = params.tagName;
228
222
  if (!tagName)
229
- throw new errors_1.MCPError('VALIDATION_ERROR', 'tagName is required');
223
+ throw new MCPError('VALIDATION_ERROR', 'tagName is required');
230
224
  const results = { success: true, providers: {} };
231
225
  // GitHub - publish = set draft: false
232
226
  if (ctx.providerManager.github) {
@@ -256,13 +250,13 @@ class GitReleaseTool {
256
250
  // Gitea - publish = set draft: false
257
251
  if (ctx.providerManager.giteaBaseUrl) {
258
252
  try {
259
- const releases = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
253
+ const releases = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
260
254
  const release = releases.data.find((r) => r.tag_name === tagName);
261
255
  if (!release) {
262
256
  results.providers.gitea = { success: false, error: 'Release not found' };
263
257
  }
264
258
  else {
265
- const result = await axios_1.default.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/${release.id}`, { draft: false }, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
259
+ const result = await axios.patch(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/${release.id}`, { draft: false }, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
266
260
  results.providers.gitea = { success: true, release: result.data };
267
261
  }
268
262
  }
@@ -275,7 +269,7 @@ class GitReleaseTool {
275
269
  case 'download': {
276
270
  const tagName = params.tagName;
277
271
  if (!tagName)
278
- throw new errors_1.MCPError('VALIDATION_ERROR', 'tagName is required');
272
+ throw new MCPError('VALIDATION_ERROR', 'tagName is required');
279
273
  const results = { success: true, providers: {} };
280
274
  // GitHub
281
275
  if (ctx.providerManager.github) {
@@ -299,7 +293,7 @@ class GitReleaseTool {
299
293
  // Gitea
300
294
  if (ctx.providerManager.giteaBaseUrl) {
301
295
  try {
302
- const result = await axios_1.default.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/tags/${tagName}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
296
+ const result = await axios.get(`${ctx.providerManager.giteaBaseUrl}/api/v1/repos/${giteaOwner}/${repo}/releases/tags/${tagName}`, { headers: { Authorization: `token ${ctx.providerManager.giteaToken}` } });
303
297
  const assets = result.data.assets?.map((a) => ({
304
298
  name: a.name,
305
299
  url: a.browser_download_url,
@@ -314,8 +308,7 @@ class GitReleaseTool {
314
308
  return results;
315
309
  }
316
310
  default:
317
- throw new errors_1.MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
311
+ throw new MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
318
312
  }
319
313
  }
320
314
  }
321
- exports.GitReleaseTool = GitReleaseTool;