- Notifications
You must be signed in to change notification settings - Fork3.2k
feat: add get_file_blame tool for retrieving git blame information#1538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
This PR adds a newget_file_blame tool that enables users to retrieve git blame information for files in GitHub repositories using the GraphQL API. The implementation includes comprehensive test coverage, proper error handling, and complete documentation updates.
Key Changes
- Added
GetFileBlamefunction that queries GitHub's GraphQL API to retrieve blame information showing who last modified each line of a file - Integrated the new tool into the default toolset alongside other repository management tools
- Created comprehensive unit tests covering successful operations, error scenarios, and edge cases like missing default branches
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/repositories.go | Implements the GetFileBlame tool with GraphQL queries for default branch resolution and blame data retrieval, including proper type conversions and JSON response formatting |
| pkg/github/tools.go | Registers GetFileBlame in the DefaultToolsetGroup for availability in the standard tool collection |
| pkg/github/repositories_test.go | Adds comprehensive test coverage including tool schema validation, default branch handling, specific ref queries, and error scenarios |
| pkg/github/toolsnaps/get_file_blame.snap | Tool schema snapshot documenting the API surface with ReadOnly annotation |
| README.md | Documents the new tool with parameter descriptions and usage information |
1222293 to8e494d9CompareMayorFaj commentedDec 5, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This pull request adds a new tool for retrieving git blame information for files in a GitHub repository, along with comprehensive tests and documentation updates. The main focus is on enabling users to see who last modified each line in a file, with support for specifying branches, tags, or commit SHAs.
New Git Blame Tool Integration
get_file_blametool to the codebase, which uses the GitHub GraphQL API to fetch blame information for a file, including author details, commit SHA, message, and line ranges. The tool supports specifying the repository owner, name, file path, and git reference, defaulting to the repository's default branch if not provided. (pkg/github/repositories.go)get_file_blametool in the default toolset group so it is available for use alongside other repository tools. (pkg/github/tools.go)Documentation and Tool Snapshots
README.mdto document the newget_file_blametool, including its parameters and usage.get_file_blamefor validation and testing purposes. (pkg/github/__toolsnaps__/get_file_blame.snap)Closes:#504