Copilot Review
Sends the current git diff to copilot for review and displays the result.
Procedure
Get the diff based on the scope argument:
Argument Command none / allgit diff HEADstagedgit diff --stagedunstagedgit diffref/branch git diff <ref>...HEADIf the diff is empty, tell the user there are no changes to review.
Write the diff to a temp file and call
copilot.
The table above maps each scope to the rightgit diffcommand; substitute accordingly:TMPFILE=$(mktemp) trap 'rm -f "$TMPFILE"' EXIT git diff HEAD > "$TMPFILE" # replace with scoped command from table above copilot -p "Please review the diff at $TMPFILE and give feedback on bugs, security issues, and code quality." \ --allow-tool='read' --add-dir "$(dirname $TMPFILE)" -sDisplay Copilot's output to the user.