atxtechbro / atxtechbro/dotfiles

fix[mcp-git]: git_add fails when staging deleted files

Open
#586 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
27
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## User Story
As an AI agent trying to stage all changes including file deletions during a refactoring task, I was blocked because `mcp__git__git_add` throws an error when trying to add deleted files to the staging area.

## Current Behavior
When calling `mcp__git__git_add` with a list of files that includes deleted files:
```
Error: Tool execution failed: [Errno 2] No such file or directory: '.claude/settings/claude-code-defaults.json'
```

## Expected Behavior
The tool should handle deleted files gracefully, similar to how `git add` works on the command line. When given a deleted file path, it should stage the deletion.

## Reproduction Steps
1. Delete a tracked file: `rm tracked-file.txt`
2. Try to stage it: `mcp__git__git_add` with `files: ["tracked-file.txt"]`
3. Observe error instead of staging the deletion

## Workaround
Currently have to fall back to bash command: `git add -A` or `git add -u`

## Suggested Solutions
1. Check if file exists before trying to add, and use appropriate git command for deletions
2. Update tool description to clarify it only works with existing files (if this is intended behavior)
3. Add a separate parameter or tool for staging deletions

## Context
Discovered during PR #585 when migrating settings and removing old configuration files.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the implementation of mcp__git__git_add and reproduce the failure with a tracked file that has been deleted. Compare its handling with git add -A or git add -u, then verify that passing a deleted path stages the deletion without an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, shell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.