Skip to content

Feature/chewy standards tool #510

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

Closed

Conversation

cgoodloe-chwy
Copy link

Closes:

@Copilot Copilot AI review requested due to automatic review settings June 12, 2025 20:34
@cgoodloe-chwy cgoodloe-chwy requested a review from a team as a code owner June 12, 2025 20: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

Adds a new MCP tool for fetching development standards from Chewy’s GitHub repository, including registration, implementation, tests, and documentation updates.

  • Introduces GetChewyStandards tool and registers it in InitToolsets
  • Implements handler logic to fetch either an explicit path or the full repository tree
  • Adds comprehensive tests and updates the README

Reviewed Changes

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

File Description
pkg/github/tools.go Registers get_chewy_standards in the read-only toolset
pkg/github/repositories.go Implements GetChewyStandards handler and tool definition
pkg/github/repositories_test.go Adds tests for default, custom-path, and error cases
README.md Documents the new get_chewy_standards tool
Comments suppressed due to low confidence (3)

pkg/github/repositories_test.go:1968

  • Add a test case that supplies a custom ref value and assert that the handler uses that ref when fetching contents.
func Test_GetChewyStandards(t *testing.T) {

README.md:512

  • Align the bullet levels and indentation for the get_chewy_standards section so it matches the existing format, and ensure each sub-item is nested correctly.
- **get_chewy_standards** - Get development standards and guidelines from Chewy's repository

README.md:604

  • Remove the stray trailing `- `` at the end of the file; it appears to be an accidental leftover.
- `


if searchWholeRepo {
// Get the entire repository tree
tree, resp, err := client.Git.GetTree(ctx, owner, repo, "HEAD", true)
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

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

Use the user-provided ref parameter when fetching the repository tree instead of hardcoding "HEAD" so that branch/tag/commit references are respected.

Suggested change
tree, resp, err := client.Git.GetTree(ctx, owner, repo, "HEAD", true)
tree, resp, err := client.Git.GetTree(ctx, owner, repo, ref, true)

Copilot uses AI. Check for mistakes.

defer func() { _ = resp.Body.Close() }()
}

if resp.StatusCode == 200 && tree != nil {
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

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

Add a check for non-200 responses from GetTree (e.g. resp.StatusCode != http.StatusOK) and return an error, rather than continuing silently when the tree isn’t fetched.

Suggested change
if resp.StatusCode == 200 && tree != nil {
if resp.StatusCode != http.StatusOK {
return mcp.NewToolResultError(fmt.Sprintf("Failed to get repository tree: received status code %d", resp.StatusCode)), nil
}
if tree != nil {

Copilot uses AI. Check for mistakes.

continue
}
if resp != nil {
defer func() { _ = resp.Body.Close() }()
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

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

Avoid deferring resp.Body.Close() inside a loop; close the response body immediately after reading to prevent resource buildup.

Copilot uses AI. Check for mistakes.

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.

2 participants