Add a way to output the `--dry-run` flag as a JSON
Describe the feature or problem you’d like to solve
It would be great if I could run something like
gh pr create --dry-run --json
and get the output as a json.
This feature would help a lot when creating libraries that wrap the gh cli project.
Proposed solution
I've yet to look at the source code, but I guess that the json creation part has already been done (since I suppose that github uses JSON for its API)
👋 Hey @seujorgenochurras
This feature would help a lot when creating libraries that wrap the gh cli project.
Could you expand on this use case a bit please? 🙏 Do you have any links to public code where this feature might be helpful?
👋 Hey @seujorgenochurras
This feature would help a lot when creating libraries that wrap the gh cli project.
Could you expand on this use case a bit please? 🙏 Do you have any links to public code where this feature might be helpful?
I'm creating an extension where I want to send my PR data to an AI so the user can tell the AI to do stuff such as changing the body of the PR, changing its title and so on.
I could do a lot of things to solve this problem like running the git commands to get the info I need or letting gh create the pr as a draft and then using the API to get it as JSON and edit the PR as needed.
But I believe that if the gh cli had this option to run dry and return as JSON, it would be easier.
I also believe that if I wanted to create a library that wraps some of the gh cli functionality it would be easier to run every prompt as dry and getting the result as json.
@seujorgenochurras : I love hearing stories like this, seeing how our community is building extensions! ❤
I'm creating an extension where I want to send my PR data to an AI so the user can tell the AI to do stuff such as changing the body of the PR, changing its title and so on.
I could do a lot of things to solve this problem like running the git commands to get the info I need or letting gh create the pr as a draft and then using the API to get it as JSON and edit the PR as needed.
But I believe that if the gh cli had this option to run dry and return as JSON, it would be easier.
I also believe that if I wanted to create a library that wraps some of the gh cli functionality it would be easier to run every prompt as dry and getting the result as json.
Personally, I'm interested in exploring if/how gh might expose commands and extensions as tools and resources via MCP for other tools to use, which would be no small feat.
Recently, the github/github-mcp-server project announced public preview of remote GitHub MCP server. I haven't explored how much PR information is exposed as resources and what tools are exposed for interacting with them, but this might be an option using something like mark3labs/mcp-go module.