Skip to content

Bash tool file changes not attributed to AI — only Write|Edit|MultiEdit are tracked #756

@DavidWangQQ

Description

@DavidWangQQ

Problem

When Claude Code modifies files via the Bash tool (e.g. cp, mv, code generators, build scripts), those changes are not attributed to AI. They silently appear as human-authored lines in git-ai blame and stats.

Root cause

The Claude Code hook installer (claude_code.rs) sets the PostToolUse matcher to Write|Edit|MultiEdit only. The Bash tool is not included, so no checkpoint is triggered when Bash modifies files.

Reproduction

  1. In a Claude Code session, ask Claude to copy or generate a file using Bash (e.g. cp foo.rs bar.rs)
  2. Commit the result
  3. Run git-ai show — prompts is empty {}
  4. Run git-ai blame — all lines show as human-authored

Expected behavior

File changes caused by the Bash tool should be attributed to AI, same as Write/Edit.

Suggested fix

  1. Add Bash to the PostToolUse matcher in claude_code.rs
  2. In ClaudePreset::run (agent_presets.rs), handle tool_name == "Bash" by setting edited_filepaths to None so the checkpoint falls back to scanning dirty files via git status, rather than relying on tool_input.file_path (which Bash doesn't provide)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions