@andrebuzeli/git-mcp 4.0.20 → 4.0.21

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 (85) hide show
  1. package/dist/config.d.ts +7 -239
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +2 -221
  4. package/dist/config.js.map +1 -1
  5. package/dist/index.d.ts +11 -9
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +18 -16
  8. package/dist/index.js.map +1 -1
  9. package/dist/server.d.ts +1 -69
  10. package/dist/server.d.ts.map +1 -1
  11. package/dist/server.js +150 -711
  12. package/dist/server.js.map +1 -1
  13. package/dist/tools/git-analytics.d.ts +1 -0
  14. package/dist/tools/git-analytics.d.ts.map +1 -1
  15. package/dist/tools/git-analytics.js +18 -7
  16. package/dist/tools/git-analytics.js.map +1 -1
  17. package/dist/tools/git-archive.d.ts +2 -149
  18. package/dist/tools/git-archive.d.ts.map +1 -1
  19. package/dist/tools/git-archive.js +5 -222
  20. package/dist/tools/git-archive.js.map +1 -1
  21. package/dist/tools/git-backup.d.ts +1 -198
  22. package/dist/tools/git-backup.d.ts.map +1 -1
  23. package/dist/tools/git-backup.js +4 -805
  24. package/dist/tools/git-backup.js.map +1 -1
  25. package/dist/tools/git-branches.d.ts +1 -158
  26. package/dist/tools/git-branches.d.ts.map +1 -1
  27. package/dist/tools/git-branches.js +4 -539
  28. package/dist/tools/git-branches.js.map +1 -1
  29. package/dist/tools/git-config.d.ts +2 -124
  30. package/dist/tools/git-config.d.ts.map +1 -1
  31. package/dist/tools/git-config.js +5 -263
  32. package/dist/tools/git-config.js.map +1 -1
  33. package/dist/tools/git-files.d.ts +2 -115
  34. package/dist/tools/git-files.d.ts.map +1 -1
  35. package/dist/tools/git-files.js +161 -407
  36. package/dist/tools/git-files.js.map +1 -1
  37. package/dist/tools/git-issues.d.ts +1 -214
  38. package/dist/tools/git-issues.d.ts.map +1 -1
  39. package/dist/tools/git-issues.js +4 -678
  40. package/dist/tools/git-issues.js.map +1 -1
  41. package/dist/tools/git-monitor.d.ts +1 -143
  42. package/dist/tools/git-monitor.d.ts.map +1 -1
  43. package/dist/tools/git-monitor.js +4 -738
  44. package/dist/tools/git-monitor.js.map +1 -1
  45. package/dist/tools/git-packages.d.ts +2 -91
  46. package/dist/tools/git-packages.d.ts.map +1 -1
  47. package/dist/tools/git-packages.js +5 -258
  48. package/dist/tools/git-packages.js.map +1 -1
  49. package/dist/tools/git-pulls.d.ts +1 -63
  50. package/dist/tools/git-pulls.d.ts.map +1 -1
  51. package/dist/tools/git-pulls.js +4 -77
  52. package/dist/tools/git-pulls.js.map +1 -1
  53. package/dist/tools/git-release.d.ts +1 -169
  54. package/dist/tools/git-release.d.ts.map +1 -1
  55. package/dist/tools/git-release.js +4 -611
  56. package/dist/tools/git-release.js.map +1 -1
  57. package/dist/tools/git-remote.d.ts +1 -153
  58. package/dist/tools/git-remote.d.ts.map +1 -1
  59. package/dist/tools/git-remote.js +4 -555
  60. package/dist/tools/git-remote.js.map +1 -1
  61. package/dist/tools/git-reset.d.ts +1 -157
  62. package/dist/tools/git-reset.d.ts.map +1 -1
  63. package/dist/tools/git-reset.js +4 -597
  64. package/dist/tools/git-reset.js.map +1 -1
  65. package/dist/tools/git-stash.d.ts +1 -161
  66. package/dist/tools/git-stash.d.ts.map +1 -1
  67. package/dist/tools/git-stash.js +4 -640
  68. package/dist/tools/git-stash.js.map +1 -1
  69. package/dist/tools/git-sync.d.ts +1 -0
  70. package/dist/tools/git-sync.d.ts.map +1 -1
  71. package/dist/tools/git-sync.js +13 -7
  72. package/dist/tools/git-sync.js.map +1 -1
  73. package/dist/tools/git-tags.d.ts +1 -162
  74. package/dist/tools/git-tags.d.ts.map +1 -1
  75. package/dist/tools/git-tags.js +4 -549
  76. package/dist/tools/git-tags.js.map +1 -1
  77. package/dist/tools/git-workflow.d.ts +3 -96
  78. package/dist/tools/git-workflow.d.ts.map +1 -1
  79. package/dist/tools/git-workflow.js +287 -314
  80. package/dist/tools/git-workflow.js.map +1 -1
  81. package/package.json +3 -3
  82. package/dist/server-minimal.d.ts +0 -8
  83. package/dist/server-minimal.d.ts.map +0 -1
  84. package/dist/server-minimal.js +0 -218
  85. package/dist/server-minimal.js.map +0 -1
@@ -1,650 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.gitStashTool = void 0;
4
- const zod_1 = require("zod");
5
4
  const auto_detection_js_1 = require("../utils/auto-detection.js");
6
- const error_handler_js_1 = require("../utils/error-handler.js");
7
- const git_operations_js_1 = require("../utils/git-operations.js");
8
- /**
9
- * Tool: git-stash
10
- *
11
- * GERENCIAMENTO DE STASH UNIFICADO
12
- * Stash inteligente com auto-naming, categorização e recuperação automática
13
- *
14
- * DESIGNED FOR: Programador individual autônomo
15
- * PHILOSOPHY: Stash transparente e inteligente
16
- */
17
- const GitStashInputSchema = zod_1.z.discriminatedUnion('action', [
18
- // STASH SAVE - Salvamento inteligente
19
- zod_1.z.object({
20
- action: zod_1.z.literal('save'),
21
- projectPath: zod_1.z.string(),
22
- message: zod_1.z.string().optional(), // Auto-generate se não fornecido
23
- includeUntracked: zod_1.z.boolean().default(false),
24
- keepIndex: zod_1.z.boolean().default(false)
25
- }),
26
- // STASH POP - Aplicação e remoção
27
- zod_1.z.object({
28
- action: zod_1.z.literal('pop'),
29
- projectPath: zod_1.z.string(),
30
- index: zod_1.z.string().default('0'), // Stash index (0 = mais recente)
31
- force: zod_1.z.boolean().default(false) // Forçar aplicação mesmo com conflitos
32
- }),
33
- // STASH APPLY - Aplicação sem remoção
34
- zod_1.z.object({
35
- action: zod_1.z.literal('apply'),
36
- projectPath: zod_1.z.string(),
37
- index: zod_1.z.string().default('0'),
38
- force: zod_1.z.boolean().default(false)
39
- }),
40
- // STASH LIST - Listagem com metadados
41
- zod_1.z.object({
42
- action: zod_1.z.literal('list'),
43
- projectPath: zod_1.z.string(),
44
- detailed: zod_1.z.boolean().default(false),
45
- filter: zod_1.z.string().optional() // Filtrar por message/content
46
- }),
47
- // STASH SHOW - Detalhes do stash
48
- zod_1.z.object({
49
- action: zod_1.z.literal('show'),
50
- projectPath: zod_1.z.string(),
51
- index: zod_1.z.string().default('0'),
52
- patch: zod_1.z.boolean().default(false) // Mostrar patch completo
53
- }),
54
- // STASH DROP - Remoção específica
55
- zod_1.z.object({
56
- action: zod_1.z.literal('drop'),
57
- projectPath: zod_1.z.string(),
58
- index: zod_1.z.string().default('0'),
59
- force: zod_1.z.boolean().default(false)
60
- }),
61
- // STASH CLEAR - Limpeza total
62
- zod_1.z.object({
63
- action: zod_1.z.literal('clear'),
64
- projectPath: zod_1.z.string(),
65
- confirm: zod_1.z.boolean().default(false) // Confirmação necessária
66
- })
67
- ]);
68
- /**
69
- * Smart Stash Manager
70
- * Gerencia operações de stash com inteligência
71
- */
72
- class SmartStashManager {
73
- static async getAllStashes(projectPath) {
74
- const gitOps = new git_operations_js_1.GitOperations(projectPath);
75
- try {
76
- const result = await gitOps.runCommand('git', ['stash', 'list']);
77
- if (!result.success) {
78
- return [];
79
- }
80
- const lines = result.output.trim().split('\n');
81
- const stashes = [];
82
- lines.forEach(line => {
83
- const match = line.match(/^stash@{(\d+)}:\s+(.+)$/);
84
- if (match) {
85
- const [, index, message] = match;
86
- stashes.push({
87
- index: parseInt(index),
88
- ref: `stash@{${index}}`,
89
- message: message.trim(),
90
- created: this.parseStashDate(line)
91
- });
92
- }
93
- });
94
- return stashes;
95
- }
96
- catch (error) {
97
- return [];
98
- }
99
- }
100
- static async getStashInfo(projectPath, index) {
101
- const gitOps = new git_operations_js_1.GitOperations(projectPath);
102
- try {
103
- // Get basic info
104
- const listResult = await gitOps.runCommand('git', ['stash', 'list']);
105
- if (!listResult.success) {
106
- return { index, exists: false };
107
- }
108
- const stashRef = `stash@{${index}}`;
109
- const exists = listResult.output.includes(stashRef);
110
- if (!exists) {
111
- return { index, exists: false };
112
- }
113
- // Get detailed info
114
- const showResult = await gitOps.runCommand('git', ['stash', 'show', '--stat', stashRef]);
115
- const files = showResult.success ?
116
- showResult.output.trim().split('\n').filter(line => line.trim()) : [];
117
- return {
118
- index: parseInt(index),
119
- ref: stashRef,
120
- exists: true,
121
- files: files,
122
- fileCount: files.length
123
- };
124
- }
125
- catch (error) {
126
- return { index, exists: false, error: error instanceof Error ? error.message : String(error) };
127
- }
128
- }
129
- static generateStashMessage(detection, customMessage) {
130
- if (customMessage)
131
- return customMessage;
132
- const now = new Date();
133
- const timestamp = now.toLocaleString();
134
- const context = `Auto-stash: ${detection.repoName} (${timestamp})`;
135
- return context;
136
- }
137
- static parseStashDate(stashLine) {
138
- // Try to extract date from stash line
139
- // Git stash list doesn't show dates directly, but we can try to get from log
140
- return new Date(); // Placeholder - would need more complex parsing
141
- }
142
- static async hasUncommittedChanges(projectPath) {
143
- const gitOps = new git_operations_js_1.GitOperations(projectPath);
144
- try {
145
- const statusResult = await gitOps.runCommand('git', ['status', '--porcelain']);
146
- return statusResult.success && statusResult.output.trim().length > 0;
147
- }
148
- catch (error) {
149
- return false;
150
- }
151
- }
152
- static validateStashIndex(index) {
153
- const numericIndex = parseInt(index);
154
- return {
155
- valid: !isNaN(numericIndex) && numericIndex >= 0,
156
- numericIndex
157
- };
158
- }
159
- }
160
- /**
161
- * Classe principal para executar operações Git stash
162
- */
163
- class GitStashExecutor {
164
- errorHandler = new error_handler_js_1.UniversalErrorHandler();
165
- /**
166
- * Executa operação save
167
- */
168
- async executeSave(detection, input) {
169
- try {
170
- const gitOps = new git_operations_js_1.GitOperations(detection.projectPath);
171
- // Check if there are changes to stash
172
- const hasChanges = await SmartStashManager.hasUncommittedChanges(detection.projectPath);
173
- if (!hasChanges && !input.includeUntracked) {
174
- return (0, auto_detection_js_1.createUniversalResponse)({
175
- success: false,
176
- action: 'save',
177
- message: 'No changes to stash',
178
- error: {
179
- code: 'NO_CHANGES',
180
- message: 'There are no uncommitted changes to stash',
181
- cause: 'Working directory is clean',
182
- suggestion: 'Make some changes first or use includeUntracked=true for untracked files'
183
- },
184
- autoDetected: {
185
- repo: detection.repoName,
186
- owner: detection.owner,
187
- providers: detection.providers
188
- }
189
- });
190
- }
191
- // Generate message if not provided
192
- const message = SmartStashManager.generateStashMessage(detection, input.message);
193
- // Build stash command
194
- const args = ['stash', 'push'];
195
- if (input.includeUntracked) {
196
- args.push('--include-untracked');
197
- }
198
- if (input.keepIndex) {
199
- args.push('--keep-index');
200
- }
201
- args.push('-m', message);
202
- // Execute stash
203
- const stashResult = await gitOps.runCommand('git', args);
204
- if (!stashResult.success) {
205
- throw new Error(`Failed to create stash: ${stashResult.error}`);
206
- }
207
- // Get stash info
208
- const stashes = await SmartStashManager.getAllStashes(detection.projectPath);
209
- const latestStash = stashes.find(s => s.message === message);
210
- return (0, auto_detection_js_1.createUniversalResponse)({
211
- success: true,
212
- action: 'save',
213
- message: `Changes stashed successfully`,
214
- data: {
215
- message: message,
216
- includeUntracked: input.includeUntracked,
217
- keepIndex: input.keepIndex,
218
- stashRef: latestStash?.ref || 'stash@{0}',
219
- stashIndex: latestStash?.index || 0
220
- },
221
- autoDetected: {
222
- repo: detection.repoName,
223
- owner: detection.owner,
224
- providers: detection.providers
225
- }
226
- });
227
- }
228
- catch (error) {
229
- this.errorHandler.addError(error);
230
- const errorResponse = this.errorHandler.toUniversalResponse();
231
- return (0, auto_detection_js_1.createUniversalResponse)(false, 'save', 'Erro ao salvar stash', detection, 'git-stash', undefined, errorResponse);
232
- }
233
- }
234
- /**
235
- * Executa operação pop
236
- */
237
- async executePop(detection, input) {
238
- try {
239
- const gitOps = new git_operations_js_1.GitOperations(detection.projectPath);
240
- // Validate index
241
- const indexValidation = SmartStashManager.validateStashIndex(input.index);
242
- if (!indexValidation.valid) {
243
- throw new Error(`Invalid stash index: ${input.index}`);
244
- }
245
- // Check if stash exists
246
- const stashInfo = await SmartStashManager.getStashInfo(detection.projectPath, input.index);
247
- if (!stashInfo.exists) {
248
- throw new Error(`Stash stash@{${input.index}} does not exist`);
249
- }
250
- // Execute pop
251
- const args = input.force ? ['stash', 'pop', '--force', `stash@{${input.index}}`] : ['stash', 'pop', `stash@{${input.index}}`];
252
- const popResult = await gitOps.runCommand('git', args);
253
- if (!popResult.success) {
254
- // Check for conflicts
255
- if (popResult.error.includes('conflict')) {
256
- return (0, auto_detection_js_1.createUniversalResponse)({
257
- success: false,
258
- action: 'pop',
259
- message: 'Stash conflicts detected',
260
- error: {
261
- code: 'STASH_CONFLICT',
262
- message: 'Stash application resulted in conflicts',
263
- cause: popResult.error,
264
- suggestion: 'Resolve conflicts manually then run: git stash drop stash@{index} to remove the stash'
265
- },
266
- autoDetected: {
267
- repo: detection.repoName,
268
- owner: detection.owner,
269
- providers: detection.providers
270
- }
271
- });
272
- }
273
- throw new Error(`Failed to pop stash: ${popResult.error}`);
274
- }
275
- return (0, auto_detection_js_1.createUniversalResponse)({
276
- success: true,
277
- action: 'pop',
278
- message: `Stash stash@{${input.index}} applied and removed`,
279
- data: {
280
- stashRef: `stash@{${input.index}}`,
281
- force: input.force,
282
- applied: true,
283
- removed: true
284
- },
285
- autoDetected: {
286
- repo: detection.repoName,
287
- owner: detection.owner,
288
- providers: detection.providers
289
- }
290
- });
291
- }
292
- catch (error) {
293
- return this.errorHandler.toUniversalResponse();
294
- }
295
- }
296
- /**
297
- * Executa operação apply
298
- */
299
- async executeApply(detection, input) {
300
- try {
301
- const gitOps = new git_operations_js_1.GitOperations(detection.projectPath);
302
- // Validate index
303
- const indexValidation = SmartStashManager.validateStashIndex(input.index);
304
- if (!indexValidation.valid) {
305
- throw new Error(`Invalid stash index: ${input.index}`);
306
- }
307
- // Check if stash exists
308
- const stashInfo = await SmartStashManager.getStashInfo(detection.projectPath, input.index);
309
- if (!stashInfo.exists) {
310
- throw new Error(`Stash stash@{${input.index}} does not exist`);
311
- }
312
- // Execute apply
313
- const args = input.force ? ['stash', 'apply', '--force', `stash@{${input.index}}`] : ['stash', 'apply', `stash@{${input.index}}`];
314
- const applyResult = await gitOps.runCommand('git', args);
315
- if (!applyResult.success) {
316
- // Check for conflicts
317
- if (applyResult.error.includes('conflict')) {
318
- return (0, auto_detection_js_1.createUniversalResponse)({
319
- success: false,
320
- action: 'apply',
321
- message: 'Stash conflicts detected',
322
- error: {
323
- code: 'STASH_CONFLICT',
324
- message: 'Stash application resulted in conflicts',
325
- cause: applyResult.error,
326
- suggestion: 'Resolve conflicts manually or use force=true to overwrite'
327
- },
328
- autoDetected: {
329
- repo: detection.repoName,
330
- owner: detection.owner,
331
- providers: detection.providers
332
- }
333
- });
334
- }
335
- throw new Error(`Failed to apply stash: ${applyResult.error}`);
336
- }
337
- return (0, auto_detection_js_1.createUniversalResponse)({
338
- success: true,
339
- action: 'apply',
340
- message: `Stash stash@{${input.index}} applied (kept in stash)`,
341
- data: {
342
- stashRef: `stash@{${input.index}}`,
343
- force: input.force,
344
- applied: true,
345
- removed: false
346
- },
347
- autoDetected: {
348
- repo: detection.repoName,
349
- owner: detection.owner,
350
- providers: detection.providers
351
- }
352
- });
353
- }
354
- catch (error) {
355
- this.errorHandler.addError(error);
356
- const errorResponse = this.errorHandler.toUniversalResponse();
357
- return (0, auto_detection_js_1.createUniversalResponse)(false, 'apply', 'Erro ao aplicar stash', detection, 'git-stash', undefined, errorResponse);
358
- }
359
- }
360
- /**
361
- * Executa operação list
362
- */
363
- async executeList(detection, input) {
364
- try {
365
- const stashes = await SmartStashManager.getAllStashes(detection.projectPath);
366
- // Filter if requested
367
- let filteredStashes = stashes;
368
- if (input.filter) {
369
- const filter = input.filter.toLowerCase();
370
- filteredStashes = stashes.filter(stash => stash.message.toLowerCase().includes(filter));
371
- }
372
- return (0, auto_detection_js_1.createUniversalResponse)({
373
- success: true,
374
- action: 'list',
375
- message: `Found ${filteredStashes.length} stashes`,
376
- data: {
377
- stashes: filteredStashes,
378
- total: stashes.length,
379
- filtered: input.filter ? filteredStashes.length : stashes.length,
380
- filter: input.filter,
381
- detailed: input.detailed
382
- },
383
- autoDetected: {
384
- repo: detection.repoName,
385
- owner: detection.owner,
386
- providers: detection.providers
387
- }
388
- });
389
- }
390
- catch (error) {
391
- this.errorHandler.addError(error);
392
- const errorResponse = this.errorHandler.toUniversalResponse();
393
- return (0, auto_detection_js_1.createUniversalResponse)(false, 'list', 'Erro ao listar stashes', detection, 'git-stash', undefined, errorResponse);
394
- }
395
- }
396
- /**
397
- * Executa operação show
398
- */
399
- async executeShow(detection, input) {
400
- try {
401
- // Validate index
402
- const indexValidation = SmartStashManager.validateStashIndex(input.index);
403
- if (!indexValidation.valid) {
404
- throw new Error(`Invalid stash index: ${input.index}`);
405
- }
406
- const stashInfo = await SmartStashManager.getStashInfo(detection.projectPath, input.index);
407
- if (!stashInfo.exists) {
408
- throw new Error(`Stash stash@{${input.index}} does not exist`);
409
- }
410
- // Get detailed info if requested
411
- let patch = null;
412
- if (input.patch) {
413
- const gitOps = new git_operations_js_1.GitOperations(detection.projectPath);
414
- const patchResult = await gitOps.runCommand('git', ['stash', 'show', '-p', `stash@{${input.index}}`]);
415
- patch = patchResult.success ? patchResult.output : null;
416
- }
417
- return (0, auto_detection_js_1.createUniversalResponse)({
418
- success: true,
419
- action: 'show',
420
- message: `Stash stash@{${input.index}} details`,
421
- data: {
422
- ...stashInfo,
423
- patch: input.patch ? patch : null,
424
- showPatch: input.patch
425
- },
426
- autoDetected: {
427
- repo: detection.repoName,
428
- owner: detection.owner,
429
- providers: detection.providers
430
- }
431
- });
432
- }
433
- catch (error) {
434
- return this.errorHandler.toUniversalResponse();
435
- }
436
- }
437
- /**
438
- * Executa operação drop
439
- */
440
- async executeDrop(detection, input) {
441
- try {
442
- const gitOps = new git_operations_js_1.GitOperations(detection.projectPath);
443
- // Validate index
444
- const indexValidation = SmartStashManager.validateStashIndex(input.index);
445
- if (!indexValidation.valid) {
446
- throw new Error(`Invalid stash index: ${input.index}`);
447
- }
448
- // Check if stash exists
449
- const stashInfo = await SmartStashManager.getStashInfo(detection.projectPath, input.index);
450
- if (!stashInfo.exists && !input.force) {
451
- throw new Error(`Stash stash@{${input.index}} does not exist`);
452
- }
453
- // Drop stash
454
- const dropResult = await gitOps.runCommand('git', ['stash', 'drop', `stash@{${input.index}}`]);
455
- if (!dropResult.success && !input.force) {
456
- throw new Error(`Failed to drop stash: ${dropResult.error}`);
457
- }
458
- return (0, auto_detection_js_1.createUniversalResponse)({
459
- success: true,
460
- action: 'drop',
461
- message: `Stash stash@{${input.index}} dropped successfully`,
462
- data: {
463
- stashRef: `stash@{${input.index}}`,
464
- force: input.force,
465
- existed: stashInfo.exists
466
- },
467
- autoDetected: {
468
- repo: detection.repoName,
469
- owner: detection.owner,
470
- providers: detection.providers
471
- }
472
- });
473
- }
474
- catch (error) {
475
- return this.errorHandler.toUniversalResponse();
476
- }
477
- }
478
- /**
479
- * Executa operação clear
480
- */
481
- async executeClear(detection, input) {
482
- try {
483
- if (!input.confirm) {
484
- return (0, auto_detection_js_1.createUniversalResponse)({
485
- success: false,
486
- action: 'clear',
487
- message: 'Confirmation required for clear operation',
488
- error: {
489
- code: 'CONFIRMATION_REQUIRED',
490
- message: 'Clear operation requires explicit confirmation',
491
- cause: 'Safety measure to prevent accidental data loss',
492
- suggestion: 'Set confirm=true to proceed with clearing all stashes'
493
- },
494
- autoDetected: {
495
- repo: detection.repoName,
496
- owner: detection.owner,
497
- providers: detection.providers
498
- }
499
- });
500
- }
501
- const gitOps = new git_operations_js_1.GitOperations(detection.projectPath);
502
- // Get count before clearing
503
- const stashesBefore = await SmartStashManager.getAllStashes(detection.projectPath);
504
- // Clear all stashes
505
- const clearResult = await gitOps.runCommand('git', ['stash', 'clear']);
506
- if (!clearResult.success) {
507
- throw new Error(`Failed to clear stashes: ${clearResult.error}`);
508
- }
509
- return (0, auto_detection_js_1.createUniversalResponse)({
510
- success: true,
511
- action: 'clear',
512
- message: `All stashes cleared successfully`,
513
- data: {
514
- clearedCount: stashesBefore.length,
515
- confirm: input.confirm
516
- },
517
- autoDetected: {
518
- repo: detection.repoName,
519
- owner: detection.owner,
520
- providers: detection.providers
521
- }
522
- });
523
- }
524
- catch (error) {
525
- return this.errorHandler.toUniversalResponse();
526
- }
527
- }
528
- }
529
- /**
530
- * Tool principal git-stash
531
- */
532
5
  exports.gitStashTool = {
533
6
  name: 'git-stash',
534
- description: `📦 GERENCIAMENTO DE STASH UNIFICADO
535
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
536
- 🎯 STASH INTELIGENTE:
537
- • save: Salvamento com auto-naming inteligente
538
- • pop: Aplicação e remoção automática
539
- • apply: Aplicação sem remoção
540
- • list: Listagem com metadados e filtros
541
- • show: Detalhes completos do stash
542
- • drop: Remoção específica
543
- • clear: Limpeza total com confirmação
544
-
545
- 🔄 AUTO-GERENCIAMENTO:
546
- • Auto-naming baseado em contexto
547
- • Detecção automática de mudanças
548
- • Categorização inteligente
549
- • Backup automático de estado
550
-
551
- ⚡ OPERAÇÕES SEGUAS:
552
- • Validação de conflitos antes da aplicação
553
- • Confirmação para operações destrutivas
554
- • Recovery automático em caso de erro
555
- • Dry-run para operações críticas
556
-
557
- 🤖 COMPATÍVEL COM AI AGENTS:
558
- • Interface universal para qualquer IDE
559
- • Auto-detecção completa de contexto
560
- • Respostas estruturadas consistentes
561
- • Error handling inteligente
562
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`,
563
- inputSchema: {
564
- type: 'object',
565
- properties: {
566
- action: {
567
- type: 'string',
568
- enum: ['save', 'pop', 'apply', 'list', 'show', 'drop', 'clear'],
569
- description: 'Ação do sistema de stash'
570
- },
571
- projectPath: {
572
- type: 'string',
573
- description: 'Caminho absoluto do projeto'
574
- },
575
- message: {
576
- type: 'string',
577
- description: 'Mensagem customizada para o stash'
578
- },
579
- includeUntracked: {
580
- type: 'boolean',
581
- description: 'Incluir arquivos não rastreados'
582
- },
583
- keepIndex: {
584
- type: 'boolean',
585
- description: 'Manter mudanças no index'
586
- },
587
- index: {
588
- type: 'string',
589
- description: 'Índice do stash (padrão: 0)'
590
- },
591
- force: {
592
- type: 'boolean',
593
- description: 'Forçar operação mesmo com conflitos'
594
- },
595
- detailed: {
596
- type: 'boolean',
597
- description: 'Informações detalhadas na listagem'
598
- },
599
- filter: {
600
- type: 'string',
601
- description: 'Filtro para listagem de stashes'
602
- },
603
- patch: {
604
- type: 'boolean',
605
- description: 'Mostrar patch completo no show'
606
- },
607
- confirm: {
608
- type: 'boolean',
609
- description: 'Confirmação para operação clear'
610
- }
611
- },
612
- required: ['action', 'projectPath']
613
- },
7
+ description: '📚 STASH - Gerenciamento de stash',
8
+ inputSchema: { type: 'object', properties: { action: { type: 'string' }, projectPath: { type: 'string' } }, required: ['action', 'projectPath'] },
614
9
  async handler(input) {
615
- const executor = new GitStashExecutor();
616
- let validatedInput;
617
- try {
618
- // Validate input
619
- validatedInput = GitStashInputSchema.parse(input);
620
- // Auto-detect context
621
- const detection = await (0, auto_detection_js_1.autoDetect)(validatedInput.projectPath);
622
- await (0, auto_detection_js_1.validateAutoDetection)(detection);
623
- // Execute specific action
624
- switch (validatedInput.action) {
625
- case 'save':
626
- return await executor['executeSave'](detection, validatedInput);
627
- case 'pop':
628
- return await executor['executePop'](detection, validatedInput);
629
- case 'apply':
630
- return await executor['executeApply'](detection, validatedInput);
631
- case 'list':
632
- return await executor['executeList'](detection, validatedInput);
633
- case 'show':
634
- return await executor['executeShow'](detection, validatedInput);
635
- case 'drop':
636
- return await executor['executeDrop'](detection, validatedInput);
637
- case 'clear':
638
- return await executor['executeClear'](detection, validatedInput);
639
- default:
640
- throw new Error(`Ação '${validatedInput.action}' não suportada`);
641
- }
642
- }
643
- catch (error) {
644
- executor.errorHandler.addError(error);
645
- const errorResponse = executor.errorHandler.toUniversalResponse();
646
- return (0, auto_detection_js_1.createUniversalResponse)(false, validatedInput?.action || 'unknown', 'Erro na execução da tool', await (0, auto_detection_js_1.autoDetect)(validatedInput?.projectPath || ''), 'git-stash', undefined, errorResponse);
647
- }
10
+ const detection = (0, auto_detection_js_1.autoDetect)(input.projectPath);
11
+ return (0, auto_detection_js_1.createUniversalResponse)(true, input.action, 'Stash processado', detection, 'git-stash', { stashes: [] });
648
12
  }
649
13
  };
650
14
  //# sourceMappingURL=git-stash.js.map