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

pretty print json#114

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
mntlty merged 3 commits intomainfrompretty_print_json
Apr 5, 2025
Merged

pretty print json#114

mntlty merged 3 commits intomainfrompretty_print_json
Apr 5, 2025

Conversation

mntlty
Copy link
Collaborator

@mntltymntlty commentedApr 5, 2025
edited
Loading

  • create a config struct for running the server
  • pretty print json

Closes:#113

Introduces a new flagpretty-print-json which will format json output from the server for easier visualization.
As the list of configuration options was growing, I opted to add a config struct instead of adding one more to the pile.

(partial output in the screenshot below)
Screenshot 2025-04-04 at 5 30 41 PM

With all of this code in main, there isn't a good way to add tests here and it felt a bit out of place to add to pkg/github/server.go
A refactor would be very helpful to make this easier.

I did not add a new option to the launch.json for it, as I feel like it is still best to be disabled by default.

A future enhancement might be to incorporatehttps://github.com/cli/go-gh/blob/61bf393cf4aeea6d00a6251390f5f67f5b67e727/pkg/jsonpretty/format.go

@CopilotCopilotAI review requested due to automatic review settingsApril 5, 2025 00:36
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 adds a new configuration option to pretty print JSON output from the server and refactors the server setup to use a dedicated configuration struct.

  • Introduces a runConfig struct to encapsulate server configuration options.
  • Adds a pretty-print-json flag and implements JSONPrettyPrintWriter for pretty printing JSON output.
Comments suppressed due to low confidence (2)

cmd/github-mcp-server/main.go:123

  • Add tests for JSONPrettyPrintWriter to validate the pretty printing behavior with various JSON inputs, including invalid JSON scenarios.
func (j JSONPrettyPrintWriter) Write(p []byte) (n int, err error) {

cmd/github-mcp-server/main.go:131

  • Consider adding tests for runStdioServer to verify that all configuration options (including the new pretty-print-json flag) are correctly handled.
func runStdioServer(cfg runConfig) error {

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab.Learn more

@@ -95,15 +107,36 @@ func initLogger(outPath string) (*log.Logger, error) {
return logger, nil
}

func runStdioServer(readOnly bool, logger *log.Logger, logCommands bool, exportTranslations bool) error {
type runConfig struct {
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably just call thisconfig but other than that lgtm!

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

going to leave it so you don't have to do another review

@mntltymntlty merged commit270bbf7 intomainApr 5, 2025
14 checks passed
@mntltymntlty deleted the pretty_print_json branchApril 5, 2025 00:59
@mntltymntlty mentioned this pull requestApr 8, 2025
manian0430 pushed a commit to ChrisLally/github-mcp-server that referenced this pull requestApr 12, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@tobytobytoby 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.

Add support for pretty printing json output
2 participants
@mntlty@toby

[8]ページ先頭

©2009-2025 Movatter.jp