feat(mcp): Git Operations MCP - Git Wrapper Implementation #106

Open
opened 2026-01-06 19:19:02 +00:00 by cardosofelipe · 0 comments

Parent Issue

Part of #58 (Git Operations MCP Server)

Summary

Implement the GitWrapper class using gitpython library for all local git operations.

Tasks

GitWrapper Class (git_wrapper.py)

  • Create GitWrapper class with workspace path
  • Implement clone(repo_url, branch) method
  • Implement checkout(branch) method
  • Implement create_branch(branch_name, base) method
  • Implement delete_branch(branch_name) method
  • Implement list_branches() method (local and remote)
  • Implement status() method (modified, staged, untracked)
  • Implement add(files) method
  • Implement commit(message, author) method
  • Implement push(branch, force) method
  • Implement pull(branch) method
  • Implement fetch() method
  • Implement diff(base, target) method
  • Implement log(limit) method
  • Implement reset(commit, mode) method

Branch Naming

  • Implement branch name validation (feature/, bugfix/, hotfix/)
  • Add auto-correction suggestions

Conflict Detection

  • Detect merge conflicts before operations
  • Report conflicting files
  • Provide conflict markers in output

Error Handling

  • Map gitpython exceptions to our exception types
  • Handle authentication errors gracefully
  • Handle large file detection (.gitattributes, LFS)

Testing

  • Unit tests for all git operations
  • Integration tests with real git repository
  • Test conflict detection
  • Test error handling
  • Achieve >90% coverage

Acceptance Criteria

  • All git operations work correctly
  • Branch naming conventions enforced
  • Conflict detection working
  • All tests pass with >90% coverage
  • Error messages are clear and actionable

Dependencies

  • Depends on: #64 (Foundation)

Labels

  • mcp
  • phase-2
  • backend
## Parent Issue Part of #58 (Git Operations MCP Server) ## Summary Implement the GitWrapper class using gitpython library for all local git operations. ## Tasks ### GitWrapper Class (`git_wrapper.py`) - [ ] Create `GitWrapper` class with workspace path - [ ] Implement `clone(repo_url, branch)` method - [ ] Implement `checkout(branch)` method - [ ] Implement `create_branch(branch_name, base)` method - [ ] Implement `delete_branch(branch_name)` method - [ ] Implement `list_branches()` method (local and remote) - [ ] Implement `status()` method (modified, staged, untracked) - [ ] Implement `add(files)` method - [ ] Implement `commit(message, author)` method - [ ] Implement `push(branch, force)` method - [ ] Implement `pull(branch)` method - [ ] Implement `fetch()` method - [ ] Implement `diff(base, target)` method - [ ] Implement `log(limit)` method - [ ] Implement `reset(commit, mode)` method ### Branch Naming - [ ] Implement branch name validation (feature/, bugfix/, hotfix/) - [ ] Add auto-correction suggestions ### Conflict Detection - [ ] Detect merge conflicts before operations - [ ] Report conflicting files - [ ] Provide conflict markers in output ### Error Handling - [ ] Map gitpython exceptions to our exception types - [ ] Handle authentication errors gracefully - [ ] Handle large file detection (.gitattributes, LFS) ### Testing - [ ] Unit tests for all git operations - [ ] Integration tests with real git repository - [ ] Test conflict detection - [ ] Test error handling - [ ] Achieve >90% coverage ## Acceptance Criteria - [ ] All git operations work correctly - [ ] Branch naming conventions enforced - [ ] Conflict detection working - [ ] All tests pass with >90% coverage - [ ] Error messages are clear and actionable ## Dependencies - Depends on: #64 (Foundation) ## Labels - mcp - phase-2 - backend
Sign in to join this conversation.