@andrebuzeli/git-mcp 5.5.1 → 5.8.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 (232) hide show
  1. package/README.md +94 -6
  2. package/dist/config.d.ts +5 -131
  3. package/dist/config.js +28 -430
  4. package/dist/index.d.ts +1 -21
  5. package/dist/index.js +118 -140
  6. package/dist/providers/giteaProvider.d.ts +3 -0
  7. package/dist/providers/giteaProvider.js +12 -0
  8. package/dist/providers/githubProvider.d.ts +2 -0
  9. package/dist/providers/githubProvider.js +7 -0
  10. package/dist/providers/providerManager.d.ts +11 -0
  11. package/dist/providers/providerManager.js +48 -0
  12. package/dist/resources/toolsGuide.d.ts +12 -0
  13. package/dist/resources/toolsGuide.js +1491 -0
  14. package/dist/server.d.ts +7 -40
  15. package/dist/server.js +59 -696
  16. package/dist/tools/gitAnalytics.d.ts +29 -0
  17. package/dist/tools/gitAnalytics.js +72 -0
  18. package/dist/tools/gitArchive.d.ts +6 -0
  19. package/dist/tools/gitArchive.js +27 -0
  20. package/dist/tools/gitBackup.d.ts +10 -0
  21. package/dist/tools/gitBackup.js +44 -0
  22. package/dist/tools/gitBranches.d.ts +72 -0
  23. package/dist/tools/gitBranches.js +98 -0
  24. package/dist/tools/gitConfig.d.ts +34 -0
  25. package/dist/tools/gitConfig.js +73 -0
  26. package/dist/tools/gitFiles.d.ts +30 -0
  27. package/dist/tools/gitFiles.js +55 -0
  28. package/dist/tools/gitHistory.d.ts +17 -0
  29. package/dist/tools/gitHistory.js +365 -0
  30. package/dist/tools/gitIssues.d.ts +6 -0
  31. package/dist/tools/gitIssues.js +279 -0
  32. package/dist/tools/gitMonitor.d.ts +51 -0
  33. package/dist/tools/gitMonitor.js +102 -0
  34. package/dist/tools/gitPackages.d.ts +6 -0
  35. package/dist/tools/gitPackages.js +28 -0
  36. package/dist/tools/gitPulls.d.ts +6 -0
  37. package/dist/tools/gitPulls.js +288 -0
  38. package/dist/tools/gitRelease.d.ts +6 -0
  39. package/dist/tools/gitRelease.js +321 -0
  40. package/dist/tools/gitRemote.d.ts +51 -0
  41. package/dist/tools/gitRemote.js +68 -0
  42. package/dist/tools/gitReset.d.ts +34 -0
  43. package/dist/tools/gitReset.js +64 -0
  44. package/dist/tools/gitStash.d.ts +41 -0
  45. package/dist/tools/gitStash.js +67 -0
  46. package/dist/tools/gitSync.d.ts +25 -0
  47. package/dist/tools/gitSync.js +51 -0
  48. package/dist/tools/gitTags.d.ts +30 -0
  49. package/dist/tools/gitTags.js +69 -0
  50. package/dist/tools/gitUpdate.d.ts +14 -0
  51. package/dist/tools/gitUpdate.js +374 -0
  52. package/dist/tools/gitUpload.d.ts +11 -0
  53. package/dist/tools/gitUpload.js +342 -0
  54. package/dist/tools/gitWorkflow.d.ts +6 -0
  55. package/dist/tools/gitWorkflow.js +303 -0
  56. package/dist/types.d.ts +17 -0
  57. package/dist/types.js +2 -0
  58. package/dist/utils/errors.d.ts +13 -0
  59. package/dist/utils/errors.js +22 -0
  60. package/dist/utils/safetyController.d.ts +1 -0
  61. package/dist/utils/safetyController.js +15 -0
  62. package/package.json +8 -3
  63. package/dist/config.d.ts.map +0 -1
  64. package/dist/config.js.map +0 -1
  65. package/dist/index.d.ts.map +0 -1
  66. package/dist/index.js.map +0 -1
  67. package/dist/providers/base-provider.d.ts +0 -66
  68. package/dist/providers/base-provider.d.ts.map +0 -1
  69. package/dist/providers/base-provider.js +0 -65
  70. package/dist/providers/base-provider.js.map +0 -1
  71. package/dist/providers/gitea-provider.d.ts +0 -79
  72. package/dist/providers/gitea-provider.d.ts.map +0 -1
  73. package/dist/providers/gitea-provider.js +0 -576
  74. package/dist/providers/gitea-provider.js.map +0 -1
  75. package/dist/providers/github-provider.d.ts +0 -74
  76. package/dist/providers/github-provider.d.ts.map +0 -1
  77. package/dist/providers/github-provider.js +0 -683
  78. package/dist/providers/github-provider.js.map +0 -1
  79. package/dist/providers/index.d.ts +0 -13
  80. package/dist/providers/index.d.ts.map +0 -1
  81. package/dist/providers/index.js +0 -35
  82. package/dist/providers/index.js.map +0 -1
  83. package/dist/providers/provider-factory.d.ts +0 -49
  84. package/dist/providers/provider-factory.d.ts.map +0 -1
  85. package/dist/providers/provider-factory.js +0 -193
  86. package/dist/providers/provider-factory.js.map +0 -1
  87. package/dist/providers/provider-operation-handler.d.ts +0 -115
  88. package/dist/providers/provider-operation-handler.d.ts.map +0 -1
  89. package/dist/providers/provider-operation-handler.js +0 -449
  90. package/dist/providers/provider-operation-handler.js.map +0 -1
  91. package/dist/providers/types.d.ts +0 -200
  92. package/dist/providers/types.d.ts.map +0 -1
  93. package/dist/providers/types.js +0 -8
  94. package/dist/providers/types.js.map +0 -1
  95. package/dist/server.d.ts.map +0 -1
  96. package/dist/server.js.map +0 -1
  97. package/dist/tools/git-analytics.d.ts +0 -237
  98. package/dist/tools/git-analytics.d.ts.map +0 -1
  99. package/dist/tools/git-analytics.js +0 -819
  100. package/dist/tools/git-analytics.js.map +0 -1
  101. package/dist/tools/git-archive.d.ts +0 -113
  102. package/dist/tools/git-archive.d.ts.map +0 -1
  103. package/dist/tools/git-archive.js +0 -466
  104. package/dist/tools/git-archive.js.map +0 -1
  105. package/dist/tools/git-auto-monitor.d.ts +0 -180
  106. package/dist/tools/git-auto-monitor.d.ts.map +0 -1
  107. package/dist/tools/git-auto-monitor.js +0 -522
  108. package/dist/tools/git-auto-monitor.js.map +0 -1
  109. package/dist/tools/git-backup.d.ts +0 -105
  110. package/dist/tools/git-backup.d.ts.map +0 -1
  111. package/dist/tools/git-backup.js +0 -414
  112. package/dist/tools/git-backup.js.map +0 -1
  113. package/dist/tools/git-branches.d.ts +0 -183
  114. package/dist/tools/git-branches.d.ts.map +0 -1
  115. package/dist/tools/git-branches.js +0 -498
  116. package/dist/tools/git-branches.js.map +0 -1
  117. package/dist/tools/git-config.d.ts +0 -119
  118. package/dist/tools/git-config.d.ts.map +0 -1
  119. package/dist/tools/git-config.js +0 -449
  120. package/dist/tools/git-config.js.map +0 -1
  121. package/dist/tools/git-files.d.ts +0 -150
  122. package/dist/tools/git-files.d.ts.map +0 -1
  123. package/dist/tools/git-files.js +0 -527
  124. package/dist/tools/git-files.js.map +0 -1
  125. package/dist/tools/git-history.d.ts +0 -253
  126. package/dist/tools/git-history.d.ts.map +0 -1
  127. package/dist/tools/git-history.js +0 -824
  128. package/dist/tools/git-history.js.map +0 -1
  129. package/dist/tools/git-issues.d.ts +0 -164
  130. package/dist/tools/git-issues.d.ts.map +0 -1
  131. package/dist/tools/git-issues.js +0 -340
  132. package/dist/tools/git-issues.js.map +0 -1
  133. package/dist/tools/git-monitor.d.ts +0 -154
  134. package/dist/tools/git-monitor.d.ts.map +0 -1
  135. package/dist/tools/git-monitor.js +0 -531
  136. package/dist/tools/git-monitor.js.map +0 -1
  137. package/dist/tools/git-packages.d.ts +0 -157
  138. package/dist/tools/git-packages.d.ts.map +0 -1
  139. package/dist/tools/git-packages.js +0 -534
  140. package/dist/tools/git-packages.js.map +0 -1
  141. package/dist/tools/git-pulls.d.ts +0 -180
  142. package/dist/tools/git-pulls.d.ts.map +0 -1
  143. package/dist/tools/git-pulls.js +0 -369
  144. package/dist/tools/git-pulls.js.map +0 -1
  145. package/dist/tools/git-release.d.ts +0 -161
  146. package/dist/tools/git-release.d.ts.map +0 -1
  147. package/dist/tools/git-release.js +0 -466
  148. package/dist/tools/git-release.js.map +0 -1
  149. package/dist/tools/git-remote.d.ts +0 -128
  150. package/dist/tools/git-remote.d.ts.map +0 -1
  151. package/dist/tools/git-remote.js +0 -542
  152. package/dist/tools/git-remote.js.map +0 -1
  153. package/dist/tools/git-reset.d.ts +0 -120
  154. package/dist/tools/git-reset.d.ts.map +0 -1
  155. package/dist/tools/git-reset.js +0 -479
  156. package/dist/tools/git-reset.js.map +0 -1
  157. package/dist/tools/git-stash.d.ts +0 -124
  158. package/dist/tools/git-stash.d.ts.map +0 -1
  159. package/dist/tools/git-stash.js +0 -506
  160. package/dist/tools/git-stash.js.map +0 -1
  161. package/dist/tools/git-sync.d.ts +0 -154
  162. package/dist/tools/git-sync.d.ts.map +0 -1
  163. package/dist/tools/git-sync.js +0 -479
  164. package/dist/tools/git-sync.js.map +0 -1
  165. package/dist/tools/git-tags.d.ts +0 -136
  166. package/dist/tools/git-tags.d.ts.map +0 -1
  167. package/dist/tools/git-tags.js +0 -461
  168. package/dist/tools/git-tags.js.map +0 -1
  169. package/dist/tools/git-update.d.ts +0 -224
  170. package/dist/tools/git-update.d.ts.map +0 -1
  171. package/dist/tools/git-update.js +0 -948
  172. package/dist/tools/git-update.js.map +0 -1
  173. package/dist/tools/git-workflow.d.ts +0 -189
  174. package/dist/tools/git-workflow.d.ts.map +0 -1
  175. package/dist/tools/git-workflow.js +0 -542
  176. package/dist/tools/git-workflow.js.map +0 -1
  177. package/dist/utils/credential-manager.d.ts +0 -119
  178. package/dist/utils/credential-manager.d.ts.map +0 -1
  179. package/dist/utils/credential-manager.js +0 -450
  180. package/dist/utils/credential-manager.js.map +0 -1
  181. package/dist/utils/data-merger.d.ts +0 -49
  182. package/dist/utils/data-merger.d.ts.map +0 -1
  183. package/dist/utils/data-merger.js +0 -233
  184. package/dist/utils/data-merger.js.map +0 -1
  185. package/dist/utils/git-command-executor.d.ts +0 -330
  186. package/dist/utils/git-command-executor.d.ts.map +0 -1
  187. package/dist/utils/git-command-executor.js +0 -901
  188. package/dist/utils/git-command-executor.js.map +0 -1
  189. package/dist/utils/logger.d.ts +0 -143
  190. package/dist/utils/logger.d.ts.map +0 -1
  191. package/dist/utils/logger.js +0 -473
  192. package/dist/utils/logger.js.map +0 -1
  193. package/dist/utils/operation-error-handler.d.ts +0 -97
  194. package/dist/utils/operation-error-handler.d.ts.map +0 -1
  195. package/dist/utils/operation-error-handler.js +0 -367
  196. package/dist/utils/operation-error-handler.js.map +0 -1
  197. package/dist/utils/parameter-validator.d.ts +0 -49
  198. package/dist/utils/parameter-validator.d.ts.map +0 -1
  199. package/dist/utils/parameter-validator.js +0 -647
  200. package/dist/utils/parameter-validator.js.map +0 -1
  201. package/dist/utils/repository-checker.d.ts +0 -46
  202. package/dist/utils/repository-checker.d.ts.map +0 -1
  203. package/dist/utils/repository-checker.js +0 -151
  204. package/dist/utils/repository-checker.js.map +0 -1
  205. package/dist/utils/repository-detector.d.ts +0 -128
  206. package/dist/utils/repository-detector.d.ts.map +0 -1
  207. package/dist/utils/repository-detector.js +0 -422
  208. package/dist/utils/repository-detector.js.map +0 -1
  209. package/dist/utils/repository-sync.d.ts +0 -67
  210. package/dist/utils/repository-sync.d.ts.map +0 -1
  211. package/dist/utils/repository-sync.js +0 -344
  212. package/dist/utils/repository-sync.js.map +0 -1
  213. package/dist/utils/response-formatter.d.ts +0 -146
  214. package/dist/utils/response-formatter.d.ts.map +0 -1
  215. package/dist/utils/response-formatter.js +0 -378
  216. package/dist/utils/response-formatter.js.map +0 -1
  217. package/dist/utils/retry.d.ts +0 -12
  218. package/dist/utils/retry.d.ts.map +0 -1
  219. package/dist/utils/retry.js +0 -28
  220. package/dist/utils/retry.js.map +0 -1
  221. package/dist/utils/safety-warnings.d.ts +0 -56
  222. package/dist/utils/safety-warnings.d.ts.map +0 -1
  223. package/dist/utils/safety-warnings.js +0 -330
  224. package/dist/utils/safety-warnings.js.map +0 -1
  225. package/dist/utils/terminal-controller.d.ts +0 -79
  226. package/dist/utils/terminal-controller.d.ts.map +0 -1
  227. package/dist/utils/terminal-controller.js +0 -291
  228. package/dist/utils/terminal-controller.js.map +0 -1
  229. package/dist/utils/user-friendly-formatter.d.ts +0 -45
  230. package/dist/utils/user-friendly-formatter.d.ts.map +0 -1
  231. package/dist/utils/user-friendly-formatter.js +0 -175
  232. package/dist/utils/user-friendly-formatter.js.map +0 -1
@@ -1,449 +0,0 @@
1
- "use strict";
2
- /**
3
- * Git Configuration Tool
4
- *
5
- * Git configuration management tool providing comprehensive Git config operations.
6
- * Supports get, set, unset, list, edit, and show operations for Git configuration.
7
- *
8
- * Operations: get, set, unset, list, edit, show
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.GitConfigTool = void 0;
12
- const git_command_executor_js_1 = require("../utils/git-command-executor.js");
13
- const parameter_validator_js_1 = require("../utils/parameter-validator.js");
14
- const operation_error_handler_js_1 = require("../utils/operation-error-handler.js");
15
- class GitConfigTool {
16
- gitExecutor;
17
- constructor() {
18
- this.gitExecutor = new git_command_executor_js_1.GitCommandExecutor();
19
- }
20
- /**
21
- * Execute git-config operation
22
- */
23
- async execute(params) {
24
- const startTime = Date.now();
25
- try {
26
- // Validate basic parameters
27
- const validation = parameter_validator_js_1.ParameterValidator.validateToolParams('git-config', params);
28
- if (!validation.isValid) {
29
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('VALIDATION_ERROR', `Parameter validation failed: ${validation.errors.join(', ')}`, params.action, { validationErrors: validation.errors }, validation.suggestions);
30
- }
31
- // Validate operation-specific parameters
32
- const operationValidation = this.validateOperationParams(params);
33
- if (!operationValidation.isValid) {
34
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('VALIDATION_ERROR', `Operation validation failed: ${operationValidation.errors.join(', ')}`, params.action, { validationErrors: operationValidation.errors }, operationValidation.suggestions);
35
- }
36
- // Route to appropriate handler
37
- switch (params.action) {
38
- case 'get':
39
- return await this.handleGet(params, startTime);
40
- case 'set':
41
- return await this.handleSet(params, startTime);
42
- case 'unset':
43
- return await this.handleUnset(params, startTime);
44
- case 'list':
45
- return await this.handleList(params, startTime);
46
- case 'edit':
47
- return await this.handleEdit(params, startTime);
48
- case 'show':
49
- return await this.handleShow(params, startTime);
50
- default:
51
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('UNSUPPORTED_OPERATION', `Operation '${params.action}' is not supported`, params.action, {}, ['Use one of: get, set, unset, list, edit, show']);
52
- }
53
- }
54
- catch (error) {
55
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
56
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('EXECUTION_ERROR', `Failed to execute ${params.action}: ${errorMessage}`, params.action, { error: errorMessage }, ['Check the error details and try again']);
57
- }
58
- }
59
- /**
60
- * Validate operation-specific parameters
61
- */
62
- validateOperationParams(params) {
63
- const errors = [];
64
- const suggestions = [];
65
- // Validate key requirement for specific operations
66
- if (['get', 'set', 'unset'].includes(params.action) && !params.key) {
67
- errors.push(`Key parameter is required for ${params.action} operation`);
68
- suggestions.push('Provide a configuration key (e.g., user.name, user.email)');
69
- }
70
- // Validate value requirement for set operation
71
- if (params.action === 'set' && !params.value) {
72
- errors.push('Value parameter is required for set operation');
73
- suggestions.push('Provide a configuration value to set');
74
- }
75
- // Validate scope conflicts
76
- const scopeCount = [params.global, params.local, params.system].filter(Boolean).length;
77
- if (scopeCount > 1) {
78
- errors.push('Only one scope can be specified (global, local, or system)');
79
- suggestions.push('Choose either --global, --local, or --system, not multiple');
80
- }
81
- // Validate key format
82
- if (params.key && !this.isValidConfigKey(params.key)) {
83
- errors.push('Invalid configuration key format');
84
- suggestions.push('Use format like: user.name, core.editor, remote.origin.url');
85
- }
86
- return {
87
- isValid: errors.length === 0,
88
- errors,
89
- suggestions
90
- };
91
- }
92
- /**
93
- * Validate configuration key format
94
- */
95
- isValidConfigKey(key) {
96
- // Git config keys should contain at least one dot and valid characters
97
- return /^[a-zA-Z][a-zA-Z0-9-]*(\.[a-zA-Z][a-zA-Z0-9-]*)+$/.test(key);
98
- }
99
- /**
100
- * Handle get configuration operation
101
- */
102
- async handleGet(params, startTime) {
103
- try {
104
- const result = await this.gitExecutor.getConfig(params.projectPath, params.key, {
105
- global: params.global,
106
- local: params.local,
107
- system: params.system
108
- });
109
- if (!result.success) {
110
- // Check if it's a "not found" error
111
- if (result.stderr.includes('not found') || result.exitCode === 1) {
112
- return {
113
- success: true,
114
- data: {
115
- key: params.key,
116
- value: null,
117
- found: false,
118
- message: `Configuration key '${params.key}' not found`,
119
- scope: this.getScopeString(params)
120
- },
121
- metadata: {
122
- operation: 'get',
123
- timestamp: new Date().toISOString(),
124
- executionTime: Date.now() - startTime
125
- }
126
- };
127
- }
128
- return operation_error_handler_js_1.OperationErrorHandler.handleGitError(result.stderr, 'get config', params.projectPath);
129
- }
130
- return {
131
- success: true,
132
- data: {
133
- key: params.key,
134
- value: result.value,
135
- found: true,
136
- scope: this.getScopeString(params),
137
- raw: result.stdout
138
- },
139
- metadata: {
140
- operation: 'get',
141
- timestamp: new Date().toISOString(),
142
- executionTime: Date.now() - startTime
143
- }
144
- };
145
- }
146
- catch (error) {
147
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
148
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('GET_CONFIG_ERROR', `Failed to get configuration: ${errorMessage}`, 'get', { error: errorMessage, key: params.key });
149
- }
150
- }
151
- /**
152
- * Handle set configuration operation
153
- */
154
- async handleSet(params, startTime) {
155
- try {
156
- const result = await this.gitExecutor.setConfig(params.projectPath, params.key, params.value, {
157
- global: params.global,
158
- local: params.local,
159
- system: params.system
160
- });
161
- if (!result.success) {
162
- return operation_error_handler_js_1.OperationErrorHandler.handleGitError(result.stderr, 'set config', params.projectPath);
163
- }
164
- return {
165
- success: true,
166
- data: {
167
- message: 'Configuration set successfully',
168
- key: params.key,
169
- value: params.value,
170
- scope: this.getScopeString(params),
171
- output: result.stdout
172
- },
173
- metadata: {
174
- operation: 'set',
175
- timestamp: new Date().toISOString(),
176
- executionTime: Date.now() - startTime
177
- }
178
- };
179
- }
180
- catch (error) {
181
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
182
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('SET_CONFIG_ERROR', `Failed to set configuration: ${errorMessage}`, 'set', { error: errorMessage, key: params.key, value: params.value });
183
- }
184
- }
185
- /**
186
- * Handle unset configuration operation
187
- */
188
- async handleUnset(params, startTime) {
189
- try {
190
- const result = await this.gitExecutor.unsetConfig(params.projectPath, params.key, {
191
- global: params.global,
192
- local: params.local,
193
- system: params.system
194
- });
195
- if (!result.success) {
196
- // Check if it's a "not found" error
197
- if (result.stderr.includes('not found') || result.exitCode === 5) {
198
- return {
199
- success: true,
200
- data: {
201
- key: params.key,
202
- found: false,
203
- message: `Configuration key '${params.key}' was not set`,
204
- scope: this.getScopeString(params)
205
- },
206
- metadata: {
207
- operation: 'unset',
208
- timestamp: new Date().toISOString(),
209
- executionTime: Date.now() - startTime
210
- }
211
- };
212
- }
213
- return operation_error_handler_js_1.OperationErrorHandler.handleGitError(result.stderr, 'unset config', params.projectPath);
214
- }
215
- return {
216
- success: true,
217
- data: {
218
- message: 'Configuration unset successfully',
219
- key: params.key,
220
- scope: this.getScopeString(params),
221
- output: result.stdout
222
- },
223
- metadata: {
224
- operation: 'unset',
225
- timestamp: new Date().toISOString(),
226
- executionTime: Date.now() - startTime
227
- }
228
- };
229
- }
230
- catch (error) {
231
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
232
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('UNSET_CONFIG_ERROR', `Failed to unset configuration: ${errorMessage}`, 'unset', { error: errorMessage, key: params.key });
233
- }
234
- }
235
- /**
236
- * Handle list configuration operation
237
- */
238
- async handleList(params, startTime) {
239
- try {
240
- const result = await this.gitExecutor.listConfig(params.projectPath, {
241
- global: params.global,
242
- local: params.local,
243
- system: params.system,
244
- showOrigin: params.showOrigin
245
- });
246
- if (!result.success) {
247
- return operation_error_handler_js_1.OperationErrorHandler.handleGitError(result.stderr, 'list config', params.projectPath);
248
- }
249
- const configs = result.configs || [];
250
- const groupedConfigs = this.groupConfigsBySection(configs);
251
- return {
252
- success: true,
253
- data: {
254
- message: `Found ${configs.length} configuration entries`,
255
- scope: this.getScopeString(params),
256
- totalCount: configs.length,
257
- configs: configs,
258
- groupedConfigs: groupedConfigs,
259
- showOrigin: params.showOrigin,
260
- raw: result.stdout
261
- },
262
- metadata: {
263
- operation: 'list',
264
- timestamp: new Date().toISOString(),
265
- executionTime: Date.now() - startTime
266
- }
267
- };
268
- }
269
- catch (error) {
270
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
271
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('LIST_CONFIG_ERROR', `Failed to list configuration: ${errorMessage}`, 'list', { error: errorMessage });
272
- }
273
- }
274
- /**
275
- * Handle edit configuration operation
276
- */
277
- async handleEdit(params, startTime) {
278
- try {
279
- const result = await this.gitExecutor.editConfig(params.projectPath, {
280
- global: params.global,
281
- local: params.local,
282
- system: params.system
283
- });
284
- if (!result.success) {
285
- return operation_error_handler_js_1.OperationErrorHandler.handleGitError(result.stderr, 'edit config', params.projectPath);
286
- }
287
- return {
288
- success: true,
289
- data: {
290
- message: 'Configuration editor opened successfully',
291
- scope: this.getScopeString(params),
292
- note: 'Configuration file was opened in the default editor',
293
- output: result.stdout
294
- },
295
- metadata: {
296
- operation: 'edit',
297
- timestamp: new Date().toISOString(),
298
- executionTime: Date.now() - startTime
299
- }
300
- };
301
- }
302
- catch (error) {
303
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
304
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('EDIT_CONFIG_ERROR', `Failed to edit configuration: ${errorMessage}`, 'edit', { error: errorMessage });
305
- }
306
- }
307
- /**
308
- * Handle show configuration operation
309
- */
310
- async handleShow(params, startTime) {
311
- try {
312
- const result = await this.gitExecutor.showConfig(params.projectPath, params.key, {
313
- global: params.global,
314
- local: params.local,
315
- system: params.system,
316
- showOrigin: params.showOrigin,
317
- showScope: params.showScope
318
- });
319
- if (!result.success) {
320
- // Check if it's a "not found" error for specific key
321
- if (params.key && (result.stderr.includes('not found') || result.exitCode === 1)) {
322
- return {
323
- success: true,
324
- data: {
325
- key: params.key,
326
- found: false,
327
- message: `Configuration key '${params.key}' not found`,
328
- scope: this.getScopeString(params)
329
- },
330
- metadata: {
331
- operation: 'show',
332
- timestamp: new Date().toISOString(),
333
- executionTime: Date.now() - startTime
334
- }
335
- };
336
- }
337
- return operation_error_handler_js_1.OperationErrorHandler.handleGitError(result.stderr, 'show config', params.projectPath);
338
- }
339
- const configs = result.configs || [];
340
- const groupedConfigs = params.key ? undefined : this.groupConfigsBySection(configs);
341
- return {
342
- success: true,
343
- data: {
344
- message: params.key
345
- ? `Configuration for '${params.key}'`
346
- : `Configuration details (${configs.length} entries)`,
347
- key: params.key,
348
- scope: this.getScopeString(params),
349
- totalCount: configs.length,
350
- configs: configs,
351
- groupedConfigs: groupedConfigs,
352
- showOrigin: params.showOrigin,
353
- showScope: params.showScope,
354
- raw: result.stdout
355
- },
356
- metadata: {
357
- operation: 'show',
358
- timestamp: new Date().toISOString(),
359
- executionTime: Date.now() - startTime
360
- }
361
- };
362
- }
363
- catch (error) {
364
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
365
- return operation_error_handler_js_1.OperationErrorHandler.createToolError('SHOW_CONFIG_ERROR', `Failed to show configuration: ${errorMessage}`, 'show', { error: errorMessage, key: params.key });
366
- }
367
- }
368
- /**
369
- * Get scope string for display
370
- */
371
- getScopeString(params) {
372
- if (params.global)
373
- return 'global';
374
- if (params.local)
375
- return 'local';
376
- if (params.system)
377
- return 'system';
378
- return 'default';
379
- }
380
- /**
381
- * Group configurations by section
382
- */
383
- groupConfigsBySection(configs) {
384
- const grouped = {};
385
- for (const config of configs) {
386
- const dotIndex = config.key.indexOf('.');
387
- const section = dotIndex > 0 ? config.key.substring(0, dotIndex) : 'other';
388
- if (!grouped[section]) {
389
- grouped[section] = [];
390
- }
391
- grouped[section].push(config);
392
- }
393
- return grouped;
394
- }
395
- /**
396
- * Get tool schema for MCP registration
397
- */
398
- static getToolSchema() {
399
- return {
400
- name: 'git-config',
401
- description: 'Git configuration management tool for get, set, unset, list, edit, and show operations. Supports global, local, and system configuration scopes.',
402
- inputSchema: {
403
- type: 'object',
404
- properties: {
405
- action: {
406
- type: 'string',
407
- enum: ['get', 'set', 'unset', 'list', 'edit', 'show'],
408
- description: 'The Git configuration operation to perform'
409
- },
410
- projectPath: {
411
- type: 'string',
412
- description: 'Absolute path to the project directory'
413
- },
414
- key: {
415
- type: 'string',
416
- description: 'Configuration key (required for get, set, unset, show operations). Examples: user.name, user.email, core.editor'
417
- },
418
- value: {
419
- type: 'string',
420
- description: 'Configuration value (required for set operation)'
421
- },
422
- global: {
423
- type: 'boolean',
424
- description: 'Use global configuration (~/.gitconfig)'
425
- },
426
- local: {
427
- type: 'boolean',
428
- description: 'Use local repository configuration (.git/config)'
429
- },
430
- system: {
431
- type: 'boolean',
432
- description: 'Use system configuration (/etc/gitconfig)'
433
- },
434
- showOrigin: {
435
- type: 'boolean',
436
- description: 'Show configuration file origin (for list and show operations)'
437
- },
438
- showScope: {
439
- type: 'boolean',
440
- description: 'Show configuration scope (for show operation)'
441
- }
442
- },
443
- required: ['action', 'projectPath']
444
- }
445
- };
446
- }
447
- }
448
- exports.GitConfigTool = GitConfigTool;
449
- //# sourceMappingURL=git-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-config.js","sourceRoot":"","sources":["../../src/tools/git-config.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,8EAAwF;AACxF,4EAAiF;AACjF,oFAAwF;AAoBxF,MAAa,aAAa;IAChB,WAAW,CAAqB;IAExC;QACE,IAAI,CAAC,WAAW,GAAG,IAAI,4CAAkB,EAAE,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,MAAuB;QACnC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,IAAI,CAAC;YACH,4BAA4B;YAC5B,MAAM,UAAU,GAAG,2CAAkB,CAAC,kBAAkB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAC/E,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;gBACxB,OAAO,kDAAqB,CAAC,eAAe,CAC1C,kBAAkB,EAClB,gCAAgC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAC9D,MAAM,CAAC,MAAM,EACb,EAAE,gBAAgB,EAAE,UAAU,CAAC,MAAM,EAAE,EACvC,UAAU,CAAC,WAAW,CAC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AAI,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa;QAClB,OAAO;YACL,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,kJAAkJ;YAC/J,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;wBACrD,WAAW,EAAE,4CAA4C;qBAC1D;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,wCAAwC;qBACtD;oBACD,GAAG,EAAE;wBACH,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iHAAiH;qBAC/H;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,kDAAkD;qBAChE;oBACD,MAAM,EAAE;wBACN,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,yCAAyC;qBACvD;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,kDAAkD;qBAChE;oBACD,MAAM,EAAE;wBACN,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,2CAA2C;qBACzD;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,+DAA+D;qBAC7E;oBACD,SAAS,EAAE;wBACT,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,+CAA+C;qBAC7D;iBACF;gBACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;aACpC;SACF,CAAC;IACJ,CAAC;CACF;AA9hBD,sCA8hBC"}
@@ -1,150 +0,0 @@
1
- /**
2
- * Git Files Tool
3
- *
4
- * File management tool providing CRUD operations for repository files.
5
- * Supports both local Git operations and remote provider operations.
6
- *
7
- * Operations: read, create, update, delete, search, backup
8
- */
9
- import { ToolParams } from '../utils/parameter-validator.js';
10
- import { ToolResult } from '../utils/operation-error-handler.js';
11
- import { ProviderConfig } from '../providers/types.js';
12
- export interface GitFilesParams extends ToolParams {
13
- action: 'read' | 'search' | 'backup' | 'list';
14
- filePath?: string;
15
- encoding?: 'utf8' | 'base64' | 'binary';
16
- branch?: string;
17
- query?: string;
18
- filePattern?: string;
19
- caseSensitive?: boolean;
20
- backupPath?: string;
21
- includePattern?: string;
22
- excludePattern?: string;
23
- repo?: string;
24
- }
25
- export declare class GitFilesTool {
26
- private gitExecutor;
27
- private terminalController;
28
- private providerHandler?;
29
- constructor(providerConfig?: ProviderConfig);
30
- /**
31
- * Execute git-files operation
32
- */
33
- execute(params: GitFilesParams): Promise<ToolResult>;
34
- /**
35
- * Execute local file operations
36
- */
37
- private executeLocalOperation;
38
- /**
39
- * Execute remote provider operations
40
- */
41
- private executeRemoteOperation;
42
- /**
43
- * Handle local file read operation
44
- */
45
- private handleLocalRead;
46
- /**
47
- * Check if operation is restricted (file content modification)
48
- */
49
- private isRestrictedOperation;
50
- /**
51
- * Handle local file search operation
52
- */
53
- private handleLocalSearch;
54
- /**
55
- * Handle local directory listing
56
- */
57
- private handleLocalList;
58
- /**
59
- * Handle local file backup operation
60
- */
61
- private handleLocalBackup;
62
- /**
63
- * Create manual backup by copying files
64
- */
65
- private createManualBackup;
66
- /**
67
- * Check if operation is a remote operation
68
- */
69
- private isRemoteOperation;
70
- /**
71
- * Extract parameters for remote operations
72
- */
73
- private extractRemoteParameters;
74
- /**
75
- * Map git-files actions to provider operations
76
- */
77
- private mapActionToProviderOperation;
78
- /**
79
- * Parse search results from grep-like output
80
- */
81
- private parseSearchResults;
82
- /**
83
- * Check if path matches pattern (simple glob matching)
84
- */
85
- private matchesPattern;
86
- /**
87
- * Get tool schema for MCP registration
88
- */
89
- static getToolSchema(): {
90
- name: string;
91
- description: string;
92
- inputSchema: {
93
- type: string;
94
- properties: {
95
- action: {
96
- type: string;
97
- enum: string[];
98
- description: string;
99
- };
100
- projectPath: {
101
- type: string;
102
- description: string;
103
- };
104
- filePath: {
105
- type: string;
106
- description: string;
107
- };
108
- encoding: {
109
- type: string;
110
- enum: string[];
111
- description: string;
112
- };
113
- branch: {
114
- type: string;
115
- description: string;
116
- };
117
- query: {
118
- type: string;
119
- description: string;
120
- };
121
- filePattern: {
122
- type: string;
123
- description: string;
124
- };
125
- caseSensitive: {
126
- type: string;
127
- description: string;
128
- };
129
- backupPath: {
130
- type: string;
131
- description: string;
132
- };
133
- includePattern: {
134
- type: string;
135
- description: string;
136
- };
137
- excludePattern: {
138
- type: string;
139
- description: string;
140
- };
141
- repo: {
142
- type: string;
143
- description: string;
144
- };
145
- };
146
- required: string[];
147
- };
148
- };
149
- }
150
- //# sourceMappingURL=git-files.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-files.d.ts","sourceRoot":"","sources":["../../src/tools/git-files.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAsB,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAyB,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAExF,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAM1E,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAG9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAGxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IAGxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;I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