@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.
Files changed (135) hide show
  1. package/README.md +34 -428
  2. package/bin/git-mcp.js +21 -0
  3. package/docs/TOOLS.md +110 -0
  4. package/mcp.json.template +12 -0
  5. package/package.json +9 -76
  6. package/src/local/git.js +14 -0
  7. package/src/providers/gitea.js +13 -0
  8. package/src/providers/github.js +13 -0
  9. package/src/server.js +63 -0
  10. package/src/tools/git-actions.js +19 -0
  11. package/src/tools/git-activity.js +28 -0
  12. package/src/tools/git-admin.js +20 -0
  13. package/src/tools/git-checks.js +14 -0
  14. package/src/tools/git-commits.js +34 -0
  15. package/src/tools/git-contents.js +30 -0
  16. package/src/tools/git-deployments.js +21 -0
  17. package/src/tools/git-gists.js +15 -0
  18. package/src/tools/git-gitdata.js +19 -0
  19. package/src/tools/git-issues-prs.js +44 -0
  20. package/src/tools/git-issues.js +12 -0
  21. package/src/tools/git-local.js +66 -0
  22. package/src/tools/git-meta.js +19 -0
  23. package/src/tools/git-misc.js +21 -0
  24. package/src/tools/git-orgs.js +26 -0
  25. package/src/tools/git-packages.js +12 -0
  26. package/src/tools/git-raw.js +14 -0
  27. package/src/tools/git-releases.js +17 -0
  28. package/src/tools/git-remote.js +29 -0
  29. package/src/tools/git-repos.js +60 -0
  30. package/src/tools/git-search.js +18 -0
  31. package/src/tools/git-sync.js +40 -0
  32. package/src/tools/git-user.js +26 -0
  33. package/src/tools/schema.js +3 -0
  34. package/src/utils/fs.js +29 -0
  35. package/src/utils/project.js +7 -0
  36. package/tests/errors.js +26 -0
  37. package/tests/full_suite.js +98 -0
  38. package/tests/run.js +50 -0
  39. package/LICENSE +0 -21
  40. package/dist/index.d.ts +0 -2
  41. package/dist/index.js +0 -224
  42. package/dist/prompts/gitPrompts.d.ts +0 -93
  43. package/dist/prompts/gitPrompts.js +0 -177
  44. package/dist/providers/giteaProvider.d.ts +0 -3
  45. package/dist/providers/giteaProvider.js +0 -6
  46. package/dist/providers/githubProvider.d.ts +0 -2
  47. package/dist/providers/githubProvider.js +0 -4
  48. package/dist/providers/providerManager.d.ts +0 -11
  49. package/dist/providers/providerManager.js +0 -49
  50. package/dist/resources/toolsGuide.d.ts +0 -12
  51. package/dist/resources/toolsGuide.js +0 -1713
  52. package/dist/scripts/test_e2e.d.ts +0 -1
  53. package/dist/scripts/test_e2e.js +0 -199
  54. package/dist/scripts/test_exhaustive.d.ts +0 -1
  55. package/dist/scripts/test_exhaustive.js +0 -275
  56. package/dist/scripts/verify_setup.d.ts +0 -1
  57. package/dist/scripts/verify_setup.js +0 -61
  58. package/dist/server.d.ts +0 -9
  59. package/dist/server.js +0 -73
  60. package/dist/tools/gitAnalytics.d.ts +0 -35
  61. package/dist/tools/gitAnalytics.js +0 -220
  62. package/dist/tools/gitArchive.d.ts +0 -119
  63. package/dist/tools/gitArchive.js +0 -150
  64. package/dist/tools/gitBackup.d.ts +0 -116
  65. package/dist/tools/gitBackup.js +0 -156
  66. package/dist/tools/gitBranches.d.ts +0 -54
  67. package/dist/tools/gitBranches.js +0 -282
  68. package/dist/tools/gitChangelog.d.ts +0 -37
  69. package/dist/tools/gitChangelog.js +0 -67
  70. package/dist/tools/gitConfig.d.ts +0 -97
  71. package/dist/tools/gitConfig.js +0 -125
  72. package/dist/tools/gitFiles.d.ts +0 -129
  73. package/dist/tools/gitFiles.js +0 -213
  74. package/dist/tools/gitFix.d.ts +0 -4
  75. package/dist/tools/gitFix.js +0 -159
  76. package/dist/tools/gitFix.tool.d.ts +0 -31
  77. package/dist/tools/gitFix.tool.js +0 -92
  78. package/dist/tools/gitHistory.d.ts +0 -41
  79. package/dist/tools/gitHistory.js +0 -349
  80. package/dist/tools/gitIgnore.d.ts +0 -214
  81. package/dist/tools/gitIgnore.js +0 -338
  82. package/dist/tools/gitIssues.d.ts +0 -80
  83. package/dist/tools/gitIssues.js +0 -363
  84. package/dist/tools/gitLog.d.ts +0 -30
  85. package/dist/tools/gitLog.js +0 -46
  86. package/dist/tools/gitMonitor.d.ts +0 -30
  87. package/dist/tools/gitMonitor.js +0 -284
  88. package/dist/tools/gitPackages.d.ts +0 -180
  89. package/dist/tools/gitPackages.js +0 -214
  90. package/dist/tools/gitPulls.d.ts +0 -66
  91. package/dist/tools/gitPulls.js +0 -347
  92. package/dist/tools/gitPush.d.ts +0 -40
  93. package/dist/tools/gitPush.js +0 -59
  94. package/dist/tools/gitRelease.d.ts +0 -49
  95. package/dist/tools/gitRelease.js +0 -359
  96. package/dist/tools/gitRemote.d.ts +0 -47
  97. package/dist/tools/gitRemote.js +0 -111
  98. package/dist/tools/gitReset.d.ts +0 -57
  99. package/dist/tools/gitReset.js +0 -79
  100. package/dist/tools/gitStash.d.ts +0 -61
  101. package/dist/tools/gitStash.js +0 -80
  102. package/dist/tools/gitSync.d.ts +0 -34
  103. package/dist/tools/gitSync.js +0 -182
  104. package/dist/tools/gitTags.d.ts +0 -45
  105. package/dist/tools/gitTags.js +0 -251
  106. package/dist/tools/gitUpdate.d.ts +0 -60
  107. package/dist/tools/gitUpdate.js +0 -474
  108. package/dist/tools/gitUpload.d.ts +0 -35
  109. package/dist/tools/gitUpload.js +0 -385
  110. package/dist/tools/gitWorkflow.d.ts +0 -117
  111. package/dist/tools/gitWorkflow.js +0 -472
  112. package/dist/types.d.ts +0 -20
  113. package/dist/types.js +0 -1
  114. package/dist/utils/agentHelpers.d.ts +0 -11
  115. package/dist/utils/agentHelpers.js +0 -41
  116. package/dist/utils/apiHelpers.d.ts +0 -29
  117. package/dist/utils/apiHelpers.js +0 -125
  118. package/dist/utils/cache.d.ts +0 -96
  119. package/dist/utils/cache.js +0 -208
  120. package/dist/utils/contextDetector.d.ts +0 -0
  121. package/dist/utils/contextDetector.js +0 -1
  122. package/dist/utils/errors.d.ts +0 -13
  123. package/dist/utils/errors.js +0 -17
  124. package/dist/utils/gitAdapter.d.ts +0 -224
  125. package/dist/utils/gitAdapter.js +0 -1152
  126. package/dist/utils/logger.d.ts +0 -45
  127. package/dist/utils/logger.js +0 -140
  128. package/dist/utils/rateLimiter.d.ts +0 -113
  129. package/dist/utils/rateLimiter.js +0 -257
  130. package/dist/utils/repoHelpers.d.ts +0 -44
  131. package/dist/utils/repoHelpers.js +0 -122
  132. package/dist/utils/safetyController.d.ts +0 -1
  133. package/dist/utils/safetyController.js +0 -12
  134. package/dist/utils/validation.d.ts +0 -115
  135. package/dist/utils/validation.js +0 -270
@@ -1,214 +0,0 @@
1
- import { Tool, MCPContext } from '../types.js';
2
- /**
3
- * Git Ignore Tool - Manage .gitignore file
4
- * Create, read, add, remove patterns, and ensure .gitignore exists
5
- */
6
- export declare class GitIgnoreTool implements Tool {
7
- name: string;
8
- description: string;
9
- inputSchema: {
10
- type: "object";
11
- properties: {
12
- projectPath: {
13
- type: string;
14
- description: string;
15
- };
16
- action: {
17
- type: string;
18
- enum: string[];
19
- description: string;
20
- };
21
- patterns: {
22
- type: string;
23
- items: {
24
- type: string;
25
- };
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
- path: string;
35
- exists: boolean;
36
- content: string;
37
- patterns: string[];
38
- lines: number;
39
- message?: undefined;
40
- created?: undefined;
41
- template?: undefined;
42
- action?: undefined;
43
- added?: undefined;
44
- skipped?: undefined;
45
- total?: undefined;
46
- removed?: undefined;
47
- remaining?: undefined;
48
- updated?: undefined;
49
- cleared?: undefined;
50
- } | {
51
- success: boolean;
52
- path: string;
53
- exists: boolean;
54
- message: string;
55
- content?: undefined;
56
- patterns?: undefined;
57
- lines?: undefined;
58
- created?: undefined;
59
- template?: undefined;
60
- action?: undefined;
61
- added?: undefined;
62
- skipped?: undefined;
63
- total?: undefined;
64
- removed?: undefined;
65
- remaining?: undefined;
66
- updated?: undefined;
67
- cleared?: undefined;
68
- } | {
69
- success: boolean;
70
- message: string;
71
- path: string;
72
- exists?: undefined;
73
- content?: undefined;
74
- patterns?: undefined;
75
- lines?: undefined;
76
- created?: undefined;
77
- template?: undefined;
78
- action?: undefined;
79
- added?: undefined;
80
- skipped?: undefined;
81
- total?: undefined;
82
- removed?: undefined;
83
- remaining?: undefined;
84
- updated?: undefined;
85
- cleared?: undefined;
86
- } | {
87
- success: boolean;
88
- path: string;
89
- created: boolean;
90
- template: any;
91
- lines: number;
92
- exists?: undefined;
93
- content?: undefined;
94
- patterns?: undefined;
95
- message?: undefined;
96
- action?: undefined;
97
- added?: undefined;
98
- skipped?: undefined;
99
- total?: undefined;
100
- removed?: undefined;
101
- remaining?: undefined;
102
- updated?: undefined;
103
- cleared?: undefined;
104
- } | {
105
- success: boolean;
106
- path: string;
107
- exists: boolean;
108
- action: string;
109
- message: string;
110
- content?: undefined;
111
- patterns?: undefined;
112
- lines?: undefined;
113
- created?: undefined;
114
- template?: undefined;
115
- added?: undefined;
116
- skipped?: undefined;
117
- total?: undefined;
118
- removed?: undefined;
119
- remaining?: undefined;
120
- updated?: undefined;
121
- cleared?: undefined;
122
- } | {
123
- success: boolean;
124
- path: string;
125
- created: boolean;
126
- template: any;
127
- action: string;
128
- exists?: undefined;
129
- content?: undefined;
130
- patterns?: undefined;
131
- lines?: undefined;
132
- message?: undefined;
133
- added?: undefined;
134
- skipped?: undefined;
135
- total?: undefined;
136
- removed?: undefined;
137
- remaining?: undefined;
138
- updated?: undefined;
139
- cleared?: undefined;
140
- } | {
141
- success: boolean;
142
- path: string;
143
- added: string[];
144
- skipped: number;
145
- total: number;
146
- exists?: undefined;
147
- content?: undefined;
148
- patterns?: undefined;
149
- lines?: undefined;
150
- message?: undefined;
151
- created?: undefined;
152
- template?: undefined;
153
- action?: undefined;
154
- removed?: undefined;
155
- remaining?: undefined;
156
- updated?: undefined;
157
- cleared?: undefined;
158
- } | {
159
- success: boolean;
160
- path: string;
161
- removed: number;
162
- remaining: number;
163
- exists?: undefined;
164
- content?: undefined;
165
- patterns?: undefined;
166
- lines?: undefined;
167
- message?: undefined;
168
- created?: undefined;
169
- template?: undefined;
170
- action?: undefined;
171
- added?: undefined;
172
- skipped?: undefined;
173
- total?: undefined;
174
- updated?: undefined;
175
- cleared?: undefined;
176
- } | {
177
- success: boolean;
178
- path: string;
179
- updated: boolean;
180
- lines: any;
181
- exists?: undefined;
182
- content?: undefined;
183
- patterns?: undefined;
184
- message?: undefined;
185
- created?: undefined;
186
- template?: undefined;
187
- action?: undefined;
188
- added?: undefined;
189
- skipped?: undefined;
190
- total?: undefined;
191
- removed?: undefined;
192
- remaining?: undefined;
193
- cleared?: undefined;
194
- } | {
195
- success: boolean;
196
- path: string;
197
- cleared: boolean;
198
- template: any;
199
- exists?: undefined;
200
- content?: undefined;
201
- patterns?: undefined;
202
- lines?: undefined;
203
- message?: undefined;
204
- created?: undefined;
205
- action?: undefined;
206
- added?: undefined;
207
- skipped?: undefined;
208
- total?: undefined;
209
- removed?: undefined;
210
- remaining?: undefined;
211
- updated?: undefined;
212
- }>;
213
- private getTemplate;
214
- }
@@ -1,338 +0,0 @@
1
- import * as fs from 'fs/promises';
2
- import * as path from 'path';
3
- import { MCPError } from '../utils/errors.js';
4
- /**
5
- * Git Ignore Tool - Manage .gitignore file
6
- * Create, read, add, remove patterns, and ensure .gitignore exists
7
- */
8
- export class GitIgnoreTool {
9
- constructor() {
10
- this.name = 'git-ignore';
11
- this.description = 'Manage .gitignore file - create, add, remove, and update ignore patterns';
12
- this.inputSchema = {
13
- type: "object",
14
- properties: {
15
- projectPath: {
16
- type: "string",
17
- 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."
18
- },
19
- action: {
20
- type: "string",
21
- enum: ["create", "add", "remove", "read"],
22
- description: "Action: create, add, remove, read"
23
- },
24
- patterns: {
25
- type: "array",
26
- items: { type: "string" },
27
- description: "Patterns to add/remove"
28
- }
29
- },
30
- required: ["projectPath", "action"],
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 action = params.action || 'read';
40
- const gitignorePath = path.join(projectPath, '.gitignore');
41
- switch (action) {
42
- case 'read': {
43
- try {
44
- const content = await fs.readFile(gitignorePath, 'utf-8');
45
- const patterns = content.split('\n').filter(l => l.trim() && !l.startsWith('#'));
46
- return {
47
- success: true,
48
- path: gitignorePath,
49
- exists: true,
50
- content,
51
- patterns,
52
- lines: content.split('\n').length,
53
- };
54
- }
55
- catch (err) {
56
- if (err.code === 'ENOENT') {
57
- return {
58
- success: true,
59
- path: gitignorePath,
60
- exists: false,
61
- message: '.gitignore does not exist',
62
- };
63
- }
64
- throw err;
65
- }
66
- }
67
- case 'create': {
68
- const template = params.template || 'default';
69
- const content = this.getTemplate(template);
70
- try {
71
- await fs.access(gitignorePath);
72
- return {
73
- success: false,
74
- message: '.gitignore already exists. Use "add" to add patterns.',
75
- path: gitignorePath,
76
- };
77
- }
78
- catch {
79
- await fs.writeFile(gitignorePath, content, 'utf-8');
80
- return {
81
- success: true,
82
- path: gitignorePath,
83
- created: true,
84
- template,
85
- lines: content.split('\n').length,
86
- };
87
- }
88
- }
89
- case 'ensure': {
90
- // Create if doesn't exist, otherwise do nothing
91
- try {
92
- await fs.access(gitignorePath);
93
- return {
94
- success: true,
95
- path: gitignorePath,
96
- exists: true,
97
- action: 'none',
98
- message: '.gitignore already exists',
99
- };
100
- }
101
- catch {
102
- const template = params.template || 'default';
103
- const content = this.getTemplate(template);
104
- await fs.writeFile(gitignorePath, content, 'utf-8');
105
- return {
106
- success: true,
107
- path: gitignorePath,
108
- created: true,
109
- template,
110
- action: 'created',
111
- };
112
- }
113
- }
114
- case 'add': {
115
- const patterns = params.patterns;
116
- if (!patterns || !Array.isArray(patterns) || patterns.length === 0) {
117
- throw new MCPError('VALIDATION_ERROR', 'patterns array is required for add action');
118
- }
119
- let content = '';
120
- try {
121
- content = await fs.readFile(gitignorePath, 'utf-8');
122
- }
123
- catch (err) {
124
- if (err.code === 'ENOENT') {
125
- // Create new file
126
- content = this.getTemplate('minimal');
127
- }
128
- else {
129
- throw err;
130
- }
131
- }
132
- const existingPatterns = new Set(content.split('\n').map(l => l.trim()).filter(l => l && !l.startsWith('#')));
133
- const newPatterns = [];
134
- for (const pattern of patterns) {
135
- if (!existingPatterns.has(pattern)) {
136
- newPatterns.push(pattern);
137
- existingPatterns.add(pattern);
138
- }
139
- }
140
- if (newPatterns.length > 0) {
141
- const comment = params.comment ? `# ${params.comment}\n` : '';
142
- content += `\n${comment}${newPatterns.join('\n')}\n`;
143
- await fs.writeFile(gitignorePath, content, 'utf-8');
144
- }
145
- return {
146
- success: true,
147
- path: gitignorePath,
148
- added: newPatterns,
149
- skipped: patterns.length - newPatterns.length,
150
- total: existingPatterns.size,
151
- };
152
- }
153
- case 'remove': {
154
- const patterns = params.patterns;
155
- if (!patterns || !Array.isArray(patterns) || patterns.length === 0) {
156
- throw new MCPError('VALIDATION_ERROR', 'patterns array is required for remove action');
157
- }
158
- let content = '';
159
- try {
160
- content = await fs.readFile(gitignorePath, 'utf-8');
161
- }
162
- catch (err) {
163
- if (err.code === 'ENOENT') {
164
- return {
165
- success: false,
166
- message: '.gitignore does not exist',
167
- path: gitignorePath,
168
- };
169
- }
170
- throw err;
171
- }
172
- const patternsToRemove = new Set(patterns);
173
- const lines = content.split('\n');
174
- const filteredLines = lines.filter(line => {
175
- const trimmed = line.trim();
176
- return !patternsToRemove.has(trimmed);
177
- });
178
- const removed = lines.length - filteredLines.length;
179
- const newContent = filteredLines.join('\n');
180
- await fs.writeFile(gitignorePath, newContent, 'utf-8');
181
- return {
182
- success: true,
183
- path: gitignorePath,
184
- removed,
185
- remaining: filteredLines.filter(l => l.trim() && !l.startsWith('#')).length,
186
- };
187
- }
188
- case 'update': {
189
- const content = params.content;
190
- if (!content) {
191
- throw new MCPError('VALIDATION_ERROR', 'content is required for update action');
192
- }
193
- await fs.writeFile(gitignorePath, content, 'utf-8');
194
- return {
195
- success: true,
196
- path: gitignorePath,
197
- updated: true,
198
- lines: content.split('\n').length,
199
- };
200
- }
201
- case 'clear': {
202
- const template = params.template || 'empty';
203
- const content = template === 'empty' ? '' : this.getTemplate('minimal');
204
- await fs.writeFile(gitignorePath, content, 'utf-8');
205
- return {
206
- success: true,
207
- path: gitignorePath,
208
- cleared: true,
209
- template,
210
- };
211
- }
212
- default:
213
- throw new MCPError('VALIDATION_ERROR', `Unsupported action: ${action}`);
214
- }
215
- }
216
- getTemplate(template) {
217
- const templates = {
218
- empty: '',
219
- minimal: `# Dependencies
220
- node_modules/
221
- .pnp
222
- .pnp.js
223
-
224
- # Build output
225
- dist/
226
- build/
227
- *.log
228
- `,
229
- default: `# Dependencies
230
- node_modules/
231
- .pnp
232
- .pnp.js
233
- bower_components/
234
-
235
- # Build output
236
- dist/
237
- build/
238
- out/
239
- .next/
240
- .nuxt/
241
- .cache/
242
- .parcel-cache/
243
-
244
- # Environment
245
- .env
246
- .env.local
247
- .env.*.local
248
- *.env
249
-
250
- # IDE
251
- .vscode/
252
- .idea/
253
- *.swp
254
- *.swo
255
- *~
256
- .DS_Store
257
-
258
- # Logs
259
- logs/
260
- *.log
261
- npm-debug.log*
262
- yarn-debug.log*
263
- yarn-error.log*
264
- lerna-debug.log*
265
- pnpm-debug.log*
266
-
267
- # Testing
268
- coverage/
269
- .nyc_output/
270
- *.lcov
271
-
272
- # Temporary
273
- tmp/
274
- temp/
275
- *.tmp
276
- `,
277
- node: `# Node
278
- node_modules/
279
- npm-debug.log*
280
- yarn-debug.log*
281
- yarn-error.log*
282
- lerna-debug.log*
283
- pnpm-debug.log*
284
- .pnpm-store/
285
- .npm
286
- .eslintcache
287
- .node_repl_history
288
- *.tgz
289
- .yarn-integrity
290
- .env
291
- .env.test
292
- .env.production
293
- .cache
294
- .next/
295
- out/
296
- build/
297
- dist/
298
- `,
299
- python: `# Python
300
- __pycache__/
301
- *.py[cod]
302
- *$py.class
303
- *.so
304
- .Python
305
- build/
306
- develop-eggs/
307
- dist/
308
- downloads/
309
- eggs/
310
- .eggs/
311
- lib/
312
- lib64/
313
- parts/
314
- sdist/
315
- var/
316
- wheels/
317
- *.egg-info/
318
- .installed.cfg
319
- *.egg
320
- MANIFEST
321
- pip-log.txt
322
- pip-delete-this-directory.txt
323
- .tox/
324
- .coverage
325
- .pytest_cache/
326
- .mypy_cache/
327
- .dmypy.json
328
- dmypy.json
329
- .env
330
- .venv
331
- env/
332
- venv/
333
- ENV/
334
- `,
335
- };
336
- return templates[template] || templates.default;
337
- }
338
- }
@@ -1,80 +0,0 @@
1
- import { Tool, MCPContext } from '../types.js';
2
- export declare class GitIssuesTool 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
- title: {
18
- type: string;
19
- description: string;
20
- };
21
- body: {
22
- type: string;
23
- description: string;
24
- };
25
- assignees: {
26
- type: string;
27
- items: {
28
- type: string;
29
- };
30
- description: string;
31
- };
32
- labels: {
33
- type: string;
34
- items: {
35
- type: string;
36
- };
37
- description: string;
38
- };
39
- milestone: {
40
- type: string;
41
- description: string;
42
- };
43
- issueNumber: {
44
- type: string;
45
- description: string;
46
- };
47
- state: {
48
- type: string;
49
- enum: string[];
50
- description: string;
51
- };
52
- state_filter: {
53
- type: string;
54
- enum: string[];
55
- description: string;
56
- };
57
- direction: {
58
- type: string;
59
- enum: string[];
60
- description: string;
61
- };
62
- sort: {
63
- type: string;
64
- enum: string[];
65
- description: string;
66
- };
67
- since: {
68
- type: string;
69
- description: string;
70
- };
71
- query: {
72
- type: string;
73
- description: string;
74
- };
75
- };
76
- required: string[];
77
- additionalProperties: boolean;
78
- };
79
- handle(params: Record<string, any>, ctx: MCPContext): Promise<any>;
80
- }