Skip to content

chore(tools): Add git_blame tool to project tooling#631

Merged
JeanMertz merged 3 commits into
mainfrom
prr198
May 13, 2026
Merged

chore(tools): Add git_blame tool to project tooling#631
JeanMertz merged 3 commits into
mainfrom
prr198

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

Implements a git_blame tool backed by git blame --porcelain,
exposing per-line authorship over a bounded line range to the assistant
during pair-programming sessions.

Output is grouped by commit: consecutive lines that share the same
blamed commit are collapsed into a single hunk, so token cost scales
with the number of distinct commits rather than the number of lines.
Each hunk carries hash, short_hash, author, date, summary, and
— when present — a previous field containing the commit that owned
those lines before the current change. That lets the assistant drill
back through line history with a follow-up git_show or
git_diff_commit call without an extra blame invocation.

The range is capped at 200 lines per call. Validation rejects zero-based
start lines, inverted ranges, and oversized windows with a clear error
message before any subprocess is spawned. An optional revision
parameter allows blaming at any commit, tag, or branch;
ignore_whitespace passes -w through to git.

The tool is wired into the MCP tool registry and added to the
git-reading skill so it is available whenever that skill is active.

Implements a `git_blame` tool backed by `git blame --porcelain`,
exposing per-line authorship over a bounded line range to the assistant
during pair-programming sessions.

Output is grouped by commit: consecutive lines that share the same
blamed commit are collapsed into a single hunk, so token cost scales
with the number of distinct commits rather than the number of lines.
Each hunk carries `hash`, `short_hash`, `author`, `date`, `summary`, and
— when present — a `previous` field containing the commit that owned
those lines before the current change. That lets the assistant drill
back through line history with a follow-up `git_show` or
`git_diff_commit` call without an extra blame invocation.

The range is capped at 200 lines per call. Validation rejects zero-based
start lines, inverted ranges, and oversized windows with a clear error
message before any subprocess is spawned. An optional `revision`
parameter allows blaming at any commit, tag, or branch;
`ignore_whitespace` passes `-w` through to git.

The tool is wired into the MCP tool registry and added to the
git-reading skill so it is available whenever that skill is active.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz changed the base branch from prr197 to main May 11, 2026 20:11
JeanMertz added 2 commits May 13, 2026 14:31
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 6d76819 into main May 13, 2026
14 checks passed
@JeanMertz JeanMertz deleted the prr198 branch May 13, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant