gh-copilot
gh-copilot copied to clipboard
[FEAT]: Copilot output as JSON format
Describe the need
I would like to be able to choose the output type of the copilot command (JSON for example) to be able to parse the result easily. For example for a script to generate messages for git commit.
Relevant terminal output
$ gh copilot suggest "write a commit message for the x.go file following this modification $(git diff x.go)"
{ "suggest_result": "Update ttt function ....." }
With this, we can have a script like this:
#!/bin/bash
files=$(git status --porcelain | awk '{print $2}')
for file in $files; do
echo "Analise file: $file"
prompt="Write a commit message for this file $file with this modification $(git diff $file)"
commit_message=$(gh copilot suggest --json $prompt | jq -r '.suggest_result')
echo "Commit message for $file: $commit_message"
done
I would also love to have the option to just return the message without the details (update available, welcome, ...)
I want to call (--quiet):
gh copilot explain -q "summarize this changes: $(git diff $(git merge-base main head))"
# or
gh pr create \
-t "$(gh copilot explain -q "summarize this changes as short title: $(git diff $(git merge-base main head))")" \
-b "$(gh copilot explain -q "summarize this changes: $(git diff $(git merge-base main head))"
Em ter., 18 de fev. de 2025 às 12:31, Martyn Messerli < @.***> escreveu:
I would also love to have the option to just return the message without the details (update available, welcome, ...)
I want to call (--quiet):
gh copilot explain -q "summarize this changes: $(git diff $(git merge-base main head))"
or
gh pr create -t "$(gh copilot explain "summarize this changes as short title: $(git diff $(git merge-base main head))")" -b "gh copilot explain -q "summarize this changes: $(git diff $(git merge-base main head))"
— Reply to this email directly, view it on GitHub https://github.com/github/gh-copilot/issues/70#issuecomment-2666062193, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLWMSGX4IGE2PGE5BE4NYYL2QNG6BAVCNFSM6AAAAABXL57QWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRWGA3DEMJZGM . You are receiving this because you are subscribed to this thread.Message ID: @.***> [image: messerm]messerm left a comment (github/gh-copilot#70) https://github.com/github/gh-copilot/issues/70#issuecomment-2666062193
I would also love to have the option to just return the message without the details (update available, welcome, ...)
I want to call (--quiet):
gh copilot explain -q "summarize this changes: $(git diff $(git merge-base main head))"
or
gh pr create -t "$(gh copilot explain "summarize this changes as short title: $(git diff $(git merge-base main head))")" -b "gh copilot explain -q "summarize this changes: $(git diff $(git merge-base main head))"
— Reply to this email directly, view it on GitHub https://github.com/github/gh-copilot/issues/70#issuecomment-2666062193, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLWMSGX4IGE2PGE5BE4NYYL2QNG6BAVCNFSM6AAAAABXL57QWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRWGA3DEMJZGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>