Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

use better raw file handling and return resources#505

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

Merged
SamMorrowDrums merged 1 commit intomainfromraw-file-api
Jun 12, 2025

Conversation

SamMorrowDrums
Copy link
Collaborator

@SamMorrowDrumsSamMorrowDrums commentedJun 12, 2025
edited
Loading

Closes#372

This PR attempts to address some initially poor choices for how do handle files and resources.

  • Adds an API adaptor for raw file API
  • uses text response for text files, and base64 response for binary
  • Adds URL parsing so it works in all supported environments
  • Uses resource responses (getting much better results in VSCode for example), we already have the resource handles for these and resources are the right pattern for this.
  • Drops directory handling from the template resources (it just doesn't work well)
  • Keeps the directory handling as a fallback for the tool version of get repo content.
  • Adds mocks for the new URI patterns
  • Tests it all

image

image

image

#497
CC@ko1ynnky I decided to go a bit further and getting very good results now. Thanks for the encouragement.

rdmueller reacted with heart emoji
@CopilotCopilotAI review requested due to automatic review settingsJune 12, 2025 01:58
@SamMorrowDrumsSamMorrowDrums requested a review froma team as acode ownerJune 12, 2025 01:58
Copy link
Contributor

@CopilotCopilotAI 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

This PR refactors file handling by introducing a dedicated raw content client and updating existing resource and tool handlers to return structured text or blob resources. It also updates the server bootstrap, default toolset configuration, mocks, and tests to support the new raw client, and adds missing third-party LICENSE files and updated license listings.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
third-party/*/LICENSEAdded missing LICENSE files for vendored third-party dependencies.
third-party-licenses.{windows,linux,darwin}.mdUpdated markdown lists to include new BSD-3-Clause dependencies.
pkg/raw/raw.go, pkg/raw/raw_mock.go, pkg/raw/raw_test.goNewraw package: client adapter, mocks, and tests for raw API.
pkg/github/repository_resource.go, pkg/github/repository_resource_test.goUpdated resource handler to use raw client and return resources.
pkg/github/repositories.go, pkg/github/repositories_test.goUpdatedGetFileContents tool to fetch via raw client and return resource results.
pkg/github/tools.go, pkg/github/server_test.goInjectedgetRawClient into default toolset and server tests.
internal/ghmcp/server.goConfiguredrawURL in API host andgetRawClient in server setup.
pkg/github/helper_test.goNew test helpers for extracting text and blob resources.
Comments suppressed due to low confidence (2)

pkg/raw/raw.go:22

  • TheSemanticSearchRequest type is unrelated to raw file handling and is unused; consider removing it to keep the package focused.
type SemanticSearchRequest struct {

pkg/github/repository_resource.go:176

  • The code usesbase64.StdEncoding.EncodeToString but theencoding/base64 package is not imported; addimport "encoding/base64".
Blob:     base64.StdEncoding.EncodeToString(content),

tonytrg
tonytrg previously approved these changesJun 12, 2025
@SamMorrowDrumsSamMorrowDrums merged commit3e32f75 intomainJun 12, 2025
16 checks passed
@SamMorrowDrumsSamMorrowDrums deleted the raw-file-api branchJune 12, 2025 12:54
@ko1ynnky
Copy link

@SamMorrowDrums
Thanks Sam! Great work taking this much further - your solution is way better than mine. Glad I could provide some encouragement to get the ball rolling!

rdmueller reacted with thumbs up emojiSamMorrowDrums reacted with heart emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@tonytrgtonytrgtonytrg approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

get_file_contents tool should have non-base64 option
3 participants
@SamMorrowDrums@ko1ynnky@tonytrg

[8]ページ先頭

©2009-2025 Movatter.jp