@andrebuzeli/git-mcp 2.14.2 → 2.15.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 (36) hide show
  1. package/README.md +351 -346
  2. package/dist/server.js +1 -1
  3. package/dist/tools/gh-codespaces.d.ts +2 -2
  4. package/dist/tools/gh-deployments.d.ts +4 -4
  5. package/dist/tools/gh-gists.d.ts +2 -2
  6. package/dist/tools/gh-projects.d.ts +2 -2
  7. package/dist/tools/gh-sync.d.ts +2 -2
  8. package/dist/tools/gh-workflows.d.ts +4 -4
  9. package/dist/tools/git-archive.d.ts +4 -4
  10. package/dist/tools/git-branches.d.ts +2 -2
  11. package/dist/tools/git-cherry-pick.d.ts +2 -2
  12. package/dist/tools/git-commits.d.ts +4 -4
  13. package/dist/tools/git-files.d.ts +4 -4
  14. package/dist/tools/git-issues.d.ts +2 -2
  15. package/dist/tools/git-pulls.d.ts +2 -2
  16. package/dist/tools/git-releases.d.ts +2 -2
  17. package/dist/tools/git-remote.d.ts +4 -4
  18. package/dist/tools/git-repositories.d.ts +90 -21
  19. package/dist/tools/git-repositories.d.ts.map +1 -1
  20. package/dist/tools/git-repositories.js +88 -19
  21. package/dist/tools/git-repositories.js.map +1 -1
  22. package/dist/tools/git-stash.d.ts +2 -2
  23. package/dist/tools/git-submodule.d.ts +4 -4
  24. package/dist/tools/git-tags.d.ts +4 -4
  25. package/dist/tools/git-webhooks.d.ts +2 -2
  26. package/dist/tools/git-worktree.d.ts +4 -4
  27. package/dist/tools/repositories.d.ts +2 -2
  28. package/dist/utils/git-operations.d.ts +168 -0
  29. package/dist/utils/git-operations.d.ts.map +1 -0
  30. package/dist/utils/git-operations.js +760 -0
  31. package/dist/utils/git-operations.js.map +1 -0
  32. package/dist/utils/terminal-controller.d.ts +7 -7
  33. package/dist/utils/terminal-controller.d.ts.map +1 -1
  34. package/dist/utils/terminal-controller.js +202 -60
  35. package/dist/utils/terminal-controller.js.map +1 -1
  36. package/package.json +2 -2
@@ -0,0 +1,760 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.GitOperations = void 0;
37
+ const child_process_1 = require("child_process");
38
+ const util_1 = require("util");
39
+ const fs = __importStar(require("fs"));
40
+ const path = __importStar(require("path"));
41
+ const execAsync = (0, util_1.promisify)(child_process_1.exec);
42
+ /**
43
+ * Classe para operações Git locais - 100% auto-suficiente
44
+ * Implementa todas as operações Git sem depender de outras tools
45
+ */
46
+ class GitOperations {
47
+ projectPath;
48
+ constructor(projectPath) {
49
+ this.projectPath = projectPath;
50
+ }
51
+ /**
52
+ * Executa comando Git local
53
+ */
54
+ async runGitCommand(command, args = []) {
55
+ return new Promise((resolve) => {
56
+ const fullCommand = `git ${command} ${args.join(' ')}`;
57
+ (0, child_process_1.exec)(fullCommand, {
58
+ cwd: this.projectPath,
59
+ maxBuffer: 1024 * 1024 * 10 // 10MB buffer
60
+ }, (error, stdout, stderr) => {
61
+ resolve({
62
+ success: !error,
63
+ output: stdout.trim(),
64
+ error: stderr.trim(),
65
+ exitCode: error ? error.code || 1 : 0
66
+ });
67
+ });
68
+ });
69
+ }
70
+ /**
71
+ * Executa comando de sistema
72
+ */
73
+ async runSystemCommand(command, args = []) {
74
+ return new Promise((resolve) => {
75
+ const fullCommand = `${command} ${args.join(' ')}`;
76
+ (0, child_process_1.exec)(fullCommand, {
77
+ cwd: this.projectPath,
78
+ maxBuffer: 1024 * 1024 * 10 // 10MB buffer
79
+ }, (error, stdout, stderr) => {
80
+ resolve({
81
+ success: !error,
82
+ output: stdout.trim(),
83
+ error: stderr.trim(),
84
+ exitCode: error ? error.code || 1 : 0
85
+ });
86
+ });
87
+ });
88
+ }
89
+ /**
90
+ * Verifica se é um repositório Git
91
+ */
92
+ async isGitRepository() {
93
+ const result = await this.runGitCommand('rev-parse', ['--git-dir']);
94
+ return result.success;
95
+ }
96
+ /**
97
+ * Inicializa repositório Git
98
+ */
99
+ async initRepository(bare = false) {
100
+ const args = bare ? ['--bare'] : [];
101
+ return await this.runGitCommand('init', args);
102
+ }
103
+ /**
104
+ * Clona repositório
105
+ */
106
+ async cloneRepository(url, directory, options = {}) {
107
+ const args = [];
108
+ if (options.bare)
109
+ args.push('--bare');
110
+ if (options.depth)
111
+ args.push('--depth', options.depth.toString());
112
+ if (options.branch)
113
+ args.push('--branch', options.branch);
114
+ if (options.singleBranch)
115
+ args.push('--single-branch');
116
+ if (options.recursive)
117
+ args.push('--recursive');
118
+ args.push(url);
119
+ if (directory)
120
+ args.push(directory);
121
+ return await this.runGitCommand('clone', args);
122
+ }
123
+ /**
124
+ * Adiciona arquivos ao staging
125
+ */
126
+ async addFiles(files = ['.']) {
127
+ return await this.runGitCommand('add', files);
128
+ }
129
+ /**
130
+ * Remove arquivos do staging
131
+ */
132
+ async resetFiles(files = []) {
133
+ return await this.runGitCommand('reset', files);
134
+ }
135
+ /**
136
+ * Faz commit
137
+ */
138
+ async commit(message, options = {}) {
139
+ const args = [];
140
+ if (options.amend)
141
+ args.push('--amend');
142
+ if (options.noVerify)
143
+ args.push('--no-verify');
144
+ if (options.allowEmpty)
145
+ args.push('--allow-empty');
146
+ args.push('-m', message);
147
+ return await this.runGitCommand('commit', args);
148
+ }
149
+ /**
150
+ * Push para remote
151
+ */
152
+ async push(remote = 'origin', branch, options = {}) {
153
+ const args = [];
154
+ if (options.force)
155
+ args.push('--force');
156
+ if (options.setUpstream)
157
+ args.push('--set-upstream');
158
+ if (options.tags)
159
+ args.push('--tags');
160
+ if (options.all)
161
+ args.push('--all');
162
+ args.push(remote);
163
+ if (branch)
164
+ args.push(branch);
165
+ return await this.runGitCommand('push', args);
166
+ }
167
+ /**
168
+ * Pull do remote
169
+ */
170
+ async pull(remote = 'origin', branch, options = {}) {
171
+ const args = [];
172
+ if (options.rebase)
173
+ args.push('--rebase');
174
+ if (options.ffOnly)
175
+ args.push('--ff-only');
176
+ if (options.noEdit)
177
+ args.push('--no-edit');
178
+ args.push(remote);
179
+ if (branch)
180
+ args.push(branch);
181
+ return await this.runGitCommand('pull', args);
182
+ }
183
+ /**
184
+ * Fetch do remote
185
+ */
186
+ async fetch(remote, options = {}) {
187
+ const args = [];
188
+ if (options.all)
189
+ args.push('--all');
190
+ if (options.tags)
191
+ args.push('--tags');
192
+ if (options.prune)
193
+ args.push('--prune');
194
+ if (options.depth)
195
+ args.push('--depth', options.depth.toString());
196
+ if (remote)
197
+ args.push(remote);
198
+ return await this.runGitCommand('fetch', args);
199
+ }
200
+ /**
201
+ * Lista branches
202
+ */
203
+ async listBranches(options = {}) {
204
+ const args = [];
205
+ if (options.all)
206
+ args.push('-a');
207
+ if (options.remote)
208
+ args.push('-r');
209
+ if (options.merged)
210
+ args.push('--merged');
211
+ if (options.noMerged)
212
+ args.push('--no-merged');
213
+ return await this.runGitCommand('branch', args);
214
+ }
215
+ /**
216
+ * Cria branch
217
+ */
218
+ async createBranch(name, startPoint, options = {}) {
219
+ const args = [];
220
+ if (options.force)
221
+ args.push('-f');
222
+ if (options.track)
223
+ args.push('--track');
224
+ if (options.noTrack)
225
+ args.push('--no-track');
226
+ args.push(name);
227
+ if (startPoint)
228
+ args.push(startPoint);
229
+ return await this.runGitCommand('branch', args);
230
+ }
231
+ /**
232
+ * Deleta branch
233
+ */
234
+ async deleteBranch(name, options = {}) {
235
+ const args = [];
236
+ if (options.force)
237
+ args.push('-D');
238
+ else
239
+ args.push('-d');
240
+ args.push(name);
241
+ return await this.runGitCommand('branch', args);
242
+ }
243
+ /**
244
+ * Checkout branch/commit
245
+ */
246
+ async checkout(target, options = {}) {
247
+ const args = [];
248
+ if (options.force)
249
+ args.push('-f');
250
+ if (options.create)
251
+ args.push('-b');
252
+ if (options.track)
253
+ args.push('--track');
254
+ args.push(target);
255
+ return await this.runGitCommand('checkout', args);
256
+ }
257
+ /**
258
+ * Merge branches
259
+ */
260
+ async merge(branch, options = {}) {
261
+ const args = [];
262
+ if (options.noCommit)
263
+ args.push('--no-commit');
264
+ if (options.squash)
265
+ args.push('--squash');
266
+ if (options.noEdit)
267
+ args.push('--no-edit');
268
+ if (options.strategy)
269
+ args.push('-s', options.strategy);
270
+ args.push(branch);
271
+ return await this.runGitCommand('merge', args);
272
+ }
273
+ /**
274
+ * Rebase
275
+ */
276
+ async rebase(target, options = {}) {
277
+ const args = [];
278
+ if (options.interactive)
279
+ args.push('-i');
280
+ if (options.onto)
281
+ args.push('--onto', options.onto);
282
+ if (options.continue)
283
+ args.push('--continue');
284
+ if (options.abort)
285
+ args.push('--abort');
286
+ if (options.skip)
287
+ args.push('--skip');
288
+ args.push(target);
289
+ return await this.runGitCommand('rebase', args);
290
+ }
291
+ /**
292
+ * Reset
293
+ */
294
+ async reset(target, options = {}) {
295
+ const args = [];
296
+ if (options.mode)
297
+ args.push(`--${options.mode}`);
298
+ if (options.soft)
299
+ args.push('--soft');
300
+ if (options.mixed)
301
+ args.push('--mixed');
302
+ if (options.hard)
303
+ args.push('--hard');
304
+ args.push(target);
305
+ return await this.runGitCommand('reset', args);
306
+ }
307
+ /**
308
+ * Revert commit
309
+ */
310
+ async revert(commit, options = {}) {
311
+ const args = [];
312
+ if (options.noCommit)
313
+ args.push('--no-commit');
314
+ if (options.edit)
315
+ args.push('--edit');
316
+ if (options.mainline)
317
+ args.push('-m', options.mainline.toString());
318
+ args.push(commit);
319
+ return await this.runGitCommand('revert', args);
320
+ }
321
+ /**
322
+ * Cherry-pick
323
+ */
324
+ async cherryPick(commit, options = {}) {
325
+ const args = [];
326
+ if (options.noCommit)
327
+ args.push('--no-commit');
328
+ if (options.edit)
329
+ args.push('--edit');
330
+ if (options.mainline)
331
+ args.push('-m', options.mainline.toString());
332
+ if (options.continue)
333
+ args.push('--continue');
334
+ if (options.abort)
335
+ args.push('--abort');
336
+ if (options.skip)
337
+ args.push('--skip');
338
+ args.push(commit);
339
+ return await this.runGitCommand('cherry-pick', args);
340
+ }
341
+ /**
342
+ * Stash
343
+ */
344
+ async stash(action = 'push', options = {}) {
345
+ const args = [];
346
+ if (action === 'push') {
347
+ if (options.message)
348
+ args.push('-m', options.message);
349
+ if (options.includeUntracked)
350
+ args.push('-u');
351
+ if (options.keepIndex)
352
+ args.push('--keep-index');
353
+ }
354
+ else if (action === 'pop') {
355
+ args.push('pop');
356
+ if (options.index)
357
+ args.push('--index');
358
+ }
359
+ else if (action === 'apply') {
360
+ args.push('apply');
361
+ if (options.index)
362
+ args.push('--index');
363
+ }
364
+ else if (action === 'list') {
365
+ args.push('list');
366
+ }
367
+ else if (action === 'show') {
368
+ args.push('show');
369
+ if (options.patch)
370
+ args.push('-p');
371
+ }
372
+ else if (action === 'drop') {
373
+ args.push('drop');
374
+ }
375
+ else if (action === 'clear') {
376
+ args.push('clear');
377
+ }
378
+ return await this.runGitCommand('stash', args);
379
+ }
380
+ /**
381
+ * Tag operations
382
+ */
383
+ async tag(name, options = {}) {
384
+ const args = [];
385
+ if (options.list)
386
+ args.push('-l');
387
+ if (options.delete)
388
+ args.push('-d');
389
+ if (options.force)
390
+ args.push('-f');
391
+ if (options.annotate)
392
+ args.push('-a');
393
+ if (options.message)
394
+ args.push('-m', options.message);
395
+ if (options.sign)
396
+ args.push('-s');
397
+ if (name)
398
+ args.push(name);
399
+ return await this.runGitCommand('tag', args);
400
+ }
401
+ /**
402
+ * Log
403
+ */
404
+ async log(options = {}) {
405
+ const args = [];
406
+ if (options.oneline)
407
+ args.push('--oneline');
408
+ if (options.graph)
409
+ args.push('--graph');
410
+ if (options.decorate)
411
+ args.push('--decorate');
412
+ if (options.all)
413
+ args.push('--all');
414
+ if (options.branches)
415
+ args.push('--branches');
416
+ if (options.tags)
417
+ args.push('--tags');
418
+ if (options.remotes)
419
+ args.push('--remotes');
420
+ if (options.maxCount)
421
+ args.push('-n', options.maxCount.toString());
422
+ if (options.since)
423
+ args.push('--since', options.since);
424
+ if (options.until)
425
+ args.push('--until', options.until);
426
+ if (options.author)
427
+ args.push('--author', options.author);
428
+ if (options.grep)
429
+ args.push('--grep', options.grep);
430
+ if (options.path)
431
+ args.push('--', options.path);
432
+ return await this.runGitCommand('log', args);
433
+ }
434
+ /**
435
+ * Status
436
+ */
437
+ async status(options = {}) {
438
+ const args = [];
439
+ if (options.short)
440
+ args.push('--short');
441
+ if (options.branch)
442
+ args.push('--branch');
443
+ if (options.porcelain)
444
+ args.push('--porcelain');
445
+ if (options.ignored)
446
+ args.push('--ignored');
447
+ if (options.untracked)
448
+ args.push('--untracked-files', options.untracked);
449
+ return await this.runGitCommand('status', args);
450
+ }
451
+ /**
452
+ * Diff
453
+ */
454
+ async diff(options = {}) {
455
+ const args = [];
456
+ if (options.cached)
457
+ args.push('--cached');
458
+ if (options.staged)
459
+ args.push('--staged');
460
+ if (options.nameOnly)
461
+ args.push('--name-only');
462
+ if (options.nameStatus)
463
+ args.push('--name-status');
464
+ if (options.stat)
465
+ args.push('--stat');
466
+ if (options.patch)
467
+ args.push('-p');
468
+ if (options.unified)
469
+ args.push('-U', options.unified.toString());
470
+ if (options.commit1)
471
+ args.push(options.commit1);
472
+ if (options.commit2)
473
+ args.push(options.commit2);
474
+ if (options.path)
475
+ args.push('--', options.path);
476
+ return await this.runGitCommand('diff', args);
477
+ }
478
+ /**
479
+ * Remote operations
480
+ */
481
+ async remote(action, name, url) {
482
+ const args = [action];
483
+ if (name)
484
+ args.push(name);
485
+ if (url)
486
+ args.push(url);
487
+ return await this.runGitCommand('remote', args);
488
+ }
489
+ /**
490
+ * Config operations
491
+ */
492
+ async config(key, value, options = {}) {
493
+ const args = [];
494
+ if (options.global)
495
+ args.push('--global');
496
+ if (options.local)
497
+ args.push('--local');
498
+ if (options.system)
499
+ args.push('--system');
500
+ if (options.unset)
501
+ args.push('--unset');
502
+ if (options.list)
503
+ args.push('--list');
504
+ if (options.get)
505
+ args.push('--get');
506
+ if (options.getAll)
507
+ args.push('--get-all');
508
+ if (key)
509
+ args.push(key);
510
+ if (value)
511
+ args.push(value);
512
+ return await this.runGitCommand('config', args);
513
+ }
514
+ /**
515
+ * Submodule operations
516
+ */
517
+ async submodule(action, options = {}) {
518
+ const args = [action];
519
+ if (options.init)
520
+ args.push('--init');
521
+ if (options.recursive)
522
+ args.push('--recursive');
523
+ if (options.remote)
524
+ args.push('--remote');
525
+ if (options.merge)
526
+ args.push('--merge');
527
+ if (options.rebase)
528
+ args.push('--rebase');
529
+ if (options.force)
530
+ args.push('--force');
531
+ if (options.path)
532
+ args.push(options.path);
533
+ if (options.url)
534
+ args.push(options.url);
535
+ return await this.runGitCommand('submodule', args);
536
+ }
537
+ /**
538
+ * Worktree operations
539
+ */
540
+ async worktree(action, options = {}) {
541
+ const args = [action];
542
+ if (options.add)
543
+ args.push('add');
544
+ if (options.remove)
545
+ args.push('remove');
546
+ if (options.list)
547
+ args.push('list');
548
+ if (options.prune)
549
+ args.push('prune');
550
+ if (options.move)
551
+ args.push('move');
552
+ if (options.repair)
553
+ args.push('repair');
554
+ if (options.path)
555
+ args.push(options.path);
556
+ if (options.branch)
557
+ args.push(options.branch);
558
+ return await this.runGitCommand('worktree', args);
559
+ }
560
+ /**
561
+ * Archive operations
562
+ */
563
+ async archive(format, treeish, output, options = {}) {
564
+ const args = [];
565
+ if (options.remote)
566
+ args.push('--remote');
567
+ if (options.exec)
568
+ args.push('--exec', options.exec);
569
+ if (options.output)
570
+ args.push('--output', options.output);
571
+ if (options.prefix)
572
+ args.push('--prefix', options.prefix);
573
+ if (options.worktreeAttributes)
574
+ args.push('--worktree-attributes');
575
+ args.push(format, treeish);
576
+ if (output)
577
+ args.push(output);
578
+ return await this.runGitCommand('archive', args);
579
+ }
580
+ /**
581
+ * Bundle operations
582
+ */
583
+ async bundle(action, options = {}) {
584
+ const args = [action];
585
+ if (options.verify)
586
+ args.push('--verify');
587
+ if (options.listHeads)
588
+ args.push('--list-heads');
589
+ if (options.unbundle)
590
+ args.push('--unbundle');
591
+ if (options.create)
592
+ args.push('create');
593
+ if (options.file)
594
+ args.push(options.file);
595
+ if (options.revlist)
596
+ args.push(options.revlist);
597
+ return await this.runGitCommand('bundle', args);
598
+ }
599
+ /**
600
+ * File operations
601
+ */
602
+ async readFile(filePath) {
603
+ try {
604
+ const fullPath = path.join(this.projectPath, filePath);
605
+ const content = fs.readFileSync(fullPath, 'utf-8');
606
+ return {
607
+ success: true,
608
+ message: 'Arquivo lido com sucesso',
609
+ data: { content, path: filePath }
610
+ };
611
+ }
612
+ catch (error) {
613
+ return {
614
+ success: false,
615
+ message: 'Erro ao ler arquivo',
616
+ error: error instanceof Error ? error.message : String(error)
617
+ };
618
+ }
619
+ }
620
+ async writeFile(filePath, content) {
621
+ try {
622
+ const fullPath = path.join(this.projectPath, filePath);
623
+ const dir = path.dirname(fullPath);
624
+ // Cria diretório se não existir
625
+ if (!fs.existsSync(dir)) {
626
+ fs.mkdirSync(dir, { recursive: true });
627
+ }
628
+ fs.writeFileSync(fullPath, content, 'utf-8');
629
+ return {
630
+ success: true,
631
+ message: 'Arquivo escrito com sucesso',
632
+ data: { path: filePath, size: content.length }
633
+ };
634
+ }
635
+ catch (error) {
636
+ return {
637
+ success: false,
638
+ message: 'Erro ao escrever arquivo',
639
+ error: error instanceof Error ? error.message : String(error)
640
+ };
641
+ }
642
+ }
643
+ async deleteFile(filePath) {
644
+ try {
645
+ const fullPath = path.join(this.projectPath, filePath);
646
+ fs.unlinkSync(fullPath);
647
+ return {
648
+ success: true,
649
+ message: 'Arquivo deletado com sucesso',
650
+ data: { path: filePath }
651
+ };
652
+ }
653
+ catch (error) {
654
+ return {
655
+ success: false,
656
+ message: 'Erro ao deletar arquivo',
657
+ error: error instanceof Error ? error.message : String(error)
658
+ };
659
+ }
660
+ }
661
+ async listFiles(directory = '.') {
662
+ try {
663
+ const fullPath = path.join(this.projectPath, directory);
664
+ const files = fs.readdirSync(fullPath, { withFileTypes: true });
665
+ const fileList = files.map(file => ({
666
+ name: file.name,
667
+ type: file.isDirectory() ? 'directory' : 'file',
668
+ path: path.join(directory, file.name)
669
+ }));
670
+ return {
671
+ success: true,
672
+ message: 'Arquivos listados com sucesso',
673
+ data: { files: fileList, directory }
674
+ };
675
+ }
676
+ catch (error) {
677
+ return {
678
+ success: false,
679
+ message: 'Erro ao listar arquivos',
680
+ error: error instanceof Error ? error.message : String(error)
681
+ };
682
+ }
683
+ }
684
+ async createDirectory(dirPath) {
685
+ try {
686
+ const fullPath = path.join(this.projectPath, dirPath);
687
+ fs.mkdirSync(fullPath, { recursive: true });
688
+ return {
689
+ success: true,
690
+ message: 'Diretório criado com sucesso',
691
+ data: { path: dirPath }
692
+ };
693
+ }
694
+ catch (error) {
695
+ return {
696
+ success: false,
697
+ message: 'Erro ao criar diretório',
698
+ error: error instanceof Error ? error.message : String(error)
699
+ };
700
+ }
701
+ }
702
+ async deleteDirectory(dirPath) {
703
+ try {
704
+ const fullPath = path.join(this.projectPath, dirPath);
705
+ fs.rmSync(fullPath, { recursive: true, force: true });
706
+ return {
707
+ success: true,
708
+ message: 'Diretório deletado com sucesso',
709
+ data: { path: dirPath }
710
+ };
711
+ }
712
+ catch (error) {
713
+ return {
714
+ success: false,
715
+ message: 'Erro ao deletar diretório',
716
+ error: error instanceof Error ? error.message : String(error)
717
+ };
718
+ }
719
+ }
720
+ /**
721
+ * Terminal operations
722
+ */
723
+ async runCommand(command, args = []) {
724
+ return await this.runSystemCommand(command, args);
725
+ }
726
+ /**
727
+ * Network operations
728
+ */
729
+ async testConnection(url) {
730
+ // Testa conectividade básica
731
+ const result = await this.runSystemCommand('ping', ['-c', '1', url]);
732
+ return result;
733
+ }
734
+ /**
735
+ * Utility operations
736
+ */
737
+ async getCurrentDirectory() {
738
+ return this.projectPath;
739
+ }
740
+ async changeDirectory(newPath) {
741
+ this.projectPath = newPath;
742
+ }
743
+ async getGitInfo() {
744
+ const [status, log, branches, remotes] = await Promise.all([
745
+ this.status(),
746
+ this.log({ maxCount: 1, oneline: true }),
747
+ this.listBranches(),
748
+ this.remote('show')
749
+ ]);
750
+ return {
751
+ status: status.output,
752
+ lastCommit: log.output,
753
+ branches: branches.output,
754
+ remotes: remotes.output,
755
+ isGitRepo: await this.isGitRepository()
756
+ };
757
+ }
758
+ }
759
+ exports.GitOperations = GitOperations;
760
+ //# sourceMappingURL=git-operations.js.map