feat(pr): review with -a/-r/-c, a review create command and the current branch's PR

tea pr review takes gh's review flags: -a/--approve, -r/--request-changes
and -c/--comment, with -b/--body, -F/--body-file and -e/--editor, and
--pending for a review to submit later. --event is hidden but still
accepted, case-insensitively, as approve, approved, request-changes,
request_changes, comment or pending. tea pr review create is the same
command under the name people look for.

The pull request argument is optional and accepts #N, URLs and branch
names; without one, the pull request of the current branch is reviewed.
Without a review type, tea opens the interactive review on a terminal
and otherwise fails with "choose a review type" instead of posting a
comment. Review types given as a subcommand ("tea pr review approve 13")
point at the flag, and approving or requesting changes on one's own pull
request fails before any editor opens.

The interactive review asks for the type first, hiding Approve and
Request changes for the author, then for an inline body that ctrl+e
opens in the configured editor, then offers to annotate the diff, and
confirms with a default of yes. A declined submission keeps the body as
a draft.

Successful reviews report "✓ Approved pull request alice/x#13 (title)"
on a terminal and print the review URL. review submit finds the
caller's pending review when no ID is given, review list and comments
are tables with headers, and dismiss, undismiss, delete, request and
cancel-request say what they did. Every review command has examples and
completes pull request and review IDs.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-11 23:54:45 +02:00
1 parent 70443acce0
commit c5cf6b9ed9
12 files changed
+1159 -439

No files matched your search

-14
View File
@@ -416,7 +416,6 @@ func walkCommands(cmd *cobra.Command, visit func(*cobra.Command)) {
// have yet to complete; see TestHelpTextsAreComplete.
const (
shortsToFix = `
pr review cancel-request
`
examplesToWrite = `
issue attachment delete
@@ -472,19 +471,6 @@ const (
pr list
pr merge
pr reopen
pr review
pr review cancel-request
pr review comments
pr review delete
pr review dismiss
pr review list
pr review reply
pr review request
pr review resolve
pr review submit
pr review undismiss
pr review unresolve
pr review view
pr status
pr view
search issue