Skip to content

Enhance get_pull_request_diff tool with pagination and file filtering options #627

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kaovilai
Copy link

@kaovilai kaovilai commented Jul 1, 2025

Signed-off-by: Tiger Kaovilai [email protected]

Closes: #625

@kaovilai kaovilai marked this pull request as ready for review July 2, 2025 00:05
@Copilot Copilot AI review requested due to automatic review settings July 2, 2025 00:05
@kaovilai kaovilai requested a review from a team as a code owner July 2, 2025 00:05
Copilot

This comment was marked as outdated.

@kaovilai kaovilai requested a review from Copilot July 2, 2025 01:32
Copilot

This comment was marked as outdated.

@kaovilai kaovilai requested a review from Copilot July 2, 2025 01:34
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Enhance the get_pull_request_diff tool by adding pagination and file-filtering capabilities to handle large pull requests efficiently.

  • Introduces new parameters: fileList, files, pathPrefix, page, and perPage
  • Implements paginated list mode and specific-file/path-prefix diff modes
  • Updates tests, toolsnap, and README to cover new functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pkg/github/pullrequests.go Added imports, parameters, and logic for pagination and filters
pkg/github/pullrequests_test.go Added tests for file list mode with pagination, path prefix, specific files, and full diff
pkg/github/toolsnaps/get_pull_request_diff.snap Updated snapshot to include new input schema properties
README.md Documented new parameters (fileList, files, pathPrefix, page, perPage)
Comments suppressed due to low confidence (4)

pkg/github/pullrequests.go:1689

  • The branch handling pathPrefix without fileList isn’t covered by tests; add a test case invoking pathPrefix alone to verify correct diff output.
			if len(params.Files) > 0 || params.PathPrefix != "" {

pkg/github/pullrequests.go:9

  • The code uses json.Marshal in the fileList block but the import for "encoding/json" is missing; add import "encoding/json".
	"strings"

pkg/github/pullrequests.go:1694

  • Each call to ListFiles returns a Response with an open body; add defer resp.Body.Close() inside the loop to avoid leaking HTTP connections.
					files, resp, err := client.PullRequests.ListFiles(ctx, params.Owner, params.Repo, int(params.PullNumber), opts)

pkg/github/pullrequests.go:1660

  • [nitpick] Filtering by PathPrefix is duplicated in both the fileList and specific-files branches; consider extracting a reusable helper function.
				if params.PathPrefix != "" {

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.

Add pagination support for get_pull_request_diff to handle large PRs
1 participant